Compare commits

...

2 Commits

Author SHA1 Message Date
4a512ceefb Revert "core: remove redundant waits" 2026-01-07 18:44:32 +02:00
85516558e4 core: cmdr 2026-01-07 18:42:01 +02:00
13 changed files with 193 additions and 9 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
Packages/

View File

@@ -5,7 +5,16 @@
"ReplicatedStorage": {
"$className": "ReplicatedStorage",
"$ignoreUnknownInstances": true,
"$path": "src/ReplicatedStorage"
"$path": "src/ReplicatedStorage",
"Packages": {
"$className": "Folder",
"$path": "Packages"
}
},
"ReplicatedFirst": {
"$className": "ReplicatedFirst",
"$ignoreUnknownInstances": true,
"$path": "src/ReplicatedFirst"
},
"ServerScriptService": {
"$className": "ServerScriptService",

View File

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

View File

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

View File

@@ -0,0 +1,23 @@
return {
Name = "chunkdump",
Aliases = {"dumpchunk"},
Description = "Show server-side block count for a chunk.",
Group = "Debug",
Args = {
{
Type = "integer",
Name = "cx",
Description = "Chunk X"
},
{
Type = "integer",
Name = "cy",
Description = "Chunk Y"
},
{
Type = "integer",
Name = "cz",
Description = "Chunk Z"
}
}
}

View File

@@ -0,0 +1,15 @@
return function(context, cx, cy, cz)
local terrainGen = require(
game:GetService("ServerScriptService")
:WaitForChild("Actor")
:WaitForChild("ServerChunkManager")
:WaitForChild("TerrainGen")
)
local chunk = terrainGen:GetChunk(cx, cy, cz)
local count = 0
for _ in pairs(chunk.data) do
count += 1
end
return ("Chunk %d,%d,%d has %d blocks"):format(cx, cy, cz, count)
end

View File

@@ -0,0 +1,49 @@
return {
Name = "resyncchunk",
Aliases = {"resyncc"},
Description = "Resync a chunk (and optional radius) for a player.",
Group = "Debug",
Args = {
{
Type = "player",
Name = "player",
Description = "Player to resync"
},
{
Type = "integer",
Name = "cx",
Description = "Chunk X"
},
{
Type = "integer",
Name = "cy",
Description = "Chunk Y"
},
{
Type = "integer",
Name = "cz",
Description = "Chunk Z"
},
{
Type = "integer",
Name = "radius",
Description = "Radius around the chunk",
Optional = true,
Default = 0
}
},
Run = function(context, player, cx, cy, cz, radius)
local tickRemote = game:GetService("ReplicatedStorage"):WaitForChild("Tick")
local r = radius or 0
local count = 0
for y = -r, r do
for x = -r, r do
for z = -r, r do
tickRemote:FireClient(player, "C_R", cx + x, cy + y, cz + z, 0, 0, 0, 0)
count += 1
end
end
end
return ("Resync sent to %s (%d chunks)"):format(player.Name, count)
end
}

View File

@@ -0,0 +1,48 @@
return {
Name = "resyncnear",
Aliases = {"resyncnearby"},
Description = "Resync chunks around a player's current chunk.",
Group = "Debug",
Args = {
{
Type = "player",
Name = "player",
Description = "Player to resync"
},
{
Type = "integer",
Name = "radius",
Description = "Radius around the player chunk",
Optional = true,
Default = 1
}
},
Run = function(context, player, radius)
local character = player.Character
if not character then
return "Player has no character"
end
local root = character:FindFirstChild("HumanoidRootPart")
if not root then
return "Player has no HumanoidRootPart"
end
local pos = root.Position
local cx = math.round(pos.X / 32)
local cy = math.round(pos.Y / 32)
local cz = math.round(pos.Z / 32)
local tickRemote = game:GetService("ReplicatedStorage"):WaitForChild("Tick")
local r = radius or 1
local count = 0
for y = -r, r do
for x = -r, r do
for z = -r, r do
tickRemote:FireClient(player, "C_R", cx + x, cy + y, cz + z, 0, 0, 0, 0)
count += 1
end
end
end
return ("Resync sent to %s (%d chunks around %d,%d,%d)"):format(player.Name, count, cx, cy, cz)
end
}

View File

@@ -0,0 +1,7 @@
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local Cmdr = require(ReplicatedStorage.Packages.cmdr)
Cmdr:RegisterDefaultCommands()
Cmdr.Registry:RegisterCommandsIn(ServerScriptService.CmdrCommands)

View File

@@ -7,13 +7,16 @@ end
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UIS = game:GetService("UserInputService")
local TXTS = game:GetService("TextChatService")
local TXTS_CIF = TXTS:FindFirstChildOfClass("ChatInputBarConfiguration")
ReplicatedStorage:WaitForChild("Objects"):WaitForChild("MLLoaded")
game:GetService("Players").LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
UIS.MouseIconEnabled = false
UIS.InputEnded:Connect(function(k)
if k.KeyCode == Enum.KeyCode.M then
if k.KeyCode == Enum.KeyCode.M and UIS:GetFocusedTextBox() == nil and not TXTS_CIF.IsFocused then
local v = not script.Parent.DummyButton.Modal
UIS.MouseIconEnabled = v
script.Parent.CrosshairLabel.Visible = not v

View File

@@ -0,0 +1,8 @@
repeat
wait(0.1)
until game:IsLoaded() == true
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Cmdr = require(ReplicatedStorage:WaitForChild("CmdrClient"))
Cmdr:SetActivationKeys({ Enum.KeyCode.F2 })

13
wally.lock Normal file
View File

@@ -0,0 +1,13 @@
# This file is automatically @generated by Wally.
# It is not intended for manual editing.
registry = "test"
[[package]]
name = "evaera/cmdr"
version = "1.12.0"
dependencies = []
[[package]]
name = "ocbwoy3-development-studios/minecraft-roblox"
version = "0.1.0"
dependencies = [["cmdr", "evaera/cmdr@1.12.0"]]

8
wally.toml Normal file
View File

@@ -0,0 +1,8 @@
[package]
name = "ocbwoy3-development-studios/minecraft-roblox"
version = "0.1.0"
registry = "https://github.com/UpliftGames/wally-index"
realm = "shared"
[dependencies]
cmdr = "evaera/cmdr@1.12.0"