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

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


 1
 2九十三.喂牛蔬菜无限产黄油
 3
 4	MT管理器打开游戏目录/assets/scripts/prefabs/beefalo.lua文件,在inst.components.eater:SetVegetarian()的下一行插入以下内容:
 5
 6local function OnGetItemFromPlayer(inst, giver, item)
 7	if item.components.edible.foodtype == "VEGGIE" then
 8	   SpawnPrefab("butter").Transform:SetPosition(inst.Transform:GetWorldPosition())	
 9	end
10end
11	inst:AddComponent("trader")
12	inst.components.trader.onaccept = OnGetItemFromPlayer
13
14	即可喂牛胡罗卜、浆果等蔬菜无限产黄油,相当于挤牛奶