-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 cow milking from cows from old saves with old milk not raw milk. #37965
Conversation
Would be better to fix once while loading the monster. That way you only have one place to change, instead of changing three places. It also seems the code will spawn "milk" (not "raw milk") when the old save is used (it takes the item id directly form the content of the ammo map, if that map still contains "milk", the spawned item will be milk). |
Yep, I considered taking this opportunity to convert it to the new format of raw_milk, but thought people might not want that, but you think its preferable to convert ? And yes Ill change to fix once when loading. |
That would lead to inconsistency, which will be seen and reported as bugs: In old saves, existing cows given "milk", but newly spawned cows give "raw milk". |
Theres some complications here, in the linked issues attached save, the sheep in that save must be very old, they have no starting ammo defined for their type at all, so they musta been spawned prior to 2018 when sheep milking went in. And yet, they have the new milkable flag, but not the starting_ammo. So I cannot give their udders milk_raw on load, when there is no starting ammo amount defined for how much to give them, only solution there I think, is just to exit early without a debugmsg, with a player message. But I can still update old milk into milk_raw on load. |
Fixed to update on load once. |
I suggest the following: When the monsters are checked for consistency ( When milking a monster, check it's actually milkable (via the flag) - this is probably already done. Afterwards, if it does not have raw milk in the starting ammo list, just add it. At this point it does not matter. It is milkable (according to the flag), so it should contain milk. Maybe add a debug message there in case it happens again and again on the same monster. |
… case of upgrading milk to raw_milk
This is pretty much what ive ended up doing, added some checks to check_monster_definitions. Seemed silly to restrict it to milk_raw, when the JSOn allowed any item to be defined, so Ive just added a check if its a liquid item to the definition checker. and that there isnt more than one. |
Summary
SUMMARY: Bugfixes "Fix cow milking from cows from old saves with old milk not raw milk."
Purpose of change
Fixes #37899
Describe the solution
In the milking PR, I forgot that cows used to produce
milk
notraw_milk
so the functions to find raw_milk in their ammo failed, producing debugmsgs.Well theres no point crying over spilt milk, so heres a fix.
It looks for raw_milk, if that fails, it then looks for milk, and goes with that.
I coulda taken this opportunity to convert their udders to raw milk, but I guess some people prefer their old milk in their old saves, and once that cows been milked theres no point trying to squirt it back up the udders, so ill let them keep their milk.
Describe alternatives you've considered
N/A
Testing
Loaded attached save in linked issue, now no errors, and milking works nad produces milk, not raw milk
Additional context
N/A