diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index 4d8eca375e8..19e1562b183 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -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](JMP)") + +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" + diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 49fbe74f658..bc81913a56e 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -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) diff --git a/code/game/gamemodes/autotraitor/autotraitor.dm b/code/game/gamemodes/autotraitor/autotraitor.dm index aeb313eed02..70105d2264d 100644 --- a/code/game/gamemodes/autotraitor/autotraitor.dm +++ b/code/game/gamemodes/autotraitor/autotraitor.dm @@ -133,6 +133,7 @@ newtraitor << "\red ATTENTION: \black It is time to pay your debt to the Syndicate..." newtraitor << "You are now a traitor." 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) diff --git a/code/game/gamemodes/revolution/revolution.dm b/code/game/gamemodes/revolution/revolution.dm index b4660241c46..12e851d064e 100644 --- a/code/game/gamemodes/revolution/revolution.dm +++ b/code/game/gamemodes/revolution/revolution.dm @@ -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 The frame's firmware detects and deletes your neural reprogramming! You remember nothing from the moment you were flashed until now." diff --git a/code/game/gamemodes/revolution/rp-revolution.dm b/code/game/gamemodes/revolution/rp-revolution.dm index 7456e73403b..963579af7c8 100644 --- a/code/game/gamemodes/revolution/rp-revolution.dm +++ b/code/game/gamemodes/revolution/rp-revolution.dm @@ -304,4 +304,4 @@ mob/living/carbon/human/proc else if(choice == "No!") M << "\red You reject this traitorous cause!" src << "\red [M] does not support the revolution!" - M.mind.rev_cooldown = world.time+50 \ No newline at end of file + M.mind.rev_cooldown = world.time+50 diff --git a/code/game/gamemodes/revolution/rp_revolution.dm b/code/game/gamemodes/revolution/rp_revolution.dm index 7deb03fd690..522cc2cf701 100644 --- a/code/game/gamemodes/revolution/rp_revolution.dm +++ b/code/game/gamemodes/revolution/rp_revolution.dm @@ -110,6 +110,7 @@ rev_mind.current << "\red 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!" rev_mind.special_role = "Revolutionary" update_rev_icons_added(rev_mind) + H.hud_updateflag |= 1 << SPECIALROLE_HUD return 1 ///////////////////////////// diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index 843f1108c9f..0814dba74e6 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -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 diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 35bbaad864b..593edaf1365 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -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" diff --git a/code/game/objects/items/weapons/implants/implanter.dm b/code/game/objects/items/weapons/implants/implanter.dm index 330a6cf7533..ff4cb1050cd 100644 --- a/code/game/objects/items/weapons/implants/implanter.dm +++ b/code/game/objects/items/weapons/implants/implanter.dm @@ -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 diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm index aedb20c70d6..f541c837e6a 100644 --- a/code/modules/clothing/glasses/hud.dm +++ b/code/modules/clothing/glasses/hud.dm @@ -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 \ No newline at end of file + 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] diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 896417b9e02..2144e5e61e8 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -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 diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index ce6de05135c..9315c8bfbf7 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -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() diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index 20d390b1ba8..8cdb3c82872 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -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 << "Your [O.display_name] is shaped normally again." + 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 diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 4fe415baffd..9e3f693aec9 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -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 << "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 diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 1ed6cf7385f..c4f2bb399cf 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -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) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index e22fb6b8d5f..a8d8608924e 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -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() \ No newline at end of file + CM.update_inv_legcuffed() diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 16449e8719e..26758a41d96 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -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 \ No newline at end of file + var/implanting = 0 //Used for the mind-slave implant + var/silent = null //Can't talk. Value goes down every life proc. diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 9de9627b2b1..6c7683396ec 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -125,6 +125,17 @@ var/list/ai_list = list() src << "These laws may be changed by other players, or by you being the traitor." 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 diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 3140e5b0065..98173429f06 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -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) diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 479a0a60d40..d0ff49d0a50 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -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 + diff --git a/code/modules/surgery/implant.dm b/code/modules/surgery/implant.dm index 32179bfa131..5408cbea2c5 100644 --- a/code/modules/surgery/implant.dm +++ b/code/modules/surgery/implant.dm @@ -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 diff --git a/code/modules/virus2/disease2.dm b/code/modules/virus2/disease2.dm index 5d74642dc64..237e6d5f990 100644 --- a/code/modules/virus2/disease2.dm +++ b/code/modules/virus2/disease2.dm @@ -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) diff --git a/code/modules/virus2/helpers.dm b/code/modules/virus2/helpers.dm index 5caaed9df2c..a732c8d542f 100644 --- a/code/modules/virus2/helpers.dm +++ b/code/modules/virus2/helpers.dm @@ -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) \ No newline at end of file + infect_virus2(src,V) diff --git a/code/setup.dm b/code/setup.dm index db2f9ee382f..44384aba264 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -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" + diff --git a/icons/mob/hud.dmi b/icons/mob/hud.dmi index b815945b642..ffef4bf299c 100644 Binary files a/icons/mob/hud.dmi and b/icons/mob/hud.dmi differ