Skip to content

Commit db02b35

Browse files
francinumKocma-san
andauthored
Fixed lights stopping emitting light in some situations (#1048)
Co-authored-by: Kocma-san <[email protected]>
1 parent 691e0d5 commit db02b35

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

code/__DEFINES/dcs/signals/signals_turf.dm

+3
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@
2424
#define COMSIG_TURF_PREPARE_STEP_SOUND "turf_prepare_step_sound"
2525
//stops element/footstep/proc/prepare_step() from returning null if the turf itself has no sound
2626
#define FOOTSTEP_OVERRIDEN (1<<0)
27+
28+
///Called when turf no longer blocks light from passing through
29+
#define COMSIG_TURF_NO_LONGER_BLOCK_LIGHT "turf_no_longer_block_light"

code/modules/lighting/lighting_source.dm

+2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
//yes, we register the signal to the top atom too, this is intentional and ensures contained lighting updates properly
9191
if(ismovable(new_atom_host))
9292
RegisterSignal(new_atom_host, COMSIG_MOVABLE_MOVED, PROC_REF(update_host_lights))
93+
RegisterSignal(new_atom_host, COMSIG_TURF_NO_LONGER_BLOCK_LIGHT, PROC_REF(force_update))
9394
return TRUE
9495

9596
///remove this light source from old_atom_host's light_sources list, unsetting movement registrations
@@ -100,6 +101,7 @@
100101
LAZYREMOVE(old_atom_host.light_sources, src)
101102
if(ismovable(old_atom_host))
102103
UnregisterSignal(old_atom_host, COMSIG_MOVABLE_MOVED)
104+
UnregisterSignal(old_atom_host, COMSIG_TURF_NO_LONGER_BLOCK_LIGHT)
103105
return TRUE
104106

105107
// Yes this doesn't align correctly on anything other than 4 width tabs.

code/modules/lighting/lighting_turf.dm

+10-6
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,16 @@
8080
reconsider_lights()
8181
return
8282
directional_opacity = NONE
83-
for(var/atom/movable/opacity_source as anything in opacity_sources)
84-
if(opacity_source.flags_1 & ON_BORDER_1)
85-
directional_opacity |= opacity_source.dir
86-
else //If fulltile and opaque, then the whole tile blocks view, no need to continue checking.
87-
directional_opacity = ALL_CARDINALS
88-
break
83+
if(opacity_sources)
84+
for(var/atom/movable/opacity_source as anything in opacity_sources)
85+
if(opacity_source.flags_1 & ON_BORDER_1)
86+
directional_opacity |= opacity_source.dir
87+
else //If fulltile and opaque, then the whole tile blocks view, no need to continue checking.
88+
directional_opacity = ALL_CARDINALS
89+
break
90+
else
91+
for(var/atom/movable/content as anything in contents)
92+
SEND_SIGNAL(content, COMSIG_TURF_NO_LONGER_BLOCK_LIGHT)
8993
if(. != directional_opacity && (. == ALL_CARDINALS || directional_opacity == ALL_CARDINALS))
9094
reconsider_lights() //The lighting system only cares whether the tile is fully concealed from all directions or not.
9195

0 commit comments

Comments
 (0)