-
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
Allow player to pick up frozen liquids #32763
Allow player to pick up frozen liquids #32763
Conversation
Players should be able to chip or crush ice or other frozen liquids and pick them up and keep them in their inventory as long as they're frozen
Can the picked frozen liquid be larger than one charge? Large frozen items would probably behave a bit strange. They would stay frozen until the whole thing is liquid and then suddenly go all at once. Multiple separate frozen items (that may stack) wouldn't have this problem. Alternatively some melting handling could be made so that as the item melts the melting part is removed from the frozen item. (containers with mixed frozen-liquid contents would be pretty cool too) |
Yes, it's handled through the [g]et menu for now with ability to select number of charges like usual, will need to add a case for [/]advanced inventory as well.
This could potentially be done by extracting one charge, erasing FROZEN tag from it and decreasing the temperature of the original item by a few degrees whenever it rises above melting point. This should work for containers too. There might be issues with that approach that I haven't considered but it was the first thing I could come up with. I'll update the PR with this. |
Partial melting and other features will be part of a larger project concerning frozen liquids and will be handled in separate PRs |
I believe that liquids that you'd pick that way should be also flagged DIRTY in the process. I can't imagine chipping away on frozen soda spilt on the ground, without it getting dirt, dust etc. Mixed up with it. That said, the melting mechanic will be very important as a foundation for later implementation of freezing bodies of water and snow gathering in winter. |
Not all liquids (e.g. water from a toilet) should be dirty when chipped. The application of the DIRTY tag already happens as soon as a comestible liquid is spilt on the ground, however not all liquids get this tag. Perhaps that functionality should be added to things like gasoline if it is indeed possible to get it cold enough to freeze it, chip it and pick it up. This does require a small change to make it unusable as fuel for vehicles however. |
Chipping frozen liquids from a toilet should sometimes lead to breaking said toilet. Swinging a hammer near ceramics is nonono |
Player can't scoop up solid ice with their hands, need something to chip off chunks with
c5f0e4c
to
c479e74
Compare
Missed astyle in last commit
Used default astyle options previously
While the partial melting comes later I'll just give the rough math for it now. It is suprisingly simple actually. Basics:
Freeze percentage is already calculated in the code.
Currently at 50% is the cutoff at which melting/freezing happens for the whole item. With partial melting the cutoff would be based on the number of units of parts in item. For example item with 10 parts you would want to remove one liquid part at 90% freeze_percentage. The removed part would be 100% liquid at freeze temperature. So its specific energy would be: The remaining part would probably be a bit less than 100% frozen so some more math would be needed. Even though the items are "separated" after the part melts you can just handle them are at same temperature until they are really separated and water is dropped on ground. If you want to do liquid+frozen water mixture in bottle the mixture will stay in one temperature as a whole until the thing is completely frozen or completely liquid. |
I'd like to be able to mix liquids in one container and have them affect eachother in different ways, for example adding frozen water to your dark cola that has been standing out in the summer sun for 3 days to make it |
Mixing liquids is out of scope of this PR I believe - remember, the bigger the PR, the less likely it's to get merged. |
Oh absolutely! It's just a dream I have, I may have worded my previous comment weirdly. It depends on other systems yet to be implemented so if it were to ever happen it would definitely NOT be in this PR. This PR is exclusively for the action of picking up existing frozen liquids and the bare minimum features to give it any use whatsoever. However, i am still interested in adding more utility to liquids in the future. |
Adding utility to the ability to pick up frozen liquids and fixing earlier traslation issues. There is still an issue relating to assigning AMMO to frozen liquids, functionality is there though game spits out an error message.
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.
1's are default values for the has_quality
. And hammering level more than 1 could also be used, so no need to specify the level in the message.
Co-Authored-By: Alexey Mostovoy <[email protected]>
Co-Authored-By: Alexey Mostovoy <[email protected]>
Adds function item_with_best_of_quality() to player.h to smash tile with correct tool. Includes advanced inventory support and minor changes to popup clarity and wording
Suggestions from @BevapDin, finishing functionality
a89f6ae
to
181d996
Compare
Apologies for monstrous commit, implemented changes suggested above by @BevapDin. I am aware of a bug with reloading some items and looking for a fix. Apart from that this is starting to feel fairly complete. |
Lines 1087 to 1088 in 181d996
It'd be better to comment it like so: /** Returns true if the item is A: of type LIQUID and if it B: has the FROZEN tag */
bool is_frozen_liquid() const; |
There was previously an accidental typo in player.h, it is now fixed Removed redundant parameter to crush_frozen_liquid() Changed function comments on suggestion of @AMurkin There was a bug where items reloaded after frozen liquid logic wouldn't reload, this has now been resolved.
I'd say this is ready for review. I'm going to run tests locally and unless there are any problems in testing or concerns here this is done and dusted 😁 |
Co-Authored-By: BevapDin <[email protected]>
Co-Authored-By: BevapDin <[email protected]>
Co-Authored-By: ZhilkinSerg <[email protected]>
Co-Authored-By: ZhilkinSerg <[email protected]>
…bi/Cataclysm-DDA into harvest_frozen_liquid
Jenkins rebuild. |
* allow player to pick frozen liquids Players should be able to chip or crush ice or other frozen liquids and pick them up and keep them in their inventory as long as they're frozen
Summary
SUMMARY: Features "Allow player to pick up and handle frozen liquids"
Purpose of change
Closes #28638 - Players should be able to chip or crush ice or other frozen liquids and pick them up and keep them in their inventory as long as they're frozen since they're technically solid.
Describe the solution
Allows picking up liquids with the FROZEN tag
Checks if player has a hammering implement to chip the frozen liquid with
Frozen liquid can be stored in a container, carried away and melted
Advanced inventory handling
Chipping frozen liquids from a toilet should sometimes lead to breaking said toilet. - suggestion by @FuelType-Memes: Performing single (s)mash on tile using hammering item used when picking up frozen liquid risking breakage of fragile furniture or items sharing the tile, Chipping with sledgehammer is riskier, logically
Drop liquid upon melting outside of a container
Error message - frozen fruit juice is not ammo
Prompt for crush on attempting reload with frozen liquid and stop player from reloading frozen liquid from container
Describe alternatives you've considered
Additional context