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

clean water goes bad if left in open container #74353

Merged
merged 8 commits into from
Jun 14, 2024

Conversation

nornagon
Copy link
Contributor

@nornagon nornagon commented Jun 6, 2024

Summary

Content "Clean water in open containers reverts to water after a while"

Purpose of change

Continuation from #72252 (comment).
If in an open container, eventually clean water (or spring or mineral water) will accumulate some environmental bacteria and become slightly dangerous to drink.

Ref #72.

Describe the solution

This doesn't use the rot system because:

  1. That makes "clean water" show up as a perishable, which is a bit weird, and
  2. spoil_multiplier isn't quite the right system to model this—e.g. a 3L glass
    jar with a lid on will happily preserve clean water basically forever, but
    it has no spoil_multiplier unless sealed.

Instead, I've added a new DECAYS_IN_AIR flag that will use an item's
revert_to field to convert to a different item after it's been exposed to
atmosphere for long enough (defined by an item property
max_air_exposure_hours). This is calculated similarly to rot, but slightly
randomized to avoid all clean water decaying at the same moment.

"exposed to atmosphere" here is defined as not in a container that
can_contain_liquid( false ), i.e. a container that's watertight even if it's
in another container. (This excludes items like a drinking glass, which is
watertight but can't be packed and still hold its contents.)

Describe alternatives you've considered

Clean water could become a perishable (with a long shelf life) and use regular
spoil rules. This would be simpler and more visible to the player, but would be
a less realistic model.

Instead of using watertight to define "exposed to atmosphere", we could use the
airtight flag. However, a lot of totally fine watertight containers for
storing water aren't listed as airtight, e.g. 2lcanteen, 30gal_barrel,
bag_zipper, etc.

Testing

I tested:

  1. water_clean in a stock pot, after the max_air_exposure_hours, it turned into water.
  2. water_clean in a glass jar, after the max_air_exposure_hours, it turned was still water_clean.

Not yet tested:

  • water_clean in a water heater shouldn't decay
  • water_clean in an open container in a fridge or vehicle fridge shouldn't decay
  • frozen water_clean shouldn't decay
  • putting partly decayed water_clean into a closed container should stop the decay. returning it to an open container should resume the decay.
  • when outside the player's reality bubble, decay should still happen.

Additional context

@github-actions github-actions bot added [JSON] Changes (can be) made in JSON [C++] Changes (can be) made in C++. Previously named `Code` Items: Containers Things that hold other things labels Jun 6, 2024
@github-actions github-actions bot added json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Jun 6, 2024
@Procyonae
Copy link
Contributor

If you have 1 clean water in a stock pot and leave it a while and then try to add another 1 clean water that hasn't been exposed yet what happens?

@nornagon
Copy link
Contributor Author

nornagon commented Jun 6, 2024

If you have 1 clean water in a stock pot and leave it a while and then try to add another 1 clean water that hasn't been exposed yet what happens?

merging liquids is generally pretty poorly defined (e.g. if one of them is poisoned and the other isn't, one of the two liquids will have its poison count kept and the other thrown away, I forget if it's the one being added or the one being added to which is kept). So I somewhat intentionally didn't try to solve that here. However, it ought to take a weighted average based on volume.

@Procyonae
Copy link
Contributor

I'm not too worried about how it works exposure time wise as long as it lets you merge them and stacks in the UIs and the first water doesn't transform independently of the first causing something to spill or an error etc

@fairyarmadillo
Copy link
Contributor

IMO you should include a check for whether the tile is outdoors and cut the rate of decay if it is. A lot of baterial pollutants are coming from rain or animals getting into the water, and if it's indoors that's going to be reduced.

@nornagon
Copy link
Contributor Author

nornagon commented Jun 6, 2024

I'm not too worried about how it works exposure time wise as long as it lets you merge them and stacks in the UIs and the first water doesn't transform independently of the first causing something to spill or an error etc

Oh, yeah, the status is invisible in the UI. Indistinguishable.

Also, I just discovered that item_counter is merged when merging charges, though not when combining items (why are those different??? argh), so I updated the PR to use that instead of an item variable and made item::combine combine item counters. Now air exposure time will correctly be conserved when merging clean water stacks.

@nornagon
Copy link
Contributor Author

nornagon commented Jun 6, 2024

IMO you should include a check for whether the tile is outdoors and cut the rate of decay if it is. A lot of baterial pollutants are coming from rain or animals getting into the water, and if it's indoors that's going to be reduced.

Rain is actually pretty clean, generally contaminants in rainwater come from the collection apparatus and not the water itself. As for animals, I think most indoor locations post-cata will have abundant vermin, so I'm not sure this makes a huge difference?

That said, it's not unreasonable to imagine that there might be a lot more bacteria and detritus floating around in the air outside which is likely to get into the water, and that seems like a decent reason to increase the rate of decay.

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jun 6, 2024
src/item.cpp Outdated Show resolved Hide resolved
src/item.cpp Outdated Show resolved Hide resolved
src/item.h Outdated Show resolved Hide resolved
@fairyarmadillo
Copy link
Contributor

When dealing with rainwater collection, I was told that the primary sources of pathogens were the rain itself, which can have them living on dust particles in the raindrops, birds, snails, and squirrels. You obviously wouldn't want rats and mice in your water barrel, but they live outside, too.

@nornagon
Copy link
Contributor Author

nornagon commented Jun 6, 2024

I was told that the primary sources of pathogens were the rain itself, which can have them living on dust particles in the raindrops, birds, snails, and squirrels

Leaving aside that the vast majority of raindrops never touch a bird, snail or squirrel, it's also true that most rain has such a tiny amount of contamination that it's not worth modeling.

Reference: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3318827/

Of the 50 rainwater samples, 25 were found to be positive for at least one pathogen: 21 for E. coli, 16 for P. aeruginosa, 6 for K. pneumoniae, and 1 for A. hydrophila.

NB. this is positive at all. The experiment used qPCR which is extremely sensitive and likely would have come back positive if there was even a single cell of the pathogen. And half the rainwater samples were negative for all pathogens tested for.

Further,

Some previous studies have reported that roof-harvested rainwater is generally acceptable for drinking and household purposes (12, 13, 16, 26), while more-recent studies have revealed the presence of waterborne pathogens in rainwater samples (1, 3, 11, 22, 34, 35, 43). Differences in the characteristics of the catchment area, the type of water tanks, their cleanliness, and other factors, such as roof material, the intensity of human activities in the catchment area (urban or rural), and the presence of insects and birds on the rooftop, could be responsible for the contradictory results in the literature on the microbial quality of rainwater (10, 17, 18, 34, 39, 46).

this is unclear enough to be an active field of study at least as recently as this paper was published (2012). If there was a significant chance of contracting illness from rainwater, I don't think it would need highly sensitive methods such as qPCR to determine, nor would it be an active area of research.

Granted there is some chance, but close to zero. This is what water now models since #72252.

@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions and removed astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Jun 6, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jun 7, 2024
@fairyarmadillo
Copy link
Contributor

fairyarmadillo commented Jun 7, 2024

I was told that the primary sources of pathogens were the rain itself, which can have them living on dust particles in the raindrops, birds, snails, and squirrels

Leaving aside that the vast majority of raindrops never touch a bird, snail or squirrel, it's also true that most rain has such a tiny amount of contamination that it's not worth modeling.

No, I mean that birds, snails, and squirrels will get into or poop in or on open water containers, and snails are basically parasite factories. These animals don't generally live indoors, but are a major concern.

Indoor vermin exist, but are going to be less interested in standing water than the other animals and, as previously stated, those vermin also live outside. The general expectation would be that more critters would get into an open water barrel if it was left outdoors, thus more likelihood of pathogens.

@nornagon
Copy link
Contributor Author

nornagon commented Jun 7, 2024 via email

data/json/flags.json Outdated Show resolved Hide resolved
Co-authored-by: Brambor <tondadrd@seznam.cz>
@Maleclypse Maleclypse merged commit fd7656a into CleverRaven:master Jun 14, 2024
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Items: Containers Things that hold other things [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants