core: cmdr
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Packages/
|
||||||
@@ -5,7 +5,16 @@
|
|||||||
"ReplicatedStorage": {
|
"ReplicatedStorage": {
|
||||||
"$className": "ReplicatedStorage",
|
"$className": "ReplicatedStorage",
|
||||||
"$ignoreUnknownInstances": true,
|
"$ignoreUnknownInstances": true,
|
||||||
"$path": "src/ReplicatedStorage"
|
"$path": "src/ReplicatedStorage",
|
||||||
|
"Packages": {
|
||||||
|
"$className": "Folder",
|
||||||
|
"$path": "Packages"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ReplicatedFirst": {
|
||||||
|
"$className": "ReplicatedFirst",
|
||||||
|
"$ignoreUnknownInstances": true,
|
||||||
|
"$path": "src/ReplicatedFirst"
|
||||||
},
|
},
|
||||||
"ServerScriptService": {
|
"ServerScriptService": {
|
||||||
"$className": "ServerScriptService",
|
"$className": "ServerScriptService",
|
||||||
|
|||||||
23
src/ServerScriptService/CmdrCommands/ChunkDump.lua
Normal file
23
src/ServerScriptService/CmdrCommands/ChunkDump.lua
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/ServerScriptService/CmdrCommands/ChunkDumpServer.lua
Normal file
15
src/ServerScriptService/CmdrCommands/ChunkDumpServer.lua
Normal 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
|
||||||
49
src/ServerScriptService/CmdrCommands/ResyncChunk.lua
Normal file
49
src/ServerScriptService/CmdrCommands/ResyncChunk.lua
Normal 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
|
||||||
|
}
|
||||||
48
src/ServerScriptService/CmdrCommands/ResyncNear.lua
Normal file
48
src/ServerScriptService/CmdrCommands/ResyncNear.lua
Normal 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
|
||||||
|
}
|
||||||
7
src/ServerScriptService/CmdrServer.server.lua
Normal file
7
src/ServerScriptService/CmdrServer.server.lua
Normal 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)
|
||||||
@@ -7,13 +7,16 @@ end
|
|||||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
local UIS = game:GetService("UserInputService")
|
local UIS = game:GetService("UserInputService")
|
||||||
|
|
||||||
|
local TXTS = game:GetService("TextChatService")
|
||||||
|
local TXTS_CIF = TXTS:FindFirstChildOfClass("ChatInputBarConfiguration")
|
||||||
|
|
||||||
ReplicatedStorage:WaitForChild("Objects"):WaitForChild("MLLoaded")
|
ReplicatedStorage:WaitForChild("Objects"):WaitForChild("MLLoaded")
|
||||||
|
|
||||||
game:GetService("Players").LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
|
game:GetService("Players").LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
|
||||||
UIS.MouseIconEnabled = false
|
UIS.MouseIconEnabled = false
|
||||||
|
|
||||||
UIS.InputEnded:Connect(function(k)
|
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
|
local v = not script.Parent.DummyButton.Modal
|
||||||
UIS.MouseIconEnabled = v
|
UIS.MouseIconEnabled = v
|
||||||
script.Parent.CrosshairLabel.Visible = not v
|
script.Parent.CrosshairLabel.Visible = not v
|
||||||
|
|||||||
@@ -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
13
wally.lock
Normal 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
8
wally.toml
Normal 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"
|
||||||
Reference in New Issue
Block a user