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

Water purification tablets only purify up to 4 water each #71971

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions data/json/item_actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,11 @@
"id": "WATER_PURIFIER",
"name": { "str": "Purify some water" }
},
{
"type": "item_action",
"id": "WATER_TABLETS",
"name": { "str": "Purify some water" }
},
{
"type": "item_action",
"id": "WEATHER_TOOL",
Expand Down
2 changes: 1 addition & 1 deletion data/json/itemgroups/Locations_MapExtras/airdrop.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"type": "item_group",
"subtype": "collection",
"container-item": "box_small",
"entries": [ { "count": 8, "group": "pur_tablets_bottle_plastic_small_15" } ]
"entries": [ { "count": 8, "group": "pur_tablets_bottle_plastic_small_50" } ]
},
{
"id": "twoliter_water_batch",
Expand Down
4 changes: 2 additions & 2 deletions data/json/itemgroups/Locations_MapExtras/locations.json
Original file line number Diff line number Diff line change
Expand Up @@ -2154,7 +2154,7 @@
{ "item": "apron_plastic", "prob": 25 },
{ "item": "apron_cotton", "prob": 8 },
{ "item": "apron_leather", "prob": 2 },
{ "prob": 15, "group": "pur_tablets_bottle_plastic_small_1_15" },
{ "prob": 15, "group": "pur_tablets_bottle_plastic_small_1_50" },
{ "item": "lye_powder", "prob": 10, "charges": [ 1, 200 ] },
{ "item": "oxy_powder", "prob": 12, "charges": [ 1, 200 ] },
{ "item": "chemistry_set", "prob": 8 },
Expand Down Expand Up @@ -2576,7 +2576,7 @@
[ "flaregun", 5 ],
[ "signal_flare", 10 ],
[ "survivormap", 1 ],
{ "prob": 5, "group": "pur_tablets_bottle_plastic_small_1_15" },
{ "prob": 5, "group": "pur_tablets_bottle_plastic_small_1_50" },
[ "razor_blade", 5 ],
[ "sheath", 5 ],
[ "bootsheath", 5 ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@
[ "jacket_army", 40 ],
[ "helmet_army_outdated", 10 ],
[ "helmet_soviet_tanker", 1 ],
{ "prob": 10, "group": "pur_tablets_bottle_plastic_small_1_15" },
{ "prob": 10, "group": "pur_tablets_bottle_plastic_small_1_50" },
[ "knife_trench", 14 ],
[ "flaregun", 20 ],
[ "signal_flare", 25 ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
[ "popcan_stove", 10 ],
[ "denat_alcohol", 6 ],
[ "methed_alcohol", 4 ],
{ "prob": 10, "group": "pur_tablets_bottle_plastic_small_1_15" },
{ "prob": 10, "group": "pur_tablets_bottle_plastic_small_1_50" },
[ "water_clean", 50 ],
[ "granola", 60 ],
[ "fruit_leather", 50 ],
Expand Down
8 changes: 4 additions & 4 deletions data/json/itemgroups/activities_hobbies.json
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
[ "pocketwatch", 5 ],
[ "boots_hiking", 20 ],
[ "runner_bag", 15 ],
{ "prob": 10, "group": "pur_tablets_bottle_plastic_small_1_15" },
{ "prob": 10, "group": "pur_tablets_bottle_plastic_small_1_50" },
[ "e_tool", 10 ],
[ "knife_trench", 7 ],
[ "flaregun", 20 ],
Expand Down Expand Up @@ -548,7 +548,7 @@
[ "pocketwatch", 5 ],
[ "boots_hiking", 20 ],
[ "runner_bag", 15 ],
{ "prob": 10, "group": "pur_tablets_bottle_plastic_small_1_15" },
{ "prob": 10, "group": "pur_tablets_bottle_plastic_small_1_50" },
[ "e_tool", 10 ],
[ "knife_trench", 7 ],
[ "flaregun", 20 ],
Expand Down Expand Up @@ -749,10 +749,10 @@
},
{
"type": "item_group",
"id": "pur_tablets_bottle_plastic_small_1_15",
"id": "pur_tablets_bottle_plastic_small_1_50",
"subtype": "collection",
"//": "This group was created automatically and may contain errors.",
"container-item": "bottle_plastic_small",
"entries": [ { "item": "pur_tablets", "count": [ 1, 15 ] } ]
"entries": [ { "item": "pur_tablets", "count": [ 1, 50 ] } ]
}
]
2 changes: 1 addition & 1 deletion data/json/itemgroups/collections_domestic.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
{ "item": "apron_plastic", "prob": 15 },
{ "item": "apron_cotton", "prob": 3 },
{ "item": "apron_leather", "prob": 3 },
{ "prob": 15, "group": "pur_tablets_bottle_plastic_small_1_15" },
{ "prob": 15, "group": "pur_tablets_bottle_plastic_small_1_50" },
{ "item": "lye_powder", "prob": 20, "charges": [ 100, -1 ] },
{ "item": "oxy_powder", "prob": 24, "charges": [ 100, -1 ] },
{ "item": "chemistry_set", "prob": 10 },
Expand Down
2 changes: 1 addition & 1 deletion data/json/itemgroups/military.json
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@
{ "prob": 25, "group": "antibiotics_bottle_plastic_pill_prescription_1_15" },
{ "item": "purifier", "prob": 12 },
{ "item": "heatpack", "prob": 60 },
{ "prob": 20, "group": "pur_tablets_bottle_plastic_small_1_15" },
{ "prob": 20, "group": "pur_tablets_bottle_plastic_small_1_50" },
{ "prob": 5, "group": "fungicide_bag_plastic_400" },
{ "group": "insecticide_bag_plastic", "prob": 5 },
{ "item": "rx12_injector", "prob": 8, "charges": [ 0, 2 ] },
Expand Down
4 changes: 2 additions & 2 deletions data/json/itemgroups/science_and_tech.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
{ "item": "oxy_powder", "prob": 8, "charges": [ 100, 200 ] },
[ "fungicide", 10 ],
{ "group": "insecticide_bag_plastic", "prob": 10 },
{ "prob": 10, "group": "pur_tablets_bottle_plastic_small_1_15" },
{ "prob": 10, "group": "pur_tablets_bottle_plastic_small_1_50" },
[ "optical_cloak", 1 ],
[ "holo_cloak", 1 ],
[ "survnote", 1 ],
Expand Down Expand Up @@ -182,7 +182,7 @@
[ "apron_plastic", 20 ],
[ "apron_cotton", 2 ],
[ "apron_leather", 2 ],
{ "prob": 5, "group": "pur_tablets_bottle_plastic_small_1_15" },
{ "prob": 5, "group": "pur_tablets_bottle_plastic_small_1_50" },
{ "item": "lye_powder", "prob": 10, "charges": [ 100, 200 ] },
{ "item": "oxy_powder", "prob": 12, "charges": [ 100, 200 ] },
{ "item": "magnesium", "prob": 12, "charges": [ 50, 100 ] },
Expand Down
22 changes: 11 additions & 11 deletions data/json/itemgroups/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
{ "item": "mess_kit", "prob": 20 },
[ "multitool", 10 ],
[ "pockknife", 30 ],
{ "prob": 10, "group": "pur_tablets_bottle_plastic_small_1_15" },
{ "prob": 10, "group": "pur_tablets_bottle_plastic_small_1_50" },
{ "item": "ref_lighter", "prob": 20, "charges": [ 0, 50 ] },
[ "rope_30", 20 ],
[ "flint_steel", 10 ],
Expand Down Expand Up @@ -443,7 +443,7 @@
{ "item": "whistle_multitool" },
{ "item": "glowstick", "charges": 1400 },
{ "item": "handflare", "count": 4, "charges": 300 },
{ "group": "pur_tablets_bottle_plastic_small_15" },
{ "group": "pur_tablets_bottle_plastic_small_50" },
{ "item": "pocket_survival" }
]
},
Expand All @@ -458,7 +458,7 @@
{ "item": "whistle_multitool", "prob": 70 },
{ "item": "glowstick", "charges": 1400, "prob": 60 },
{ "item": "handflare", "count": [ 0, 4 ], "charges": 300 },
{ "group": "pur_tablets_bottle_plastic_small_0_15" },
{ "group": "pur_tablets_bottle_plastic_small_0_50" },
{ "item": "pocket_survival", "prob": 40 }
]
},
Expand Down Expand Up @@ -566,7 +566,7 @@
{ "item": "bandages", "count": 9 },
{ "item": "medical_gauze", "count": 3 },
{ "item": "adhesive_bandages", "count": 3 },
{ "group": "pur_tablets_bottle_plastic_small_0_3" },
{ "group": "pur_tablets_bottle_plastic_small_0_9" },
{ "item": "gloves_medical" },
{ "item": "scissors_medical" }
]
Expand All @@ -583,7 +583,7 @@
{ "item": "bandages", "count": [ 0, 9 ] },
{ "item": "medical_gauze", "count": [ 0, 3 ] },
{ "item": "adhesive_bandages", "count": [ 0, 3 ] },
{ "group": "pur_tablets_bottle_plastic_small_0_3" },
{ "group": "pur_tablets_bottle_plastic_small_0_9" },
{ "item": "gloves_medical", "prob": 50 },
{ "item": "scissors_medical", "prob": 30 }
]
Expand Down Expand Up @@ -967,19 +967,19 @@
},
{
"type": "item_group",
"id": "pur_tablets_bottle_plastic_small_15",
"id": "pur_tablets_bottle_plastic_small_50",
"subtype": "collection",
"//": "This group was created automatically and may contain errors.",
"container-item": "bottle_plastic_small",
"entries": [ { "item": "pur_tablets", "count": 15 } ]
"entries": [ { "item": "pur_tablets", "count": 50 } ]
},
{
"type": "item_group",
"id": "pur_tablets_bottle_plastic_small_0_15",
"id": "pur_tablets_bottle_plastic_small_0_50",
"subtype": "collection",
"//": "This group was created automatically and may contain errors.",
"container-item": "bottle_plastic_small",
"entries": [ { "item": "pur_tablets", "count": [ 0, 15 ] } ]
"entries": [ { "item": "pur_tablets", "count": [ 0, 50 ] } ]
},
{
"type": "item_group",
Expand Down Expand Up @@ -1015,11 +1015,11 @@
},
{
"type": "item_group",
"id": "pur_tablets_bottle_plastic_small_0_3",
"id": "pur_tablets_bottle_plastic_small_0_9",
"subtype": "collection",
"//": "This group was created automatically and may contain errors.",
"container-item": "bottle_plastic_small",
"entries": [ { "item": "pur_tablets", "count": [ 0, 3 ] } ]
"entries": [ { "item": "pur_tablets", "count": [ 0, 9 ] } ]
},
{
"type": "item_group",
Expand Down
13 changes: 10 additions & 3 deletions data/json/items/chemicals_and_resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -1179,14 +1179,21 @@
"material": [ "powder" ],
"weight": "1 g",
"color": "white",
"use_action": [ "WATER_PURIFIER" ],
"use_action": [ "WATER_TABLETS" ],
"comestible_type": "MED",
"symbol": "!",
"description": "Intended for the clarification and disinfection of unsafe drinking water, this halazone-based purification tablet removes dangerous contaminants using powerful chemicals. The label says to use one tablet per unit of water (250 mL).",
"//": "Modeled after camping-scale aquatabs (https://cdn.shopify.com/s/files/1/0371/7506/6755/files/2020-49mg_insert.pdf?v=1592588294). Usage procedure is: clarify and decant water, add tablets, mix for 10 minutes, wait for 30.",
"//2": "The recommended usage is 1 tablet per L, going to 2 tablets if cloudy/stained/cold",
"//3": "The same company manufactures larger tablets for larger volumes, but the amount of active ingredient per litre of water is roughly equivalent and the procedure is similar",
"//4": "The infrastructure does not currently exist for modelling whether water is cloudy.",
"//5": "Based on this: usage is modeled in-game as: 1. Spend 5m/1L with significant batch savings to decant, 2. Add tablets 3. Assume mixing can be arranged, 4. wait 40 minutes for clean water.",
"description": "Intended for the clarification and disinfection of unsafe drinking water while camping or travelling, this sodium dichloroisocyanurate-based purification tablet removes dangerous contaminants using powerful chemicals. The label says to use one tablet per liter (4 units of water).",
"price": "9 cent",
"price_postapoc": "20 cent",
"volume": "2 ml",
"flags": [ "NO_INGEST", "WATER_DISSOLVE" ]
"flags": [ "NO_INGEST", "WATER_DISSOLVE" ],
"//6": "The ratio of how much water can be purified per tablet (maximum). Should match the water_purifying recipe",
"variables": { "water_per_tablet": "4" }
},
{
"type": "GENERIC",
Expand Down
30 changes: 30 additions & 0 deletions data/json/items/comestibles/drink.json
Original file line number Diff line number Diff line change
Expand Up @@ -1872,5 +1872,35 @@
"phase": "liquid",
"flags": [ "EATEN_COLD" ],
"fun": 3
},
{
"id": "water_purifying",
"type": "COMESTIBLE",
"comestible_type": "DRINK",
"category": "food",
"name": { "str_sp": "water (purifying)" },
"description": "You've dissolved tablets of disinfecting chemicals in this water to purify it. Soon it'll be ready to drink.",
"material": [ "water" ],
"weight": "250 g",
"volume": "250 ml",
"charges": 1,
"price": 50,
"price_postapoc": 1,
"symbol": "~",
"color": "light_blue",
"phase": "liquid",
"container": "bottle_plastic",
"sealed": false,
"quench": 50,
"ammo_data": { "ammo_type": "water" },
"flags": [ "EATEN_COLD" ],
"use_action": {
"target": "water_clean",
"msg": "After using the tablets and carefully decanting out the resulting clean water, it's ready to drink",
"moves": 100,
"type": "delayed_transform",
"transform_age": 2400,
"not_ready_msg": "The chlorine released by the tablets is still working. You still need to wait a bit before you can drink it."
}
}
]
2 changes: 1 addition & 1 deletion data/json/mapgen/military/mil_base/mil_base_z0.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@
{ "item": "thermos", "x": 38, "y": 59, "chance": 75, "repeat": [ 50, 150 ] },
{ "item": "mess_kit", "x": 37, "y": 59, "chance": 75, "repeat": [ 50, 100 ] },
{ "item": "water_purifier", "x": 36, "y": 59, "chance": 75, "repeat": [ 50, 100 ] },
{ "group": "pur_tablets_bottle_plastic_small_15", "x": 36, "y": 59, "chance": 75, "repeat": [ 50, 100 ] },
{ "group": "pur_tablets_bottle_plastic_small_50", "x": 36, "y": 59, "chance": 75, "repeat": [ 50, 100 ] },
{ "group": "MRE", "x": [ 49, 55 ], "y": [ 53, 54 ], "chance": 75, "repeat": 1500 },
{ "group": "MRE", "x": [ 49, 55 ], "y": 48, "chance": 75, "repeat": 750 },
{ "group": "groce_pasta", "x": [ 44, 46 ], "y": 54, "chance": 75, "repeat": [ 50, 150 ] },
Expand Down
2 changes: 1 addition & 1 deletion data/json/npcs/godco/classes.json
Original file line number Diff line number Diff line change
Expand Up @@ -1033,10 +1033,10 @@
{ "item": "heavy_flashlight", "prob": 20, "charges": [ 100, 300 ] },
{ "item": "glowstick", "prob": 50, "charges": 1400 },
{ "item": "handflare", "prob": 50, "charges": 300 },
{ "item": "pur_tablets", "prob": 10, "count": [ 15, 50 ] },
{ "item": "gasoline_lantern", "prob": 7, "charges": [ 100, -1 ] },
{ "item": "oil_lamp", "prob": 7, "charges": [ 100, -1 ] },
{ "item": "lamp_oil", "prob": 5, "charges": [ 100, -1 ] },
{ "item": "pur_tablets", "prob": 10, "count": [ 5, 15 ] },
{ "item": "mess_kit", "prob": 33 },
{ "item": "popcan_stove", "prob": 33, "charges": [ 100, 500 ] },
{
Expand Down
6 changes: 3 additions & 3 deletions data/json/npcs/items_generic.json
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@
[ "pudding", 2 ],
[ "puller", 1 ],
[ "punch_dagger", 2 ],
{ "group": "pur_tablets_bottle_plastic_small_5" },
{ "group": "pur_tablets_bottle_plastic_small_50" },
[ "purple_drink", 3 ],
[ "purse", 4 ],
[ "quikclot", 5 ],
Expand Down Expand Up @@ -1147,10 +1147,10 @@
},
{
"type": "item_group",
"id": "pur_tablets_bottle_plastic_small_5",
"id": "pur_tablets_bottle_plastic_small_50",
"subtype": "collection",
"//": "This group was created automatically and may contain errors.",
"container-item": "bottle_plastic_small",
"entries": [ { "item": "pur_tablets", "count": 5 } ]
"entries": [ { "item": "pur_tablets", "count": 50 } ]
}
]
11 changes: 7 additions & 4 deletions data/json/recipes/recipe_food.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,15 @@
{
"type": "recipe",
"activity_level": "NO_EXERCISE",
"result": "water",
"result": "water_purifying",
"category": "CC_FOOD",
"id_suffix": "using_water_purifier",
"id_suffix": "using_tablets",
"subcategory": "CSC_FOOD_DRINKS",
"skill_used": "survival",
"time": "1 m",
"skill_used": "cooking",
"time": "5 m",
"batch_time_factors": [ 90, 2 ],
"charges": 4,
"//": "See pur_tablets item definition for documentation and discussion",
"autolearn": true,
"components": [ [ [ "water_murky", 1 ] ], [ [ "pur_tablets", 1 ] ] ]
},
Expand Down
12 changes: 9 additions & 3 deletions data/mods/TEST_DATA/EOC.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,15 +300,21 @@
},
{
"type": "effect_on_condition",
"id": "EOC_math_addiction",
"id": "EOC_math_addiction_setup",
"effect": [
{ "set_string_var": "caffeine", "target_var": { "global_val": "add_id" } },
{ "u_spawn_item": "backpack", "force_equip": true },
{ "u_spawn_item": "test_whiskey_caffenated", "container": "bottle_glass" },
{
"u_run_inv_eocs": "all",
"true_eocs": [ { "id": "EOC_math_addiction_nested", "effect": [ { "u_activate": "ALCOHOL" } ] } ]
},
}
]
},
{
"type": "effect_on_condition",
"id": "EOC_math_addiction_check",
"effect": [
{ "set_string_var": "caffeine", "target_var": { "global_val": "add_id" } },
{ "math": [ "key_add_intensity", "=", "u_addiction_intensity(add_id)" ] },
{ "math": [ "key_add_turn", "=", "u_addiction_turns(add_id)" ] }
]
Expand Down
21 changes: 11 additions & 10 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7092,6 +7092,17 @@ bool Character::invoke_item( item *used, const std::string &method, const tripoi
return false;
}

if( actually_used->is_comestible() &&
actually_used->type->use_methods.find( "delayed_transform" ) ==
actually_used->type->use_methods.end() ) {
// Assume that when activating food that can be transformed, you're trying to transform it. Otherwise...
// Try to eat it.
add_msg_if_player( m_info, string_format( "Attempting to eat %s", actually_used->display_name() ) );
assign_activity( consume_activity_actor( item_location( *this, actually_used ) ) );
// If the character isn't eating, then invoking the item failed somewhere
return !activity.is_null();
}

std::optional<int> charges_used = actually_used->type->invoke( this, *actually_used,
pt, method );
if( !charges_used.has_value() ) {
Expand All @@ -7105,16 +7116,6 @@ bool Character::invoke_item( item *used, const std::string &method, const tripoi
return false;
}

if( actually_used->is_comestible() ) {
const bool ret = consume_effects( *used );
const int consumed = used->activation_consume( charges_used.value(), pt, this );
if( consumed == 0 ) {
// Nothing was consumed from within the item. "Eat" the item itself away.
i_rem( actually_used );
}
return ret;
}

actually_used->activation_consume( charges_used.value(), pt, this );

if( actually_used->has_flag( flag_SINGLE_USE ) || actually_used->is_bionic() ||
Expand Down
Loading
Loading