From 9243cb66b7a73249bc85afa38346e97bf2925f2d Mon Sep 17 00:00:00 2001 From: Vero <73014819+vero5123@users.noreply.github.com> Date: Sat, 20 Apr 2024 00:21:33 -0400 Subject: [PATCH] Toggle ghost now leaves the users mob visible (#6065) # About the pull request Fixes #5894 # Explain why it's good for the game bug fix # Changelog :cl: fix: toggling ghost vision now keeps the user's mob visible. /:cl: --------- Co-authored-by: DOOM --- code/__DEFINES/__game.dm | 2 ++ code/modules/mob/dead/observer/observer.dm | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/code/__DEFINES/__game.dm b/code/__DEFINES/__game.dm index 6a9e9f1d4623..6617c5aafcee 100644 --- a/code/__DEFINES/__game.dm +++ b/code/__DEFINES/__game.dm @@ -78,6 +78,8 @@ #define SEE_INVISIBLE_LEVEL_TWO 45 //Used by some other stuff in code. It's really poorly organized. #define INVISIBILITY_LEVEL_TWO 45 //Used by some other stuff in code. It's really poorly organized. +#define HIDE_INVISIBLE_OBSERVER 59 // define for when we want to hide all observer mobs. + #define INVISIBILITY_OBSERVER 60 #define SEE_INVISIBLE_OBSERVER 60 diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 4f9493cfdf49..d93aeef63143 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -37,6 +37,7 @@ /// If the observer is an admin, are they excluded from the xeno queue? var/admin_larva_protection = TRUE // Enabled by default var/ghostvision = TRUE + var/self_visibility = TRUE var/can_reenter_corpse var/started_as_observer //This variable is set to 1 when you enter the game as an observer. //If you died in the game and are a ghost - this will remain as null. @@ -71,10 +72,10 @@ set desc = "Toggles your ability to see things only ghosts can see, like other ghosts" set category = "Ghost.Settings" ghostvision = !ghostvision - if(hud_used) - var/atom/movable/screen/plane_master/lighting/lighting = hud_used.plane_masters["[GHOST_PLANE]"] - if (lighting) - lighting.alpha = ghostvision? 255 : 0 + if(ghostvision) + see_invisible = INVISIBILITY_OBSERVER + else + see_invisible = HIDE_INVISIBLE_OBSERVER to_chat(usr, SPAN_NOTICE("You [(ghostvision?"now":"no longer")] have ghost vision.")) /mob/dead/observer/Initialize(mapload, mob/body) @@ -845,11 +846,12 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/dead/observer/verb/toggle_self_visibility() set name = "Toggle Self Visibility" set category = "Ghost.Settings" - - if (alpha) - alpha = 0 - else + self_visibility = !self_visibility + if (self_visibility) alpha = initial(alpha) + else + alpha = 0 + to_chat(usr, SPAN_NOTICE("You are now [(self_visibility?"visible":"invisible")].")) /mob/dead/observer/verb/view_manifest() set name = "View Crew Manifest"