Deprecates hud_trait where possible, introduces lists where not (#25204)

* screaming

* woop woop

* Update hud.dm

* Update modular_skyrat/modules/modular_items/code/modular_glasses.dm

Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>

---------

Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
This commit is contained in:
Waterpig
2023-11-23 15:53:50 -05:00
committed by GitHub
co-authored by Bloop
parent 1787cc4d69
commit 83f49e0970
3 changed files with 22 additions and 22 deletions
@@ -21,7 +21,7 @@
name = "security eyepatch HUD"
desc = "Lost your eye beating an innocent clown? Thankfully your corporate overlords have made something to make up for this. May not do well against flashes."
hud_type = DATA_HUD_SECURITY_ADVANCED
hud_trait = TRAIT_SECURITY_HUD
clothing_traits = list(TRAIT_SECURITY_HUD)
glass_colour_type = /datum/client_colour/glass_colour/blue
unique_reskin = list(
@@ -40,7 +40,7 @@
icon_state = "medpatch"
base_icon_state = "medpatch"
hud_type = DATA_HUD_MEDICAL_ADVANCED
hud_trait = TRAIT_MEDICAL_HUD
clothing_traits = list(TRAIT_MEDICAL_HUD)
glass_colour_type = /datum/client_colour/glass_colour/lightblue
unique_reskin = list(
@@ -82,7 +82,7 @@
icon_state = "robopatch"
base_icon_state = "robopatch"
hud_type = DATA_HUD_DIAGNOSTIC_BASIC
hud_trait = TRAIT_DIAGNOSTIC_HUD
clothing_traits = list(TRAIT_DIAGNOSTIC_HUD)
glass_colour_type = /datum/client_colour/glass_colour/lightorange
unique_reskin = list(
@@ -9,8 +9,8 @@
var/eyewear_check = TRUE
/// What kind of HUD are we adding when the NIFSoft is activated?
var/hud_type
/// What is the HUD trait we are adding when the NIFSoft is activated?
var/hud_trait
/// What are the HUD traits we are adding when the NIFSoft is activated?
var/list/hud_traits
/// A list of traits that we want to add while the NIFSoft is active. This is here to emulate things like sci-goggles
var/list/added_eyewear_traits = list()
@@ -20,8 +20,8 @@
var/datum/atom_hud/our_hud = GLOB.huds[hud_type]
our_hud.show_to(linked_mob)
if(hud_trait)
ADD_TRAIT(linked_mob, hud_trait, GLASSES_TRAIT)
for(var/trait in hud_traits)
ADD_TRAIT(linked_mob, trait, GLASSES_TRAIT)
for(var/trait as anything in added_eyewear_traits)
ADD_TRAIT(linked_mob, trait, TRAIT_NIFSOFT)
@@ -34,8 +34,8 @@
var/datum/atom_hud/hud = GLOB.huds[hud_type]
hud.hide_from(linked_mob)
if(hud_trait)
REMOVE_TRAIT(linked_mob, hud_trait, TRAIT_NIFSOFT)
for(var/trait in hud_traits)
REMOVE_TRAIT(linked_mob, trait, TRAIT_NIFSOFT)
for(var/trait in added_eyewear_traits)
REMOVE_TRAIT(linked_mob, trait, TRAIT_NIFSOFT)
@@ -100,19 +100,19 @@
name = "Medical Scrying Lens"
ui_icon = "staff-snake"
hud_type = DATA_HUD_MEDICAL_ADVANCED
hud_trait = TRAIT_MEDICAL_HUD
hud_traits = list(TRAIT_MEDICAL_HUD)
/datum/nifsoft/hud/job/diagnostic
name = "Diagnostic Scrying Lens"
ui_icon = "robot"
hud_type = DATA_HUD_DIAGNOSTIC_BASIC
hud_trait = TRAIT_DIAGNOSTIC_HUD
hud_traits = list(TRAIT_DIAGNOSTIC_HUD)
/datum/nifsoft/hud/job/security
name = "Security Scrying Lens"
ui_icon = "shield"
hud_type = DATA_HUD_SECURITY_ADVANCED
hud_trait = TRAIT_SECURITY_HUD
hud_traits = list(TRAIT_SECURITY_HUD)
/datum/nifsoft/hud/job/cargo_tech
name = "Permit Scrying Lens"
@@ -90,7 +90,8 @@
if(human.glasses == src)
var/datum/atom_hud/our_hud = GLOB.huds[initial(glasses_type.hud_type)]
our_hud.show_to(human)
ADD_TRAIT(human, initial(glasses_type.hud_trait), GLASSES_TRAIT)
for(var/trait in initial(glasses_type.clothing_traits))
ADD_TRAIT(human, trait, GLASSES_TRAIT)
/obj/item/clothing/glasses/hud/ar/proc/remove_hud(mob/user)
if(ishuman(user)) // Make sure they're a human wearing the glasses first
@@ -98,7 +99,8 @@
if(human.glasses == src)
var/datum/atom_hud/our_hud = GLOB.huds[initial(glasses_type.hud_type)]
our_hud.hide_from(human)
REMOVE_TRAIT(human, initial(glasses_type.hud_trait), GLASSES_TRAIT)
for(var/trait in initial(glasses_type.clothing_traits))
REMOVE_TRAIT(human, trait, GLASSES_TRAIT)
/obj/item/clothing/glasses/hud/ar/proc/reset_vars()
worn_icon = initial(glasses_type.worn_icon)
@@ -108,7 +110,6 @@
color_cutoffs = initial(glasses_type.color_cutoffs)
vision_flags = initial(glasses_type.vision_flags)
hud_type = initial(glasses_type.hud_type)
hud_trait = initial(glasses_type.hud_trait)
//initial does not currently work on lists so we must do this
var/obj/item/clothing/glasses/hud/ar/glasses_object = new glasses_type // make a temporary glasses obj
clothing_traits = glasses_object.clothing_traits // pull the list from the created obj
@@ -119,7 +120,6 @@
color_cutoffs = null // Resets lighting_alpha to user's default one
clothing_traits = null /// also disables the options for Science functionality
hud_type = null
hud_trait = null
/// Create new icon and worn_icon, with only the first frame of every state and setting that as icon.
/// this practically freezes the animation :)
@@ -165,7 +165,7 @@
off_state = "aviator_sec_flash"
flash_protect = FLASH_PROTECTION_NONE
hud_type = DATA_HUD_SECURITY_ADVANCED
hud_trait = TRAIT_SECURITY_HUD
clothing_traits = list(TRAIT_SECURITY_HUD)
glass_colour_type = /datum/client_colour/glass_colour/red
modes = list(MODE_OFF_FLASH_PROTECTION, MODE_ON)
modes_msg = list(MODE_OFF_FLASH_PROTECTION = "flash protection mode", MODE_ON = "optical matrix enabled")
@@ -177,7 +177,7 @@
icon_state = "aviator_med"
flash_protect = FLASH_PROTECTION_NONE
hud_type = DATA_HUD_MEDICAL_ADVANCED
hud_trait = TRAIT_MEDICAL_HUD
clothing_traits = list(TRAIT_MEDICAL_HUD)
glass_colour_type = /datum/client_colour/glass_colour/lightblue
// (Normal) meson scanner Aviators
@@ -198,7 +198,7 @@
icon_state = "aviator_diagnostic"
flash_protect = FLASH_PROTECTION_NONE
hud_type = DATA_HUD_DIAGNOSTIC_BASIC
hud_trait = TRAIT_DIAGNOSTIC_HUD
clothing_traits = list(TRAIT_DIAGNOSTIC_HUD)
glass_colour_type = /datum/client_colour/glass_colour/lightorange
// Science Aviators
@@ -264,19 +264,19 @@
name = "retinal projector health HUD"
icon_state = "projector_med"
hud_type = DATA_HUD_MEDICAL_ADVANCED
hud_trait = list(ID_HUD, TRAIT_MEDICAL_HUD)
clothing_traits = list(ID_HUD, TRAIT_MEDICAL_HUD)
/obj/item/clothing/glasses/hud/ar/projector/security
name = "retinal projector security HUD"
icon_state = "projector_sec"
hud_type = DATA_HUD_SECURITY_ADVANCED
hud_trait = TRAIT_SECURITY_HUD
clothing_traits = list(TRAIT_SECURITY_HUD)
/obj/item/clothing/glasses/hud/ar/projector/diagnostic
name = "retinal projector diagnostic HUD"
icon_state = "projector_diagnostic"
hud_type = DATA_HUD_DIAGNOSTIC_BASIC
hud_trait = TRAIT_DIAGNOSTIC_HUD
clothing_traits = list(TRAIT_DIAGNOSTIC_HUD)
/obj/item/clothing/glasses/hud/ar/projector/science
name = "science retinal projector"