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

Implement basic saline infusion to help with blood loss #70566

Merged
merged 8 commits into from
Jan 5, 2024
84 changes: 84 additions & 0 deletions data/json/effects_on_condition/medicine_eocs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
[
{
"type": "effect_on_condition",
"id": "SALINE_INFUSION_init",
"condition": { "or": [ { "u_has_flag": "INFECTION_IMMUNE" }, { "u_has_effect": "cannula_in_hand" } ] },
"effect": [
{ "run_eoc_with": "SALINE_INFUSION", "variables": { "has_disinfectant": "1" } },
{ "u_message": "DEBUG: you have infection_immune or cannula in hand, processing infusion", "type": "debug" }
],
"false_effect": [
{
"u_message": "DEBUG: you don't have infection_immune or cannula in hand, searching the disinfectant",
"type": "debug"
},
{
"u_run_inv_eocs": "manual",
"search_data": [ { "flags": [ "DISINFECTANT" ] } ],
"true_eocs": [
{
"id": "REMOVE_DISINFECTANT",
"effect": [
{ "u_message": "DEBUG: found disinfectant, processing infusion", "type": "debug" },
{ "math": [ "n_hp('ALL')", "=", "0" ] },
{ "run_eoc_with": "SALINE_INFUSION", "variables": { "has_disinfectant": "1" } }
]
}
],
"false_eocs": [
{
"id": "INFUSE_WITHOUT_DISINFECTION",
"effect": [
{ "u_message": "DEBUG: disinfectant not found, query to process", "type": "debug" },
{
"if": {
"u_query": "You don't have any disinfectant to clean your skin. Your arm may be infected after infusion. Continue without disinfection?",
"default": true
},
"then": [
{ "u_message": "DEBUG: processed without disinfectant", "type": "debug" },
{ "run_eoc_with": "SALINE_INFUSION", "variables": { "has_disinfectant": "0" } }
],
"else": [
{ "u_message": "DEBUG: infusion stopped", "type": "debug" },
{ "u_message": "You decided to not risk your life until you find something to disinfect the skin." }
]
}
]
}
]
}
]
},
{
"type": "effect_on_condition",
"id": "SALINE_INFUSION",
"//": "4 ml of saline per 1 ml of blood, rate 2L/hour. 1 ml of blood = 10 units of vitamin",
"effect": [
{ "math": [ "u_amount_of_saline_infused", "=", "_volume_of_saline" ] },
{ "u_assign_activity": "ACT_SALINE_INFUSE", "duration": { "math": [ "_volume_of_saline / 0.55555556" ] } },
{ "u_consume_item": { "context_val": "bag_id" } },
{
"set_string_var": "<context_val:bag_id>_empty",
"target_var": { "context_val": "bag_to_drop" },
"parse_tags": true
},
{
"if": { "math": [ "rand(100)", ">", "u_has_trait('INFRESIST') ? 96 : 90" ] },
"then": { "u_add_effect": "infected", "duration": 1, "target_part": "arm_l" }
},
{ "u_add_effect": "infected", "duration": 0, "target_part": "arm_l" },
{ "u_spawn_item": { "context_val": "bag_to_drop" }, "suppress_message": true },
{
"u_message": "You prepare the tubing, insert the needle into a vein, and patiently wait for the saline solution to flow into your bloodstream.",
"type": "good"
}
]
},
{
"type": "effect_on_condition",
"id": "SALINE_INFUSION_eff",
"//": "4 ml of saline per 1 ml of blood, rate 2L/hour. 1 ml of blood = 10 units of vitamin",
"effect": [ { "math": [ "u_vitamin('blood')", "+=", "u_amount_of_saline_infused * ( 10 / 4 )" ] } ]
}
]
5 changes: 5 additions & 0 deletions data/json/flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -2371,5 +2371,10 @@
"id": "TRANSPARENT",
"type": "json_flag",
"info": "This is transparent and <info>won't block light</info> from hitting the wearer."
},
{
"id": "DISINFECTANT",
"type": "json_flag",
"//": "This item is disinfectant, used in EoC checks, doesn't have any effect on it's own."
}
]
11 changes: 11 additions & 0 deletions data/json/itemgroups/Drugs_Tobacco_Alcohol/drugs.json
Original file line number Diff line number Diff line change
Expand Up @@ -599,5 +599,16 @@
"subtype": "collection",
"container-item": "bottle_plastic",
"entries": [ { "item": "protein_powder", "container-item": "null", "count": 10 } ]
},
{
"type": "item_group",
"id": "saline_bottle_random",
"subtype": "distribution",
"entries": [
{ "item": "saline_bag_250", "prob": 50 },
{ "item": "saline_bag_500", "prob": 100 },
{ "item": "saline_bag_1000", "prob": 25 },
{ "item": "saline_bag_2000", "prob": 10 }
]
}
]
22 changes: 9 additions & 13 deletions data/json/itemgroups/Locations_MapExtras/locations.json
Original file line number Diff line number Diff line change
Expand Up @@ -2697,14 +2697,14 @@
"type": "item_group",
"subtype": "distribution",
"entries": [
{ "item": "blanket", "prob": 50 },
{ "item": "cotton_patchwork", "prob": 100, "custom-flags": [ "FILTHY" ] },
{ "item": "left_leg_prosthetic", "prob": 20 },
{ "item": "right_leg_prosthetic", "prob": 20 },
{ "item": "left_arm_prosthetic", "prob": 20 },
{ "item": "right_arm_prosthetic", "prob": 20 },
{ "item": "left_arm_neuroprosthetic", "prob": 10 },
{ "item": "right_arm_neuroprosthetic", "prob": 10 }
{ "item": "blanket", "prob": 200 },
{ "item": "cotton_patchwork", "prob": 400, "custom-flags": [ "FILTHY" ] },
{ "item": "left_leg_prosthetic", "prob": 2 },
{ "item": "right_leg_prosthetic", "prob": 2 },
{ "item": "left_arm_prosthetic", "prob": 2 },
{ "item": "right_arm_prosthetic", "prob": 2 },
{ "item": "left_arm_neuroprosthetic", "prob": 1 },
{ "item": "right_arm_neuroprosthetic", "prob": 1 }
]
},
{
Expand Down Expand Up @@ -2746,11 +2746,7 @@
"id": "mil_base_iv",
"type": "item_group",
"subtype": "distribution",
"entries": [
{ "item": "blood", "prob": 100 },
{ "item": "saline", "prob": 80, "container-item": "bag_iv" },
{ "item": "bag_iv", "prob": 50 }
]
"entries": [ { "item": "blood", "prob": 100 }, { "group": "saline_bottle_random", "prob": 80 }, { "item": "bag_iv", "prob": 50 } ]
},
{
"id": "mil_base_mess_hall",
Expand Down
2 changes: 1 addition & 1 deletion data/json/itemgroups/science_and_tech.json
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@
"id": "surgery",
"items": [
[ "blood", 20 ],
{ "item": "saline", "prob": 20, "container-item": "bag_iv" },
{ "group": "saline_bottle_random", "prob": 20 },
{ "prob": 5, "group": "iodine_bottle_plastic_pill_supplement_1_10" },
{ "prob": 5, "group": "prussian_blue_bottle_plastic_pill_supplement_1_10" },
[ "autoclave", 5 ],
Expand Down
16 changes: 8 additions & 8 deletions data/json/items/armor/arm_prosthetics.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"color": "brown",
"warmth": 15,
"material_thickness": 1,
"flags": [ "ARM_PROSTHETIC", "ONLY_ONE", "PADDED" ],
"flags": [ "ARM_PROSTHETIC", "ONLY_ONE", "PADDED", "MUNDANE" ],
"relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "mutations": [ "RIGHT_PROSTHETIC_ARM" ] } ] },
"armor": [ { "encumbrance": 0, "coverage": 100, "covers": [ "arm_stub_r", "arm_prosthetic_r", "hand_prosthetic_r" ] } ]
},
Expand All @@ -35,7 +35,7 @@
"color": "brown",
"warmth": 15,
"material_thickness": 1,
"flags": [ "ARM_PROSTHETIC", "ONLY_ONE", "PADDED" ],
"flags": [ "ARM_PROSTHETIC", "ONLY_ONE", "PADDED", "MUNDANE" ],
"relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "mutations": [ "LEFT_PROSTHETIC_ARM" ] } ] },
"armor": [ { "encumbrance": 0, "coverage": 100, "covers": [ "arm_stub_l", "arm_prosthetic_l", "hand_prosthetic_l" ] } ]
},
Expand All @@ -55,7 +55,7 @@
"color": "brown",
"warmth": 15,
"material_thickness": 1,
"flags": [ "ARM_PROSTHETIC", "ONLY_ONE", "PADDED" ],
"flags": [ "ARM_PROSTHETIC", "ONLY_ONE", "PADDED", "MUNDANE" ],
"relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "mutations": [ "RIGHT_NEUROPROSTHETIC_ARM" ] } ] },
"armor": [ { "encumbrance": 0, "coverage": 100, "covers": [ "arm_stub_r", "arm_neuroprosthetic_r", "hand_neuroprosthetic_r" ] } ]
},
Expand All @@ -75,7 +75,7 @@
"color": "brown",
"warmth": 15,
"material_thickness": 1,
"flags": [ "ARM_PROSTHETIC", "ONLY_ONE", "PADDED" ],
"flags": [ "ARM_PROSTHETIC", "ONLY_ONE", "PADDED", "MUNDANE" ],
"relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "mutations": [ "LEFT_NEUROPROSTHETIC_ARM" ] } ] },
"armor": [ { "encumbrance": 0, "coverage": 100, "covers": [ "arm_stub_l", "arm_neuroprosthetic_l", "hand_neuroprosthetic_l" ] } ]
},
Expand All @@ -95,7 +95,7 @@
"color": "brown",
"warmth": 15,
"material_thickness": 1,
"flags": [ "ARM_PROSTHETIC", "ONLY_ONE", "PADDED" ],
"flags": [ "ARM_PROSTHETIC", "ONLY_ONE", "PADDED", "MUNDANE" ],
"relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "mutations": [ "RIGHT_COSMETIC_PROSTHETIC_ARM" ] } ] },
"armor": [ { "encumbrance": 0, "coverage": 100, "covers": [ "arm_stub_r", "arm_prosthetic_cosmetic_r", "hand_prosthetic_r" ] } ]
},
Expand All @@ -115,7 +115,7 @@
"color": "brown",
"warmth": 15,
"material_thickness": 1,
"flags": [ "ARM_PROSTHETIC", "ONLY_ONE", "PADDED" ],
"flags": [ "ARM_PROSTHETIC", "ONLY_ONE", "PADDED", "MUNDANE" ],
"relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "mutations": [ "LEFT_COSMETIC_PROSTHETIC_ARM" ] } ] },
"armor": [ { "encumbrance": 0, "coverage": 100, "covers": [ "arm_stub_l", "arm_prosthetic_cosmetic_l", "hand_prosthetic_l" ] } ]
},
Expand All @@ -135,7 +135,7 @@
"color": "brown",
"warmth": 15,
"material_thickness": 1,
"flags": [ "ARM_PROSTHETIC", "ONLY_ONE", "PADDED" ],
"flags": [ "ARM_PROSTHETIC", "ONLY_ONE", "PADDED", "MUNDANE" ],
"relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "mutations": [ "RIGHT_PROSTHETIC_ARM" ] } ] },
"armor": [ { "encumbrance": 0, "coverage": 100, "covers": [ "arm_stub_r", "arm_prosthetic_r", "hand_prosthetic_r" ] } ]
},
Expand All @@ -155,7 +155,7 @@
"color": "brown",
"warmth": 15,
"material_thickness": 1,
"flags": [ "ARM_PROSTHETIC", "ONLY_ONE", "PADDED" ],
"flags": [ "ARM_PROSTHETIC", "ONLY_ONE", "PADDED", "MUNDANE" ],
"relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "mutations": [ "LEFT_PROSTHETIC_ARM" ] } ] },
"armor": [ { "encumbrance": 0, "coverage": 100, "covers": [ "arm_stub_l", "arm_prosthetic_l", "hand_prosthetic_l" ] } ]
}
Expand Down
12 changes: 6 additions & 6 deletions data/json/items/armor/legs_prosthetics.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"color": "brown",
"warmth": 15,
"material_thickness": 1,
"flags": [ "LEG_PROSTHETIC", "ONLY_ONE", "PADDED" ],
"flags": [ "LEG_PROSTHETIC", "ONLY_ONE", "PADDED", "MUNDANE" ],
"relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "mutations": [ "RIGHT_PROSTHETIC_LEG" ] } ] },
"armor": [ { "encumbrance": 0, "coverage": 100, "covers": [ "leg_stub_r", "leg_prosthetic_r", "foot_prosthetic_r" ] } ]
},
Expand All @@ -35,7 +35,7 @@
"color": "brown",
"warmth": 15,
"material_thickness": 1,
"flags": [ "LEG_PROSTHETIC", "ONLY_ONE", "PADDED" ],
"flags": [ "LEG_PROSTHETIC", "ONLY_ONE", "PADDED", "MUNDANE" ],
"relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "mutations": [ "LEFT_PROSTHETIC_LEG" ] } ] },
"armor": [ { "encumbrance": 0, "coverage": 100, "covers": [ "leg_stub_l", "leg_prosthetic_l", "foot_prosthetic_l" ] } ]
},
Expand All @@ -55,7 +55,7 @@
"color": "brown",
"warmth": 15,
"material_thickness": 1,
"flags": [ "LEG_PROSTHETIC", "ONLY_ONE", "FRAGILE", "PADDED" ],
"flags": [ "LEG_PROSTHETIC", "ONLY_ONE", "FRAGILE", "PADDED", "MUNDANE" ],
"relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "mutations": [ "RIGHT_PEG_LEG" ] } ] },
"armor": [ { "encumbrance": 0, "coverage": 100, "covers": [ "leg_stub_r", "leg_peg_r" ] } ]
},
Expand All @@ -75,7 +75,7 @@
"color": "brown",
"warmth": 15,
"material_thickness": 1,
"flags": [ "LEG_PROSTHETIC", "ONLY_ONE", "FRAGILE", "PADDED" ],
"flags": [ "LEG_PROSTHETIC", "ONLY_ONE", "FRAGILE", "PADDED", "MUNDANE" ],
"relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "mutations": [ "LEFT_PEG_LEG" ] } ] },
"armor": [ { "encumbrance": 0, "coverage": 100, "covers": [ "leg_stub_l", "leg_peg_l" ] } ]
},
Expand All @@ -95,7 +95,7 @@
"color": "light_gray",
"warmth": 15,
"material_thickness": 2,
"flags": [ "LEG_PROSTHETIC", "ONLY_ONE", "PADDED" ],
"flags": [ "LEG_PROSTHETIC", "ONLY_ONE", "PADDED", "MUNDANE" ],
"relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "mutations": [ "RIGHT_PROSTHETIC_LEG" ] } ] },
"armor": [ { "encumbrance": 0, "coverage": 100, "covers": [ "leg_stub_r", "leg_prosthetic_r", "foot_prosthetic_r" ] } ]
},
Expand All @@ -115,7 +115,7 @@
"color": "light_gray",
"warmth": 15,
"material_thickness": 2,
"flags": [ "LEG_PROSTHETIC", "ONLY_ONE", "PADDED" ],
"flags": [ "LEG_PROSTHETIC", "ONLY_ONE", "PADDED", "MUNDANE" ],
"relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "mutations": [ "LEFT_PROSTHETIC_LEG" ] } ] },
"armor": [ { "encumbrance": 0, "coverage": 100, "covers": [ "leg_stub_l", "leg_prosthetic_l", "foot_prosthetic_l" ] } ]
}
Expand Down
14 changes: 7 additions & 7 deletions data/json/items/comestibles/med.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"symbol": "!",
"color": "white",
"container": "bottle_plastic_small",
"flags": [ "NO_INGEST", "IRREPLACEABLE_CONSUMABLE", "WATER_DISSOLVE", "EDIBLE_FROZEN" ],
"flags": [ "NO_INGEST", "IRREPLACEABLE_CONSUMABLE", "WATER_DISSOLVE", "EDIBLE_FROZEN", "DISINFECTANT" ],
"use_action": { "type": "heal", "disinfectant_power": 4, "bite": 0.95, "move_cost": 2000 }
},
{
Expand Down Expand Up @@ -232,7 +232,7 @@
"color": "white",
"phase": "liquid",
"container": "bottle_plastic_small",
"flags": [ "NO_INGEST", "WATER_DISSOLVE" ],
"flags": [ "NO_INGEST", "WATER_DISSOLVE", "DISINFECTANT" ],
"use_action": { "type": "heal", "disinfectant_power": 4, "bite": 0.95, "move_cost": 2000 }
},
{
Expand Down Expand Up @@ -453,7 +453,7 @@
"freezing_point": -56,
"phase": "liquid",
"container": "bottle_plastic_small",
"flags": [ "NO_INGEST", "IRREPLACEABLE_CONSUMABLE", "WATER_DISSOLVE" ],
"flags": [ "NO_INGEST", "IRREPLACEABLE_CONSUMABLE", "WATER_DISSOLVE", "DISINFECTANT" ],
"use_action": { "type": "heal", "disinfectant_power": 4, "bite": 0.95, "move_cost": 3000 }
},
{
Expand All @@ -463,7 +463,7 @@
"price_postapoc": 250,
"copy-from": "disinfectant",
"description": "Makeshift antiseptic made from ethanol. Can be used to disinfect wounds.",
"flags": [ "NO_INGEST", "WATER_DISSOLVE" ],
"flags": [ "NO_INGEST", "WATER_DISSOLVE", "DISINFECTANT" ],
"use_action": { "type": "heal", "disinfectant_power": 3, "bite": 0.95, "move_cost": 3000 }
},
{
Expand Down Expand Up @@ -859,7 +859,7 @@
"move_cost": 2500,
"effects": [ { "id": "pkill_wintergreen_oil", "duration": "1 h" } ]
},
"flags": [ "NO_INGEST", "WATER_DISSOLVE", "ALLOWS_REMOTE_USE" ]
"flags": [ "NO_INGEST", "WATER_DISSOLVE", "ALLOWS_REMOTE_USE", "DISINFECTANT" ]
},
{
"id": "mugwort_oil",
Expand Down Expand Up @@ -1198,7 +1198,7 @@
"color": "yellow",
"phase": "liquid",
"spoils_in": "28 days",
"flags": [ "NO_INGEST" ],
"flags": [ "NO_INGEST", "DISINFECTANT" ],
"use_action": { "type": "heal", "disinfectant_power": 3, "bite": 0.95, "move_cost": 3000 }
},
{
Expand Down Expand Up @@ -1564,7 +1564,7 @@
"phase": "liquid",
"symbol": "~",
"color": "light_blue",
"flags": [ "NO_INGEST", "WATER_DISSOLVE" ],
"flags": [ "NO_INGEST", "WATER_DISSOLVE", "DISINFECTANT" ],
"use_action": {
"type": "heal",
"disinfectant_power": 1,
Expand Down
Loading
Loading