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

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



九十三.喂牛蔬菜无限产黄油

	用MT管理器打开游戏目录/assets/scripts/prefabs/beefalo.lua文件,在inst.components.eater:SetVegetarian()的下一行插入以下内容:

local function OnGetItemFromPlayer(inst, giver, item)
	if item.components.edible.foodtype == "VEGGIE" then
	   SpawnPrefab("butter").Transform:SetPosition(inst.Transform:GetWorldPosition())	
	end
end
	inst:AddComponent("trader")
	inst.components.trader.onaccept = OnGetItemFromPlayer

	即可喂牛胡罗卜、浆果等蔬菜无限产黄油,相当于挤牛奶