Adds screen hud elements for ghost toggles (#94570)

## About The Pull Request

On the bottom right of the ghost hud, there will be buttons to toggle
the various ghost hud changes

<img width="253" height="130" alt="image"
src="https://github.com/user-attachments/assets/98e66f4f-b211-4d45-9f18-382d4a50de37"
/>

- Darkness level
- Atmos click scan
- Heath click scan
- Chem click scan
- Data huds
- Tray scan
- Ghost vision

## Why It's Good For The Game

Provides an easy place to toggle things without needing to fish though a
side panel or UI, or type something in chat.
Plus shows you at a glance what you all have on. 

## Changelog

🆑 Melbert
add: Adds screen hud elements for ghost toggles
/🆑
This commit is contained in:
MrMelbert
2025-12-30 22:01:30 +01:00
committed by GitHub
parent b4a1973a82
commit 88cc7e80a6
5 changed files with 121 additions and 21 deletions
+1 -10
View File
@@ -159,16 +159,7 @@ GLOBAL_DATUM_INIT(ghost_menu, /datum/ghost_menu, new)
user.update_sight()
/datum/ghost_menu/proc/toggle_hud_type(mob/dead/observer/user, hud_type)
user.ghost_hud_flags ^= hud_type
//special aftereffects for specific flags.
switch(hud_type)
if(GHOST_VISION)
user.update_sight()
if(GHOST_DATA_HUDS)
if(user.ghost_hud_flags & GHOST_DATA_HUDS)
user.show_data_huds()
else
user.remove_data_huds()
user.toggle_ghost_hud_flag(hud_type)
/datum/ghost_menu/proc/restore_ghost_appearance(mob/dead/observer/user)
user.set_ghost_appearance()
+23 -10
View File
@@ -40,7 +40,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
///Flags of huds the ghost currently has enabled, data huds & ghost vision by default.
///Selection: GHOST_DATA_HUDS | GHOST_VISION | GHOST_HEALTH | GHOST_CHEM | GHOST_GAS
var/ghost_hud_flags = GHOST_DATA_HUDS | GHOST_VISION
var/ghost_hud_flags = NONE
///The shape the ghost will make while orbiting mobs.
var/ghost_orbit = GHOST_ORBIT_CIRCLE
@@ -145,7 +145,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
grant_all_languages()
setup_hud_traits()
show_data_huds()
toggle_ghost_hud_flag(GHOST_VISION | GHOST_DATA_HUDS)
SSpoints_of_interest.make_point_of_interest(src)
ADD_TRAIT(src, TRAIT_HEAR_THROUGH_DARKNESS, INNATE_TRAIT)
@@ -524,7 +524,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
/mob/dead/observer/verb/toggle_ghostsee()
set name = "Toggle Ghost Vision"
ghost_hud_flags ^= GHOST_VISION
toggle_ghost_hud_flag(GHOST_VISION)
update_sight()
to_chat(usr, span_boldnotice("You [(ghost_hud_flags & GHOST_VISION) ? "now" : "no longer"] have ghost vision."))
@@ -590,18 +590,16 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
/mob/dead/observer/verb/toggle_data_huds()
set name = "Toggle Sec/Med/Diag HUD"
ghost_hud_flags ^= GHOST_DATA_HUDS
toggle_ghost_hud_flag(GHOST_DATA_HUDS)
if(ghost_hud_flags & GHOST_DATA_HUDS)
show_data_huds()
to_chat(src, span_notice("Data HUDs enabled."))
else
remove_data_huds()
to_chat(src, span_notice("Data HUDs disabled."))
/mob/dead/observer/verb/toggle_health_scan()
set name = "Toggle Health Scan"
ghost_hud_flags ^= GHOST_HEALTH
toggle_ghost_hud_flag(GHOST_HEALTH)
if(ghost_hud_flags & GHOST_HEALTH)
to_chat(src, span_notice("Health scan enabled."))
else
@@ -610,7 +608,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
/mob/dead/observer/verb/toggle_chem_scan()
set name = "Toggle Chem Scan"
ghost_hud_flags ^= GHOST_CHEM
toggle_ghost_hud_flag(GHOST_CHEM)
if(ghost_hud_flags & GHOST_CHEM)
to_chat(src, span_notice("Chem scan enabled."))
else
@@ -619,7 +617,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
/mob/dead/observer/verb/toggle_gas_scan()
set name = "Toggle Gas Scan"
ghost_hud_flags ^= GHOST_GAS
toggle_ghost_hud_flag(GHOST_GAS)
if(ghost_hud_flags & GHOST_GAS)
to_chat(src, span_notice("Gas scan enabled."))
else
@@ -636,6 +634,18 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
mind.ghostname = real_name
name = real_name
/// Toggles a flag from ghost hud and updates the mob accordingly
/mob/dead/observer/proc/toggle_ghost_hud_flag(toggled)
ghost_hud_flags ^= toggled
if(ghost_hud_flags & GHOST_DATA_HUDS)
show_data_huds()
else
remove_data_huds()
update_sight()
for(var/atom/movable/screen/ghost/hudbox/hud in hud_used?.static_inventory)
if(hud.relevant_flag & toggled)
hud.update_appearance(UPDATE_ICON_STATE)
// This is the ghost's follow verb with an argument
/mob/dead/observer/proc/ManualFollow(atom/movable/target)
if (!istype(target) || (is_secret_level(target.z) && !client?.holder))
@@ -702,7 +712,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
else
set_invis_see(SEE_INVISIBLE_OBSERVER)
updateghostimages()
..()
@@ -828,9 +837,13 @@ 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()
PRIVATE_PROC(TRUE)
ghost_hud_flags |= GHOST_DATA_HUDS // only for safety, it should be set already.
add_traits(observer_hud_traits, REF(src))
/mob/dead/observer/proc/remove_data_huds()
PRIVATE_PROC(TRUE)
ghost_hud_flags &= ~GHOST_DATA_HUDS // only for safety, it should be unset already.
remove_traits(observer_hud_traits, REF(src))
/mob/dead/observer/proc/set_ghost_appearance()