Fixes #772 Toggling darkness off prevents ghosts from seeing one another.

Abuses client.images to get around the issue with flat see_invisible scaling not allowing for both being able to see ghosts while not seeing darkness layers.
This commit is contained in:
MrStonedOne
2015-02-28 10:12:16 -08:00
parent 4475f541b9
commit 0257dbfc9a
3 changed files with 32 additions and 0 deletions
+6
View File
@@ -2,4 +2,10 @@
..()
if(client.prefs.unlock_content)
icon_state = client.prefs.ghost_form
if (ghostimage)
ghostimage.icon_state = src.icon_state
updateghostimages()
update_interface()
+1
View File
@@ -1,4 +1,5 @@
/mob/dead/observer/Logout()
client.images -= ghostimages
..()
spawn(0)
if(src && !key) //we've transferred to another mob. This ghost should be deleted.
@@ -1,3 +1,4 @@
var/list/image/ghostimages = list() //this is a list of images of other ghosts that ghosts see when they toggle darkness
/mob/dead/observer
name = "ghost"
desc = "It's a g-g-g-g-ghooooost!" //jinkies!
@@ -18,6 +19,7 @@
//Note that this is not a reliable way to determine if admins started as observers, since they change mobs a lot.
var/atom/movable/following = null
var/fun_verbs = 0
var/image/ghostimage = null
/mob/dead/observer/New(mob/body)
sight |= SEE_TURFS | SEE_MOBS | SEE_OBJS | SEE_SELF
@@ -26,6 +28,9 @@
verbs += /mob/dead/observer/proc/dead_tele
stat = DEAD
ghostimage = image(src.icon,src,src.icon_state)
ghostimages |= ghostimage
var/turf/T
if(ismob(body))
T = get_turf(body) //Where is the body located?
@@ -54,8 +59,14 @@
verbs -= /mob/dead/observer/verb/possess
animate(src, pixel_y = 2, time = 10, loop = -1)
updateallghostimages()
..()
/mob/dead/observer/Destroy()
ghostimages -= ghostimage
qdel(ghostimage)
updateallghostimages()
..()
/mob/dead/CanPass(atom/movable/mover, turf/target, height=0)
return 1
@@ -262,6 +273,20 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
see_invisible = SEE_INVISIBLE_OBSERVER
else
see_invisible = SEE_INVISIBLE_OBSERVER_NOLIGHTING
updateghostimages()
/mob/dead/observer/proc/updateallghostimages()
for (var/mob/dead/observer/O in player_list)
O.updateghostimages()
/mob/dead/observer/proc/updateghostimages()
if (!client)
return
if (see_invisible >= SEE_INVISIBLE_OBSERVER)
client.images -= ghostimages
else
client.images |= ghostimages //add images for all the ghosts so we can see them
client.images -= ghostimage //remove ourself
/mob/dead/observer/verb/possess()
set category = "Ghost"