mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-28 20:05:22 +09:00
Commands
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
--[[-- Commands Module - Admin Chat
|
||||
- Adds a command that allows admins to talk in a private chat
|
||||
@commands Admin-Chat
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') --- @dep expcore.common
|
||||
require 'config.expcore-commands.parse_general'
|
||||
|
||||
--- Sends a message in chat that only admins can see
|
||||
-- @command admin-chat
|
||||
-- @tparam string message the message to send in the admin chat
|
||||
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
|
||||
:add_param('message',false)
|
||||
:enable_auto_concat()
|
||||
:set_flag('admin_only',true)
|
||||
:add_alias('ac')
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
--[[-- Commands Module - Bonus
|
||||
- Adds a command that allows players to have increased stats
|
||||
@commands Bonus
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
@@ -15,6 +20,9 @@ Store.register(function(value,category)
|
||||
end
|
||||
end)
|
||||
|
||||
--- Changes the amount of bonus you receive
|
||||
-- @command bonus
|
||||
-- @tparam number amount range 0-50 the percent increase for your bonus
|
||||
Commands.new_command('bonus','Changes the amount of bonus you receive')
|
||||
:add_param('amount','integer-range',0,50)
|
||||
:register(function(player,amount)
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
--[[-- Commands Module - Cheat Mode
|
||||
- Adds a command that allows players to enter cheat mode
|
||||
@commands Cheat-Mode
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore-commands.parse_general'
|
||||
|
||||
--- Toggles cheat mode for your player, or another player.
|
||||
-- @command toggle-cheat-mode
|
||||
-- @tparam[opt=self] LuaPlayer player player to toggle chest mode of, can be nil for self
|
||||
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_param('player',true,'player')
|
||||
:set_defaults{player=function(player)
|
||||
return player -- default is the user using the command
|
||||
end}
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
--[[-- Commands Module - Clear Inventory
|
||||
- Adds a command that allows admins to clear people's inventorys
|
||||
@commands Clear-Inventory
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local move_items = ext_require('expcore.common','move_items') --- @dep expcore.common
|
||||
require 'config.expcore-commands.parse_roles'
|
||||
|
||||
--- Clears a players inventory
|
||||
-- @command clear-inventory
|
||||
-- @tparam LuaPlayer player the player to clear the inventory of
|
||||
Commands.new_command('clear-inventory','Clears a players inventory')
|
||||
:add_param('player',false,'player-role-alive')
|
||||
:add_alias('clear-inv','move-inventory','move-inv')
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
--[[-- Commands Module - Debug
|
||||
- Adds a command that opens the debug frame
|
||||
@commands Debug
|
||||
]]
|
||||
|
||||
local DebugView = require 'modules.gui.debug.main_view' --- @dep modules.gui.debug.main_view
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
|
||||
--- Opens the debug pannel for viewing tables.
|
||||
-- @command debug
|
||||
Commands.new_command('debug','Opens the debug pannel for viewing tables.')
|
||||
:register(function(player,raw)
|
||||
DebugView.open_dubug(player)
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
--[[-- Commands Module - Find
|
||||
- Adds a command that zooms in on the given player
|
||||
@commands Find
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore-commands.parse_general'
|
||||
|
||||
--- Find a player on your map.
|
||||
-- @command find-on-map
|
||||
-- @tparam LuaPlayer the player to find on the map
|
||||
Commands.new_command('find-on-map','Find a player on your map.')
|
||||
:add_param('player',false,'player-online') -- the player to find on the map
|
||||
:add_param('player',false,'player-online')
|
||||
:add_alias('find','zoom-to')
|
||||
:register(function(player,action_player,raw)
|
||||
local position = action_player.position
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
--[[-- Commands Module - Help
|
||||
- Adds a better help command that allows searching of descriotions and names
|
||||
@commands Help
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
require 'config.expcore-commands.parse_general'
|
||||
@@ -9,9 +14,13 @@ Global.register(search_cache,function(tbl)
|
||||
search_cache = tbl
|
||||
end)
|
||||
|
||||
--- Searches for a keyword in all commands you are allowed to use.
|
||||
-- @command chelp
|
||||
-- @tparam string keyword the keyword that will be looked for
|
||||
-- @tparam number page the page of help to view, must be in range of pages
|
||||
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_param('keyword',true)
|
||||
:add_param('page',true,'integer')
|
||||
:set_defaults{keyword='',page=1}
|
||||
:register(function(player,keyword,page,raw)
|
||||
local player_index = player and player.index or 0
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
--[[-- Commands Module - Home
|
||||
- Adds a command that allows setting and teleporting to your home position
|
||||
@commands Home
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
require 'config.expcore-commands.parse_general'
|
||||
@@ -23,6 +28,8 @@ local function floor_pos(position)
|
||||
}
|
||||
end
|
||||
|
||||
--- Teleports you to your home location
|
||||
-- @command home
|
||||
Commands.new_command('home','Teleports you to your home location')
|
||||
:register(function(player,raw)
|
||||
local home = homes[player.index]
|
||||
@@ -35,6 +42,8 @@ Commands.new_command('home','Teleports you to your home location')
|
||||
Commands.print{'expcom-home.return-set',rtn.x,rtn.y}
|
||||
end)
|
||||
|
||||
--- Sets your home location to your current position
|
||||
-- @command home-set
|
||||
Commands.new_command('home-set','Sets your home location to your current position')
|
||||
:register(function(player,raw)
|
||||
local home = homes[player.index]
|
||||
@@ -47,6 +56,8 @@ Commands.new_command('home-set','Sets your home location to your current positio
|
||||
Commands.print{'expcom-home.home-set',pos.x,pos.y}
|
||||
end)
|
||||
|
||||
--- Returns your current home location
|
||||
-- @command home-get
|
||||
Commands.new_command('home-get','Returns your current home location')
|
||||
:register(function(player,raw)
|
||||
local home = homes[player.index]
|
||||
@@ -57,6 +68,8 @@ Commands.new_command('home-get','Returns your current home location')
|
||||
Commands.print{'expcom-home.home-get',pos.x,pos.y}
|
||||
end)
|
||||
|
||||
--- Teleports you to previous location
|
||||
-- @command return
|
||||
Commands.new_command('return','Teleports you to previous location')
|
||||
:register(function(player,raw)
|
||||
local home = homes[player.index]
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
--[[-- Commands Module - Interface
|
||||
- Adds a command that acts as a direct link to the the active softmod, for debug use
|
||||
@commands Interface
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Common = require 'expcore.common' --- @dep expcore.common
|
||||
@@ -52,8 +57,11 @@ local function get_index(self,key)
|
||||
end
|
||||
end
|
||||
|
||||
--- Sends an innovation to be ran and returns the result.
|
||||
-- @command interface
|
||||
-- @tparam string innovation the command that will be run
|
||||
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
|
||||
:add_param('innovation',false)
|
||||
:enable_auto_concat()
|
||||
:set_flag('admin_only',true)
|
||||
:register(function(player,innovation,raw)
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
--[[-- Commands Module - Jail
|
||||
- Adds a commands that allow admins to jail, unjail, and temp ban players
|
||||
@commands Jail
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Jail = require 'modules.control.jail' --- @dep modules.control.jail
|
||||
local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') --- @dep expcore.common
|
||||
require 'config.expcore-commands.parse_roles'
|
||||
|
||||
--- Puts a player into jail and removes all other roles.
|
||||
-- @command jail
|
||||
-- @tparam LuaPlayer player the player that will be jailed
|
||||
-- @tparam[opt] string reason the reason why the player is being jailed
|
||||
Commands.new_command('jail','Puts a player into jail and removes all other roles.')
|
||||
:add_param('player',false,'player-role')
|
||||
:add_param('reason',true)
|
||||
@@ -18,6 +27,9 @@ Commands.new_command('jail','Puts a player into jail and removes all other roles
|
||||
end
|
||||
end)
|
||||
|
||||
--- Removes a player from jail.
|
||||
-- @command unjail
|
||||
-- @tparam LuaPlayer the player that will be unjailed
|
||||
Commands.new_command('unjail','Removes a player from jail.')
|
||||
:add_param('player',false,'player-role')
|
||||
:add_alias('clear-jail','remove-jail')
|
||||
@@ -32,6 +44,10 @@ Commands.new_command('unjail','Removes a player from jail.')
|
||||
end
|
||||
end)
|
||||
|
||||
--- Temp bans a player until the next reset; this requires a reason; this will clear the players inventory.
|
||||
-- @command temp-ban
|
||||
-- @tparam LuaPlayer player the player that will be temp banned
|
||||
-- @tparam string reason the reason that the player is being temp banned
|
||||
Commands.new_command('temp-ban','Temp bans a player until the next reset; this requires a reason; this will clear the players inventory.')
|
||||
:add_param('player',false,'player-role')
|
||||
:add_param('reason',false)
|
||||
@@ -46,6 +62,9 @@ Commands.new_command('temp-ban','Temp bans a player until the next reset; this r
|
||||
end
|
||||
end)
|
||||
|
||||
--- Removes temp ban from a player; this will not restore their items.
|
||||
-- @command clear-temp-ban
|
||||
-- @tparam LuaPlayer player the player to revoke the temp ban from
|
||||
Commands.new_command('clear-temp-ban','Removes temp ban from a player; this will not restore their items.')
|
||||
:add_param('player',false,'player-role')
|
||||
:add_alias('untemp-ban','remove-temp-ban')
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
--[[-- Commands Module - Kill
|
||||
- Adds a command that allows players to kill them selfs and others
|
||||
@commands Kill
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
require 'config.expcore-commands.parse_general'
|
||||
require 'config.expcore-commands.parse_roles'
|
||||
|
||||
--- Kills yourself or another player.
|
||||
-- @command kill
|
||||
-- @tparam[opt=self] LuaPlayer player the player to kill, must be alive to be valid
|
||||
Commands.new_command('kill','Kills yourself or another player.')
|
||||
:add_param('player',true,'player-role-alive') -- the player to kill, must be alive to be valid
|
||||
:add_param('player',true,'player-role-alive')
|
||||
:set_defaults{player=function(player)
|
||||
-- default is the player unless they are dead
|
||||
if player.character and player.character.health > 0 then
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
--[[-- Commands Module - Me
|
||||
- Adds a command that adds * around your message in the chat
|
||||
@commands Me
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
|
||||
--- Sends an action message in the chat
|
||||
-- @command me
|
||||
-- @tparam string action the action that follows your name in chat
|
||||
Commands.new_command('me','Sends an action message in the chat')
|
||||
:add_param('action',false) -- action that is done by the player, just text its meaningless
|
||||
:add_param('action',false)
|
||||
:enable_auto_concat()
|
||||
:register(function(player,action,raw)
|
||||
local player_name = player and player.name or '<Server>'
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
--[[-- Commands Module - Rainbow
|
||||
- Adds a command that prints your message in rainbow font
|
||||
@commands Rainbow
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local format_chat_colour = ext_require('expcore.common','format_chat_colour') --- @dep expcore.common
|
||||
|
||||
@@ -35,8 +40,11 @@ local function next_color(color,step)
|
||||
return step_color(new_color)
|
||||
end
|
||||
|
||||
--- Sends an rainbow message in the chat
|
||||
-- @command rainbow
|
||||
-- @tparam string message the message that will be printed in chat
|
||||
Commands.new_command('rainbow','Sends an rainbow message in the chat')
|
||||
:add_param('message',false) -- action that is done by the player, just text its meaningless
|
||||
:add_param('message',false)
|
||||
:enable_auto_concat()
|
||||
:register(function(player,message,raw)
|
||||
local player_name = player and player.name or '<Server>'
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
--[[-- Commands Module - Repair
|
||||
- Adds a command that allows an admin to repair and revive a large area
|
||||
@commands Repair
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local config = require 'config.repair' --- @dep config.repair
|
||||
require 'config.expcore-commands.parse_general'
|
||||
|
||||
local max_time_to_live = 4294967295 -- unit32 max
|
||||
--- Repairs entities on your force around you
|
||||
-- @command repair
|
||||
-- @tparam number range the range to repair stuff in, there is a max limit to this
|
||||
Commands.new_command('repair','Repairs entities on your force around you')
|
||||
:add_param('range',false,'integer-range',1,config.max_range)
|
||||
:register(function(player,range,raw)
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
--[[-- Commands Module - Reports
|
||||
- Adds a commands that allow players to report other players
|
||||
@commands Reports
|
||||
]]
|
||||
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Reports = require 'modules.control.reports' --- @dep modules.control.reports
|
||||
local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') --- @dep expcore.common
|
||||
require 'config.expcore-commands.parse_general'
|
||||
|
||||
--- Reports a player and notifies moderators
|
||||
-- @command report
|
||||
-- @tparam LuaPlayer player the player to report, some players are immune
|
||||
-- @tparam string reason the reason the player is being reported
|
||||
Commands.new_command('report','Reports a player and notifies moderators')
|
||||
:add_param('player',false,function(input,player,reject)
|
||||
input = Commands.parse('player',input,player,reject)
|
||||
@@ -28,6 +37,9 @@ end)
|
||||
end
|
||||
end)
|
||||
|
||||
--- Gets a list of all reports that a player has on them. If no player then lists all players and the number of reports on them.
|
||||
-- @command get-reports
|
||||
-- @tparam LuaPlayer player the player to get the report for
|
||||
Commands.new_command('get-reports','Gets a list of all reports that a player has on them. If no player then lists all players and the number of reports on them.')
|
||||
:add_param('player',true,'player')
|
||||
:add_alias('reports','list-reports')
|
||||
@@ -51,6 +63,10 @@ Commands.new_command('get-reports','Gets a list of all reports that a player has
|
||||
end
|
||||
end)
|
||||
|
||||
--- Clears all reports from a player or just the report from one player.
|
||||
-- @command clear-reports
|
||||
-- @tparam LuaPlayer player the player to clear the report(s) from
|
||||
-- @tparam[opt=all] LuaPlayer from-player remove only the report made by this player
|
||||
Commands.new_command('clear-reports','Clears all reports from a player or just the report from one player.')
|
||||
:add_param('player',false,'player')
|
||||
:add_param('from-player',true,'player')
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
--[[-- Commands Module - Roles
|
||||
- Adds a commands that allow interaction with the role system
|
||||
@commands Roles
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local Colours = require 'resources.color_presets' --- @dep resources.color_presets
|
||||
@@ -6,6 +11,10 @@ local format_chat_player_name, format_chat_colour_localized = ext_require('expco
|
||||
'format_chat_colour_localized'
|
||||
)
|
||||
|
||||
--- Assigns a role to a player
|
||||
-- @command assign-role
|
||||
-- @tparam LuaPlayer player the player to assign the role to
|
||||
-- @tparam string role the name of the role to assign to the player, supports auto complete after enter
|
||||
Commands.new_command('assign-role','Assigns a role to a player')
|
||||
:add_param('player',false,'player-role')
|
||||
:add_param('role',false,'role')
|
||||
@@ -20,6 +29,10 @@ Commands.new_command('assign-role','Assigns a role to a player')
|
||||
end
|
||||
end)
|
||||
|
||||
--- Unassigns a role from a player
|
||||
-- @command unassign-role
|
||||
-- @tparam LuaPlayer player the player to unassign the role from
|
||||
-- @tparam string role the name of the role to unassign from the player, supports auto complete after enter
|
||||
Commands.new_command('unassign-role','Unassigns a role from a player')
|
||||
:add_param('player',false,'player-role')
|
||||
:add_param('role',false,'role')
|
||||
@@ -34,6 +47,9 @@ Commands.new_command('unassign-role','Unassigns a role from a player')
|
||||
end
|
||||
end)
|
||||
|
||||
--- Lists all roles in they correct order
|
||||
-- @command list-roles
|
||||
-- @tparam[opt=all] LuaPlayer player list only the roles which this player has
|
||||
Commands.new_command('list-roles','Lists all roles in they correct order')
|
||||
:add_param('player',true,'player')
|
||||
:add_alias('lsroles','roles')
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
--[[-- Commands Module - Spawn
|
||||
- Adds a command that allows players to teleport to their spawn point
|
||||
@commands Spawn
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
|
||||
@@ -11,6 +16,9 @@ local function teleport(player)
|
||||
return true
|
||||
end
|
||||
|
||||
--- Teleport to spawn
|
||||
-- @command go-to-spawn
|
||||
-- @tparam[opt=self] LuaPlayer player the player to teleport to their spawn point
|
||||
Commands.new_command('go-to-spawn','Teleport to spawn')
|
||||
:add_param('player',true,'player-role-alive')
|
||||
:set_defaults{
|
||||
|
||||
@@ -1,17 +1,28 @@
|
||||
--[[-- Commands Module - Tag
|
||||
- Adds a command that allows players to have a custom tag after their name
|
||||
@commands Tag
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
require 'config.expcore-commands.parse_general'
|
||||
require 'config.expcore-commands.parse_roles'
|
||||
|
||||
--- Sets your player tag.
|
||||
-- @command tag
|
||||
-- @tparam string tag the tag that will be after the name, there is a max length
|
||||
Commands.new_command('tag','Sets your player tag.')
|
||||
:add_param('tag',false,'string-max-length',20) -- new tag for your player max 20 char
|
||||
:add_param('tag',false,'string-max-length',20)
|
||||
:enable_auto_concat()
|
||||
:register(function(player,tag,raw)
|
||||
player.tag = '- '..tag
|
||||
end)
|
||||
|
||||
--- Clears your tag. Or another player if you are admin.
|
||||
-- @command tag-clear
|
||||
-- @tparam[opt=self] LuaPlayer player the player to remove the tag from, nil will apply to self
|
||||
Commands.new_command('tag-clear','Clears your tag. Or another player if you are admin.')
|
||||
:add_param('player',true,'player-role') -- player to remove the tag of, nil to apply to self
|
||||
:add_param('player',true,'player-role')
|
||||
:set_defaults{player=function(player)
|
||||
return player -- default is the user using the command
|
||||
end}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
--[[-- Commands Module - Teleport
|
||||
- Adds a command that allows players to teleport to other players
|
||||
@commands Teleport
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore-commands.parse_general'
|
||||
|
||||
@@ -10,9 +15,13 @@ local function teleport(from_player,to_player)
|
||||
return true
|
||||
end
|
||||
|
||||
--- Teleports a player to another player.
|
||||
-- @command teleport
|
||||
-- @tparam LuaPlayer from_player the player that will be teleported, must be alive
|
||||
-- @tparam LuaPlayer to_player the player to teleport to, must be online (if dead goes to where they died)
|
||||
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_param('from_player',false,'player-alive')
|
||||
:add_param('to_player',false,'player-online')
|
||||
:add_alias('tp')
|
||||
:set_flag('admin_only',true)
|
||||
:register(function(player,from_player,to_player,raw)
|
||||
@@ -26,8 +35,11 @@ Commands.new_command('teleport','Teleports a player to another player.')
|
||||
end
|
||||
end)
|
||||
|
||||
--- Teleports a player to you.
|
||||
-- @command bring
|
||||
-- @tparam LuaPlayer player the player that will be teleported, must be alive
|
||||
Commands.new_command('bring','Teleports a player to you.')
|
||||
:add_param('player',false,'player-alive') -- player that will be teleported, must be alive
|
||||
:add_param('player',false,'player-alive')
|
||||
:set_flag('admin_only',true)
|
||||
:register(function(player,from_player,raw)
|
||||
if from_player.index == player.index then
|
||||
@@ -40,8 +52,11 @@ Commands.new_command('bring','Teleports a player to you.')
|
||||
end
|
||||
end)
|
||||
|
||||
--- Teleports you to a player.
|
||||
-- @command goto
|
||||
-- @tparam LuaPlayer player the player to teleport to, must be online (if dead goes to where they died)
|
||||
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_param('player',false,'player-online')
|
||||
:add_alias('tp-me','tpme')
|
||||
:set_flag('admin_only',true)
|
||||
:register(function(player,to_player,raw)
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
--[[-- Commands Module - Warnings
|
||||
- Adds a commands that allow admins to warn other players
|
||||
@commands Warnings
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Warnings = require 'modules.control.warnings' --- @dep modules.control.warnings
|
||||
local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') --- @dep expcore.common
|
||||
local config = require 'config.warnings' --- @dep config.warnings
|
||||
require 'config.expcore-commands.parse_roles'
|
||||
|
||||
--- Gives a warning to a player; may lead to automatic script action.
|
||||
-- @command give-warning
|
||||
-- @tparam LuaPlayer player the player the will recive a warning
|
||||
-- @tparam string reason the reason the player is being given a warning
|
||||
Commands.new_command('give-warning','Gives a warning to a player; may lead to automatic script action.')
|
||||
:add_param('player',false,'player-role')
|
||||
:add_param('reason',false)
|
||||
@@ -16,6 +25,9 @@ Commands.new_command('give-warning','Gives a warning to a player; may lead to au
|
||||
game.print{'expcom-warnings.received',action_player_name_color,by_player_name_color,reason}
|
||||
end)
|
||||
|
||||
--- Gets the number of warnings a player has. If no player then lists all players and the number of warnings they have.
|
||||
-- @command get-warnings
|
||||
-- @tparam[opt=list] LuaPlayer player the player to get the warning for, if nil all players are listed
|
||||
Commands.new_command('get-warnings','Gets the number of warnings a player has. If no player then lists all players and the number of warnings they have.')
|
||||
:add_param('player',true,'player')
|
||||
:add_alias('warnings','list-warnings')
|
||||
@@ -46,6 +58,9 @@ Commands.new_command('get-warnings','Gets the number of warnings a player has. I
|
||||
end
|
||||
end)
|
||||
|
||||
--- Clears all warnings (and script warnings) from a player
|
||||
-- @command clear-warnings
|
||||
-- @tparam LuaPlayer player the player to clear the warnings from
|
||||
Commands.new_command('clear-warnings','Clears all warnings (and script warnings) from a player')
|
||||
:add_param('player',false,'player')
|
||||
:register(function(player,action_player,raw)
|
||||
|
||||
Reference in New Issue
Block a user