From 9cec18423fd4635d3cfbf5ade5b668a0ff69121f Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 31 Jul 2024 03:55:43 +0200 Subject: [PATCH] [MIRROR] localizes create_all_lighting_objects (#29110) * localizes create_all_lighting_objects (#85135) ## About The Pull Request Moves create_all_lighting_objects to the only thing that uses it - the lighting subsystem I saw zero difference in lighting system init time ## Why It's Good For The Game Reduces global proc pollution and keeps everything in the same place, improving code readability ## Changelog :cl: refactor: moves the create_all_lighting_objects proc to the lighting subsystem /:cl: * localizes create_all_lighting_objects --------- Co-authored-by: Jackriip <97582790+Jackriip@users.noreply.github.com> --- code/controllers/subsystem/lighting.dm | 13 +++++++++++++ code/modules/lighting/lighting_setup.dm | 12 ------------ tgstation.dme | 1 - 3 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 code/modules/lighting/lighting_setup.dm diff --git a/code/controllers/subsystem/lighting.dm b/code/controllers/subsystem/lighting.dm index 59ff294e959..24d871d2f09 100644 --- a/code/controllers/subsystem/lighting.dm +++ b/code/controllers/subsystem/lighting.dm @@ -26,6 +26,19 @@ SUBSYSTEM_DEF(lighting) return SS_INIT_SUCCESS + +/datum/controller/subsystem/lighting/proc/create_all_lighting_objects() + for(var/area/area as anything in GLOB.areas) + if(!area.static_lighting) + continue + for (var/list/zlevel_turfs as anything in area.get_zlevel_turf_lists()) + for(var/turf/area_turf as anything in zlevel_turfs) + if(area_turf.space_lit) + continue + new /datum/lighting_object(area_turf) + CHECK_TICK + CHECK_TICK + /datum/controller/subsystem/lighting/fire(resumed, init_tick_checks) MC_SPLIT_TICK_INIT(3) if(!init_tick_checks) diff --git a/code/modules/lighting/lighting_setup.dm b/code/modules/lighting/lighting_setup.dm deleted file mode 100644 index c148530d1cd..00000000000 --- a/code/modules/lighting/lighting_setup.dm +++ /dev/null @@ -1,12 +0,0 @@ - -/proc/create_all_lighting_objects() - for(var/area/area as anything in GLOB.areas) - if(!area.static_lighting) - continue - for (var/list/zlevel_turfs as anything in area.get_zlevel_turf_lists()) - for(var/turf/area_turf as anything in zlevel_turfs) - if(area_turf.space_lit) - continue - new /datum/lighting_object(area_turf) - CHECK_TICK - CHECK_TICK diff --git a/tgstation.dme b/tgstation.dme index fabc6c41fbb..903c6dbbf9d 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -4563,7 +4563,6 @@ #include "code\modules\lighting\lighting_atom.dm" #include "code\modules\lighting\lighting_corner.dm" #include "code\modules\lighting\lighting_object.dm" -#include "code\modules\lighting\lighting_setup.dm" #include "code\modules\lighting\lighting_source.dm" #include "code\modules\lighting\lighting_turf.dm" #include "code\modules\lighting\static_lighting_area.dm"