Shuttle refactor (#2171)

Rewrites the area movement code used by shuttles & elevators in an effort to make it faster, more extensible, and generally easier to read. Also fixes some bugs relating to lighting & moving areas, such as lighting overlays suddenly being teleported into space for absolutely no reason.

Fixes #2161.
Fixes #2166.
This commit is contained in:
Lohikar
2017-05-05 10:16:53 +03:00
committed by skull132
parent a14654b197
commit 52a4f3a4e3
14 changed files with 204 additions and 292 deletions
+8 -8
View File
@@ -30,7 +30,10 @@
update_overlay()
/atom/movable/lighting_overlay/Destroy()
/atom/movable/lighting_overlay/Destroy(force = FALSE)
if (!force)
return QDEL_HINT_LETMELIVE // STOP DELETING ME
L_PROF(loc, "overlay_destroy")
SSlighting.lighting_overlays -= src
SSlighting.overlay_queue -= src
@@ -54,13 +57,7 @@
else
warning("A lighting overlay realised it was in nullspace in update_overlay() and got deleted!")
qdel(src)
return
if (istype(T, /turf/space))
// I mean, this happens often and doesn't do any harm. Might as well silence the warning.
//warning("A lighting overlay realised it was attached to a space tile and got pooled!")
qdel(src)
qdel(src, TRUE)
return
// To the future coder who sees this and thinks
@@ -154,3 +151,6 @@
color = LIGHTING_BASE_MATRIX
return ..("color")
/atom/movable/lighting_overlay/shuttle_move(turf/loc)
return
+12 -2
View File
@@ -23,7 +23,12 @@
/turf/proc/lighting_clear_overlay()
if (lighting_overlay)
qdel(lighting_overlay)
if (lighting_overlay.loc != src)
var/turf/badT = lighting_overlay.loc
crash_with("Lighting overlay variable on turf [DEBUG_REF(src)] is insane, lighting overlay actually located on [DEBUG_REF(lighting_overlay.loc)] at ([badT.x],[badT.y],[badT.z])!")
qdel(lighting_overlay, TRUE)
lighting_overlay = null
L_PROF(src, "turf_clear_overlay")
@@ -170,9 +175,14 @@
recalc_atom_opacity()
lighting_overlay = old_lighting_overlay
if (lighting_overlay && lighting_overlay.loc != src)
// This is a hack, but I can't figure out why the fuck they're not on the correct turf in the first place.
lighting_overlay.forceMove(src, harderforce = TRUE)
affecting_lights = old_affecting_lights
corners = old_corners
if ((old_opacity != opacity) || (dynamic_lighting != old_dynamic_lighting))
if ((old_opacity != opacity) || (dynamic_lighting != old_dynamic_lighting) || force_lighting_update)
reconsider_lights()
if (dynamic_lighting != old_dynamic_lighting)
+3 -3
View File
@@ -42,7 +42,7 @@ var/list/admin_verbs_lighting = list(
SSlighting.corner_queue = list()
SSlighting.overlay_queue = list()
/client/proc/lighting_reconsider_target(turf/T in world)
/client/proc/lighting_reconsider_target(turf/T in turfs)
set category = "Lighting"
set name = "Reconsider Visibility"
set desc = "Triggers a visibility update for a turf."
@@ -57,7 +57,7 @@ var/list/admin_verbs_lighting = list(
T.reconsider_lights()
/client/proc/lighting_build_overlay(turf/T in world)
/client/proc/lighting_build_overlay(turf/T in turfs)
set category = "Lighting"
set name = "Build Overlay"
set desc = "Builds a lighting overlay for a turf if it does not have one."
@@ -72,7 +72,7 @@ var/list/admin_verbs_lighting = list(
T.lighting_build_overlay()
/client/proc/lighting_clear_overlay(turf/T in world)
/client/proc/lighting_clear_overlay(turf/T in turfs)
set category = "Lighting"
set name = "Clear Overlay"
set desc = "Clears a lighting overlay for a turf if it has one."