This is a patch for a long standing issue; I know this isn't technically part of the beta, but it seems appropriate for this particular ocean fix to make it into this release.
There's an issue with the canopy shadows of overlapping canopies disappearing that can be seen by first loading into an area with overlapping trees, leaving the area, then returning to the area. To the player, it looks like there's a bunch of area not covered by canopy shadows.
Here's the fix that corrects the broken shadows.
diff --git a/scripts/components/canopyshadows.lua b/scripts/components/canopyshadows.lua
index c79d5e6..655a26b 100644
--- a/scripts/components/canopyshadows.lua
+++ b/scripts/components/canopyshadows.lua
@@ -37,8 +37,8 @@ function CanopyShadows:GenerateCanopyShadowPositions()
local shadetile_key = newx.."-"..newz
local shadetile = Canopyshadows[shadetile_key]
+ table.insert(self.canopy_positions, {newx, newz})
if not shadetile then
- table.insert(self.canopy_positions, {newx, newz})
Canopyshadows[shadetile_key] = {refs = 1, spawnrefs = 0}
else
shadetile.refs = shadetile.refs + 1
@@ -103,4 +103,4 @@ function CanopyShadows:DespawnShadows(ignore_entity_sleep)
self.spawned = false
end
Allow me to explain.
First, some context. There is a global object Canopyshadows which stores reference counting objects for the shadow effect. This is necessary because although the tiles of the canopy shadows must be tracked per tree, the actual shadow effect is world state and ends up shared by adjacent trees.
Here's the bug. Only the tree that initialized one of those reference counting objects was actually recording that it had a shadow on that tile. Other trees would still increment the reference count, though. But because those other trees weren't tracking that they had a shadow in that position, they didn't decrement the reference count when they unloaded, and that ends up leaking the object in Canopyshadows. When the tree is reloaded, the object is still there and now it doesn't record that it has a shadow there, _and_ it can't turn on the shadow effect.
The fix is to always record the canopy location regardless of whether this tree initialized the reference counting object.
Spawn a few oceantree_pillar 4 tiles away from each other. Walk far enough to way and unload them all, then return. Observe that some of the shadows in the overlapping areas are missing.
After applying the patch, repeating this procedure should result in all of the shadows visible.
-
1
A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now