From 8fd62f87029c5042ba4ffd4a97b4ff3541a065c0 Mon Sep 17 00:00:00 2001
From: Contrabang <91113370+Contrabang@users.noreply.github.com>
Date: Wed, 25 Sep 2024 07:09:56 -0400
Subject: [PATCH] Protects living damage variables (#26892)
---
code/datums/components/riding/riding_vehicle.dm | 2 +-
code/datums/status_effects/buffs.dm | 4 ++--
code/game/machinery/clonepod.dm | 4 ++--
code/modules/antagonists/vampire/vamp_datum.dm | 2 +-
code/modules/martial_arts/martial.dm | 4 ++--
.../mob/living/carbon/human/species/_species.dm | 2 +-
code/modules/mob/living/living_defines.dm | 12 ++++++------
7 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/code/datums/components/riding/riding_vehicle.dm b/code/datums/components/riding/riding_vehicle.dm
index f79270b13da..55cd8c72119 100644
--- a/code/datums/components/riding/riding_vehicle.dm
+++ b/code/datums/components/riding/riding_vehicle.dm
@@ -144,7 +144,7 @@
return
var/obj/tgvehicle/scooter/skateboard/S = parent
for(var/mob/living/L in S.return_occupants()) // Only one on a skateboard unless an admin var edits it. If an admin var edits it, that is on them.
- if((L.staminaloss >= 60 || L.health <= 40) && !L.absorb_stun(0)) // Only injured people can be shot off. Hulks and people on stimulants can not be shot off.
+ if((L.getStaminaLoss() >= 60 || L.health <= 40) && !L.absorb_stun(0)) // Only injured people can be shot off. Hulks and people on stimulants can not be shot off.
S.unbuckle_mob(L)
L.KnockDown(2 SECONDS)
L.visible_message("[L] gets shot off [S] by [projectile]!",
diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm
index 1d0e1d9d258..aadac8f9d6d 100644
--- a/code/datums/status_effects/buffs.dm
+++ b/code/datums/status_effects/buffs.dm
@@ -550,7 +550,7 @@
return TRUE
/datum/status_effect/speedlegs/tick()
- if(owner.stat || owner.staminaloss >= 90 || cling.chem_charges <= (stacks + 1) * 3)
+ if(owner.stat || owner.getStaminaLoss() >= 90 || cling.chem_charges <= (stacks + 1) * 3)
to_chat(owner, "Our muscles relax without the energy to strengthen them.")
owner.Weaken(6 SECONDS)
qdel(src)
@@ -561,7 +561,7 @@
to_chat(owner, "Our legs are really starting to hurt...")
/datum/status_effect/speedlegs/before_remove()
- if(stacks < 3 && !(owner.stat || owner.staminaloss >= 90 || cling.chem_charges <= (stacks + 1) * 3)) //We don't want people to turn it on and off fast, however, we need it forced off if the 3 later conditions are met.
+ if(stacks < 3 && !(owner.stat || owner.getStaminaLoss() >= 90 || cling.chem_charges <= (stacks + 1) * 3)) //We don't want people to turn it on and off fast, however, we need it forced off if the 3 later conditions are met.
to_chat(owner, "Our muscles just tensed up, they will not relax so fast.")
return FALSE
return TRUE
diff --git a/code/game/machinery/clonepod.dm b/code/game/machinery/clonepod.dm
index 3113a14f56d..9dbbc05c984 100644
--- a/code/game/machinery/clonepod.dm
+++ b/code/game/machinery/clonepod.dm
@@ -245,7 +245,7 @@
create_clone()
return
- if(clone.cloneloss >= 25)
+ if(clone.getCloneLoss() >= 25)
clone.adjustCloneLoss(-2)
return
@@ -373,7 +373,7 @@
reset_cloning()
return TRUE
- if(!clone.cloneloss)
+ if(!clone.getCloneLoss())
clone.forceMove(loc)
var/datum/mind/patient_mind = locateUID(patient_data.mindUID)
patient_mind.transfer_to(clone)
diff --git a/code/modules/antagonists/vampire/vamp_datum.dm b/code/modules/antagonists/vampire/vamp_datum.dm
index 60588ac5ca3..cc62c38b72d 100644
--- a/code/modules/antagonists/vampire/vamp_datum.dm
+++ b/code/modules/antagonists/vampire/vamp_datum.dm
@@ -233,7 +233,7 @@ RESTRICT_TYPE(/datum/antagonist/vampire)
to_chat(owner.current, "Your body is turning to ash, get out of the starlight NOW!")
owner.current.adjustCloneLoss(10) //I'm melting!
vamp_burn(85)
- if(owner.current.cloneloss >= 100)
+ if(owner.current.getCloneLoss() >= 100)
owner.current.dust()
/datum/antagonist/vampire/proc/handle_vampire()
diff --git a/code/modules/martial_arts/martial.dm b/code/modules/martial_arts/martial.dm
index b9d1100c17c..603599a9228 100644
--- a/code/modules/martial_arts/martial.dm
+++ b/code/modules/martial_arts/martial.dm
@@ -426,8 +426,8 @@
H.visible_message("[H] collapses!", \
"Your legs give out!")
H.Weaken(8 SECONDS)
- if(H.staminaloss && !H.IsSleeping())
- var/total_health = (H.health - H.staminaloss)
+ if(H.getStaminaLoss() && !H.IsSleeping())
+ var/total_health = (H.health - H.getStaminaLoss())
if(total_health <= HEALTH_THRESHOLD_CRIT && !H.stat)
H.visible_message("[user] delivers a heavy hit to [H]'s head, knocking [H.p_them()] out cold!", \
"[user] knocks you unconscious!")
diff --git a/code/modules/mob/living/carbon/human/species/_species.dm b/code/modules/mob/living/carbon/human/species/_species.dm
index d51046d14b6..26b07818d2d 100644
--- a/code/modules/mob/living/carbon/human/species/_species.dm
+++ b/code/modules/mob/living/carbon/human/species/_species.dm
@@ -337,7 +337,7 @@
. = round_down(. * SLOWDOWN_MULTIPLIER) / SLOWDOWN_MULTIPLIER //This allows us to round in values of 0.5 A slowdown of 0.55 becomes 1.10, which is rounded to 1, then reduced to 0.5
leftover -= .
- var/health_deficiency = max(H.maxHealth - H.health, H.staminaloss)
+ var/health_deficiency = max(H.maxHealth - H.health, H.getStaminaLoss())
if(H.reagents)
for(var/datum/reagent/R in H.reagents.reagent_list)
if(R.shock_reduction)
diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm
index 0471a39bcad..27e41f391a2 100644
--- a/code/modules/mob/living/living_defines.dm
+++ b/code/modules/mob/living/living_defines.dm
@@ -15,12 +15,12 @@
var/health = 100 //A mob's health
//Damage related vars, NOTE: THESE SHOULD ONLY BE MODIFIED BY PROCS
- var/bruteloss = 0 //Brutal damage caused by brute force (punching, being clubbed by a toolbox ect... this also accounts for pressure damage)
- var/oxyloss = 0 //Oxygen depravation damage (no air in lungs)
- var/toxloss = 0 //Toxic damage caused by being poisoned or radiated
- var/fireloss = 0 //Burn damage caused by being way too hot, too cold or burnt.
- var/cloneloss = 0 //Damage caused by being cloned or ejected from the cloner early. slimes also deal cloneloss damage to victims
- var/staminaloss = 0 //Stamina damage, or exhaustion. You recover it slowly naturally, and are stunned if it gets too high. Holodeck and hallucinations deal this.
+ VAR_PROTECTED/bruteloss = 0 //Brutal damage caused by brute force (punching, being clubbed by a toolbox ect... this also accounts for pressure damage)
+ VAR_PROTECTED/oxyloss = 0 //Oxygen depravation damage (no air in lungs)
+ VAR_PROTECTED/toxloss = 0 //Toxic damage caused by being poisoned or radiated
+ VAR_PROTECTED/fireloss = 0 //Burn damage caused by being way too hot, too cold or burnt.
+ VAR_PROTECTED/cloneloss = 0 //Damage caused by being cloned or ejected from the cloner early. slimes also deal cloneloss damage to victims
+ VAR_PROTECTED/staminaloss = 0 //Stamina damage, or exhaustion. You recover it slowly naturally, and are stunned if it gets too high. Holodeck and hallucinations deal this.
var/last_special = 0 //Used by the resist verb, likely used to prevent players from bypassing next_move by logging in/out.