Mass water purification

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.

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=“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.

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.

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.

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

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.

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=“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 :slight_smile:

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=“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.