Jump to content

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!

  • Like 1
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)

 

On 9/2/2017 at 6:43 AM, waw said:
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)

 

Do me have to change "customchar" into character name too? (´・ω・`)

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
×
  • Create New...