代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。
原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html
四十六.树桩继续长成树
用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/evergreens.lua文件,
1.将下列内容:
local function chop_down_tree(inst, chopper)
inst:RemoveComponent("burnable")
MakeSmallBurnable(inst)
inst:RemoveComponent("propagator")
MakeSmallPropagator(inst)
inst:RemoveComponent("workable")
替换为:
MakeLargeBurnable(inst)
MakeLargePropagator(inst)
2.将下列内容:
RemovePhysicsColliders(inst)
inst.AnimState:PushAnimation(inst.anims.stump)
inst:AddComponent("workable")
inst.components.workable:SetWorkAction(ACTIONS.DIG)
inst.components.workable:SetOnFinishCallback(dig_up_stump)
inst.components.workable:SetWorkLeft(1)
inst:AddTag("stump")
if inst.components.growable then
inst.components.growable:StopGrowing()
end
替换为:
inst.AnimState:PushAnimation(inst.anims.stump)
即可让树桩继续长成树,取消用铲子挖树桩,如果不想要树桩了,烧掉即可。注意这种再生树不会烧成枯树,烧完只会剩一团灰。不要与“砍树无树桩”一同修改