Fix openturf starlight (#3401)

changes:

Openturf starlight now actually works.
Openturf starlight is now under its own config option, so it can be toggled separately from starlight.
OT starlight no longer re-applies to a turf that already has it set.
Seems to use a fair bit of memory unfortunately, as well as adding a good 25 seconds or so to boot time.
This commit is contained in:
Lohikar
2017-09-10 22:50:14 +03:00
committed by Erki
parent 8f4b4effae
commit f4be66f342
3 changed files with 27 additions and 4 deletions
+5
View File
@@ -275,6 +275,8 @@ var/list/gamemode_cache = list()
var/show_game_type_odd = 1 // If the check gamemode probability verb is enabled or not
var/openturf_starlight_permitted = FALSE
/datum/configuration/New()
var/list/L = typesof(/datum/game_mode) - /datum/game_mode
for (var/T in L)
@@ -741,6 +743,9 @@ var/list/gamemode_cache = list()
value = text2num(value)
config.starlight = value >= 0 ? value : 0
if("openturf_starlight")
openturf_starlight_permitted = TRUE
if("ert_species")
config.ert_species = text2list(value, ";")
if(!config.ert_species.len)
+19 -4
View File
@@ -20,6 +20,8 @@
var/list/openspace_overlays = list()
var/list/openspace_turfs = list()
var/starlight_enabled = FALSE
/datum/controller/subsystem/openturf/New()
NEW_SS_GLOBAL(SSopenturf)
@@ -67,8 +69,21 @@
..("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)
starlight_enabled = config.starlight && config.openturf_starlight_permitted
// Flush the queue.
fire(FALSE, TRUE)
if (starlight_enabled)
var/t = REALTIMEOFDAY
admin_notice("<span class='danger'>[src] setup completed in [(t - timeofday)/10] seconds!</span>", R_DEBUG)
SSlighting.fire(FALSE, TRUE)
admin_notice("<span class='danger'>Secondary [SSlighting] flush completed in [(REALTIMEOFDAY - t)/10] seconds!</span>", R_DEBUG)
t = REALTIMEOFDAY
fire(FALSE, TRUE) // Fire /again/ to flush updates caused by the above.
admin_notice("<span class='danger'>Secondary [src] flush completed in [(REALTIMEOFDAY - t)/10] seconds!</span>", R_DEBUG)
..()
/datum/controller/subsystem/openturf/fire(resumed = FALSE, no_mc_tick = FALSE)
@@ -116,12 +131,12 @@
// Handle space parallax & starlight.
if (T.is_above_space())
T.plane = PLANE_SPACE_BACKGROUND
/*if (config.starlight) // Openturf starlight is broken. SSlighting and SSopenturf will fight if this is un-commented-out. Maybe someone will fix it someday.
T.set_light(config.starlight, 0.5)*/
if (starlight_enabled && !T.light_range)
T.set_light(config.starlight, 0.5)
else
T.plane = OPENTURF_MAX_PLANE - depth
/*if (config.starlight && T.light_range != 0)
T.set_light(0)*/
if (starlight_enabled && T.light_range)
T.set_light(0)
// Add everything below us to the update queue.
for (var/thing in T.below)