From 1646cc73ce65ed2c9aff7c81e17d9732eaf73758 Mon Sep 17 00:00:00 2001
From: kevinz000 <2003111+kevinz000@users.noreply.github.com>
Date: Fri, 23 Mar 2018 04:36:35 -0700
Subject: [PATCH] Combat Overhaul Staging: Limb Specific Stamina and status
effect clickdelay modifiers! (#36274)
---
code/_onclick/click.dm | 8 ++
code/datums/status_effects/debuffs.dm | 6 +-
code/datums/status_effects/status_effect.dm | 7 ++
.../antagonists/abductor/equipment/gland.dm | 2 +-
code/modules/mob/living/carbon/carbon.dm | 3 +
.../modules/mob/living/carbon/damage_procs.dm | 96 +++++++++++--------
code/modules/mob/living/carbon/human/human.dm | 2 +-
.../mob/living/carbon/human/human_defense.dm | 4 +-
.../mob/living/carbon/human/species.dm | 6 +-
code/modules/mob/living/carbon/life.dm | 2 +-
code/modules/mob/living/damage_procs.dm | 33 ++++---
code/modules/mob/living/living.dm | 17 ++--
code/modules/mob/mob_helpers.dm | 2 +-
.../chemistry/reagents/alcohol_reagents.dm | 8 +-
.../chemistry/reagents/medicine_reagents.dm | 6 +-
.../chemistry/reagents/other_reagents.dm | 2 +-
.../chemistry/reagents/toxin_reagents.dm | 4 +-
code/modules/surgery/bodyparts/bodyparts.dm | 58 +++++------
code/modules/surgery/organs/vocal_cords.dm | 2 +-
19 files changed, 160 insertions(+), 108 deletions(-)
diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm
index f72754566d5a..e2298e4ec304 100644
--- a/code/_onclick/click.dm
+++ b/code/_onclick/click.dm
@@ -20,6 +20,14 @@
/mob/proc/changeNext_move(num)
next_move = world.time + ((num+next_move_adjust)*next_move_modifier)
+/mob/living/changeNext_move(num)
+ var/mod = next_move_modifier
+ var/adj = next_move_adjust
+ for(var/i in status_effects)
+ var/datum/status_effect/S = i
+ mod *= S.nextmove_modifier()
+ adj += S.nextmove_adjust()
+ next_move = world.time + ((num + adj)*mod)
/*
Before anything else, defer these calls to a per-mobtype handler. This allows us to
diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm
index 915d5bce8d61..fd5cf79f5956 100644
--- a/code/datums/status_effects/debuffs.dm
+++ b/code/datums/status_effects/debuffs.dm
@@ -30,7 +30,7 @@
id = "knockdown"
/datum/status_effect/incapacitating/knockdown/tick()
- if(owner.staminaloss)
+ if(owner.getStaminaLoss())
owner.adjustStaminaLoss(-0.3) //reduce stamina loss by 0.3 per tick, 6 per 2 seconds
@@ -40,7 +40,7 @@
needs_update_stat = TRUE
/datum/status_effect/incapacitating/unconscious/tick()
- if(owner.staminaloss)
+ if(owner.getStaminaLoss())
owner.adjustStaminaLoss(-0.3) //reduce stamina loss by 0.3 per tick, 6 per 2 seconds
//SLEEPING
@@ -65,7 +65,7 @@
return ..()
/datum/status_effect/incapacitating/sleeping/tick()
- if(owner.staminaloss)
+ if(owner.getStaminaLoss())
owner.adjustStaminaLoss(-0.5) //reduce stamina loss by 0.5 per tick, 10 per 2 seconds
if(human_owner && human_owner.drunkenness)
human_owner.drunkenness *= 0.997 //reduce drunkenness by 0.3% per tick, 6% per 2 seconds
diff --git a/code/datums/status_effects/status_effect.dm b/code/datums/status_effects/status_effect.dm
index e24359d18ce3..c8bcd831e218 100644
--- a/code/datums/status_effects/status_effect.dm
+++ b/code/datums/status_effects/status_effect.dm
@@ -63,6 +63,13 @@
owner = null
qdel(src)
+//clickdelay/nextmove modifiers!
+/datum/status_effect/proc/nextmove_modifier()
+ return 1
+
+/datum/status_effect/proc/nextmove_adjust()
+ return 0
+
////////////////
// ALERT HOOK //
////////////////
diff --git a/code/modules/antagonists/abductor/equipment/gland.dm b/code/modules/antagonists/abductor/equipment/gland.dm
index 3db66dee573c..c551509cc702 100644
--- a/code/modules/antagonists/abductor/equipment/gland.dm
+++ b/code/modules/antagonists/abductor/equipment/gland.dm
@@ -105,7 +105,7 @@
/obj/item/organ/heart/gland/heals/activate()
to_chat(owner, "You feel curiously revitalized.")
owner.adjustToxLoss(-20, FALSE, TRUE)
- owner.heal_bodypart_damage(20, 20, TRUE)
+ owner.heal_bodypart_damage(20, 20, 0, TRUE)
owner.adjustOxyLoss(-20)
/obj/item/organ/heart/gland/slime
diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm
index a274f1b00cf1..79b0cf93f7b6 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -504,11 +504,14 @@
return
var/total_burn = 0
var/total_brute = 0
+ var/total_stamina = 0
for(var/X in bodyparts) //hardcoded to streamline things a bit
var/obj/item/bodypart/BP = X
total_brute += BP.brute_dam
total_burn += BP.burn_dam
+ total_stamina += BP.stamina_dam
health = maxHealth - getOxyLoss() - getToxLoss() - getCloneLoss() - total_burn - total_brute
+ staminaloss = total_stamina
update_stat()
if(((maxHealth - total_burn) < HEALTH_THRESHOLD_DEAD) && stat == DEAD )
become_husk("burn")
diff --git a/code/modules/mob/living/carbon/damage_procs.dm b/code/modules/mob/living/carbon/damage_procs.dm
index 8282af1c3dd3..8aa52e6c8671 100644
--- a/code/modules/mob/living/carbon/damage_procs.dm
+++ b/code/modules/mob/living/carbon/damage_procs.dm
@@ -35,10 +35,14 @@
if(CLONE)
adjustCloneLoss(damage * hit_percent)
if(STAMINA)
- adjustStaminaLoss(damage * hit_percent)
+ if(BP)
+ if(BP.receive_damage(0, 0, damage * hit_percent))
+ update_damage_overlays()
+ else
+ adjustStaminaLoss(damage * hit_percent)
if(BRAIN)
adjustBrainLoss(damage * hit_percent)
- return 1
+ return TRUE
//These procs fetch a cumulative total damage from all bodyparts
@@ -61,21 +65,20 @@
if(!forced && (status_flags & GODMODE))
return FALSE
if(amount > 0)
- take_overall_damage(amount, 0, updating_health)
+ take_overall_damage(amount, 0, 0, updating_health)
else
- heal_overall_damage(-amount, 0, 0, 1, updating_health)
+ heal_overall_damage(abs(amount), 0, 0, FALSE, TRUE, updating_health)
return amount
/mob/living/carbon/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE)
if(!forced && (status_flags & GODMODE))
return FALSE
if(amount > 0)
- take_overall_damage(0, amount, updating_health)
+ take_overall_damage(0, amount, 0, updating_health)
else
- heal_overall_damage(0, -amount, 0, 1, updating_health)
+ heal_overall_damage(0, abs(amount), 0, FALSE, TRUE, updating_health)
return amount
-
/mob/living/carbon/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE)
if(!forced && has_trait(TRAIT_TOXINLOVER)) //damage becomes healing and healing becomes damage
amount = -amount
@@ -85,14 +88,36 @@
blood_volume -= amount
return ..()
+/mob/living/carbon/getStaminaLoss()
+ . = 0
+ for(var/X in bodyparts)
+ var/obj/item/bodypart/BP = X
+ . += BP.stamina_dam
+
+/mob/living/carbon/adjustStaminaLoss(amount, updating_health = TRUE, forced = FALSE)
+ if(!forced && (status_flags & GODMODE))
+ return FALSE
+ if(amount > 0)
+ take_overall_damage(0, 0, amount, updating_health)
+ else
+ heal_overall_damage(0, 0, abs(amount), FALSE, FALSE, updating_health)
+ return amount
+
+/mob/living/carbon/setStaminaLoss(amount, updating = TRUE, forced = FALSE)
+ var/current = getStaminaLoss()
+ var/diff = amount - current
+ if(!diff)
+ return
+ adjustStaminaLoss(diff, updating, forced)
+
////////////////////////////////////////////
//Returns a list of damaged bodyparts
-/mob/living/carbon/proc/get_damaged_bodyparts(brute, burn)
+/mob/living/carbon/proc/get_damaged_bodyparts(brute = FALSE, burn = FALSE, stamina = FALSE)
var/list/obj/item/bodypart/parts = list()
for(var/X in bodyparts)
var/obj/item/bodypart/BP = X
- if((brute && BP.brute_dam) || (burn && BP.burn_dam))
+ if((brute && BP.brute_dam) || (burn && BP.burn_dam) || (stamina && BP.stamina_dam))
parts += BP
return parts
@@ -108,91 +133,80 @@
//Heals ONE bodypart randomly selected from damaged ones.
//It automatically updates damage overlays if necessary
//It automatically updates health status
-/mob/living/carbon/heal_bodypart_damage(brute, burn, only_robotic = 0, only_organic = 1)
+/mob/living/carbon/heal_bodypart_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE, only_robotic = FALSE, only_organic = TRUE)
var/list/obj/item/bodypart/parts = get_damaged_bodyparts(brute,burn)
if(!parts.len)
return
var/obj/item/bodypart/picked = pick(parts)
- if(picked.heal_damage(brute, burn, only_robotic, only_organic))
+ if(picked.heal_damage(brute, burn, stamina, only_robotic, only_organic))
update_damage_overlays()
//Damages ONE bodypart randomly selected from damagable ones.
//It automatically updates damage overlays if necessary
//It automatically updates health status
-/mob/living/carbon/take_bodypart_damage(brute, burn)
+/mob/living/carbon/take_bodypart_damage(brute = 0, burn = 0, stamina = 0)
var/list/obj/item/bodypart/parts = get_damageable_bodyparts()
if(!parts.len)
return
var/obj/item/bodypart/picked = pick(parts)
- if(picked.receive_damage(brute,burn))
+ if(picked.receive_damage(brute, burn, stamina))
update_damage_overlays()
-
//Heal MANY bodyparts, in random order
-/mob/living/carbon/heal_overall_damage(brute, burn, only_robotic = 0, only_organic = 1, updating_health = 1)
- var/list/obj/item/bodypart/parts = get_damaged_bodyparts(brute,burn)
+/mob/living/carbon/heal_overall_damage(brute = 0, burn = 0, stamina = 0, only_robotic = FALSE, only_organic = TRUE, updating_health = TRUE)
+ var/list/obj/item/bodypart/parts = get_damaged_bodyparts(brute, burn, stamina)
- var/update = 0
- while(parts.len && (brute>0 || burn>0) )
+ var/update = NONE
+ while(parts.len && (brute > 0 || burn > 0 || stamina > 0))
var/obj/item/bodypart/picked = pick(parts)
var/brute_was = picked.brute_dam
var/burn_was = picked.burn_dam
+ var/stamina_was = picked.stamina_dam
- update |= picked.heal_damage(brute,burn, only_robotic, only_organic, 0)
+ update |= picked.heal_damage(brute, burn, stamina, only_robotic, only_organic, FALSE)
- brute -= (brute_was-picked.brute_dam)
- burn -= (burn_was-picked.burn_dam)
+ brute -= (brute_was - picked.brute_dam)
+ burn -= (burn_was - picked.burn_dam)
+ stamina -= (stamina_was - picked.stamina_dam)
parts -= picked
if(updating_health)
updatehealth()
+ update_stamina()
if(update)
update_damage_overlays()
// damage MANY bodyparts, in random order
-/mob/living/carbon/take_overall_damage(brute, burn, updating_health = 1)
+/mob/living/carbon/take_overall_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE)
if(status_flags & GODMODE)
return //godmode
var/list/obj/item/bodypart/parts = get_damageable_bodyparts()
var/update = 0
- while(parts.len && (brute>0 || burn>0) )
+ while(parts.len && (brute > 0 || burn > 0 || stamina > 0))
var/obj/item/bodypart/picked = pick(parts)
var/brute_per_part = round(brute/parts.len, 0.01)
var/burn_per_part = round(burn/parts.len, 0.01)
+ var/stamina_per_part = round(stamina/parts.len, 0.01)
var/brute_was = picked.brute_dam
var/burn_was = picked.burn_dam
+ var/stamina_was = picked.stamina_dam
- update |= picked.receive_damage(brute_per_part,burn_per_part, 0)
+ update |= picked.receive_damage(brute_per_part, burn_per_part, stamina_per_part, FALSE)
brute -= (picked.brute_dam - brute_was)
burn -= (picked.burn_dam - burn_was)
+ stamina -= (picked.stamina_dam - stamina_was)
parts -= picked
if(updating_health)
updatehealth()
if(update)
update_damage_overlays()
-
-
-
-/mob/living/carbon/adjustStaminaLoss(amount, updating_stamina = 1)
- if(status_flags & GODMODE)
- return 0
- staminaloss = CLAMP(staminaloss + amount, 0, maxHealth*2)
- if(updating_stamina)
- update_stamina()
-
-
-/mob/living/carbon/setStaminaLoss(amount, updating_stamina = 1)
- if(status_flags & GODMODE)
- return 0
- staminaloss = amount
- if(updating_stamina)
- update_stamina()
+ update_stamina()
/mob/living/carbon/getBrainLoss()
. = 0
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index 709ce0f75ec5..7e2fb19d8236 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -769,7 +769,7 @@
return
else
if(hud_used.healths)
- var/health_amount = health - staminaloss
+ var/health_amount = health - getStaminaLoss()
if(..(health_amount)) //not dead
switch(hal_screwyhud)
if(SCREWYHUD_CRIT)
diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm
index 11afd98c99bb..a179fe278a19 100644
--- a/code/modules/mob/living/carbon/human/human_defense.dm
+++ b/code/modules/mob/living/carbon/human/human_defense.dm
@@ -692,8 +692,8 @@
if(bleed_rate)
to_chat(src, "You are bleeding!")
- if(staminaloss)
- if(staminaloss > 30)
+ if(getStaminaLoss())
+ if(getStaminaLoss() > 30)
to_chat(src, "You're completely exhausted.")
else
to_chat(src, "You feel fatigued.")
diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm
index 3121948bc4a1..9dde73ee9205 100644
--- a/code/modules/mob/living/carbon/human/species.dm
+++ b/code/modules/mob/living/carbon/human/species.dm
@@ -1452,7 +1452,11 @@ GLOBAL_LIST_EMPTY(roundstart_races)
if(CLONE)
H.adjustCloneLoss(damage * hit_percent * H.physiology.clone_mod)
if(STAMINA)
- H.adjustStaminaLoss(damage * hit_percent * H.physiology.stamina_mod)
+ if(BP)
+ if(BP.receive_damage(0, 0, damage * hit_percent * H.physiology.stamina_mod))
+ H.update_stamina()
+ else
+ H.adjustStaminaLoss(damage * hit_percent * H.physiology.stamina_mod)
if(BRAIN)
H.adjustBrainLoss(damage * hit_percent * H.physiology.brain_mod)
return 1
diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm
index 51dffbe912b1..505887278a45 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -322,7 +322,7 @@
//this updates all special effects: stun, sleeping, knockdown, druggy, stuttering, etc..
/mob/living/carbon/handle_status_effects()
..()
- if(staminaloss)
+ if(getStaminaLoss())
adjustStaminaLoss(-3)
var/restingpwr = 1 + 4 * resting
diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm
index bdab26192d9f..a9674f8ad2c6 100644
--- a/code/modules/mob/living/damage_procs.dm
+++ b/code/modules/mob/living/damage_procs.dm
@@ -236,34 +236,41 @@
/mob/living/proc/setStaminaLoss(amount, updating_stamina = TRUE, forced = FALSE)
return
-
// heal ONE external organ, organ gets randomly selected from damaged ones.
-/mob/living/proc/heal_bodypart_damage(brute, burn, updating_health = 1)
- adjustBruteLoss(-brute, 0) //zero as argument for no instant health update
- adjustFireLoss(-burn, 0)
+/mob/living/proc/heal_bodypart_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE)
+ adjustBruteLoss(-brute, FALSE) //zero as argument for no instant health update
+ adjustFireLoss(-burn, FALSE)
+ adjustStaminaLoss(-stamina, FALSE)
if(updating_health)
updatehealth()
+ update_stamina()
// damage ONE external organ, organ gets randomly selected from damaged ones.
-/mob/living/proc/take_bodypart_damage(brute, burn, updating_health = 1)
- adjustBruteLoss(brute, 0) //zero as argument for no instant health update
- adjustFireLoss(burn, 0)
+/mob/living/proc/take_bodypart_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE)
+ adjustBruteLoss(brute, FALSE) //zero as argument for no instant health update
+ adjustFireLoss(burn, FALSE)
+ adjustStaminaLoss(stamina, FALSE)
if(updating_health)
updatehealth()
+ update_stamina()
// heal MANY bodyparts, in random order
-/mob/living/proc/heal_overall_damage(brute, burn, only_robotic = 0, only_organic = 1, updating_health = 1)
- adjustBruteLoss(-brute, 0) //zero as argument for no instant health update
- adjustFireLoss(-burn, 0)
+/mob/living/proc/heal_overall_damage(brute = 0, burn = 0, stamina = 0, only_robotic = FALSE, only_organic = TRUE, updating_health = TRUE)
+ adjustBruteLoss(-brute, FALSE) //zero as argument for no instant health update
+ adjustFireLoss(-burn, FALSE)
+ adjustStaminaLoss(-stamina, FALSE)
if(updating_health)
updatehealth()
+ update_stamina()
// damage MANY bodyparts, in random order
-/mob/living/proc/take_overall_damage(brute, burn, updating_health = 1)
- adjustBruteLoss(brute, 0) //zero as argument for no instant health update
- adjustFireLoss(burn, 0)
+/mob/living/proc/take_overall_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE)
+ adjustBruteLoss(brute, FALSE) //zero as argument for no instant health update
+ adjustFireLoss(burn, FALSE)
+ adjustStaminaLoss(stamina, FALSE)
if(updating_health)
updatehealth()
+ update_stamina()
//heal up to amount damage, in a given order
/mob/living/proc/heal_ordered_damage(amount, list/damage_types)
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index 560d28a66b95..acdbe1489c47 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -433,6 +433,7 @@
if(status_flags & GODMODE)
return
health = maxHealth - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() - getCloneLoss()
+ staminaloss = getStaminaLoss()
update_stat()
med_hud_set_health()
med_hud_set_status()
@@ -481,7 +482,7 @@
cure_blind()
cure_husk()
hallucination = 0
- heal_overall_damage(100000, 100000, 0, 0, 1) //heal brute and burn dmg on both organic and robotic limbs, and update health right away.
+ heal_overall_damage(INFINITY, INFINITY, INFINITY, FALSE, FALSE, TRUE) //heal brute and burn dmg on both organic and robotic limbs, and update health right away.
ExtinguishMob()
fire_stacks = 0
update_canmove()
@@ -862,14 +863,18 @@
return FALSE
return TRUE
-/mob/living/carbon/proc/update_stamina()
- if(staminaloss)
- var/total_health = (health - staminaloss)
+/mob/living/proc/update_stamina()
+ return
+
+/mob/living/carbon/update_stamina()
+ var/stam = getStaminaLoss()
+ if(stam)
+ var/total_health = (health - stam)
if(total_health <= HEALTH_THRESHOLD_CRIT && !stat)
to_chat(src, "You're too exhausted to keep going...")
Knockdown(100)
- setStaminaLoss(health - 2)
- update_health_hud()
+ setStaminaLoss(health - 2, FALSE, FALSE)
+ update_health_hud()
/mob/living/carbon/alien/update_stamina()
return
diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm
index 3b9930faa9e0..4800c4dc370e 100644
--- a/code/modules/mob/mob_helpers.dm
+++ b/code/modules/mob/mob_helpers.dm
@@ -408,7 +408,7 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
else
dam = 0
if((brute_heal > 0 && affecting.brute_dam > 0) || (burn_heal > 0 && affecting.burn_dam > 0))
- if(affecting.heal_damage(brute_heal, burn_heal, 1, 0))
+ if(affecting.heal_damage(brute_heal, burn_heal, 0, TRUE, FALSE))
H.update_damage_overlays()
user.visible_message("[user] has fixed some of the [dam ? "dents on" : "burnt wires in"] [H]'s [affecting.name].", \
"You fix some of the [dam ? "dents on" : "burnt wires in"] [H]'s [affecting.name].")
diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm
index e8070e8906ec..a597706962fc 100644
--- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm
@@ -231,7 +231,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
/datum/reagent/consumable/ethanol/bilk/on_mob_life(mob/living/M)
if(M.getBruteLoss() && prob(10))
- M.heal_bodypart_damage(1,0, 0)
+ M.heal_bodypart_damage(1)
. = 1
return ..() || .
@@ -1085,7 +1085,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
/datum/reagent/consumable/ethanol/bananahonk/on_mob_life(mob/living/M)
if((ishuman(M) && M.job in list("Clown") ) || ismonkey(M))
- M.heal_bodypart_damage(1,1, 0)
+ M.heal_bodypart_damage(1,1)
. = 1
return ..() || .
@@ -1403,7 +1403,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
/datum/reagent/consumable/ethanol/quadruple_sec/on_mob_life(mob/living/M)
if(M.mind && M.mind.assigned_role in list("Security Officer", "Detective", "Head of Security", "Warden", "Lawyer")) //Securidrink in line with the screwderiver for engineers or nothing for mimes.
- M.heal_bodypart_damage (1,1,1)
+ M.heal_bodypart_damage(1, 1)
M.adjustBruteLoss(-2,0)
. = 1
return ..()
@@ -1421,7 +1421,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
/datum/reagent/consumable/ethanol/quintuple_sec/on_mob_life(mob/living/M)
if(M.mind && M.mind.assigned_role in list("Security Officer", "Detective", "Head of Security", "Warden", "Lawyer")) //Securidrink in line with the screwderiver for engineers or nothing for mimes but STRONG..
- M.heal_bodypart_damage (2,2,2)
+ M.heal_bodypart_damage(2,2,2)
M.adjustBruteLoss(-5,0)
M.adjustOxyLoss(-5,0)
M.adjustFireLoss(-5,0)
diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
index 92d73e2ccf6e..8f66fcb7ac1f 100644
--- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
@@ -40,7 +40,7 @@
M.setCloneLoss(0, 0)
M.setOxyLoss(0, 0)
M.radiation = 0
- M.heal_bodypart_damage(5,5, 0)
+ M.heal_bodypart_damage(5,5)
M.adjustToxLoss(-5, 0, TRUE)
M.hallucination = 0
M.setBrainLoss(0)
@@ -197,7 +197,7 @@
/datum/reagent/medicine/rezadone/on_mob_life(mob/living/M)
M.setCloneLoss(0) //Rezadone is almost never used in favor of cryoxadone. Hopefully this will change that.
- M.heal_bodypart_damage(1,1, 0)
+ M.heal_bodypart_damage(1,1)
M.remove_trait(TRAIT_DISFIGURED, TRAIT_GENERIC)
..()
. = 1
@@ -1129,7 +1129,7 @@
can_synth = FALSE
/datum/reagent/medicine/miningnanites/on_mob_life(mob/living/M)
- M.heal_bodypart_damage(5,5, 0)
+ M.heal_bodypart_damage(5,5)
..()
. = 1
diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm
index fca2260e0215..927944504e52 100644
--- a/code/modules/reagents/chemistry/reagents/other_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm
@@ -784,7 +784,7 @@
taste_description = "chlorine"
/datum/reagent/chlorine/on_mob_life(mob/living/M)
- M.take_bodypart_damage(1*REM, 0, 0)
+ M.take_bodypart_damage(1*REM, 0, 0, 0)
. = 1
..()
diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm
index e77d87c5b67c..eeb8054916e7 100644
--- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm
@@ -128,7 +128,7 @@
M.adjustToxLoss(rand(20,60)*REM, 0)
. = 1
else if(prob(40))
- M.heal_bodypart_damage(5*REM,0, 0)
+ M.heal_bodypart_damage(5*REM)
. = 1
..()
@@ -874,7 +874,7 @@
/datum/reagent/toxin/peaceborg/tire/on_mob_life(mob/living/M)
var/healthcomp = (100 - M.health) //DOES NOT ACCOUNT FOR ADMINBUS THINGS THAT MAKE YOU HAVE MORE THAN 200/210 HEALTH, OR SOMETHING OTHER THAN A HUMAN PROCESSING THIS.
- if(M.staminaloss < (45 - healthcomp)) //At 50 health you would have 200 - 150 health meaning 50 compensation. 60 - 50 = 10, so would only do 10-19 stamina.)
+ if(M.getStaminaLoss() < (45 - healthcomp)) //At 50 health you would have 200 - 150 health meaning 50 compensation. 60 - 50 = 10, so would only do 10-19 stamina.)
M.adjustStaminaLoss(10)
if(prob(30))
to_chat(M, "You should sit down and take a rest...")
diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm
index 133c22510ebb..d3e7aafc63d2 100644
--- a/code/modules/surgery/bodyparts/bodyparts.dm
+++ b/code/modules/surgery/bodyparts/bodyparts.dm
@@ -19,6 +19,7 @@
var/burnstate = 0
var/brute_dam = 0
var/burn_dam = 0
+ var/stamina_dam = 0
var/max_damage = 0
var/list/embedded_objects = list()
var/held_index = 0 //are we a hand? if so, which one!
@@ -107,52 +108,54 @@
//Applies brute and burn damage to the organ. Returns 1 if the damage-icon states changed at all.
//Damage will not exceed max_damage using this proc
//Cannot apply negative damage
-/obj/item/bodypart/proc/receive_damage(brute, burn, updating_health = 1)
+/obj/item/bodypart/proc/receive_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE)
if(owner && (owner.status_flags & GODMODE))
- return 0 //godmode
+ return FALSE //godmode
var/dmg_mlt = CONFIG_GET(number/damage_multiplier)
brute = max(brute * dmg_mlt, 0)
burn = max(burn * dmg_mlt, 0)
-
-
+ stamina = max(stamina * dmg_mlt, 0)
if(status == BODYPART_ROBOTIC) //This makes robolimbs not damageable by chems and makes it stronger
brute = max(0, brute - 5)
burn = max(0, burn - 4)
+ //No stamina scaling.. for now..
+
+ if(!brute && !burn && !stamina)
+ return FALSE
switch(animal_origin)
if(ALIEN_BODYPART,LARVA_BODYPART) //aliens take double burn
burn *= 2
var/can_inflict = max_damage - (brute_dam + burn_dam)
- if(!can_inflict)
- return 0
+ if(can_inflict <= 0)
+ return FALSE
+
+ var/total_damage = brute + burn
+
+ if(total_damage > can_inflict)
+ var/excess = total_damage - can_inflict
+ brute = brute * (excess / total_damage)
+ burn = burn * (excess / total_damage)
+
+ brute_dam += brute
+ burn_dam += burn
+
+ //We've dealt the physical damages, if there's room lets apply the stamina damage.
+ var/current_damage = brute_dam + burn_dam + stamina_dam //This time around, count stamina loss too.
+ var/available_damage = max_damage - current_damage
+ stamina_dam += CLAMP(stamina, 0, available_damage)
- if((brute + burn) < can_inflict)
- brute_dam += brute
- burn_dam += burn
- else
- if(brute > 0)
- if(burn > 0)
- brute = round( (brute/(brute+burn)) * can_inflict, 1 )
- burn = can_inflict - brute //gets whatever damage is left over
- brute_dam += brute
- burn_dam += burn
- else
- brute_dam += can_inflict
- else
- if(burn > 0)
- burn_dam += can_inflict
- else
- return 0
if(owner && updating_health)
owner.updatehealth()
+ if(stamina)
+ owner.update_stamina()
return update_bodypart_damage_state()
-
//Heals brute and burn damage for the organ. Returns 1 if the damage-icon states changed at all.
//Damage cannot go below zero.
//Cannot remove negative damage (i.e. apply damage)
-/obj/item/bodypart/proc/heal_damage(brute, burn, only_robotic = 0, only_organic = 1, updating_health = 1)
+/obj/item/bodypart/proc/heal_damage(brute, burn, stamina, only_robotic = FALSE, only_organic = TRUE, updating_health = TRUE)
if(only_robotic && status != BODYPART_ROBOTIC) //This makes organic limbs not heal when the proc is in Robotic mode.
return
@@ -162,6 +165,7 @@
brute_dam = max(brute_dam - brute, 0)
burn_dam = max(burn_dam - burn, 0)
+ stamina_dam = max(stamina_dam - stamina, 0)
if(owner && updating_health)
owner.updatehealth()
return update_bodypart_damage_state()
@@ -180,8 +184,8 @@
if((tbrute != brutestate) || (tburn != burnstate))
brutestate = tbrute
burnstate = tburn
- return 1
- return 0
+ return TRUE
+ return FALSE
diff --git a/code/modules/surgery/organs/vocal_cords.dm b/code/modules/surgery/organs/vocal_cords.dm
index a07722cb3b64..a47c7ffb5e76 100644
--- a/code/modules/surgery/organs/vocal_cords.dm
+++ b/code/modules/surgery/organs/vocal_cords.dm
@@ -305,7 +305,7 @@
cooldown = COOLDOWN_DAMAGE
for(var/V in listeners)
var/mob/living/L = V
- L.heal_overall_damage(10 * power_multiplier, 10 * power_multiplier, 0, 0)
+ L.heal_overall_damage(10 * power_multiplier, 10 * power_multiplier, 0, FALSE, FALSE)
//BRUTE DAMAGE
else if((findtext(message, hurt_words)))