Re-add ghost space transitions, add ghost z level registering

This commit is contained in:
Mark van Alphen
2019-05-23 19:35:35 +02:00
parent b1acfe3c87
commit 8fed0ac75c
3 changed files with 37 additions and 1 deletions

View File

@@ -6,12 +6,14 @@ SUBSYSTEM_DEF(mobs)
var/list/currentrun = list()
var/static/list/clients_by_zlevel[][]
var/static/list/dead_players_by_zlevel[][] = list(list()) // Needs to support zlevel 1 here, MaxZChanged only happens when z2 is created and new_players can login before that.
/datum/controller/subsystem/mobs/stat_entry()
..("P:[GLOB.mob_list.len]")
/datum/controller/subsystem/mobs/Initialize(start_timeofday)
clients_by_zlevel = new /list(world.maxz,0)
dead_players_by_zlevel = new /list(world.maxz,0)
return ..()
/datum/controller/subsystem/mobs/fire(resumed = 0)

View File

@@ -252,3 +252,8 @@
/turf/space/proc/remove_transitions()
destination_z = initial(destination_z)
/turf/space/attack_ghost(mob/dead/observer/user)
if(destination_z)
var/turf/T = locate(destination_x, destination_y, destination_z)
user.forceMove(T)

View File

@@ -1,4 +1,33 @@
/mob/dead/Login()
. = ..()
var/turf/T = get_turf(src)
if (isturf(T))
update_z(T.z)
/mob/dead/Logout()
update_z(null)
return ..()
/mob/dead/forceMove(atom/destination)
var/turf/old_turf = get_turf(src)
var/turf/new_turf = get_turf(destination)
if (old_turf?.z != new_turf?.z)
onTransitZ(old_turf?.z, new_turf?.z)
var/oldloc = loc
loc = destination
Moved(oldloc, NONE, TRUE)
Moved(oldloc, NONE, TRUE)
/mob/dead/onTransitZ(old_z,new_z)
..()
update_z(new_z)
/mob/dead/proc/update_z(new_z) // 1+ to register, null to unregister
if (registered_z != new_z)
if (registered_z)
SSmobs.dead_players_by_zlevel[registered_z] -= src
if (client)
if (new_z)
SSmobs.dead_players_by_zlevel[new_z] += src
registered_z = new_z
else
registered_z = null