Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Deprecates hud_trait where possible, introduces lists where not #802

Merged
merged 2 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
18 changes: 9 additions & 9 deletions modular_skyrat/modules/modular_implants/code/nifsofts/huds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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"
Expand Down
20 changes: 10 additions & 10 deletions modular_skyrat/modules/modular_items/code/modular_glasses.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,17 @@
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
var/mob/living/carbon/human/human = user
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)
Expand All @@ -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
Expand All @@ -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 :)
Expand Down Expand Up @@ -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")
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down
Loading