* Openturf icon fixes and improvements

* more things

* Remove some pointless/bad layering/planing

* yeah well I didn't need this anyways

* Refactor Z mimickry to be at /turf

* more refactoring

* Cleanup, use turf/flags instead of z_mimic_flags

* Fix turf/Entered()

* misc optimizations

* fixes

* Major icon smoothing optimizations

* Speed up boot some more

* Fix AO

* Remove some redundant code

* Tie Z-lights to Z-mimic instead of openturfs

* Fix an opacity issue with no_mutate turfs

* Fix some issues with Z-mimic AO not properly clearing

* Fix some OT->OT changetuf bugs

* Add helpers for changing Z-mimic operational state on turfs

* Fix some merge issues, change how F_CUT smoothhint works a bit.

* indentation

* SSopenturf -> SSzcopy
This commit is contained in:
Lohikar
2017-12-30 04:42:18 +02:00
committed by Erki
parent 6debd29cb7
commit 06514840f7
19 changed files with 301 additions and 264 deletions
+3 -2
View File
@@ -27,9 +27,10 @@
if (!QDELETED(target))
if (target.ao_queued == AO_UPDATE_REBUILD)
var/old = target.ao_neighbors
var/old_n = target.ao_neighbors
var/old_z = target.ao_neighbors_mimic
target.calculate_ao_neighbors()
if (old != target.ao_neighbors)
if (old_n != target.ao_neighbors || old_z != target.ao_neighbors_mimic)
target.update_ao()
else
target.update_ao()
@@ -3,13 +3,13 @@
#define OPENTURF_MAX_DEPTH 10 // The maxiumum number of planes deep we'll go before we just dump everything on the same plane.
#define SHADOWER_DARKENING_FACTOR 0.4 // The multiplication factor for openturf shadower darkness. Lighting will be multiplied by this.
/var/datum/controller/subsystem/openturf/SSopenturf
/var/datum/controller/subsystem/zcopy/SSzcopy
/datum/controller/subsystem/openturf
name = "Open Space"
/datum/controller/subsystem/zcopy
name = "Z-Copy"
wait = 1
init_order = SS_INIT_OPENTURF
priority = SS_PRIORITY_OPENTURF
init_order = SS_INIT_ZCOPY
priority = SS_PRIORITY_ZCOPY
flags = SS_FIRE_IN_LOBBY
var/list/queued_turfs = list()
@@ -22,53 +22,57 @@
var/starlight_enabled = FALSE
/datum/controller/subsystem/openturf/New()
NEW_SS_GLOBAL(SSopenturf)
/datum/controller/subsystem/zcopy/New()
NEW_SS_GLOBAL(SSzcopy)
/datum/controller/subsystem/openturf/proc/update_all()
/datum/controller/subsystem/zcopy/proc/update_all()
disable()
for (var/thing in openspace_overlays)
var/atom/movable/AM = thing
var/turf/simulated/open/T = get_turf(AM)
if (istype(T))
T.update_icon()
var/turf/T = get_turf(AM)
if (TURF_IS_MIMICING(T))
if (!(T.flags & MIMIC_QUEUED))
T.update_mimic()
else
qdel(AM)
CHECK_TICK
for (var/thing in openspace_turfs)
var/turf/simulated/open/T = thing
T.update_icon()
var/turf/T = thing
T.update_mimic()
enable()
/datum/controller/subsystem/openturf/proc/hard_reset()
/datum/controller/subsystem/zcopy/proc/hard_reset()
disable()
log_debug("SSopenturf: hard_reset() invoked.")
log_debug("SSzcopy: hard_reset() invoked.")
var/num_deleted = 0
for (var/thing in openspace_overlays)
var/thing
for (thing in openspace_overlays)
qdel(thing)
num_deleted++
CHECK_TICK
log_debug("SSopenturf: deleted [num_deleted] overlays.")
log_debug("SSzcopy: deleted [num_deleted] overlays.")
var/num_turfs = 0
for (var/turf/simulated/open/T in turfs)
T.update_icon()
num_turfs++
for (thing in turfs)
var/turf/T = thing
if (T.flags & MIMIC_BELOW)
T.update_mimic()
num_turfs++
CHECK_TICK
log_debug("SSopenturf: queued [num_turfs] openturfs for update. hard_reset() complete.")
log_debug("SSzcopy: queued [num_turfs] turfs for update. hard_reset() complete.")
enable()
/datum/controller/subsystem/openturf/stat_entry()
/datum/controller/subsystem/zcopy/stat_entry()
..("Q:{T:[queued_turfs.len - (qt_idex - 1)]|O:[queued_overlays.len - (qo_idex - 1)]} T:{T:[openspace_turfs.len]|O:[openspace_overlays.len]}")
/datum/controller/subsystem/openturf/Initialize(timeofday)
/datum/controller/subsystem/zcopy/Initialize(timeofday)
starlight_enabled = config.starlight && config.openturf_starlight_permitted
// Flush the queue.
fire(FALSE, TRUE)
@@ -86,7 +90,7 @@
..()
/datum/controller/subsystem/openturf/fire(resumed = FALSE, no_mc_tick = FALSE)
/datum/controller/subsystem/zcopy/fire(resumed = FALSE, no_mc_tick = FALSE)
if (!resumed)
qt_idex = 1
qo_idex = 1
@@ -99,7 +103,7 @@
var/list/curr_ov = queued_overlays
while (qt_idex <= curr_turfs.len)
var/turf/simulated/open/T = curr_turfs[qt_idex]
var/turf/T = curr_turfs[qt_idex]
curr_turfs[qt_idex] = null
qt_idex++
@@ -115,8 +119,8 @@
// Figure out how many z-levels down we are.
var/depth = 0
var/turf/simulated/open/Td = T
while (Td && isopenturf(Td.below))
var/turf/Td = T
while (Td && TURF_IS_MIMICING(Td.below))
Td = Td.below
depth++
if (depth > OPENTURF_MAX_DEPTH)
@@ -135,15 +139,17 @@
if (starlight_enabled && T.light_range)
T.set_light(0)
if (T.no_mutate)
if (!(T.flags & MIMIC_OVERWRITE))
// Some openturfs have icons, so we can't overwrite their appearance.
if (!T.below.bound_overlay)
T.below.bound_overlay = new(T)
var/atom/movable/openspace/turf_overlay/TO = T.below.bound_overlay
TO.appearance = T.below
TO.name = T.name
TO.opacity = FALSE
T.desc = TO.desc = "Below seems to be \a [T.below]."
TO.plane = t_target
TO.mouse_opacity = FALSE
else
// This openturf doesn't care about its icon, so we can just overwrite it.
if (T.below.bound_overlay)
@@ -173,12 +179,17 @@
var/atom/movable/openspace/overlay/OO = object.bound_overlay
// If the OO was queued for destruction but was claimed by another OT, stop the destruction timer.
if (OO.destruction_timer)
deltimer(OO.destruction_timer)
OO.destruction_timer = null
// Cache our already-calculated depth so we don't need to re-calculate it a bunch of times.
OO.depth = oo_target
queued_overlays += OO
T.updating = FALSE
T.flags &= ~MIMIC_QUEUED
if (no_mc_tick)
CHECK_TICK
@@ -233,7 +244,7 @@
qo_idex = 1
/client/proc/analyze_openturf(turf/simulated/open/T)
/client/proc/analyze_openturf(turf/T)
set name = "Analyze Openturf"
set desc = "Show the layering of an openturf and everything it's mimicking."
set category = "Debug"
@@ -241,19 +252,14 @@
if (!check_rights(R_DEBUG|R_DEV))
return
if (!istype(T))
usr << "Invalid Selection."
return
var/list/out = list(
"<h1>Analysis of [T] at [T.x],[T.y],[T.z]</h1>",
"<b>Queued for update:</b> [T.updating ? "Yes" : "No"]",
"<b>Appearance Type:</b> [T.no_mutate ? "Movable Copy" : "Turf Overwrite"]",
"<b>Z Flags</b>: [english_list(bitfield2list(T.flags, list("NOJAUNT", "MIMIC_BELOW", "MIMIC_OVERWRITE", "MIMIC_QUEUED", "MIMIC_NO_AO")), "(none)")]",
"<b>Has Shadower:</b> [T.shadower ? "Yes" : "No"]",
"<b>Below:</b> [!T.below ? "(nothing)" : "[T.below] at [T.below.x],[T.below.y],[T.below.z]"]",
"<ul>"
)
var/list/found_oo = list(T)
for (var/thing in T)
if (istype(thing, /atom/movable/openspace))