mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
* SSMetrics * We were a bit too silly * Forgot to commit this * Logs CPU * Removes global data from all ss * And puts it on the metrics ss * Update metrics.dm * Logs profiler data * Adds profile configs * Update code/controllers/subsystem/metrics.dm Co-authored-by: adamsong <adamsong@users.noreply.github.com> * Log request errors * Final fixes * Rebuilds for 1.2.0-yogs1 * Apparnetly you can't split macro calls on multiple lines * Org is called yogstation13 not yogstation --------- Co-authored-by: alexkar598 <> Co-authored-by: adamsong <adamsong@users.noreply.github.com>
100 lines
2.2 KiB
Plaintext
100 lines
2.2 KiB
Plaintext
SUBSYSTEM_DEF(lighting)
|
|
name = "Lighting"
|
|
wait = 2
|
|
init_order = INIT_ORDER_LIGHTING
|
|
flags = SS_TICKER
|
|
var/static/list/sources_queue = list() // List of lighting sources queued for update.
|
|
var/static/list/corners_queue = list() // List of lighting corners queued for update.
|
|
var/static/list/objects_queue = list() // List of lighting objects queued for update.
|
|
|
|
loading_points = 6 SECONDS // Yogs -- loading times
|
|
|
|
/datum/controller/subsystem/lighting/stat_entry(msg)
|
|
msg = "L:[length(sources_queue)]|C:[length(corners_queue)]|O:[length(objects_queue)]"
|
|
return ..()
|
|
|
|
/datum/controller/subsystem/lighting/get_metrics()
|
|
. = ..()
|
|
.["queue_sources"] = length(sources_queue)
|
|
.["queue_corners"] = length(corners_queue)
|
|
.["queue_objects"] = length(objects_queue)
|
|
|
|
/datum/controller/subsystem/lighting/Initialize(timeofday)
|
|
if(!initialized)
|
|
if (CONFIG_GET(flag/starlight))
|
|
for(var/I in GLOB.areas)
|
|
var/area/A = I
|
|
if (A.dynamic_lighting == DYNAMIC_LIGHTING_IFSTARLIGHT)
|
|
A.luminosity = 0
|
|
|
|
create_all_lighting_objects()
|
|
initialized = TRUE
|
|
|
|
fire(FALSE, TRUE)
|
|
|
|
return SS_INIT_SUCCESS
|
|
|
|
/datum/controller/subsystem/lighting/fire(resumed, init_tick_checks)
|
|
MC_SPLIT_TICK_INIT(3)
|
|
if(!init_tick_checks)
|
|
MC_SPLIT_TICK
|
|
var/list/queue = sources_queue
|
|
var/i = 0
|
|
for (i in 1 to length(queue))
|
|
var/datum/light_source/L = queue[i]
|
|
|
|
L.update_corners()
|
|
|
|
L.needs_update = LIGHTING_NO_UPDATE
|
|
|
|
if(init_tick_checks)
|
|
CHECK_TICK
|
|
else if (MC_TICK_CHECK)
|
|
break
|
|
if (i)
|
|
queue.Cut(1, i+1)
|
|
i = 0
|
|
|
|
if(!init_tick_checks)
|
|
MC_SPLIT_TICK
|
|
|
|
queue = corners_queue
|
|
for (i in 1 to length(queue))
|
|
var/datum/lighting_corner/C = queue[i]
|
|
|
|
C.needs_update = FALSE //update_objects() can call qdel if the corner is storing no data
|
|
C.update_objects()
|
|
|
|
if(init_tick_checks)
|
|
CHECK_TICK
|
|
else if (MC_TICK_CHECK)
|
|
break
|
|
if (i)
|
|
queue.Cut(1, i+1)
|
|
i = 0
|
|
|
|
|
|
if(!init_tick_checks)
|
|
MC_SPLIT_TICK
|
|
|
|
queue = objects_queue
|
|
for (i in 1 to length(queue))
|
|
var/datum/lighting_object/O = queue[i]
|
|
|
|
if (QDELETED(O))
|
|
continue
|
|
|
|
O.update()
|
|
O.needs_update = FALSE
|
|
if(init_tick_checks)
|
|
CHECK_TICK
|
|
else if (MC_TICK_CHECK)
|
|
break
|
|
if (i)
|
|
queue.Cut(1, i+1)
|
|
|
|
|
|
/datum/controller/subsystem/lighting/Recover()
|
|
initialized = SSlighting.initialized
|
|
..()
|