Skip to content

Commit

Permalink
bugfix: fixes elite fauna (#6032)
Browse files Browse the repository at this point in the history
* bugfix: fixes elite fauna

* autodoc
  • Loading branch information
Vladisvell authored Oct 15, 2024
1 parent 91f57a5 commit 97c00a2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
37 changes: 32 additions & 5 deletions code/modules/mob/living/simple_animal/damage_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,33 @@
*
* Returns STATUS_UPDATE_HEALTH if any changes were made, STATUS_UPDATE_NONE otherwise
*/
/mob/living/simple_animal/proc/setDamage(amount, updating_health = TRUE)
if(HAS_TRAIT(src, TRAIT_GODMODE))
var/oldbruteloss = bruteloss
bruteloss = 0
if(oldbruteloss != 0)
updatehealth("setDamage")
return STATUS_UPDATE_NONE
var/oldbruteloss = bruteloss
bruteloss = clamp(round(amount, DAMAGE_PRECISION), 0, maxHealth)
if(oldbruteloss == bruteloss)
updating_health = FALSE
. = STATUS_UPDATE_NONE
else
. = STATUS_UPDATE_HEALTH
if(updating_health)
updatehealth("setDamage")

/**
* Proc-setter for health of simple mobs.
* Any passed amount will be converted to bruteloss calculated from (maxHealth - amount). No resists will be applied.
*
* Arguments:
* * amount - Amount of health to set.
* * updating_health - If TRUE calls update health on success.
*
* Returns STATUS_UPDATE_HEALTH if any changes were made, STATUS_UPDATE_NONE otherwise
*/
/mob/living/simple_animal/proc/setHealth(amount, updating_health = TRUE)
if(HAS_TRAIT(src, TRAIT_GODMODE))
var/oldbruteloss = bruteloss
Expand All @@ -60,7 +87,7 @@
updatehealth("setHealth")
return STATUS_UPDATE_NONE
var/oldbruteloss = bruteloss
bruteloss = clamp(round(amount, DAMAGE_PRECISION), 0, maxHealth)
bruteloss = clamp(round(maxHealth - amount, DAMAGE_PRECISION), 0, maxHealth)
if(oldbruteloss == bruteloss)
updating_health = FALSE
. = STATUS_UPDATE_NONE
Expand Down Expand Up @@ -120,7 +147,7 @@


/mob/living/simple_animal/setOxyLoss(amount, updating_health = TRUE)
return setHealth(amount, updating_health)
return setDamage(amount, updating_health)


/mob/living/simple_animal/adjustToxLoss(
Expand All @@ -134,7 +161,7 @@


/mob/living/simple_animal/setToxLoss(amount, updating_health = TRUE)
return setHealth(amount, updating_health)
return setDamage(amount, updating_health)


/mob/living/simple_animal/adjustCloneLoss(
Expand All @@ -148,7 +175,7 @@


/mob/living/simple_animal/setCloneLoss(amount, updating_health = TRUE)
return setHealth(amount, updating_health)
return setDamage(amount, updating_health)


/mob/living/simple_animal/adjustStaminaLoss(
Expand All @@ -162,6 +189,6 @@


/mob/living/simple_animal/setStaminaLoss(amount, updating_health = TRUE)
return setHealth(amount, updating_health)
return setDamage(amount, updating_health)


Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,13 @@ While using this makes the system rely on OnFire, it still gives options for tim
/obj/structure/elite_tumor/proc/arena_checks()
if(activity != TUMOR_ACTIVE || QDELETED(src))
return

INVOKE_ASYNC(src, PROC_REF(arena_trap)) //Gets another arena trap queued up for when this one runs out.
INVOKE_ASYNC(src, PROC_REF(border_check)) //Checks to see if our fighters got out of the arena somehow.
INVOKE_ASYNC(src, PROC_REF(fighters_check)) //Checks to see if our fighters died.
if(QDELETED(src))
return

addtimer(CALLBACK(src, PROC_REF(arena_checks)), 5 SECONDS)

/obj/structure/elite_tumor/proc/fighters_check()
Expand Down

0 comments on commit 97c00a2

Please sign in to comment.