Skip to content
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 overlays being created multiple times per turf #4756

Merged
merged 3 commits into from
Jan 20, 2025

Conversation

out-of-phaze
Copy link
Member

Description of changes

Fixes unnecessary/redundant z-level initialization and inlines a method that shouldn't ever be reused elsewhere.
Also re-enables some guard code to prevent this from being reintroduced.
Finally, we always go through lighting_build_overlay to make overlays, rather than just using a bare new() in SSlighting init.

Why and what will this PR improve

Restores some assumptions that O7L uses, potentially optimizes some parts of lighting

@out-of-phaze out-of-phaze added the ready for review This PR is ready for review and merge. label Jan 18, 2025
@out-of-phaze out-of-phaze marked this pull request as ready for review January 18, 2025 18:26
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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is using this helper a correctness fix? It was done manually for performance, though this is not particularly hot anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, i guess i could copy the CRASH or assert to this loop. mostly i just wanted to make damn well sure nothing was creating an overlay without it also checking to see if it already had one

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like O7 just has logging in this block, I'm fine with either approach assuming calling TBO here doesn't blow out lighting init times (which I assume it doesn't).

@MistakeNot4892 MistakeNot4892 merged commit d4847b8 into NebulaSS13:dev Jan 20, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review This PR is ready for review and merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants