From d7bca1922d3e850d96586c538daa492506ceb78f Mon Sep 17 00:00:00 2001 From: deathride58 Date: Wed, 3 Oct 2018 23:44:09 -0400 Subject: [PATCH] Mostly fixes stamina by making knockdown() apply its staminaloss to the chest, giving adjuststaminaloss() new args, disabling limb-specific stamina regen for the chest, and disabling head stamina (#7596) * fixes stamina (hopefully) * makes adjuststaminaloss() apply to the chest by default, makes it possible to target specific zones with adjuststaminaloss. * i dropped out of first grade dont bulli * REE * be patient im a dum * come on --- code/game/objects/items/stunbaton.dm | 2 +- code/modules/mob/living/carbon/damage_procs.dm | 8 ++++---- code/modules/mob/living/carbon/human/species.dm | 8 ++++---- code/modules/surgery/bodyparts/bodyparts.dm | 6 +++--- code/modules/surgery/bodyparts/head.dm | 2 +- .../code/modules/mob/living/carbon/damage_procs.dm | 8 ++------ 6 files changed, 15 insertions(+), 19 deletions(-) diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 1d77dfcf8b..c0e81a7949 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -163,7 +163,7 @@ return 0 L.Knockdown(stunforce) - L.adjustStaminaLoss(stunforce*0.1)//CIT CHANGE - makes stunbatons deal extra staminaloss. Todo: make this also deal pain when pain gets implemented. + L.adjustStaminaLoss(stunforce*0.1, affected_zone = (istype(user) ? user.zone_selected : BODY_ZONE_CHEST))//CIT CHANGE - makes stunbatons deal extra staminaloss. Todo: make this also deal pain when pain gets implemented. L.apply_effect(EFFECT_STUTTER, stunforce) SEND_SIGNAL(L, COMSIG_LIVING_MINOR_SHOCK) if(user) diff --git a/code/modules/mob/living/carbon/damage_procs.dm b/code/modules/mob/living/carbon/damage_procs.dm index 124fd622d7..b22498670a 100644 --- a/code/modules/mob/living/carbon/damage_procs.dm +++ b/code/modules/mob/living/carbon/damage_procs.dm @@ -2,7 +2,7 @@ /mob/living/carbon/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked = FALSE) var/hit_percent = (100-blocked)/100 - if(!damage || hit_percent <= 0) + if(hit_percent <= 0) return 0 var/obj/item/bodypart/BP = null @@ -18,13 +18,13 @@ switch(damagetype) if(BRUTE) if(BP) - if(BP.receive_damage(damage * hit_percent, 0)) + if(damage > 0 ? BP.receive_damage(damage * hit_percent, 0) : BP.heal_damage(abs(damage * hit_percent), 0)) update_damage_overlays() else //no bodypart, we deal damage with a more general method. adjustBruteLoss(damage * hit_percent) if(BURN) if(BP) - if(BP.receive_damage(0, damage * hit_percent)) + if(damage > 0 ? BP.receive_damage(0, damage * hit_percent) : BP.heal_damage(0, abs(damage * hit_percent))) update_damage_overlays() else adjustFireLoss(damage * hit_percent) @@ -36,7 +36,7 @@ adjustCloneLoss(damage * hit_percent) if(STAMINA) if(BP) - if(BP.receive_damage(0, 0, damage * hit_percent)) + if(damage > 0 ? BP.receive_damage(0, 0, damage * hit_percent) : BP.heal_damage(0, 0, abs(damage * hit_percent))) update_damage_overlays() else adjustStaminaLoss(damage * hit_percent) diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 1f68431771..79ea11682d 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1600,7 +1600,7 @@ GLOBAL_LIST_EMPTY(roundstart_races) /datum/species/proc/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked, mob/living/carbon/human/H) var/hit_percent = (100-(blocked+armor))/100 hit_percent = (hit_percent * (100-H.physiology.damage_resistance))/100 - if(!damage || hit_percent <= 0) + if(hit_percent <= 0) return 0 var/obj/item/bodypart/BP = null @@ -1617,14 +1617,14 @@ GLOBAL_LIST_EMPTY(roundstart_races) if(BRUTE) H.damageoverlaytemp = 20 if(BP) - if(BP.receive_damage(damage * hit_percent * brutemod * H.physiology.brute_mod, 0)) + if(damage > 0 ? BP.receive_damage(damage * hit_percent * brutemod * H.physiology.brute_mod, 0) : BP.heal_damage(abs(damage * hit_percent * brutemod * H.physiology.brute_mod), 0)) H.update_damage_overlays() else//no bodypart, we deal damage with a more general method. H.adjustBruteLoss(damage * hit_percent * brutemod * H.physiology.brute_mod) if(BURN) H.damageoverlaytemp = 20 if(BP) - if(BP.receive_damage(0, damage * hit_percent * burnmod * H.physiology.burn_mod)) + if(damage > 0 ? BP.receive_damage(0, damage * hit_percent * burnmod * H.physiology.burn_mod) : BP.heal_damage(0, abs(damage * hit_percent * burnmod * H.physiology.burn_mod))) H.update_damage_overlays() else H.adjustFireLoss(damage * hit_percent * burnmod * H.physiology.burn_mod) @@ -1636,7 +1636,7 @@ GLOBAL_LIST_EMPTY(roundstart_races) H.adjustCloneLoss(damage * hit_percent * H.physiology.clone_mod) if(STAMINA) if(BP) - if(BP.receive_damage(0, 0, damage * hit_percent * H.physiology.stamina_mod)) + if(damage > 0 ? BP.receive_damage(0, 0, damage * hit_percent * H.physiology.stamina_mod) : BP.heal_damage(0, 0, abs(damage * hit_percent * H.physiology.stamina_mod))) H.update_stamina() else H.adjustStaminaLoss(damage * hit_percent * H.physiology.stamina_mod) diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index d8918b609f..1841ac52b5 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -31,7 +31,7 @@ var/stamina_dam = 0 var/max_stamina_damage = 0 var/max_damage = 0 - var/stam_heal_tick = 3 //per Life(). + var/stam_heal_tick = 0 //per Life(). Defaults to 0 due to citadel changes var/brute_reduction = 0 //Subtracted to brute damage taken var/burn_reduction = 0 //Subtracted to burn damage taken @@ -135,7 +135,7 @@ //Return TRUE to get whatever mob this is in to update health. /obj/item/bodypart/proc/on_life() - if(stamina_dam > DAMAGE_PRECISION) //DO NOT update health here, it'll be done in the carbon's life. + if(stam_heal_tick && stamina_dam > DAMAGE_PRECISION) //DO NOT update health here, it'll be done in the carbon's life. if(heal_damage(brute = 0, burn = 0, stamina = stam_heal_tick, only_robotic = FALSE, only_organic = FALSE, updating_health = FALSE)) . |= BODYPART_LIFE_UPDATE_HEALTH @@ -441,7 +441,7 @@ px_x = 0 px_y = 0 stam_damage_coeff = 1 - max_stamina_damage = 100 + max_stamina_damage = 200 var/obj/item/cavity_item /obj/item/bodypart/chest/Destroy() diff --git a/code/modules/surgery/bodyparts/head.dm b/code/modules/surgery/bodyparts/head.dm index c08e6e5673..1f0fa00632 100644 --- a/code/modules/surgery/bodyparts/head.dm +++ b/code/modules/surgery/bodyparts/head.dm @@ -12,7 +12,7 @@ px_x = 0 px_y = -8 stam_damage_coeff = 1 - max_stamina_damage = 100 + max_stamina_damage = 0 //Setting this to 0 since this has the same exact effects as the chest when disabled var/mob/living/brain/brainmob = null //The current occupant. var/obj/item/organ/brain/brain = null //The brain organ diff --git a/modular_citadel/code/modules/mob/living/carbon/damage_procs.dm b/modular_citadel/code/modules/mob/living/carbon/damage_procs.dm index 217eb9d749..9921e4ed47 100644 --- a/modular_citadel/code/modules/mob/living/carbon/damage_procs.dm +++ b/modular_citadel/code/modules/mob/living/carbon/damage_procs.dm @@ -9,12 +9,8 @@ if(updating_stamina) update_health_hud() -/mob/living/carbon/adjustStaminaLoss(amount, updating_health = TRUE, forced = FALSE) +/mob/living/carbon/adjustStaminaLoss(amount, updating_health = TRUE, forced = FALSE, affected_zone = BODY_ZONE_CHEST) if(!forced && (status_flags & GODMODE)) return FALSE - if(amount > 0) - amount = CLAMP(amount, 0, 200 - getStaminaLoss()) - take_overall_damage(0, 0, amount, updating_health) - else - heal_overall_damage(0, 0, abs(amount), FALSE, FALSE, updating_health) + apply_damage(amount, STAMINA, affected_zone) return amount