mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-21 03:55:05 +01:00
Code effeciency project: HUD items rewrite
Before: Every tick each HUD item would recalculate and redo images for every mob in view. For items like the secHUD where we're transversing implants and the various records this gets very expensive. After: Mobs use their hud_list variable to store varius huditem images, when conditions change for those specific huditem images it updates the specific ones on demand. As a backup every 30 ticks or so the mob will update all of their hud_list. Also: moved proc/RoundHealth() from 2 seperate locations into __HELPERS/mobs.dm Conflicts: code/__HELPERS/mobs.dm code/game/objects/items/weapons/implants/implanter.dm code/modules/mob/dead/observer/observer.dm code/modules/mob/living/carbon/human/human_damage.dm code/modules/mob/living/carbon/human/life.dm code/modules/mob/living/living.dm code/modules/mob/living/living_defines.dm code/modules/mob/living/silicon/silicon.dm code/modules/virus2/helpers.dm code/setup.dm icons/mob/hud.dmi
This commit is contained in:
+23
-1
@@ -76,7 +76,6 @@ proc/age2agedescription(age)
|
||||
if(70 to INFINITY) return "elderly"
|
||||
else return "unknown"
|
||||
|
||||
|
||||
/*
|
||||
Proc for attack log creation, because really why not
|
||||
1 argument is the actor
|
||||
@@ -95,3 +94,26 @@ proc/add_logs(mob/target, mob/user, what_done, var/object=null, var/addition=nul
|
||||
if(target.client)
|
||||
if(what_done != ("shaked" || "CPRed" || "grabbed"))
|
||||
message_admins("[user.name][ismob(user) ? "([user.ckey])" : ""] [what_done] [target.name][ismob(target) ? "([target.ckey])" : ""][object ? " with [object]" : " "][addition](<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[target.x];Y=[target.y];Z=[target.z]'>JMP</a>)")
|
||||
|
||||
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
@@ -538,6 +538,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)
|
||||
@@ -578,6 +581,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)
|
||||
@@ -667,6 +672,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)
|
||||
@@ -713,6 +719,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)
|
||||
@@ -739,6 +747,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)
|
||||
@@ -792,6 +801,10 @@ datum/mind
|
||||
|
||||
|
||||
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)
|
||||
@@ -818,7 +831,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)
|
||||
@@ -846,6 +858,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)
|
||||
@@ -925,6 +938,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)
|
||||
|
||||
@@ -133,6 +133,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:"
|
||||
for(var/datum/objective/objective in newtraitor.mind.objectives)
|
||||
|
||||
@@ -202,6 +202,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
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
rev_mind.current << "\red <FONT size = 3> You are now a revolutionary! Help your cause. Do not harm your fellow freedom fighters. You can identify your comrades by the red \"R\" icons, and your leaders by the blue \"R\" icons. Help them kill, capture or convert the heads to win the revolution!</FONT>"
|
||||
rev_mind.special_role = "Revolutionary"
|
||||
update_rev_icons_added(rev_mind)
|
||||
H.hud_updateflag |= 1 << SPECIALROLE_HUD
|
||||
return 1
|
||||
|
||||
/////////////////////////////
|
||||
|
||||
@@ -453,6 +453,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
|
||||
|
||||
|
||||
|
||||
@@ -524,6 +524,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"
|
||||
|
||||
@@ -46,9 +46,11 @@
|
||||
var/datum/organ/external/affected = H.get_organ(user.zone_sel.selecting)
|
||||
affected.implants += src.imp
|
||||
imp.part = affected
|
||||
H.hud_updateflag |= 1 << IMPLOYAL_HUD
|
||||
M:implanting = 0
|
||||
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]
|
||||
|
||||
@@ -94,10 +94,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)
|
||||
@@ -105,94 +106,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
|
||||
|
||||
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/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")
|
||||
if("Vampire")
|
||||
U.client.images += image(tempHud,target,"vampire")
|
||||
if("VampThrall")
|
||||
U.client.images += image(tempHud,target,"vampthrall")
|
||||
else//If we don't know what role they have but they have one.
|
||||
U.client.images += image(tempHud,target,"hudunknown1")
|
||||
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")
|
||||
@@ -200,9 +126,10 @@ 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
|
||||
|
||||
/mob/proc/ghostize(var/flags = GHOST_CAN_REENTER)
|
||||
/mob/proc/ghostize(var/can_reenter_corpse = 1)
|
||||
if(key)
|
||||
var/mob/dead/observer/ghost = new(src, flags) //Transfer safety to observer spawning proc.
|
||||
ghost.timeofdeath = src.timeofdeath //BS12 EDIT
|
||||
|
||||
@@ -5,7 +5,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.
|
||||
|
||||
@@ -83,8 +83,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")
|
||||
|
||||
|
||||
..()
|
||||
|
||||
@@ -633,6 +641,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()
|
||||
|
||||
@@ -48,6 +48,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)
|
||||
@@ -57,6 +58,7 @@
|
||||
take_overall_damage(0, amount)
|
||||
else
|
||||
heal_overall_damage(0, -amount)
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
|
||||
/mob/living/carbon/human/Stun(amount)
|
||||
if(M_HULK in mutations) return
|
||||
@@ -99,6 +101,7 @@
|
||||
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
|
||||
|
||||
////////////////////////////////////////////
|
||||
|
||||
@@ -127,6 +130,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.
|
||||
@@ -138,6 +142,7 @@
|
||||
var/datum/organ/external/picked = pick(parts)
|
||||
if(picked.take_damage(brute,burn,sharp))
|
||||
UpdateDamageIcon()
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
updatehealth()
|
||||
|
||||
|
||||
@@ -159,6 +164,7 @@
|
||||
|
||||
parts -= picked
|
||||
updatehealth()
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
if(update) UpdateDamageIcon()
|
||||
|
||||
// damage MANY external organs, in random order
|
||||
@@ -178,6 +184,7 @@
|
||||
|
||||
parts -= picked
|
||||
updatehealth()
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
if(update) UpdateDamageIcon()
|
||||
|
||||
|
||||
@@ -188,6 +195,7 @@
|
||||
if(istype(E, /datum/organ/external))
|
||||
if (E.heal_damage(brute, burn))
|
||||
UpdateDamageIcon()
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
else
|
||||
return 0
|
||||
return
|
||||
@@ -242,6 +250,7 @@
|
||||
|
||||
// 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
|
||||
|
||||
@@ -76,6 +76,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
|
||||
@@ -1242,6 +1245,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)
|
||||
@@ -1727,5 +1734,152 @@
|
||||
H << "<spawn class='warning'>You smell something foul..."
|
||||
H.vomit()
|
||||
|
||||
/*
|
||||
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"
|
||||
if("Vampire")
|
||||
holder.icon_state = "hudvampire"
|
||||
if("VampThrall")
|
||||
holder.icon_state = "hudvampthrall"
|
||||
|
||||
hud_list[SPECIALROLE_HUD] = holder
|
||||
|
||||
hud_updateflag = 0
|
||||
|
||||
|
||||
#undef HUMAN_MAX_OXYLOSS
|
||||
#undef HUMAN_CRIT_MAX_OXYLOSS
|
||||
|
||||
@@ -565,6 +565,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,var/green=0)
|
||||
|
||||
@@ -284,6 +284,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()
|
||||
|
||||
@@ -321,6 +323,8 @@
|
||||
stat = CONSCIOUS
|
||||
update_fire()
|
||||
regenerate_icons()
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
hud_updateflag |= 1 << STATUS_HUD
|
||||
..()
|
||||
return
|
||||
|
||||
@@ -678,4 +682,4 @@
|
||||
CM << "\blue You successfully remove \the [CM.legcuffed]."
|
||||
CM.drop_from_inventory(CM.legcuffed)
|
||||
CM.legcuffed = null
|
||||
CM.update_inv_legcuffed()
|
||||
CM.update_inv_legcuffed()
|
||||
|
||||
@@ -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)
|
||||
@@ -37,6 +39,6 @@
|
||||
var/update_slimes = 1
|
||||
var/on_fire = 0 //The "Are we on fire?" var
|
||||
var/fire_stacks = 0 //Tracks how many stacks of fire we have on, max is usually 20
|
||||
var/silent = null //Can't talk. Value goes down every life proc.
|
||||
var/specialsauce = 0 //Has this person consumed enough special sauce? IF so they're a ticking time bomb of death.
|
||||
var/implanting = 0 //Used for the mind-slave implant
|
||||
var/implanting = 0 //Used for the mind-slave implant
|
||||
var/silent = null //Can't talk. Value goes down every life proc.
|
||||
|
||||
@@ -125,6 +125,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
|
||||
|
||||
@@ -142,6 +142,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)
|
||||
|
||||
@@ -194,7 +194,6 @@
|
||||
src << browse(dat, "window=airoster")
|
||||
onclose(src, "airoster")
|
||||
|
||||
|
||||
/mob/living/silicon/Bump(atom/movable/AM as mob|obj, yes) //Allows the AI to bump into mobs if it's itself pushed
|
||||
if ((!( yes ) || now_pushing))
|
||||
return
|
||||
@@ -220,3 +219,4 @@
|
||||
step(AM, t)
|
||||
now_pushing = null
|
||||
|
||||
|
||||
|
||||
@@ -184,6 +184,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
|
||||
|
||||
@@ -78,6 +78,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)
|
||||
@@ -180,6 +181,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)
|
||||
|
||||
@@ -74,6 +74,7 @@ proc/airborne_can_reach(turf/source, turf/target, var/radius=5)
|
||||
var/datum/disease2/disease/D = disease.getcopy()
|
||||
D.minormutate()
|
||||
M.virus2["[D.uniqueID]"] = D
|
||||
M.hud_updateflag |= 1 << STATUS_HUD
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@@ -83,12 +84,14 @@ proc/airborne_can_reach(turf/source, turf/target, var/radius=5)
|
||||
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)
|
||||
@@ -134,4 +137,4 @@ proc/airborne_can_reach(turf/source, turf/target, var/radius=5)
|
||||
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)
|
||||
|
||||
+17
-4
@@ -732,13 +732,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
|
||||
@@ -829,3 +831,14 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse
|
||||
#define CENTCOMM_Z 2
|
||||
#define TELECOMM_Z 3
|
||||
#define ASTEROID_Z 5
|
||||
|
||||
//some colors
|
||||
#define COLOR_RED "#FF0000"
|
||||
#define COLOR_GREEN "#00FF00"
|
||||
#define COLOR_BLUE "#0000FF"
|
||||
#define COLOR_CYAN "#00FFFF"
|
||||
#define COLOR_PINK "#FF00FF"
|
||||
#define COLOR_YELLOW "#FFFF00"
|
||||
#define COLOR_ORANGE "#FF9900"
|
||||
#define COLOR_WHITE "#FFFFFF"
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Reference in New Issue
Block a user