core: broken
This commit is contained in:
@@ -46,7 +46,6 @@ do
|
||||
end
|
||||
|
||||
local function Swait(l)
|
||||
task.synchronize()
|
||||
for _ = 1, l do
|
||||
RunService.Stepped:Wait()
|
||||
end
|
||||
@@ -59,14 +58,12 @@ function ChunkManager:GetChunk(x, y, z)
|
||||
end
|
||||
|
||||
if pendingChunkRequests[key] then
|
||||
task.synchronize()
|
||||
while pendingChunkRequests[key] do
|
||||
task.wait()
|
||||
end
|
||||
return Chunk.AllChunks[key]
|
||||
end
|
||||
|
||||
task.synchronize()
|
||||
pendingChunkRequests[key] = true
|
||||
local ok, data = pcall(function()
|
||||
return remote:InvokeServer(x, y, z)
|
||||
@@ -74,7 +71,6 @@ function ChunkManager:GetChunk(x, y, z)
|
||||
if not ok then
|
||||
data = {}
|
||||
end
|
||||
task.synchronize()
|
||||
local ch = Chunk.from(x, y, z, data)
|
||||
Chunk.AllChunks[key] = ch
|
||||
pendingChunkRequests[key] = nil
|
||||
@@ -102,7 +98,6 @@ function ChunkManager:LoadChunk(x, y, z)
|
||||
|
||||
unloadingChunks[key] = true
|
||||
task.defer(function()
|
||||
task.desynchronize()
|
||||
ensureNeighboringChunksLoaded(x, y, z)
|
||||
|
||||
local chunk = Chunk.AllChunks[key]
|
||||
@@ -111,7 +106,6 @@ function ChunkManager:LoadChunk(x, y, z)
|
||||
Chunk.AllChunks[key] = chunk
|
||||
end
|
||||
|
||||
task.synchronize()
|
||||
local instance = ChunkBuilder:BuildChunk(chunk, ChunkFolder)
|
||||
chunk.instance = instance
|
||||
chunk.loaded = true
|
||||
@@ -129,7 +123,6 @@ function ChunkManager:RefreshChunk(x, y, z)
|
||||
return
|
||||
end
|
||||
|
||||
task.synchronize()
|
||||
local ok, newData = pcall(function()
|
||||
return remote:InvokeServer(x, y, z)
|
||||
end)
|
||||
@@ -198,9 +191,7 @@ function ChunkManager:RefreshChunk(x, y, z)
|
||||
for _, child in ipairs(chunk.instance:GetChildren()) do
|
||||
if not newData[child.Name] then
|
||||
pruned += 1
|
||||
task.synchronize()
|
||||
child:Destroy()
|
||||
task.desynchronize()
|
||||
end
|
||||
end
|
||||
if DEBUG_RESYNC and pruned > 0 then
|
||||
@@ -210,7 +201,6 @@ function ChunkManager:RefreshChunk(x, y, z)
|
||||
if DEBUG_RESYNC and (changed > 0 or removed > 0) then
|
||||
print("[CHUNKMANAGER][RESYNC] Applied diff", key, "changed", changed, "removed", removed)
|
||||
end
|
||||
task.desynchronize()
|
||||
end
|
||||
|
||||
function ChunkManager:ForceTick()
|
||||
@@ -268,7 +258,6 @@ function ChunkManager:Tick()
|
||||
for y = 0, 2 do
|
||||
task.defer(function()
|
||||
for x = -CHUNK_RADIUS, CHUNK_RADIUS do
|
||||
task.desynchronize()
|
||||
for z = -CHUNK_RADIUS, CHUNK_RADIUS do
|
||||
local cx, cy, cz = chunkPos.x + x, y, chunkPos.z + z
|
||||
local key = `{cx},{cy},{cz}`
|
||||
@@ -279,7 +268,6 @@ function ChunkManager:Tick()
|
||||
Swait(2)
|
||||
end
|
||||
end
|
||||
task.synchronize()
|
||||
end
|
||||
end)
|
||||
Swait(10)
|
||||
@@ -291,7 +279,6 @@ function ChunkManager:Tick()
|
||||
if tick() - loadedChunk.inhabitedTime > 15 and not unloadingChunks[key] then
|
||||
unloadingChunks[key] = true
|
||||
task.defer(function()
|
||||
task.synchronize()
|
||||
loadedChunk:Unload()
|
||||
loadedChunk:Destroy()
|
||||
Chunk.AllChunks[key] = nil
|
||||
|
||||
Reference in New Issue
Block a user