diff --git a/code/__DEFINES/hud.dm b/code/__DEFINES/hud.dm new file mode 100644 index 00000000000..8842b23e433 --- /dev/null +++ b/code/__DEFINES/hud.dm @@ -0,0 +1,26 @@ +// for secHUDs and medHUDs and variants. The number is the location of the image on the list hud_list +// note: if you add more HUDs, even for non-human atoms, make sure to use unique numbers for the defines! +// /datum/atom_hud expects these to be unique +// these need to be strings in order to make them associative lists +#define HEALTH_HUD "1" // dead, alive, sick, health status +#define STATUS_HUD "2" // a simple line rounding the mob's number health +#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 IMPCHEM_HUD "6" // chemical implant +#define IMPTRACK_HUD "7" // tracking implant +//for antag huds. these are used at the /mob level +#define ANTAG_HUD "8" + +//data HUD (medhud, sechud) defines +//Don't forget to update human/New() if you change these! +#define DATA_HUD_SECURITY_BASIC 1 +#define DATA_HUD_SECURITY_ADVANCED 2 +#define DATA_HUD_MEDICAL_BASIC 3 +#define DATA_HUD_MEDICAL_ADVANCED 4 +//antag HUD defines +#define ANTAG_HUD_CULT 5 +#define ANTAG_HUD_REV 6 +#define ANTAG_HUD_OPS 7 +#define ANTAG_HUD_GANG_A 8 +#define ANTAG_HUD_GANG_B 9 diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 2991fe66569..4af1675b4e7 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -50,4 +50,4 @@ #define STAGE_TWO 3 #define STAGE_THREE 5 #define STAGE_FOUR 7 -#define STAGE_FIVE 9 \ No newline at end of file +#define STAGE_FIVE 9 diff --git a/code/__DEFINES/sight.dm b/code/__DEFINES/sight.dm index 6d8865816df..40c56793bac 100644 --- a/code/__DEFINES/sight.dm +++ b/code/__DEFINES/sight.dm @@ -21,12 +21,3 @@ #define BORGMESON 1 #define BORGTHERM 2 #define BORGXRAY 4 - -// 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 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 IMPCHEM_HUD 6 // chemical implant -#define IMPTRACK_HUD 7 // tracking implant diff --git a/code/_globalvars/lists/objects.dm b/code/_globalvars/lists/objects.dm index e50f6555116..f1a89798a86 100644 --- a/code/_globalvars/lists/objects.dm +++ b/code/_globalvars/lists/objects.dm @@ -14,5 +14,3 @@ var/global/list/chemical_reactions_list //list of all /datum/chemical_reactio var/global/list/chemical_reagents_list //list of all /datum/reagent datums indexed by reagent id. Used by chemistry stuff var/global/list/surgeries_list = list() //list of all surgeries by name, associated with their path. var/global/list/table_recipes = list() //list of all table craft recipes -var/global/list/med_hud_users = list() //list of all entities using a medical HUD. -var/global/list/sec_hud_users = list() //list of all entities using a security HUD. \ No newline at end of file diff --git a/code/datums/diseases/_MobProcs.dm b/code/datums/diseases/_MobProcs.dm index ea29f9b80d8..aae3b1d65e8 100644 --- a/code/datums/diseases/_MobProcs.dm +++ b/code/datums/diseases/_MobProcs.dm @@ -37,8 +37,11 @@ DD.affected_mob = src DD.holder = src if(DD.disease_flags & CAN_CARRY && prob(5)) - DD.carrier++ + DD.carrier = 1 +/mob/living/carbon/human/AddDisease(var/datum/disease/D) + ..() + med_hud_set_status() /mob/living/carbon/ContractDisease(var/datum/disease/D) if(!CanContractDisease(D)) @@ -122,4 +125,4 @@ /mob/proc/ForceContractDisease(var/datum/disease/D) if(!CanContractDisease(D)) return 0 - AddDisease(D) \ No newline at end of file + AddDisease(D) diff --git a/code/datums/diseases/_disease.dm b/code/datums/diseases/_disease.dm index 4baa4b20969..5ef05a315c8 100644 --- a/code/datums/diseases/_disease.dm +++ b/code/datums/diseases/_disease.dm @@ -152,7 +152,7 @@ var/list/diseases = typesof(/datum/disease) - /datum/disease if(disease_flags & CAN_RESIST) if(!(type in affected_mob.resistances)) affected_mob.resistances += type - affected_mob.viruses -= src + remove_virus() del(src) @@ -192,3 +192,10 @@ var/list/diseases = typesof(/datum/disease) - /datum/disease if(spread_flags & CONTACT_FEET || spread_flags & CONTACT_HANDS || spread_flags & CONTACT_GENERAL) return 1 return 0 + +//don't use this proc directly. this should only ever be called by cure() +/datum/disease/proc/remove_virus() + affected_mob.viruses -= src //remove the datum from the list + if(istype(affected_mob, /mob/living/carbon/human)) + var/mob/living/carbon/human/H = affected_mob + H.med_hud_set_status() diff --git a/code/datums/diseases/advance/advance.dm b/code/datums/diseases/advance/advance.dm index d3b859ba89b..714844f30eb 100644 --- a/code/datums/diseases/advance/advance.dm +++ b/code/datums/diseases/advance/advance.dm @@ -106,7 +106,7 @@ var/list/advance_cures = list( var/id = "[GetDiseaseID()]" if(resistance && !(id in affected_mob.resistances)) affected_mob.resistances[id] = id - affected_mob.viruses -= src //remove the datum from the list + remove_virus() del(src) //delete the datum to stop it processing // Returns the advance disease with a different reference memory. diff --git a/code/datums/hud.dm b/code/datums/hud.dm new file mode 100644 index 00000000000..4a57ca08417 --- /dev/null +++ b/code/datums/hud.dm @@ -0,0 +1,72 @@ +/* HUD DATUMS */ + +//GLOBAL HUD LIST +var/datum/atom_hud/huds = list( \ + DATA_HUD_SECURITY_BASIC = new/datum/atom_hud/data/security/basic(), \ + DATA_HUD_SECURITY_ADVANCED = new/datum/atom_hud/data/security/advanced(), \ + DATA_HUD_MEDICAL_BASIC = new/datum/atom_hud/data/medical/basic(), \ + DATA_HUD_MEDICAL_ADVANCED = new/datum/atom_hud/data/medical/advanced(), \ + ANTAG_HUD_CULT = new/datum/atom_hud/antag(), \ + ANTAG_HUD_REV = new/datum/atom_hud/antag(), \ + ANTAG_HUD_OPS = new/datum/atom_hud/antag(), \ + ANTAG_HUD_GANG_A = new/datum/atom_hud/antag(), \ + ANTAG_HUD_GANG_B = new/datum/atom_hud/antag(), \ + ) + +/mob/proc/refresh_huds(var/mob/inherited_from = null) + var/mob/seek_for = (inherited_from) ? inherited_from : src + var/image/oldantagicon = seek_for.hud_list[ANTAG_HUD] + var/image/newantagicon = hud_list[ANTAG_HUD] + if(oldantagicon && oldantagicon.icon_state) + newantagicon.icon_state = oldantagicon.icon_state + if(istype(inherited_from, /mob/dead/observer)) + var/mob/dead/observer/G = inherited_from + for(var/datum/atom_hud/hud in G.oldhuds) + readd_hud(hud) + else + for(var/datum/atom_hud/hud in huds) + if(seek_for in hud.hudusers) + readd_hud(hud) + +/mob/proc/readd_hud(var/datum/atom_hud/hud) + hud.add_hud_to(src) + +/mob/dead/observer/readd_hud(var/datum/atom_hud/hud) + oldhuds |= hud + +/datum/atom_hud + var/list/atom/hudatoms = list() //list of all atoms which display this hud + var/list/mob/hudusers = list() //list with all mobs who can see the hud + var/list/hud_icons = list() //these will be the indexes for the atom's hud_list + +/datum/atom_hud/proc/remove_hud_from(var/mob/M) + for(var/atom/A in hudatoms) + remove_from_single_hud(M, A) + hudusers -= M + +/datum/atom_hud/proc/remove_from_hud(var/atom/A) + for(var/mob/M in hudusers) + remove_from_single_hud(M, A) + hudatoms -= A + +/datum/atom_hud/proc/remove_from_single_hud(var/mob/M, var/atom/A) //unsafe, no sanity apart from client + if(!M.client) + return + for(var/i in hud_icons) + M.client.images -= A.hud_list[i] + +/datum/atom_hud/proc/add_hud_to(var/mob/M) + hudusers |= M + for(var/atom/A in hudatoms) + add_to_single_hud(M, A) + +/datum/atom_hud/proc/add_to_hud(var/atom/A) + hudatoms |= A + for(var/mob/M in hudusers) + add_to_single_hud(M, A) + +/datum/atom_hud/proc/add_to_single_hud(var/mob/M, var/atom/A) //unsafe, no sanity apart from client + if(!M.client) + return + for(var/i in hud_icons) + M.client.images |= A.hud_list[i] diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 914c80fe622..51e2fa251f7 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -75,6 +75,7 @@ if(new_character.mind) //disassociate any mind currently in our new body's mind variable new_character.mind.current = null + new_character.refresh_huds(current) //inherit the HUDs from the old body current = new_character //associate ourself with our new body new_character.mind = src //and associate our new body with ourself diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 2f1b1f6e074..7a712a2001a 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -12,6 +12,11 @@ ///Chemistry. var/datum/reagents/reagents = null + //This atom's HUD (med/sec, etc) images. Associative list. + var/list/image/hud_list = list() + //HUD images that this atom can provide. + var/list/hud_possible + //var/chem_is_open_container = 0 // replaced by OPENCONTAINER flags and atom/proc/is_open_container() ///Chemistry. diff --git a/code/game/data_huds.dm b/code/game/data_huds.dm index 603170f6dd0..19b37ee8d30 100644 --- a/code/game/data_huds.dm +++ b/code/game/data_huds.dm @@ -1,21 +1,70 @@ -/* Using the HUD procs is simple. Call these procs in the life.dm of the intended mob. -Use the regular_hud_updates() proc before process_med_hud(mob) or process_sec_hud(mob) so -the HUD updates properly! */ +/* + * Data HUDs have been rewritten in a more generic way. + * In short, they now use an observer-listener pattern. + * See code/datum/hud.dm for the generic hud datum. + * Update the HUD icons when needed with the appropriate hook. (see below) + */ -//Deletes the current HUD images so they can be refreshed with new ones. -mob/proc/regular_hud_updates() //Used in the life.dm of mobs that can use HUDs. - if(client) - for(var/image/hud in client.images) - if(copytext(hud.icon_state,1,4) == "hud") - client.images -= hud - med_hud_users -= src - sec_hud_users -= src +/* DATA HUD DATUMS */ +/atom/proc/add_to_all_data_huds() + for(var/datum/atom_hud/data/hud in huds) hud.add_to_hud(src) -//Medical HUD procs +/atom/proc/remove_from_all_data_huds() + for(var/datum/atom_hud/data/hud in huds) hud.remove_from_hud(src) -proc/RoundHealth(health) +/datum/atom_hud/data +/datum/atom_hud/data/medical + hud_icons = list(HEALTH_HUD, STATUS_HUD) + +/datum/atom_hud/data/medical/basic + +/datum/atom_hud/data/medical/basic/proc/check_sensors(var/mob/living/carbon/human/H) + if(!istype(H)) return 0 + var/obj/item/clothing/under/U = H.w_uniform + if(!istype(U)) return 0 + if(U.sensor_mode <= 2) return 0 + return 1 + +/datum/atom_hud/data/medical/basic/add_to_single_hud(var/mob/M, var/mob/living/carbon/human/H) + if(check_sensors(H)) + ..() + +/datum/atom_hud/data/medical/basic/proc/update_suit_sensors(var/mob/living/carbon/human/H) + check_sensors(H) ? add_to_hud(H) : remove_from_hud(H) + +/datum/atom_hud/data/medical/advanced + +/datum/atom_hud/data/security + +/datum/atom_hud/data/security/basic + hud_icons = list(ID_HUD) + +/datum/atom_hud/data/security/advanced + hud_icons = list(ID_HUD, IMPTRACK_HUD, IMPLOYAL_HUD, IMPCHEM_HUD, WANTED_HUD) + +/* MED/SEC HUD HOOKS */ + +/* + * THESE HOOKS SHOULD BE CALLED BY THE MOB SHOWING THE HUD + */ + +/*********************************************** + Medical HUD! Basic mode needs suit sensors on. +************************************************/ + +//HELPERS + +//called when a human changes virus +/mob/living/carbon/human/proc/check_virus() + for(var/datum/disease/D in viruses) + if((!(D.visibility_flags & HIDDEN_SCANNER)) && (D.severity != NONTHREAT)) + return 1 + return 0 + +//helper for getting the appropriate health status +/proc/RoundHealth(health) switch(health) if(100 to INFINITY) return "health100" @@ -37,146 +86,74 @@ proc/RoundHealth(health) return "health-100" return "0" -/*Called by the Life() proc of the mob using it, usually. Items can call it as well. -Called with this syntax: (The user mob, the type of hud in use, the advanced or basic version of the hud,eye object in the case of an AI) */ +//HOOKS -proc/process_data_hud(var/mob/M, var/hud_type, var/hud_mode, var/mob/eye) - #define DATA_HUD_MEDICAL 1 - #define DATA_HUD_SECURITY 2 +//called when a human changes suit sensors +/mob/living/carbon/human/proc/update_suit_sensors() + var/datum/atom_hud/data/medical/basic/B = huds[DATA_HUD_MEDICAL_BASIC] + B.update_suit_sensors(src) - #define DATA_HUD_BASIC 1 - #define DATA_HUD_ADVANCED 2 - - if(!M) - return - if(!M.client) - return - - var/turf/T - if(eye) - T = get_turf(eye) - else - T = get_turf(M) - - - for(var/mob/living/carbon/human/H in mob_list) - if(get_dist(H, T) > M.client.view) //Ignores any humans outside of the user's view distance. - continue - - switch(hud_type) - if(DATA_HUD_MEDICAL) - med_hud_users |= M - process_med_hud(M,hud_mode,T,H) - - if(DATA_HUD_SECURITY) - sec_hud_users |= M //Used for Security HUD alerts. - process_sec_hud(M,hud_mode,T,H) - -/*********************************************** -Medical HUD outputs! Advanced mode ignores suit sensors. -************************************************/ -proc/process_med_hud(var/mob/M, var/mode, var/turf/T, var/mob/living/carbon/human/patient) - - var/client/C = M.client - - if(mode == DATA_HUD_BASIC && !med_hud_suit_sensors(patient)) //Used for the AI's MedHUD, only works if the patient has activated suit sensors. - return - - - var/foundVirus = med_hud_find_virus(patient) //Detects non-hidden diseases in a patient, returns as a binary value. - - C.images += med_hud_get_health(patient) //Generates a patient's health bar. - C.images += med_hud_get_status(patient, foundVirus) //Determines the type of status icon to show. - - -proc/med_hud_suit_sensors(var/mob/living/carbon/human/patient) - if(istype(patient.w_uniform, /obj/item/clothing/under)) - var/obj/item/clothing/under/U = patient.w_uniform - if(U.sensor_mode > 2) - return 1 - else - return 0 - -proc/med_hud_find_virus(var/mob/living/carbon/human/patient) - for(var/datum/disease/D in patient.viruses) - if(!(D.visibility_flags & HIDDEN_SCANNER)) - if(D.severity != NONTHREAT) - return 1 - -proc/med_hud_get_health(var/mob/living/carbon/human/patient) - var/image/holder = patient.hud_list[HEALTH_HUD] - if(patient.stat == 2) +//called when a human changes health +/mob/living/carbon/human/proc/med_hud_set_health() + var/image/holder = hud_list[HEALTH_HUD] + if(stat == 2) holder.icon_state = "hudhealth-100" else - holder.icon_state = "hud[RoundHealth(patient.health)]" - return holder + holder.icon_state = "hud[RoundHealth(health)]" -proc/med_hud_get_status(var/mob/living/carbon/human/patient, var/foundVirus) - var/image/holder = patient.hud_list[STATUS_HUD] - if(patient.stat == 2) +//called when a human changes stat, virus or XENO_HOST +/mob/living/carbon/human/proc/med_hud_set_status() + var/image/holder = hud_list[STATUS_HUD] + if(stat == 2) holder.icon_state = "huddead" - else if(patient.status_flags & XENO_HOST) + else if(status_flags & XENO_HOST) holder.icon_state = "hudxeno" - else if(foundVirus) + else if(check_virus()) holder.icon_state = "hudill" else holder.icon_state = "hudhealthy" - return holder /*********************************************** - Security HUDs. - Pass a value for the second argument to enable implant viewing or other special features. + Security HUDs! Basic mode shows only the job. ************************************************/ -proc/process_sec_hud(var/mob/M, var/mode, var/turf/T, var/mob/living/carbon/human/perp) - var/client/C = M.client +//HOOKS - sec_hud_get_ID(C, perp) //Provides the perp's job icon. - - if(mode == DATA_HUD_ADVANCED) //If not set to "DATA_HUD_ADVANCED, the Sec HUD will only display the job. - sec_hud_get_implants(C, perp) //Returns the perp's implants, if any. - sec_hud_get_security_status(C, perp) //Gives the perp's arrest record, if there is one. - - -proc/sec_hud_get_ID(var/client/C, var/mob/living/carbon/human/perp) - var/image/holder - holder = perp.hud_list[ID_HUD] +/mob/living/carbon/human/proc/sec_hud_set_ID() + var/image/holder = hud_list[ID_HUD] holder.icon_state = "hudno_id" - if(perp.wear_id) - holder.icon_state = "hud[ckey(perp.wear_id.GetJobName())]" - C.images += holder + if(wear_id) + holder.icon_state = "hud[ckey(wear_id.GetJobName())]" -proc/sec_hud_get_implants(var/client/C, var/mob/living/carbon/human/perp) +/mob/living/carbon/human/proc/sec_hud_set_implants() var/image/holder - for(var/obj/item/weapon/implant/I in perp) + for(var/i in list(IMPTRACK_HUD, IMPLOYAL_HUD, IMPCHEM_HUD)) + holder = hud_list[i] + holder.icon_state = null + for(var/obj/item/weapon/implant/I in src) if(I.implanted) if(istype(I,/obj/item/weapon/implant/tracking)) - holder = perp.hud_list[IMPTRACK_HUD] + holder = hud_list[IMPTRACK_HUD] holder.icon_state = "hud_imp_tracking" else if(istype(I,/obj/item/weapon/implant/loyalty)) - holder = perp.hud_list[IMPLOYAL_HUD] + holder = hud_list[IMPLOYAL_HUD] holder.icon_state = "hud_imp_loyal" else if(istype(I,/obj/item/weapon/implant/chem)) - holder = perp.hud_list[IMPCHEM_HUD] + holder = hud_list[IMPCHEM_HUD] holder.icon_state = "hud_imp_chem" - else - continue - C.images += holder - break -proc/sec_hud_get_security_status(var/client/C, var/mob/living/carbon/human/perp) +/mob/living/carbon/human/proc/sec_hud_set_security_status() var/image/holder - var/perpname = perp.get_face_name(perp.get_id_name("")) + var/perpname = get_face_name(get_id_name("")) if(perpname) var/datum/data/record/R = find_record("name", perpname, data_core.security) if(R) - holder = perp.hud_list[WANTED_HUD] + holder = hud_list[WANTED_HUD] switch(R.fields["criminal"]) if("*Arrest*") holder.icon_state = "hudwanted" if("Incarcerated") holder.icon_state = "hudincarcerated" if("Parolled") holder.icon_state = "hudparolled" - if("Discharged") holder.icon_state = "huddischarged" - else - return - C.images += holder \ No newline at end of file + if("Discharged") holder.icon_state = "huddischarged" + else holder.icon_state = null + diff --git a/code/game/gamemodes/antag_hud.dm b/code/game/gamemodes/antag_hud.dm new file mode 100644 index 00000000000..62a4f23b976 --- /dev/null +++ b/code/game/gamemodes/antag_hud.dm @@ -0,0 +1,14 @@ +/datum/atom_hud/antag + hud_icons = list(ANTAG_HUD) + +/datum/atom_hud/antag/proc/join_hud(var/mob/M) + add_to_hud(M) + add_hud_to(M) + +/datum/atom_hud/antag/proc/leave_hud(var/mob/M) + remove_from_hud(M) + remove_hud_from(M) + +/datum/game_mode/proc/set_antag_hud(var/mob/M, var/new_icon_state) + var/image/holder = M.hud_list[ANTAG_HUD] + holder.icon_state = new_icon_state diff --git a/code/game/gamemodes/changeling/powers/revive.dm b/code/game/gamemodes/changeling/powers/revive.dm index 36842d319c5..71aab2d901d 100644 --- a/code/game/gamemodes/changeling/powers/revive.dm +++ b/code/game/gamemodes/changeling/powers/revive.dm @@ -25,5 +25,9 @@ user.status_flags &= ~(FAKEDEATH) user.update_canmove() user.mind.changeling.purchasedpowers -= src + if(istype(user, /mob/living/carbon/human)) + var/mob/living/carbon/human/H = user + H.med_hud_set_status() + H.med_hud_set_health() feedback_add_details("changeling_powers","CR") - return 1 \ No newline at end of file + return 1 diff --git a/code/game/gamemodes/cult/cult.dm b/code/game/gamemodes/cult/cult.dm index eb67ca4895d..a8394f6235f 100644 --- a/code/game/gamemodes/cult/cult.dm +++ b/code/game/gamemodes/cult/cult.dm @@ -241,52 +241,15 @@ for(var/mob/M in viewers(cult_mind.current)) M << "[cult_mind.current] looks like they just reverted to their old faith!" -/datum/game_mode/proc/update_all_cult_icons() - spawn(0) - for(var/datum/mind/cultist in cult) - if(cultist.current) - if(cultist.current.client) - for(var/image/I in cultist.current.client.images) - if(I.icon_state == "cult") - del(I) - - for(var/datum/mind/cultist in cult) - if(cultist.current) - if(cultist.current.client) - for(var/datum/mind/cultist_1 in cult) - if(cultist_1.current) - var/I = image('icons/mob/mob.dmi', loc = cultist_1.current, icon_state = "cult") - cultist.current.client.images += I - - /datum/game_mode/proc/update_cult_icons_added(datum/mind/cult_mind) - spawn(0) - for(var/datum/mind/cultist in cult) - if(cultist.current) - if(cultist.current.client) - var/I = image('icons/mob/mob.dmi', loc = cult_mind.current, icon_state = "cult") - cultist.current.client.images += I - if(cult_mind.current) - if(cult_mind.current.client) - var/image/J = image('icons/mob/mob.dmi', loc = cultist.current, icon_state = "cult") - cult_mind.current.client.images += J - + var/datum/atom_hud/antag/culthud = huds[ANTAG_HUD_CULT] + culthud.join_hud(cult_mind.current) + set_antag_hud(cult_mind.current, "cult") /datum/game_mode/proc/update_cult_icons_removed(datum/mind/cult_mind) - spawn(0) - for(var/datum/mind/cultist in cult) - if(cultist.current) - if(cultist.current.client) - for(var/image/I in cultist.current.client.images) - if(I.icon_state == "cult" && I.loc == cult_mind.current) - del(I) - - if(cult_mind.current) - if(cult_mind.current.client) - for(var/image/I in cult_mind.current.client.images) - if(I.icon_state == "cult") - del(I) - + var/datum/atom_hud/antag/culthud = huds[ANTAG_HUD_CULT] + culthud.leave_hud(cult_mind.current) + set_antag_hud(cult_mind.current, null) /datum/game_mode/cult/proc/get_unconvertables() var/list/ucs = list() diff --git a/code/game/gamemodes/gang/gang.dm b/code/game/gamemodes/gang/gang.dm index 9a4374959f7..718f9ad8d65 100644 --- a/code/game/gamemodes/gang/gang.dm +++ b/code/game/gamemodes/gang/gang.dm @@ -233,127 +233,41 @@ gangster_mind.current.visible_message("[gangster_mind.current] looks like they've given up the life of crime!") gangster_mind.current << "You have been reformed! You are no longer a gangster!" - update_gang_icons_removed(gangster_mind) + update_gang_icons_removed(gangster_mind, gang) +/////////////////////// +//Add/remove gang HUD// +/////////////////////// +/datum/game_mode/proc/get_gang_hud(var/gang) + var/datum/atom_hud/antag/ganghud = null + switch(gang) + if("A") ganghud = huds[ANTAG_HUD_GANG_A] + if("B") ganghud = huds[ANTAG_HUD_GANG_B] + return ganghud -///////////////////////////////////////////////////////////////////////////////////////////////// -//Keeps track of players having the correct icons//////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////// -/datum/game_mode/proc/update_all_gang_icons() - spawn(0) - var/list/all_gangsters = A_bosses + B_bosses + A_gangsters + B_gangsters +/datum/game_mode/proc/get_gang_bosses(var/gang) + var/bosses = null + switch(gang) + if("A") bosses = A_bosses + if("B") bosses = B_bosses + return bosses - //Delete all gang icons - for(var/datum/mind/gang_mind in all_gangsters) - if(gang_mind.current) - if(gang_mind.current.client) - for(var/image/I in gang_mind.current.client.images) - if(I.icon_state == "gangster" || I.icon_state == "gang_boss") - del(I) - - update_gang_icons("A") - update_gang_icons("B") - -/datum/game_mode/proc/update_gang_icons(var/gang) - var/list/bosses - var/list/gangsters - if(gang == "A") - bosses = A_bosses - gangsters = A_gangsters - else if(gang == "B") - bosses = B_bosses - gangsters = B_gangsters - else - world << "ERROR: Invalid gang in update_gang_icons()" - - //Update gang icons for boss' visions - for(var/datum/mind/boss_mind in bosses) - if(boss_mind.current) - if(boss_mind.current.client) - for(var/datum/mind/gangster_mind in gangsters) - if(gangster_mind.current) - var/I = image('icons/mob/mob.dmi', loc = gangster_mind.current, icon_state = "gangster") - boss_mind.current.client.images += I - for(var/datum/mind/boss2_mind in bosses) - if(boss2_mind.current) - var/I = image('icons/mob/mob.dmi', loc = boss2_mind.current, icon_state = "gang_boss") - boss_mind.current.client.images += I - - //Update boss and self icons for gangsters' visions - for(var/datum/mind/gangster_mind in gangsters) - if(gangster_mind.current) - if(gangster_mind.current.client) - for(var/datum/mind/boss_mind in bosses) - if(boss_mind.current) - var/I = image('icons/mob/mob.dmi', loc = boss_mind.current, icon_state = "gang_boss") - gangster_mind.current.client.images += I - //Tag themselves to see - var/K - if(gangster_mind in bosses) //If the new gangster is a boss himself - K = image('icons/mob/mob.dmi', loc = gangster_mind.current, icon_state = "gang_boss") - else - K = image('icons/mob/mob.dmi', loc = gangster_mind.current, icon_state = "gangster") - gangster_mind.current.client.images += K - -///////////////////////////////////////////////// -//Assigns icons when a new gangster is recruited// -///////////////////////////////////////////////// /datum/game_mode/proc/update_gang_icons_added(datum/mind/recruit_mind, var/gang) - var/list/bosses - if(gang == "A") - bosses = A_bosses - else if(gang == "B") - bosses = B_bosses - if(!gang) - world << "ERROR: Invalid gang in update_gang_icons_added()" + var/datum/atom_hud/antag/ganghud = get_gang_hud(gang) + var/bosses = get_gang_bosses(gang) + if(!ganghud) + ERROR("Invalid gang in update_gang_icons_added(): [gang]") - spawn(0) - for(var/datum/mind/boss_mind in bosses) - //Tagging the new gangster for the bosses to see - if(boss_mind.current) - if(boss_mind.current.client) - var/I - if(recruit_mind in bosses) //If the new gangster is a boss himself - I = image('icons/mob/mob.dmi', loc = recruit_mind.current, icon_state = "gang_boss") - else - I = image('icons/mob/mob.dmi', loc = recruit_mind.current, icon_state = "gangster") - boss_mind.current.client.images += I - //Tagging every boss for the new gangster to see - if(recruit_mind.current) - if(recruit_mind.current.client) - var/image/J = image('icons/mob/mob.dmi', loc = boss_mind.current, icon_state = "gang_boss") - recruit_mind.current.client.images += J - //Tag themselves to see - if(recruit_mind.current) - if(recruit_mind.current.client) - var/K - if(recruit_mind in bosses) //If the new gangster is a boss himself - K = image('icons/mob/mob.dmi', loc = recruit_mind.current, icon_state = "gang_boss") - else - K = image('icons/mob/mob.dmi', loc = recruit_mind.current, icon_state = "gangster") - recruit_mind.current.client.images += K + ganghud.join_hud(recruit_mind.current) + set_antag_hud(recruit_mind.current, ((recruit_mind in bosses) ? "gang_boss" : "gangster")) -//////////////////////////////////////// -//Keeps track of deconverted gangsters// -//////////////////////////////////////// -/datum/game_mode/proc/update_gang_icons_removed(datum/mind/defector_mind) - var/list/all_gangsters = A_bosses + B_bosses + A_gangsters + B_gangsters +/datum/game_mode/proc/update_gang_icons_removed(datum/mind/defector_mind, var/gang) + var/datum/atom_hud/antag/ganghud = get_gang_hud(gang) + if(!ganghud) + ERROR("Invalid gang in update_gang_icons_removed(): [gang]") - spawn(0) - //Remove defector's icon from gangsters' visions - for(var/datum/mind/boss_mind in all_gangsters) - if(boss_mind.current) - if(boss_mind.current.client) - for(var/image/I in boss_mind.current.client.images) - if((I.icon_state == "gangster" || I.icon_state == "gang_boss") && I.loc == defector_mind.current) - del(I) - - //Remove gang icons from defector's vision - if(defector_mind.current) - if(defector_mind.current.client) - for(var/image/I in defector_mind.current.client.images) - if(I.icon_state == "gangster" || I.icon_state == "gang_boss") - del(I) + ganghud.leave_hud(defector_mind.current) + set_antag_hud(defector_mind.current, null) /////////////////////////// //Checks for gang victory// diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm index 28641ca9203..c55d3b827f8 100644 --- a/code/game/gamemodes/nuclear/nuclear.dm +++ b/code/game/gamemodes/nuclear/nuclear.dm @@ -48,44 +48,15 @@ //////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////// -/datum/game_mode/proc/update_all_synd_icons() - spawn(0) - for(var/datum/mind/synd_mind in syndicates) - if(synd_mind.current) - if(synd_mind.current.client) - for(var/image/I in synd_mind.current.client.images) - if(I.icon_state == "synd") - del(I) - - for(var/datum/mind/synd_mind in syndicates) - if(synd_mind.current) - if(synd_mind.current.client) - for(var/datum/mind/synd_mind_1 in syndicates) - if(synd_mind_1.current) - var/I = image('icons/mob/mob.dmi', loc = synd_mind_1.current, icon_state = "synd") - synd_mind.current.client.images += I - /datum/game_mode/proc/update_synd_icons_added(datum/mind/synd_mind) - spawn(0) - if(synd_mind.current) - if(synd_mind.current.client) - var/I = image('icons/mob/mob.dmi', loc = synd_mind.current, icon_state = "synd") - synd_mind.current.client.images += I + var/datum/atom_hud/antag/opshud = huds[ANTAG_HUD_OPS] + opshud.join_hud(synd_mind.current) + set_antag_hud(synd_mind.current, "synd") /datum/game_mode/proc/update_synd_icons_removed(datum/mind/synd_mind) - spawn(0) - for(var/datum/mind/synd in syndicates) - if(synd.current) - if(synd.current.client) - for(var/image/I in synd.current.client.images) - if(I.icon_state == "synd" && I.loc == synd_mind.current) - del(I) - - if(synd_mind.current) - if(synd_mind.current.client) - for(var/image/I in synd_mind.current.client.images) - if(I.icon_state == "synd") - del(I) + var/datum/atom_hud/antag/opshud = huds[ANTAG_HUD_OPS] + opshud.leave_hud(synd_mind.current) + set_antag_hud(synd_mind.current, null) //////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////// @@ -129,8 +100,6 @@ spawnpos++ update_synd_icons_added(synd_mind) - update_all_synd_icons() - if(uplinklocker) new /obj/structure/closet/syndicate/nuclear(uplinklocker.loc) if(nuke_spawn && synd_spawn.len > 0) diff --git a/code/game/gamemodes/revolution/revolution.dm b/code/game/gamemodes/revolution/revolution.dm index b7dbbce85bc..3dc96cba6fb 100644 --- a/code/game/gamemodes/revolution/revolution.dm +++ b/code/game/gamemodes/revolution/revolution.dm @@ -4,7 +4,6 @@ // Just make sure the converter is a head before you call it! // To remove a rev (from brainwashing or w/e), call ticker.mode:remove_revolutionary(_THE_PLAYERS_MIND_), // this will also check they're not a head, so it can just be called freely -// If the rev icons start going wrong for some reason, ticker.mode:update_all_rev_icons() can be called to correct them. // If the game somtimes isn't registering a win properly, then ticker.mode.check_win() isn't being called somewhere. /datum/game_mode @@ -258,120 +257,21 @@ else M << "[rev_mind.current] looks like they just remembered their real allegiance!" - -///////////////////////////////////////////////////////////////////////////////////////////////// -//Keeps track of players having the correct icons//////////////////////////////////////////////// -//CURRENTLY CONTAINS BUGS://///////////////////////////////////////////////////////////////////// -//-PLAYERS THAT HAVE BEEN REVS FOR AWHILE OBTAIN THE BLUE ICON WHILE STILL NOT BEING A REV HEAD// -// -Possibly caused by cloning of a standard rev///////////////////////////////////////////////// -//-UNCONFIRMED: DECONVERTED REVS NOT LOSING THEIR ICON PROPERLY////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////// -/datum/game_mode/proc/update_all_rev_icons() - spawn(0) - for(var/datum/mind/head_rev_mind in head_revolutionaries) - if(head_rev_mind.current) - if(head_rev_mind.current.client) - for(var/image/I in head_rev_mind.current.client.images) - if(I.icon_state == "rev" || I.icon_state == "rev_head") - del(I) - - for(var/datum/mind/rev_mind in revolutionaries) - if(rev_mind.current) - if(rev_mind.current.client) - for(var/image/I in rev_mind.current.client.images) - if(I.icon_state == "rev" || I.icon_state == "rev_head") - del(I) - - for(var/datum/mind/head_rev in head_revolutionaries) - if(head_rev.current) - if(head_rev.current.client) - for(var/datum/mind/rev in revolutionaries) - if(rev.current) - var/I = image('icons/mob/mob.dmi', loc = rev.current, icon_state = "rev") - head_rev.current.client.images += I - for(var/datum/mind/head_rev_1 in head_revolutionaries) - if(head_rev_1.current) - var/I = image('icons/mob/mob.dmi', loc = head_rev_1.current, icon_state = "rev_head") - head_rev.current.client.images += I - - for(var/datum/mind/rev in revolutionaries) - if(rev.current) - if(rev.current.client) - for(var/datum/mind/head_rev in head_revolutionaries) - if(head_rev.current) - var/I = image('icons/mob/mob.dmi', loc = head_rev.current, icon_state = "rev_head") - rev.current.client.images += I - for(var/datum/mind/rev_1 in revolutionaries) - if(rev_1.current) - var/I = image('icons/mob/mob.dmi', loc = rev_1.current, icon_state = "rev") - rev.current.client.images += I - -//////////////////////////////////////////////////// -//Keeps track of converted revs icons/////////////// -//Refer to above bugs. They may apply here as well// -//////////////////////////////////////////////////// +///////////////////////////////////// +//Adds the rev hud to a new convert// +///////////////////////////////////// /datum/game_mode/proc/update_rev_icons_added(datum/mind/rev_mind) - spawn(0) - for(var/datum/mind/head_rev_mind in head_revolutionaries) + var/datum/atom_hud/antag/revhud = huds[ANTAG_HUD_REV] + revhud.join_hud(rev_mind.current) + set_antag_hud(rev_mind.current, ((rev_mind in head_revolutionaries) ? "rev_head" : "rev")) - //Tagging the new rev for revheads to see - if(head_rev_mind.current) - if(head_rev_mind.current.client) - var/I - if(rev_mind in head_revolutionaries) //If the new rev is a head rev - I = image('icons/mob/mob.dmi', loc = rev_mind.current, icon_state = "rev_head") - else - I = image('icons/mob/mob.dmi', loc = rev_mind.current, icon_state = "rev") - head_rev_mind.current.client.images += I - - //Tagging the revheads for new rev to see - if(rev_mind.current) - if(rev_mind.current.client) - var/image/J = image('icons/mob/mob.dmi', loc = head_rev_mind.current, icon_state = "rev_head") - rev_mind.current.client.images += J - - for(var/datum/mind/rev_mind_1 in revolutionaries) - - //Tagging the new rev for fellow revs to see - if(rev_mind_1.current) - if(rev_mind_1.current.client) - var/I - if(rev_mind in head_revolutionaries) //If the new rev is a head rev - I = image('icons/mob/mob.dmi', loc = rev_mind.current, icon_state = "rev_head") - else - I = image('icons/mob/mob.dmi', loc = rev_mind.current, icon_state = "rev") - rev_mind_1.current.client.images += I - - //Tagging fellow revs for the new rev to see - if(rev_mind.current) - if(rev_mind.current.client) - var/image/J = image('icons/mob/mob.dmi', loc = rev_mind_1.current, icon_state = "rev") - rev_mind.current.client.images += J - -/////////////////////////////////// -//Keeps track of deconverted revs// -/////////////////////////////////// +///////////////////////////////////////// +//Removes the hud from deconverted revs// +///////////////////////////////////////// /datum/game_mode/proc/update_rev_icons_removed(datum/mind/rev_mind) - spawn(0) - for(var/datum/mind/head_rev_mind in head_revolutionaries) - if(head_rev_mind.current) - if(head_rev_mind.current.client) - for(var/image/I in head_rev_mind.current.client.images) - if((I.icon_state == "rev" || I.icon_state == "rev_head") && I.loc == rev_mind.current) - del(I) - - for(var/datum/mind/rev_mind_1 in revolutionaries) - if(rev_mind_1.current) - if(rev_mind_1.current.client) - for(var/image/I in rev_mind_1.current.client.images) - if((I.icon_state == "rev" || I.icon_state == "rev_head") && I.loc == rev_mind.current) - del(I) - - if(rev_mind.current) - if(rev_mind.current.client) - for(var/image/I in rev_mind.current.client.images) - if(I.icon_state == "rev" || I.icon_state == "rev_head") - del(I) + var/datum/atom_hud/antag/revhud = huds[ANTAG_HUD_REV] + revhud.leave_hud(rev_mind.current) + set_antag_hud(rev_mind.current, null) ////////////////////////// //Checks for rev victory// diff --git a/code/game/jobs/job/captain.dm b/code/game/jobs/job/captain.dm index 84ab61c9e0c..360d10cd342 100644 --- a/code/game/jobs/job/captain.dm +++ b/code/game/jobs/job/captain.dm @@ -43,6 +43,7 @@ Captain var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H) L.imp_in = H L.implanted = 1 + H.sec_hud_set_implants() minor_announce("Captain [H.real_name] on deck!") diff --git a/code/game/jobs/job/security.dm b/code/game/jobs/job/security.dm index 940a832355b..734f2d0fd16 100644 --- a/code/game/jobs/job/security.dm +++ b/code/game/jobs/job/security.dm @@ -53,6 +53,7 @@ Head of Security var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H) L.imp_in = H L.implanted = 1 + H.sec_hud_set_implants() /* Warden @@ -94,6 +95,7 @@ Warden var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H) L.imp_in = H L.implanted = 1 + H.sec_hud_set_implants() /datum/job/warden/get_access() var/list/L = list() @@ -143,6 +145,7 @@ Detective var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H) L.imp_in = H L.implanted = 1 + H.sec_hud_set_implants() /* Security Officer @@ -187,6 +190,7 @@ Security Officer var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H) L.imp_in = H L.implanted = 1 + H.sec_hud_set_implants() /datum/job/officer/get_access() var/list/L = list() diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index f971345f42f..bc18f0d9985 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -168,24 +168,11 @@ //Here let's calculate their health so the pod doesn't immediately eject them!!! H.updatehealth() + H.refresh_huds(clonemind.current) clonemind.transfer_to(H) H.ckey = ckey H << "Consciousness slowly creeps over you as your body regenerates.
So this is what cloning feels like?
" - // -- Mode/mind specific stuff goes here - - if((H.mind in ticker.mode.revolutionaries) || (H.mind in ticker.mode.head_revolutionaries)) - ticker.mode.update_all_rev_icons() //So the icon actually appears - if((H.mind in ticker.mode.A_bosses) || ((H.mind in ticker.mode.A_gangsters) || (H.mind in ticker.mode.B_bosses)) || (H.mind in ticker.mode.B_gangsters)) - ticker.mode.update_all_gang_icons() - if(H.mind in ticker.mode.syndicates) - ticker.mode.update_all_synd_icons() - if (H.mind in ticker.mode.cult) - ticker.mode.add_cultist(src.occupant.mind) - ticker.mode.update_all_cult_icons() //So the icon actually appears - - // -- End mode specific stuff - hardset_dna(H, ui, se, null, null, mrace, mcolor) if(efficiency > 2) diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 3372945212b..5fe0b91cc05 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -628,7 +628,8 @@ What a mess.*/ if("released") active2.fields["criminal"] = "Discharged" investigate_log("[active1.fields["name"]] has been set from [old_field] to [active2.fields["criminal"]] by [usr.name] ([usr.key]).", "records") - + for(var/mob/living/carbon/human/H in mob_list) //thanks for forcing me to do this, whoever wrote this shitty records system + H.sec_hud_set_security_status() if ("Delete Record (Security) Execute") investigate_log("[usr.name] ([usr.key]) has deleted the security records for [active1.fields["name"]].", "records") if (active2) diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm index 8061ba7f4d2..f3bee16d85f 100644 --- a/code/game/machinery/doors/brigdoors.dm +++ b/code/game/machinery/doors/brigdoors.dm @@ -24,9 +24,10 @@ var/id = null // id of door it controls. var/releasetime = 0 // when world.time reaches it - release the prisoneer var/timelength = 0 // the length of time this door will be set for - var/timing = 1 // boolean, true/1 timer is on, false/0 means it's not timing + var/timing = 0 // boolean, true/1 timer is on, false/0 means it's not timing var/picture_state // icon_state of alert picture, if not displaying text/numbers var/list/obj/machinery/targets = list() + var/obj/item/device/radio/Radio //needed to send messages to sec radio maptext_height = 26 maptext_width = 32 @@ -34,6 +35,9 @@ /obj/machinery/door_timer/New() ..() + Radio = new/obj/item/device/radio(src) + Radio.listening = 0 + pixel_x = ((src.dir & 3)? (0) : (src.dir == 4 ? 32 : -32)) pixel_y = ((src.dir & 3)? (src.dir ==1 ? 24 : -32) : (0)) @@ -64,7 +68,8 @@ if(stat & (NOPOWER|BROKEN)) return if(timing) if(world.time > src.releasetime) - broadcast_hud_message("[src]'s timer has expired. Releasing prisoner.", src) + Radio.set_frequency(SEC_FREQ) + Radio.talk_into(src, "Timer has expired. Releasing prisoner.", SEC_FREQ) src.timer_end() // open doors, reset timer, clear status screen timing = 0 timeset(0) diff --git a/code/game/mecha/medical/odysseus.dm b/code/game/mecha/medical/odysseus.dm index 795ff390d64..fa7d79e6113 100644 --- a/code/game/mecha/medical/odysseus.dm +++ b/code/game/mecha/medical/odysseus.dm @@ -9,102 +9,25 @@ internal_damage_threshold = 35 deflect_chance = 15 step_energy_drain = 6 - var/obj/item/clothing/glasses/hud/health/mech/hud - -/obj/mecha/medical/odysseus/New() - ..() - hud = new /obj/item/clothing/glasses/hud/health/mech(src) - return + var/builtin_hud_user = 0 /obj/mecha/medical/odysseus/moved_inside(var/mob/living/carbon/human/H as mob) if(..()) - if(H.glasses) - occupant_message("[H.glasses] prevent you from using [src] [hud]") + if(H.glasses && istype(H.glasses, /obj/item/clothing/glasses/hud)) + occupant_message("Your [H.glasses] prevent you from using the built-in medical hud.") else - H.glasses = hud + var/datum/atom_hud/data/medical/advanced/A = huds[DATA_HUD_MEDICAL_ADVANCED] + A.add_hud_to(H) + builtin_hud_user = 1 return 1 else return 0 /obj/mecha/medical/odysseus/go_out() - if(ishuman(occupant)) + if(ishuman(occupant) && builtin_hud_user) var/mob/living/carbon/human/H = occupant - if(H.glasses == hud) - H.glasses = null + var/datum/atom_hud/data/medical/advanced/A = huds[DATA_HUD_MEDICAL_ADVANCED] + A.remove_hud_from(H) ..() return -/* -/obj/mecha/medical/odysseus/verb/set_perspective() - set name = "Set client perspective." - set category = "Exosuit Interface" - set src = usr.loc - var/perspective = input("Select a perspective type.", - "Client perspective", - occupant.client.perspective) in list(MOB_PERSPECTIVE,EYE_PERSPECTIVE) - world << "[perspective]" - occupant.client.perspective = perspective - return -/obj/mecha/medical/odysseus/verb/toggle_eye() - set name = "Toggle eye." - set category = "Exosuit Interface" - set src = usr.loc - if(occupant.client.eye == occupant) - occupant.client.eye = src - else - occupant.client.eye = occupant - world << "[occupant.client.eye]" - return -*/ - -//TODO - Check documentation for client.eye and client.perspective... -/obj/item/clothing/glasses/hud/health/mech - name = "integrated medical Hud" - - -/obj/item/clothing/glasses/hud/health/mech/process_hud(var/mob/M) -/* - world<< "view(M)" - for(var/mob/mob in view(M)) - world << "[mob]" - world<< "view(M.client)" - for(var/mob/mob in view(M.client)) - world << "[mob]" - world<< "view(M.loc)" - for(var/mob/mob in view(M.loc)) - world << "[mob]" -*/ - - if(!M || M.stat || !(M in view(M))) return - if(!M.client) return - var/client/C = M.client - var/image/holder - for(var/mob/living/carbon/human/patient in view(M.loc)) - if(M.see_invisible < patient.invisibility) - continue - var/foundVirus = 0 - for(var/datum/disease/D in patient.viruses) - if(!(D.visibility_flags & HIDDEN_SCANNER)) - if(D.severity != NONTHREAT) - foundVirus++ - //if(patient.virus2) - // foundVirus++ - - holder = patient.hud_list[HEALTH_HUD] - if(patient.stat == 2) - holder.icon_state = "hudhealth-100" - C.images += holder - 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 - holder.icon_state = "hudhealthy" - C.images += holder diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index be405a167fb..c3ad66f6a1f 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -221,9 +221,6 @@ /obj/item/proc/talk_into(mob/M as mob, text) return -/obj/item/proc/moved(mob/user as mob, old_loc as turf) - return - /obj/item/proc/dropped(mob/user as mob) ..() diff --git a/code/game/objects/items/weapons/implants/implant.dm b/code/game/objects/items/weapons/implants/implant.dm index 6932525dd09..af34671bef5 100644 --- a/code/game/objects/items/weapons/implants/implant.dm +++ b/code/game/objects/items/weapons/implants/implant.dm @@ -27,6 +27,9 @@ /obj/item/weapon/implant/proc/implanted(var/mob/source) if(activated) action_button_name = "Activate [src.name]" + if(istype(source, /mob/living/carbon/human)) + var/mob/living/carbon/human/H = source + H.sec_hud_set_implants() return 1 @@ -205,4 +208,4 @@ /obj/item/weapon/implant/emp/activate() if (src.uses < 1) return 0 src.uses-- - empulse(imp_in, 3, 5) \ No newline at end of file + empulse(imp_in, 3, 5) diff --git a/code/modules/admin/verbs/one_click_antag.dm b/code/modules/admin/verbs/one_click_antag.dm index 4a5110e6016..8b9e6e3ccf6 100644 --- a/code/modules/admin/verbs/one_click_antag.dm +++ b/code/modules/admin/verbs/one_click_antag.dm @@ -302,8 +302,6 @@ client/proc/one_click_antag() new_character.mind.make_Nuke(synd_spawn[spawnpos],nuke_code) spawnpos++ - ticker.mode.update_all_synd_icons() - return 1 diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index a244747a41a..3b9687c3306 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -33,14 +33,10 @@ var/darkness_view = 2//Base human is 2 var/invis_view = SEE_INVISIBLE_LIVING var/emagged = 0 - var/hud = null var/list/icon/current = list() //the current hud icons strip_delay = 20 put_on_delay = 25 -/obj/item/clothing/glasses/proc/process_hud(var/mob/M) - return - /* SEE_SELF // can see self, no matter what SEE_MOBS // can see all mobs, no matter what @@ -268,7 +264,7 @@ atom/proc/generate_female_clothing(index,t_color,icon) var/mob/M = usr if (istype(M, /mob/dead/)) return - if (!can_use(usr)) + if (!can_use(M)) return if(src.has_sensor >= 2) usr << "The controls are locked." @@ -281,13 +277,17 @@ atom/proc/generate_female_clothing(index,t_color,icon) src.sensor_mode = 0 switch(src.sensor_mode) if(0) - usr << "You disable your suit's remote sensing equipment." + M << "You disable your suit's remote sensing equipment." if(1) - usr << "Your suit will now report whether you are live or dead." + M << "Your suit will now report whether you are live or dead." if(2) - usr << "Your suit will now report your vital lifesigns." + M << "Your suit will now report your vital lifesigns." if(3) - usr << "Your suit will now report your vital lifesigns as well as your coordinate position." + M << "Your suit will now report your vital lifesigns as well as your coordinate position." + if(istype(M,/mob/living/carbon/human)) + var/mob/living/carbon/human/H = M + if(H.w_uniform == src) + H.update_suit_sensors() ..() /obj/item/clothing/under/verb/rolldown() diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm index 25e6b20f94a..9b6ab29fda5 100644 --- a/code/modules/clothing/glasses/hud.dm +++ b/code/modules/clothing/glasses/hud.dm @@ -3,33 +3,27 @@ desc = "A heads-up display that provides important info in (almost) real time." flags = null //doesn't protect eyes because it's a monocle, duh origin_tech = "magnets=3;biotech=2" - hud = 1 + var/hud_type = null -/* /obj/item/clothing/glasses/hud/attackby(obj/item/weapon/W as obj, mob/user as mob) - ..() - if(istype(W, /obj/item/weapon/card/emag)) - if(emagged == 0) - emagged = 1 - user << "PZZTTPFFFT" - desc = desc+ " The display flickers slightly." - else - user << "It is already emagged!" */ //No emags allowed +/obj/item/clothing/glasses/hud/equipped(mob/living/carbon/human/user, slot) + if(slot == slot_glasses) + var/datum/atom_hud/H = huds[hud_type] + H.add_hud_to(user) + +/obj/item/clothing/glasses/hud/dropped(mob/living/carbon/human/user) + var/datum/atom_hud/H = huds[hud_type] + H.remove_hud_from(user) /obj/item/clothing/glasses/hud/emp_act(severity) if(emagged == 0) emagged = 1 desc = desc + " The display flickers slightly." - /obj/item/clothing/glasses/hud/health 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" - - -/obj/item/clothing/glasses/hud/health/process_hud(var/mob/M) - process_data_hud(M,DATA_HUD_MEDICAL,DATA_HUD_ADVANCED) - + hud_type = DATA_HUD_MEDICAL_ADVANCED /obj/item/clothing/glasses/hud/health/night name = "Night Vision Health Scanner HUD" @@ -43,6 +37,7 @@ 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" + hud_type = DATA_HUD_SECURITY_ADVANCED /obj/item/clothing/glasses/hud/security/eyepatch name = "Eyepatch HUD" @@ -56,6 +51,7 @@ darkness_view = 1 flash_protect = 1 tint = 1 + /obj/item/clothing/glasses/hud/security/night name = "Night Vision Security HUD" desc = "An advanced heads-up display which provides id data and vision in complete darkness." @@ -68,5 +64,3 @@ emagged = 1 desc = desc + " The display flickers slightly." -/obj/item/clothing/glasses/hud/security/process_hud(var/mob/M) - process_data_hud(M,DATA_HUD_SECURITY,DATA_HUD_ADVANCED) diff --git a/code/modules/events/disease_outbreak.dm b/code/modules/events/disease_outbreak.dm index 142e58fa0f6..7ff6b0ead14 100644 --- a/code/modules/events/disease_outbreak.dm +++ b/code/modules/events/disease_outbreak.dm @@ -45,7 +45,5 @@ else D = new virus_type() D.carrier = 1 - D.holder = H - D.affected_mob = H - H.viruses += D + H.AddDisease(D) break \ No newline at end of file diff --git a/code/modules/events/spontaneous_appendicitis.dm b/code/modules/events/spontaneous_appendicitis.dm index a55038ea1e3..6219d1fda69 100644 --- a/code/modules/events/spontaneous_appendicitis.dm +++ b/code/modules/events/spontaneous_appendicitis.dm @@ -14,7 +14,5 @@ continue var/datum/disease/D = new /datum/disease/appendicitis - D.holder = H - D.affected_mob = H - H.viruses += D + H.AddDisease(D) break \ No newline at end of file diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index cdcde2708a6..52903fbd0c8 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -811,29 +811,12 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) podman.real_name = realName else podman.real_name = "Pod Person [rand(0,999)]" + podman.refresh_huds(mind.current) var/oldactive = mind.active mind.active = 1 mind.transfer_to(podman) mind.active = oldactive - // -- Mode/mind specific stuff goes here. TODO! Broken :( Should be merged into mob/living/Login - if((podman.mind in ticker.mode.A_bosses) || (podman.mind in ticker.mode.A_gangsters) || (podman.mind in ticker.mode.B_bosses) || (podman.mind in ticker.mode.B_gangsters)) - ticker.mode.update_all_gang_icons() - if(podman.mind in ticker.mode:revolutionaries) - ticker.mode.add_revolutionary(podman.mind) - ticker.mode.update_all_rev_icons() //So the icon actually appears - if(podman.mind in ticker.mode:head_revolutionaries) - ticker.mode.add_revolutionary(podman.mind) - ticker.mode.update_all_rev_icons() - if(podman.mind in ticker.mode:syndicates) - ticker.mode:update_all_synd_icons() - if(podman.mind in ticker.mode:cult) - ticker.mode:add_cultist(podman.mind) - ticker.mode:update_all_cult_icons() //So the icon actually appears - - // -- End mode specific stuff - podman.gender = ghost.gender - //dna stuff hardset_dna(podman, ui, se, null, null, null, !prob(potency) ? /datum/species/plant/pod : null, "#59CE00") //makes sure podman has dna and sets the dna's ui/se/mutantrace/real_name etc variables diff --git a/code/modules/mining/laborcamp/laborstacker.dm b/code/modules/mining/laborcamp/laborstacker.dm index bb07bb2f569..18b9f1d9e45 100644 --- a/code/modules/mining/laborcamp/laborstacker.dm +++ b/code/modules/mining/laborcamp/laborstacker.dm @@ -12,9 +12,13 @@ var/obj/item/weapon/card/id/prisoner/inserted_id var/obj/machinery/door/airlock/release_door var/door_tag = "prisonshuttle" + var/obj/item/device/radio/Radio //needed to send messages to sec radio + /obj/machinery/mineral/labor_claim_console/New() ..() + Radio = new/obj/item/device/radio(src) + Radio.listening = 0 spawn(7) src.machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir)) var/t @@ -93,7 +97,8 @@ if(s.location == /area/shuttle/laborcamp/outpost) if(alone_in_area(get_area(loc), usr)) if (s.move_shuttle(0)) // No delay, to stop people from getting on while it is departing. - broadcast_hud_message("[inserted_id.registered_name] has met their quota and has returned to the station. Minerals and Prisoner ID card ready for retrieval.", src) + Radio.set_frequency(SEC_FREQ) + Radio.talk_into(src, "[inserted_id.registered_name] has returned to the station. Minerals and Prisoner ID card ready for retrieval.", SEC_FREQ) usr << "Shuttle recieved message and will be sent shortly." else usr << "Shuttle is already moving." @@ -162,4 +167,4 @@ else user << "Error: Invalid ID" return - ..() \ No newline at end of file + ..() diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index f7da665c052..d8aac764edd 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -19,6 +19,7 @@ //Note that this is not a reliable way to determine if admins started as observers, since they change mobs a lot. var/atom/movable/following = null var/fun_verbs = 0 + var/list/datum/atom_hud/oldhuds = null //old antag hud, gets readded in cloning/plantpodding /mob/dead/observer/New(mob/body) sight |= SEE_TURFS | SEE_MOBS | SEE_OBJS | SEE_SELF @@ -69,6 +70,7 @@ Works together with spawning an observer, noted above. var/mob/dead/observer/ghost = new(src) //Transfer safety to observer spawning proc. ghost.can_reenter_corpse = can_reenter_corpse ghost.key = key + ghost.refresh_huds(src) //inherit the HUDs return ghost /* diff --git a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm index b895068c1c2..a8c5300a573 100644 --- a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm +++ b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm @@ -14,6 +14,9 @@ var/const/ALIEN_AFK_BRACKET = 450 // 45 seconds if(istype(loc, /mob/living)) affected_mob = loc affected_mob.status_flags |= XENO_HOST + if(istype(affected_mob,/mob/living/carbon/human)) + var/mob/living/carbon/human/H = affected_mob + H.med_hud_set_status() processing_objects.Add(src) spawn(0) AddInfectionImages(affected_mob) @@ -23,6 +26,9 @@ var/const/ALIEN_AFK_BRACKET = 450 // 45 seconds /obj/item/alien_embryo/Destroy() if(affected_mob) affected_mob.status_flags &= ~(XENO_HOST) + if(istype(affected_mob,/mob/living/carbon/human)) + var/mob/living/carbon/human/H = affected_mob + H.med_hud_set_status() spawn(0) RemoveInfectionImages(affected_mob) ..() @@ -31,6 +37,9 @@ var/const/ALIEN_AFK_BRACKET = 450 // 45 seconds if(!affected_mob) return if(loc != affected_mob) affected_mob.status_flags &= ~(XENO_HOST) + if(istype(affected_mob,/mob/living/carbon/human)) + var/mob/living/carbon/human/H = affected_mob + H.med_hud_set_status() processing_objects.Remove(src) spawn(0) RemoveInfectionImages(affected_mob) @@ -132,4 +141,4 @@ Des: Removes all images from the mob infected by this embryo if(alien.client) for(var/image/I in alien.client.images) if(dd_hasprefix_case(I.icon_state, "infected") && I.loc == affected_mob) - qdel(I) \ No newline at end of file + qdel(I) diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm index 045ca305efa..ede9ea44ada 100644 --- a/code/modules/mob/living/carbon/human/death.dm +++ b/code/modules/mob/living/carbon/human/death.dm @@ -36,6 +36,8 @@ if(dna) dna.species.spec_death(gibbed,src) + med_hud_set_health() + med_hud_set_status() tod = worldtime2text() //weasellos time of death patch if(mind) mind.store_memory("Time of death: [tod]", 0) @@ -66,4 +68,4 @@ /mob/living/carbon/proc/Drain() ChangeToHusk() mutations |= NOCLONE - return 1 \ No newline at end of file + return 1 diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 9df56ed3037..0e4f3d8fe82 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -4,7 +4,6 @@ voice_name = "Unknown" icon = 'icons/mob/human.dmi' icon_state = "caucasian1_m_s" - var/list/hud_list = list() @@ -27,9 +26,6 @@ internal_organs += new /obj/item/organ/heart internal_organs += new /obj/item/organ/brain - for(var/i=0;i<7;i++) // 2 for medHUDs and 5 for secHUDs - hud_list += image('icons/mob/hud.dmi', src, "hudunknown") - // for spawned humans; overwritten by other code create_dna(src) ready_dna(src) @@ -37,9 +33,24 @@ ..() +/mob/living/carbon/human/prepare_huds() + ..() + prepare_data_huds() + +/mob/living/carbon/human/proc/prepare_data_huds() + //Update all our data hud images... + med_hud_set_health() + med_hud_set_status() + sec_hud_set_ID() + sec_hud_set_implants() + sec_hud_set_security_status() + //...and display them + add_to_all_data_huds() + /mob/living/carbon/human/Destroy() for(var/atom/movable/organelle in organs) qdel(organelle) + remove_from_all_data_huds() return ..() /mob/living/carbon/human/Bump(atom/movable/AM as mob|obj, yes) @@ -400,9 +411,7 @@ if(setcriminal != "Cancel") investigate_log("[src.key] has been set from [R.fields["criminal"]] to [setcriminal] by [usr.name] ([usr.key]).", "records") R.fields["criminal"] = setcriminal - - spawn() - H.handle_regular_hud_updates() + sec_hud_set_security_status() return if(href_list["view"]) diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index 633e72059db..ab55bba100e 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -13,6 +13,8 @@ //TODO: fix husking if( ((maxHealth - total_burn) < config.health_threshold_dead) && stat == DEAD ) ChangeToHusk() + med_hud_set_health() + med_hud_set_status() return diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 1cc63bab99c..09ac10b4d51 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -1,5 +1,6 @@ /mob/living/carbon/human languages = HUMAN + hud_possible = list(HEALTH_HUD,STATUS_HUD,ID_HUD,WANTED_HUD,IMPLOYAL_HUD,IMPCHEM_HUD,IMPTRACK_HUD, ANTAG_HUD) //Hair colour and style var/hair_color = "000" var/hair_style = "Bald" @@ -46,4 +47,4 @@ var/xylophone = 0 //For the spoooooooky xylophone cooldown - var/gender_ambiguous = 0 //if something goes wrong during gender reassignment this generates a line in examine \ No newline at end of file + var/gender_ambiguous = 0 //if something goes wrong during gender reassignment this generates a line in examine diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index c08ffd36903..6da553aaf24 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -260,6 +260,7 @@ if(belt) unEquip(belt) w_uniform = null + update_suit_sensors() update_inv_w_uniform(0) else if(I == gloves) gloves = null @@ -289,9 +290,11 @@ if(internals) internals.icon_state = "internal0" internal = null + sec_hud_set_ID() update_inv_wear_mask(0) else if(I == wear_id) wear_id = null + sec_hud_set_ID() update_inv_wear_id(0) else if(I == r_store) r_store = null @@ -330,6 +333,7 @@ wear_mask = I if(wear_mask.flags & BLOCKHAIR) update_hair(redraw_mob) //rebuild hair + sec_hud_set_ID() update_inv_wear_mask(redraw_mob) if(slot_handcuffed) handcuffed = I @@ -348,6 +352,7 @@ update_inv_belt(redraw_mob) if(slot_wear_id) wear_id = I + sec_hud_set_ID() update_inv_wear_id(redraw_mob) if(slot_ears) ears = I @@ -373,6 +378,7 @@ update_inv_wear_suit(redraw_mob) if(slot_w_uniform) w_uniform = I + update_suit_sensors() update_inv_w_uniform(redraw_mob) if(slot_l_store) l_store = I @@ -387,7 +393,7 @@ if(get_active_hand() == I) unEquip(I) I.loc = back - return else src << "You are trying to equip this item to an unsupported inventory slot. Report this to a coder!" - return \ No newline at end of file + return + diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 366d08617cb..6985cf97e93 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -583,8 +583,6 @@ /mob/living/carbon/human/proc/handle_regular_hud_updates() if(!client) return 0 - regular_hud_updates() //For MED/SEC HUD icon deletion - client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask) update_action_buttons() diff --git a/code/modules/mob/living/carbon/human/login.dm b/code/modules/mob/living/carbon/human/login.dm index 98ae4a6e6d3..7877b6f6072 100644 --- a/code/modules/mob/living/carbon/human/login.dm +++ b/code/modules/mob/living/carbon/human/login.dm @@ -1,6 +1,4 @@ /mob/living/carbon/human/Login() ..() update_hud() - if(ticker.mode) - ticker.mode.update_all_synd_icons() //This proc only sounds CPU-expensive on paper. It is O(n^2), but the outer for-loop only iterates through syndicates, which are only prsenet in nuke rounds and even when they exist, there's usually 6 of them. return diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index e73f2466b48..3d26f84da37 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -457,9 +457,6 @@ H.sight |= G.vision_flags H.see_in_dark = G.darkness_view H.see_invisible = G.invis_view - if(G.hud) - G.process_hud(H) - if(H.druggy) //Override for druggy H.see_invisible = see_temp diff --git a/code/modules/mob/living/carbon/slime/hud.dm b/code/modules/mob/living/carbon/slime/hud.dm deleted file mode 100644 index ad8ac6a00f6..00000000000 --- a/code/modules/mob/living/carbon/slime/hud.dm +++ /dev/null @@ -1,2 +0,0 @@ -/mob/living/carbon/slime/regular_hud_updates() - return \ No newline at end of file diff --git a/code/modules/mob/living/carbon/slime/life.dm b/code/modules/mob/living/carbon/slime/life.dm index bdb63e28c37..495686752d7 100644 --- a/code/modules/mob/living/carbon/slime/life.dm +++ b/code/modules/mob/living/carbon/slime/life.dm @@ -35,8 +35,6 @@ //to find it. src.blinded = null - regular_hud_updates() // Basically just deletes any screen objects :< - if(environment) handle_environment(environment) // Handle temperature/pressure differences between body and environment diff --git a/code/modules/mob/living/login.dm b/code/modules/mob/living/login.dm index 0d2e5ad541b..889afd142a1 100644 --- a/code/modules/mob/living/login.dm +++ b/code/modules/mob/living/login.dm @@ -4,64 +4,16 @@ sync_mind() mind.show_memory(src, 0) - //Round specific stuff like hud updates + //Round specific stuff if(ticker && ticker.mode) switch(ticker.mode.name) if("sandbox") CanBuild() - if("revolution") - if((mind in ticker.mode.revolutionaries) || (src.mind in ticker.mode:head_revolutionaries)) - ticker.mode.update_rev_icons_added(src.mind) - if("gang") - if((mind in ticker.mode.A_bosses) || (mind in ticker.mode.A_gangsters)) - ticker.mode.update_gang_icons_added(src.mind,"A") - if((mind in ticker.mode.B_bosses) || (mind in ticker.mode.B_gangsters)) - ticker.mode.update_gang_icons_added(src.mind,"B") - if("cult") - if(mind in ticker.mode:cult) - ticker.mode.update_cult_icons_added(src.mind) - if("nuclear emergency") - if(mind in ticker.mode:syndicates) - ticker.mode.update_all_synd_icons() + + //HUD updates (antag hud, etc) + refresh_huds() if(ventcrawler) src << "You can ventcrawl! Use alt+click on vents to quickly travel about the station." update_interface() return . - -//This stuff needs to be merged from cloning.dm but I'm not in the mood to be shouted at for breaking all the things :< ~Carn - /* clones - switch(ticker.mode.name) - if("revolution") - if(src.occupant.mind in ticker.mode:revolutionaries) - ticker.mode:update_all_rev_icons() //So the icon actually appears - if(src.occupant.mind in ticker.mode:head_revolutionaries) - ticker.mode:update_all_rev_icons() - if("nuclear emergency") - if (src.occupant.mind in ticker.mode:syndicates) - ticker.mode:update_all_synd_icons() - if("cult") - if (src.occupant.mind in ticker.mode:cult) - ticker.mode:add_cultist(src.occupant.mind) - ticker.mode:update_all_cult_icons() //So the icon actually appears - */ - - /* Plantpeople - switch(ticker.mode.name) - if ("revolution") - if (podman.mind in ticker.mode:revolutionaries) - ticker.mode:add_revolutionary(podman.mind) - ticker.mode:update_all_rev_icons() //So the icon actually appears - if (podman.mind in ticker.mode:head_revolutionaries) - ticker.mode:update_all_rev_icons() - if ("nuclear emergency") - if (podman.mind in ticker.mode:syndicates) - ticker.mode:update_all_synd_icons() - if ("cult") - if (podman.mind in ticker.mode:cult) - ticker.mode:add_cultist(podman.mind) - ticker.mode:update_all_cult_icons() //So the icon actually appears - if ("changeling") - if (podman.mind in ticker.mode:changelings) - podman.make_changeling() - */ \ No newline at end of file diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index c591952fc60..cc5e57f2459 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -20,6 +20,8 @@ var/list/ai_list = list() density = 1 status_flags = CANSTUN|CANPARALYSE|CANPUSH force_compose = 1 //This ensures that the AI always composes it's own hear message. Needed for hrefs and job display. + med_hud = DATA_HUD_MEDICAL_BASIC + sec_hud = DATA_HUD_SECURITY_BASIC var/list/network = list("SS13") var/obj/machinery/camera/current = null var/list/connected_robots = list() diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index ea50f2e80b1..54cff59b181 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -163,11 +163,6 @@ sleep(50) theAPC = null - regular_hud_updates() - - if(sensor_mode) //Data HUDs, such as Security or Medical HUDS. Passes the AI's eye since it seems from that instead of itself. - process_data_hud(src,sensor_mode,DATA_HUD_BASIC,src.eyeobj) - /mob/living/silicon/ai/updatehealth() if(status_flags & GODMODE) health = maxHealth @@ -175,4 +170,4 @@ return health = maxHealth - getOxyLoss() - getToxLoss() - getBruteLoss() if(!fire_res_on_core) - health -= getFireLoss() \ No newline at end of file + health -= getFireLoss() diff --git a/code/modules/mob/living/silicon/pai/life.dm b/code/modules/mob/living/silicon/pai/life.dm index f8a7d0c2ef1..874828a6f69 100644 --- a/code/modules/mob/living/silicon/pai/life.dm +++ b/code/modules/mob/living/silicon/pai/life.dm @@ -8,12 +8,6 @@ M.show_message("[src.cable] rapidly retracts back into its spool.", 3, "You hear a click and the sound of wire spooling rapidly.", 2) qdel(src.cable) cable = null - - regular_hud_updates() - if(secHUD == 1) - process_data_hud(src, DATA_HUD_SECURITY,DATA_HUD_ADVANCED) - if(medHUD == 1) - process_data_hud(src, DATA_HUD_MEDICAL,DATA_HUD_ADVANCED) if(silence_time) if(world.timeofday >= silence_time) silence_time = null diff --git a/code/modules/mob/living/silicon/pai/software.dm b/code/modules/mob/living/silicon/pai/software.dm index c7ac1b347d5..c57a52c8a8f 100644 --- a/code/modules/mob/living/silicon/pai/software.dm +++ b/code/modules/mob/living/silicon/pai/software.dm @@ -238,10 +238,16 @@ temp = "Unable to locate requested security record. Record may have been deleted, or never have existed." if("securityhud") if(href_list["toggle"]) - src.secHUD = !src.secHUD + secHUD = !secHUD + remove_med_sec_hud() + if(secHUD) + add_sec_hud() if("medicalhud") if(href_list["toggle"]) - src.medHUD = !src.medHUD + medHUD = !medHUD + remove_med_sec_hud() + if(medHUD) + add_med_hud() if("translator") if(href_list["toggle"]) languages = languages == ALL ? HUMAN & ROBOT : ALL diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index 9ffd615c845..61b4f3487de 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -166,11 +166,6 @@ if(see_override) see_invisible = see_override - regular_hud_updates() //Handles MED/SEC HUDs for borgs. - - if(sensor_mode) - process_data_hud(src,sensor_mode,DATA_HUD_ADVANCED) - if (src.healths) if (src.stat != 2) switch(health) @@ -310,4 +305,4 @@ /mob/living/silicon/robot/update_canmove() if(paralysis || stunned || weakened || buckled || lockcharge) canmove = 0 else canmove = 1 - return canmove \ No newline at end of file + return canmove diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index e11c255358f..a1d4cc93437 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -15,7 +15,8 @@ var/lawcheck[1] var/ioncheck[1] - var/sensor_mode = 0 //Determines the current HUD. + var/med_hud = DATA_HUD_MEDICAL_ADVANCED //Determines the med hud to use + var/sec_hud = DATA_HUD_SECURITY_ADVANCED //Determines the sec hud to use /mob/living/silicon/proc/cancelAlarm() return @@ -317,18 +318,32 @@ /mob/living/silicon/assess_threat() //Secbots won't hunt silicon units return -10 +/mob/living/silicon/proc/remove_med_sec_hud() + var/datum/atom_hud/secsensor = huds[sec_hud] + var/datum/atom_hud/medsensor = huds[med_hud] + secsensor.remove_hud_from(src) + medsensor.remove_hud_from(src) + +/mob/living/silicon/proc/add_sec_hud() + var/datum/atom_hud/secsensor = huds[sec_hud] + secsensor.add_hud_to(src) + +/mob/living/silicon/proc/add_med_hud() + var/datum/atom_hud/medsensor = huds[med_hud] + medsensor.add_hud_to(src) + /mob/living/silicon/verb/sensor_mode() set name = "Set Sensor Augmentation" var/sensor_type = input("Please select sensor type.", "Sensor Integration", null) in list("Security", "Medical","Disable") + remove_med_sec_hud() switch(sensor_type) if ("Security") - sensor_mode = DATA_HUD_SECURITY + add_sec_hud() src << "Security records overlay enabled." if ("Medical") - sensor_mode = DATA_HUD_MEDICAL + add_med_hud() src << "Life signs monitor overlay enabled." if ("Disable") - sensor_mode = 0 src << "Sensor augmentations disabled." diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 0ea87f92744..918437895bb 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -13,7 +13,6 @@ /mob/proc/sac_act(var/obj/effect/rune/R, var/mob/victim as mob) return - var/next_mob_id = 0 /mob/New() tag = "mob_[next_mob_id++]" @@ -22,8 +21,13 @@ var/next_mob_id = 0 dead_mob_list += src else living_mob_list += src + prepare_huds() ..() +/mob/proc/prepare_huds() + for(var/hud in hud_possible) + hud_list[hud] = image('icons/mob/hud.dmi', src, "") + /mob/proc/Cell() set category = "Admin" set hidden = 1 diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index f13d82a7c8e..6b66ca59f6e 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -3,6 +3,7 @@ layer = 4 animate_movement = 2 flags = NOREACT | HEAR + hud_possible = list(ANTAG_HUD) var/datum/mind/mind var/stat = 0 //Whether a mob is alive or dead. TODO: Move this to living - Nodrak diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 7252eafa2bb..ed782e6daaf 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -463,11 +463,3 @@ proc/is_special_character(mob/M) // returns 1 for special characters and 2 for h else return -/proc/broadcast_hud_message(var/message, var/broadcast_source) - var/turf/sourceturf = get_turf(broadcast_source) - var/user_list = sec_hud_users //A local var is used for easy addition of other HUD types. - var/hud_icon = /obj/item/weapon/restraints/handcuffs //Icon displayed when the HUD triggered. Handcuffs for Sec HUDs. - for(var/mob/hud_user in user_list) - var/turf/userturf = get_turf(hud_user) - if(userturf.z == sourceturf.z) //Must have same z-level. - hud_user.show_message("\icon[hud_icon] [message]", 1) diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 8b088f09835..90ec8f9336c 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -163,6 +163,7 @@ viruses = list() for(var/datum/disease/D in O.viruses) D.affected_mob = O + O.med_hud_set_status() //keep damage? if (tr_flags & TR_KEEPDAMAGE) @@ -175,6 +176,7 @@ for(var/obj/item/weapon/implant/I in implants) I.loc = O I.implanted = O + O.sec_hud_set_implants() if(mind) mind.transfer_to(O) diff --git a/code/modules/surgery/implant_removal.dm b/code/modules/surgery/implant_removal.dm index 054ad9a19d7..bcd0bb32bc1 100644 --- a/code/modules/surgery/implant_removal.dm +++ b/code/modules/surgery/implant_removal.dm @@ -29,6 +29,9 @@ if(istype(I, /obj/item/weapon/implant/loyalty)) target << "You feel a sense of liberation as Nanotrasen's grip on your mind fades away." qdel(I) + if(istype(user, /mob/living/carbon/human)) + var/mob/living/carbon/human/H = user + H.sec_hud_set_implants() else user.visible_message("[user] can't find anything in [target]'s [target_zone].") - return 1 \ No newline at end of file + return 1 diff --git a/html/changelogs/Tkdrg-HUDs.yml b/html/changelogs/Tkdrg-HUDs.yml new file mode 100644 index 00000000000..192dba145fb --- /dev/null +++ b/html/changelogs/Tkdrg-HUDs.yml @@ -0,0 +1,5 @@ +author: Tkdrg +delete-after: True + +changes: + - tweak: Security/Medical HUDs are now more responsive and less laggy. diff --git a/icons/mob/hud.dmi b/icons/mob/hud.dmi index 648866f97d7..12fe2bf8812 100644 Binary files a/icons/mob/hud.dmi and b/icons/mob/hud.dmi differ diff --git a/icons/mob/mob.dmi b/icons/mob/mob.dmi index 2cfaf2b0015..390f3f00953 100644 Binary files a/icons/mob/mob.dmi and b/icons/mob/mob.dmi differ diff --git a/tgstation.dme b/tgstation.dme index 4530e7f5027..c256d38e465 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -23,6 +23,7 @@ #include "code\__DEFINES\combat.dm" #include "code\__DEFINES\flags.dm" #include "code\__DEFINES\genetics.dm" +#include "code\__DEFINES\hud.dm" #include "code\__DEFINES\machines.dm" #include "code\__DEFINES\math.dm" #include "code\__DEFINES\misc.dm" @@ -131,6 +132,7 @@ #include "code\datums\datacore.dm" #include "code\datums\datumvars.dm" #include "code\datums\gas_mixture.dm" +#include "code\datums\hud.dm" #include "code\datums\mind.dm" #include "code\datums\mixed.dm" #include "code\datums\modules.dm" @@ -244,6 +246,7 @@ #include "code\game\area\ai_monitored.dm" #include "code\game\area\areas.dm" #include "code\game\area\Space Station 13 areas.dm" +#include "code\game\gamemodes\antag_hud.dm" #include "code\game\gamemodes\antag_spawner.dm" #include "code\game\gamemodes\events.dm" #include "code\game\gamemodes\factions.dm" @@ -1073,7 +1076,6 @@ #include "code\modules\mob\living\carbon\slime\death.dm" #include "code\modules\mob\living\carbon\slime\emote.dm" #include "code\modules\mob\living\carbon\slime\examine.dm" -#include "code\modules\mob\living\carbon\slime\hud.dm" #include "code\modules\mob\living\carbon\slime\life.dm" #include "code\modules\mob\living\carbon\slime\login.dm" #include "code\modules\mob\living\carbon\slime\powers.dm"