代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。
原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html
四十.收割者(吹排箫一次采集周边所有植物)
用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/panflute.lua文件,
1.将下列内容:
local function HearPanFlute(inst, musician, instrument)
if inst.components.sleeper then
inst.components.sleeper:AddSleepiness(10, TUNING.PANFLUTE_SLEEPTIME)
end
end
替换为:
local function HearPanFlute(inst, musician, instrument)
local pos = Vector3(inst.Transform:GetWorldPosition())
local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 30)
for k,v in pairs(ents) do
if v.components.pickable and v.prefab ~= "flower" then
v.components.pickable:Pick(GetPlayer())
end
if v.components.crop then
v.components.crop:Harvest(GetPlayer())
end
end
end
2.将下列内容:
inst.components.instrument.range = TUNING.PANFLUTE_SLEEPRANGE
inst.components.instrument:SetOnHeardFn(HearPanFlute)
inst:AddComponent("tool")
inst.components.tool:SetAction(ACTIONS.PLAY)
inst:AddComponent("finiteuses")
inst.components.finiteuses:SetMaxUses(TUNING.PANFLUTE_USES)
inst.components.finiteuses:SetUses(TUNING.PANFLUTE_USES)
inst.components.finiteuses:SetOnFinished( onfinished)
inst.components.finiteuses:SetConsumption(ACTIONS.PLAY, 1)
替换为:
inst.components.instrument:SetOnHeardFn(HearPanFlute)
inst:AddComponent("tool")
inst.components.tool:SetAction(ACTIONS.PLAY)
即可吹排箫一次采集周边所有植物(除了花),包括农田也可以收割,排箫原有催眠功能取消。排箫在魔法选项(画着红骷髅)下用5个芦苇、1个曼德拉草、1个绳子制造。如果觉得曼德拉草不好找,可以按本修改技巧“用便便种曼德拉草”修改一下