mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-14 00:14:52 +09:00
Merge branch 'feature/jail' into dev
This commit is contained in:
commit
098e43b485
23 files changed
+263
-66
No files matched your search
+5
-6
@@ -147,7 +147,7 @@ Roles.new_role('Regular','Reg')
|
||||
end)
|
||||
|
||||
--- Guest/Default role
|
||||
Roles.new_role('Guest','')
|
||||
local default = Roles.new_role('Guest','')
|
||||
:set_permission_group('Guest')
|
||||
:set_custom_color{r=185,g=187,b=160}
|
||||
:allow{
|
||||
@@ -164,15 +164,14 @@ Roles.new_role('Jail')
|
||||
:set_permission_group('Restricted')
|
||||
:set_custom_color{r=50,g=50,b=50}
|
||||
:set_block_auto_promote(true)
|
||||
:allow{
|
||||
}
|
||||
:disallow(default.allowed)
|
||||
|
||||
--- System defaults which are required to be set
|
||||
Roles.set_root('System')
|
||||
Roles.set_default('Guest')
|
||||
|
||||
Roles.define_role_order{
|
||||
'System',
|
||||
'System', -- Best to keep root at top
|
||||
'Senior Administrator',
|
||||
'Administrator',
|
||||
'Moderator',
|
||||
@@ -184,8 +183,8 @@ Roles.define_role_order{
|
||||
'Veteran',
|
||||
'Member',
|
||||
'Regular',
|
||||
'Guest',
|
||||
'Jail'
|
||||
'Jail',
|
||||
'Guest' -- Default must be last if you want to apply restrictions to other roles
|
||||
}
|
||||
|
||||
Roles.override_player_roles{
|
||||
|
||||
@@ -497,10 +497,39 @@ function Public.table_keysort(tbl)
|
||||
return _tbl
|
||||
end
|
||||
|
||||
--- Returns a message with valid chat tags to change its colour
|
||||
-- @tparam message string the message that will be in the output
|
||||
-- @tparam color table a color which contains r,g,b as its keys
|
||||
-- @treturn string the message with the color tags included
|
||||
function Public.format_chat_colour(message,color)
|
||||
color = color or Colours.white
|
||||
local color_tag = '[color='..math.round(color.r,3)..','..math.round(color.g,3)..','..math.round(color.b,3)..']'
|
||||
return string.format('%s%s[/color]',color_tag,message)
|
||||
end
|
||||
|
||||
--- Returns a message with valid chat tags to change its colour, using localization
|
||||
-- @tparam message ?string|table the message that will be in the output
|
||||
-- @tparam color table a color which contains r,g,b as its keys
|
||||
-- @treturn table the message with the color tags included
|
||||
function Public.format_chat_colour_localized(message,color)
|
||||
color = color or Colours.white
|
||||
color = math.round(color.r,3)..','..math.round(color.g,3)..','..math.round(color.b,3)
|
||||
return {'color-tag',color,message}
|
||||
end
|
||||
|
||||
--- Returns the players name in the players color
|
||||
-- @tparam player LuaPlayer the player to use the name and color of
|
||||
-- @tparam[opt=false] raw_string boolean when true a string is returned rather than a localized string
|
||||
-- @treturn table the players name with tags for the players color
|
||||
function Public.format_chat_player_name(player,raw_string)
|
||||
player = Game.get_player_from_any(player)
|
||||
local player_name = player and player.name or '<Server>'
|
||||
local player_chat_colour = player and player.chat_color or Colors.white
|
||||
if raw_string then
|
||||
return Public.format_chat_colour(player_name,player_chat_colour)
|
||||
else
|
||||
return Public.format_chat_colour_localized(player_name,player_chat_colour)
|
||||
end
|
||||
end
|
||||
|
||||
return Public
|
||||
+36
-22
@@ -114,8 +114,8 @@
|
||||
Roles.get_player_roles(player) --- Gets all the roles of the given player, this will always contain the default role
|
||||
Roles.get_player_highest_role(player) --- Gets the highest role which the player has, can be used to compeer one player to another
|
||||
|
||||
Roles.assign_player(player,roles,by_player_name) --- Gives a player the given role(s) with an option to pass a by player name used in the log
|
||||
Roles.unassign_player(player,roles,by_player_name) --- Removes a player from the given role(s) with an option to pass a by player name used in the log
|
||||
Roles.assign_player(player,roles,by_player_name,silent) --- Gives a player the given role(s) with an option to pass a by player name used in the log
|
||||
Roles.unassign_player(player,roles,by_player_name,silent) --- Removes a player from the given role(s) with an option to pass a by player name used in the log
|
||||
Roles.override_player_roles(roles) --- Overrides all player roles with the given table of roles, useful to mass set roles on game start
|
||||
|
||||
Roles.player_has_role(player,search_role) --- A test for weather a player has the given role
|
||||
@@ -170,15 +170,31 @@ local Roles = {
|
||||
_prototype={}
|
||||
}
|
||||
|
||||
--- When global is loaded it will have the metatable re-assigned to the roles
|
||||
Global.register(Roles.config,function(tbl)
|
||||
Roles.config = tbl
|
||||
for _,role in pairs(Roles.config.roles) do
|
||||
setmetatable(role,{__index=Roles._prototype})
|
||||
local parent = Roles.config.roles[role.parent]
|
||||
if parent then
|
||||
setmetatable(role.allowed_actions, {__index=parent.allowed_actions})
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
--- Internal function used to trigger a few different things when roles are changed
|
||||
local function emit_player_roles_updated(player,type,roles,by_player_name)
|
||||
-- this is the raw internal trigger as the other function is called at other times
|
||||
-- there is a second half called role_update which triggers after the event call, it also is called when a player joins
|
||||
local function emit_player_roles_updated(player,type,roles,by_player_name,skip_game_print)
|
||||
by_player_name = game.player and game.player.name or by_player_name or '<server>'
|
||||
local by_player = Game.get_player_from_any(by_player_name)
|
||||
local by_player_index = by_player and by_player.index or 0
|
||||
-- get the event id from the type of emit
|
||||
local event = Roles.player_role_assigned
|
||||
if type == 'unassign' then
|
||||
event = Roles.player_role_unassigned
|
||||
end
|
||||
local by_player = Game.get_player_from_any(by_player_name)
|
||||
local by_player_index = by_player and by_player.index or 0
|
||||
-- convert the roles to objects and get the names of the roles
|
||||
local role_names = {}
|
||||
for index,role in pairs(roles) do
|
||||
role = Roles.get_role_from_any(role)
|
||||
@@ -187,7 +203,15 @@ local function emit_player_roles_updated(player,type,roles,by_player_name)
|
||||
table.insert(role_names,role.name)
|
||||
end
|
||||
end
|
||||
game.print({'expcore-roles.game-message-'..type,player.name,table.concat(role_names,', '),by_player_name},Colours.cyan)
|
||||
-- output to all the different locations: game print, player sound, event trigger and role log
|
||||
if not skip_game_print then
|
||||
game.print({'expcore-roles.game-message-'..type,player.name,table.concat(role_names,', '),by_player_name},Colours.cyan)
|
||||
end
|
||||
if type == 'assign' then
|
||||
player.play_sound{path='utility/achievement_unlocked'}
|
||||
else
|
||||
player.play_sound{path='utility/game_lost'}
|
||||
end
|
||||
script.raise_event(event,{
|
||||
name=Roles.player_roles_updated,
|
||||
tick=game.tick,
|
||||
@@ -203,18 +227,6 @@ local function emit_player_roles_updated(player,type,roles,by_player_name)
|
||||
}..'\n',true,0)
|
||||
end
|
||||
|
||||
--- When global is loaded it will have the metatable re-assigned to the roles
|
||||
Global.register(Roles.config,function(tbl)
|
||||
Roles.config = tbl
|
||||
for _,role in pairs(Roles.config.roles) do
|
||||
setmetatable(role,{__index=Roles._prototype})
|
||||
local parent = Roles.config.roles[role.parent]
|
||||
if parent then
|
||||
setmetatable(role.allowed_actions, {__index=parent.allowed_actions})
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
--- Returns a string which contains all roles in index order displaying all data for them
|
||||
-- @treturn string the debug output string
|
||||
function Roles.debug()
|
||||
@@ -293,7 +305,8 @@ end
|
||||
-- @tparam player LuaPlayer the player that will be assigned the roles
|
||||
-- @tparam role table a table of roles that the player will be given, can be one role and can be role names
|
||||
-- @tparam[opt=<server>] by_player_name string the name of the player that will be shown in the log
|
||||
function Roles.assign_player(player,roles,by_player_name)
|
||||
-- @tparam[opt=false] silent boolean when true there will be no game message printed
|
||||
function Roles.assign_player(player,roles,by_player_name,silent)
|
||||
player = Game.get_player_from_any(player)
|
||||
if not player then return end
|
||||
if type(roles) ~= 'table' or roles.name then
|
||||
@@ -305,14 +318,15 @@ function Roles.assign_player(player,roles,by_player_name)
|
||||
role:add_player(player,false,true)
|
||||
end
|
||||
end
|
||||
emit_player_roles_updated(player,'assign',roles,by_player_name)
|
||||
emit_player_roles_updated(player,'assign',roles,by_player_name,silent)
|
||||
end
|
||||
|
||||
--- Removes a player from the given role(s) with an option to pass a by player name used in the log
|
||||
-- @tparam player LuaPlayer the player that will have the roles removed
|
||||
-- @tparam roles table a table of roles to be removed from the player, can be one role and can be role names
|
||||
-- @tparam[opt=<server>] by_player_name string the name of the player that will be shown in the logs
|
||||
function Roles.unassign_player(player,roles,by_player_name)
|
||||
-- @tparam[opt=false] silent boolean when true there will be no game message printed
|
||||
function Roles.unassign_player(player,roles,by_player_name,silent)
|
||||
player = Game.get_player_from_any(player)
|
||||
if not player then return end
|
||||
if type(roles) ~= 'table' or roles.name then
|
||||
@@ -324,7 +338,7 @@ function Roles.unassign_player(player,roles,by_player_name)
|
||||
role:remove_player(player,false,true)
|
||||
end
|
||||
end
|
||||
emit_player_roles_updated(player,'unassign',roles,by_player_name)
|
||||
emit_player_roles_updated(player,'unassign',roles,by_player_name,silent)
|
||||
end
|
||||
|
||||
--- Overrides all player roles with the given table of roles, useful to mass set roles on game start
|
||||
|
||||
+12
-4
@@ -1,6 +1,6 @@
|
||||
[exp-commands]
|
||||
kill-already-dead=You are already dead.
|
||||
admin-chat-format=[Admin Chat] [color=__3__]__1__[/color]: __2__
|
||||
admin-chat-format=[Admin Chat] __1__: __2__
|
||||
tp-no-position-found=No position to teleport to was found, please try again later.
|
||||
tp-to-self=Player can not be teleported to themselves.
|
||||
chelp-title=Help results for "__1__":
|
||||
@@ -9,6 +9,14 @@ chelp-format=/__1__ __2__ - __3__ __4__
|
||||
chelp-alias=Alias: __1__
|
||||
chelp-out-of-range=__1__ is an invalid page number.
|
||||
roles-higher-role=The role you tried to assign is higher than your highest.
|
||||
roles-list=All roles are: [color=__1__]__2__[/color]
|
||||
roles-list-player=[color=__1__]__2__[/color] has: [color=__3__]__4__[/color]
|
||||
roles-list-element=__1__, [color=__2__]__3__[/color]
|
||||
roles-list=All roles are: __1__
|
||||
roles-list-player=__1__ has: __2__
|
||||
roles-list-element=__1__, __2__
|
||||
jail-give=__1__ was jailed by __2__. Reason: __3__
|
||||
jail-remove=__1__ was unjailed by __2__.
|
||||
jail-already-jailed=__1__ is already in jail.
|
||||
jail-not-jailed=__1__ is not currently in jail.
|
||||
jail-temp-ban=__1__ was temp banned until next reset by __2__. Reason: __3__
|
||||
jail-temp-ban-clear=__1__ was cleared from temp banned by __2__.
|
||||
jail-not-temp-banned=__1__ is not currently temp banned.
|
||||
jail-already-banned=__1__ is already banned.
|
||||
@@ -1,4 +1,5 @@
|
||||
time-symbol-days-short=__1__d
|
||||
color-tag=[color=__1__]__2__[/color]
|
||||
|
||||
[expcore-commands]
|
||||
unauthorized=Unauthorized, Access is denied due to invalid credentials
|
||||
|
||||
@@ -7,20 +7,18 @@ local config = require 'config.compilatron'
|
||||
local messages = config.messages
|
||||
local locations = config.locations
|
||||
|
||||
local compilatrons = {}
|
||||
local current_messages = {}
|
||||
Global.register(
|
||||
{
|
||||
compilatrons = compilatrons,
|
||||
current_messages = current_messages
|
||||
},
|
||||
function(tbl)
|
||||
compilatrons = tbl.compilatrons
|
||||
current_messages = tbl.current_messages
|
||||
end
|
||||
)
|
||||
local Public = {
|
||||
compilatrons={},
|
||||
current_messages={}
|
||||
}
|
||||
|
||||
local Public = {}
|
||||
Global.register({
|
||||
Public.compilatrons,
|
||||
Public.current_messages
|
||||
},function(tbl)
|
||||
Public.compilatrons=tbl[1]
|
||||
Public.current_messages=tbl[2]
|
||||
end)
|
||||
|
||||
--- This will re-create the speech bubble after it de-spawns called with set_timeout
|
||||
local callback =
|
||||
@@ -33,17 +31,17 @@ local callback =
|
||||
ent.surface.create_entity(
|
||||
{name = 'compi-speech-bubble', text = messages[name][msg_number], position = {0, 0}, source = ent}
|
||||
)
|
||||
current_messages[name] = {message = message, msg_number = msg_number}
|
||||
Public.global.current_messages[name] = {message = message, msg_number = msg_number}
|
||||
end
|
||||
)
|
||||
|
||||
--- This will move the messages onto the next message in the loop
|
||||
local function circle_messages()
|
||||
for name, ent in pairs(compilatrons) do
|
||||
for name, ent in pairs(Public.global.compilatrons) do
|
||||
if not ent.valid then
|
||||
Public.spawn_compilatron(game.players[1].surface,name)
|
||||
end
|
||||
local current_message = current_messages[name]
|
||||
local current_message = Public.global.current_messages[name]
|
||||
local msg_number
|
||||
local message
|
||||
if current_message ~= nil then
|
||||
@@ -73,12 +71,12 @@ function Public.add_compilatron(entity, name)
|
||||
if name == nil then
|
||||
return
|
||||
end
|
||||
compilatrons[name] = entity
|
||||
Public.global.compilatrons[name] = entity
|
||||
local message =
|
||||
entity.surface.create_entity(
|
||||
{name = 'compi-speech-bubble', text = messages[name][1], position = {0, 0}, source = entity}
|
||||
)
|
||||
current_messages[name] = {message = message, msg_number = 1}
|
||||
Public.global.current_messages[name] = {message = message, msg_number = 1}
|
||||
end
|
||||
|
||||
--- This spawns a new compilatron on a surface with the given location tag (not a position)
|
||||
|
||||
@@ -94,6 +94,4 @@ if config.auto_collect_bodies then
|
||||
end
|
||||
|
||||
-- this is so other modules can access the logs
|
||||
return function()
|
||||
return deaths
|
||||
end
|
||||
return deaths
|
||||
@@ -0,0 +1,78 @@
|
||||
local Roles = require 'expcore.roles'
|
||||
local Game = require 'utils.game'
|
||||
local Global = require 'utils.global'
|
||||
local move_items = ext_require('expcore.common','move_items')
|
||||
|
||||
local Public = {
|
||||
old_roles = {},
|
||||
temp_bans = {}
|
||||
}
|
||||
Global.register({
|
||||
Public.old_roles,
|
||||
Public.temp_bans
|
||||
},function(tbl)
|
||||
Public.old_roles=tbl[1]
|
||||
Public.temp_bans=tbl[2]
|
||||
end)
|
||||
|
||||
--- Jails a player, this is only the logic there is no output to players
|
||||
-- @tparam player LuaPlayer the player that will be jailed, must not be in jail
|
||||
-- @tparam[opt='<server>'] by_player_name string the name of the player doing the action used in logs
|
||||
-- @treturn the number of roles that were removed, nil if there was an error
|
||||
function Public.jail_player(player,by_player_name)
|
||||
player = Game.get_player_from_any(player)
|
||||
if not player then return end
|
||||
if Roles.player_has_role(player,'Jail') then return end
|
||||
local old_roles = Role.get_player_roles(player)
|
||||
Public.old_roles[player.name] = old_roles
|
||||
Roles.unassign_player(player,old_roles,by_player_name,true)
|
||||
Roles.assign_player(player,'Jail',by_player_name,true)
|
||||
return #old_roles
|
||||
end
|
||||
|
||||
--- Unjails a player, this is only the logic there is no output to players
|
||||
-- @tparam player LuaPlayer the player that will be unjailed, must be in jail
|
||||
-- @tparam[opt='<server>'] by_player_name string string the name of the player who is doing the action
|
||||
-- @treturn the number of roles that were added, nil if there was an error
|
||||
function Public.unjail_player(player,by_player_name)
|
||||
player = Game.get_player_from_any(player)
|
||||
if not player then return end
|
||||
if not Roles.player_has_role(player,'Jail') then return end
|
||||
local old_roles = Public.old_roles[player.name]
|
||||
Roles.unassign_player(player,'Jail',by_player_name,true)
|
||||
Roles.assign_player(player,old_roles,by_player_name,true)
|
||||
return #old_roles
|
||||
end
|
||||
|
||||
--- Temp bans a player which is similar to jail but will store the reason for the action and clears items
|
||||
-- @tparam player LuaPlayer the player that will be temp baned, must not be temp banned
|
||||
-- @tparam[opt='<server>'] by_player_name string the name of the player that is doing the action
|
||||
-- @tparam[opt='None Given.'] reason string the reason that will be stored for this temp ban
|
||||
-- @treturn boolean true if successful else will return nil
|
||||
function Public.temp_ban_player(player,by_player_name,reason)
|
||||
player = Game.get_player_from_any(player)
|
||||
reason = reason or 'None Given.'
|
||||
if not player then return end
|
||||
if Public.temp_bans[player.name] then return end
|
||||
Public.jail_player(player,by_player_name)
|
||||
Public.temp_bans[player.name] = {reason,by_player_name}
|
||||
local inv = player.get_main_inventory()
|
||||
move_items(inv.get_contents())
|
||||
inv.clear()
|
||||
return true
|
||||
end
|
||||
|
||||
--- Removes temp ban from a player, note this does not restore the items
|
||||
-- @tparam player LuaPlayer the player that will be cleared from temp baned, must be temp banned
|
||||
-- @tparam[opt='<server>'] by_player_name string the name of the player that is doing the action
|
||||
-- @treturn boolean true if successful else will return nil
|
||||
function Public.clear_temp_ban_player(player,by_player_name)
|
||||
player = Game.get_player_from_any(player)
|
||||
if not player then return end
|
||||
if not Public.temp_bans[player.name] then return end
|
||||
Public.unjail_player(player,by_player_name)
|
||||
Public.temp_bans[player.name] = nil
|
||||
return true
|
||||
end
|
||||
|
||||
return Public
|
||||
@@ -141,4 +141,7 @@ Event.add(defines.events.on_player_created, function(event)
|
||||
spawn_belts(s,p)
|
||||
spawn_turrets()
|
||||
player.teleport(p,s)
|
||||
end)
|
||||
end)
|
||||
|
||||
-- Way to access global table
|
||||
return turrets
|
||||
@@ -1,4 +1,5 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
local format_chat_player_name = ext_require('expcore.common','format_chat_player_name')
|
||||
require 'config.command_parse_general'
|
||||
|
||||
Commands.new_command('admin-chat','Sends a message in chat that only admins can see.')
|
||||
@@ -7,12 +8,10 @@ Commands.new_command('admin-chat','Sends a message in chat that only admins can
|
||||
: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}
|
||||
local player_name = player and player.name or '<Server>'
|
||||
local colour = string.format('%s,%s,%s',pcc.r,pcc.g,pcc.b)
|
||||
local player_name_colour = format_chat_player_name(player)
|
||||
for _,return_player in pairs(game.connected_players) do
|
||||
if return_player.admin then
|
||||
return_player.print{'exp-commands.admin-chat-format',player_name,message,colour}
|
||||
return_player.print{'exp-commands.admin-chat-format',player_name_colour,message}
|
||||
end
|
||||
end
|
||||
return Commands.success -- prevents command complete message from showing
|
||||
|
||||
@@ -72,4 +72,7 @@ Commands.new_command('chelp','Searches for a keyword in all commands you are all
|
||||
end
|
||||
-- blocks command complete message
|
||||
return Commands.success
|
||||
end)
|
||||
end)
|
||||
|
||||
-- way to access global
|
||||
return search_cache
|
||||
@@ -91,4 +91,8 @@ add_interface_callback('position',function(player) return player.position end)
|
||||
add_interface_callback('entity',function(player) return player.selected end)
|
||||
add_interface_callback('tile',function(player) return player.surface.get_tile(player.position) end)
|
||||
|
||||
return add_interface_callback
|
||||
return {
|
||||
add_interface_callback=add_interface_callback,
|
||||
interface_env=interface_env,
|
||||
interface_callbacks=interface_callbacks
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
local JailControl = require 'modules.addons.jail-control'
|
||||
local format_chat_player_name = ext_require('expcore.common','format_chat_player_name')
|
||||
require 'config.command_parse_roles'
|
||||
|
||||
Commands.new_command('jail','Puts a player into jail and removes all other roles.')
|
||||
:add_param('player',false,'player-role')
|
||||
:add_param('reason',true)
|
||||
:enable_auto_concat()
|
||||
:register(function(player,action_player,reason,raw)
|
||||
reason = reason or 'Non Given.'
|
||||
local action_player_name_color = format_chat_player_name(action_player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
if JailControl.jail_player(action_player,player.name) then
|
||||
game.print{'exp-commands.jail-give',action_player_name_color,by_player_name_color,reason}
|
||||
else
|
||||
return Commands.error{'exp-commands.jail-already-jailed',action_player_name_color}
|
||||
end
|
||||
end)
|
||||
|
||||
Commands.new_command('unjail','Puts a player into jail and removes all other roles.')
|
||||
:add_param('player',false,'player-role')
|
||||
:enable_auto_concat()
|
||||
:register(function(player,action_player,raw)
|
||||
local action_player_name_color = format_chat_player_name(action_player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
if JailControl.unjail_player(action_player,player.name) then
|
||||
game.print{'exp-commands.jail-remove',action_player_name_color,by_player_name_color}
|
||||
else
|
||||
return Commands.error{'exp-commands.jail-not-jailed',action_player_name_color}
|
||||
end
|
||||
end)
|
||||
|
||||
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)
|
||||
:enable_auto_concat()
|
||||
:register(function(player,action_player,reason,raw)
|
||||
local action_player_name_color = format_chat_player_name(action_player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
if JailControl.temp_ban_player(action_player,player.name,reason) then
|
||||
game.print{'exp-commands.jail-temp-ban',action_player_name_color,by_player_name_color,reason}
|
||||
else
|
||||
return Commands.error{'exp-commands.jail-already-banned',action_player_name_color}
|
||||
end
|
||||
end)
|
||||
|
||||
Commands.new_command('remove-temp-ban','Removes temp ban from a player; this will not restore they items.')
|
||||
:add_param('player',false,'player-role')
|
||||
:add_param('reason',false)
|
||||
:enable_auto_concat()
|
||||
:register(function(player,action_player,reason,raw)
|
||||
local action_player_name_color = format_chat_player_name(action_player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
if JailControl.clear_temp_ban_player(action_player,player.name,reason) then
|
||||
game.print{'exp-commands.jail-temp-ban-clear',action_player_name_color,by_player_name_color}
|
||||
else
|
||||
return Commands.error{'exp-commands.jail-not-temp-banned',action_player_name_color}
|
||||
end
|
||||
end)
|
||||
@@ -1,6 +1,10 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
local Roles = require 'expcore.roles'
|
||||
local Colours = require 'resources.color_presets'
|
||||
local format_chat_player_name, format_chat_colour_localized = ext_require('expcore.common',
|
||||
'format_chat_player_name',
|
||||
'format_chat_colour_localized'
|
||||
)
|
||||
|
||||
Commands.new_command('assign-role','Assigns a role to a player')
|
||||
:add_param('player',false,'player-role')
|
||||
@@ -42,16 +46,15 @@ Commands.new_command('list-roles','Lists all roles in they correct order')
|
||||
for index,role in pairs(roles) do
|
||||
role = Roles.get_role_from_any(role)
|
||||
local colour = role.custom_color or Colours.white
|
||||
colour = string.format('%d,%d,%d',colour.r,colour.g,colour.b)
|
||||
local role_name = format_chat_colour_localized(role.name,colour)
|
||||
if index == 1 then
|
||||
message = {'exp-commands.roles-list',colour,role.name}
|
||||
message = {'exp-commands.roles-list',role_name}
|
||||
if action_player ~= '' then
|
||||
local player_colour = action_player.color
|
||||
player_colour = string.format('%d,%d,%d',player_colour.r*255,player_colour.g*255,player_colour.b*255)
|
||||
message = {'exp-commands.roles-list-player',player_colour,action_player.name,colour,role.name}
|
||||
local player_name_colour = format_chat_player_name(action_player)
|
||||
message = {'exp-commands.roles-list-player',player_name_colour,role_name}
|
||||
end
|
||||
else
|
||||
message = {'exp-commands.roles-list-element',message,colour,role.name}
|
||||
message = {'exp-commands.roles-list-element',message,role_name}
|
||||
end
|
||||
end
|
||||
return Commands.success(message)
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user