More hud stuff

This commit is contained in:
Aurorablade
2017-11-28 23:17:50 -05:00
parent 64c4883cc2
commit dc6bb34b38
16 changed files with 126 additions and 71 deletions
+55 -54
View File
@@ -76,56 +76,54 @@
return 0
//helper for getting the appropriate health status UPDATED BY PUCKABOO2 TO INCLUDE NEGATIVES.
/proc/RoundHealth(health)
switch(health)
/proc/RoundHealth(mob/living/M)
if(M.stat == DEAD)
return "health-100" //what's our health? it doesn't matter, we're dead
var/resulthealth = (M.health / M.maxHealth) * 100
switch(resulthealth)
if(100 to INFINITY)
return "health100"
if(95 to 100)
return "health95" //For telling patients to eat a warm donk pocket and go on with their shift.
if(90 to 95)
return "health90"
if(80 to 90)
return "health80"
if(70 to 80)
return "health70"
if(60 to 70)
return "health60"
if(50 to 60)
if(90.625 to 100)
return "health93.75"
if(84.375 to 90.625)
return "health87.5"
if(78.125 to 84.375)
return "health81.25"
if(71.875 to 78.125)
return "health75"
if(65.625 to 71.875)
return "health68.75"
if(59.375 to 65.625)
return "health62.5"
if(53.125 to 59.375)
return "health56.25"
if(46.875 to 53.125)
return "health50"
if(40 to 50)
return "health40"
if(30 to 40)
return "health30"
if(20 to 30)
return "health20"
if(10 to 20)
return "health10"
if(0 to 10)
if(40.625 to 46.875)
return "health43.75"
if(34.375 to 40.625)
return "health37.5"
if(28.125 to 34.375)
return "health31.25"
if(21.875 to 28.125)
return "health25"
if(15.625 to 21.875)
return "health18.75"
if(9.375 to 15.625)
return "health12.5"
if(1 to 9.375)
return "health6.25"
if(-50 to 1)
return "health0"
if(-10 to 0)
return "health-0" //The health bar will turn a brilliant red and flash as usual, but deducted health will be black.
if(-20 to -10)
return "health-10"
if(-30 to -20)
return "health-20"
if(-40 to -30)
return "health-30"
if(-50 to -40)
return "health-40"
if(-60 to -50)
if(-85 to -50)
return "health-50"
if(-70 to -60)
return "health-60"
if(-80 to -70)
return "health-70" //Doc?
if(-90 to -80)
return "health-80" //Hey, doc?
if(-100 to -90)
return "health-90" //HURRY UP, DOC!
if(-99 to -85)
return "health-85"
else
return "health-100" //doc u had 1 job
return "health-100"
return "0"
///HOOKS
//called when a human changes suit sensors
@@ -134,22 +132,26 @@
B.update_suit_sensors(src)
//called when a carbon changes health
/mob/living/carbon/proc/med_hud_set_health()
//called when a living mob changes health
/mob/living/proc/med_hud_set_health()
var/image/holder = hud_list[HEALTH_HUD]
if(stat == 2)
holder.icon_state = "hudhealth-100"
else
holder.icon_state = "hud[RoundHealth(health)]"
holder.icon_state = "hud[RoundHealth(src)]"
//called when a carbon changes stat, virus or XENO_HOST
/mob/living/carbon/proc/med_hud_set_status()
/mob/living/proc/med_hud_set_status()
var/image/holder = hud_list[STATUS_HUD]
//var/image/holder2 = hud_list[STATUS_HUD_OOC]
var/mob/living/simple_animal/borer/B = has_brain_worms()
if(stat == 2)
if(stat == DEAD)
holder.icon_state = "huddead"
else
holder.icon_state = "hudhealthy"
//called when a carbon changes stat, virus or XENO_HOST
/mob/living/carbon/med_hud_set_status()
var/image/holder = hud_list[STATUS_HUD]
var/mob/living/simple_animal/borer/B = has_brain_worms()
if(stat == DEAD)
holder.icon_state = "huddead"
//holder2.icon_state = "huddead"
else if(status_flags & XENO_HOST)
holder.icon_state = "hudxeno"
else if(check_virus())
@@ -158,7 +160,6 @@
holder.icon_state = "hudbrainworm"
else
holder.icon_state = "hudhealthy"
//holder2.icon_state = "hudhealthy"
@@ -112,6 +112,7 @@
loot = list(/obj/effect/decal/cleanable/blood/gibs/robot, /obj/item/weapon/ore/bluespace_crystal/artificial)
deathmessage = "The swarmer explodes with a sharp pop!"
del_on_death = 1
hud_possible = list(SPECIALROLE_HUD, DIAG_STAT_HUD, DIAG_HUD)
/mob/living/simple_animal/hostile/swarmer/Login()
..()
@@ -131,6 +132,18 @@
diag_hud.add_to_hud(src)
updatename()
/mob/living/simple_animal/hostile/swarmer/med_hud_set_health()
var/image/holder = hud_list[DIAG_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
holder.icon_state = "huddiag[RoundDiagBar(health/maxHealth)]"
/mob/living/simple_animal/hostile/swarmer/med_hud_set_status()
var/image/holder = hud_list[DIAG_STAT_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
holder.icon_state = "hudstat"
/mob/living/simple_animal/hostile/swarmer/Stat()
..()
if(statpanel("Status"))
@@ -41,6 +41,21 @@
var/adminseal = FALSE
var/name_color = "white"//only used with protector shields for the time being
/mob/living/simple_animal/hostile/guardian/med_hud_set_health()
if(summoner)
var/image/holder = hud_list[HEALTH_HUD]
holder.icon_state = "hud[RoundHealth(summoner)]"
/mob/living/simple_animal/hostile/guardian/med_hud_set_status()
if(summoner)
var/image/holder = hud_list[STATUS_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
if(summoner.stat == DEAD)
holder.icon_state = "huddead"
else
holder.icon_state = "hudhealthy"
/mob/living/simple_animal/hostile/guardian/Life() //Dies if the summoner dies
..()
if(summoner)
@@ -88,7 +103,8 @@
resulthealth = round((summoner.health / summoner.maxHealth) * 100)
if(hud_used)
hud_used.guardianhealthdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#efeeef'>[resulthealth]%</font></div>"
med_hud_set_health()
med_hud_set_status()
/mob/living/simple_animal/hostile/guardian/adjustHealth(amount) //The spirit is invincible, but passes on damage to the summoner
var/damage = amount * damage_transfer
@@ -52,6 +52,9 @@
C.adjustOxyLoss(-5)
C.adjustToxLoss(-5)
heal_cooldown = world.time + 20
if(C == summoner)
med_hud_set_health()
med_hud_set_status()
/mob/living/simple_animal/hostile/guardian/healer/ToggleMode()
if(loc == summoner)
-15
View File
@@ -2,20 +2,6 @@
var/canEnterVentWith = "/obj/item/weapon/implant=0&/obj/item/clothing/mask/facehugger=0&/obj/item/device/radio/borg=0&/obj/machinery/camera=0"
var/datum/middleClickOverride/middleClickOverride = null
/mob/living/carbon/prepare_huds()
..()
prepare_data_huds()
/mob/living/carbon/proc/prepare_data_huds()
..()
med_hud_set_health()
med_hud_set_status()
/mob/living/carbon/updatehealth()
..()
med_hud_set_health()
med_hud_set_status()
/mob/living/carbon/Destroy()
QDEL_LIST(internal_organs)
QDEL_LIST(stomach_contents)
@@ -23,7 +9,6 @@
if(B)
B.leave_host()
qdel(B)
remove_from_all_data_huds()
return ..()
/mob/living/carbon/blob_act()
@@ -1,6 +1,5 @@
/mob/living/carbon
gender = MALE
hud_possible = list(HEALTH_HUD,STATUS_HUD,SPECIALROLE_HUD)
var/list/stomach_contents = list()
var/list/internal_organs = list()
var/list/internal_organs_slot = list() //Same as above, but stores "slot ID" - "organ" pairs for easy access.
+3
View File
@@ -14,4 +14,7 @@
var/datum/soullink/S = s
S.sharerDies(gibbed, src)
med_hud_set_health()
med_hud_set_status()
..(gibbed)
+16
View File
@@ -1,7 +1,22 @@
/mob/living/New()
. = ..()
var/datum/atom_hud/data/human/medical/advanced/medhud = huds[DATA_HUD_MEDICAL_ADVANCED]
medhud.add_to_hud(src)
/mob/living/prepare_huds()
..()
prepare_data_huds()
/mob/living/proc/prepare_data_huds()
..()
med_hud_set_health()
med_hud_set_status()
/mob/living/Destroy()
if(ranged_ability)
ranged_ability.remove_ranged_ability(src)
remove_from_all_data_huds()
return ..()
/mob/living/ghostize(can_reenter_corpse = 1)
@@ -214,6 +229,7 @@
stat = CONSCIOUS
return
health = maxHealth - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() - getCloneLoss()
med_hud_set_health()
//This proc is used for mobs which are affected by pressure to calculate the amount of pressure that actually
@@ -64,3 +64,4 @@
var/list/recent_tastes = list()
var/blood_volume = 0 //how much blood the mob has
hud_possible = list(HEALTH_HUD,STATUS_HUD,SPECIALROLE_HUD)
@@ -44,6 +44,12 @@
add_language("Galactic Common")
init_subsystems()
/mob/living/silicon/med_hud_set_health()
return //we use a different hud
/mob/living/silicon/med_hud_set_status()
return //we use a different hud
/mob/living/silicon/Destroy()
silicon_mob_list -= src
for(var/datum/alarm_handler/AH in alarm_handlers)
@@ -75,6 +75,7 @@
var/control_freq = BOT_FREQ // bot control frequency
var/bot_filter // The radio filter the bot uses to identify itself on the network.
var/bot_type = 0 //The type of bot it is, for radio control.
var/data_hud_type = DATA_HUD_DIAGNOSTIC //The type of data HUD the bot uses. Diagnostic by default.
//This holds text for what the bot is mode doing, reported on the remote bot control interface.
var/list/mode_name = list("In Pursuit","Preparing to Arrest", "Arresting", \
"Beginning Patrol", "Patrolling", "Summoned by PDA", \
@@ -170,6 +171,13 @@
path_hud.add_to_hud(src)
path_hud.add_hud_to(src)
/mob/living/simple_animal/bot/med_hud_set_health()
return //we use a different hud
/mob/living/simple_animal/bot/med_hud_set_status()
return //we use a different hud
/mob/living/simple_animal/bot/update_canmove(delay_action_updates = 0)
. = ..()
if(!on)
@@ -21,6 +21,7 @@
window_id = "autoed209"
window_name = "Automatic Security Unit v2.6"
path_image_color = "#FF0000"
data_hud_type = DATA_HUD_SECURITY_ADVANCED
var/lastfired = 0
var/shot_delay = 3 //.3 seconds between shots
@@ -20,6 +20,7 @@
window_id = "automed"
window_name = "Automatic Medical Unit v1.1"
path_image_color = "#DDDDFF"
data_hud_type = DATA_HUD_MEDICAL_ADVANCED
var/obj/item/weapon/reagent_containers/glass/reagent_glass = null //Can be set to draw from this for reagents.
var/skin = null //Set to "tox", "ointment" or "o2" for the other two firstaid kits.
@@ -19,6 +19,7 @@
window_id = "autosec"
window_name = "Automatic Security Unit v1.6"
path_image_color = "#FF0000"
data_hud_type = DATA_HUD_SECURITY_ADVANCED
var/base_icon = "secbot"
var/mob/living/carbon/target
@@ -109,6 +109,7 @@
/mob/living/simple_animal/updatehealth()
..()
health = Clamp(health, 0, maxHealth)
med_hud_set_status()
/mob/living/simple_animal/handle_hud_icons_health()
..()
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB