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 cascade chunkloading #8

Merged
merged 4 commits into from
Dec 21, 2024

Conversation

Pilzinsel64
Copy link

@Pilzinsel64 Pilzinsel64 commented Dec 9, 2024

This PR aims to fix a the cascade chunkloading issue. Whenever a light wants to set a phatom light in a chunk that is not yet loaded (can happen when traveling throw the world), it automatically loads the chunk. If in the new newly loaded chunk is another light, this loads the next again, and the next and so on ...

This also fixes a two possible crashes whenever WorldServer.loadChunkOnRequest is set to false like on my server. (Yes, it finally fixes my issues with Flood Lights / in combination with EIO Lights.)

Last but not least, this PR moves a piceace of code to a method to de-duplicate it (from about 10 similar usages).

As from my tests, this doesn't break existing worlds or the usage of the lights. But of course, this should be tested by someone else (and/or on Zeta) too.

For the reviewers: This line of code is required to just get a static copy of the list as it get changed (sources get removed) while iterating it. There is no threading issue. Feel free to suggest any better way. I just wanted to not change the method signature of void removeSource(x, y, z).

because I always forget ...
- also deduplicate some code
- also supports `WorldServer.loadChunkOnRequest = false`
-> just use a copy of our collection as we update the sources collection while iterating it
@serenibyss serenibyss merged commit 3e864bc into GTNewHorizons:master Dec 21, 2024
1 check passed
@Pilzinsel64 Pilzinsel64 deleted the fix/cascadechunkloading branch December 21, 2024 22:26
Dream-Master pushed a commit that referenced this pull request Dec 31, 2024
(cherry picked from commit 3e864bc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants