diff --git a/code/__DEFINES/dcs/mob_signals.dm b/code/__DEFINES/dcs/mob_signals.dm index 5ff29166680..286daac792f 100644 --- a/code/__DEFINES/dcs/mob_signals.dm +++ b/code/__DEFINES/dcs/mob_signals.dm @@ -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 diff --git a/code/game/gamemodes/miniantags/guardian/guardian.dm b/code/game/gamemodes/miniantags/guardian/guardian.dm index 425e4013bb5..1901ec93ba9 100644 --- a/code/game/gamemodes/miniantags/guardian/guardian.dm +++ b/code/game/gamemodes/miniantags/guardian/guardian.dm @@ -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, "Your [name] died somehow!") + 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 = "
[resulthealth]%
" + hud_used.guardianhealthdisplay.maptext = "
[resulthealth]%
" /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 diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index 1a3dee8c18e..f508bc1e511 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -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() diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index a7209d9f643..206c0981b53 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -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()