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

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


 1
 2四十.收割者(吹排箫一次采集周边所有植物)
 3
 4	MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/panflute.lua文件
 5
 6	1.将下列内容:
 7
 8local function HearPanFlute(inst, musician, instrument)
 9	if inst.components.sleeper then
10		inst.components.sleeper:AddSleepiness(10, TUNING.PANFLUTE_SLEEPTIME)
11	end
12end
13
14	替换为:
15
16local function HearPanFlute(inst, musician, instrument)
17	local pos = Vector3(inst.Transform:GetWorldPosition())
18	local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 30)
19	for k,v in pairs(ents) do
20		if v.components.pickable and v.prefab ~= "flower" then
21		   v.components.pickable:Pick(GetPlayer())
22		end
23		if v.components.crop then
24		   v.components.crop:Harvest(GetPlayer())
25		end
26	end
27end
28
29
30	2.将下列内容:
31
32	inst.components.instrument.range = TUNING.PANFLUTE_SLEEPRANGE
33	inst.components.instrument:SetOnHeardFn(HearPanFlute)
34	
35	inst:AddComponent("tool")
36	inst.components.tool:SetAction(ACTIONS.PLAY)
37	
38	inst:AddComponent("finiteuses")
39	inst.components.finiteuses:SetMaxUses(TUNING.PANFLUTE_USES)
40	inst.components.finiteuses:SetUses(TUNING.PANFLUTE_USES)
41	inst.components.finiteuses:SetOnFinished( onfinished)
42	inst.components.finiteuses:SetConsumption(ACTIONS.PLAY, 1)
43
44	替换为:
45
46	inst.components.instrument:SetOnHeardFn(HearPanFlute)
47	inst:AddComponent("tool")
48	inst.components.tool:SetAction(ACTIONS.PLAY)
49
50	即可吹排箫一次采集周边所有植物(除了花),包括农田也可以收割,排箫原有催眠功能取消。排箫在魔法选项(画着红骷髅)下用5个芦苇、1个曼德拉草、1个绳子制造。如果觉得曼德拉草不好找,可以按本修改技巧“用便便种曼德拉草”修改一下