add 'cheat-commands' rule

This commit is contained in:
MihailRis
2024-11-06 18:01:00 +03:00
parent 2e24d60404
commit 5e9b290aea
3 changed files with 37 additions and 5 deletions
+13 -3
View File
@@ -28,17 +28,17 @@ console.add_command(
function(args, kwargs)
local name = args[1]
if #name == 0 then
local commands = console.get_commands_list()
table.sort(commands)
local str = "Available commands:"
for i,k in ipairs(commands) do
str = str .. "\n " .. build_scheme(console.get_command_info(k))
if rules.get("cheat-commands") or not table.has(console.cheats, k) then
str = str .. "\n " .. build_scheme(console.get_command_info(k))
end
end
return str .. "\nuse 'help <command>'"
end
local command = console.get_command_info(name)
@@ -255,3 +255,13 @@ console.add_command(
return "registered rules:\n" .. names
end
)
console.cheats = {
"blocks.fill",
"tp",
"fragment.place",
"time.set",
"time.daycycle",
"entity.despawn",
"player.respawn"
}