代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。

原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html


 1
 2九十七.养殖兔子(用兔子种兔子洞、兔子可堆叠)
 3
 4	MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/rabbit.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:
 5
 6local function OnDeploy (inst, pt)
 7	SpawnPrefab("rabbithole").Transform:SetPosition(pt.x, pt.y, pt.z)
 8	inst.components.stackable:Get():Remove()
 9end
10	inst:AddComponent("deployable")
11	inst.components.deployable.ondeploy = OnDeploy
12	inst:AddComponent("stackable")
13	inst.components.stackable.maxsize = TUNING.STACK_SIZE_LARGEITEM
14
15	即可种兔子得兔子洞、兔子可堆叠