Move openspace object updating to event listeners

This commit is contained in:
Aronai Sieyes
2020-05-19 14:21:25 -04:00
parent 49c00572c9
commit ce31fbdef3
2 changed files with 15 additions and 16 deletions
+15
View File
@@ -39,15 +39,30 @@
..()
update()
/turf/simulated/open/ChangeTurf()
var/turf/T = GetBelow(src)
if(T)
GLOB.turf_entered_event.unregister(T, src, .proc/BelowOpenUpdated)
GLOB.turf_exited_event.unregister(T, src, .proc/BelowOpenUpdated)
. = ..()
/turf/simulated/open/Initialize()
. = ..()
ASSERT(HasBelow(z))
update()
var/turf/T = GetBelow(src)
if(T)
GLOB.turf_entered_event.register(T, src, .proc/BelowOpenUpdated)
GLOB.turf_exited_event.register(T, src, .proc/BelowOpenUpdated)
/turf/simulated/open/Entered(var/atom/movable/mover)
. = ..()
mover.fall()
/turf/simulated/open/proc/BelowOpenUpdated(turf/T, atom/movable/AM, old_loc)
if(isobj(AM) && GLOB.open_space_initialised && !AM.invisibility)
SSopen_space.add_turf(src, 1)
// Called when thrown object lands on this turf.
/turf/simulated/open/hitby(var/atom/movable/AM, var/speed)
. = ..()