From b5bbc6f1efdb4bb320c255f87c6b9678459f822a Mon Sep 17 00:00:00 2001 From: phil235 Date: Fri, 8 May 2015 15:37:40 +0200 Subject: [PATCH] Fixes aliens getting an exhaustion message. Fixes nearly infinite loop when calling setStaminaLoss -> CHeckStamina -> SetStaminaLoss -> etc... CheckStamina is now called in carbon/handle_status_effects instead of carbon/handle_regular_status_updates(). --- code/modules/mob/living/carbon/alien/life.dm | 5 ++++- code/modules/mob/living/carbon/life.dm | 13 ++++++++++++- code/modules/mob/living/living.dm | 15 --------------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index 858d3ec155b..39b9a267f9e 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -61,4 +61,7 @@ handle_hud_icons_health() - return 1 \ No newline at end of file + return 1 + +/mob/living/carbon/alien/CheckStamina() + return \ No newline at end of file diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 4cd512731e0..120e7da4350 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -274,13 +274,24 @@ if(sleeping) stat = UNCONSCIOUS - CheckStamina() return 1 +/mob/living/carbon/proc/CheckStamina() + if(staminaloss) + var/total_health = (health - staminaloss) + if(total_health <= config.health_threshold_crit && !stat) + src << "You're too exhausted to keep going..." + Weaken(5) + setStaminaLoss(health - 2) + return + setStaminaLoss(max((staminaloss - 2), 0)) + //this updates all special effects: stunned, sleeping, weakened, druggy, stuttering, etc.. /mob/living/carbon/handle_status_effects() ..() + CheckStamina() + if(sleeping) handle_dreams() adjustStaminaLoss(-10) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 5f794989e13..7e1da42729c 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -313,12 +313,10 @@ Sorry Giacom. Please don't be mad :( /mob/living/proc/adjustStaminaLoss(var/amount) if(status_flags & GODMODE) return 0 staminaloss = min(max(staminaloss + amount, 0),(maxHealth*2)) - handle_regular_status_updates() //we update our health right away. /mob/living/proc/setStaminaLoss(var/amount) if(status_flags & GODMODE) return 0 staminaloss = amount - handle_regular_status_updates() //we update our health right away. /mob/living/proc/getMaxHealth() return maxHealth @@ -660,19 +658,6 @@ Sorry Giacom. Please don't be mad :( /mob/living/proc/get_visible_name() return name -/mob/living/proc/CheckStamina() - if(staminaloss) - var/total_health = (health - staminaloss) - if(total_health <= config.health_threshold_crit && !stat) - Exhaust() - setStaminaLoss(health - 2) - return - setStaminaLoss(max((staminaloss - 2), 0)) - -/mob/living/proc/Exhaust() - src << "You're too exhausted to keep going..." - Weaken(5) - /mob/living/update_gravity(has_gravity) if(!ticker) return