diff --git a/code/_onclick/hud/_defines.dm b/code/_onclick/hud/_defines.dm index e3d423130e5..58e82733abe 100644 --- a/code/_onclick/hud/_defines.dm +++ b/code/_onclick/hud/_defines.dm @@ -107,14 +107,20 @@ #define ui_healthdoll "EAST-1:28,CENTER-1:15" #define ui_health "EAST-1:28,CENTER:17" #define ui_internal "EAST-1:28,CENTER+1:19" - //borgs + +//borgs #define ui_borg_health "EAST-1:28,CENTER-1:15" //borgs have the health display where humans have the pressure damage indicator. + +//aliens #define ui_alien_health "EAST-1:28,CENTER-1:15" //aliens have the health display where humans have the pressure damage indicator. - +//constructs #define ui_construct_pull "EAST-1:28,SOUTH+1:10" //above the zone_sel icon #define ui_construct_health "EAST,CENTER:15" //same height as humans, hugging the right border +//slimes +#define ui_slime_health "EAST,CENTER:15" //same as borgs, constructs and humans + //Pop-up inventory #define ui_shoes "WEST+1:8,SOUTH:5" diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index a0274c30616..8bc65fcf691 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -456,6 +456,12 @@ /obj/screen/healths/corgi icon = 'icons/mob/screen_corgi.dmi' +/obj/screen/healths/slime + icon = 'icons/mob/screen_slime.dmi' + icon_state = "slime_health0" + screen_loc = ui_slime_health + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + /obj/screen/healths/guardian name = "summoner health" icon = 'icons/mob/guardian.dmi' diff --git a/code/_onclick/hud/slime.dm b/code/_onclick/hud/slime.dm new file mode 100644 index 00000000000..9f5621b75ee --- /dev/null +++ b/code/_onclick/hud/slime.dm @@ -0,0 +1,18 @@ +/mob/living/carbon/slime/create_mob_hud() + if(client && !hud_used) + hud_used = new /datum/hud/slime(src) + +/mob/living/simple_animal/slime/create_mob_hud() + if(client && !hud_used) + hud_used = new /datum/hud/slime(src) + +/datum/hud/slime/New(mob/owner) + ..() + mymob.healths = new /obj/screen/healths/slime() + infodisplay += mymob.healths + + mymob.pullin = new /obj/screen/pull() + mymob.pullin.icon = 'icons/mob/screen_slime.dmi' + mymob.pullin.update_icon(mymob) + mymob.pullin.screen_loc = ui_construct_pull + hotkeybuttons += mymob.pullin diff --git a/code/modules/mob/living/carbon/slime/slime.dm b/code/modules/mob/living/carbon/slime/slime.dm index 914c810da27..38dadbbbfa7 100644 --- a/code/modules/mob/living/carbon/slime/slime.dm +++ b/code/modules/mob/living/carbon/slime/slime.dm @@ -146,6 +146,44 @@ stat(null,"Power Level: [powerlevel]") +/mob/living/carbon/slime/updatehealth(reason) + . = ..() + update_health_hud() + +/mob/living/carbon/slime/proc/update_health_hud() + if(hud_used) + var/severity = 0 + var/healthpercent = (health/maxHealth) * 100 + if(stat != DEAD) + switch(healthpercent) + if(100 to INFINITY) + healths.icon_state = "slime_health0" + if(80 to 100) + healths.icon_state = "slime_health1" + severity = 1 + if(60 to 80) + healths.icon_state = "slime_health2" + severity = 2 + if(40 to 60) + healths.icon_state = "slime_health3" + severity = 3 + if(20 to 40) + healths.icon_state = "slime_health4" + severity = 4 + if(0 to 20) + healths.icon_state = "slime_health5" + severity = 5 + if(-199 to 0) + healths.icon_state = "slime_health6" + severity = 6 + else + healths.icon_state = "slime_health7" + severity = 6 + if(severity > 0) + overlay_fullscreen("brute", /obj/screen/fullscreen/brute, severity) + else + clear_fullscreen("brute") + /mob/living/carbon/slime/adjustFireLoss(amount) ..(-abs(amount)) // Heals them return diff --git a/code/modules/mob/living/simple_animal/friendly/slime.dm b/code/modules/mob/living/simple_animal/friendly/slime.dm index 13e7c893d86..ac913170c86 100644 --- a/code/modules/mob/living/simple_animal/friendly/slime.dm +++ b/code/modules/mob/living/simple_animal/friendly/slime.dm @@ -12,8 +12,8 @@ response_disarm = "shoos" response_harm = "stomps on" emote_see = list("jiggles", "bounces in place") - var/colour = "grey" pass_flags = PASSTABLE + var/colour = "grey" /mob/living/simple_animal/slime/adult health = 200 @@ -24,3 +24,37 @@ /mob/living/simple_animal/slime/New() ..() overlays += "aslime-:33" + +/mob/living/simple_animal/slime/updatehealth(reason) + . = ..() + update_health_hud() + +/mob/living/simple_animal/slime/proc/update_health_hud() + if(hud_used) + var/severity = 0 + var/healthpercent = (health/maxHealth) * 100 + switch(healthpercent) + if(100 to INFINITY) + healths.icon_state = "slime_health0" + if(80 to 100) + healths.icon_state = "slime_health1" + severity = 1 + if(60 to 80) + healths.icon_state = "slime_health2" + severity = 2 + if(40 to 60) + healths.icon_state = "slime_health3" + severity = 3 + if(20 to 40) + healths.icon_state = "slime_health4" + severity = 4 + if(1 to 20) + healths.icon_state = "slime_health5" + severity = 5 + else + healths.icon_state = "slime_health7" + severity = 6 + if(severity > 0) + overlay_fullscreen("brute", /obj/screen/fullscreen/brute, severity) + else + clear_fullscreen("brute") diff --git a/icons/mob/screen_slime.dmi b/icons/mob/screen_slime.dmi new file mode 100644 index 00000000000..d5786f3ca69 Binary files /dev/null and b/icons/mob/screen_slime.dmi differ diff --git a/paradise.dme b/paradise.dme index afaa97e1919..86eb2825b04 100644 --- a/paradise.dme +++ b/paradise.dme @@ -148,6 +148,7 @@ #include "code\_onclick\hud\radial.dm" #include "code\_onclick\hud\robot.dm" #include "code\_onclick\hud\screen_objects.dm" +#include "code\_onclick\hud\slime.dm" #include "code\_onclick\hud\swarmer.dm" #include "code\ATMOSPHERICS\atmospherics.dm" #include "code\ATMOSPHERICS\datum_icon_manager.dm"