From a15637a9297f973015e3eabe0e7a65dff66ac38c Mon Sep 17 00:00:00 2001 From: keronshb Date: Wed, 19 May 2021 19:18:19 -0400 Subject: [PATCH] Part 1 of Health Bars for Space Dragon --- code/modules/mob/living/living.dm | 41 ++++++++++++++++++++++- code/modules/mob/living/living_defines.dm | 1 + 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 6aaa2cca87..0ae83e6a25 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -543,7 +543,46 @@ med_hud_set_health() med_hud_set_status() -//proc used to ressuscitate a mob +/mob/living/update_health_hud() + var/severity = 0 + var/healthpercent = (health/maxHealth) * 100 + if(hud_used?.healthdoll) //to really put you in the boots of a simplemob + var/obj/screen/healthdoll/living/livingdoll = hud_used.healthdoll + switch(healthpercent) + if(100 to INFINITY) + livingdoll.icon_state = "living0" + if(80 to 100) + livingdoll.icon_state = "living1" + severity = 1 + if(60 to 80) + livingdoll.icon_state = "living2" + severity = 2 + if(40 to 60) + livingdoll.icon_state = "living3" + severity = 3 + if(20 to 40) + livingdoll.icon_state = "living4" + severity = 4 + if(1 to 20) + livingdoll.icon_state = "living5" + severity = 5 + else + livingdoll.icon_state = "living6" + severity = 6 + if(!livingdoll.filtered) + livingdoll.filtered = TRUE + var/icon/mob_mask = icon(icon, icon_state) + if(mob_mask.Height() > world.icon_size || mob_mask.Width() > world.icon_size) + var/health_doll_icon_state = health_doll_icon ? health_doll_icon : "megasprite" + mob_mask = icon('icons/mob/screen_gen.dmi', health_doll_icon_state) //swap to something generic if they have no special doll + UNLINT(livingdoll.filters += filter(type="alpha", icon = mob_mask)) + livingdoll.filters += filter(type="drop_shadow", size = -1) + if(severity > 0) + overlay_fullscreen("brute", /obj/screen/fullscreen/brute, severity) + else + clear_fullscreen("brute") + +//Proc used to resuscitate a mob, for full_heal see fully_heal() /mob/living/proc/revive(full_heal = FALSE, admin_revive = FALSE) SEND_SIGNAL(src, COMSIG_LIVING_REVIVE, full_heal, admin_revive) if(full_heal) diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 386f1174e1..f5919f389c 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -94,6 +94,7 @@ var/smoke_delay = 0 //used to prevent spam with smoke reagent reaction on mob. var/bubble_icon = "default" //what icon the mob uses for speechbubbles + var/health_doll_icon //if this exists AND the normal sprite is bigger than 32x32, this is the replacement icon state (because health doll size limitations). the icon will always be screen_gen.dmi var/last_bumped = 0 var/unique_name = 0 //if a mob's name should be appended with an id when created e.g. Mob (666)