[MIRROR] AdjustHealth proc cleanup (#3475)

* AdjustHealth proc cleanup (#56966)

This PR cleans up duplicate definition of the AdjustHealth proc for simplemobs, as otherwise you cannot properly locate the definition via VSCode DMcode plugins. No functionality changes, as this is exactly how it already works - duplicate definition calls the "real" proc definition via ..(). Autodoc documentation of the relevant proc included.

* AdjustHealth proc cleanup

Co-authored-by: Arkatos1 <43862960+Arkatos1@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-02-18 05:45:37 +01:00
committed by GitHub
parent 8216247fef
commit be6eca62dd
2 changed files with 18 additions and 14 deletions
@@ -1,11 +1,22 @@
/**
* Adjusts the health of a simple mob by a set amount and wakes AI if its idle to react
*
* Arguments:
* * amount The amount that will be used to adjust the mob's health
* * updating_health If the mob's health should be immediately updated to the new value
* * forced If we should force update the adjustment of the mob's health no matter the restrictions, like GODMODE
*/
/mob/living/simple_animal/proc/adjustHealth(amount, updating_health = TRUE, forced = FALSE)
if(!forced && (status_flags & GODMODE))
return FALSE
bruteloss = round(clamp(bruteloss + amount, 0, maxHealth * 2), DAMAGE_PRECISION)
if(updating_health)
updatehealth()
return amount
. = FALSE
if(forced || !(status_flags & GODMODE))
bruteloss = round(clamp(bruteloss + amount, 0, maxHealth * 2), DAMAGE_PRECISION)
if(updating_health)
updatehealth()
. = amount
if(ckey || stat)
return
if(AIStatus == AI_IDLE)
toggle_ai(AI_ON)
/mob/living/simple_animal/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE)
if(forced)
@@ -705,13 +705,6 @@
if (pulledby || shouldwakeup)
toggle_ai(AI_ON)
/mob/living/simple_animal/adjustHealth(amount, updating_health = TRUE, forced = FALSE)
. = ..()
if(!ckey && !stat)//Not unconscious
if(AIStatus == AI_IDLE)
toggle_ai(AI_ON)
/mob/living/simple_animal/onTransitZ(old_z, new_z)
..()
if (AIStatus == AI_Z_OFF)