core: cmdr

This commit is contained in:
2026-01-07 18:42:01 +02:00
parent 64c91b344a
commit 85516558e4
11 changed files with 186 additions and 2 deletions

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 })