Changed add_tag to set_flag on commands

This commit is contained in:
Cooldude2606
2019-04-09 16:16:05 +01:00
parent cbde97e7b0
commit e9a4382277
8 changed files with 19 additions and 19 deletions

View File

@@ -4,7 +4,7 @@ require 'config.command_parse_general'
Commands.new_command('admin-chat','Sends a message in chat that only admins can see.')
:add_param('message',false) -- the message to send in the admin chat
:enable_auto_concat()
:add_tag('admin_only',true)
:set_flag('admin_only',true)
:add_alias('ac')
:register(function(player,message,raw)
local pcc = player and player.chat_color or {r=255,g=255,b=255}

View File

@@ -3,10 +3,10 @@ require 'config.command_parse_general'
Commands.new_command('toggle-cheat-mode','Toggles cheat mode for your player, or another player.')
:add_param('player',true,'player') -- player to toggle chest mode of, can be nil for self
:add_defaults{player=function(player)
:set_defaults{player=function(player)
return player -- default is the user using the command
end}
:add_tag('admin_only',true)
:set_flag('admin_only',true)
:register(function(player,action_player,raw)
action_player.cheat_mode = not action_player.cheat_mode
end)

View File

@@ -12,7 +12,7 @@ end)
Commands.new_command('chelp','Searches for a keyword in all commands you are allowed to use.')
:add_param('keyword',true) -- the keyword that will be looked for
:add_param('page',true,'integer') -- the keyword that will be looked for
:add_defaults{keyword='',page=1}
:set_defaults{keyword='',page=1}
:register(function(player,keyword,page,raw)
local player_index = player and player.index or 0
-- if keyword is a number then treat it as page number

View File

@@ -48,7 +48,7 @@ end
Commands.new_command('interface','Sends an innovation to be ran and returns the result.')
:add_param('innovation',false) -- the message to send in the admin chat
:enable_auto_concat()
:add_tag('admin_only',true)
:set_flag('admin_only',true)
:register(function(player,innovation,raw)
if not innovation:find('%s') and not innovation:find('return') then
-- if there are no spaces and return is not present then return is appended to the start

View File

@@ -3,13 +3,13 @@ require 'config.command_parse_general'
Commands.new_command('kill','Kills yourself or another player.')
:add_param('player',true,'player-alive') -- the player to kill, must be alive to be valid
:add_defaults{player=function(player)
:set_defaults{player=function(player)
-- default is the player unless they are dead
if player.character and player.character.health > 0 then
return player
end
end}
:add_tag('admin_only',true)
:set_flag('admin_only',true)
:register(function(player,action_player,raw)
if not action_player then
-- can only be nil if no player given and the user is dead

View File

@@ -10,7 +10,7 @@ end)
Commands.new_command('tag-clear','Clears your tag. Or another player if you are admin.')
:add_param('player',true,'player') -- player to remove the tag of, nil to apply to self
:add_defaults{player=function(player)
:set_defaults{player=function(player)
return player -- default is the user using the command
end}
:register(function(player,action_player,raw)

View File

@@ -14,7 +14,7 @@ Commands.new_command('teleport','Teleports a player to another player.')
:add_param('from_player',false,'player-alive') -- player that will be teleported, must be alive
:add_param('to_player',false,'player-online') -- player to teleport to, must be online (if dead goes to where they died)
:add_alias('tp')
:add_tag('admin_only',true)
:set_flag('admin_only',true)
:register(function(player,from_player,to_player,raw)
if from_player.index == to_player.index then
-- return if attempting to teleport to self
@@ -28,7 +28,7 @@ end)
Commands.new_command('bring','Teleports a player to you.')
:add_param('player',false,'player-alive') -- player that will be teleported, must be alive
:add_tag('admin_only',true)
:set_flag('admin_only',true)
:register(function(player,from_player,raw)
if from_player.index == player.index then
-- return if attempting to teleport to self
@@ -43,7 +43,7 @@ end)
Commands.new_command('goto','Teleports you to a player.')
:add_param('player',false,'player-online') -- player to teleport to, must be online (if dead goes to where they died)
:add_alias('tp-me','tpme')
:add_tag('admin_only',true)
:set_flag('admin_only',true)
:register(function(player,to_player,raw)
if to_player.index == player.index then
-- return if attempting to teleport to self