From 1f78b145599ea15db5d604d7c9d2efb8450cad02 Mon Sep 17 00:00:00 2001 From: Arkatos1 Date: Mon, 1 Jul 2019 18:08:19 +0200 Subject: [PATCH] Added SlimeHUD --- code/_onclick/hud/_defines.dm | 10 ++++- code/_onclick/hud/screen_objects.dm | 5 +++ code/_onclick/hud/slime.dm | 18 +++++++++ code/modules/mob/living/carbon/slime/slime.dm | 38 ++++++++++++++++++ .../living/simple_animal/friendly/slime.dm | 36 ++++++++++++++++- icons/mob/screen_slime.dmi | Bin 0 -> 2678 bytes paradise.dme | 1 + 7 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 code/_onclick/hud/slime.dm create mode 100644 icons/mob/screen_slime.dmi 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 c583617ac23..4560794c009 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -453,6 +453,11 @@ /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" 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 0000000000000000000000000000000000000000..d5786f3ca691d8d9ee2411e1c7cd88864ae01e60 GIT binary patch literal 2678 zcmV-+3W@cJP)C0006UP)t-sz`(#3 z78WuxGAJl0KR-WOT3SLvLM$vSzP`RMFE0RI006xJkB^T4r~p1bK3G^-R#sL`O-*`w zdQMJGOG`^eMn*I=G%zqQf`Wo-YHD0uTsb*8D=RAibpU^Ve`siEU|?WXRaI?mZF6&T zeSLkbtgLc!a$8$lQc_aCzrVe`y>W4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