mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-21 20:13:45 +01:00
Lighting performance/profiling tweaks
- Lighting process now yields at 10% of a tick and defers at 80% of a tick - There is no longer a limit to how many sources/corners/overlays will update in a single work run - Source/corner/overlay totals are now simple counts instead of lists - Lighting update stats now show updates over each of the previous 5 seconds - Space turfs now remove their starlight when changing to a different turf, fixing a runtime
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/var/list/datum/lighting_corner/all_lighting_corners = list()
|
||||
/var/total_lighting_corners = 0
|
||||
/var/datum/lighting_corner/dummy/dummy_lighting_corner = new
|
||||
// Because we can control each corner of every lighting overlay.
|
||||
// And corners get shared between multiple turfs (unless you're on the corners of the map, then 1 corner doesn't).
|
||||
@@ -32,7 +32,7 @@
|
||||
/datum/lighting_corner/New(var/turf/new_turf, var/diagonal)
|
||||
. = ..()
|
||||
|
||||
all_lighting_corners += src
|
||||
total_lighting_corners++
|
||||
|
||||
masters[new_turf] = turn(diagonal, 180)
|
||||
z = new_turf.z
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var/list/all_lighting_overlays = list() // Global list of lighting overlays.
|
||||
/var/total_lighting_overlays = 0
|
||||
/atom/movable/lighting_overlay
|
||||
name = ""
|
||||
mouse_opacity = 0
|
||||
@@ -21,7 +21,7 @@ var/list/all_lighting_overlays = list() // Global list of lighting overlays.
|
||||
/atom/movable/lighting_overlay/New(var/atom/loc, var/no_update = FALSE)
|
||||
. = ..()
|
||||
verbs.Cut()
|
||||
global.all_lighting_overlays += src
|
||||
total_lighting_overlays++
|
||||
|
||||
var/turf/T = loc //If this runtimes atleast we'll know what's creating overlays outside of turfs.
|
||||
T.lighting_overlay = src
|
||||
@@ -77,7 +77,7 @@ var/list/all_lighting_overlays = list() // Global list of lighting overlays.
|
||||
return
|
||||
|
||||
/atom/movable/lighting_overlay/Destroy()
|
||||
global.all_lighting_overlays -= src
|
||||
total_lighting_overlays--
|
||||
global.lighting_update_overlays -= src
|
||||
global.lighting_update_overlays_old -= src
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/var/list/datum/light_source/all_lighting_sources = list()
|
||||
/var/total_lighting_sources = 0
|
||||
// This is where the fun begins.
|
||||
// These are the main datums that emit light.
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
var/force_update
|
||||
|
||||
/datum/light_source/New(var/atom/owner, var/atom/top)
|
||||
all_lighting_sources += src
|
||||
total_lighting_sources++
|
||||
source_atom = owner // Set our new owner.
|
||||
if(!source_atom.light_sources)
|
||||
source_atom.light_sources = list()
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
// Kill ourselves.
|
||||
/datum/light_source/proc/destroy()
|
||||
all_lighting_sources -= src
|
||||
total_lighting_sources--
|
||||
destroyed = TRUE
|
||||
force_update()
|
||||
if(source_atom)
|
||||
|
||||
Reference in New Issue
Block a user