core: fix building

This commit is contained in:
2026-01-08 19:30:49 +02:00
parent 165913ca51
commit 2381fa124a
9 changed files with 594 additions and 83 deletions

View File

@@ -139,12 +139,21 @@ local function isBlockInsidePlayer(blockPos: Vector3): boolean
end
local DEBUG_PLACEMENT = true
local function debugPlacementLog(...: any)
if DEBUG_PLACEMENT then
Util.StudioLog(...)
end
end
local function debugPlacementWarn(...: any)
if DEBUG_PLACEMENT then
Util.StudioWarn(...)
end
end
placeRemote.OnServerEvent:Connect(function(player, cx, cy, cz, x, y, z, blockId)
local function reject(reason: string)
if DEBUG_PLACEMENT then
warn("[PLACE][REJECT]", player.Name, reason, "chunk", cx, cy, cz, "block", x, y, z, "id", blockId)
end
debugPlacementWarn("[PLACE][REJECT]", player.Name, reason, "chunk", cx, cy, cz, "block", x, y, z, "id", blockId)
return
end
@@ -178,9 +187,7 @@ placeRemote.OnServerEvent:Connect(function(player, cx, cy, cz, x, y, z, blockId)
if existing and existing.id and existing.id ~= 0 then
if existing.id == resolvedId then
-- same block already there; treat as success without changes
if DEBUG_PLACEMENT then
print("[PLACE][OK][NOOP]", player.Name, "chunk", cx, cy, cz, "block", x, y, z, "id", resolvedId)
end
debugPlacementLog("[PLACE][OK][NOOP]", player.Name, "chunk", cx, cy, cz, "block", x, y, z, "id", resolvedId)
return
end
-- allow replacement when different id: remove then place
@@ -192,9 +199,7 @@ placeRemote.OnServerEvent:Connect(function(player, cx, cy, cz, x, y, z, blockId)
}
chunk:CreateBlock(x, y, z, data)
propogate("B_C", cx, cy, cz, x, y, z, data)
if DEBUG_PLACEMENT then
print("[PLACE][OK]", player.Name, "chunk", cx, cy, cz, "block", x, y, z, "id", resolvedId)
end
debugPlacementLog("[PLACE][OK]", player.Name, "chunk", cx, cy, cz, "block", x, y, z, "id", resolvedId)
end)
breakRemote.OnServerEvent:Connect(function(player, cx, cy, cz, x, y, z)
@@ -219,10 +224,12 @@ breakRemote.OnServerEvent:Connect(function(player, cx, cy, cz, x, y, z)
task.synchronize()
tickRemote:FireClient(player, "C_R", cx, cy, cz, 0, 0, 0, 0)
task.desynchronize()
debugPlacementLog("[BREAK][NOOP]", player.Name, "chunk", cx, cy, cz, "block", x, y, z)
return
end
chunk:RemoveBlock(x, y, z)
propogate("B_D", cx, cy, cz, x, y, z, 0)
debugPlacementLog("[BREAK][OK]", player.Name, "chunk", cx, cy, cz, "block", x, y, z)
end)
task.desynchronize()