HUD traits now apply their corresponding hud automatically. Most clothing/item/etc sources of HUDs now only use traits (#84984)

## About The Pull Request

Currently if you want to apply a HUD you usually add both its trait and
the HUD itself. Only exceptions are things like simplemobs where you
should avoid adding the hud trait since it adds security/med DB access
and such, but there is no cases where you'd want to apply the trait and
not apply the hud.

Requested by Melbert about a week ago.

![image](https://github.com/user-attachments/assets/8af3e9cc-ea22-4cee-86ec-54c397291727)

## Why It's Good For The Game

This makes working with HUDs significantly easier, as you no longer have
to bother with manually adding/removing them. Also potentially removes
an edge case where if your hud could get removed while keeping the
trait.

## Changelog
🆑
refactor: HUD traits now apply their corresponding hud automatically
/🆑
This commit is contained in:
SmArtKar
2024-07-19 01:24:07 +02:00
committed by GitHub
parent 1feedc68ab
commit dfb12f91d6
25 changed files with 106 additions and 178 deletions
+2 -2
View File
@@ -58,8 +58,8 @@
#define DATA_HUD_SECURITY_ADVANCED 2
#define DATA_HUD_MEDICAL_BASIC 3
#define DATA_HUD_MEDICAL_ADVANCED 4
#define DATA_HUD_DIAGNOSTIC_BASIC 5
#define DATA_HUD_DIAGNOSTIC_ADVANCED 6
#define DATA_HUD_DIAGNOSTIC 5
#define DATA_HUD_BOT_PATH 6
#define DATA_HUD_ABDUCTOR 7
#define DATA_HUD_SENTIENT_DISEASE 8
#define DATA_HUD_AI_DETECT 9
+1
View File
@@ -336,6 +336,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_SECURITY_HUD "sec_hud"
/// for something granting you a diagnostic hud
#define TRAIT_DIAGNOSTIC_HUD "diag_hud"
#define TRAIT_BOT_PATH_HUD "bot_path_hud"
/// Is a medbot healing you
#define TRAIT_MEDIBOTCOMINGTHROUGH "medbot"
#define TRAIT_PASSTABLE "passtable"
+1
View File
@@ -188,6 +188,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_DETECTIVES_TASTE" = TRAIT_DETECTIVES_TASTE,
"TRAIT_DETECT_STORM" = TRAIT_DETECT_STORM,
"TRAIT_DIAGNOSTIC_HUD" = TRAIT_DIAGNOSTIC_HUD,
"TRAIT_BOT_PATH_HUD" = TRAIT_BOT_PATH_HUD,
"TRAIT_DISCOORDINATED_TOOL_USER" = TRAIT_DISCOORDINATED_TOOL_USER,
"TRAIT_DISEASELIKE_SEVERITY_MEDIUM" = TRAIT_DISEASELIKE_SEVERITY_MEDIUM,
"TRAIT_DISFIGURED" = TRAIT_DISFIGURED,
+1
View File
@@ -60,6 +60,7 @@ GLOBAL_LIST_INIT(admin_visible_traits, list(
"TRAIT_DEFIB_BLACKLISTED" = TRAIT_DEFIB_BLACKLISTED,
"TRAIT_DEPRESSION" = TRAIT_DEPRESSION,
"TRAIT_DIAGNOSTIC_HUD" = TRAIT_DIAGNOSTIC_HUD,
"TRAIT_BOT_PATH_HUD" = TRAIT_BOT_PATH_HUD,
"TRAIT_DISCOORDINATED_TOOL_USER" = TRAIT_DISCOORDINATED_TOOL_USER,
"TRAIT_DISFIGURED" = TRAIT_DISFIGURED,
"TRAIT_DISK_VERIFIER" = TRAIT_DISK_VERIFIER,
+6 -8
View File
@@ -27,17 +27,15 @@
/datum/element/digitalcamo/proc/HideFromAIHuds(mob/living/target)
for(var/mob/living/silicon/ai/AI in GLOB.ai_list)
var/datum/atom_hud/M = GLOB.huds[AI.med_hud]
M.hide_single_atomhud_from(AI,target)
var/datum/atom_hud/S = GLOB.huds[AI.sec_hud]
S.hide_single_atomhud_from(AI,target)
for (var/hud_type in AI.silicon_huds)
var/datum/atom_hud/silicon_hud = GLOB.huds[hud_type]
silicon_hud.hide_single_atomhud_from(AI,target)
/datum/element/digitalcamo/proc/UnhideFromAIHuds(mob/living/target)
for(var/mob/living/silicon/ai/AI in GLOB.ai_list)
var/datum/atom_hud/M = GLOB.huds[AI.med_hud]
M.unhide_single_atomhud_from(AI,target)
var/datum/atom_hud/S = GLOB.huds[AI.sec_hud]
S.unhide_single_atomhud_from(AI,target)
for (var/hud_type in AI.silicon_huds)
var/datum/atom_hud/silicon_hud = GLOB.huds[hud_type]
silicon_hud.unhide_single_atomhud_from(AI,target)
/datum/element/digitalcamo/proc/on_examine(datum/source, mob/M)
SIGNAL_HANDLER
+18 -11
View File
@@ -8,17 +8,24 @@ GLOBAL_LIST_EMPTY(huds_by_category)
//GLOBAL HUD LIST
GLOBAL_LIST_INIT(huds, list(
DATA_HUD_SECURITY_BASIC = new/datum/atom_hud/data/human/security/basic(),
DATA_HUD_SECURITY_ADVANCED = new/datum/atom_hud/data/human/security/advanced(),
DATA_HUD_MEDICAL_BASIC = new/datum/atom_hud/data/human/medical/basic(),
DATA_HUD_MEDICAL_ADVANCED = new/datum/atom_hud/data/human/medical/advanced(),
DATA_HUD_DIAGNOSTIC_BASIC = new/datum/atom_hud/data/diagnostic/basic(),
DATA_HUD_DIAGNOSTIC_ADVANCED = new/datum/atom_hud/data/diagnostic/advanced(),
DATA_HUD_ABDUCTOR = new/datum/atom_hud/abductor(),
DATA_HUD_SENTIENT_DISEASE = new/datum/atom_hud/sentient_disease(),
DATA_HUD_AI_DETECT = new/datum/atom_hud/ai_detector(),
DATA_HUD_FAN = new/datum/atom_hud/data/human/fan_hud(),
DATA_HUD_MALF_APC = new/datum/atom_hud/data/malf_apc(),
DATA_HUD_SECURITY_BASIC = new /datum/atom_hud/data/human/security/basic(),
DATA_HUD_SECURITY_ADVANCED = new /datum/atom_hud/data/human/security/advanced(),
DATA_HUD_MEDICAL_BASIC = new /datum/atom_hud/data/human/medical/basic(),
DATA_HUD_MEDICAL_ADVANCED = new /datum/atom_hud/data/human/medical/advanced(),
DATA_HUD_DIAGNOSTIC = new /datum/atom_hud/data/diagnostic(),
DATA_HUD_BOT_PATH = new /datum/atom_hud/data/bot_path(),
DATA_HUD_ABDUCTOR = new /datum/atom_hud/abductor(),
DATA_HUD_SENTIENT_DISEASE = new /datum/atom_hud/sentient_disease(),
DATA_HUD_AI_DETECT = new /datum/atom_hud/ai_detector(),
DATA_HUD_FAN = new /datum/atom_hud/data/human/fan_hud(),
DATA_HUD_MALF_APC = new /datum/atom_hud/data/malf_apc(),
))
GLOBAL_LIST_INIT(trait_to_hud, list(
TRAIT_SECURITY_HUD = DATA_HUD_SECURITY_ADVANCED,
TRAIT_MEDICAL_HUD = DATA_HUD_MEDICAL_ADVANCED,
TRAIT_DIAGNOSTIC_HUD = DATA_HUD_DIAGNOSTIC,
TRAIT_BOT_PATH_HUD = DATA_HUD_BOT_PATH
))
/datum/atom_hud
+3 -7
View File
@@ -53,18 +53,14 @@
hud_icons = list(FAN_HUD)
/datum/atom_hud/data/diagnostic
/datum/atom_hud/data/diagnostic/basic
hud_icons = list(DIAG_HUD, DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD, DIAG_BOT_HUD, DIAG_TRACK_HUD, DIAG_CAMERA_HUD, DIAG_AIRLOCK_HUD, DIAG_LAUNCHPAD_HUD)
/datum/atom_hud/data/diagnostic/advanced
hud_icons = list(DIAG_HUD, DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD, DIAG_BOT_HUD, DIAG_TRACK_HUD, DIAG_CAMERA_HUD, DIAG_AIRLOCK_HUD, DIAG_LAUNCHPAD_HUD, DIAG_PATH_HUD)
/datum/atom_hud/data/bot_path
// This hud exists so the bot can see itself, that's all
uses_global_hud_category = FALSE
hud_icons = list(DIAG_PATH_HUD)
/datum/atom_hud/data/bot_path/private
uses_global_hud_category = FALSE
/datum/atom_hud/abductor
hud_icons = list(GLAND_HUD)
@@ -50,16 +50,12 @@
..()
if(!(slot & ITEM_SLOT_HANDS))
return
var/datum/atom_hud/our_hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
our_hud.show_to(user)
ADD_TRAIT(user, TRAIT_MEDICAL_HUD, type)
/obj/item/statuebust/hippocratic/dropped(mob/living/carbon/human/user)
..()
if(HAS_TRAIT_NOT_FROM(user, TRAIT_MEDICAL_HUD, type))
return
var/datum/atom_hud/our_hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
our_hud.hide_from(user)
REMOVE_TRAIT(user, TRAIT_MEDICAL_HUD, type)
/obj/item/statuebust/hippocratic/attack_self(mob/user)
+2 -2
View File
@@ -361,7 +361,7 @@ ADMIN_VERB(combo_hud, R_ADMIN, "Toggle Combo HUD", "Toggles the Admin Combo HUD.
combo_hud_enabled = TRUE
for (var/hudtype in list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_ADVANCED))
for (var/hudtype in list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC, DATA_HUD_BOT_PATH))
var/datum/atom_hud/atom_hud = GLOB.huds[hudtype]
atom_hud.show_to(mob)
@@ -377,7 +377,7 @@ ADMIN_VERB(combo_hud, R_ADMIN, "Toggle Combo HUD", "Toggles the Admin Combo HUD.
combo_hud_enabled = FALSE
for (var/hudtype in list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_ADVANCED))
for (var/hudtype in list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC, DATA_HUD_BOT_PATH))
var/datum/atom_hud/atom_hud = GLOB.huds[hudtype]
atom_hud.hide_from(mob)
@@ -42,23 +42,4 @@ Happy hunting!
icon_state = "sunhudmed"
flags_cover = GLASSESCOVERSEYES
flash_protect = FLASH_PROTECTION_WELDER
clothing_traits = list(TRAIT_REAGENT_SCANNER)
var/list/hudlist = list(DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_ADVANCED, DATA_HUD_SECURITY_ADVANCED)
/obj/item/clothing/glasses/overwatch/equipped(mob/user, slot)
. = ..()
if(!(slot & ITEM_SLOT_EYES) || !ishuman(user))
return
for(var/hud in hudlist)
var/datum/atom_hud/our_hud = GLOB.huds[hud]
our_hud.show_to(user)
user.add_traits(list(TRAIT_MEDICAL_HUD, TRAIT_SECURITY_HUD, TRAIT_DIAGNOSTIC_HUD), GLASSES_TRAIT)
/obj/item/clothing/glasses/overwatch/dropped(mob/user)
. = ..()
user.remove_traits(list(TRAIT_MEDICAL_HUD, TRAIT_SECURITY_HUD, TRAIT_DIAGNOSTIC_HUD), GLASSES_TRAIT)
if(!ishuman(user))
return
for(var/hud in hudlist)
var/datum/atom_hud/our_hud = GLOB.huds[hud]
our_hud.hide_from(user)
clothing_traits = list(TRAIT_REAGENT_SCANNER, TRAIT_SECURITY_HUD, TRAIT_MEDICAL_HUD, TRAIT_DIAGNOSTIC_HUD)
+1 -1
View File
@@ -611,7 +611,7 @@
glass_colour_type = FALSE
vision_flags = SEE_TURFS
clothing_traits = list(TRAIT_REAGENT_SCANNER, TRAIT_MADNESS_IMMUNE)
var/list/hudlist = list(DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_ADVANCED, DATA_HUD_SECURITY_ADVANCED)
var/list/hudlist = list(DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC, DATA_HUD_SECURITY_ADVANCED, DATA_HUD_BOT_PATH)
var/xray = FALSE
/obj/item/clothing/glasses/debug/equipped(mob/user, slot)
+15 -39
View File
@@ -2,26 +2,6 @@
name = "HUD"
desc = "A heads-up display that provides important info in (almost) real time."
flags_1 = null //doesn't protect eyes because it's a monocle, duh
///A list of atom hud types added to the mob when the glasses are worn on the appropriate slot.
var/list/hud_types
// NOTE: Just because you have a HUD display doesn't mean you should be able to interact with stuff on examine, that's where the associated trait (TRAIT_MEDICAL_HUD, TRAIT_SECURITY_HUD, etc) is necessary.
/obj/item/clothing/glasses/hud/equipped(mob/living/carbon/human/user, slot)
..()
if(!(slot & ITEM_SLOT_EYES))
return
for(var/hud_type in hud_types)
var/datum/atom_hud/our_hud = GLOB.huds[hud_type]
our_hud.show_to(user)
/obj/item/clothing/glasses/hud/dropped(mob/living/carbon/human/user)
..()
if(!istype(user) || user.glasses != src)
return
for(var/hud_type in hud_types)
var/datum/atom_hud/our_hud = GLOB.huds[hud_type]
our_hud.hide_from(user)
/obj/item/clothing/glasses/hud/emp_act(severity)
. = ..()
@@ -56,7 +36,6 @@
name = "health scanner HUD"
desc = "A heads-up display that scans the humanoids in view and provides accurate data about their health status."
icon_state = "healthhud"
hud_types = list(DATA_HUD_MEDICAL_ADVANCED)
clothing_traits = list(TRAIT_MEDICAL_HUD)
glass_colour_type = /datum/client_colour/glass_colour/lightblue
@@ -64,7 +43,6 @@
name = "health scanner security HUD"
desc = "A heads-up display that scans the humanoids in view and provides accurate data about their health status, ID status and security records."
icon_state = "medsechud"
hud_types = list(DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_SECURITY_ADVANCED)
clothing_traits = list(TRAIT_MEDICAL_HUD, TRAIT_SECURITY_HUD)
/obj/item/clothing/glasses/hud/health/night
@@ -118,7 +96,6 @@
name = "diagnostic HUD"
desc = "A heads-up display capable of analyzing the integrity and status of robotics and exosuits."
icon_state = "diagnostichud"
hud_types = list(DATA_HUD_DIAGNOSTIC_BASIC)
clothing_traits = list(TRAIT_DIAGNOSTIC_HUD)
glass_colour_type = /datum/client_colour/glass_colour/lightorange
@@ -161,7 +138,6 @@
name = "security HUD"
desc = "A heads-up display that scans the humanoids in view and provides accurate data about their ID status and security records."
icon_state = "securityhud"
hud_types = list(DATA_HUD_SECURITY_ADVANCED)
clothing_traits = list(TRAIT_SECURITY_HUD)
glass_colour_type = /datum/client_colour/glass_colour/red
@@ -251,20 +227,18 @@
if (wearer.glasses != src)
return
for(var/hud_type in hud_types)
var/datum/atom_hud/our_hud = GLOB.huds[hud_type]
our_hud.hide_from(user)
for(var/trait in clothing_traits)
REMOVE_CLOTHING_TRAIT(user, trait)
if (DATA_HUD_MEDICAL_ADVANCED in hud_types)
hud_types = null
else if (DATA_HUD_SECURITY_ADVANCED in hud_types)
hud_types = list(DATA_HUD_MEDICAL_ADVANCED)
if (TRAIT_MEDICAL_HUD in clothing_traits)
clothing_traits = null
else if (TRAIT_SECURITY_HUD in clothing_traits)
clothing_traits = list(TRAIT_MEDICAL_HUD)
else
hud_types = list(DATA_HUD_SECURITY_ADVANCED)
clothing_traits = list(TRAIT_SECURITY_HUD)
for(var/hud_type in hud_types)
var/datum/atom_hud/our_hud = GLOB.huds[hud_type]
our_hud.show_to(user)
for(var/trait in clothing_traits)
ADD_CLOTHING_TRAIT(user, trait)
/datum/action/item_action/switch_hud
name = "Switch HUD"
@@ -273,20 +247,22 @@
name = "thermal HUD scanner"
desc = "Thermal imaging HUD in the shape of glasses."
icon_state = "thermal"
hud_types = list(DATA_HUD_SECURITY_ADVANCED)
vision_flags = SEE_MOBS
color_cutoffs = list(25, 8, 5)
glass_colour_type = /datum/client_colour/glass_colour/red
clothing_traits = list(TRAIT_SECURITY_HUD)
/obj/item/clothing/glasses/hud/toggle/thermal/attack_self(mob/user)
..()
var/hud_type = hud_types[1]
var/hud_type
if (!isnull(clothing_traits) && clothing_traits.len)
hud_type = clothing_traits[1]
switch (hud_type)
if (DATA_HUD_MEDICAL_ADVANCED)
if (TRAIT_MEDICAL_HUD)
icon_state = "meson"
color_cutoffs = list(5, 15, 5)
change_glass_color(/datum/client_colour/glass_colour/green)
if (DATA_HUD_SECURITY_ADVANCED)
if (TRAIT_SECURITY_HUD)
icon_state = "thermal"
color_cutoffs = list(25, 8, 5)
change_glass_color(/datum/client_colour/glass_colour/red)
@@ -50,15 +50,11 @@
/obj/item/clothing/suit/hooded/ablative/on_hood_up(obj/item/clothing/head/hooded/hood)
. = ..()
var/mob/living/carbon/user = loc
var/datum/atom_hud/hud = GLOB.huds[DATA_HUD_SECURITY_ADVANCED]
ADD_TRAIT(user, TRAIT_SECURITY_HUD, HELMET_TRAIT)
hud.show_to(user)
balloon_alert(user, "hud enabled")
/obj/item/clothing/suit/hooded/ablative/on_hood_down(obj/item/clothing/head/hooded/hood)
var/mob/living/carbon/user = loc
var/datum/atom_hud/sec_hud = GLOB.huds[DATA_HUD_SECURITY_ADVANCED]
REMOVE_TRAIT(user, TRAIT_SECURITY_HUD, HELMET_TRAIT)
sec_hud.hide_from(user)
balloon_alert(user, "hud disabled")
return ..()
+9 -8
View File
@@ -36,7 +36,6 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
var/health_scan = FALSE //Are health scans currently enabled?
var/chem_scan = FALSE //Are chem scans currently enabled?
var/gas_scan = FALSE //Are gas scans currently enabled?
var/list/datahuds = list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_ADVANCED) //list of data HUDs shown to ghosts.
var/ghost_orbit = GHOST_ORBIT_CIRCLE
//These variables store hair data if the ghost originates from a species with head and/or facial hair.
@@ -63,6 +62,13 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
/// The POI we're orbiting (orbit menu)
var/orbiting_ref
var/static/list/observer_hud_traits = list(
TRAIT_SECURITY_HUD,
TRAIT_MEDICAL_HUD,
TRAIT_DIAGNOSTIC_HUD,
TRAIT_BOT_PATH_HUD
)
/mob/dead/observer/Initialize(mapload)
set_invisibility(GLOB.observer_default_invisibility)
@@ -149,7 +155,6 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
SSpoints_of_interest.make_point_of_interest(src)
ADD_TRAIT(src, TRAIT_HEAR_THROUGH_DARKNESS, ref(src))
ADD_TRAIT(src, TRAIT_SECURITY_HUD, ref(src))
/mob/dead/observer/get_photo_description(obj/item/camera/camera)
if(!invisibility || camera.see_ghosts)
@@ -760,14 +765,10 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
return
/mob/dead/observer/proc/show_data_huds()
for(var/hudtype in datahuds)
var/datum/atom_hud/data_hud = GLOB.huds[hudtype]
data_hud.show_to(src)
add_traits(observer_hud_traits, REF(src))
/mob/dead/observer/proc/remove_data_huds()
for(var/hudtype in datahuds)
var/datum/atom_hud/data_hud = GLOB.huds[hudtype]
data_hud.hide_from(src)
remove_traits(observer_hud_traits, REF(src))
/mob/dead/observer/verb/toggle_data_huds()
set name = "Toggle Sec/Med/Diag HUD"
+1 -1
View File
@@ -88,7 +88,7 @@ GLOBAL_LIST_INIT(command_strings, list(
var/list/current_pathed_turfs = list()
///The type of data HUD the bot uses. Diagnostic by default.
var/data_hud_type = DATA_HUD_DIAGNOSTIC_BASIC
var/data_hud_type = DATA_HUD_DIAGNOSTIC
/// If true we will allow ghosts to control this mob
var/can_be_possessed = FALSE
/// Message to display upon possession
@@ -52,7 +52,7 @@
var/list/path_images = active_hud_list[DIAG_PATH_HUD]
LAZYCLEARLIST(path_images)
var/list/path_huds_watching_me = list(GLOB.huds[DATA_HUD_DIAGNOSTIC_ADVANCED])
var/list/path_huds_watching_me = list(GLOB.huds[DATA_HUD_DIAGNOSTIC], GLOB.huds[DATA_HUD_BOT_PATH])
var/atom/move_target = ai_controller.current_movement_target
if(move_target != ai_controller.blackboard[BB_BEACON_TARGET])
@@ -14,7 +14,7 @@
radio_key = /obj/item/encryptionkey/headset_service
radio_channel = RADIO_CHANNEL_SERVICE
bot_type = VIBE_BOT
data_hud_type = DATA_HUD_DIAGNOSTIC_BASIC
data_hud_type = DATA_HUD_DIAGNOSTIC
path_image_color = "#2cac12"
possessed_message = "You are a vibebot! Maintain the station's vibes to the best of your ability!"
+1 -3
View File
@@ -11,9 +11,7 @@
combat_mode = TRUE //so we always get pushed instead of trying to swap
sight = SEE_TURFS | SEE_MOBS | SEE_OBJS
hud_type = /datum/hud/ai
med_hud = DATA_HUD_MEDICAL_BASIC
sec_hud = DATA_HUD_SECURITY_BASIC
d_hud = DATA_HUD_DIAGNOSTIC_ADVANCED
silicon_huds = list(DATA_HUD_MEDICAL_BASIC, DATA_HUD_SECURITY_BASIC, DATA_HUD_DIAGNOSTIC, DATA_HUD_BOT_PATH)
mob_size = MOB_SIZE_LARGE
radio = /obj/item/radio/headset/silicon/ai
can_buckle_to = FALSE
+7 -15
View File
@@ -38,9 +38,7 @@
///Are our siliconHUDs on? TRUE for yes, FALSE for no.
var/sensors_on = TRUE
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
var/d_hud = DATA_HUD_DIAGNOSTIC_BASIC //Determines the diag hud to use
var/list/silicon_huds = list(DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_SECURITY_ADVANCED, DATA_HUD_DIAGNOSTIC)
var/law_change_counter = 0
var/obj/machinery/camera/builtInCamera = null
@@ -392,20 +390,14 @@
return -10
/mob/living/silicon/proc/remove_sensors()
var/datum/atom_hud/secsensor = GLOB.huds[sec_hud]
var/datum/atom_hud/medsensor = GLOB.huds[med_hud]
var/datum/atom_hud/diagsensor = GLOB.huds[d_hud]
secsensor.hide_from(src)
medsensor.hide_from(src)
diagsensor.hide_from(src)
for (var/hud_type in silicon_huds)
var/datum/atom_hud/silicon_hud = GLOB.huds[hud_type]
silicon_hud.hide_from(src)
/mob/living/silicon/proc/add_sensors()
var/datum/atom_hud/secsensor = GLOB.huds[sec_hud]
var/datum/atom_hud/medsensor = GLOB.huds[med_hud]
var/datum/atom_hud/diagsensor = GLOB.huds[d_hud]
secsensor.show_to(src)
medsensor.show_to(src)
diagsensor.show_to(src)
for (var/hud_type in silicon_huds)
var/datum/atom_hud/silicon_hud = GLOB.huds[hud_type]
silicon_hud.show_to(src)
/mob/living/silicon/proc/toggle_sensors()
if(incapacitated())
@@ -95,8 +95,8 @@
var/turf/nearest_beacon_loc
///The type of data HUD the bot uses. Diagnostic by default.
var/data_hud_type = DATA_HUD_DIAGNOSTIC_BASIC
var/datum/atom_hud/data/bot_path/path_hud
var/data_hud_type = DATA_HUD_DIAGNOSTIC
var/datum/atom_hud/data/bot_path/private/path_hud
var/path_image_icon = 'icons/mob/silicon/aibots.dmi'
var/path_image_icon_state = "path_indicator"
var/path_image_color = COLOR_WHITE
@@ -165,7 +165,7 @@
. = ..()
GLOB.bots_list += src
path_hud = new /datum/atom_hud/data/bot_path()
path_hud = new /datum/atom_hud/data/bot_path/private()
for(var/hud in path_hud.hud_icons) // You get to see your own path
set_hud_image_active(hud, exclusive_hud = path_hud)
@@ -1148,7 +1148,7 @@ Pass a positive integer as an argument to override a bot's default speed.
path = newpath ? newpath : list()
if(!path_hud)
return
var/list/path_huds_watching_me = list(GLOB.huds[DATA_HUD_DIAGNOSTIC_ADVANCED])
var/list/path_huds_watching_me = list(GLOB.huds[DATA_HUD_DIAGNOSTIC], GLOB.huds[DATA_HUD_BOT_PATH])
if(path_hud)
path_huds_watching_me += path_hud
for(var/datum/atom_hud/hud as anything in path_huds_watching_me)
+16
View File
@@ -92,6 +92,7 @@
AA.onNewMob(src)
set_nutrition(rand(NUTRITION_LEVEL_START_MIN, NUTRITION_LEVEL_START_MAX))
. = ..()
setup_hud_traits()
update_config_movespeed()
initialize_actionspeed()
update_movespeed(TRUE)
@@ -1598,3 +1599,18 @@
/mob/key_down(key, client/client, full_key)
..()
SEND_SIGNAL(src, COMSIG_MOB_KEYDOWN, key, client, full_key)
/mob/proc/setup_hud_traits()
for(var/hud_trait in GLOB.trait_to_hud)
RegisterSignal(src, SIGNAL_ADDTRAIT(hud_trait), PROC_REF(hud_trait_enabled))
RegisterSignal(src, SIGNAL_REMOVETRAIT(hud_trait), PROC_REF(hud_trait_disabled))
/mob/proc/hud_trait_enabled(datum/source, new_trait)
SIGNAL_HANDLER
var/datum/atom_hud/datahud = GLOB.huds[GLOB.trait_to_hud[new_trait]]
datahud.show_to(src)
/mob/proc/hud_trait_disabled(datum/source, new_trait)
SIGNAL_HANDLER
var/datum/atom_hud/datahud = GLOB.huds[GLOB.trait_to_hud[new_trait]]
datahud.hide_from(src)
+1 -12
View File
@@ -10,23 +10,15 @@
incompatible_modules = list(/obj/item/mod/module/visor)
cooldown_time = 0.5 SECONDS
required_slots = list(ITEM_SLOT_HEAD|ITEM_SLOT_EYES|ITEM_SLOT_MASK)
/// The HUD type given by the visor.
var/hud_type
/// The traits given by the visor.
var/list/visor_traits = list()
/obj/item/mod/module/visor/on_activation()
if(hud_type)
var/datum/atom_hud/hud = GLOB.huds[hud_type]
hud.show_to(mod.wearer)
if(length(visor_traits))
mod.wearer.add_traits(visor_traits, MOD_TRAIT)
mod.wearer.update_sight()
/obj/item/mod/module/visor/on_deactivation(display_message = TRUE, deleting = FALSE)
if(hud_type)
var/datum/atom_hud/hud = GLOB.huds[hud_type]
hud.hide_from(mod.wearer)
if(length(visor_traits))
mod.wearer.remove_traits(visor_traits, MOD_TRAIT)
mod.wearer.update_sight()
@@ -38,7 +30,6 @@
biological scanning suite, allowing the user to visualize the current health of organic lifeforms, as well as \
access data such as patient files in a convenient readout. They say these also let you see behind you."
icon_state = "medhud_visor"
hud_type = DATA_HUD_MEDICAL_ADVANCED
visor_traits = list(TRAIT_MEDICAL_HUD)
//Diagnostic Visor - Gives you a diagnostic HUD.
@@ -48,8 +39,7 @@
from advanced machinery, exosuits, and other devices, allowing the user to visualize current power levels \
and integrity of such. They say these also let you see behind you."
icon_state = "diaghud_visor"
hud_type = DATA_HUD_DIAGNOSTIC_ADVANCED
visor_traits = list(TRAIT_DIAGNOSTIC_HUD)
visor_traits = list(TRAIT_DIAGNOSTIC_HUD, TRAIT_BOT_PATH_HUD)
//Security Visor - Gives you a security HUD.
/obj/item/mod/module/visor/sechud
@@ -58,7 +48,6 @@
plugged into various criminal databases to be able to view arrest records, command simple security-oriented robots, \
and generally know who to shoot. They say these also let you see behind you."
icon_state = "sechud_visor"
hud_type = DATA_HUD_SECURITY_ADVANCED
visor_traits = list(TRAIT_SECURITY_HUD)
//Meson Visor - Gives you meson vision.
+2 -2
View File
@@ -230,11 +230,11 @@
var/datum/atom_hud/hud
var/hud_on
if(mode == PAI_TOGGLE_MEDICAL_HUD)
hud = GLOB.huds[med_hud]
hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
medHUD = !medHUD
hud_on = medHUD
if(mode == PAI_TOGGLE_SECURITY_HUD)
hud = GLOB.huds[sec_hud]
hud = GLOB.huds[DATA_HUD_SECURITY_ADVANCED]
secHUD = !secHUD
hud_on = secHUD
if(hud_on)
@@ -13,62 +13,47 @@
desc = "These cybernetic eyes will display a HUD over everything you see. Maybe."
slot = ORGAN_SLOT_HUD
actions_types = list(/datum/action/item_action/toggle_hud)
var/HUD_type = 0
var/HUD_trait = null
var/HUD_traits = list()
/// Whether the HUD implant is on or off
var/toggled_on = TRUE
/obj/item/organ/internal/cyberimp/eyes/hud/proc/toggle_hud(mob/living/carbon/eye_owner)
if(toggled_on)
if(HUD_type)
var/datum/atom_hud/hud = GLOB.huds[HUD_type]
hud.hide_from(eye_owner)
toggled_on = FALSE
eye_owner.add_traits(HUD_traits, ORGAN_TRAIT)
balloon_alert(eye_owner, "hud disabled")
else
if(HUD_type)
var/datum/atom_hud/hud = GLOB.huds[HUD_type]
hud.show_to(eye_owner)
toggled_on = TRUE
balloon_alert(eye_owner, "hud enabled")
return
toggled_on = TRUE
eye_owner.remove_traits(HUD_traits, ORGAN_TRAIT)
balloon_alert(eye_owner, "hud enabled")
/obj/item/organ/internal/cyberimp/eyes/hud/Insert(mob/living/carbon/eye_owner, special = FALSE, movement_flags)
. = ..()
if(!.)
return
if(HUD_type)
var/datum/atom_hud/hud = GLOB.huds[HUD_type]
hud.show_to(eye_owner)
if(HUD_trait)
ADD_TRAIT(eye_owner, HUD_trait, ORGAN_TRAIT)
eye_owner.add_traits(HUD_traits, ORGAN_TRAIT)
toggled_on = TRUE
/obj/item/organ/internal/cyberimp/eyes/hud/Remove(mob/living/carbon/eye_owner, special, movement_flags)
. = ..()
if(HUD_type)
var/datum/atom_hud/hud = GLOB.huds[HUD_type]
hud.hide_from(eye_owner)
if(HUD_trait)
REMOVE_TRAIT(eye_owner, HUD_trait, ORGAN_TRAIT)
eye_owner.remove_traits(HUD_traits, ORGAN_TRAIT)
toggled_on = FALSE
/obj/item/organ/internal/cyberimp/eyes/hud/medical
name = "Medical HUD implant"
desc = "These cybernetic eye implants will display a medical HUD over everything you see."
HUD_type = DATA_HUD_MEDICAL_ADVANCED
HUD_trait = TRAIT_MEDICAL_HUD
HUD_traits = list(TRAIT_MEDICAL_HUD)
/obj/item/organ/internal/cyberimp/eyes/hud/security
name = "Security HUD implant"
desc = "These cybernetic eye implants will display a security HUD over everything you see."
HUD_type = DATA_HUD_SECURITY_ADVANCED
HUD_trait = TRAIT_SECURITY_HUD
HUD_traits = list(TRAIT_SECURITY_HUD)
/obj/item/organ/internal/cyberimp/eyes/hud/diagnostic
name = "Diagnostic HUD implant"
desc = "These cybernetic eye implants will display a diagnostic HUD over everything you see."
HUD_type = DATA_HUD_DIAGNOSTIC_ADVANCED
HUD_traits = list(TRAIT_DIAGNOSTIC_HUD, TRAIT_BOT_PATH_HUD)
/obj/item/organ/internal/cyberimp/eyes/hud/security/syndicate
name = "Contraband Security HUD Implant"
@@ -15,20 +15,14 @@
/obj/vehicle/sealed/mecha/odysseus/moved_inside(mob/living/carbon/human/H)
. = ..()
if(. && !HAS_TRAIT(H, TRAIT_MEDICAL_HUD))
var/datum/atom_hud/hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
hud.show_to(H)
ADD_TRAIT(H, TRAIT_MEDICAL_HUD, VEHICLE_TRAIT)
/obj/vehicle/sealed/mecha/odysseus/remove_occupant(mob/living/carbon/human/H)
if(isliving(H) && HAS_TRAIT_FROM(H, TRAIT_MEDICAL_HUD, VEHICLE_TRAIT))
var/datum/atom_hud/med_hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
med_hud.hide_from(H)
REMOVE_TRAIT(H, TRAIT_MEDICAL_HUD, VEHICLE_TRAIT)
return ..()
/obj/vehicle/sealed/mecha/odysseus/mmi_moved_inside(obj/item/mmi/M, mob/user)
. = ..()
if(. && !HAS_TRAIT(M, TRAIT_MEDICAL_HUD))
var/datum/atom_hud/hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
var/mob/living/brain/B = M.brainmob
hud.show_to(B)
ADD_TRAIT(M, TRAIT_MEDICAL_HUD, VEHICLE_TRAIT)