Skip to content

Commit 8b391aa

Browse files
authored
salving external wounds can salve internal ones (#8631)
progression pain only triggers on self-progression, otherwise deferring pain to other processes severity reduction resetting progress now also resets death progress resetting progress/death progress flags becomes branchless chems can temporarily stabilize wounds
1 parent ed8ecdc commit 8b391aa

File tree

5 files changed

+51
-7
lines changed

5 files changed

+51
-7
lines changed

code/__DEFINES/damage_organs.dm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,20 @@
177177
#define IWOUND_SPREAD (1<<3)
178178
#define IWOUND_HALLUCINATE (1<<4)
179179
#define IWOUND_AGGRAVATION (1<<5)
180+
#define IWOUND_RECOVER (1<<6)
181+
#define IWOUND_STASIS (1<<7) // disables certain automatic flag changes
180182

181183
#define IWOUND_INSIGNIFICANT_DAMAGE 0.05
182184
#define IWOUND_LIGHT_DAMAGE 0.1
183185
#define IWOUND_MEDIUM_DAMAGE 0.25
184186
#define IWOUND_HEAVY_DAMAGE 0.5
185187

188+
#define WE_SALVE "salve" // salves
189+
#define WE_BANDAGE "bandage" // bandaging
190+
191+
#define WOUND_STABLE 1
192+
#define WOUND_RECOVER 2
193+
186194
#define IWOUND_1_MINUTE 30
187195
#define IWOUND_2_MINUTES 60
188196
#define IWOUND_3_MINUTES 90

code/modules/organs/external/_external.dm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,12 @@ This function completely restores a damaged organ to perfect condition.
705705
for(var/datum/wound/W in wounds)
706706
rval |= !W.salved
707707
W.salved = 1
708+
if(rval)
709+
for(var/obj/item/organ/internal/tofix in internal_organs)
710+
for(var/grabthis in tofix.wounddatums)
711+
if(istype(tofix.wounddatums[grabthis], /datum/internal_wound))
712+
var/datum/internal_wound/patchthis = tofix.wounddatums[grabthis]
713+
patchthis.first_aid(list(WE_SALVE))
708714
return rval
709715

710716
/obj/item/organ/external/proc/clamp_wounds()

code/modules/organs/internal/_internal.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@
474474
if(IW in wounddatums)
475475
var/datum/internal_wound/old_wound = wounddatums[IW]
476476
old_wound.progress() // Getting a new wound of the same type as an existing wound will progress it
477+
old_wound.characteristic_flag &= ~(IWOUND_STASIS) // and knock it out of stasis
477478
else
478479
var/datum/internal_wound/new_wound = new IW()
479480
if(wound_name)

code/modules/organs/internal/internal_wounds/_internal_wound.dm

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
var/list/treatments_item = list() // list(/obj/item = amount)
66
var/list/treatments_tool = list() // list(QUALITY_TOOL = FAILCHANCE)
77
var/list/treatments_chem = list() // list(CE_CHEMEFFECT = strength)
8+
var/list/stabilizers_chem = list() // like the above, but for stabilizing the wound.
9+
var/list/firstaid_type = list() //list(WE_TREATMENTTYPE = TREATEFFECT)
810
var/datum/internal_wound/scar // If defined, applies this wound type when successfully treated
911

1012
var/diagnosis_stat // BIO for organic, MEC for robotic
@@ -17,6 +19,8 @@
1719
// IWOUND_SPREAD - Allows the wound to spread to another organ
1820
// IWOUND_HALLUCINATE - Causes hallucinations
1921
// IWOUND_AGGRAVATION - inheritance increases severity gradually if progress IW flag is not present
22+
//IWOUND_RECOVER - recovers over time
23+
//IWOUND_STASIS - disables certain automatic changes
2024
var/characteristic_flag = IWOUND_CAN_DAMAGE|IWOUND_PROGRESS
2125

2226
var/severity = 0 // How much the wound contributes to internal organ damage
@@ -92,8 +96,10 @@
9296
if((!parent || O.status & ORGAN_DEAD) && !(characteristic_flag & IWOUND_PROGRESS_DEATH))
9397
return PROCESS_KILL
9498

95-
// Progress if not in a cryo tube or in stasis
96-
if(characteristic_flag & IWOUND_PROGRESS && (H && !(H.bodytemperature < 170 || H.in_stasis)))
99+
// Progress if not recovering or in a cryo tube or in stasis
100+
if(characteristic_flag & IWOUND_RECOVER)
101+
treatment_slow()
102+
else if(characteristic_flag & IWOUND_PROGRESS && (H && !(H.bodytemperature < 170 || H.in_stasis)))
97103
++current_progression_tick
98104
if(current_progression_tick >= progression_threshold)
99105
current_progression_tick = 0
@@ -102,6 +108,7 @@
102108
if(!H)
103109
return
104110

111+
var/stabilized = characteristic_flag & IWOUND_STASIS
105112
// Chemical treatment handling
106113
var/list/owner_ce = H.chem_effects
107114
for(var/chem_effect in owner_ce)
@@ -110,6 +117,12 @@
110117
owner_ce[chem_effect] -= treatment_threshold
111118
treatment(FALSE)
112119
return
120+
if(chem_effect in stabilizers_chem)
121+
stabilized = TRUE
122+
if(stabilized)
123+
characteristic_flag &= ~(IWOUND_PROGRESS|IWOUND_PROGRESS_DEATH) // gotta do this somehow
124+
else if(severity < severity_max)
125+
characteristic_flag |= (initial(characteristic_flag) & (IWOUND_PROGRESS|IWOUND_PROGRESS_DEATH)) // re-add if not stabilized/stasis
113126

114127
// Spread once
115128
if(characteristic_flag & IWOUND_SPREAD)
@@ -153,10 +166,10 @@
153166
var/obj/item/organ/O = parent
154167
var/obj/item/organ/external/E = parent ? O.parent : null
155168
var/mob/living/carbon/human/H = parent ? O.owner : null
156-
if(((characteristic_flag & IWOUND_CAN_DAMAGE) || hal_damage) && H)
157-
H.custom_pain("Something inside your [E.name] hurts a lot.", 0)
158169
if(severity < severity_max)
159170
++severity
171+
if(((characteristic_flag & IWOUND_CAN_DAMAGE) || hal_damage) && H)
172+
H.custom_pain("Something inside your [E.name] hurts a lot.", 0)
160173
else
161174
characteristic_flag &= ~(IWOUND_PROGRESS|IWOUND_PROGRESS_DEATH) // Lets us remove the wound from processing
162175
if(next_wound && ispath(next_wound, /datum/internal_wound))
@@ -227,8 +240,7 @@
227240
if(severity > 0 && !used_tool)
228241
--severity
229242
// If it was turned off by reaching the max, turn it on again.
230-
if(initial(characteristic_flag) & IWOUND_PROGRESS)
231-
characteristic_flag |= IWOUND_PROGRESS
243+
characteristic_flag |= (initial(characteristic_flag) & (IWOUND_PROGRESS|IWOUND_PROGRESS_DEATH))
232244
else
233245
if(!used_autodoc && scar && ispath(scar, /datum/internal_wound))
234246
SEND_SIGNAL_OLD(parent, COMSIG_IORGAN_ADD_WOUND, pick(subtypesof(scar)))
@@ -243,6 +255,19 @@
243255
if(!QDELING(src) && treatmentamount < amount)
244256
treatment_slow(amount - treatmentamount)
245257

258+
/datum/internal_wound/proc/first_aid(list/aideffects = list())
259+
parent?.owner.visible_message("aid attempt")
260+
for(var/totest in aideffects)
261+
if(firstaid_type[totest])
262+
switch(firstaid_type[totest])
263+
if(WOUND_STABLE)
264+
characteristic_flag &= ~(IWOUND_PROGRESS|IWOUND_PROGRESS_DEATH)
265+
characteristic_flag |= IWOUND_STASIS
266+
if(WOUND_RECOVER)
267+
characteristic_flag |= IWOUND_RECOVER
268+
break // most potent effect should end the loop
269+
270+
246271
/datum/internal_wound/proc/apply_effects()
247272
var/obj/item/organ/internal/O = parent
248273

code/modules/organs/internal/internal_wounds/organic.dm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@
8787
/datum/internal_wound/organic/burn
8888
treatments_item = list(/obj/item/stack/medical/advanced/ointment = 2)
8989
treatments_tool = list(QUALITY_CUTTING = FAILCHANCE_NORMAL)
90-
treatments_chem = list(CE_STABLE = 1) // Inaprov will only keep it from killing you
90+
firstaid_type = list(WE_SALVE = WOUND_STABLE) //salving won't cure it, but it will stabilize it.
91+
stabilizers_chem = list(CE_STABLE = 1) // Inaprov will only keep it from killing you
9192
scar = /datum/internal_wound/organic/necrosis_start
9293
severity = 0
9394
severity_max = 5
@@ -113,6 +114,8 @@
113114

114115
/datum/internal_wound/organic/necrosis_start
115116
treatments_tool = list(QUALITY_CUTTING = FAILCHANCE_NORMAL)
117+
firstaid_type = list(CE_STABLE = WOUND_STABLE)
118+
stabilizers_chem = list(CE_STABLE, CE_ANTIBIOTIC)
116119
severity = 0
117120
severity_max = 1
118121
next_wound = /datum/internal_wound/organic/necrosis
@@ -251,6 +254,7 @@
251254
/datum/internal_wound/organic/swelling
252255
treatments_tool = list(QUALITY_CUTTING = FAILCHANCE_NORMAL)
253256
treatments_chem = list(CE_ANTIBIOTIC = 5) // Spaceacillin
257+
firstaid_type = list(WE_SALVE = WOUND_RECOVER)
254258
severity = 0
255259
severity_max = 3
256260
next_wound = /datum/internal_wound/organic/infection

0 commit comments

Comments
 (0)