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

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


 1
 2四十一.用普通种子种胡萝卜且一次采10个(胡萝卜田)
 3
 4	1.MT管理器打开游戏目录/assets/scripts/prefabs/seeds.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:
 5
 6local function OnDeploy (inst, pt)
 7	SpawnPrefab("carrot_planted").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
13
14	2.MT管理器打开游戏目录/assets/scripts/prefabs/carrot.lua文件,将inst.components.pickable:SetUp("carrot", 10)替换为inst.components.pickable:SetUp("carrot", 10, 10)
15
16	即可用普通种子种胡萝卜且一次采10个。拿起种子在空地上按鼠标右键即可种植,冬天也有青菜吃