[MIRROR] starlight optimization (#11130)

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-06-29 10:06:55 -07:00
committed by GitHub
parent b81d4e421c
commit 0e2c783b50
6 changed files with 11 additions and 15 deletions

View File

@@ -60,8 +60,6 @@
#define DYNAMIC_LIGHTING_ENABLED 1 #define DYNAMIC_LIGHTING_ENABLED 1
/// dynamic lighting enabled even if the area doesn't require power /// dynamic lighting enabled even if the area doesn't require power
#define DYNAMIC_LIGHTING_FORCED 2 #define DYNAMIC_LIGHTING_FORCED 2
/// dynamic lighting enabled only if starlight is.
#define DYNAMIC_LIGHTING_IFSTARLIGHT 3
#define IS_DYNAMIC_LIGHTING(A) A.dynamic_lighting #define IS_DYNAMIC_LIGHTING(A) A.dynamic_lighting

View File

@@ -581,7 +581,8 @@
/datum/config_entry/flag/allow_url_links /datum/config_entry/flag/allow_url_links
default = TRUE // honestly if I were you i'd leave this one off, only use in dire situations default = TRUE // honestly if I were you i'd leave this one off, only use in dire situations
/datum/config_entry/flag/starlight // Whether space turfs have ambient light or not /datum/config_entry/number/starlight // Whether space turfs have ambient light or not and how strong it is.
default = 0
// FIXME: Unused // FIXME: Unused
///datum/config_entry/str_list/ert_species ///datum/config_entry/str_list/ert_species

View File

@@ -20,11 +20,6 @@ SUBSYSTEM_DEF(lighting)
/datum/controller/subsystem/lighting/Initialize() /datum/controller/subsystem/lighting/Initialize()
if(!subsystem_initialized) if(!subsystem_initialized)
if (CONFIG_GET(flag/starlight))
for(var/area/A in world)
if (A.dynamic_lighting == DYNAMIC_LIGHTING_IFSTARLIGHT)
A.luminosity = 0
subsystem_initialized = TRUE subsystem_initialized = TRUE
create_all_lighting_objects() create_all_lighting_objects()

View File

@@ -13,7 +13,7 @@
var/forced_dirs = 0 //Force this one to pretend it's an overedge turf var/forced_dirs = 0 //Force this one to pretend it's an overedge turf
/turf/space/Initialize(mapload) /turf/space/Initialize(mapload)
if(CONFIG_GET(flag/starlight)) if(CONFIG_GET(number/starlight))
update_starlight() update_starlight()
//Sprite stuff only beyond here //Sprite stuff only beyond here
@@ -75,7 +75,7 @@
/turf/space/proc/update_starlight() /turf/space/proc/update_starlight()
if(locate(/turf/simulated) in orange(src,1)) if(locate(/turf/simulated) in orange(src,1))
set_light(CONFIG_GET(flag/starlight)) set_light(CONFIG_GET(number/starlight))
else else
set_light(0) set_light(0)

View File

@@ -100,8 +100,9 @@
if(SSair) if(SSair)
SSair.mark_for_update(W) SSair.mark_for_update(W)
for(var/turf/space/S in range(W, 1)) if(CONFIG_GET(number/starlight))
S.update_starlight() for(var/turf/space/S in range(W, 1))
S.update_starlight()
W.levelupdate() W.levelupdate()
W.update_icon(1) W.update_icon(1)
W.post_change() W.post_change()
@@ -130,8 +131,9 @@
else if(lighting_object && !lighting_object.needs_update) else if(lighting_object && !lighting_object.needs_update)
lighting_object.update() lighting_object.update()
for(var/turf/space/space_tile in RANGE_TURFS(1, src)) if(CONFIG_GET(number/starlight))
space_tile.update_starlight() for(var/turf/space/space_tile in RANGE_TURFS(1, src))
space_tile.update_starlight()
var/turf/simulated/sim_self = src var/turf/simulated/sim_self = src
if(lighting_object && istype(sim_self) && sim_self.shandler) //sanity check, but this should never be null for either of the switch cases (lighting_object will be null during initializations sometimes) if(lighting_object && istype(sim_self) && sim_self.shandler) //sanity check, but this should never be null for either of the switch cases (lighting_object will be null during initializations sometimes)

View File

@@ -30,7 +30,7 @@
affected_turf.lighting_object = src affected_turf.lighting_object = src
affected_turf.set_luminosity(0) affected_turf.set_luminosity(0)
if(CONFIG_GET(flag/starlight)) if(CONFIG_GET(number/starlight))
for(var/turf/space/space_tile in RANGE_TURFS(1, affected_turf)) for(var/turf/space/space_tile in RANGE_TURFS(1, affected_turf))
space_tile.update_starlight() space_tile.update_starlight()