Merge pull request #11776 from Arkatos1/SlimeHUD

SlimeHUD
This commit is contained in:
variableundefined
2019-08-15 10:37:12 +08:00
committed by GitHub
7 changed files with 106 additions and 3 deletions
+8 -2
View File
@@ -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"
+6
View File
@@ -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'
+18
View File
@@ -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
@@ -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
@@ -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")