# Mass water purification

**URL:** <https://discourse.cataclysmdda.org/t/mass-water-purification/1183>\
**Category:** The Lab\
**Created:** [May 11, 2013, 10:02pm UTC](https://discourse.cataclysmdda.org/t/mass-water-purification/1183 "2013-05-11T22:02:40Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![drake1storm](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@drake1storm](https://discourse.cataclysmdda.org/u/drake1storm)\
**Post date:** [May 11, 2013, 10:02pm UTC](https://discourse.cataclysmdda.org/t/mass-water-purification/1183/1 "2013-05-11T22:02:40Z")

</div>

This is a simple mod that allows you to mass purify water.

Here is a quick and dirty version of this mod. This will require you to change the source code (download codeblocks if you want it to compile successfully), unless you know of some place where I can upload the exe for you guys (note, you will still have to replace your recipe.json in your data folder).

place in iuse.cpp just under water\_clean declaration:

[code]DRINK(“water\_cleanx2”,“clean water”, 90, 50, c\_ltcyan, “bottle\_plastic”,  
// QUE NUT SPO STM HTH ADD CHG FUN use\_func addiction type  
50, 0, 0, 0, 0, 0, 2, 0,&iuse::none, ADD\_NULL, “  
Fresh, clean water. Truly the best thing to quench your thirst.”, 0);

DRINK(“water\_cleanx6”,“clean water”, 90, 50, c\_ltcyan, “bottle\_plastic”,  
// QUE NUT SPO STM HTH ADD CHG FUN use\_func addiction type  
50, 0, 0, 0, 0, 0, 6, 0,&iuse::none, ADD\_NULL, “  
Fresh, clean water. Truly the best thing to quench your thirst.”, 0);

DRINK(“water\_cleanx10”,“clean water”, 90, 50, c\_ltcyan, “bottle\_plastic”,  
// QUE NUT SPO STM HTH ADD CHG FUN use\_func addiction type  
50, 0, 0, 0, 0, 0, 10, 0,&iuse::none, ADD\_NULL, “  
Fresh, clean water. Truly the best thing to quench your thirst.”, 0);

DRINK(“water\_cleanx40”,“clean water”, 90, 50, c\_ltcyan, “bottle\_plastic”,  
// QUE NUT SPO STM HTH ADD CHG FUN use\_func addiction type  
50, 0, 0, 0, 0, 0, 40, 0,&iuse::none, ADD\_NULL, “  
Fresh, clean water. Truly the best thing to quench your thirst.”, 0);

DRINK(“water\_cleanx100”,“clean water”, 90, 50, c\_ltcyan, “bottle\_plastic”,  
// QUE NUT SPO STM HTH ADD CHG FUN use\_func addiction type  
50, 0, 0, 0, 0, 0, 100, 0,&iuse::none, ADD\_NULL, “  
Fresh, clean water. Truly the best thing to quench your thirst.”, 0);

CONT(“sealed\_can\_drink”, “resealable aluminum can”, 70, 1, c\_ltblue, STEEL, MNULL,  
1, 0, 0, 0, 1, mfb(con\_rigid)|mfb(con\_wtight)|mfb(con\_seals), “  
An aluminum can with a tie on plastic bag for a cover.”);[/code]

Place this anywhere in your recipe.json:

[code] {  
“result”: “water\_clean”,  
“category”: “CC\_DRINK”,  
“skill\_pri”: “cooking”,  
“difficulty”: 0,  
“time”: 1000,  
“reversible”: false,  
“autolearn”: true,  
“tools”: [  
[  
[“hotplate”, 3],  
[“toolset”, 1],  
[“fire”, -1]  
],  
[  
[“can\_food”,-1],  
[“can\_drink”,-1],  
[“pan”, -1],  
[“rock\_pot”, -1],  
[“pot”, -1],  
[“jerrycan\_big”,-1]  
]  
],  
“components”: [  
[  
[“water”, 1]  
]  
]  
},

```
	{
        "result": "water_cleanx2",
        "category": "CC_DRINK",
        "skill_pri": "cooking",
        "difficulty": 0,
        "time": 2000,
        "reversible": false,
        "autolearn": true,
        "tools": [
                     [
                         ["hotplate", 6],
                         ["toolset", 2],
                         ["fire", -1]
                     ],
                     [
                         ["pan", -1],
                         ["pot", -1],
                         ["rock_pot", -1],
						 ["jerrycan_big",-1]
                     ]
                 ],
        "components": [
                          [
                              ["water", 2]
                          ]
                      ]
    },
	
	{
        "result": "water_cleanx6",
        "category": "CC_DRINK",
        "skill_pri": "cooking",
        "difficulty": 0,
        "time": 5500,
        "reversible": false,
        "autolearn": true,
        "tools": [
                     [
                         ["hotplate", 16],
                         ["toolset", 5],
                         ["fire", -1]
                     ],
                     [
                         ["pan", -1],
                         ["pot", -1],
                         ["rock_pot", -1],
						 ["jerrycan_big",-1]
                     ]
                 ],
        "components": [
                          [
                              ["water", 6]
                          ]
                      ]
    },
	
	{
        "result": "water_cleanx10",
        "category": "CC_DRINK",
        "skill_pri": "cooking",
        "difficulty": 0,
        "time": 9000,
        "reversible": false,
        "autolearn": true,
        "tools": [
                     [
                         ["toolset", 8],
                         ["fire", -1]
                     ],
                     [

                         ["pot", -1],
                         ["rock_pot", -1],
						 ["jerrycan_big",-1]
                     ]
                 ],
        "components": [
                          [
                              ["water", 10]
                          ]
                      ]
    },
	
	{
        "result": "water_cleanx40",
        "category": "CC_DRINK",
        "skill_pri": "cooking",
        "difficulty": 0,
        "time": 35000,
        "reversible": false,
        "autolearn": true,
        "tools": [
                     [
                         ["toolset", 30],
                         ["fire", -1]
                     ],
                     [
                         ["pot", -1],
                         ["jerrycan_big", -1]
                     ]
                 ],
        "components": [
                          [
                              ["water", 40]
                          ]
                      ]
    },
	
	{
        "result": "water_cleanx100",
        "category": "CC_DRINK",
        "skill_pri": "cooking",
        "difficulty": 0,
        "time": 85000,
        "reversible": false,
        "autolearn": true,
        "tools": [
                     [
                         ["toolset", 70],
                         ["fire", -1]
                     ],
                     [
                         ["jerrycan_big", -1]

                     ]
                 ],
        "components": [
                          [
                              ["water", 100]
                          ]
                      ]
    },
	
	
	{
        "result": "salt",
        "category": "CC_MISC",
        "skill_pri": "cooking",
        "difficulty": 0,
        "time": 8000,
        "reversible": false,
        "autolearn": true,
        "tools": [
                     [
                         ["hotplate", 24],
                         ["toolset", 8],
                         ["fire", -1]
                     ],
                     [
                         ["pan", -1],
                         ["pot", -1],
                         ["rock_pot", -1],
						 ["jerrycan_big",-1]
                     ]
                 ],
        "components": [
                          [
                              ["salt_water", 8]
                          ]
                      ]
    },

```

{  
“result”: “sealed\_can\_drink”,  
“category”: “CC\_MISC”,  
“difficulty”: 0,  
“time”: 30000,  
“reversible”: false,  
“autolearn”: true,  
“tools”: [  
[  
]  
],  
“components”: [  
[  
[“sinew”, 10],  
[“plant\_fibre”, 10],  
[“thread”, 10]  
],  
[  
[“bag\_plastic”, 1]  
]  
]  
},[/code]

Note, this will create different water objects. They will have the exact same function, but will not, at least with this quick and dirty fix, be inter-mixable.

Second Note, I’m surprised that they tied the “put in container” query to liquids. It made this take only 5 minutes compared to the half an hour it would have taken. Thank you cataclysm devs :).

Third note, interesting outcome of this is, if you use the right recipe for your container, you will be able to put the water directly back into the container that held the dirty water, without requiring an intermediate container like you used to need.

Fourth note, if you know of any other containers that have odd water amounts, tell me, and I will update everything for it.

---

<div class="post-metadata">

**Author:** ![Flare](https://avatars.discourse-cdn.com/v4/letter/f/c0e974/32.png) [@Flare](https://discourse.cataclysmdda.org/u/Flare)\
**Post date:** [May 11, 2013, 11:56pm UTC](https://discourse.cataclysmdda.org/t/mass-water-purification/1183/2 "2013-05-11T23:56:50Z")

</div>

Four things I’d like to suggest.

Firstly, with the repeat-crafting-recipe command, it is very easy to do multiple craftings very fast, and the use of this might be limited if it’s just a linear increase in time and units of water without any change to the time involved when pasteurizing the water in bigger amounts.

Secondly, I realize that doing something in bulk quantities usually means that it can be done faster than doing them individually, however this is done exponentially, not linearly as in your recipes the quantity goes up. For example, making 1 unit of water might take 1 minute in the original game, but you can make it such that it takes 1 minute and 40 seconds when purifying 2 units of water. As you go up in quantity, the time needed becomes less and less.

Thirdly, maybe you can balance this by only letting large boiling containers perform the really large quantities of water. The pot for example would be the biggest container, followed by the rock pot, and then the frying pan.  
On top of this, you can balance this even further by putting in other containers that also be used to pasteurize water, coke cans, tins cans, water bottles, and plastic bags for example, though with the appropriate units of water they can pasteurize used in the recipes since most of these are really small.

Fourthly, you might want to change the charges required for the toolset and hot plates.

---

<div class="post-metadata">

**Author:** ![drake1storm](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@drake1storm](https://discourse.cataclysmdda.org/u/drake1storm)\
**Post date:** [May 12, 2013, 12:08am UTC](https://discourse.cataclysmdda.org/t/mass-water-purification/1183/3 "2013-05-12T00:08:50Z")

</div>

[quote=“Flare, post:2, topic:1183”]Four things I’d like to suggest.

Firstly, with the repeat-crafting-recipe command, it is very easy to do multiple craftings very fast, and the use of this might be limited if it’s just a linear increase in time and units of water without any change to the time involved when pasteurizing the water in bigger amounts.

Secondly, I realize that doing something in bulk quantities usually means that it can be done faster than doing them individually, however this is done exponentially, not linearly as in your recipes the quantity goes up. For example, making 1 unit of water might take 1 minute in the original game, but you can make it such that it takes 1 minute and 40 seconds when purifying 2 units of water. As you go up in quantity, the time needed becomes less and less.

Thirdly, maybe you can balance this by only letting large boiling containers perform the really large quantities of water. The pot for example would be the biggest container, followed by the rock pot, and then the frying pan.  
On top of this, you can balance this even further by putting in other containers that also be used to pasteurize water, coke cans, tins cans, water bottles, and plastic bags for example, though with the appropriate units of water they can pasteurize used in the recipes since most of these are really small.

Fourthly, you might want to change the charges required for the toolset and hot plates.[/quote]

1. This idea was really just a “because I was asked to save some time” mod. Frankly, I’ve had a headache all day (screw you too thunderstorm), and I am well aware this could use some tweaking.
2. I was planning a system like this, though it is annoyingly hard to do 6th grade math with a pounding head. I’ll update it tomorrow when my thoughts are clearer. Posting that was probably a good idea in case this headache robs me of that memory.
3. That is a very good point, though, in that case, the pot would not be the biggest thing used. If anything, the steel jerrycan would be. However, I like the idea of changing the 1 unit one to be able to use simple things like coke cans to boil water in, as well as various other items for the other quantities. Might even add in an optional recipe to “re-seal” a can with water, or something along those lines.

Ps, sorry if this came out hostile. I am well aware I am not a nice person when I have a headache.

---

<div class="post-metadata">

**Author:** ![drake1storm](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@drake1storm](https://discourse.cataclysmdda.org/u/drake1storm)\
**Post date:** [May 12, 2013, 1:56pm UTC](https://discourse.cataclysmdda.org/t/mass-water-purification/1183/4 "2013-05-12T13:56:52Z")

</div>

Ok, main recipe list has been updated to make use of recommended changes. The efficiency increase starts out negligible, but can be rather significant in the more “mass” versions of water purification.

Also, I added in a recipe to boil off salt water to get salt.

Edit: last minute addition. I added in a resealable aluminum can object and recipe. They are the last thing in each code block, and are completely unnecessary for the code to run. They are entirely optional.

---

<div class="post-metadata">

**Author:** ![drake1storm](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@drake1storm](https://discourse.cataclysmdda.org/u/drake1storm)\
**Post date:** [May 12, 2013, 5:33pm UTC](https://discourse.cataclysmdda.org/t/mass-water-purification/1183/5 "2013-05-12T17:33:04Z")

</div>

Note, as should have been suspected, the day I put this up was the day they moved consumables out to jsons.

I have updated everything, but the latest git is broken and I am waiting until it is fixed before putting up the modifications.

---

<div class="post-metadata">

**Author:** ![Soron](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/soron/32/885_2.png) [@Soron](https://discourse.cataclysmdda.org/u/Soron)\
**Post date:** [May 12, 2013, 9:55pm UTC](https://discourse.cataclysmdda.org/t/mass-water-purification/1183/6 "2013-05-12T21:55:40Z")

</div>

This reminds me that we should make recipes able to specify the quantity that you get from them.

---

<div class="post-metadata">

**Author:** ![drake1storm](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@drake1storm](https://discourse.cataclysmdda.org/u/drake1storm)\
**Post date:** [May 12, 2013, 10:06pm UTC](https://discourse.cataclysmdda.org/t/mass-water-purification/1183/7 "2013-05-12T22:06:33Z")

</div>

I was considering that myself, but it is a bit beyond my abilities with C++.

It would not be overly difficult, however. The recipes are read from json files, so adding another field called “quantity” would not be overly difficult. Simply have it get that number of objects of the desired type for that recipe.

However, the complications from that are bit farther reaching than they seem at a glance. Currently, all items in game are declared to have a specific size “quantity” upon declaration, so if you create an item of that type you get “quantity” number of those regardless of what recipe is used to spawn it. This, rather restrictive, mechanic, though a rather large liability, has been what the entirety of the item generation process was built around. Changing it at this point would be a major task that would require more than my subpar level of C++ knowledge.

---

<div class="post-metadata">

**Author:** ![Soron](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/soron/32/885_2.png) [@Soron](https://discourse.cataclysmdda.org/u/Soron)\
**Post date:** [May 12, 2013, 11:30pm UTC](https://discourse.cataclysmdda.org/t/mass-water-purification/1183/8 "2013-05-12T23:30:10Z")

</div>

Actually, if you dig in a bit more, I’m pretty sure that it’ll be pretty simple to implement, with not TOO many ancillary issues.

A while back (not too long after 0.3), I remember that I changed on-the-map item spawning to allow for non-default quantities and amounts of charges, while still using the default values given in the item definitions. It wouldn’t be too difficult to do something similar for crafting, as well.

And thanks to the recipes being defined in JSON now, it’s pretty easy to add new optional fields.

So, my estimation is that it would be pretty straightforward, if you know the relevant code well enough.

---

<div class="post-metadata">

**Author:** ![drake1storm](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@drake1storm](https://discourse.cataclysmdda.org/u/drake1storm)\
**Post date:** [May 12, 2013, 11:34pm UTC](https://discourse.cataclysmdda.org/t/mass-water-purification/1183/9 "2013-05-12T23:34:12Z")

</div>

[quote=“Soron, post:8, topic:1183”]Actually, if you dig in a bit more, I’m pretty sure that it’ll be pretty simple to implement, with not TOO many ancillary issues.

A while back (not too long after 0.3), I remember that I changed on-the-map item spawning to allow for non-default quantities and amounts of charges, while still using the default values given in the item definitions. It wouldn’t be too difficult to do something similar for crafting, as well.

And thanks to the recipes being defined in JSON now, it’s pretty easy to add new optional fields.

So, my estimation is that it would be pretty straightforward, if you know the relevant code well enough.[/quote]

And this is why I think I’ll stick to to more basic stuff using the tools at hand. I’ve been routing through all of the code lately, and I never picked up on those changes.

Ah well. Life’s only interesting so long as there are new things to see and learn.

At least now you’ve got yourself a project to work on aswell. Get to it 🙂

---

<div class="post-metadata">

**Author:** ![Soron](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/soron/32/885_2.png) [@Soron](https://discourse.cataclysmdda.org/u/Soron)\
**Post date:** [May 13, 2013, 12:47am UTC](https://discourse.cataclysmdda.org/t/mass-water-purification/1183/10 "2013-05-13T00:47:58Z")

</div>

Yeah, fair enough. There are a lot of cases where stuff might be simple if you know how it works, or you could end up completely breaking who-knows-what. And yeah, this’ll be a nice, easy thing to implement, when I need something of the sort.

If you’re curious, the relevant code is map::spawn\_item, btw. The defaults are declared in the header (map.h), and the actual logic is in map.cpp.

---

<div class="post-metadata">

**Author:** ![drake1storm](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@drake1storm](https://discourse.cataclysmdda.org/u/drake1storm)\
**Post date:** [May 13, 2013, 12:51am UTC](https://discourse.cataclysmdda.org/t/mass-water-purification/1183/11 "2013-05-13T00:51:52Z")

</div>

[quote=“Soron, post:10, topic:1183”]Yeah, fair enough. There are a lot of cases where stuff might be simple if you know how it works, or you could end up completely breaking who-knows-what. And yeah, this’ll be a nice, easy thing to implement, when I need something of the sort.

If you’re curious, the relevant code is map::spawn\_item, btw. The defaults are declared in the header (map.h), and the actual logic is in map.cpp.[/quote]

I’ll take a look at it after my exam then, and see if I can’t bash it out. Let’s call it a race.

![](http://cdn.polarisindustries.com/VIC/MY2013/receptors/vic-challenge/img-challenge-text.jpg)
