Improve, cleanup, and expand wound code (#20757)

This PR includes several changes to bring our wound code up to date with
baystation, nebula, and modern standards. Highlights include:
- The usage of integers between 0 and 100 for ratios (expressed as a
percentage), instead of 0.0 to 1.0. Small decimal values are prone to
floating point precision errors, but by moving to a percentage instead,
we can reduce the impact of this.
- The untangling of damage flags and injury flags, which were used
interchangably in the code. This could have caused issues should we
expand any of these.
- Larger embedded objects now halt bleeding in wounds, until they are
pulled out. In exchange however, embedded objects will halt healing in
wounds (it is difficult to close an open wound that currently has a rod
stuck in it)
- A lot of data, such as implanted objects and organs, are now stored in
amputated limbs.
This commit is contained in:
Cody Brittain
2025-12-19 15:22:29 -05:00
committed by GitHub
parent 034d0e4cb1
commit 96a2951608
23 changed files with 861 additions and 575 deletions
+27 -24
View File
@@ -45,43 +45,46 @@ BREATH ANALYZER
health_scan_mob(user, user, mode, sound_scan = sound_scan)
add_fingerprint(user)
/proc/get_wound_severity(var/damage_ratio, var/uppercase = FALSE) //Used for ratios.
/// Calculates severity based on the ratios defined external limbs.
/proc/get_wound_severity(damage_ratio, uppercase = FALSE)
var/degree = "none"
switch(damage_ratio)
if(0.001 to 0.1)
if (0 to 10)
degree = "minor"
if(0.1 to 0.2)
if (11 to 25)
degree = "moderate"
if(0.2 to 0.4)
if (26 to 50)
degree = "significant"
if(0.4 to 0.6)
if (51 to 75)
degree = "severe"
if(0.6 to 0.8)
degree = "critical"
if(0.8 to 1)
degree = "fatal"
if (76 to 99)
degree = "extreme"
if (99 to INFINITY)
degree = "irreparable"
if(uppercase)
degree = capitalize(degree)
return degree
/proc/get_severity(amount, var/uppercase = FALSE)
/proc/get_severity(amount, uppercase = FALSE)
var/output = "none"
if(!amount)
output = "none"
else if(amount > 100)
output = "fatal"
else if(amount > 75)
output = "critical"
else if(amount > 50)
output = "severe"
else if(amount > 25)
output = "significant"
else if(amount > 10)
output = "moderate"
else
output = "minor"
switch(amount)
if (0)
output = "none"
if (1 to 10)
output = "minor"
if (11 to 25)
output = "moderate"
if (26 to 50)
output = "significant"
if (51 to 75)
output = "severe"
if (76 to 99)
output = "extreme"
if (100 to INFINITY)
output = "irreparable"
if(uppercase)
output = capitalize(output)
+2 -2
View File
@@ -162,7 +162,7 @@ Contains:
user.visible_message(SPAN_NOTICE("\The [user] bandages \a [W.desc] on [target_mob]'s [affecting.name]."), \
SPAN_NOTICE("You bandage \a [W.desc] on [target_mob]'s [affecting.name]."))
//H.add_side_effect("Itch")
else if (W.damage_type == BRUISE)
else if (W.damage_type == INJURY_TYPE_BRUISE)
user.visible_message(SPAN_NOTICE("\The [user] places a bruise patch over \a [W.desc] on [target_mob]'s [affecting.name]."), \
SPAN_NOTICE("You place a bruise patch over \a [W.desc] on [target_mob]'s [affecting.name]."))
else
@@ -289,7 +289,7 @@ Contains:
user.visible_message(SPAN_NOTICE("\The [user] cleans \a [W.desc] on [target_mob]'s [affecting.name] and seals the edges with bioglue."), \
SPAN_NOTICE("You clean and seal \a [W.desc] on [target_mob]'s [affecting.name]."))
//H.add_side_effect("Itch")
else if (W.damage_type == BRUISE)
else if (W.damage_type == INJURY_TYPE_BRUISE)
user.visible_message(SPAN_NOTICE("\The [user] places a medical patch over \a [W.desc] on [target_mob]'s [affecting.name]."), \
SPAN_NOTICE("You place a medical patch over \a [W.desc] on [target_mob]'s [affecting.name]."))
else
@@ -180,7 +180,7 @@
if(ishuman(imp_in) && part)
//No tearing off these parts since it's pretty much killing. Mangle them.
if(part.vital && !istype(part, /obj/item/organ/external/head)) //Head explodes
part.createwound(BRUISE, 70)
part.createwound(INJURY_TYPE_BRUISE, 70)
part.add_pain(50)
imp_in.visible_message(SPAN_WARNING("\The [imp_in]'s [part.name] bursts open with a horrible ripping noise!"),
SPAN_DANGER("Your [part.name] bursts open with a horrible ripping noise!"),