Diona nymphs can now run correctly (#19665)

Diona nymphs can now run correctly, without a weird empty stamina bar,
and stopping as appropriate when their stamina (health) is low, with a
message.

Fixes #14038
This commit is contained in:
Fluffy
2024-07-27 10:10:27 +00:00
committed by GitHub
parent 62d887c68e
commit d380eef668
5 changed files with 89 additions and 7 deletions
@@ -26,6 +26,7 @@
meat_amount = 2
maxHealth = 50
health = 50
max_stamina = -1
pass_flags = PASSTABLE
// Decorative head flower.
@@ -377,3 +378,9 @@
if (status_flags & GODMODE)
return
health = min(health - amount, maxHealth)
/mob/living/carbon/alien/diona/getHalLoss()
if(status_flags & GODMODE)
return
return max((maxHealth - health), 0)
@@ -668,7 +668,7 @@
if(H.is_drowsy())
cost *= 1.25
if (H.stamina == -1)
LOG_DEBUG("Error: Species with special sprint mechanics has not overridden cost function.")
stack_trace("Error: Species with special sprint mechanics has not overridden cost function.")
return 0
var/obj/item/organ/internal/augment/calf_override/C = H.internal_organs_by_name[BP_AUG_CALF_OVERRIDE]
@@ -182,6 +182,23 @@
if((!D.client && !D.mind) || D.stat == DEAD)
qdel(D)
//This handles nymphs, which are the only diona specie that can run, since they don't breathe they just take pain damage instead
/datum/species/diona/handle_sprint_cost(mob/living/carbon/human/H, cost, pre_move)
if(!pre_move)
H.adjustHalLoss(cost*0.3)
H.updatehealth()
if(H.getHalLoss() > (H.maxHealth*0.6))
var/shock = H.get_shock()
if(prob(shock * 2))
to_chat(H, SPAN_DANGER("You feel a sharp pain in your nervous system! You can't run anymore, or you might die!"))
H.m_intent = M_WALK
if(!pre_move)
H.hud_used.move_intent.update_move_icon(H)
return 1
/datum/species/diona/after_equip(mob/living/carbon/human/H, visualsOnly, datum/job/J)
. = ..()
var/obj/item/storage/box/survival/SB = locate() in H