mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-19 02:56:14 +01:00
Merge pull request #4553 from Ccomp5950/hud_rewrite
Code effeciency project: HUD items rewrite.
This commit is contained in:
+23
-1
@@ -74,4 +74,26 @@ proc/age2agedescription(age)
|
||||
if(45 to 60) return "middle-aged"
|
||||
if(60 to 70) return "aging"
|
||||
if(70 to INFINITY) return "elderly"
|
||||
else return "unknown"
|
||||
else return "unknown"
|
||||
|
||||
proc/RoundHealth(health)
|
||||
switch(health)
|
||||
if(100 to INFINITY)
|
||||
return "health100"
|
||||
if(70 to 100)
|
||||
return "health80"
|
||||
if(50 to 70)
|
||||
return "health60"
|
||||
if(30 to 50)
|
||||
return "health40"
|
||||
if(18 to 30)
|
||||
return "health25"
|
||||
if(5 to 18)
|
||||
return "health10"
|
||||
if(1 to 5)
|
||||
return "health1"
|
||||
if(-99 to 0)
|
||||
return "health0"
|
||||
else
|
||||
return "health-100"
|
||||
return "0"
|
||||
|
||||
+15
-1
@@ -499,6 +499,9 @@ datum/mind
|
||||
|
||||
else if(href_list["implant"])
|
||||
var/mob/living/carbon/human/H = current
|
||||
|
||||
H.hud_updateflag |= (1 << IMPLOYAL_HUD) // updates that players HUD images so secHUD's pick up they are implanted or not.
|
||||
|
||||
switch(href_list["implant"])
|
||||
if("remove")
|
||||
for(var/obj/item/weapon/implant/loyalty/I in H.contents)
|
||||
@@ -540,6 +543,8 @@ datum/mind
|
||||
log_admin("[key_name_admin(usr)] has de-traitor'ed [current].")
|
||||
|
||||
else if (href_list["revolution"])
|
||||
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
|
||||
|
||||
switch(href_list["revolution"])
|
||||
if("clear")
|
||||
if(src in ticker.mode.revolutionaries)
|
||||
@@ -633,6 +638,7 @@ datum/mind
|
||||
usr << "\red Reequipping revolutionary goes wrong!"
|
||||
|
||||
else if (href_list["cult"])
|
||||
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
|
||||
switch(href_list["cult"])
|
||||
if("clear")
|
||||
if(src in ticker.mode.cult)
|
||||
@@ -682,6 +688,8 @@ datum/mind
|
||||
usr << "\red Spawning amulet failed!"
|
||||
|
||||
else if (href_list["wizard"])
|
||||
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
|
||||
|
||||
switch(href_list["wizard"])
|
||||
if("clear")
|
||||
if(src in ticker.mode.wizards)
|
||||
@@ -710,6 +718,7 @@ datum/mind
|
||||
usr << "\blue The objectives for wizard [key] have been generated. You can edit them and anounce manually."
|
||||
|
||||
else if (href_list["changeling"])
|
||||
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
|
||||
switch(href_list["changeling"])
|
||||
if("clear")
|
||||
if(src in ticker.mode.changelings)
|
||||
@@ -744,6 +753,10 @@ datum/mind
|
||||
domutcheck(current, null)
|
||||
|
||||
else if (href_list["nuclear"])
|
||||
var/mob/living/carbon/human/H = current
|
||||
|
||||
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
|
||||
|
||||
switch(href_list["nuclear"])
|
||||
if("clear")
|
||||
if(src in ticker.mode.syndicates)
|
||||
@@ -773,7 +786,6 @@ datum/mind
|
||||
if("lair")
|
||||
current.loc = get_turf(locate("landmark*Syndicate-Spawn"))
|
||||
if("dressup")
|
||||
var/mob/living/carbon/human/H = current
|
||||
del(H.belt)
|
||||
del(H.back)
|
||||
del(H.l_ear)
|
||||
@@ -800,6 +812,7 @@ datum/mind
|
||||
usr << "\red No valid nuke found!"
|
||||
|
||||
else if (href_list["traitor"])
|
||||
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
|
||||
switch(href_list["traitor"])
|
||||
if("clear")
|
||||
if(src in ticker.mode.traitors)
|
||||
@@ -882,6 +895,7 @@ datum/mind
|
||||
current.radiation -= 50
|
||||
|
||||
else if (href_list["silicon"])
|
||||
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
|
||||
switch(href_list["silicon"])
|
||||
if("unmalf")
|
||||
if(src in ticker.mode.malf_ai)
|
||||
|
||||
@@ -135,6 +135,7 @@
|
||||
newtraitor << "\red <B>ATTENTION:</B> \black It is time to pay your debt to the Syndicate..."
|
||||
newtraitor << "<B>You are now a traitor.</B>"
|
||||
newtraitor.mind.special_role = "traitor"
|
||||
newtraitor.hud_updateflag |= 1 << SPECIALROLE_HUD
|
||||
var/obj_count = 1
|
||||
newtraitor << "\blue Your current objectives:"
|
||||
if(!config.objectives_disabled)
|
||||
|
||||
@@ -208,6 +208,7 @@
|
||||
if(rev_mind in revolutionaries)
|
||||
revolutionaries -= rev_mind
|
||||
rev_mind.special_role = null
|
||||
rev_mind.current.hud_updateflag |= 1 << SPECIALROLE_HUD
|
||||
|
||||
if(beingborged)
|
||||
rev_mind.current << "\red <FONT size = 3><B>The frame's firmware detects and deletes your neural reprogramming! You remember nothing from the moment you were flashed until now.</B></FONT>"
|
||||
|
||||
@@ -304,4 +304,4 @@ mob/living/carbon/human/proc
|
||||
else if(choice == "No!")
|
||||
M << "\red You reject this traitorous cause!"
|
||||
src << "\red <b>[M] does not support the revolution!</b>"
|
||||
M.mind.rev_cooldown = world.time+50
|
||||
M.mind.rev_cooldown = world.time+50
|
||||
|
||||
@@ -116,6 +116,7 @@
|
||||
if(config.objectives_disabled)
|
||||
rev_mind.current << "<font color=blue>Within the rules,</font> try to act as an opposing force to the crew. Further RP and try to make sure other players have </i>fun<i>! If you are confused or at a loss, always adminhelp, and before taking extreme actions, please try to also contact the administration! Think through your actions and make the roleplay immersive! <b>Please remember all rules aside from those without explicit exceptions apply to antagonists.</i></b>"
|
||||
update_rev_icons_added(rev_mind)
|
||||
H.hud_updateflag |= 1 << SPECIALROLE_HUD
|
||||
return 1
|
||||
|
||||
/////////////////////////////
|
||||
|
||||
@@ -439,6 +439,10 @@ var/global/datum/controller/occupations/job_master
|
||||
var/obj/item/clothing/glasses/G = H.glasses
|
||||
G.prescription = 1
|
||||
// H.update_icons()
|
||||
|
||||
H.hud_updateflag |= (1 << ID_HUD)
|
||||
H.hud_updateflag |= (1 << IMPLOYAL_HUD)
|
||||
H.hud_updateflag |= (1 << SPECIALROLE_HUD)
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
@@ -525,6 +525,8 @@ What a mess.*/
|
||||
|
||||
if ("Change Criminal Status")
|
||||
if (active2)
|
||||
for(var/mob/living/carbon/human/H in player_list)
|
||||
H.hud_updateflag |= 1 << WANTED_HUD
|
||||
switch(href_list["criminal2"])
|
||||
if("none")
|
||||
active2.fields["criminal"] = "None"
|
||||
|
||||
@@ -47,8 +47,11 @@
|
||||
affected.implants += src.imp
|
||||
imp.part = affected
|
||||
|
||||
H.hud_updateflag |= 1 << IMPLOYAL_HUD
|
||||
|
||||
src.imp = null
|
||||
update()
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
@@ -14,80 +14,25 @@
|
||||
name = "Health Scanner HUD"
|
||||
desc = "A heads-up display that scans the humans in view and provides accurate data about their health status."
|
||||
icon_state = "healthhud"
|
||||
proc
|
||||
RoundHealth(health)
|
||||
|
||||
|
||||
RoundHealth(health)
|
||||
switch(health)
|
||||
if(100 to INFINITY)
|
||||
return "health100"
|
||||
if(70 to 100)
|
||||
return "health80"
|
||||
if(50 to 70)
|
||||
return "health60"
|
||||
if(30 to 50)
|
||||
return "health40"
|
||||
if(18 to 30)
|
||||
return "health25"
|
||||
if(5 to 18)
|
||||
return "health10"
|
||||
if(1 to 5)
|
||||
return "health1"
|
||||
if(-99 to 0)
|
||||
return "health0"
|
||||
else
|
||||
return "health-100"
|
||||
return "0"
|
||||
|
||||
|
||||
process_hud(var/mob/M)
|
||||
if(!M) return
|
||||
if(!M.client) return
|
||||
var/client/C = M.client
|
||||
var/image/holder
|
||||
for(var/mob/living/carbon/human/patient in view(get_turf(M)))
|
||||
if(M.see_invisible < patient.invisibility)
|
||||
continue
|
||||
var/foundVirus = 0
|
||||
for(var/datum/disease/D in patient.viruses)
|
||||
if(!D.hidden[SCANNER])
|
||||
foundVirus++
|
||||
for (var/ID in patient.virus2)
|
||||
if (ID in virusDB)
|
||||
foundVirus = 1
|
||||
break
|
||||
if(!C) continue
|
||||
|
||||
holder = patient.hud_list[HEALTH_HUD]
|
||||
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(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 if(patient.has_brain_worms())
|
||||
var/mob/living/simple_animal/borer/B = patient.has_brain_worms()
|
||||
if(B.controlling)
|
||||
holder.icon_state = "hudbrainworm"
|
||||
else
|
||||
holder.icon_state = "hudhealthy"
|
||||
else
|
||||
holder.icon_state = "hudhealthy"
|
||||
C.images += holder
|
||||
/obj/item/clothing/glasses/hud/health/process_hud(var/mob/M)
|
||||
if(!M) return
|
||||
if(!M.client) return
|
||||
var/client/C = M.client
|
||||
for(var/mob/living/carbon/human/patient in view(get_turf(M)))
|
||||
if(M.see_invisible < patient.invisibility)
|
||||
continue
|
||||
C.images += patient.hud_list[HEALTH_HUD]
|
||||
C.images += patient.hud_list[STATUS_HUD]
|
||||
|
||||
|
||||
/obj/item/clothing/glasses/hud/security
|
||||
name = "Security HUD"
|
||||
desc = "A heads-up display that scans the humans in view and provides accurate data about their ID status and security records."
|
||||
icon_state = "securityhud"
|
||||
var/global/list/jobs[0]
|
||||
|
||||
/obj/item/clothing/glasses/hud/security/jensenshades
|
||||
name = "Augmented shades"
|
||||
@@ -98,62 +43,16 @@
|
||||
invisa_view = 2
|
||||
|
||||
/obj/item/clothing/glasses/hud/security/process_hud(var/mob/M)
|
||||
|
||||
if(!M) return
|
||||
if(!M.client) return
|
||||
var/client/C = M.client
|
||||
var/image/holder
|
||||
for(var/mob/living/carbon/human/perp in view(get_turf(M)))
|
||||
if(M.see_invisible < perp.invisibility)
|
||||
continue
|
||||
if(!C) continue
|
||||
var/perpname = perp.name
|
||||
holder = perp.hud_list[ID_HUD]
|
||||
if(perp.wear_id)
|
||||
var/obj/item/weapon/card/id/I = perp.wear_id.GetID()
|
||||
if(I)
|
||||
perpname = I.registered_name
|
||||
holder.icon_state = "hud[ckey(I.GetJobName())]"
|
||||
C.images += holder
|
||||
else
|
||||
perpname = perp.name
|
||||
holder.icon_state = "hudunknown"
|
||||
C.images += holder
|
||||
else
|
||||
perpname = perp.name
|
||||
holder.icon_state = "hudunknown"
|
||||
C.images += holder
|
||||
|
||||
for(var/datum/data/record/E in data_core.general)
|
||||
if(E.fields["name"] == perpname)
|
||||
holder = perp.hud_list[WANTED_HUD]
|
||||
for (var/datum/data/record/R in data_core.security)
|
||||
if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "*Arrest*"))
|
||||
holder.icon_state = "hudwanted"
|
||||
C.images += holder
|
||||
break
|
||||
else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Incarcerated"))
|
||||
holder.icon_state = "hudprisoner"
|
||||
C.images += holder
|
||||
break
|
||||
else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Parolled"))
|
||||
holder.icon_state = "hudparolled"
|
||||
C.images += holder
|
||||
break
|
||||
else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Released"))
|
||||
holder.icon_state = "hudreleased"
|
||||
C.images += holder
|
||||
break
|
||||
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"
|
||||
C.images += holder
|
||||
if(istype(I,/obj/item/weapon/implant/loyalty))
|
||||
holder = perp.hud_list[IMPLOYAL_HUD]
|
||||
holder.icon_state = "hud_imp_loyal"
|
||||
C.images += holder
|
||||
if(istype(I,/obj/item/weapon/implant/chem))
|
||||
holder = perp.hud_list[IMPCHEM_HUD]
|
||||
holder.icon_state = "hud_imp_chem"
|
||||
C.images += holder
|
||||
C.images += perp.hud_list[ID_HUD]
|
||||
C.images += perp.hud_list[WANTED_HUD]
|
||||
C.images += perp.hud_list[IMPTRACK_HUD]
|
||||
C.images += perp.hud_list[IMPLOYAL_HUD]
|
||||
C.images += perp.hud_list[IMPCHEM_HUD]
|
||||
|
||||
@@ -102,10 +102,11 @@ Works together with spawning an observer, noted above.
|
||||
for(var/image/hud in client.images)
|
||||
if(copytext(hud.icon_state,1,4) == "hud")
|
||||
client.images.Remove(hud)
|
||||
|
||||
if(antagHUD)
|
||||
var/list/target_list = list()
|
||||
for(var/mob/living/target in oview(src))
|
||||
if( target.mind&&(target.mind.special_role||issilicon(target)) )
|
||||
for(var/mob/living/target in oview(src, 14))
|
||||
if(target.mind&&(target.mind.special_role||issilicon(target)) )
|
||||
target_list += target
|
||||
if(target_list.len)
|
||||
assess_targets(target_list, src)
|
||||
@@ -113,91 +114,19 @@ Works together with spawning an observer, noted above.
|
||||
process_medHUD(src)
|
||||
|
||||
|
||||
// Direct copied from medical HUD glasses proc, used to determine what health bar to put over the targets head.
|
||||
/mob/dead/proc/RoundHealth(var/health)
|
||||
switch(health)
|
||||
if(100 to INFINITY)
|
||||
return "health100"
|
||||
if(70 to 100)
|
||||
return "health80"
|
||||
if(50 to 70)
|
||||
return "health60"
|
||||
if(30 to 50)
|
||||
return "health40"
|
||||
if(18 to 30)
|
||||
return "health25"
|
||||
if(5 to 18)
|
||||
return "health10"
|
||||
if(1 to 5)
|
||||
return "health1"
|
||||
if(-99 to 0)
|
||||
return "health0"
|
||||
else
|
||||
return "health-100"
|
||||
return "0"
|
||||
|
||||
|
||||
// Pretty much a direct copy of Medical HUD stuff, except will show ill if they are ill instead of also checking for known illnesses.
|
||||
|
||||
/mob/dead/proc/process_medHUD(var/mob/M)
|
||||
var/client/C = M.client
|
||||
var/image/holder
|
||||
for(var/mob/living/carbon/human/patient in oview(M))
|
||||
var/foundVirus = 0
|
||||
if(patient.virus2.len)
|
||||
foundVirus = 1
|
||||
if(!C) return
|
||||
holder = patient.hud_list[HEALTH_HUD]
|
||||
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(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 if(patient.has_brain_worms())
|
||||
var/mob/living/simple_animal/borer/B = patient.has_brain_worms()
|
||||
if(B.controlling)
|
||||
holder.icon_state = "hudbrainworm"
|
||||
else
|
||||
holder.icon_state = "hudhealthy"
|
||||
else
|
||||
holder.icon_state = "hudhealthy"
|
||||
|
||||
C.images += holder
|
||||
|
||||
|
||||
/mob/dead/proc/assess_targets(list/target_list, mob/dead/observer/U)
|
||||
var/icon/tempHud = 'icons/mob/hud.dmi'
|
||||
for(var/mob/living/target in target_list)
|
||||
if(iscarbon(target))
|
||||
switch(target.mind.special_role)
|
||||
if("traitor","Syndicate")
|
||||
U.client.images += image(tempHud,target,"hudsyndicate")
|
||||
if("Revolutionary")
|
||||
U.client.images += image(tempHud,target,"hudrevolutionary")
|
||||
if("Head Revolutionary")
|
||||
U.client.images += image(tempHud,target,"hudheadrevolutionary")
|
||||
if("Cultist")
|
||||
U.client.images += image(tempHud,target,"hudcultist")
|
||||
if("Changeling")
|
||||
U.client.images += image(tempHud,target,"hudchangeling")
|
||||
if("Wizard","Fake Wizard")
|
||||
U.client.images += image(tempHud,target,"hudwizard")
|
||||
if("Hunter","Sentinel","Drone","Queen")
|
||||
U.client.images += image(tempHud,target,"hudalien")
|
||||
if("Death Commando")
|
||||
U.client.images += image(tempHud,target,"huddeathsquad")
|
||||
if("Ninja")
|
||||
U.client.images += image(tempHud,target,"hudninja")
|
||||
else//If we don't know what role they have but they have one.
|
||||
U.client.images += image(tempHud,target,"hudunknown1")
|
||||
/mob/dead/proc/process_medHUD(var/mob/M)
|
||||
var/client/C = M.client
|
||||
for(var/mob/living/carbon/human/patient in oview(M, 14))
|
||||
C.images += patient.hud_list[HEALTH_HUD]
|
||||
C.images += patient.hud_list[STATUS_HUD_OOC]
|
||||
|
||||
/mob/dead/proc/assess_targets(list/target_list, mob/dead/observer/U)
|
||||
var/client/C = U.client
|
||||
for(var/mob/living/carbon/human/target in target_list)
|
||||
C.images += target.hud_list[SPECIALROLE_HUD]
|
||||
|
||||
|
||||
/*
|
||||
else//If the silicon mob has no law datum, no inherent laws, or a law zero, add them to the hud.
|
||||
var/mob/living/silicon/silicon_target = target
|
||||
if(!silicon_target.laws||(silicon_target.laws&&(silicon_target.laws.zeroth||!silicon_target.laws.inherent.len))||silicon_target.mind.special_role=="traitor")
|
||||
@@ -205,8 +134,9 @@ Works together with spawning an observer, noted above.
|
||||
U.client.images += image(tempHud,silicon_target,"hudmalborg")
|
||||
else
|
||||
U.client.images += image(tempHud,silicon_target,"hudmalai")
|
||||
return 1
|
||||
|
||||
*/
|
||||
return 1
|
||||
|
||||
/mob/proc/ghostize(var/can_reenter_corpse = 1)
|
||||
if(key)
|
||||
var/mob/dead/observer/ghost = new(src) //Transfer safety to observer spawning proc.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
voice_name = "unknown"
|
||||
icon = 'icons/mob/human.dmi'
|
||||
icon_state = "body_m_s"
|
||||
var/list/hud_list = list()
|
||||
var/list/hud_list[9]
|
||||
var/datum/species/species //Contains icon generation and language information, set during New().
|
||||
var/embedded_flag //To check if we've need to roll for damage on movement while an item is imbedded in us.
|
||||
|
||||
@@ -53,8 +53,16 @@
|
||||
dna = new /datum/dna(null)
|
||||
dna.species=species.name
|
||||
|
||||
for(var/i=0;i<7;i++) // 2 for medHUDs and 5 for secHUDs
|
||||
hud_list += image('icons/mob/hud.dmi', src, "hudunknown")
|
||||
hud_list[HEALTH_HUD] = image('icons/mob/hud.dmi', src, "hudhealth100")
|
||||
hud_list[STATUS_HUD] = image('icons/mob/hud.dmi', src, "hudhealthy")
|
||||
hud_list[ID_HUD] = image('icons/mob/hud.dmi', src, "hudunknown")
|
||||
hud_list[WANTED_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[IMPLOYAL_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[IMPCHEM_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[IMPTRACK_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[SPECIALROLE_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[STATUS_HUD_OOC] = image('icons/mob/hud.dmi', src, "hudhealthy")
|
||||
|
||||
|
||||
..()
|
||||
|
||||
@@ -552,6 +560,7 @@
|
||||
modified = 1
|
||||
|
||||
spawn()
|
||||
hud_updateflag |= 1 << WANTED_HUD
|
||||
if(istype(usr,/mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/U = usr
|
||||
U.handle_regular_hud_updates()
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
take_overall_damage(amount, 0)
|
||||
else
|
||||
heal_overall_damage(-amount, 0)
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
|
||||
/mob/living/carbon/human/adjustFireLoss(var/amount)
|
||||
if(species && species.burn_mod)
|
||||
@@ -56,6 +57,7 @@
|
||||
take_overall_damage(0, amount)
|
||||
else
|
||||
heal_overall_damage(0, -amount)
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
|
||||
/mob/living/carbon/human/Stun(amount)
|
||||
if(HULK in mutations) return
|
||||
@@ -97,6 +99,8 @@
|
||||
if (O.status & ORGAN_MUTATED)
|
||||
O.unmutate()
|
||||
src << "<span class = 'notice'>Your [O.display_name] is shaped normally again.</span>"
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
|
||||
////////////////////////////////////////////
|
||||
|
||||
//Returns a list of damaged organs
|
||||
@@ -124,6 +128,7 @@
|
||||
var/datum/organ/external/picked = pick(parts)
|
||||
if(picked.heal_damage(brute,burn))
|
||||
UpdateDamageIcon()
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
updatehealth()
|
||||
|
||||
//Damages ONE external organ, organ gets randomly selected from damagable ones.
|
||||
@@ -135,6 +140,7 @@
|
||||
var/datum/organ/external/picked = pick(parts)
|
||||
if(picked.take_damage(brute,burn,sharp))
|
||||
UpdateDamageIcon()
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
updatehealth()
|
||||
|
||||
|
||||
@@ -156,6 +162,7 @@
|
||||
|
||||
parts -= picked
|
||||
updatehealth()
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
if(update) UpdateDamageIcon()
|
||||
|
||||
// damage MANY external organs, in random order
|
||||
@@ -175,6 +182,7 @@
|
||||
|
||||
parts -= picked
|
||||
updatehealth()
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
if(update) UpdateDamageIcon()
|
||||
|
||||
|
||||
@@ -200,6 +208,7 @@ This function restores all organs.
|
||||
if(istype(E, /datum/organ/external))
|
||||
if (E.heal_damage(brute, burn))
|
||||
UpdateDamageIcon()
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
else
|
||||
return 0
|
||||
return
|
||||
@@ -243,6 +252,7 @@ This function restores all organs.
|
||||
|
||||
// Will set our damageoverlay icon to the next level, which will then be set back to the normal level the next mob.Life().
|
||||
updatehealth()
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
|
||||
//Embedded projectile code.
|
||||
if(!organ) return
|
||||
|
||||
@@ -63,6 +63,9 @@
|
||||
in_stasis = istype(loc, /obj/structure/closet/body_bag/cryobag) && loc:opened == 0
|
||||
if(in_stasis) loc:used++
|
||||
|
||||
if(life_tick%30==15)
|
||||
hud_updateflag = 1022
|
||||
|
||||
//No need to update all of these procs if the guy is dead.
|
||||
if(stat != DEAD && !in_stasis)
|
||||
if(air_master.current_cycle%4==2 || failed_last_breath) //First, resolve location and get a breath
|
||||
@@ -1125,6 +1128,10 @@
|
||||
proc/handle_regular_hud_updates()
|
||||
if(!client) return 0
|
||||
|
||||
if(hud_updateflag)
|
||||
handle_hud_list()
|
||||
|
||||
|
||||
for(var/image/hud in client.images)
|
||||
if(copytext(hud.icon_state,1,4) == "hud") //ugly, but icon comparison is worse, I believe
|
||||
client.images.Remove(hud)
|
||||
@@ -1544,6 +1551,148 @@
|
||||
|
||||
return temp
|
||||
|
||||
/*
|
||||
Called by life(), instead of having the individual hud items update icons each tick and check for status changes
|
||||
we only set those statuses and icons upon changes. Then those HUD items will simply add those pre-made images.
|
||||
This proc below is only called when those HUD elements need to change as determined by the mobs hud_updateflag.
|
||||
*/
|
||||
|
||||
|
||||
/mob/living/carbon/human/proc/handle_hud_list()
|
||||
|
||||
if(hud_updateflag & 1 << HEALTH_HUD)
|
||||
var/image/holder = hud_list[HEALTH_HUD]
|
||||
if(stat == 2)
|
||||
holder.icon_state = "hudhealth-100" // X_X
|
||||
else
|
||||
holder.icon_state = "hud[RoundHealth(health)]"
|
||||
|
||||
hud_list[HEALTH_HUD] = holder
|
||||
|
||||
if(hud_updateflag & 1 << STATUS_HUD)
|
||||
var/foundVirus = 0
|
||||
for(var/datum/disease/D in viruses)
|
||||
if(!D.hidden[SCANNER])
|
||||
foundVirus++
|
||||
for (var/ID in virus2)
|
||||
if (ID in virusDB)
|
||||
foundVirus = 1
|
||||
break
|
||||
|
||||
var/image/holder = hud_list[STATUS_HUD]
|
||||
var/image/holder2 = hud_list[STATUS_HUD_OOC]
|
||||
if(stat == 2)
|
||||
holder.icon_state = "huddead"
|
||||
holder2.icon_state = "huddead"
|
||||
else if(status_flags & XENO_HOST)
|
||||
holder.icon_state = "hudxeno"
|
||||
holder2.icon_state = "hudxeno"
|
||||
else if(foundVirus)
|
||||
holder.icon_state = "hudill"
|
||||
else if(has_brain_worms())
|
||||
var/mob/living/simple_animal/borer/B = has_brain_worms()
|
||||
if(B.controlling)
|
||||
holder.icon_state = "hudbrainworm"
|
||||
else
|
||||
holder.icon_state = "hudhealthy"
|
||||
holder2.icon_state = "hudbrainworm"
|
||||
else
|
||||
holder.icon_state = "hudhealthy"
|
||||
if(virus2.len)
|
||||
holder2.icon_state = "hudill"
|
||||
else
|
||||
holder2.icon_state = "hudhealthy"
|
||||
|
||||
hud_list[STATUS_HUD] = holder
|
||||
hud_list[STATUS_HUD_OOC] = holder2
|
||||
|
||||
if(hud_updateflag & 1 << ID_HUD)
|
||||
var/image/holder = hud_list[ID_HUD]
|
||||
if(wear_id)
|
||||
var/obj/item/weapon/card/id/I = wear_id.GetID()
|
||||
if(I)
|
||||
holder.icon_state = "hud[ckey(I.GetJobName())]"
|
||||
else
|
||||
holder.icon_state = "hudunknown"
|
||||
else
|
||||
holder.icon_state = "hudunknown"
|
||||
|
||||
|
||||
hud_list[ID_HUD] = holder
|
||||
|
||||
if(hud_updateflag & 1 << WANTED_HUD)
|
||||
var/image/holder = hud_list[WANTED_HUD]
|
||||
holder.icon_state = "hudblank"
|
||||
var/perpname = name
|
||||
if(wear_id)
|
||||
var/obj/item/weapon/card/id/I = wear_id.GetID()
|
||||
if(I)
|
||||
perpname = I.registered_name
|
||||
|
||||
for(var/datum/data/record/E in data_core.general)
|
||||
if(E.fields["name"] == perpname)
|
||||
for (var/datum/data/record/R in data_core.security)
|
||||
if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "*Arrest*"))
|
||||
holder.icon_state = "hudwanted"
|
||||
break
|
||||
else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Incarcerated"))
|
||||
holder.icon_state = "hudprisoner"
|
||||
break
|
||||
else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Parolled"))
|
||||
holder.icon_state = "hudparolled"
|
||||
break
|
||||
else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Released"))
|
||||
holder.icon_state = "hudreleased"
|
||||
break
|
||||
hud_list[WANTED_HUD] = holder
|
||||
|
||||
if(hud_updateflag & 1 << IMPLOYAL_HUD || hud_updateflag & 1 << IMPCHEM_HUD || hud_updateflag & 1 << IMPTRACK_HUD)
|
||||
var/image/holder1 = hud_list[IMPTRACK_HUD]
|
||||
var/image/holder2 = hud_list[IMPLOYAL_HUD]
|
||||
var/image/holder3 = hud_list[IMPCHEM_HUD]
|
||||
|
||||
holder1.icon_state = "hudblank"
|
||||
holder2.icon_state = "hudblank"
|
||||
holder3.icon_state = "hudblank"
|
||||
|
||||
for(var/obj/item/weapon/implant/I in src)
|
||||
if(I.implanted)
|
||||
if(istype(I,/obj/item/weapon/implant/tracking))
|
||||
holder1.icon_state = "hud_imp_tracking"
|
||||
if(istype(I,/obj/item/weapon/implant/loyalty))
|
||||
holder2.icon_state = "hud_imp_loyal"
|
||||
if(istype(I,/obj/item/weapon/implant/chem))
|
||||
holder3.icon_state = "hud_imp_chem"
|
||||
|
||||
hud_list[IMPTRACK_HUD] = holder1
|
||||
hud_list[IMPLOYAL_HUD] = holder2
|
||||
hud_list[IMPCHEM_HUD] = holder3
|
||||
|
||||
if(hud_updateflag & 1 << SPECIALROLE_HUD)
|
||||
var/image/holder = hud_list[SPECIALROLE_HUD]
|
||||
holder.icon_state = "hudblank"
|
||||
switch(mind.special_role)
|
||||
if("traitor","Syndicate")
|
||||
holder.icon_state = "hudsyndicate"
|
||||
if("Revolutionary")
|
||||
holder.icon_state = "hudrevolutionary"
|
||||
if("Head Revolutionary")
|
||||
holder.icon_state = "hudheadrevolutionary"
|
||||
if("Cultist")
|
||||
holder.icon_state = "hudcultist"
|
||||
if("Changeling")
|
||||
holder.icon_state = "hudchangeling"
|
||||
if("Wizard","Fake Wizard")
|
||||
holder.icon_state = "hudwizard"
|
||||
if("Death Commando")
|
||||
holder.icon_state = "huddeathsquad"
|
||||
if("Ninja")
|
||||
holder.icon_state = "hudninja"
|
||||
|
||||
hud_list[SPECIALROLE_HUD] = holder
|
||||
|
||||
hud_updateflag = 0
|
||||
|
||||
|
||||
#undef HUMAN_MAX_OXYLOSS
|
||||
#undef HUMAN_CRIT_MAX_OXYLOSS
|
||||
|
||||
@@ -516,6 +516,10 @@ proc/get_damage_icon_part(damage_state, body_part)
|
||||
overlays_standing[ID_LAYER] = null
|
||||
else
|
||||
overlays_standing[ID_LAYER] = null
|
||||
|
||||
hud_updateflag |= 1 << ID_HUD
|
||||
hud_updateflag |= 1 << WANTED_HUD
|
||||
|
||||
if(update_icons) update_icons()
|
||||
|
||||
/mob/living/carbon/human/update_inv_gloves(var/update_icons=1)
|
||||
|
||||
@@ -264,6 +264,8 @@
|
||||
if (C.legcuffed && !initial(C.legcuffed))
|
||||
C.drop_from_inventory(C.legcuffed)
|
||||
C.legcuffed = initial(C.legcuffed)
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
hud_updateflag |= 1 << STATUS_HUD
|
||||
|
||||
/mob/living/proc/rejuvenate()
|
||||
|
||||
@@ -310,7 +312,9 @@
|
||||
|
||||
// make the icons look correct
|
||||
regenerate_icons()
|
||||
|
||||
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
hud_updateflag |= 1 << STATUS_HUD
|
||||
return
|
||||
|
||||
/mob/living/proc/UpdateDamageIcon()
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
var/maxHealth = 100 //Maximum health that should be possible.
|
||||
var/health = 100 //A mob's health
|
||||
|
||||
var/hud_updateflag = 0
|
||||
|
||||
//Damage related vars, NOTE: THESE SHOULD ONLY BE MODIFIED BY PROCS
|
||||
var/bruteloss = 0.0 //Brutal damage caused by brute force (punching, being clubbed by a toolbox ect... this also accounts for pressure damage)
|
||||
var/oxyloss = 0.0 //Oxygen depravation damage (no air in lungs)
|
||||
@@ -35,4 +37,4 @@
|
||||
|
||||
var/tod = null // Time of death
|
||||
var/update_slimes = 1
|
||||
var/silent = null //Can't talk. Value goes down every life proc.
|
||||
var/silent = null //Can't talk. Value goes down every life proc.
|
||||
|
||||
@@ -115,6 +115,17 @@ var/list/ai_list = list()
|
||||
src << "<b>These laws may be changed by other players, or by you being the traitor.</b>"
|
||||
|
||||
job = "AI"
|
||||
|
||||
hud_list[HEALTH_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[STATUS_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[ID_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[WANTED_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[IMPLOYAL_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[IMPCHEM_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[IMPTRACK_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[SPECIALROLE_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
|
||||
|
||||
ai_list += src
|
||||
..()
|
||||
return
|
||||
|
||||
@@ -126,6 +126,18 @@
|
||||
var/datum/robot_component/cell_component = components["power cell"]
|
||||
cell_component.wrapped = cell
|
||||
cell_component.installed = 1
|
||||
|
||||
hud_list[HEALTH_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[STATUS_HUD] = image('icons/mob/hud.dmi', src, "hudhealth100")
|
||||
hud_list[ID_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[WANTED_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[IMPLOYAL_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[IMPCHEM_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[IMPTRACK_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[SPECIALROLE_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
|
||||
|
||||
|
||||
|
||||
playsound(loc, 'sound/voice/liveagain.ogg', 75, 1)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
var/list/alarms_to_show = list()
|
||||
var/list/alarms_to_clear = list()
|
||||
immune_to_ssd = 1
|
||||
|
||||
var/list/hud_list[9]
|
||||
var/list/alarm_types_show = list("Motion" = 0, "Fire" = 0, "Atmosphere" = 0, "Power" = 0, "Camera" = 0)
|
||||
var/list/alarm_types_clear = list("Motion" = 0, "Fire" = 0, "Atmosphere" = 0, "Power" = 0, "Camera" = 0)
|
||||
|
||||
@@ -191,4 +191,4 @@
|
||||
dat += data_core.get_manifest(1) // make it monochrome
|
||||
dat += "<br>"
|
||||
src << browse(dat, "window=airoster")
|
||||
onclose(src, "airoster")
|
||||
onclose(src, "airoster")
|
||||
|
||||
@@ -182,6 +182,8 @@
|
||||
"\blue You take [obj] out of incision on [target]'s [affected.display_name]s with \the [tool]." )
|
||||
affected.implants -= obj
|
||||
|
||||
target.hud_updateflag |= 1 << IMPLOYAL_HUD
|
||||
|
||||
//Handle possessive brain borers.
|
||||
if(istype(obj,/mob/living/simple_animal/borer))
|
||||
var/mob/living/simple_animal/borer/worm = obj
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
for(var/datum/disease2/effectholder/e in effects)
|
||||
e.effect.deactivate(mob)
|
||||
mob.virus2.Remove("[uniqueID]")
|
||||
mob.hud_updateflag |= 1 << STATUS_HUD
|
||||
|
||||
/datum/disease2/disease/proc/minormutate()
|
||||
//uniqueID = rand(0,10000)
|
||||
@@ -175,6 +176,7 @@ proc/virus2_lesser_infection()
|
||||
for(var/mob/living/carbon/human/G in player_list)
|
||||
if(G.client && G.stat != DEAD)
|
||||
candidates += G
|
||||
|
||||
if(!candidates.len) return
|
||||
|
||||
candidates = shuffle(candidates)
|
||||
|
||||
@@ -77,6 +77,7 @@ proc/airborne_can_reach(turf/source, turf/target)
|
||||
D.minormutate()
|
||||
// log_debug("Adding virus")
|
||||
M.virus2["[D.uniqueID]"] = D
|
||||
M.hud_updateflag |= 1 << STATUS_HUD
|
||||
|
||||
//Infects mob M with random lesser disease, if he doesn't have one
|
||||
/proc/infect_mob_random_lesser(var/mob/living/carbon/M)
|
||||
@@ -84,12 +85,14 @@ proc/airborne_can_reach(turf/source, turf/target)
|
||||
D.makerandom()
|
||||
D.infectionchance = 1
|
||||
M.virus2["[D.uniqueID]"] = D
|
||||
M.hud_updateflag |= 1 << STATUS_HUD
|
||||
|
||||
//Infects mob M with random greated disease, if he doesn't have one
|
||||
/proc/infect_mob_random_greater(var/mob/living/carbon/M)
|
||||
var/datum/disease2/disease/D = new /datum/disease2/disease
|
||||
D.makerandom(1)
|
||||
M.virus2["[D.uniqueID]"] = D
|
||||
M.hud_updateflag |= 1 << STATUS_HUD
|
||||
|
||||
//Fancy prob() function.
|
||||
/proc/dprob(var/p)
|
||||
@@ -135,4 +138,4 @@ proc/airborne_can_reach(turf/source, turf/target)
|
||||
for (var/ID in victim.virus2)
|
||||
var/datum/disease2/disease/V = victim.virus2[ID]
|
||||
if(V && V.spreadtype != vector) continue
|
||||
infect_virus2(src,V)
|
||||
infect_virus2(src,V)
|
||||
|
||||
+7
-5
@@ -691,13 +691,15 @@ var/list/be_special_flags = list(
|
||||
#define RIGHT 2
|
||||
|
||||
// for secHUDs and medHUDs and variants. The number is the location of the image on the list hud_list of humans.
|
||||
#define HEALTH_HUD 1 // dead, alive, sick, health status
|
||||
#define STATUS_HUD 2 // a simple line rounding the mob's number health
|
||||
#define HEALTH_HUD 1 // a simple line rounding the mob's number health
|
||||
#define STATUS_HUD 2 // alive, dead, diseased, etc.
|
||||
#define ID_HUD 3 // the job asigned to your ID
|
||||
#define WANTED_HUD 4 // wanted, released, parroled, security status
|
||||
#define IMPLOYAL_HUD 5 // loyality implant
|
||||
#define IMPLOYAL_HUD 5 // loyality implant
|
||||
#define IMPCHEM_HUD 6 // chemical implant
|
||||
#define IMPTRACK_HUD 7 // tracking implant
|
||||
#define IMPTRACK_HUD 7 // tracking implant
|
||||
#define SPECIALROLE_HUD 8 // AntagHUD image
|
||||
#define STATUS_HUD_OOC 9 // STATUS_HUD without virus db check for someone being ill.
|
||||
|
||||
//Pulse levels, very simplified
|
||||
#define PULSE_NONE 0 //so !M.pulse checks would be possible
|
||||
@@ -758,4 +760,4 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse
|
||||
#define COLOR_PINK "#FF00FF"
|
||||
#define COLOR_YELLOW "#FFFF00"
|
||||
#define COLOR_ORANGE "#FF9900"
|
||||
#define COLOR_WHITE "#FFFFFF"
|
||||
#define COLOR_WHITE "#FFFFFF"
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Reference in New Issue
Block a user