-
Notifications
You must be signed in to change notification settings - Fork 224
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
Fix lighting on maps loaded after SSlighting init #4797
Fix lighting on maps loaded after SSlighting init #4797
Conversation
@@ -57,7 +57,7 @@ SUBSYSTEM_DEF(lighting) | |||
var/datum/level_data/level = SSmapping.levels_by_z[zlevel] | |||
for (var/turf/tile as anything in block(1, 1, zlevel, level.level_max_width, level.level_max_height)) // include TRANSITIONEDGE turfs | |||
if (TURF_IS_DYNAMICALLY_LIT_UNSAFE(tile)) | |||
tile.lighting_build_overlay() | |||
new /atom/movable/lighting_overlay(tile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should check that there's no existing overlay, they'll just be orphaned if they somehow exist.
Given that's an error/impossible case, just logging is all that should be necessary.
788d5b7
to
d59493e
Compare
@@ -57,7 +57,10 @@ SUBSYSTEM_DEF(lighting) | |||
var/datum/level_data/level = SSmapping.levels_by_z[zlevel] | |||
for (var/turf/tile as anything in block(1, 1, zlevel, level.level_max_width, level.level_max_height)) // include TRANSITIONEDGE turfs | |||
if (TURF_IS_DYNAMICALLY_LIT_UNSAFE(tile)) | |||
tile.lighting_build_overlay() | |||
if(!isnull(tile.lighting_overlay)) | |||
log_warning("Attempted to create lighting_overlay on tile that already had one.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log_warning("Attempted to create lighting_overlay on tile that already had one.") | |
log_warning("Attempted to create lighting_overlay on tile ([tile.x],[tile.y],[tile.z]) that already had one.") |
d59493e
to
2344d71
Compare
Fixes a regression caused by #4756.
Maploading only goes through new() and not changeturf. If we're loading a turf during mapload, and it's not in changeturf, and SSlighting init has already run, then we need to build the lighting overlay for that turf in Initialize().
I decided to do this rather than making it do a pass after expanding the world bounds (runs before the actual map loading is done, will do basically nothing because unsim filler turfs fail TIDLU) or after finishing loading a map (multiple relevant points, complicated for planets/etc., can result in missing some turfs or processing others twice.
Definitely needs proper review by @Lohikar to make sure I don't do an oopsie again and that I'm not overlooking a better solution.