Jump to content

Recommended Posts

So, at the moment, I am currently making a mod that will add all sort of things, mostly chest related, into the game.

 

But at the moment I am stuck on one I am working on.

You see, I am making a object that cooks any food that you put it (not Crockpot cook, but like Raw Meat to Cooked Meat), which I can figure out, but I also want to make it where if the person leaves the food in there, it will perish multiplier rate of 2.

 

So far, the highest I have found for perish (excluding RoG) is "PERISH_GROUND_MULT = 1.5"...

 

I really can't change that without messing with the rest of normal game play, so does anyone know how I can create something that allows for a Perish rate of x2?

 

There's a mod called "Additional Structures" for Don't Starve that adds a thing called the "perish box", it causes things to spoils faster.

Well, I went and looked at that mod, but it changes the perishable.lua file, which I am trying to avoid (seeing as it can make things incompatible).

 

Though, it seems it might be the only thing I can do. .-.

How does the icebox do it?

It modifies the local function "Update" in perishable.lua by overriding the file. The Update function is (originally) called within multiple functions in the perishable.lua file itself. (Perishable:LongUpdate and Perishable:StartPerishing)

 

 

@FryoKnight Perhaps you'd wanna consider changing perishable.perishtime and perishable.perishremainingtime instead? It's kinda hacky, but somewhat more reliable than changing the whole file.

local function CustomPerish(inst, data)    -- inst = instance of item that can perish    -- data.percent = current perish percent    -- You can modify perishtime, use perishable:ReducePercent, or perishable:SetPercent    -- Remember to calculate it properly according to the old percentageend-- inst = instance of item that can perish-- Start listening (and modifying)-- When item is put into the boxinst:ListenForEvent("perishchange", CustomPerish)-- Stop listening-- When item is removed from the boxinst::RemoveEventCallback("perishchange", CustomPerish)

Check "..\components\perishable.lua" to see how the component works.

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...