mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 20:11:50 +00:00
add 'cheat-commands' rule
This commit is contained in:
parent
2e24d60404
commit
5e9b290aea
3 changed files with 37 additions and 5 deletions
|
|
@ -52,6 +52,22 @@ function submit(text)
|
|||
add_to_history(text)
|
||||
setup_variables()
|
||||
|
||||
text = text:trim()
|
||||
local name
|
||||
for s in text:gmatch("%S+") do
|
||||
name = s
|
||||
break
|
||||
end
|
||||
if name == nil then
|
||||
name = text
|
||||
end
|
||||
if not rules.get("cheat-commands") and table.has(console.cheats, name) then
|
||||
console.log("cheat commands are disabled")
|
||||
document.prompt.text = ""
|
||||
document.prompt.focused = true
|
||||
return
|
||||
end
|
||||
|
||||
document.log.caret = -1
|
||||
local status, result = pcall(console.execute, text)
|
||||
if result then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue