中级玩家
- 贡献度
- 13
- 金元
- 946
- 积分
- 147
- 精华
- 0
- 注册时间
- 2011-5-11
|
首先感谢blackgodx的无私奉献,修改器参见原帖:
[首发]《饥荒》全版本通用内置修改器。纯脚本。(更新若干新功能2/19)
http://bbs.3dmgame.com/forum.php?mod=viewthread&tid=3530975&fromuid=3455207
拿过来后发现用着不是很顺手,只支持10个物品创建,而且修改后必须保存游戏再读档重进,于是简单修改了下:
(添加到main.lua的末尾)
----from here
temp_copy_entity = nil;
-- copy inst
TheInput:AddKeyUpHandler(KEY_C, function()
if TheInput:IsKeyDown(KEY_CTRL) then
local target = nil
local ent = TheInput:GetWorldEntityUnderMouse()
if ent and not ent:HasTag("player") then
target = ent
end
temp_copy_entity = target
end
end
);
-- paste inst
TheInput:AddKeyUpHandler(KEY_V, function()
if TheInput:IsKeyDown(KEY_CTRL) and temp_copy_entity ~= nil then
if temp_copy_entity.prefab ~= "" then
local inst = Spawn(temp_copy_entity.prefab)
inst.Transform:SetPosition(TheInput:GetMouseWorldPos():Get())
end
end
end
);
-- del inst
TheInput:AddKeyUpHandler(KEY_D, function()
if TheInput:IsKeyDown(KEY_CTRL) and temp_copy_entity ~= nil then
temp_copy_entity:Remove()
temp_copy_entity = nil
end
end
);
-- move inst
TheInput:AddKeyUpHandler(KEY_X, function()
if TheInput:IsKeyDown(KEY_CTRL) and temp_copy_entity ~= nil and temp_copy_entity.Transform then
temp_copy_entity.Transform:SetPosition(TheInput:GetMouseWorldPos():Get())
end
end
);
--to here
大意是Ctrl+C 复制鼠标指向的对象,Ctrl+V 复制一份到鼠标位置,Ctrl+D是删除(不要乱用!), Ctrl+X自然是把刚复制的对象移动到鼠标制定位置。
最近简单读了下游戏的源码和结构,发现还是很好懂的,简单改了几个像蜂巢存储蜂蜜上限和背包特异功能等,觉得这游戏就是用来改的嘛~
最后还是得郑重提醒: 修改游戏会导致游戏失去初始的乐趣,不喜勿入!
|
|