Added command_auth_runtime_disable

This commit is contained in:
Cooldude2606
2019-03-24 15:39:17 +00:00
parent 06b4ae9b25
commit 7c4210f8b4
11 changed files with 53 additions and 351 deletions

View File

@@ -8,7 +8,7 @@ Commands.add_authenticator(function(player,command,tags,reject)
if player.admin then
return true
else
return reject('This command is for admins only!')
return reject{'command-auth.admin-only'}
end
else
return true

View File

@@ -0,0 +1,25 @@
--- This config for command auth allows commands to be globally enabled and disabled during runtime
-- this config adds Commands.disable and Commands.enable to enable and disable commands for all users
local Commands = require 'expcore.commands'
local Global = require 'utils.global'
local disabled_commands = {}
Global.register(disabled_commands,function(tbl)
disabled_commands = tbl
end)
function Commands.disable(command_name)
disabled_commands[command_name] = true
end
function Commands.enable(command_name)
disabled_commands[command_name] = nil
end
Commands.add_authenticator(function(player,command,tags,reject)
if disabled_commands[command] then
return reject{'command-auth.command-disabled'}
else
return true
end
end)

3
config/config.cfg Normal file
View File

@@ -0,0 +1,3 @@
[command-auth]
admin-only=This command is for (game) admins only!
command-disabled=This command has been disabled by management!

12
config/death_markers.lua Normal file
View File

@@ -0,0 +1,12 @@
--- This config controls what happens when a player dies mostly about map markers and item collection
-- allow_teleport_to_body_command and allow_collect_bodies_command can be over ridden if command_auth_runtime_disable is present
-- if not present then the commands will not be loaded into the game
return {
allow_teleport_to_body_command=false, -- allows use of /return-to-body which teleports you to your last death
allow_collect_bodies_command=false, -- allows use of /collect-body which returns all your items to you and removes the body
use_chests_as_bodies=false, -- weather items should be moved into a chest when a player dies
auto_collect_bodies=false, -- enables items being returned to the spawn point in chests upon death
show_map_markers=true, -- shows markers on the map where bodies are
include_time_of_death=true, -- weather to include the time of death on the map marker
map_icon='' -- the icon that the map marker shows '' means no icon
}

View File

@@ -18,6 +18,7 @@ return {
'modules.addons.chat-popups',
'modules.addons.damage-popups',
-- Config Files
'config.command_auth_admin', -- commands tags with admin_only are blocked for non admins
'config.command_auth_admin', -- commands tagged with admin_only are blocked for non admins
'config.command_auth_runtime_disable', -- allows commands to be enabled and disabled during runtime
'config.permission_groups', -- loads some predefined permission groups
}