Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smarter defrost for items EATEN_COLD #25383

Merged
merged 1 commit into from
Sep 5, 2018

Conversation

cake-pie
Copy link
Contributor

@cake-pie cake-pie commented Sep 5, 2018

Summary

SUMMARY: Features "Smarter defrosting for comestibles EATEN_COLD"

Purpose of change

Fixes #25375 - Smarter defrosting for comestibles EATEN_COLD.

Describe the solution

If defrosting an item that is enjoyable when consumed cold, spend less time heating it, going from FROZEN to COLD rather than all the way to HOT.

Set the item_counter depending on ambient temperature at player position.
COLD becomes FROZEN if it hits 600, and item ceases to be COLD if it falls to 0.
Therefore, in a cold environment, avert re-freezing by setting item_counter = 50
Whereas in a warm environment set item_counter = 550

Additional context

Decided to go ahead and PR this since @nexusmrsep wouldn't be able to get to it until next week.
This is a first pass at the problem, might need tweaked depending on how it plays out in practice.

@ZhilkinSerg ZhilkinSerg merged commit 8038005 into CleverRaven:master Sep 5, 2018
@cake-pie cake-pie deleted the smartdefrost branch September 5, 2018 21:31
@nexusmrsep
Copy link
Contributor

Freezing scales with larger temperature differences, so you took some risks here setting counter in cold ambients to 50, as it translates to 5 minutes of cold food in best conditions and about 1,5 minutes of cold food in worst conditions.

@cake-pie
Copy link
Contributor Author

cake-pie commented Sep 6, 2018

Freezing scales with larger temperature differences, so you took some risks here setting counter in cold ambients to 50, as it translates to 5 minutes of cold food in best conditions and about 1,5 minutes of cold food in worst conditions.

Pretty sure you're confused here.

HOT counts down toward normal which is why in #24880 and #24905 you've been increasing the counter -- you want it to take longer to cool down and re-freeze.

However COLD counts up toward FROZEN, so in cold ambient environment, you want the counter to be lower, not higher, to give more time before re-freeze. Setting counter to 50 means it has to reach 600 before freezing. Theoretically, that's between 13.75min and 55min.

Before submitting this PR I had empirically tested -- savescumming to ensure identical conditions -- and verified that my understanding is correct: immediately placing a freshly thawed plastic bottle of lemonade back into a minifreezer takes 2:36 to freeze if counter is set to 550, and 19:00 if counter is set to 50.

In the extreme, the counter could be set to 1 to permit maximum delay before refreeze, but I think it is better to be conservative and have a bit of buffer in case of unforeseen situations where the food is moved to a hotter environment soon after thawing and could potentially cease to be COLD quite quickly. (Worst case 1.5min with counter = 50)

Let's see how this works out. If 13.75min before re-freeze isn't good enough, i.e. in extremely cold environment and/or large batch heating, then a more robust solution will be needed.
I think that would likely have to involve one or both of:

  1. actually set the counter at the completion of heating rather than at the start

and/or

  1. use a dedicated flag for "recently thawed" to delay cooling and re-freeze instead of overloading HOT to serve that purpose

@nexusmrsep
Copy link
Contributor

nexusmrsep commented Sep 6, 2018

Yes, you were right here, and without my rig at hand I mixed up directions where counters are going. Process always removes counters but freeze mechanics adds it back, so it goes in opposite direction in appropriate temperatures, sorry about that, and thanks for pointing that out.

Also: option nr 1 would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants