3DMGAME 3DM首页 新闻中心 前瞻 | 评测 游戏库 热门 | 最新 攻略中心 攻略 | 秘籍 下载中心 游戏 | 汉化 购买正版 论坛

注册 登录

QQ登录

只需一步,快速开始

查看: 7553|回复: 8
打印 上一主题 下一主题

[修改] 通用内置修改器的一点小修改

  [复制链接]

3

主题

40

帖子

147

积分

中级玩家

Rank: 3Rank: 3

贡献度
13
金元
946
积分
147
精华
0
注册时间
2011-5-11
跳转到指定楼层
主题
发表于 2013-5-2 21:58 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
首先感谢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自然是把刚复制的对象移动到鼠标制定位置。

最近简单读了下游戏的源码和结构,发现还是很好懂的,简单改了几个像蜂巢存储蜂蜜上限和背包特异功能等,觉得这游戏就是用来改的嘛~

最后还是得郑重提醒: 修改游戏会导致游戏失去初始的乐趣,不喜勿入!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|3DMGAME ( 京ICP备14006952号-1  沪公网安备 31011202006753号

GMT+8, 2026-3-25 08:12 , Processed in 0.024230 second(s), 16 queries , Memcached On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表