-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix foods getting negative rot when the date of cataclysm is not zero #33345
Fix foods getting negative rot when the date of cataclysm is not zero #33345
Conversation
Maybe a more complete fix would be to make sure that when an item is created its |
Ok I did the more complete fix I mentioned above. |
time_duration spoil_variation = get_shelf_life() * 0.2f; | ||
rot += factor * rng( -spoil_variation, spoil_variation ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was it intentional to remove the multiplication by factor
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The factor is only applied to field dressed corpses. AFAIK none of those exist at the beginning of the cataclysm.
And if they do exist I think that shouldn't reduce the range of random variation the item can have.
Summary
SUMMARY: Bugfixes "Fix food getting negative rot when start date is set to not zero"
Purpose of change
Fixes: #33338
Describe the solution
Items spawned during mapgen had their bday at
calendar::turn_zero
(day 0).The cataclysm may occur at some later date (default day 30).
Rot calculation made some bad assumptions about how the last rot check is related to the occurence of the cataclysm.
Result was that the spawned items would get (potentially massive) negative rot when they were processed from
calendar::turn_zero
tocalendar::start_of_cataclysm
.Items having bday at
calendar::turn_zero
is wrong practically always. Items that exist at the start of the game should have bday atcalendar::start_of_cataclysm
.Now they have their bday at
calendar::start_of_cataclysm
.The whole thing about
calendar::start_of_cataclysm
in rot calculations was probably originally meant to fix this issue. This is better solution so it has been removed.Describe alternatives you've considered
Work around the wrong bday in other places:
calendar::start_of_cataclysm
. There may be valid uses for bday before that and it would just hide wrong bdays being set somewhere.Additional context
I don't know why
time = std::min( { last_rot_check, last_temp_check } );
has curly bracets. It seems to work even without them ( last_rot_check, last_temp_check being different from each other is really rare so it will be really hard to notice if this breaks something ).