isopenturf() macro, update_above improvements (#2931)

changes:

Added a isopenturf() macro, equivalent to istype(thing, /turf/simulated/open).
Converted most/all instances of istype(/turf/simulated/open) to isopenturf().
Made update_above()' aware of queue status & inlined a proc-call.
This commit is contained in:
Lohikar
2017-07-03 04:04:18 -05:00
committed by skull132
parent d0fcc77f31
commit 9c010f92d1
18 changed files with 29 additions and 33 deletions
+1 -1
View File
@@ -425,7 +425,7 @@ var/global/movement_disabled_exception //This is the client that calls the proc,
for(var/obj/machinery/door/airlock/A in machines)
var/turf/T = get_turf(A)
if(istype(T, /turf/space) || istype(T, /turf/simulated/floor/asteroid) || istype(T, /turf/simulated/open) || T.density)
if(istype(T, /turf/space) || istype(T, /turf/simulated/floor/asteroid) || isopenturf(T) || T.density)
usr << "Airlock [A] with bad turf at ([A.x],[A.y],[A.z]) in [T.loc]."
/client/proc/get_bad_fdoors()
@@ -590,7 +590,7 @@
return 0
var/turf/leapEnd = get_step(TA, H.dir)
if (!leapEnd || istype(leapEnd, /turf/simulated/open) || istype(leapEnd, /turf/space)\
if (!leapEnd || isopenturf(leapEnd) || istype(leapEnd, /turf/space)\
|| leapEnd.density || leapEnd.contains_dense_objects())
to_chat(H, "<span class='warning'>There is no valid ledge to scale ahead of you!</span>")
return 0
+1 -1
View File
@@ -342,7 +342,7 @@
turfs += T
if (istype(T, /turf/simulated/open) && T:below)
if (isopenturf(T) && T:below)
T = T:below // Consider the turf below us as well. (Z-lights)
goto check_t
@@ -76,7 +76,7 @@
CHECK_TICK
if (istype(T, /turf/simulated/open) && T:below)
if (isopenturf(T) && T:below)
T = T:below
goto check_t
+2 -2
View File
@@ -12,7 +12,7 @@
/obj/item/weapon/ladder_mobile/proc/place_ladder(atom/A, mob/user)
if (istype(A, /turf/simulated/open)) //Place into open space
if (isopenturf(A)) //Place into open space
var/turf/below_loc = GetBelow(A)
if (!below_loc || (istype(/turf/space, below_loc)))
to_chat(user, "<span class='notice'>Why would you do that?! There is only infinite space there...</span>")
@@ -33,7 +33,7 @@
else if (istype(A, /turf/simulated/floor)) //Place onto Floor
var/turf/upper_loc = GetAbove(A)
if (!upper_loc || !istype(upper_loc,/turf/simulated/open))
if (!upper_loc || !isopenturf(upper_loc))
user << "<span class='notice'>There is something above. You can't deploy!</span>"
return
user.visible_message("<span class='warning'>[user] begins deploying \the [src] on \the [A].</span>",
+6 -12
View File
@@ -7,7 +7,7 @@
/turf/Entered(atom/movable/thing, atom/oldLoc)
. = ..()
if (above && !thing.no_z_overlay && !thing.bound_overlay && !istype(oldLoc, /turf/simulated/open))
if (above && !thing.no_z_overlay && !thing.bound_overlay && !isopenturf(oldLoc))
above.update_icon()
/turf/Destroy()
@@ -43,8 +43,11 @@
return
// check_existence returns TRUE if the overlay is valid.
if (bound_overlay.check_existence() && !bound_overlay.queued)
if (isopenturf(bound_overlay.loc) && !bound_overlay.queued)
SSopenturf.queued_overlays += bound_overlay
bound_overlay.queued = TRUE
else
qdel(bound_overlay)
/atom/movable/proc/get_above_oo()
. = list()
@@ -136,22 +139,13 @@
/atom/movable/openspace/overlay/forceMove(atom/dest)
. = ..()
if (istype(dest, /turf/simulated/open))
if (isopenturf(dest))
if (destruction_timer)
deltimer(destruction_timer)
destruction_timer = null
else if (!destruction_timer)
destruction_timer = addtimer(CALLBACK(GLOBAL_PROC, /proc/qdel, src), 10 SECONDS, TIMER_STOPPABLE)
// Checks if we've moved off of an openturf.
// Returns TRUE if we're continuing to exist, FALSE if we're deleting ourselves.
/atom/movable/openspace/overlay/proc/check_existence()
if (!istype(loc, /turf/simulated/open))
qdel(src)
return FALSE
else
return TRUE
// Called when the turf we're on is deleted/changed.
/atom/movable/openspace/overlay/proc/owning_turf_changed()
if (!destruction_timer)
+1 -1
View File
@@ -666,7 +666,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
return
///// Z-Level Stuff
// check if the target is open space
if(istype(F, /turf/simulated/open))
if(isopenturf(F))
for(var/obj/structure/cable/LC in F)
if((LC.d1 == dirn && LC.d2 == 11 ) || ( LC.d2 == dirn && LC.d1 == 11))
user << "<span class='warning'>There's already a cable at that position.</span>"