Skip to content

Commit

Permalink
Merge pull request #855 from KnigTheThrasher/medical
Browse files Browse the repository at this point in the history
[PORT] First aid analyzer rework and improvised medicine
  • Loading branch information
wraith-54321 authored Feb 1, 2024
2 parents f3cd54f + ddbbae2 commit 0e276a3
Show file tree
Hide file tree
Showing 37 changed files with 567 additions and 109 deletions.
5 changes: 1 addition & 4 deletions _maps/RandomRuins/SpaceRuins/infested_frigate.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1146,10 +1146,7 @@
icon_state = "warningline_white";
dir = 8
},
/obj/machinery/vending/medical{
req_access = list("theatre");
products = list(/obj/item/stack/medical/gauze=0,/obj/item/reagent_containers/syringe=7,/obj/item/reagent_containers/dropper=3,/obj/item/healthanalyzer=0,/obj/item/wrench/medical=0,/obj/item/stack/sticky_tape/surgical=0,/obj/item/healthanalyzer/wound=0,/obj/item/stack/medical/ointment=0,/obj/item/stack/medical/suture=1,/obj/item/stack/medical/bone_gel/four=1,/obj/item/cane/white=2)
},
/obj/machinery/vending/medical/infested_frigate,
/turf/open/floor/pod/dark,
/area/ruin/space/has_grav/infested_frigate)
"sQ" = (
Expand Down
9 changes: 8 additions & 1 deletion _maps/map_files/NorthStar/north_star.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -28139,6 +28139,13 @@
/obj/structure/stairs/west,
/turf/open/floor/pod/light,
/area/station/maintenance/floor1/port)
"hAV" = (
/obj/effect/turf_decal/tile/blue/fourcorners,
/obj/structure/table/glass,
/obj/item/bonesetter,
/obj/item/stack/medical/bone_gel,
/turf/open/floor/iron/white/textured,
/area/station/medical/treatment_center)
"hBe" = (
/obj/effect/turf_decal/trimline/blue/filled/line,
/turf/open/floor/iron/white,
Expand Down Expand Up @@ -71649,7 +71656,7 @@
/obj/effect/turf_decal/tile/blue/fourcorners,
/obj/structure/table/glass,
/obj/item/bonesetter,
/obj/item/stack/medical/bone_gel/four,
/obj/item/stack/medical/bone_gel,
/obj/structure/sign/departments/medbay/alt/directional/south,
/turf/open/floor/iron/white/textured,
/area/station/medical/treatment_center)
Expand Down
2 changes: 1 addition & 1 deletion _maps/shuttles/emergency_lance.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@
/obj/item/stack/medical/ointment{
pixel_x = 5
},
/obj/item/stack/medical/bone_gel/four,
/obj/item/stack/medical/bone_gel,
/turf/open/floor/iron/dark/textured,
/area/shuttle/escape)
"WI" = (
Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/maths.dm
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@
#define SPT_PROB(prob_per_second_percent, seconds_per_tick) (prob(100*SPT_PROB_RATE((prob_per_second_percent)/100, (seconds_per_tick))))
// )

// This value per these many units. Very unnecessary but helpful for readability (For example wanting 30 units of synthflesh to heal 50 damage - VALUE_PER(50, 30))
#define VALUE_PER(value, per) (value / per)

#define GET_TRUE_DIST(a, b) (a == null || b == null) ? -1 : max(abs(a.x -b.x), abs(a.y-b.y), abs(a.z-b.z))

//We used to use linear regression to approximate the answer, but Mloc realized this was actually faster.
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
#define REAGENT_NO_RANDOM_RECIPE (1<<7)
///Does this reagent clean things?
#define REAGENT_CLEANS (1<<8)
///Does this reagent affect wounds? Used to check if some procs should be ran.
#define REAGENT_AFFECTS_WOUNDS (1<<9)

//Chemical reaction flags, for determining reaction specialties
///Convert into impure/pure on reaction completion
Expand Down
15 changes: 9 additions & 6 deletions code/datums/wounds/_wounds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@
return base_xadone_progress_to_qdel * severity

/// When synthflesh is applied to the victim, we call this. No sense in setting up an entire chem reaction system for wounds when we only care for a few chems. Probably will change in the future
/datum/wound/proc/on_synthflesh(power)
/datum/wound/proc/on_synthflesh(reac_volume)
return

/// Called when the patient is undergoing stasis, so that having fully treated a wound doesn't make you sit there helplessly until you think to unbuckle them
Expand Down Expand Up @@ -642,18 +642,21 @@
return "[desc]."

/datum/wound/proc/get_scanner_description(mob/user)
return "Type: [name]\nSeverity: [severity_text()]\nDescription: [desc]\nRecommended Treatment: [treat_text]"
return "Type: [name]\nSeverity: [severity_text(simple = FALSE)]\nDescription: [desc]\nRecommended Treatment: [treat_text]"

/datum/wound/proc/severity_text()
/datum/wound/proc/get_simple_scanner_description(mob/user)
return "[name] detected!\nRisk: [severity_text(simple = TRUE)]\nDescription: [simple_desc ? simple_desc : desc]\n<i>Treatment Guide: [simple_treat_text]</i>\n<i>Homemade Remedies: [homemade_treat_text]</i>"

/datum/wound/proc/severity_text(simple = FALSE)
switch(severity)
if(WOUND_SEVERITY_TRIVIAL)
return "Trivial"
if(WOUND_SEVERITY_MODERATE)
return "Moderate"
return "Moderate" + (simple ? "!" : "")
if(WOUND_SEVERITY_SEVERE)
return "Severe"
return "Severe" + (simple ? "!!" : "")
if(WOUND_SEVERITY_CRITICAL)
return "Critical"
return "Critical" + (simple ? "!!!" : "")

/// Returns TRUE if our limb is the head or chest, FALSE otherwise.
/// Essential in the sense of "we cannot live without it".
Expand Down
13 changes: 13 additions & 0 deletions code/datums/wounds/bones.dm
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@
status_effect_type = /datum/status_effect/wound/blunt/bone/moderate
scar_keyword = "dislocate"

simple_desc = "Patient's bone has been dislocated, causing limping or reduced dexterity."
simple_treat_text = "<b>Bandaging</b> the wound will reduce its impact until treated with a bonesetter. Most commonly, it is treated by aggressively grabbing someone and helpfully wrenching the limb in place, though there's room for malfeasance when doing this."
homemade_treat_text = "Besides bandaging and wrenching, <b>bone setters</b> can be printed in lathes and utilized on oneself at the cost of great pain. As a last resort, <b>crushing</b> the patient with a <b>firelock</b> has sometimes been noted to fix their dislocated limb."

/datum/wound_pregen_data/bone/dislocate
abstract = FALSE

Expand Down Expand Up @@ -330,6 +334,11 @@
wound_flags = (ACCEPTS_GAUZE | MANGLES_INTERIOR)
regen_ticks_needed = 120 // ticks every 2 seconds, 240 seconds, so roughly 4 minutes default

simple_desc = "Patient's bone has cracked in the middle, drastically reducing limb functionality."
simple_treat_text = "<b>Bandaging</b> the wound will reduce its impact until <b>surgically treated</b> with bone gel and surgical tape."
homemade_treat_text = "<b>Bone gel and surgical tape</b> may be applied directly to the wound, though this is quite difficult for most people to do so individually unless they've dosed themselves with one or more <b>painkillers</b> (Morphine and Miner's Salve have been known to help)"


/datum/wound_pregen_data/bone/hairline
abstract = FALSE

Expand Down Expand Up @@ -361,6 +370,10 @@
wound_flags = (ACCEPTS_GAUZE | MANGLES_INTERIOR)
regen_ticks_needed = 240 // ticks every 2 seconds, 480 seconds, so roughly 8 minutes default

simple_desc = "Patient's bones have effectively shattered completely, causing total immobilization of the limb."
simple_treat_text = "<b>Bandaging</b> the wound will slightly reduce its impact until <b>surgically treated</b> with bone gel and surgical tape."
homemade_treat_text = "Although this is extremely difficult and slow to function, <b>Bone gel and surgical tape</b> may be applied directly to the wound, though this is nigh-impossible for most people to do so individually unless they've dosed themselves with one or more <b>painkillers</b> (Morphine and Miner's Salve have been known to help)"

/datum/wound_pregen_data/bone/compound
abstract = FALSE

Expand Down
32 changes: 22 additions & 10 deletions code/datums/wounds/burns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,9 @@
victim.visible_message(span_danger("The infection on the remnants of [victim]'s [limb.plaintext_zone] shift and bubble nauseatingly!"), span_warning("You can feel the infection on the remnants of your [limb.plaintext_zone] coursing through your veins!"), vision_distance = COMBAT_MESSAGE_RANGE)
return

if(victim.reagents)
if(victim.reagents.has_reagent(/datum/reagent/medicine/antipathogenic/spaceacillin))
sanitization += 0.9
if(victim.reagents.has_reagent(/datum/reagent/space_cleaner/sterilizine/))
sanitization += 0.9
if(victim.reagents.has_reagent(/datum/reagent/medicine/mine_salve))
sanitization += 0.3
flesh_healing += 0.5
for(var/datum/reagent/reagent as anything in victim.reagents.reagent_list)
if(reagent.chemical_flags & REAGENT_AFFECTS_WOUNDS)
reagent.on_burn_wound_processing()

if(limb.current_gauze)
limb.seep_gauze(WOUND_BURN_SANITIZATION_RATE * seconds_per_tick)
Expand Down Expand Up @@ -262,8 +257,8 @@
if(sanitization > 0)
infestation = max(infestation - (0.1 * WOUND_BURN_SANITIZATION_RATE * seconds_per_tick), 0)

/datum/wound/burn/flesh/on_synthflesh(amount)
flesh_healing += amount * 0.5 // 20u patch will heal 10 flesh standard
/datum/wound/burn/flesh/on_synthflesh(reac_volume)
flesh_healing += reac_volume * 0.5 // 20u patch will heal 10 flesh standard

/datum/wound_pregen_data/flesh_burn
abstract = TRUE
Expand All @@ -284,11 +279,16 @@
examine_desc = "is badly burned and breaking out in blisters"
occur_text = "breaks out with violent red burns"
severity = WOUND_SEVERITY_MODERATE
damage_multiplier_penalty = 1.1
threshold_penalty = 30 // burns cause significant decrease in limb integrity compared to other wounds
status_effect_type = /datum/status_effect/wound/burn/flesh/moderate
flesh_damage = 5
scar_keyword = "burnmoderate"

simple_desc = "Patient's skin is burned, weakening the limb and multiplying percieved damage!"
simple_treat_text = "Ointment will speed up recovery, as will regenerative mesh. Risk of infection is negligible."
homemade_treat_text = "Healthy tea will speed up recovery. Salt, or preferably a salt-water mixture, will sanitize the wound, but the former will cause skin irritation, increasing the risk of infection."

/datum/wound_pregen_data/flesh_burn/second_degree
abstract = FALSE

Expand All @@ -303,13 +303,18 @@
examine_desc = "appears seriously charred, with aggressive red splotches"
occur_text = "chars rapidly, exposing ruined tissue and spreading angry red burns"
severity = WOUND_SEVERITY_SEVERE
damage_multiplier_penalty = 1.2
threshold_penalty = 40
status_effect_type = /datum/status_effect/wound/burn/flesh/severe
treatable_by = list(/obj/item/flashlight/pen/paramedic, /obj/item/stack/medical/ointment, /obj/item/stack/medical/mesh)
infestation_rate = 0.07 // appx 9 minutes to reach sepsis without any treatment
flesh_damage = 12.5
scar_keyword = "burnsevere"

simple_desc = "Patient's skin is badly burned, significantly weakening the limb and compounding further damage!!"
simple_treat_text = "<b>Bandages will speed up recovery</b>, as will <b>ointment or regenerative mesh</b>. <b>Spaceacilin, sterilizine, and 'Miner's Salve'</b> will help with infection."
homemade_treat_text = "<b>Healthy tea</b> will speed up recovery. <b>Salt</b>, or preferably a <b>salt-water</b> mixture, will sanitize the wound, but the former especially will cause skin irritation and dehydration, speeding up infection. <b>Space Cleaner</b> can be used as disinfectant in a pinch."

/datum/wound_pregen_data/flesh_burn/third_degree
abstract = FALSE

Expand All @@ -324,6 +329,7 @@
examine_desc = "is a ruined mess of blanched bone, melted fat, and charred tissue"
occur_text = "vaporizes as flesh, bone, and fat melt together in a horrifying mess"
severity = WOUND_SEVERITY_CRITICAL
damage_multiplier_penalty = 1.3
sound_effect = 'sound/effects/wounds/sizzle2.ogg'
threshold_penalty = 80
status_effect_type = /datum/status_effect/wound/burn/flesh/critical
Expand All @@ -332,6 +338,10 @@
flesh_damage = 20
scar_keyword = "burncritical"

simple_desc = "Patient's skin is destroyed and tissue charred, leaving the limb with almost <b>no integrity<b> and a drastic chance of <b>infection<b>!!!"
simple_treat_text = "Immediately <b>bandage</b> the wound and treat it with <b>ointment or regenerative mesh</b>. <b>Spaceacilin, sterilizine, or 'Miner's Salve'</b> will stave off infection. Seek professional care <b>immediately</b>, before sepsis sets in and the wound becomes untreatable."
homemade_treat_text = "<b>Healthy tea</b> will help with recovery. A <b>salt-water mixture</b>, topically applied, might help stave off infection in the short term, but pure table salt is NOT recommended. <b>Space Cleaner</b> can be used as disinfectant in a pinch."

/datum/wound_pregen_data/flesh_burn/fourth_degree
abstract = FALSE

Expand All @@ -346,6 +356,8 @@
examine_desc = "appears to have holy symbols painfully branded into their flesh, leaving severe burns."
occur_text = "chars rapidly into a strange pattern of holy symbols, burned into the flesh."

simple_desc = "Patient's skin has had strange markings burned onto it, significantly weakening the limb and compounding further damage!!"

/datum/wound_pregen_data/flesh_burn/third_degree/holy
abstract = FALSE
can_be_randomly_generated = FALSE
Expand Down
13 changes: 11 additions & 2 deletions code/datums/wounds/pierce.dm
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@
if (limb) // parent can cause us to be removed, so its reasonable to check if we're still applied
adjust_blood_flow(-0.03 * power) // i think it's like a minimum of 3 power, so .09 blood_flow reduction per tick is pretty good for 0 effort

/datum/wound/pierce/bleed/on_synthflesh(power)
/datum/wound/pierce/bleed/on_synthflesh(reac_volume)
. = ..()
adjust_blood_flow(-0.025 * power) // 20u * 0.05 = -1 blood flow, less than with slashes but still good considering smaller bleed rates
adjust_blood_flow(-0.025 * reac_volume) // 20u * 0.05 = -1 blood flow, less than with slashes but still good considering smaller bleed rates

/// If someone is using a suture to close this puncture
/datum/wound/pierce/bleed/proc/suture(obj/item/stack/medical/suture/I, mob/user)
Expand Down Expand Up @@ -202,6 +202,9 @@
status_effect_type = /datum/status_effect/wound/pierce/moderate
scar_keyword = "piercemoderate"

simple_treat_text = "<b>Bandaging</b> the wound will reduce blood loss, help the wound close by itself quicker, and speed up the blood recovery period. The wound itself can be slowly <b>sutured</b> shut."
homemade_treat_text = "<b>Tea</b> stimulates the body's natural healing systems, slightly fastening clotting. The wound itself can be rinsed off on a sink or shower as well. Other remedies are unnecessary."

/datum/wound_pregen_data/flesh_pierce/breakage
abstract = FALSE

Expand Down Expand Up @@ -230,6 +233,9 @@
status_effect_type = /datum/status_effect/wound/pierce/severe
scar_keyword = "piercesevere"

simple_treat_text = "<b>Bandaging</b> the wound is essential, and will reduce blood loss. Afterwards, the wound can be <b>sutured</b> shut, preferably while the patient is resting and/or grasping their wound."
homemade_treat_text = "Bed sheets can be ripped up to make <b>makeshift gauze</b>. <b>Flour, table salt, or salt mixed with water</b> can be applied directly to stem the flow, though unmixed salt will irritate the skin and worsen natural healing. Resting and grabbing your wound will also reduce bleeding."

/datum/wound_pregen_data/flesh_pierce/open_puncture
abstract = FALSE

Expand Down Expand Up @@ -258,6 +264,9 @@
scar_keyword = "piercecritical"
wound_flags = (ACCEPTS_GAUZE | MANGLES_EXTERIOR | CAN_BE_GRASPED)

simple_treat_text = "<b>Bandaging</b> the wound is of utmost importance, as is seeking direct medical attention - <b>Death</b> will ensue if treatment is delayed whatsoever, with lack of <b>oxygen</b> killing the patient, thus <b>Food, Iron, and saline solution</b> is always recommended after treatment. This wound will not naturally seal itself."
homemade_treat_text = "Bed sheets can be ripped up to make <b>makeshift gauze</b>. <b>Flour, salt, and saltwater</b> topically applied will help. Dropping to the ground and grabbing your wound will reduce blood flow."

/datum/wound_pregen_data/flesh_pierce/cavity
abstract = FALSE

Expand Down
24 changes: 19 additions & 5 deletions code/datums/wounds/slash.dm
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@
if (limb) // parent can cause us to be removed, so its reasonable to check if we're still applied
adjust_blood_flow(-0.03 * power) // i think it's like a minimum of 3 power, so .09 blood_flow reduction per tick is pretty good for 0 effort

/datum/wound/slash/flesh/on_synthflesh(power)
/datum/wound/slash/flesh/on_synthflesh(reac_volume)
. = ..()
adjust_blood_flow(-0.075 * power) // 20u * 0.075 = -1.5 blood flow, pretty good for how little effort it is
adjust_blood_flow(-0.075 * reac_volume) // 20u * 0.075 = -1.5 blood flow, pretty good for how little effort it is

/// If someone's putting a laser gun up to our cut to cauterize it
/datum/wound/slash/flesh/proc/las_cauterize(obj/item/gun/energy/laser/lasgun, mob/user)
Expand All @@ -257,8 +257,15 @@
var/improv_penalty_mult = (I.tool_behaviour == TOOL_CAUTERY ? 1 : 1.25) // 25% longer and less effective if you don't use a real cautery
var/self_penalty_mult = (user == victim ? 1.5 : 1) // 50% longer and less effective if you do it to yourself

user.visible_message(span_danger("[user] begins cauterizing [victim]'s [limb.plaintext_zone] with [I]..."), span_warning("You begin cauterizing [user == victim ? "your" : "[victim]'s"] [limb.plaintext_zone] with [I]..."))
if(!do_after(user, base_treat_time * self_penalty_mult * improv_penalty_mult, target=victim, extra_checks = CALLBACK(src, PROC_REF(still_exists))))
var/treatment_delay = base_treat_time * self_penalty_mult * improv_penalty_mult

if(HAS_TRAIT(src, TRAIT_WOUND_SCANNED))
treatment_delay *= 0.5
user.visible_message(span_danger("[user] begins expertly cauterizing [victim]'s [limb.plaintext_zone] with [I]..."), span_warning("You begin cauterizing [user == victim ? "your" : "[victim]'s"] [limb.plaintext_zone] with [I], keeping the holo-image indications in mind..."))
else
user.visible_message(span_danger("[user] begins cauterizing [victim]'s [limb.plaintext_zone] with [I]..."), span_warning("You begin cauterizing [user == victim ? "your" : "[victim]'s"] [limb.plaintext_zone] with [I]..."))

if(!do_after(user, treatment_delay, target = victim, extra_checks = CALLBACK(src, PROC_REF(still_exists))))
return
var/bleeding_wording = (!limb.can_bleed() ? "cuts" : "bleeding")
user.visible_message(span_green("[user] cauterizes some of the [bleeding_wording] on [victim]."), span_green("You cauterize some of the [bleeding_wording] on [victim]."))
Expand Down Expand Up @@ -321,6 +328,9 @@
status_effect_type = /datum/status_effect/wound/slash/flesh/moderate
scar_keyword = "slashmoderate"

simple_treat_text = "<b>Bandaging</b> the wound will reduce blood loss, help the wound close by itself quicker, and speed up the blood recovery period. The wound itself can be slowly <b>sutured</b> shut."
homemade_treat_text = "<b>Tea</b> stimulates the body's natural healing systems, slightly fastening clotting. The wound itself can be rinsed off on a sink or shower as well. Other remedies are unnecessary."

/datum/wound/slash/flesh/moderate/update_descriptions()
if(!limb.can_bleed())
occur_text = "is cut open"
Expand Down Expand Up @@ -348,6 +358,9 @@
status_effect_type = /datum/status_effect/wound/slash/flesh/severe
scar_keyword = "slashsevere"

simple_treat_text = "<b>Bandaging</b> the wound is essential, and will reduce blood loss. Afterwards, the wound can be <b>sutured</b> shut, preferably while the patient is resting and/or grasping their wound."
homemade_treat_text = "Bed sheets can be ripped up to make <b>makeshift gauze</b>. <b>Flour, table salt, or salt mixed with water</b> can be applied directly to stem the flow, though unmixed salt will irritate the skin and worsen natural healing. Resting and grabbing your wound will also reduce bleeding."

/datum/wound_pregen_data/flesh_slash/laceration
abstract = FALSE

Expand Down Expand Up @@ -375,6 +388,8 @@
status_effect_type = /datum/status_effect/wound/slash/flesh/critical
scar_keyword = "slashcritical"
wound_flags = (ACCEPTS_GAUZE | MANGLES_EXTERIOR | CAN_BE_GRASPED)
simple_treat_text = "<b>Bandaging</b> the wound is of utmost importance, as is seeking direct medical attention - <b>Death</b> will ensue if treatment is delayed whatsoever, with lack of <b>oxygen</b> killing the patient, thus <b>Food, Iron, and saline solution</b> is always recommended after treatment. This wound will not naturally seal itself."
homemade_treat_text = "Bed sheets can be ripped up to make <b>makeshift gauze</b>. <b>Flour, salt, and saltwater</b> topically applied will help. Dropping to the ground and grabbing your wound will reduce blood flow."

/datum/wound/slash/flesh/critical/update_descriptions()
if (!limb.can_bleed())
Expand All @@ -384,7 +399,6 @@
abstract = FALSE

wound_path_to_generate = /datum/wound/slash/flesh/critical

threshold_minimum = 80

/datum/wound/slash/flesh/moderate/many_cuts
Expand Down
Loading

0 comments on commit 0e276a3

Please sign in to comment.