Jump to content

Is it possible to make a code to change an item into another item after cooling?


blackteapie

Recommended Posts

There is a string of code: "ReplaceOnCooked". This code could make the item change into another item after it was fully heated.

So is it possible to make a string of code whose effect is exactly backward to ReplaceOnCooked, to change a item after it was fully cooled down?

Which lua file or string of lua codes should I looking for?

:shock:

Link to comment
Share on other sites

You'll need to write your own system for it. The concept you want is basicly add an 'on/off' context option to the fridge, give it a moddata of "on" and add that fridge to a table (or "off" when turned off, and remove it from the table). Then have an onTick event, or a EveryTenMinutes event (the latter is ingame time, not real time minutes), loop through the fridges in your table, check the items in it for their temperature, and if it's the right temperature for long enough (you can use a moddata for how many ticks it's been cooled), you remove the item, and add the one you want to change it too.

Bonus things you could add are using the "LoadGridsquare" to check if there is a fridge on it, or the "OnObjectAdded" whether that object is a fridge, and add that to the table.

You'll also need to create your own tooltip intigration for a "freezing" bar.

 

Here is the code to check if the fridge has power:

if object:getSquare():haveElectricity() or (SandboxVars.ElecShutModifier > -1 and GameTime:getInstance():getNightsSurvived() < SandboxVars.ElecShutModifier) then

Good luck, I'm eager to see what you make of it!

Link to comment
Share on other sites

You'll need to write your own system for it. The concept you want is basicly add an 'on/off' context option to the fridge, give it a moddata of "on" and add that fridge to a table (or "off" when turned off, and remove it from the table). Then have an onTick event, or a EveryTenMinutes event (the latter is ingame time, not real time minutes), loop through the fridges in your table, check the items in it for their temperature, and if it's the right temperature for long enough (you can use a moddata for how many ticks it's been cooled), you remove the item, and add the one you want to change it too.

Bonus things you could add are using the "LoadGridsquare" to check if there is a fridge on it, or the "OnObjectAdded" whether that object is a fridge, and add that to the table.

You'll also need to create your own tooltip intigration for a "freezing" bar.

 

Here is the code to check if the fridge has power:

if object:getSquare():haveElectricity() or (SandboxVars.ElecShutModifier > -1 and GameTime:getInstance():getNightsSurvived() < SandboxVars.ElecShutModifier) then

Good luck, I'm eager to see what you make of it!

:shock: Looks like it is quite complicated.

I hope I can get it done.

Link to comment
Share on other sites

You'll need to write your own system for it. The concept you want is basicly add an 'on/off' context option to the fridge, give it a moddata of "on" and add that fridge to a table (or "off" when turned off, and remove it from the table). Then have an onTick event, or a EveryTenMinutes event (the latter is ingame time, not real time minutes), loop through the fridges in your table, check the items in it for their temperature, and if it's the right temperature for long enough (you can use a moddata for how many ticks it's been cooled), you remove the item, and add the one you want to change it too.

Bonus things you could add are using the "LoadGridsquare" to check if there is a fridge on it, or the "OnObjectAdded" whether that object is a fridge, and add that to the table.

You'll also need to create your own tooltip intigration for a "freezing" bar.

 

Here is the code to check if the fridge has power:

if object:getSquare():haveElectricity() or (SandboxVars.ElecShutModifier > -1 and GameTime:getInstance():getNightsSurvived() < SandboxVars.ElecShutModifier) then

Good luck, I'm eager to see what you make of it!

Hope this won't bother you too much.

Do you know which lua string or strings are related to ReplaceOnCooked string?

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