KernelCore Posted April 27, 2017 Share Posted April 27, 2017 I'm making a DST character mod with the ability to eat rocks and found the following text: -- So you can eat all elementals local eater = inst.components.eater table.insert(eater.preferseating, FOODTYPE.ELEMENTAL) table.insert(eater.caneat, FOODTYPE.ELEMENTAL) eater.inst:AddTag(FOODTYPE.ELEMENTAL.."_eater") local _TestFood = eater.TestFood eater.TestFood = function(self, food, testvalues) -- So you can only eat rocks, out of all stuff of the elementals group if food and food.components.edible and food.components.edible.foodtype == FOODTYPE.ELEMENTAL then return food.prefab == "rocks" end return _TestFood(self, food, testvalues) end -- So you benefit for eating rocks eater.oneatfn = function(inst, food) if food and food.prefab == "rocks" then -- rocks give 1 hunger back by default, 1 + 9 = 10 inst.components.hunger:DoDelta(9) end end It works well and I figured out how to manipulate it for other values. The problem I have right now is how my character can eat other elementals. How can I limit this to just rocks? I've included the main lua file and the entire mod folder in 2 separate uploads. goatroo.lua goatroo 2.zip Link to comment Share on other sites More sharing options...
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!Register a new account
Already have an account? Sign in here.Sign In Now