Skip to content

Commit

Permalink
Toggle ghost now leaves the users mob visible (#6065)
Browse files Browse the repository at this point in the history
# 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 <N/A>
  • Loading branch information
vero5123 authored Apr 20, 2024
1 parent b896706 commit 9243cb6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/__game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 10 additions & 8 deletions code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 9243cb6

Please sign in to comment.