Jump to content

[Character mod help] Refusing to eat stale/spoiled food.


Recommended Posts

I'm close to finishing up my character mod for DTS and the last thing I want to give my character for her final perk is that she will straight up refuse to eat stale and spoiled food.

I figure the way of getting it to work would be mess with Wigfred's code (since she only eats meat) but i have little experience in coding and can't get it to work properly.

Thank you in advance!

Link to comment
Share on other sites

AddPrefabPostInit("customchar", function(inst)
	if inst.components.eater then
		local Old_CanEat = inst.components.eater.CanEat
		function inst.components.eater:CanEat(food, ...)
			return food.components.perishable and not (food.components.perishable:IsStale() or food.components.perishable:IsSpoiled())
				and Old_CanEat(self, food, ...)
		end
	end
end)

 

Link to comment
Share on other sites

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

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...