diff --git a/code/datums/actions/items/toggles.dm b/code/datums/actions/items/toggles.dm index bbdd2e9f7b9..53c9e4f53cc 100644 --- a/code/datums/actions/items/toggles.dm +++ b/code/datums/actions/items/toggles.dm @@ -80,6 +80,17 @@ return FALSE return ..() +/datum/action/item_action/toggle_hud + name = "Toggle Implant HUD" + desc = "Disables your HUD implant's visuals. You can still access examine information." + +/datum/action/item_action/toggle_hud/Trigger(trigger_flags) + . = ..() + if(!.) + return + var/obj/item/organ/internal/cyberimp/eyes/hud/hud_implant = target + hud_implant.toggle_hud(owner) + /datum/action/item_action/wheelys name = "Toggle Wheels" desc = "Pops out or in your shoes' wheels." diff --git a/code/modules/surgery/organs/internal/cyberimp/augments_eyes.dm b/code/modules/surgery/organs/internal/cyberimp/augments_eyes.dm index 352d4237cc0..869d4cc1c9e 100644 --- a/code/modules/surgery/organs/internal/cyberimp/augments_eyes.dm +++ b/code/modules/surgery/organs/internal/cyberimp/augments_eyes.dm @@ -12,8 +12,24 @@ name = "HUD implant" 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 + /// 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 + else + if(HUD_type) + var/datum/atom_hud/hud = GLOB.huds[HUD_type] + hud.show_to(eye_owner) + toggled_on = TRUE /obj/item/organ/internal/cyberimp/eyes/hud/Insert(mob/living/carbon/eye_owner, special = FALSE, drop_if_replaced = TRUE) . = ..() @@ -24,6 +40,7 @@ hud.show_to(eye_owner) if(HUD_trait) ADD_TRAIT(eye_owner, HUD_trait, ORGAN_TRAIT) + toggled_on = TRUE /obj/item/organ/internal/cyberimp/eyes/hud/Remove(mob/living/carbon/eye_owner, special = FALSE) . = ..() @@ -32,6 +49,7 @@ hud.hide_from(eye_owner) if(HUD_trait) REMOVE_TRAIT(eye_owner, HUD_trait, ORGAN_TRAIT) + toggled_on = FALSE /obj/item/organ/internal/cyberimp/eyes/hud/medical name = "Medical HUD implant"