[MIRROR] Up ports the dynamic light system (#10149)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-02-13 14:49:16 +01:00
committed by GitHub
co-authored by Kashargul
parent fe69ddd909
commit 7e2fd538ac
26 changed files with 99 additions and 677 deletions
+7 -11
View File
@@ -1,17 +1,17 @@
SUBSYSTEM_DEF(lighting)
name = "Lighting"
wait = 1 // CHOMPEdit
wait = 1
init_order = INIT_ORDER_LIGHTING
flags = SS_TICKER
runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY //CHOMPEdit Do some work during lobby waiting period. May as well.
runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY // Do some work during lobby waiting period. May as well.
var/sun_mult = 1.0
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.
var/static/list/sunlight_queue = list() //CHOMPEdit // List of turfs that are affected by sunlight
var/static/list/sunlight_queue_active = list() //CHOMPEdit // List of turfs that need to have their sunlight updated
var/list/planet_shandlers = list() //CHOMPEdit //Precomputed lighting values for tiles only affected by the sun
var/list/z_to_pshandler = list() //CHOMPEdit
var/static/list/sunlight_queue = list() // List of turfs that are affected by sunlight
var/static/list/sunlight_queue_active = list() // List of turfs that need to have their sunlight updated
var/list/planet_shandlers = list() // Precomputed lighting values for tiles only affected by the sun
var/list/z_to_pshandler = list()
/datum/controller/subsystem/lighting/stat_entry(msg)
msg = "L:[length(sources_queue)]|C:[length(corners_queue)]|O:[length(objects_queue)]"
@@ -28,14 +28,12 @@ SUBSYSTEM_DEF(lighting)
subsystem_initialized = TRUE
create_all_lighting_objects()
//CHOMPEdit Begin
for(var/datum/planet/planet in SSplanets.planets)
if(!planet_shandlers[planet])
planet_shandlers[planet] = new /datum/planet_sunlight_handler(planet)
//CHOMPEdit End
fire(FALSE, TRUE)
sunlight_queue_active += sunlight_queue + sunlight_queue //CHOMPEdit Run through shandler's twice during lobby wait to get some initial computation out of the way. After these two, the sunlight system will run MUCH faster.
sunlight_queue_active += sunlight_queue + sunlight_queue // Run through shandler's twice during lobby wait to get some initial computation out of the way. After these two, the sunlight system will run MUCH faster.
return SS_INIT_SUCCESS
@@ -123,7 +121,6 @@ SUBSYSTEM_DEF(lighting)
break
if (i)
queue.Cut(1, i + 1)
//CHOMPEdit Begin
i = 0
@@ -183,7 +180,6 @@ SUBSYSTEM_DEF(lighting)
return pshandler
/datum/controller/subsystem/lighting
//CHOMPEdit End
/datum/controller/subsystem/lighting/Recover()
subsystem_initialized = SSlighting.subsystem_initialized
+1 -2
View File
@@ -45,7 +45,6 @@ SUBSYSTEM_DEF(planets)
else if(istype(T, /turf/simulated) && T.is_outdoors())
P.planet_floors += T
P.weather_holder.apply_to_turf(T)
//P.sun_holder.apply_to_turf(T) CHOMPEdit replaced planetary lighting
/datum/controller/subsystem/planets/proc/removeTurf(var/turf/T,var/is_edge)
if(z_to_planet.len >= T.z)
@@ -108,7 +107,7 @@ SUBSYSTEM_DEF(planets)
var/new_color = P.sun["color"]
P.sun_holder.update_color(new_color)
SSlighting.update_sunlight(SSlighting.get_pshandler_planet(P)) //CHOMPEdit
SSlighting.update_sunlight(SSlighting.get_pshandler_planet(P))
/datum/controller/subsystem/planets/proc/updateTemp(var/datum/planet/P)
//Set new temperatures