mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
125 lines
3.7 KiB
Plaintext
125 lines
3.7 KiB
Plaintext
/* Using the HUD procs is simple. Call these procs in the life.dm of the intended mob.
|
|
Use the regular_hud_updates() proc before process_med_hud(mob) or process_sec_hud(mob) so
|
|
the HUD updates properly! */
|
|
|
|
//Deletes the current HUD images so they can be refreshed with new ones.
|
|
mob/proc/regular_hud_updates() //Used in the life.dm of mobs that can use HUDs.
|
|
if(client)
|
|
for(var/image/hud in client.images)
|
|
if(findtext(hud.icon_state, "hud", 1, 4))
|
|
client.images -= hud
|
|
if(src in med_hud_users)
|
|
med_hud_users -= src
|
|
if(src in sec_hud_users)
|
|
sec_hud_users -= src
|
|
|
|
|
|
//Medical HUD outputs. Called by the Life() proc of the mob using it, usually.
|
|
proc/process_med_hud(var/mob/M, var/mob/eye)
|
|
if(!M)
|
|
return
|
|
if(!M.client)
|
|
return
|
|
if(!(M in med_hud_users))
|
|
med_hud_users += M
|
|
var/client/C = M.client
|
|
var/image/holder
|
|
var/turf/T
|
|
if(eye)
|
|
T = get_turf(eye)
|
|
else
|
|
T = get_turf(M)
|
|
for(var/mob/living/carbon/human/patient in range(T))
|
|
if(patient.head && istype(patient.head,/obj/item/clothing/head/tinfoil)) //Tinfoil hat? Move along.
|
|
continue
|
|
if(M.see_invisible < patient.invisibility)
|
|
continue
|
|
var/foundVirus = 0
|
|
for(var/datum/disease/D in patient.viruses)
|
|
if(!D.hidden[SCANNER])
|
|
foundVirus++
|
|
if(!C) continue
|
|
|
|
holder = patient.hud_list[HEALTH_HUD]
|
|
if(holder)
|
|
if(patient.stat == 2)
|
|
holder.icon_state = "hudhealth-100"
|
|
else
|
|
holder.icon_state = "hud[RoundHealth(patient.health)]"
|
|
C.images += holder
|
|
|
|
holder = patient.hud_list[STATUS_HUD]
|
|
if(holder)
|
|
if(patient.stat == 2)
|
|
holder.icon_state = "huddead"
|
|
else if(patient.status_flags & XENO_HOST)
|
|
holder.icon_state = "hudxeno"
|
|
else if(foundVirus)
|
|
holder.icon_state = "hudill"
|
|
else
|
|
holder.icon_state = "hudhealthy"
|
|
C.images += holder
|
|
|
|
|
|
//Security HUDs. Pass a value for the second argument to enable implant viewing or other special features.
|
|
proc/process_sec_hud(var/mob/M, var/advanced_mode,var/mob/eye)
|
|
if(!M)
|
|
return
|
|
if(!M.client)
|
|
return
|
|
if(!(M in sec_hud_users))
|
|
sec_hud_users += M
|
|
var/client/C = M.client
|
|
var/image/holder
|
|
var/turf/T
|
|
if(eye)
|
|
T = get_turf(eye)
|
|
else
|
|
T = get_turf(M)
|
|
for(var/mob/living/carbon/human/perp in range(T))
|
|
if(M.see_invisible < perp.invisibility)
|
|
continue
|
|
holder = perp.hud_list[ID_HUD]
|
|
if(!holder)
|
|
continue
|
|
holder.icon_state = "hudno_id"
|
|
if(perp.head && istype(perp.head,/obj/item/clothing/head/tinfoil)) //Tinfoil hat? Move along.
|
|
C.images += holder
|
|
continue
|
|
var/obj/item/weapon/card/id/card = perp.get_id_card()
|
|
if(card)
|
|
holder.icon_state = "hud[ckey(card.GetJobName())]"
|
|
C.images += holder
|
|
|
|
if(advanced_mode) //If set, the SecHUD will display the implants a person has.
|
|
for(var/obj/item/weapon/implant/I in perp)
|
|
if(I.implanted)
|
|
if(istype(I,/obj/item/weapon/implant/tracking))
|
|
holder = perp.hud_list[IMPTRACK_HUD]
|
|
holder.icon_state = "hud_imp_tracking"
|
|
else if(istype(I,/obj/item/weapon/implant/loyalty))
|
|
holder = perp.hud_list[IMPLOYAL_HUD]
|
|
holder.icon_state = "hud_imp_loyal"
|
|
else if(istype(I,/obj/item/weapon/implant/chem))
|
|
holder = perp.hud_list[IMPCHEM_HUD]
|
|
holder.icon_state = "hud_imp_chem"
|
|
else
|
|
continue
|
|
C.images += holder
|
|
break
|
|
|
|
var/perpname = perp.get_face_name()
|
|
if(lowertext(perpname) == "unknown" || !perpname)
|
|
perpname = perp.get_id_name("Unknown")
|
|
if(perpname)
|
|
var/datum/data/record/R = find_record("name", perpname, data_core.security)
|
|
if(R)
|
|
holder = perp.hud_list[WANTED_HUD]
|
|
switch(R.fields["criminal"])
|
|
if("*Arrest*") holder.icon_state = "hudwanted"
|
|
if("Incarcerated") holder.icon_state = "hudprisoner"
|
|
if("Parolled") holder.icon_state = "hudparolled"
|
|
if("Released") holder.icon_state = "hudreleased"
|
|
else
|
|
continue
|
|
C.images += holder |