From 348f13dfd18d1834c4f0353ce71b551d49e6fcd5 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 10 Jul 2024 05:30:03 +0200 Subject: [PATCH] [MIRROR] Fixed lights stopping emitting light in some situations (#28759) * Fixed lights stopping emitting light in some situations (#84299) ## About The Pull Request closes #77789 edt: also closes #82600 Light sources stop emitting light if the tile in which the light source itself is located and all 4 adjacent tile block the light. This usually happens when a smoke grenade is thrown, or something went wrong in the chemistry again
Videos As it was before https://github.com/tgstation/tgstation/assets/112967882/44ff556b-d09f-4024-945e-c2c105f511a9 Now https://github.com/tgstation/tgstation/assets/112967882/9f9f8f43-47a9-47be-8499-99bab39fc166
## Why It's Good For The Game You wont need to switch the lights twice to make them work after someone threw smoke grenades into the hallways anymore ## Changelog :cl: fix: Fixed lights stopping emitting light in some situations /:cl: --------- Co-authored-by: Ghom <42542238+Ghommie@ users.noreply.github.com> * Fixed lights stopping emitting light in some situations --------- Co-authored-by: Kocma-san <112967882+Kocma-san@users.noreply.github.com> Co-authored-by: Ghom <42542238+Ghommie@ users.noreply.github.com> --- code/__DEFINES/dcs/signals/signals_turf.dm | 3 +++ code/modules/lighting/lighting_source.dm | 2 ++ code/modules/lighting/lighting_turf.dm | 3 +++ 3 files changed, 8 insertions(+) diff --git a/code/__DEFINES/dcs/signals/signals_turf.dm b/code/__DEFINES/dcs/signals/signals_turf.dm index f89f30d1eb4..321fb503cbf 100644 --- a/code/__DEFINES/dcs/signals/signals_turf.dm +++ b/code/__DEFINES/dcs/signals/signals_turf.dm @@ -40,3 +40,6 @@ #define COMSIG_TURF_RESET_ELEVATION "turf_reset_elevation" #define ELEVATION_CURRENT_PIXEL_SHIFT 1 #define ELEVATION_MAX_PIXEL_SHIFT 2 + +///Called when turf no longer blocks light from passing through +#define COMSIG_TURF_NO_LONGER_BLOCK_LIGHT "turf_no_longer_block_light" diff --git a/code/modules/lighting/lighting_source.dm b/code/modules/lighting/lighting_source.dm index 1a32686aa19..30c239160e5 100644 --- a/code/modules/lighting/lighting_source.dm +++ b/code/modules/lighting/lighting_source.dm @@ -95,6 +95,7 @@ LAZYADD(new_atom_host.light_sources, src) if(ismovable(new_atom_host) && new_atom_host == source_atom) RegisterSignal(new_atom_host, COMSIG_MOVABLE_MOVED, PROC_REF(update_host_lights)) + RegisterSignal(new_atom_host, COMSIG_TURF_NO_LONGER_BLOCK_LIGHT, PROC_REF(force_update)) return TRUE ///remove this light source from old_atom_host's light_sources list, unsetting movement registrations @@ -105,6 +106,7 @@ LAZYREMOVE(old_atom_host.light_sources, src) if(ismovable(old_atom_host) && old_atom_host == source_atom) UnregisterSignal(old_atom_host, COMSIG_MOVABLE_MOVED) + UnregisterSignal(old_atom_host, COMSIG_TURF_NO_LONGER_BLOCK_LIGHT) return TRUE // Yes this doesn't align correctly on anything other than 4 width tabs. diff --git a/code/modules/lighting/lighting_turf.dm b/code/modules/lighting/lighting_turf.dm index 26ebbd1ba4e..949d9b59b8f 100644 --- a/code/modules/lighting/lighting_turf.dm +++ b/code/modules/lighting/lighting_turf.dm @@ -88,6 +88,9 @@ else //If fulltile and opaque, then the whole tile blocks view, no need to continue checking. directional_opacity = ALL_CARDINALS break + else + for(var/atom/movable/content as anything in contents) + SEND_SIGNAL(content, COMSIG_TURF_NO_LONGER_BLOCK_LIGHT) if(. != directional_opacity && (. == ALL_CARDINALS || directional_opacity == ALL_CARDINALS)) reconsider_lights() //The lighting system only cares whether the tile is fully concealed from all directions or not.