From 7dff58205c8742503174ac68e72eed2f5fa40b30 Mon Sep 17 00:00:00 2001 From: TiviPlus <57223640+TiviPlus@users.noreply.github.com> Date: Wed, 8 Sep 2021 22:03:43 +0200 Subject: [PATCH] var/static_lighting proper varedit support (#61164) per title it creates/destroys the lighting objects now --- code/modules/lighting/lighting_area.dm | 6 ++++++ code/modules/lighting/static_lighting_area.dm | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/code/modules/lighting/lighting_area.dm b/code/modules/lighting/lighting_area.dm index caf7ed244fd..fcb76e9ee20 100644 --- a/code/modules/lighting/lighting_area.dm +++ b/code/modules/lighting/lighting_area.dm @@ -27,6 +27,12 @@ if("base_lighting_alpha") set_base_lighting(new_alpha = var_value) return TRUE + if("static_lighting") + if(!static_lighting) + create_area_lighting_objects() + else + remove_area_lighting_objects() + return ..() /area/proc/update_base_lighting() diff --git a/code/modules/lighting/static_lighting_area.dm b/code/modules/lighting/static_lighting_area.dm index 150ee669e54..059a80d02d2 100644 --- a/code/modules/lighting/static_lighting_area.dm +++ b/code/modules/lighting/static_lighting_area.dm @@ -15,3 +15,19 @@ GLOBAL_DATUM_INIT(fullbright_overlay, /mutable_appearance, create_fullbright_ove //Non static lighting areas. //Any lighting area that wont support static lights. //These areas will NOT have corners generated. + +///regenerates lighting objects for turfs in this area, primary use is VV changes +/area/proc/create_area_lighting_objects() + for(var/turf/T in src) + if(T.always_lit) + continue + T.lighting_build_overlay() + CHECK_TICK + +///Removes lighting objects from turfs in this area if we have them, primary use is VV changes +/area/proc/remove_area_lighting_objects() + for(var/turf/T in src) + if(T.always_lit) + continue + T.lighting_clear_overlay() + CHECK_TICK