core: remove redundant waits

This commit is contained in:
2026-01-07 16:07:36 +02:00
parent 14931ef42d
commit 64c91b344a
3 changed files with 11 additions and 11 deletions

View File

@@ -5,13 +5,13 @@ local BlockManager = {}
BlockManager.BlockIdMappings = {} :: {BasePart} BlockManager.BlockIdMappings = {} :: {BasePart}
for i,v in pairs(game:GetService("ReplicatedStorage"):WaitForChild("Blocks"):GetChildren()) do for _,v in pairs(game:GetService("ReplicatedStorage"):WaitForChild("Blocks"):GetChildren()) do
BlockManager.BlockIdMappings[v:GetAttribute("n")] = v BlockManager.BlockIdMappings[v:GetAttribute("n")] = v
end end
BlockManager.UpdateIdMappings = {} :: {BasePart} BlockManager.UpdateIdMappings = {} :: {BasePart}
for i,v in pairs(game:GetService("ReplicatedStorage"):WaitForChild("BlockUpdateOperations"):GetChildren()) do for _,v in pairs(game:GetService("ReplicatedStorage"):WaitForChild("BlockUpdateOperations"):GetChildren()) do
local success, reason = pcall(function() local success, reason = pcall(function()
BlockManager.UpdateIdMappings[v:GetAttribute("n")] = require(v) BlockManager.UpdateIdMappings[v:GetAttribute("n")] = require(v)
end) end)
@@ -37,8 +37,8 @@ function BlockManager:GetBlock(blockId: number, attr: {[typeof("")]: any}?)
local b = BlockManager.BlockIdMappings[blockId]:Clone() local b = BlockManager.BlockIdMappings[blockId]:Clone()
b.Size = Vector3.new(3.95,3.95,3.95) b.Size = Vector3.new(3.95,3.95,3.95)
for i,v in pairs(attr or {}) do for _,v in pairs(attr or {}) do
b:SetAttribute(i,v) b:SetAttribute(_,v)
end end
if BlockManager.UpdateIdMappings[blockId] then if BlockManager.UpdateIdMappings[blockId] then

View File

@@ -117,7 +117,7 @@ function ChunkBuilder:BuildChunk(c: typeof(Chunk.new(0,0,0)),parent: Instance?)
if existing then if existing then
task.defer(function() task.defer(function()
task.synchronize() task.synchronize()
RunService.RenderStepped:Wait() -- RunService.RenderStepped:Wait()
if existing.Parent then if existing.Parent then
existing:Destroy() existing:Destroy()
end end

View File

@@ -139,9 +139,9 @@ function PlacementManager:BreakBlock(cx, cy, cz, x, y, z)
print("[DEBUG] Client missing block; resyncing nearby chunks") print("[DEBUG] Client missing block; resyncing nearby chunks")
ChunkManager:ResyncAroundChunk(cx, cy, cz, 1) ChunkManager:ResyncAroundChunk(cx, cy, cz, 1)
task.defer(function() task.defer(function()
task.synchronize() -- task.synchronize()
RunService.RenderStepped:Wait() -- RunService.RenderStepped:Wait()
task.desynchronize() -- task.desynchronize()
local refreshed = ChunkManager:GetChunk(cx, cy, cz) local refreshed = ChunkManager:GetChunk(cx, cy, cz)
if refreshed and refreshed:GetBlockAt(x, y, z) then if refreshed and refreshed:GetBlockAt(x, y, z) then
task.synchronize() task.synchronize()
@@ -254,9 +254,9 @@ function PlacementManager:Init()
if not pendingBreakResync[key] then if not pendingBreakResync[key] then
pendingBreakResync[key] = true pendingBreakResync[key] = true
task.defer(function() task.defer(function()
task.synchronize() -- task.synchronize()
RunService.RenderStepped:Wait() -- RunService.RenderStepped:Wait()
task.desynchronize() -- task.desynchronize()
pendingBreakResync[key] = nil pendingBreakResync[key] = nil
ChunkManager:ResyncAroundChunk(cx, cy, cz, 1) ChunkManager:ResyncAroundChunk(cx, cy, cz, 1)
end) end)