mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-13 16:14:52 +09:00
Merge branch 'release/5.4.0' into dev
This commit is contained in:
commit
20adb43107
87 files changed
+1271
-108
No files matched your search
@@ -83,3 +83,6 @@ $RECYCLE.BIN/
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
.vscode
|
||||
*luacheckrc
|
||||
+1002
File diff suppressed because it is too large.
Load diff
Vendored
-31
@@ -1,31 +0,0 @@
|
||||
{
|
||||
"cSpell.enabledLanguageIds": [
|
||||
"asciidoc",
|
||||
"c",
|
||||
"cpp",
|
||||
"csharp",
|
||||
"css",
|
||||
"go",
|
||||
"handlebars",
|
||||
"html",
|
||||
"jade",
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"json",
|
||||
"latex",
|
||||
"less",
|
||||
"lua",
|
||||
"markdown",
|
||||
"php",
|
||||
"plaintext",
|
||||
"pub",
|
||||
"python",
|
||||
"restructuredtext",
|
||||
"rust",
|
||||
"scss",
|
||||
"text",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"yml"
|
||||
]
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
--- Desction <get from json>
|
||||
-- @module ThisModule@X.Y.Z
|
||||
-- @author <get from json>
|
||||
-- @license <get from json>
|
||||
-- @alias ThisModule
|
||||
|
||||
-- Module Require
|
||||
local Module = require('Module')
|
||||
local SubModule = require('Collection.Submodule')
|
||||
local OptModule -- OptModule@^X.Y.Z
|
||||
|
||||
-- Local Variables
|
||||
|
||||
-- Module Define
|
||||
local module_verbose = false
|
||||
local ThisModule = {
|
||||
on_init=function(self)
|
||||
if loaded_modules['OptModule'] then OptModule = require('OptModule') end
|
||||
if loaded_modules['OptModule2'] then require(module_path..'/src/module2',{self=self}) end
|
||||
--code
|
||||
end,
|
||||
on_post=function()
|
||||
--code
|
||||
end
|
||||
}
|
||||
|
||||
-- Global Define
|
||||
local global = global{
|
||||
key='value'
|
||||
}
|
||||
|
||||
-- Function Define
|
||||
|
||||
-- Event Handlers Define
|
||||
|
||||
-- Module Return
|
||||
return ThisModule
|
||||
@@ -22,7 +22,10 @@
|
||||
</p>
|
||||
<h2 align="center">ExpGaming Scenario Repository</h2>
|
||||
|
||||
<p align="center"><font size="-2">Out Dated; Will be updated in the future</font></p>
|
||||
|
||||
#### Use and Installation
|
||||
|
||||
* Download the git repo
|
||||
* Move files into the scenario folder (C:\Users\User\AppData\Roaming\Factorio\scenarios\ExpGamingScenario)
|
||||
* Make edits to role and group configs as well as any other configs that you want
|
||||
@@ -30,9 +33,11 @@
|
||||
* All modules will be loaded if you have not removed any, any problems see log file
|
||||
|
||||
#### Creation of new modules
|
||||
|
||||
* Please see [FactorioSoftmodManager](https://github.com/explosivegaming/FactorioSoftmodManager) for making new modules
|
||||
|
||||
#### Forks and Pull Requests
|
||||
|
||||
* We are happy for people to make pull requests if you wish to help make our server better
|
||||
* Your server is a community server, it is all about the people and feedback is good
|
||||
* Dont be afraid to make a pull request as if it fixes something then its a good change
|
||||
@@ -1,3 +0,0 @@
|
||||
new_type('command','Commands',false,'param')
|
||||
new_type('event','Events',false,'field')
|
||||
new_type('gui','Guis')
|
||||
@@ -6,8 +6,13 @@ require 'config.command_parse_general'
|
||||
|
||||
Commands.add_parse('role',function(input,player,reject)
|
||||
if not input then return end
|
||||
local roles = Roles.config.roles
|
||||
local role = auto_complete(roles,input,true)
|
||||
local roles = Roles.config.order
|
||||
local rev_roles = {}
|
||||
for i=#roles,1,-1 do
|
||||
table.insert(rev_roles,roles[i])
|
||||
end
|
||||
local role = auto_complete(rev_roles,input)
|
||||
role = Roles.get_role_by_name(role)
|
||||
if not role then
|
||||
return reject{'expcore-role.reject-role'}
|
||||
else
|
||||
|
||||
@@ -16,6 +16,12 @@ return {
|
||||
'modules.commands.help',
|
||||
'modules.commands.roles',
|
||||
'modules.commands.rainbow',
|
||||
'modules.commands.clear-inventory',
|
||||
'modules.commands.jail',
|
||||
'modules.commands.repair',
|
||||
'modules.commands.reports',
|
||||
'modules.commands.spawn',
|
||||
'modules.commands.warnings',
|
||||
-- QoL Addons
|
||||
'modules.addons.chat-popups',
|
||||
'modules.addons.damage-popups',
|
||||
@@ -25,6 +31,7 @@ return {
|
||||
'modules.addons.compilatron',
|
||||
'modules.addons.scorched-earth',
|
||||
'modules.addons.pollution-grading',
|
||||
'modules.addons.random-player-colours',
|
||||
-- Config Files
|
||||
'config.command_auth_admin', -- commands tagged with admin_only are blocked for non admins
|
||||
'config.command_auth_roles', -- commands must be allowed via the role config
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
return {
|
||||
players={
|
||||
BADgamerNL={r=255,g=20,b=147},
|
||||
arty714={r=150,g=68,b=161},
|
||||
Cooldude2606={r=57,g=192,b=207},
|
||||
mark9064={r=99,g=0,b=255},
|
||||
eissturm={r=25,g=25,b=112},
|
||||
Sakama={r=20,g=213,b=80},
|
||||
Sakama={r=20,g=213,b=80},
|
||||
freek18={r=50,g=0,b=255},
|
||||
aldldl={r=0,g=131,b=255},
|
||||
NAD4X4={r=135,g=206,b=250},
|
||||
cydes={r=82,g=249,b=155},
|
||||
UUBlueFire={r=0,g=204,b=255}
|
||||
},
|
||||
disallow = { -- the value does not matter it is only the key which is checked
|
||||
black = {r = 0, g = 0, b = 0},
|
||||
white = {r = 255, g = 255, b = 255},
|
||||
jailed = {r = 255, g = 255, b = 255},
|
||||
probation = {r = 255, g = 255, b = 255},
|
||||
guest = {r = 255, g = 255, b = 255},
|
||||
auto_trusted = {r = 192, g = 192, b = 192},
|
||||
regular = {r = 0.155, g = 0.540, b = 0.898},
|
||||
admin = {r = 0.093, g = 0.768, b = 0.172},
|
||||
donator = {r = 172.6, g = 70.2, b = 215.8},
|
||||
[-10] = {r = 255, g = 255, b = 255},
|
||||
[0] = {r = 255, g = 255, b = 255},
|
||||
[10] = {r = 192, g = 192, b = 192},
|
||||
[20] = {r = 0.155, g = 0.540, b = 0.898},
|
||||
[30] = {r = 0.093, g = 0.768, b = 0.172},
|
||||
success = {r = 0, g = 255, b = 0},
|
||||
warning = {r = 255, g = 255, b = 0},
|
||||
fail = {r = 255, g = 0, b = 0},
|
||||
info = {r = 255, g = 255, b = 255}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
disallow = {
|
||||
['loader']=true,
|
||||
['fast-loader']=true,
|
||||
['express-loader']=true,
|
||||
['electric-energy-interface']=true,
|
||||
['infinity-chest']=true
|
||||
},
|
||||
max_range=50,
|
||||
allow_blueprint_repair=false,
|
||||
allow_ghost_revive=true,
|
||||
allow_heal_entities=true
|
||||
}
|
||||
+29
-6
@@ -33,12 +33,14 @@ Roles.new_role('System','SYS')
|
||||
:set_permission_group('Admin')
|
||||
:set_flag('is_admin')
|
||||
:set_flag('is_spectator')
|
||||
:set_flag('report-immune')
|
||||
:set_allow_all()
|
||||
|
||||
Roles.new_role('Senior Administrator','SAdmin')
|
||||
:set_permission_group('Admin')
|
||||
:set_flag('is_admin')
|
||||
:set_flag('is_spectator')
|
||||
:set_flag('report-immune')
|
||||
:set_parent('Administrator')
|
||||
:allow{
|
||||
'command/interface',
|
||||
@@ -50,6 +52,7 @@ Roles.new_role('Administrator','Admin')
|
||||
:set_custom_color{r=233,g=63,b=233}
|
||||
:set_flag('is_admin')
|
||||
:set_flag('is_spectator')
|
||||
:set_flag('report-immune')
|
||||
:set_parent('Moderator')
|
||||
:allow{
|
||||
}
|
||||
@@ -59,10 +62,19 @@ Roles.new_role('Moderator','Mod')
|
||||
:set_custom_color{r=0,g=170,b=0}
|
||||
:set_flag('is_admin')
|
||||
:set_flag('is_spectator')
|
||||
:set_flag('report-immune')
|
||||
:set_parent('Trainee')
|
||||
:allow{
|
||||
'command/assign-role',
|
||||
'command/unassign-role'
|
||||
'command/unassign-role',
|
||||
'command/repair',
|
||||
'command/kill/always',
|
||||
'command/tag-clear/always',
|
||||
'command/go-to-spawn/always',
|
||||
'command/clear-reports',
|
||||
'command/clear-warnings',
|
||||
'command/clear-temp-ban',
|
||||
'command/clear-inventory',
|
||||
}
|
||||
|
||||
Roles.new_role('Trainee','TrMod')
|
||||
@@ -70,14 +82,17 @@ Roles.new_role('Trainee','TrMod')
|
||||
:set_custom_color{r=0,g=170,b=0}
|
||||
:set_flag('is_admin')
|
||||
:set_flag('is_spectator')
|
||||
:set_flag('report-immune')
|
||||
:set_parent('Donator')
|
||||
:allow{
|
||||
'command/admin-chat',
|
||||
'command/teleport',
|
||||
'command/bring',
|
||||
'command/goto',
|
||||
'command/kill/always',
|
||||
'command/tag-clear/always',
|
||||
'command/temp-ban',
|
||||
'command/give-warning',
|
||||
'command/get-warnings',
|
||||
'command/get-reports',
|
||||
}
|
||||
|
||||
--- Trusted Roles
|
||||
@@ -85,6 +100,7 @@ Roles.new_role('Sponsor','Spon')
|
||||
:set_permission_group('Trusted')
|
||||
:set_custom_color{r=247,g=246,b=54}
|
||||
:set_flag('is_spectator')
|
||||
:set_flag('report-immune')
|
||||
:set_parent('Pay to Win')
|
||||
:allow{
|
||||
}
|
||||
@@ -93,6 +109,7 @@ Roles.new_role('Pay to Win','P2W')
|
||||
:set_permission_group('Trusted')
|
||||
:set_custom_color{r=238,g=172,b=44}
|
||||
:set_flag('is_spectator')
|
||||
:set_flag('report-immune')
|
||||
:set_parent('Donator')
|
||||
:allow{
|
||||
}
|
||||
@@ -103,6 +120,8 @@ Roles.new_role('Donator','Don')
|
||||
:set_flag('is_spectator')
|
||||
:set_parent('Veteran')
|
||||
:allow{
|
||||
'command/jail',
|
||||
'command/unjail'
|
||||
}
|
||||
|
||||
Roles.new_role('Partner','Part')
|
||||
@@ -111,6 +130,8 @@ Roles.new_role('Partner','Part')
|
||||
:set_flag('is_spectator')
|
||||
:set_parent('Veteran')
|
||||
:allow{
|
||||
'command/jail',
|
||||
'command/unjail'
|
||||
}
|
||||
|
||||
Roles.new_role('Veteran','Vet')
|
||||
@@ -138,7 +159,10 @@ Roles.new_role('Regular','Reg')
|
||||
:set_custom_color{r=79,g=155,b=163}
|
||||
:set_parent('Guest')
|
||||
:allow{
|
||||
'command/kill'
|
||||
'command/kill',
|
||||
'command/rainbow',
|
||||
'command/go-to-spawn',
|
||||
'command/me',
|
||||
}
|
||||
:set_auto_promote_condition(function(player)
|
||||
if player.online_time > 3*216000 then
|
||||
@@ -151,12 +175,11 @@ local default = Roles.new_role('Guest','')
|
||||
:set_permission_group('Guest')
|
||||
:set_custom_color{r=185,g=187,b=160}
|
||||
:allow{
|
||||
'command/me',
|
||||
'command/tag',
|
||||
'command/tag-clear',
|
||||
'command/chelp',
|
||||
'command/list-roles',
|
||||
'command/rainbow'
|
||||
'command/report',
|
||||
}
|
||||
|
||||
--- Jail role
|
||||
|
||||
@@ -201,7 +201,7 @@
|
||||
Commands.remove_parse(name) --- Removes a parse function, see add_parse for adding them
|
||||
Commands.parse(name,input,player,reject,...) --- Intended to be used within other parse functions, runs a parse and returns success and new value
|
||||
|
||||
Commands.add_command(name,help) --- Creates a new command object to added details to, note this does not register the command to the game
|
||||
Commands.new_command(name,help) --- Creates a new command object to added details to, note this does not register the command to the game
|
||||
Commands._prototype:add_param(name,optional,parse,...) --- Adds a new param to the command this will be displayed in the help and used to parse the input
|
||||
Commands._prototype:set_defaults(defaults) --- Adds default values to params only matters if the param is optional
|
||||
Commands._prototype:set_flag(name,value) --- Adds a tag to the command which is passed via the flags param to the authenticators, can be used to assign command roles or type
|
||||
@@ -724,10 +724,10 @@ function Commands.run_command(command_event)
|
||||
|
||||
-- runs the command
|
||||
-- player: LuaPlayer, ... command params, raw: string
|
||||
table.insert(params,input_string)
|
||||
table.insert(params,command_data.max_param_count+1,input_string)
|
||||
local success, err = pcall(command_data.callback,player,unpack(params))
|
||||
if Commands.internal_error(success,command_data.name,err) then
|
||||
return command_log(player,command_data,'Internal Error: Command Callback Fail',params,command_event.parameter,err)
|
||||
return command_log(player,command_data,'Internal Error: Command Callback Fail',raw_params,command_event.parameter,err)
|
||||
end
|
||||
if err == Commands.defines.error or err == Commands.error then
|
||||
return command_log(player,command_data,'Custom Error',raw_params,input_string)
|
||||
|
||||
+3
-3
@@ -230,7 +230,7 @@ end
|
||||
function Public.move_items(items,surface,position,radius,chest_type)
|
||||
chest_type = chest_type or 'iron-chest'
|
||||
surface = surface or game.surfaces[1]
|
||||
if type(position) ~= 'table' then return end
|
||||
if position and type(position) ~= 'table' then return end
|
||||
if type(items) ~= 'table' then return end
|
||||
-- Finds all entities of the given type
|
||||
local p = position or {x=0,y=0}
|
||||
@@ -438,7 +438,7 @@ end
|
||||
-- @return the list item found that matches the input
|
||||
function Public.auto_complete(options,input,use_key,rtn_key)
|
||||
local rtn = {}
|
||||
if type(input)~= 'string' then return end
|
||||
if type(input) ~= 'string' then return end
|
||||
input = input:lower()
|
||||
for key,value in pairs(options) do
|
||||
local check = use_key and key or value
|
||||
@@ -524,7 +524,7 @@ end
|
||||
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
|
||||
local player_chat_colour = player and player.chat_color or Colours.white
|
||||
if raw_string then
|
||||
return Public.format_chat_colour(player_name,player_chat_colour)
|
||||
else
|
||||
|
||||
@@ -641,6 +641,8 @@ end
|
||||
-- @treturn boolean true if the player was added successfully
|
||||
function Roles._prototype:add_player(player,skip_check,skip_event)
|
||||
player = Game.get_player_from_any(player)
|
||||
-- Default role cant have players added or removed
|
||||
if self.name == Roles.config.internal.default then return end
|
||||
-- Check the player is valid, can be skipped but a name must be given
|
||||
if not player then
|
||||
if skip_check then
|
||||
@@ -673,6 +675,8 @@ end
|
||||
-- @treturn boolean true if the player was removed successfully
|
||||
function Roles._prototype:remove_player(player,skip_check,skip_event)
|
||||
player = Game.get_player_from_any(player)
|
||||
-- Default role cant have players added or removed
|
||||
if self.name == Roles.config.internal.default then return end
|
||||
-- Check the player is valid, can be skipped but a name must be given
|
||||
if not player then
|
||||
if skip_check then
|
||||
|
||||
@@ -35,4 +35,5 @@ pre-pre-ban=You are close to reciving a ban; successful ban appeals are unlikely
|
||||
pre-ban=This your LAST warning before you are BANNED! successful ban appeals are unlikely.
|
||||
ban=You were banned for having too many warnings; Vist __1__ to request a ban appeal.
|
||||
script-warning=You are reciving script warnings; if you recive too many you will recive a permiment warning (__1__/__2__)
|
||||
script-wrning-removed=A script warning has expired (__1__/__2__)
|
||||
script-wrning-removed=A script warning has expired (__1__/__2__)
|
||||
script-warning-limit=__1__ has recived a permiment warning from the script.
|
||||
@@ -33,4 +33,6 @@ warnings-received=__1__ recived a warning from __2__ for __3__.
|
||||
warnings-player=__1__ has __2__ warnings and __3__/__4__ script warnings.
|
||||
warnings-list-tilte=The following player have this many warnings (and this many script warnings):
|
||||
warnings-list=__1__: __2__ (__3__/__4__)
|
||||
warnings-cleared=__1__ had all they warnings cleared by __2__.
|
||||
warnings-cleared=__1__ had all they warnings cleared by __2__.
|
||||
spawn-unavailable=They was a problem getting you to spawn, please try again later.
|
||||
repair-result=__1__ entites were revived and __2__ were healed to max health.
|
||||
@@ -31,17 +31,17 @@ local callback =
|
||||
ent.surface.create_entity(
|
||||
{name = 'compi-speech-bubble', text = messages[name][msg_number], position = {0, 0}, source = ent}
|
||||
)
|
||||
Public.global.current_messages[name] = {message = message, msg_number = msg_number}
|
||||
Public.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(Public.global.compilatrons) do
|
||||
for name, ent in pairs(Public.compilatrons) do
|
||||
if not ent.valid then
|
||||
Public.spawn_compilatron(game.players[1].surface,name)
|
||||
end
|
||||
local current_message = Public.global.current_messages[name]
|
||||
local current_message = Public.current_messages[name]
|
||||
local msg_number
|
||||
local message
|
||||
if current_message ~= nil then
|
||||
@@ -71,12 +71,12 @@ function Public.add_compilatron(entity, name)
|
||||
if name == nil then
|
||||
return
|
||||
end
|
||||
Public.global.compilatrons[name] = entity
|
||||
Public.compilatrons[name] = entity
|
||||
local message =
|
||||
entity.surface.create_entity(
|
||||
{name = 'compi-speech-bubble', text = messages[name][1], position = {0, 0}, source = entity}
|
||||
)
|
||||
Public.global.current_messages[name] = {message = message, msg_number = 1}
|
||||
Public.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)
|
||||
|
||||
@@ -11,6 +11,7 @@ local Public = {
|
||||
player_temp_banned=script.generate_event_name(),
|
||||
player_clear_temp_ban=script.generate_event_name()
|
||||
}
|
||||
|
||||
Global.register({
|
||||
Public.old_roles,
|
||||
Public.temp_bans
|
||||
@@ -37,7 +38,7 @@ 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)
|
||||
local old_roles = Roles.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)
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
local Colours = require 'resources.color_presets'
|
||||
local Game = require 'utils.game'
|
||||
local Event = require 'utils.event'
|
||||
local config = require 'config.preset_player_colours'
|
||||
local Global = require 'utils.global'
|
||||
require 'utils.table'
|
||||
|
||||
Global.register(config,function(tbl)
|
||||
config = tbl
|
||||
end)
|
||||
|
||||
local white = Colours.white
|
||||
local black = Colours.black
|
||||
Event.add(defines.events.on_player_created,function(event)
|
||||
local player = Game.get_player_by_index(event.player_index)
|
||||
local color = 'white'
|
||||
if config.players[player.name] then
|
||||
color = config.players[player.name]
|
||||
else
|
||||
while not config.disallow[color] do
|
||||
color = table.get_random_dictionary_entry(Colours,true)
|
||||
end
|
||||
color = Colours[color]
|
||||
end
|
||||
color = {r=color.r/255,g=color.g/255,b=color.b/255,a=0.5}
|
||||
player.color = color
|
||||
player.chat_color = color
|
||||
end)
|
||||
@@ -57,6 +57,9 @@ function Public.remove_player_report(player,by_player_name)
|
||||
if reports and reports[by_player_name] then
|
||||
event_emit(Public.player_report_removed,player,by_player_name)
|
||||
reports[by_player_name] = nil
|
||||
if Public.count_player_reports(player) == 0 then
|
||||
Public.user_reports[player.name] = nil
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
@@ -115,7 +118,11 @@ function Public.count_player_reports(player,count_callback)
|
||||
if not player then return end
|
||||
local reports = Public.user_reports[player.name] or {}
|
||||
if not count_callback then
|
||||
return #reports
|
||||
local ctn = 0
|
||||
for _ in pairs(reports) do
|
||||
ctn=ctn+1
|
||||
end
|
||||
return ctn
|
||||
else
|
||||
local ctn = 0
|
||||
for player_name,reason in pairs(reports) do
|
||||
|
||||
@@ -2,6 +2,7 @@ local Game = require 'utils.game'
|
||||
local Global = require 'utils.global'
|
||||
local Event = require 'utils.event'
|
||||
local config = require 'config.warnings'
|
||||
local format_chat_player_name = ext_require('expcore.common','format_chat_player_name')
|
||||
require 'utils.table'
|
||||
|
||||
local Public = {
|
||||
@@ -195,8 +196,8 @@ Event.add(Public.player_warning_added,function(event)
|
||||
elseif type(action) == 'table' then
|
||||
-- {locale,by_player_name,number_of_warning,...}
|
||||
local current_action = table.deep_copy(action)
|
||||
table.insert(current_action,1,event.by_player_name)
|
||||
table.insert(current_action,1,event.warning_count)
|
||||
table.insert(current_action,2,event.by_player_name)
|
||||
table.insert(current_action,3,event.warning_count)
|
||||
player.print(current_action)
|
||||
elseif type(action) == 'string' then
|
||||
player.print(action)
|
||||
@@ -208,6 +209,8 @@ Event.add(Public.player_temp_warning_added,function(event)
|
||||
local player = Game.get_player_by_index(event.player_index)
|
||||
if event.temp_warning_count > config.temp_warning_limit then
|
||||
Public.add_warnings(event.player_index,event.by_player_name)
|
||||
local player_name_color = format_chat_player_name(player)
|
||||
game.print{'warnings.script-warning-limit',player_name_color}
|
||||
else
|
||||
player.print{'warnings.script-warning',event.temp_warning_count,config.temp_warning_limit}
|
||||
end
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
local move_items = ext_require('expcore.common','move_items')
|
||||
require 'config.command_parse_roles'
|
||||
|
||||
Commands.new_command('clear-inventory','Clears a players inventory')
|
||||
:add_param('player',false,'player-role-alive')
|
||||
:add_alias('clear-inv','move-inventory','move-inv')
|
||||
:register(function(player,action_player)
|
||||
local inv = action_player.get_main_inventory()
|
||||
move_items(inv.get_contents())
|
||||
inv.clear()
|
||||
end)
|
||||
@@ -48,13 +48,12 @@ end)
|
||||
|
||||
Commands.new_command('clear-temp-ban','Removes temp ban from a player; this will not restore they items.')
|
||||
:add_param('player',false,'player-role')
|
||||
:add_param('reason',false)
|
||||
:add_alias('untemp-ban','remove-temp-ban')
|
||||
:enable_auto_concat()
|
||||
:register(function(player,action_player,reason,raw)
|
||||
: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.clear_temp_ban_player(action_player,player.name,reason) then
|
||||
if JailControl.clear_temp_ban_player(action_player,player.name) 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}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
local config = require 'config.repair'
|
||||
require 'config.command_parse_general'
|
||||
|
||||
local max_time_to_live = 4294967295 -- unit32 max
|
||||
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)
|
||||
local revive_count = 0
|
||||
local heal_count = 0
|
||||
local range2 = range^2
|
||||
local surface = player.surface
|
||||
local center = player.position
|
||||
local area = {{x=center.x-range,y=center.y-range},{x=center.x+range,y=center.y+range}}
|
||||
if config.allow_ghost_revive then
|
||||
local ghosts = surface.find_entities_filtered({area=area,type='entity-ghost',force=player.force})
|
||||
for _,ghost in pairs(ghosts) do
|
||||
if ghost.valid then
|
||||
local x = ghost.position.x-center.x
|
||||
local y = ghost.position.y-center.y
|
||||
if x^2+y^2 <= range2 then
|
||||
if config.allow_blueprint_repair or ghost.time_to_live ~= max_time_to_live then
|
||||
revive_count = revive_count+1
|
||||
if not config.disallow[ghost.ghost_name] then ghost.revive() end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if config.allow_heal_entities then
|
||||
local entities = surface.find_entities_filtered({area=area,force=player.force})
|
||||
for _,entity in pairs(entities) do
|
||||
if entity.valid then
|
||||
local x = entity.position.x-center.x
|
||||
local y = entity.position.y-center.y
|
||||
if entity.health and entity.get_health_ratio() ~= 1 and x^2+y^2 <= range2 then
|
||||
heal_count = heal_count+1
|
||||
entity.health = max_time_to_live
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return Commands.success{'exp-commands.repair-result',revive_count,heal_count}
|
||||
end)
|
||||
@@ -8,8 +8,8 @@ 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)
|
||||
if not input then return end
|
||||
if Roles.player_has_flag(player,'report-immune') then
|
||||
return reject{'exp-command.report-player-immune'}
|
||||
if Roles.player_has_flag(input,'report-immune') then
|
||||
return reject{'exp-commands.report-player-immune'}
|
||||
else
|
||||
return input
|
||||
end
|
||||
@@ -45,7 +45,8 @@ Commands.new_command('get-reports','Gets a list of all reports that a player has
|
||||
Commands.print{'exp-commands.report-player-count-title'}
|
||||
for player_name,reports in pairs(user_reports) do
|
||||
local player_name_color = format_chat_player_name(player_name)
|
||||
Commands.print{'exp-commands.report-list',player_name_color,#reports}
|
||||
local report_count = ReportsControl.count_player_reports(player_name)
|
||||
Commands.print{'exp-commands.report-list',player_name_color,report_count}
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -55,7 +56,7 @@ Commands.new_command('clear-reports','Clears all reports from a player or just t
|
||||
:add_param('from-player',true,'player')
|
||||
:register(function(player,action_player,from_player,raw)
|
||||
if from_player then
|
||||
if not ReportsControl.remove_player_report(action_player,from_player) then
|
||||
if not ReportsControl.remove_player_report(action_player,from_player.name) then
|
||||
return Commands.error{'exp-commands.report-not-reported'}
|
||||
end
|
||||
else
|
||||
|
||||
@@ -40,7 +40,7 @@ Commands.new_command('list-roles','Lists all roles in they correct order')
|
||||
:register(function(player,action_player,raw)
|
||||
local roles = Roles.config.order
|
||||
local message = {'exp-commands.roles-list'}
|
||||
if action_player ~= '' then
|
||||
if action_player then
|
||||
roles = Roles.get_player_roles(action_player)
|
||||
end
|
||||
for index,role in pairs(roles) do
|
||||
@@ -49,7 +49,7 @@ Commands.new_command('list-roles','Lists all roles in they correct order')
|
||||
local role_name = format_chat_colour_localized(role.name,colour)
|
||||
if index == 1 then
|
||||
message = {'exp-commands.roles-list',role_name}
|
||||
if action_player ~= '' then
|
||||
if action_player then
|
||||
local player_name_colour = format_chat_player_name(action_player)
|
||||
message = {'exp-commands.roles-list-player',player_name_colour,role_name}
|
||||
end
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
local Roles = require 'expcore.roles'
|
||||
|
||||
local function teleport(player)
|
||||
local surface = player.surface
|
||||
local spawn = player.force.get_spawn_position(surface)
|
||||
local position = surface.find_non_colliding_position('player',spawn,32,1)
|
||||
if not position then return false end
|
||||
if player.driving then player.driving = false end -- kicks a player out a vehicle if in one
|
||||
player.teleport(position,surface)
|
||||
return true
|
||||
end
|
||||
|
||||
Commands.new_command('go-to-spawn','Teleport to spawn')
|
||||
:add_param('player',true,'player-role-alive')
|
||||
:set_defaults{
|
||||
player=function(player)
|
||||
if player.connected and player.character and player.character.health > 0 then
|
||||
return player
|
||||
end
|
||||
end
|
||||
}
|
||||
:add_alias('spawn','tp-spawn')
|
||||
:register(function(player,action_player)
|
||||
if not action_player then
|
||||
return Commands.error{'exp-commands.spawn-unavailable'}
|
||||
elseif action_player == player then
|
||||
if not teleport(player) then
|
||||
return Commands.error{'exp-commands.spawn-unavailable'}
|
||||
end
|
||||
elseif Roles.player_allowed(player,'command/go-to-spawn/always') then
|
||||
if not teleport(action_player) then
|
||||
return Commands.error{'exp-commands.spawn-unavailable'}
|
||||
end
|
||||
else
|
||||
return Commands.error{'expcore-commands.unauthorized'}
|
||||
end
|
||||
end)
|
||||
@@ -46,11 +46,11 @@ Commands.new_command('get-warnings','Gets the number of warnings a player has. I
|
||||
end
|
||||
end)
|
||||
|
||||
Commands.new_command('clear-warnigns','Clears all warnings (and script warnings) from a player')
|
||||
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)
|
||||
WarningsControl.clear_warnings(player,player.name)
|
||||
WarningsControl.clear_temp_warnings(player,player.name)
|
||||
WarningsControl.clear_warnings(action_player,player.name)
|
||||
WarningsControl.clear_temp_warnings(action_player,player.name)
|
||||
local action_player_name_color = format_chat_player_name(action_player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
game.print{'exp-commands.warnings-cleared',action_player_name_color,by_player_name_color}
|
||||
|
||||
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.
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.
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.
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.
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.
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.
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