mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-27 22:17:32 +01:00
[FIX] Guardian health HUD now updates properly when host health changes (#26818)
* Guardian health hud now updates properly * Now with negative numbers! * New signal * remove non-functioning proc * Update code/game/gamemodes/miniantags/guardian/guardian.dm Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Signed-off-by: Chap <erwin@lombok.demon.nl> --------- Signed-off-by: Chap <erwin@lombok.demon.nl> Co-authored-by: Adrer <adrermail@gmail.com> Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
This commit is contained in:
@@ -131,6 +131,8 @@
|
||||
///from base of /obj/item/bodypart/proc/attach_limb(): (new_limb, special) allows you to fail limb attachment
|
||||
#define COMSIG_LIVING_ATTACH_LIMB "living_attach_limb"
|
||||
#define COMPONENT_NO_ATTACH (1<<0)
|
||||
///from base of mob/living/health_update()
|
||||
#define COMSIG_LIVING_HEALTH_UPDATE "living_health_update"
|
||||
///sent from borg recharge stations: (amount, repairs)
|
||||
#define COMSIG_PROCESS_BORGCHARGER_OCCUPANT "living_charge"
|
||||
///sent when a mob enters a borg charger
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
return
|
||||
summoner = host
|
||||
host.grant_guardian_actions(src)
|
||||
RegisterSignal(summoner, COMSIG_LIVING_HEALTH_UPDATE, PROC_REF(update_health_hud))
|
||||
|
||||
/mob/living/simple_animal/hostile/guardian/can_buckle()
|
||||
return FALSE
|
||||
@@ -133,6 +134,7 @@
|
||||
if(!.)
|
||||
return FALSE
|
||||
to_chat(summoner, "<span class='danger'>Your [name] died somehow!</span>")
|
||||
UnregisterSignal(summoner, COMSIG_LIVING_HEALTH_UPDATE)
|
||||
summoner.death()
|
||||
|
||||
|
||||
@@ -140,11 +142,11 @@
|
||||
if(summoner)
|
||||
var/resulthealth
|
||||
if(iscarbon(summoner))
|
||||
resulthealth = round((abs(HEALTH_THRESHOLD_DEAD - summoner.health) / abs(HEALTH_THRESHOLD_DEAD - summoner.maxHealth)) * 100)
|
||||
resulthealth = round(((summoner.health - HEALTH_THRESHOLD_CRIT) / abs(HEALTH_THRESHOLD_CRIT - summoner.maxHealth)) * 100)
|
||||
else
|
||||
resulthealth = round((summoner.health / summoner.maxHealth) * 100)
|
||||
resulthealth = round((summoner.health / (summoner.maxHealth / 2)) * 100)
|
||||
if(hud_used)
|
||||
hud_used.guardianhealthdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font face='Small Fonts' color='#efeeef'>[resulthealth]%</font></div>"
|
||||
hud_used.guardianhealthdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font face='Small Fonts' color=[summoner.health < HEALTH_THRESHOLD_CRIT ? "#db2828" : "#efeeef"]>[resulthealth]%</font></div>"
|
||||
|
||||
/mob/living/simple_animal/hostile/guardian/adjustHealth(amount, updating_health = TRUE) //The spirit is invincible, but passes on damage/healing to the summoner
|
||||
var/damage = amount * damage_transfer
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
health = maxHealth - getOxyLoss() - getToxLoss() - getCloneLoss() - total_limb_damage
|
||||
|
||||
SEND_SIGNAL(src, COMSIG_LIVING_HEALTH_UPDATE)
|
||||
update_stat("updatehealth([reason])")
|
||||
med_hud_set_health()
|
||||
|
||||
|
||||
@@ -359,6 +359,7 @@
|
||||
return
|
||||
health = maxHealth - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() - getCloneLoss()
|
||||
|
||||
SEND_SIGNAL(src, COMSIG_LIVING_HEALTH_UPDATE)
|
||||
update_stat("updatehealth([reason])")
|
||||
med_hud_set_health()
|
||||
med_hud_set_status()
|
||||
|
||||
Reference in New Issue
Block a user