From 220698306783555823761ad899cf70c6b556364d Mon Sep 17 00:00:00 2001 From: Waterpig <49160555+Majkl-J@users.noreply.github.com> Date: Thu, 23 Nov 2023 21:53:50 +0100 Subject: [PATCH] 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> --- .../modules/clothing/glasses/hud.dm | 6 +++--- .../modular_implants/code/nifsofts/huds.dm | 19 +++++++++++------- .../modular_items/code/modular_glasses.dm | 20 +++++++++---------- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/modular_skyrat/modules/customization/modules/clothing/glasses/hud.dm b/modular_skyrat/modules/customization/modules/clothing/glasses/hud.dm index 7cd1b38c6be..69df3d6539c 100644 --- a/modular_skyrat/modules/customization/modules/clothing/glasses/hud.dm +++ b/modular_skyrat/modules/customization/modules/clothing/glasses/hud.dm @@ -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( diff --git a/modular_skyrat/modules/modular_implants/code/nifsofts/huds.dm b/modular_skyrat/modules/modular_implants/code/nifsofts/huds.dm index 77353910752..719a87c44b5 100644 --- a/modular_skyrat/modules/modular_implants/code/nifsofts/huds.dm +++ b/modular_skyrat/modules/modular_implants/code/nifsofts/huds.dm @@ -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, NIFSOFT_TRAIT) @@ -34,8 +34,13 @@ var/datum/atom_hud/hud = GLOB.huds[hud_type] hud.hide_from(linked_mob) +<<<<<<< HEAD if(hud_trait) REMOVE_TRAIT(linked_mob, hud_trait, NIFSOFT_TRAIT) +======= + for(var/trait in hud_traits) + REMOVE_TRAIT(linked_mob, trait, TRAIT_NIFSOFT) +>>>>>>> 83f49e097 (Deprecates hud_trait where possible, introduces lists where not (#25204)) for(var/trait in added_eyewear_traits) REMOVE_TRAIT(linked_mob, trait, NIFSOFT_TRAIT) @@ -100,19 +105,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" diff --git a/modular_skyrat/modules/modular_items/code/modular_glasses.dm b/modular_skyrat/modules/modular_items/code/modular_glasses.dm index f35bb33433d..96272393a1f 100644 --- a/modular_skyrat/modules/modular_items/code/modular_glasses.dm +++ b/modular_skyrat/modules/modular_items/code/modular_glasses.dm @@ -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"