Skip to content

Ports tg#84299: Fixed lights stopping emitting light in some situations #1048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals/signals_turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@
#define COMSIG_TURF_PREPARE_STEP_SOUND "turf_prepare_step_sound"
//stops element/footstep/proc/prepare_step() from returning null if the turf itself has no sound
#define FOOTSTEP_OVERRIDEN (1<<0)

///Called when turf no longer blocks light from passing through
#define COMSIG_TURF_NO_LONGER_BLOCK_LIGHT "turf_no_longer_block_light"
2 changes: 2 additions & 0 deletions code/modules/lighting/lighting_source.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
//yes, we register the signal to the top atom too, this is intentional and ensures contained lighting updates properly
if(ismovable(new_atom_host))
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
Expand All @@ -100,6 +101,7 @@
LAZYREMOVE(old_atom_host.light_sources, src)
if(ismovable(old_atom_host))
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.
Expand Down
16 changes: 10 additions & 6 deletions code/modules/lighting/lighting_turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,16 @@
reconsider_lights()
return
directional_opacity = NONE
for(var/atom/movable/opacity_source as anything in opacity_sources)
if(opacity_source.flags_1 & ON_BORDER_1)
directional_opacity |= opacity_source.dir
else //If fulltile and opaque, then the whole tile blocks view, no need to continue checking.
directional_opacity = ALL_CARDINALS
break
if(opacity_sources)
for(var/atom/movable/opacity_source as anything in opacity_sources)
if(opacity_source.flags_1 & ON_BORDER_1)
directional_opacity |= opacity_source.dir
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.

Expand Down
Loading