mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
Update all code styles
This commit is contained in:
@@ -36,6 +36,11 @@
|
||||
"param": "_?_?(\\w+)",
|
||||
"$1": "snake_case"
|
||||
}],
|
||||
"module_local_name_style": [{
|
||||
"type" : "pattern",
|
||||
"param": "_?_?(\\w+)",
|
||||
"$1": "snake_case"
|
||||
}, "pascal_case"],
|
||||
"function_param_name_style": [{
|
||||
"type" : "pattern",
|
||||
"param": "_?_?(\\w+)",
|
||||
|
||||
@@ -73,9 +73,10 @@ Commands.new("commands", "List and search all commands for a keyword")
|
||||
end
|
||||
|
||||
-- Print selected page to the player
|
||||
Commands.print{ "exp-commands-help.header", keyword == '' and '<all>' or keyword }
|
||||
Commands.print{ "exp-commands-help.header", keyword == "" and "<all>" or keyword }
|
||||
for _, command in pairs(page_data) do
|
||||
Commands.print(command)
|
||||
end
|
||||
|
||||
return Commands.status.success{ "exp-commands-help.footer", found, page, #pages }
|
||||
end)
|
||||
|
||||
@@ -31,10 +31,15 @@ rcon_statics.ipc = Clustorio.send_json
|
||||
|
||||
--- Some common callback values which are useful when a player uses the command
|
||||
function rcon_callbacks.player(player) return player end
|
||||
|
||||
function rcon_callbacks.surface(player) return player and player.surface end
|
||||
|
||||
function rcon_callbacks.force(player) return player and player.force end
|
||||
|
||||
function rcon_callbacks.position(player) return player and player.position end
|
||||
|
||||
function rcon_callbacks.entity(player) return player and player.selected end
|
||||
|
||||
function rcon_callbacks.tile(player) return player and player.surface.get_tile(player.position) end
|
||||
|
||||
--- The rcon env is saved between command runs to prevent desyncs
|
||||
@@ -73,7 +78,7 @@ Commands.new("_rcon", "Execute arbitrary code within a custom environment")
|
||||
else
|
||||
local success, rtn = xpcall(invocation, debug.traceback)
|
||||
if success == false then
|
||||
local err = rtn:gsub('%.%.%..-/temp/currently%-playing/', '')
|
||||
local err = rtn:gsub("%.%.%..-/temp/currently%-playing/", "")
|
||||
return Commands.status.error(err)
|
||||
else
|
||||
return Commands.status.success(rtn)
|
||||
|
||||
@@ -20,6 +20,6 @@ Commands.new("_sudo", "Run a command as another player")
|
||||
name = command.name,
|
||||
tick = game.tick,
|
||||
player_index = player.index,
|
||||
parameter = parameter
|
||||
parameter = parameter,
|
||||
}
|
||||
end)
|
||||
|
||||
@@ -70,7 +70,7 @@ local Commands = {
|
||||
|
||||
Commands._metatable = {
|
||||
__index = Commands._prototype,
|
||||
__class = "ExpCommand"
|
||||
__class = "ExpCommand",
|
||||
}
|
||||
|
||||
Commands.player_server = setmetatable({
|
||||
@@ -87,7 +87,7 @@ Commands.player_server = setmetatable({
|
||||
spectator = true,
|
||||
show_on_map = false,
|
||||
valid = true,
|
||||
object_name = "LuaPlayer"
|
||||
object_name = "LuaPlayer",
|
||||
}, {
|
||||
__index = function(_, key)
|
||||
if key == "__self" or type(key) == "number" then return nil end
|
||||
@@ -97,7 +97,7 @@ Commands.player_server = setmetatable({
|
||||
__newindex = function(_, key)
|
||||
Commands.error("Command does not support rcon usage, requires reading player." .. key)
|
||||
error("Command does not support rcon usage, requires setting player." .. key)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
--- Status Returns.
|
||||
@@ -107,34 +107,34 @@ Commands.player_server = setmetatable({
|
||||
--- Used to signal success from a command, data type parser, or permission authority
|
||||
-- @tparam[opt] LocaleString|string msg An optional message to be included when a command completes (only has an effect in command callbacks)
|
||||
function Commands.status.success(msg)
|
||||
return Commands.status.success, msg or {'exp-commands.success'}
|
||||
return Commands.status.success, msg or { "exp-commands.success" }
|
||||
end
|
||||
|
||||
--- Used to signal an error has occurred in a command, data type parser, or permission authority
|
||||
-- For data type parsers and permission authority, an error return will prevent the command from being executed
|
||||
-- @tparam[opt] LocaleString|string msg An optional error message to be included in the output, a generic message is used if not provided
|
||||
function Commands.status.error(msg)
|
||||
return Commands.status.error, {'exp-commands.error', msg or {'exp-commands.error-default'}}
|
||||
return Commands.status.error, { "exp-commands.error", msg or { "exp-commands.error-default" } }
|
||||
end
|
||||
|
||||
--- Used to signal the player is unauthorised to use a command, primarily used by permission authorities but can be used in a command callback
|
||||
-- For permission authorities, an error return will prevent the command from being executed
|
||||
-- @tparam[opt] LocaleString|string msg An optional error message to be included in the output, a generic message is used if not provided
|
||||
function Commands.status.unauthorised(msg)
|
||||
return Commands.status.unauthorised, msg or {'exp-commands.unauthorized', msg or {'exp-commands.unauthorized-default'}}
|
||||
return Commands.status.unauthorised, msg or { "exp-commands.unauthorized", msg or { "exp-commands.unauthorized-default" } }
|
||||
end
|
||||
|
||||
--- Used to signal the player provided invalid input to an command, primarily used by data type parsers but can be used in a command callback
|
||||
-- For data type parsers, an error return will prevent the command from being executed
|
||||
-- @tparam[opt] LocaleString|string msg An optional error message to be included in the output, a generic message is used if not provided
|
||||
function Commands.status.invalid_input(msg)
|
||||
return Commands.status.invalid_input, msg or {'exp-commands.invalid-input'}
|
||||
return Commands.status.invalid_input, msg or { "exp-commands.invalid-input" }
|
||||
end
|
||||
|
||||
--- Used to signal an internal error has occurred, this is reserved for internal use
|
||||
-- @tparam LocaleString|string msg A message detailing the error which has occurred, will be logged and outputted
|
||||
function Commands.status.internal_error(msg)
|
||||
return Commands.status.internal_error, {'exp-commands.internal-error', msg}
|
||||
return Commands.status.internal_error, { "exp-commands.internal-error", msg }
|
||||
end
|
||||
|
||||
local valid_command_status = {} -- Hashmap lookup for testing if a status is valid
|
||||
@@ -279,7 +279,7 @@ local function search_commands(keyword, custom_commands)
|
||||
|
||||
-- Search all custom commands
|
||||
for name, command in pairs(custom_commands) do
|
||||
local search = string.format('%s %s %s', name, command.help, table.concat(command.aliases, ' '))
|
||||
local search = string.format("%s %s %s", name, command.help, table.concat(command.aliases, " "))
|
||||
if search:lower():match(keyword) then
|
||||
rtn[name] = command
|
||||
end
|
||||
@@ -287,13 +287,13 @@ local function search_commands(keyword, custom_commands)
|
||||
|
||||
-- Search all game commands
|
||||
for name, description in pairs(commands.game_commands) do
|
||||
local search = string.format('%s %s', name, description)
|
||||
local search = string.format("%s %s", name, description)
|
||||
if search:lower():match(keyword) then
|
||||
rtn[name] = {
|
||||
name = name,
|
||||
help = description,
|
||||
description = "",
|
||||
aliases = {}
|
||||
aliases = {},
|
||||
}
|
||||
end
|
||||
end
|
||||
@@ -322,8 +322,8 @@ end
|
||||
-- @tparam Color color The color that the message should be
|
||||
-- @treturn string The string which can be printed to game chat
|
||||
function Commands.set_chat_message_color(message, color)
|
||||
local color_tag = math.round(color.r, 3)..', '..math.round(color.g, 3)..', '..math.round(color.b, 3)
|
||||
return string.format('[color=%s]%s[/color]', color_tag, message)
|
||||
local color_tag = math.round(color.r, 3) .. ", " .. math.round(color.g, 3) .. ", " .. math.round(color.b, 3)
|
||||
return string.format("[color=%s]%s[/color]", color_tag, message)
|
||||
end
|
||||
|
||||
--- Set the color of a locale message using rich text chat
|
||||
@@ -331,8 +331,8 @@ end
|
||||
-- @tparam Color color The color that the message should be
|
||||
-- @treturn LocaleString The locale string which can be printed to game chat
|
||||
function Commands.set_locale_chat_message_color(message, color)
|
||||
local color_tag = math.round(color.r, 3)..', '..math.round(color.g, 3)..', '..math.round(color.b, 3)
|
||||
return {'color-tag', color_tag, message}
|
||||
local color_tag = math.round(color.r, 3) .. ", " .. math.round(color.g, 3) .. ", " .. math.round(color.b, 3)
|
||||
return { "color-tag", color_tag, message }
|
||||
end
|
||||
|
||||
--- Get a string representing the name of the given player in their chat colour
|
||||
@@ -341,8 +341,8 @@ end
|
||||
function Commands.format_player_name(player)
|
||||
local player_name = player and player.name or "<server>"
|
||||
local player_color = player and player.chat_color or Color.white
|
||||
local color_tag = math.round(player_color.r, 3)..', '..math.round(player_color.g, 3)..', '..math.round(player_color.b, 3)
|
||||
return string.format('[color=%s]%s[/color]', color_tag, player_name)
|
||||
local color_tag = math.round(player_color.r, 3) .. ", " .. math.round(player_color.g, 3) .. ", " .. math.round(player_color.b, 3)
|
||||
return string.format("[color=%s]%s[/color]", color_tag, player_name)
|
||||
end
|
||||
|
||||
--- Get a locale string representing the name of the given player in their chat colour
|
||||
@@ -351,8 +351,8 @@ end
|
||||
function Commands.format_locale_player_name(player)
|
||||
local player_name = player and player.name or "<server>"
|
||||
local player_color = player and player.chat_color or Color.white
|
||||
local color_tag = math.round(player_color.r, 3)..', '..math.round(player_color.g, 3)..', '..math.round(player_color.b, 3)
|
||||
return {'color-tag', color_tag, player_name}
|
||||
local color_tag = math.round(player_color.r, 3) .. ", " .. math.round(player_color.g, 3) .. ", " .. math.round(player_color.b, 3)
|
||||
return { "color-tag", color_tag, player_name }
|
||||
end
|
||||
|
||||
--- Print a message to the user of a command, accepts any value and will print in a readable and safe format
|
||||
@@ -366,14 +366,14 @@ function Commands.print(message, color, sound)
|
||||
else
|
||||
local formatted = ExpUtil.format_any(message, nil, 20)
|
||||
player.print(formatted, color or Color.white)
|
||||
player.play_sound{ path = sound or 'utility/scenario_message' }
|
||||
player.play_sound{ path = sound or "utility/scenario_message" }
|
||||
end
|
||||
end
|
||||
|
||||
--- Print an error message to the user of a command, accepts any value and will print in a readable and safe format
|
||||
-- @tparam any message The message / value to be printed
|
||||
function Commands.error(message)
|
||||
return Commands.print(message, Color.orange_red, 'utility/wire_pickup')
|
||||
return Commands.print(message, Color.orange_red, "utility/wire_pickup")
|
||||
end
|
||||
|
||||
--- Command Prototype
|
||||
@@ -382,7 +382,7 @@ end
|
||||
|
||||
--- This is a default callback that should never be called
|
||||
local function default_command_callback()
|
||||
return Commands.status.internal_error('No callback registered')
|
||||
return Commands.status.internal_error("No callback registered")
|
||||
end
|
||||
|
||||
--- Returns a new command object, this will not register the command to the game
|
||||
@@ -434,7 +434,7 @@ function Commands._prototype:argument(name, data_type, ...)
|
||||
optional = false,
|
||||
data_type = data_type,
|
||||
data_type_parser = get_parser(data_type),
|
||||
parse_args = {...}
|
||||
parse_args = { ... },
|
||||
}
|
||||
return self
|
||||
end
|
||||
@@ -450,7 +450,7 @@ function Commands._prototype:optional(name, data_type, ...)
|
||||
optional = true,
|
||||
data_type = data_type,
|
||||
data_type_parser = get_parser(data_type),
|
||||
parse_args = {...}
|
||||
parse_args = { ... },
|
||||
}
|
||||
return self
|
||||
end
|
||||
@@ -469,12 +469,14 @@ function Commands._prototype:defaults(defaults)
|
||||
matched[argument.name] = true
|
||||
end
|
||||
end
|
||||
|
||||
-- Check that there are no extra values in the table
|
||||
for name in pairs(defaults) do
|
||||
if not matched[name] then
|
||||
error("No argument with name: " .. name)
|
||||
end
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -489,6 +491,7 @@ function Commands._prototype:add_flags(flags)
|
||||
self.flags[name] = value
|
||||
end
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -500,6 +503,7 @@ function Commands._prototype:add_aliases(aliases)
|
||||
for index, alias in ipairs(aliases) do
|
||||
self.aliases[start_index + index] = alias
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -525,6 +529,7 @@ function Commands._prototype:register(callback)
|
||||
description[index] = "<" .. argument.name .. ">"
|
||||
end
|
||||
end
|
||||
|
||||
self.description = table.concat(description, " ")
|
||||
|
||||
-- Callback which is called by the game engine
|
||||
@@ -539,7 +544,7 @@ function Commands._prototype:register(callback)
|
||||
end
|
||||
|
||||
-- Registers the command under its own name
|
||||
local help = {'exp-commands.command-help', self.description, self.help}
|
||||
local help = { "exp-commands.command-help", self.description, self.help }
|
||||
commands.add_command(self.name, help, command_callback)
|
||||
|
||||
-- Registers the command under its aliases
|
||||
@@ -554,13 +559,13 @@ end
|
||||
|
||||
--- Log that a command was attempted and its outcome (error / success)
|
||||
local function log_command(comment, command, player, args, detail)
|
||||
local player_name = player and player.name or '<Server>'
|
||||
ExpUtil.write_json('log/commands.log', {
|
||||
local player_name = player and player.name or "<Server>"
|
||||
ExpUtil.write_json("log/commands.log", {
|
||||
comment = comment,
|
||||
detail = detail,
|
||||
player_name = player_name,
|
||||
command_name = command.name,
|
||||
args = args
|
||||
args = args,
|
||||
})
|
||||
end
|
||||
|
||||
@@ -572,15 +577,15 @@ local function extract_arguments(raw_input, max_args, auto_concat)
|
||||
-- Extract quoted arguments
|
||||
local quoted_arguments = {}
|
||||
local input_string = raw_input:gsub('"[^"]-"', function(word)
|
||||
local no_spaces = word:gsub('%s', '%%s')
|
||||
local no_spaces = word:gsub("%s", "%%s")
|
||||
quoted_arguments[no_spaces] = word:sub(2, -2)
|
||||
return ' '..no_spaces..' '
|
||||
return " " .. no_spaces .. " "
|
||||
end)
|
||||
|
||||
-- Extract all arguments
|
||||
local index = 0
|
||||
local arguments = {}
|
||||
for word in input_string:gmatch('%S+') do
|
||||
for word in input_string:gmatch("%S+") do
|
||||
index = index + 1
|
||||
if index > max_args then
|
||||
-- concat the word onto the last argument
|
||||
@@ -589,7 +594,7 @@ local function extract_arguments(raw_input, max_args, auto_concat)
|
||||
elseif quoted_arguments[word] then
|
||||
arguments[max_args] = arguments[max_args] .. ' "' .. quoted_arguments[word] .. '"'
|
||||
else
|
||||
arguments[max_args] = arguments[max_args]..' '..word
|
||||
arguments[max_args] = arguments[max_args] .. " " .. word
|
||||
end
|
||||
else
|
||||
-- new argument to be added
|
||||
@@ -626,20 +631,20 @@ function Commands._event_handler(event)
|
||||
-- Check the edge case of parameter being nil
|
||||
if command.min_arg_count > 0 and event.parameter == nil then
|
||||
log_command("Too few arguments", command, player, event.parameter, { minimum = command.min_arg_count, maximum = command.max_arg_count })
|
||||
return Commands.error{'exp-commands.invalid-usage', command.name, command.description}
|
||||
return Commands.error{ "exp-commands.invalid-usage", command.name, command.description }
|
||||
end
|
||||
|
||||
-- Get the arguments for the command, returns nil if there are too many arguments
|
||||
local raw_arguments = extract_arguments(event.parameter, command.max_arg_count, command.auto_concat)
|
||||
if raw_arguments == nil then
|
||||
log_command("Too many arguments", command, player, event.parameter, { minimum = command.min_arg_count, maximum = command.max_arg_count })
|
||||
return Commands.error{'exp-commands.invalid-usage', command.name, command.description}
|
||||
return Commands.error{ "exp-commands.invalid-usage", command.name, command.description }
|
||||
end
|
||||
|
||||
-- Check the minimum number of arguments is fullfiled
|
||||
if #raw_arguments < command.min_arg_count then
|
||||
log_command("Too few arguments", command, player, event.parameter, { minimum = command.min_arg_count, maximum = command.max_arg_count })
|
||||
return Commands.error{'exp-commands.invalid-usage', command.name, command.description}
|
||||
return Commands.error{ "exp-commands.invalid-usage", command.name, command.description }
|
||||
end
|
||||
|
||||
-- Parse the arguments, optional arguments will attempt to use a default if provided
|
||||
@@ -659,7 +664,7 @@ function Commands._event_handler(event)
|
||||
local success, status, parsed = Commands.parse_data_type(argument.data_type_parser, input, player, table.unpack(argument.parse_args))
|
||||
if success == false then
|
||||
log_command("Input parse failed", command, player, event.parameter, { status = valid_command_status[status], index = index, argument = argument, reason = parsed })
|
||||
return Commands.error{'exp-commands.invalid-argument', argument.name, parsed}
|
||||
return Commands.error{ "exp-commands.invalid-argument", argument.name, parsed }
|
||||
else
|
||||
arguments[index] = parsed
|
||||
end
|
||||
|
||||
@@ -66,7 +66,7 @@ local function on_permission_group_edited(event)
|
||||
local old = pending_updates[event.old_name]
|
||||
if old then pending.players = old.players end
|
||||
on_permission_group_deleted{
|
||||
tick = event.tick, player_index = event.player_index, group_name = event.old_name
|
||||
tick = event.tick, player_index = event.player_index, group_name = event.old_name,
|
||||
}
|
||||
end
|
||||
end
|
||||
@@ -79,12 +79,12 @@ local function send_updates()
|
||||
done[group_name] = true
|
||||
if pending.sync_all then
|
||||
clusterio_api.send_json("exp_groups-permission_group_create", {
|
||||
group = group_name, defiantion = Groups.get_group(group_name):to_json(true)
|
||||
group = group_name, defiantion = Groups.get_group(group_name):to_json(true),
|
||||
})
|
||||
else
|
||||
if next(pending.players) then
|
||||
clusterio_api.send_json("exp_groups-permission_group_edit", {
|
||||
type = "assign_players", group = group_name, changes = table.get_keys(pending.players)
|
||||
type = "assign_players", group = group_name, changes = table.get_keys(pending.players),
|
||||
})
|
||||
end
|
||||
local add, remove = {}, {}
|
||||
@@ -95,19 +95,21 @@ local function send_updates()
|
||||
remove[#remove + 1] = permission
|
||||
end
|
||||
end
|
||||
|
||||
if next(add) then
|
||||
clusterio_api.send_json("exp_groups-permission_group_edit", {
|
||||
type = "add_permissions", group = group_name, changes = Groups.actions_to_names(add)
|
||||
type = "add_permissions", group = group_name, changes = Groups.actions_to_names(add),
|
||||
})
|
||||
end
|
||||
if next(remove) then
|
||||
clusterio_api.send_json("exp_groups-permission_group_edit", {
|
||||
type = "remove_permissions", group = group_name, changes = Groups.actions_to_names(remove)
|
||||
type = "remove_permissions", group = group_name, changes = Groups.actions_to_names(remove),
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for group_name in pairs(done) do
|
||||
pending_updates[group_name] = nil
|
||||
end
|
||||
@@ -121,5 +123,5 @@ return {
|
||||
},
|
||||
on_nth_tick = {
|
||||
[300] = send_updates,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ Groups._metatable = {
|
||||
__index = setmetatable(Groups._prototype, {
|
||||
__index = function(self, key)
|
||||
return self.group[key]
|
||||
end
|
||||
end,
|
||||
}),
|
||||
__class = "ExpGroup"
|
||||
__class = "ExpGroup",
|
||||
}
|
||||
|
||||
local action_to_name = {}
|
||||
@@ -42,6 +42,7 @@ local function add_players_to_group(players, group)
|
||||
for i = 2, #players do
|
||||
add_player(players[i])
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -57,7 +58,7 @@ function Groups.get_group(group_name)
|
||||
local group = game.permissions.get_group(group_name)
|
||||
if group == nil then return nil end
|
||||
return setmetatable({
|
||||
group = group
|
||||
group = group,
|
||||
}, Groups._metatable)
|
||||
end
|
||||
|
||||
@@ -67,7 +68,7 @@ function Groups.get_player_group(player)
|
||||
local group = player.permission_group
|
||||
if group == nil then return nil end
|
||||
return setmetatable({
|
||||
group = group
|
||||
group = group,
|
||||
}, Groups._metatable)
|
||||
end
|
||||
|
||||
@@ -79,7 +80,7 @@ function Groups.new_group(group_name)
|
||||
group = game.permissions.create_group(group_name)
|
||||
assert(group ~= nil, "Requires permission add_permission_group")
|
||||
return setmetatable({
|
||||
group = group
|
||||
group = group,
|
||||
}, Groups._metatable)
|
||||
end
|
||||
|
||||
@@ -89,13 +90,13 @@ function Groups.get_or_create(group_name)
|
||||
local group = game.permissions.get_group(group_name)
|
||||
if group then
|
||||
return setmetatable({
|
||||
group = group
|
||||
group = group,
|
||||
}, Groups._metatable)
|
||||
else
|
||||
group = game.permissions.create_group(group_name)
|
||||
assert(group ~= nil, "Requires permission add_permission_group")
|
||||
return setmetatable({
|
||||
group = group
|
||||
group = group,
|
||||
}, Groups._metatable)
|
||||
end
|
||||
end
|
||||
@@ -146,6 +147,7 @@ function Groups._prototype:allow_actions(actions)
|
||||
for _, action in ipairs(actions) do
|
||||
set_allow(action, true)
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -156,6 +158,7 @@ function Groups._prototype:disallow_actions(actions)
|
||||
for _, action in ipairs(actions) do
|
||||
set_allow(action, false)
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -167,6 +170,7 @@ function Groups._prototype:reset(allowed)
|
||||
for _, action in pairs(defines.input_action) do
|
||||
set_allow(action, allowed)
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -217,6 +221,7 @@ function Groups.actions_to_names(actions)
|
||||
for i, action in ipairs(actions) do
|
||||
names[i] = action_to_name[action]
|
||||
end
|
||||
|
||||
return names
|
||||
end
|
||||
|
||||
@@ -227,6 +232,7 @@ function Groups.get_actions_json()
|
||||
rtn[rtn_i] = name
|
||||
rtn_i = rtn_i + 1
|
||||
end
|
||||
|
||||
return game.table_to_json(rtn)
|
||||
end
|
||||
|
||||
|
||||
@@ -5,108 +5,108 @@
|
||||
-- @config File-Loader
|
||||
return {
|
||||
-- 'example.file_not_loaded',
|
||||
'modules.factorio-control', -- base factorio free play scenario
|
||||
'expcore.player_data', -- must be loaded first to register event handlers
|
||||
"modules.factorio-control", -- base factorio free play scenario
|
||||
"expcore.player_data", -- must be loaded first to register event handlers
|
||||
|
||||
--- Game Commands
|
||||
'modules.commands.debug',
|
||||
'modules.commands.me',
|
||||
'modules.commands.kill',
|
||||
'modules.commands.admin-chat',
|
||||
'modules.commands.admin-markers',
|
||||
'modules.commands.teleport',
|
||||
'modules.commands.cheat-mode',
|
||||
'modules.commands.ratio',
|
||||
'modules.commands.interface',
|
||||
'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',
|
||||
'modules.commands.find',
|
||||
'modules.commands.home',
|
||||
'modules.commands.connect',
|
||||
'modules.commands.last-location',
|
||||
'modules.commands.protection',
|
||||
'modules.commands.spectate',
|
||||
'modules.commands.search',
|
||||
'modules.commands.bot-queue',
|
||||
'modules.commands.speed',
|
||||
'modules.commands.pollution',
|
||||
'modules.commands.train',
|
||||
'modules.commands.friendly-fire',
|
||||
'modules.commands.research',
|
||||
'modules.commands.vlayer',
|
||||
'modules.commands.enemy',
|
||||
'modules.commands.waterfill',
|
||||
'modules.commands.artillery',
|
||||
'modules.commands.surface-clearing',
|
||||
"modules.commands.debug",
|
||||
"modules.commands.me",
|
||||
"modules.commands.kill",
|
||||
"modules.commands.admin-chat",
|
||||
"modules.commands.admin-markers",
|
||||
"modules.commands.teleport",
|
||||
"modules.commands.cheat-mode",
|
||||
"modules.commands.ratio",
|
||||
"modules.commands.interface",
|
||||
"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",
|
||||
"modules.commands.find",
|
||||
"modules.commands.home",
|
||||
"modules.commands.connect",
|
||||
"modules.commands.last-location",
|
||||
"modules.commands.protection",
|
||||
"modules.commands.spectate",
|
||||
"modules.commands.search",
|
||||
"modules.commands.bot-queue",
|
||||
"modules.commands.speed",
|
||||
"modules.commands.pollution",
|
||||
"modules.commands.train",
|
||||
"modules.commands.friendly-fire",
|
||||
"modules.commands.research",
|
||||
"modules.commands.vlayer",
|
||||
"modules.commands.enemy",
|
||||
"modules.commands.waterfill",
|
||||
"modules.commands.artillery",
|
||||
"modules.commands.surface-clearing",
|
||||
|
||||
--- Addons
|
||||
'modules.addons.chat-popups',
|
||||
'modules.addons.damage-popups',
|
||||
'modules.addons.death-logger',
|
||||
'modules.addons.advanced-start',
|
||||
'modules.addons.spawn-area',
|
||||
'modules.addons.compilatron',
|
||||
'modules.addons.scorched-earth',
|
||||
'modules.addons.pollution-grading',
|
||||
'modules.addons.station-auto-name',
|
||||
'modules.addons.discord-alerts',
|
||||
'modules.addons.chat-reply',
|
||||
'modules.addons.tree-decon',
|
||||
'modules.addons.afk-kick',
|
||||
'modules.addons.report-jail',
|
||||
'modules.addons.protection-jail',
|
||||
'modules.addons.deconlog',
|
||||
'modules.addons.nukeprotect',
|
||||
'modules.addons.inserter',
|
||||
'modules.addons.miner',
|
||||
'modules.addons.lawnmower',
|
||||
'modules.addons.logging',
|
||||
"modules.addons.chat-popups",
|
||||
"modules.addons.damage-popups",
|
||||
"modules.addons.death-logger",
|
||||
"modules.addons.advanced-start",
|
||||
"modules.addons.spawn-area",
|
||||
"modules.addons.compilatron",
|
||||
"modules.addons.scorched-earth",
|
||||
"modules.addons.pollution-grading",
|
||||
"modules.addons.station-auto-name",
|
||||
"modules.addons.discord-alerts",
|
||||
"modules.addons.chat-reply",
|
||||
"modules.addons.tree-decon",
|
||||
"modules.addons.afk-kick",
|
||||
"modules.addons.report-jail",
|
||||
"modules.addons.protection-jail",
|
||||
"modules.addons.deconlog",
|
||||
"modules.addons.nukeprotect",
|
||||
"modules.addons.inserter",
|
||||
"modules.addons.miner",
|
||||
"modules.addons.lawnmower",
|
||||
"modules.addons.logging",
|
||||
|
||||
-- Control
|
||||
'modules.control.vlayer',
|
||||
"modules.control.vlayer",
|
||||
|
||||
--- Data
|
||||
'modules.data.statistics',
|
||||
'modules.data.player-colours',
|
||||
'modules.data.greetings',
|
||||
'modules.data.quickbar',
|
||||
'modules.data.alt-view',
|
||||
'modules.data.tag',
|
||||
"modules.data.statistics",
|
||||
"modules.data.player-colours",
|
||||
"modules.data.greetings",
|
||||
"modules.data.quickbar",
|
||||
"modules.data.alt-view",
|
||||
"modules.data.tag",
|
||||
-- 'modules.data.bonus',
|
||||
'modules.data.personal-logistic',
|
||||
'modules.data.language',
|
||||
"modules.data.personal-logistic",
|
||||
"modules.data.language",
|
||||
|
||||
--- GUI
|
||||
'modules.gui.readme',
|
||||
'modules.gui.rocket-info',
|
||||
'modules.gui.science-info',
|
||||
'modules.gui.autofill',
|
||||
'modules.gui.warp-list',
|
||||
'modules.gui.task-list',
|
||||
'modules.gui.player-list',
|
||||
'modules.gui.server-ups',
|
||||
'modules.gui.bonus',
|
||||
'modules.gui.vlayer',
|
||||
'modules.gui.research',
|
||||
'modules.gui.module',
|
||||
'modules.gui.landfill',
|
||||
'modules.gui.production',
|
||||
'modules.gui.playerdata',
|
||||
'modules.gui.surveillance',
|
||||
'modules.graftorio.require', -- graftorio
|
||||
'modules.gui.toolbar', -- must be loaded last to register toolbar handlers
|
||||
"modules.gui.readme",
|
||||
"modules.gui.rocket-info",
|
||||
"modules.gui.science-info",
|
||||
"modules.gui.autofill",
|
||||
"modules.gui.warp-list",
|
||||
"modules.gui.task-list",
|
||||
"modules.gui.player-list",
|
||||
"modules.gui.server-ups",
|
||||
"modules.gui.bonus",
|
||||
"modules.gui.vlayer",
|
||||
"modules.gui.research",
|
||||
"modules.gui.module",
|
||||
"modules.gui.landfill",
|
||||
"modules.gui.production",
|
||||
"modules.gui.playerdata",
|
||||
"modules.gui.surveillance",
|
||||
"modules.graftorio.require", -- graftorio
|
||||
"modules.gui.toolbar", -- must be loaded last to register toolbar handlers
|
||||
|
||||
--- Config Files
|
||||
'config.expcore.command_auth_admin', -- commands tagged with admin_only are blocked for non admins
|
||||
'config.expcore.command_auth_roles', -- commands must be allowed via the role config
|
||||
'config.expcore.command_runtime_disable', -- allows commands to be enabled and disabled during runtime
|
||||
'config.expcore.permission_groups', -- loads some predefined permission groups
|
||||
'config.expcore.roles', -- loads some predefined roles
|
||||
"config.expcore.command_auth_admin", -- commands tagged with admin_only are blocked for non admins
|
||||
"config.expcore.command_auth_roles", -- commands must be allowed via the role config
|
||||
"config.expcore.command_runtime_disable", -- allows commands to be enabled and disabled during runtime
|
||||
"config.expcore.permission_groups", -- loads some predefined permission groups
|
||||
"config.expcore.roles", -- loads some predefined roles
|
||||
}
|
||||
|
||||
@@ -83,48 +83,48 @@ return {
|
||||
items = { --- @setting items items and there condition for being given
|
||||
-- ['item-name'] = function(amount_made, production_stats, player) return <Number> end -- 0 means no items given
|
||||
-- Plates
|
||||
['iron-plate']=scale_amount_made(100, 10, 10),
|
||||
['copper-plate']=scale_amount_made(100, 0, 8),
|
||||
['steel-plate']=scale_amount_made(100, 0, 4),
|
||||
["iron-plate"] = scale_amount_made(100, 10, 10),
|
||||
["copper-plate"] = scale_amount_made(100, 0, 8),
|
||||
["steel-plate"] = scale_amount_made(100, 0, 4),
|
||||
-- Secondary Items
|
||||
['electronic-circuit']=scale_amount_made(1000, 0, 6),
|
||||
['iron-gear-wheel']=scale_amount_made(1000, 0, 6),
|
||||
["electronic-circuit"] = scale_amount_made(1000, 0, 6),
|
||||
["iron-gear-wheel"] = scale_amount_made(1000, 0, 6),
|
||||
-- Starting Items
|
||||
['burner-mining-drill']=cutoff_time(10*minutes, 4, 0),
|
||||
['stone-furnace']=cutoff_time(10*minutes, 4, 0),
|
||||
["burner-mining-drill"] = cutoff_time(10 * minutes, 4, 0),
|
||||
["stone-furnace"] = cutoff_time(10 * minutes, 4, 0),
|
||||
-- Armor
|
||||
['light-armor']=cutoff_amount_made_unless(5, 0,1,'heavy-armor',5),
|
||||
['heavy-armor']=cutoff_amount_made(5, 0,1),
|
||||
["light-armor"] = cutoff_amount_made_unless(5, 0, 1, "heavy-armor", 5),
|
||||
["heavy-armor"] = cutoff_amount_made(5, 0, 1),
|
||||
-- Weapon
|
||||
['pistol']=cutoff_amount_made_unless(0, 1, 1,'submachine-gun',5),
|
||||
['submachine-gun']=cutoff_amount_made(5, 0, 1),
|
||||
["pistol"] = cutoff_amount_made_unless(0, 1, 1, "submachine-gun", 5),
|
||||
["submachine-gun"] = cutoff_amount_made(5, 0, 1),
|
||||
-- Ammo
|
||||
['firearm-magazine']=cutoff_amount_made_unless(100, 10, 0,'piercing-rounds-magazine', 100),
|
||||
['piercing-rounds-magazine']=cutoff_amount_made(100, 0, 10),
|
||||
["firearm-magazine"] = cutoff_amount_made_unless(100, 10, 0, "piercing-rounds-magazine", 100),
|
||||
["piercing-rounds-magazine"] = cutoff_amount_made(100, 0, 10),
|
||||
--[[
|
||||
['construction-robot']=scale_amount_made(1, 10, 1)
|
||||
]]
|
||||
},
|
||||
armor = {
|
||||
enable = false,
|
||||
main = 'modular-armor',
|
||||
main = "modular-armor",
|
||||
item = {
|
||||
{
|
||||
equipment='solar-panel-equipment',
|
||||
count=16
|
||||
equipment = "solar-panel-equipment",
|
||||
count = 16,
|
||||
},
|
||||
{
|
||||
equipment='belt-immunity-equipment',
|
||||
count=1
|
||||
equipment = "belt-immunity-equipment",
|
||||
count = 1,
|
||||
},
|
||||
{
|
||||
equipment='battery-equipment',
|
||||
count=2
|
||||
equipment = "battery-equipment",
|
||||
count = 2,
|
||||
},
|
||||
{
|
||||
equipment='personal-roboport-equipment',
|
||||
count=1
|
||||
equipment = "personal-roboport-equipment",
|
||||
count = 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
return {
|
||||
admin_as_active = true, --- @setting admin_as_active When true admins will be treated as active regardless of afk time
|
||||
trust_as_active = true, --- @setting trust_as_active When true trusted players (by playtime) will be treated as active regardless of afk time
|
||||
active_role = 'Veteran', --- @setting active_role When not nil a player with this role will be treated as active regardless of afk time
|
||||
active_role = "Veteran", --- @setting active_role When not nil a player with this role will be treated as active regardless of afk time
|
||||
afk_time = 3600 * 10, --- @setting afk_time The time in ticks that must pass for a player to be considered afk
|
||||
kick_time = 3600 * 30, --- @setting kick_time The time in ticks that must pass without any active players for all players to be kicked
|
||||
trust_time = 3600 * 60 * 10, --- @setting trust_time The time in ticks that a player must be online for to count as trusted
|
||||
|
||||
@@ -17,79 +17,79 @@ return {
|
||||
= 480
|
||||
]]
|
||||
pts = {
|
||||
base = 260
|
||||
base = 260,
|
||||
},
|
||||
gui_display_width = {
|
||||
half = 150,
|
||||
label = 70,
|
||||
slider = 180,
|
||||
count = 50
|
||||
count = 50,
|
||||
},
|
||||
conversion = {
|
||||
['cmms'] = 'character_mining_speed_modifier',
|
||||
['crs'] = 'character_running_speed_modifier',
|
||||
['ccs'] = 'character_crafting_speed_modifier',
|
||||
['cisb'] = 'character_inventory_slots_bonus',
|
||||
['chb'] = 'character_health_bonus',
|
||||
['crdb'] = 'character_reach_distance_bonus',
|
||||
["cmms"] = "character_mining_speed_modifier",
|
||||
["crs"] = "character_running_speed_modifier",
|
||||
["ccs"] = "character_crafting_speed_modifier",
|
||||
["cisb"] = "character_inventory_slots_bonus",
|
||||
["chb"] = "character_health_bonus",
|
||||
["crdb"] = "character_reach_distance_bonus",
|
||||
--[[
|
||||
['cpdb'] = 'character_item_pickup_distance_bonus'
|
||||
]]
|
||||
},
|
||||
player_special_bonus_rate = 300,
|
||||
player_special_bonus = {
|
||||
['personal_battery_recharge'] = {
|
||||
["personal_battery_recharge"] = {
|
||||
-- 1 MW
|
||||
value = 6,
|
||||
max = 12,
|
||||
scale = 1,
|
||||
cost_scale = 4,
|
||||
cost = 40,
|
||||
is_percentage = false
|
||||
}
|
||||
is_percentage = false,
|
||||
},
|
||||
},
|
||||
player_bonus = {
|
||||
['character_mining_speed_modifier'] = {
|
||||
["character_mining_speed_modifier"] = {
|
||||
value = 3,
|
||||
max = 6,
|
||||
scale = 0.5,
|
||||
cost_scale = 1,
|
||||
cost = 10,
|
||||
is_percentage = true
|
||||
is_percentage = true,
|
||||
},
|
||||
['character_running_speed_modifier'] = {
|
||||
["character_running_speed_modifier"] = {
|
||||
value = 1.5,
|
||||
max = 3,
|
||||
scale = 0.25,
|
||||
cost_scale = 1,
|
||||
cost = 60,
|
||||
is_percentage = true
|
||||
is_percentage = true,
|
||||
},
|
||||
['character_crafting_speed_modifier'] = {
|
||||
["character_crafting_speed_modifier"] = {
|
||||
value = 8,
|
||||
max = 16,
|
||||
scale = 1,
|
||||
cost_scale = 1,
|
||||
cost = 4,
|
||||
is_percentage = true
|
||||
is_percentage = true,
|
||||
},
|
||||
['character_inventory_slots_bonus'] = {
|
||||
["character_inventory_slots_bonus"] = {
|
||||
value = 100,
|
||||
max = 200,
|
||||
scale = 10,
|
||||
cost_scale = 10,
|
||||
cost = 2,
|
||||
is_percentage = false
|
||||
is_percentage = false,
|
||||
},
|
||||
['character_health_bonus'] = {
|
||||
["character_health_bonus"] = {
|
||||
value = 200,
|
||||
max = 400,
|
||||
scale = 50,
|
||||
cost_scale = 50,
|
||||
cost = 4,
|
||||
is_percentage = false
|
||||
is_percentage = false,
|
||||
},
|
||||
['character_reach_distance_bonus'] = {
|
||||
["character_reach_distance_bonus"] = {
|
||||
value = 12,
|
||||
max = 24,
|
||||
scale = 2,
|
||||
@@ -97,9 +97,9 @@ return {
|
||||
cost = 1,
|
||||
is_percentage = false,
|
||||
combined_bonus = {
|
||||
'character_resource_reach_distance_bonus',
|
||||
'character_build_distance_bonus'
|
||||
}
|
||||
"character_resource_reach_distance_bonus",
|
||||
"character_build_distance_bonus",
|
||||
},
|
||||
},
|
||||
--[[
|
||||
['character_item_pickup_distance_bonus'] = {
|
||||
@@ -190,29 +190,29 @@ return {
|
||||
is_percentage = false
|
||||
},
|
||||
]]
|
||||
['worker_robots_battery_modifier'] = {
|
||||
["worker_robots_battery_modifier"] = {
|
||||
value = 1,
|
||||
max = 1,
|
||||
scale = 1,
|
||||
cost_scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
is_percentage = false,
|
||||
},
|
||||
['worker_robots_storage_bonus'] = {
|
||||
["worker_robots_storage_bonus"] = {
|
||||
value = 1,
|
||||
max = 1,
|
||||
scale = 1,
|
||||
cost_scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
is_percentage = false,
|
||||
},
|
||||
['following_robots_lifetime_modifier'] = {
|
||||
["following_robots_lifetime_modifier"] = {
|
||||
value = 1,
|
||||
max = 1,
|
||||
scale = 1,
|
||||
cost_scale = 1,
|
||||
cost = 1,
|
||||
is_percentage = false
|
||||
is_percentage = false,
|
||||
},
|
||||
--[[
|
||||
['character_item_pickup_distance_bonus'] = {
|
||||
@@ -316,5 +316,5 @@ return {
|
||||
is_percentage = false
|
||||
}
|
||||
]]
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -22,107 +22,109 @@ local afk_time_units = {
|
||||
return {
|
||||
allow_command_prefix_for_messages = true, --- @setting allow_command_prefix_for_messages when true any message trigger will print to all player when prefixed
|
||||
messages = { --- @setting messages will trigger when ever the word is said
|
||||
['discord'] = {'info.discord'},
|
||||
['expgaming'] = {'info.website'},
|
||||
['website'] = {'info.website'},
|
||||
['status'] = {'info.status'},
|
||||
['github'] = {'info.github'},
|
||||
['patreon'] = {'info.patreon'},
|
||||
['donate'] = {'info.patreon'},
|
||||
['command'] = {'info.custom-commands'},
|
||||
['commands'] = {'info.custom-commands'},
|
||||
['softmod'] = {'info.softmod'},
|
||||
['script'] = {'info.softmod'},
|
||||
['loop'] = {'chat-bot.loops'},
|
||||
['rhd'] = {'info.lhd'},
|
||||
['lhd'] = {'info.lhd'},
|
||||
['roundabout'] = {'chat-bot.loops'},
|
||||
['roundabouts'] = {'chat-bot.loops'},
|
||||
['redmew'] = {'info.redmew'},
|
||||
['afk'] = function(player, _is_command)
|
||||
["discord"] = { "info.discord" },
|
||||
["expgaming"] = { "info.website" },
|
||||
["website"] = { "info.website" },
|
||||
["status"] = { "info.status" },
|
||||
["github"] = { "info.github" },
|
||||
["patreon"] = { "info.patreon" },
|
||||
["donate"] = { "info.patreon" },
|
||||
["command"] = { "info.custom-commands" },
|
||||
["commands"] = { "info.custom-commands" },
|
||||
["softmod"] = { "info.softmod" },
|
||||
["script"] = { "info.softmod" },
|
||||
["loop"] = { "chat-bot.loops" },
|
||||
["rhd"] = { "info.lhd" },
|
||||
["lhd"] = { "info.lhd" },
|
||||
["roundabout"] = { "chat-bot.loops" },
|
||||
["roundabouts"] = { "chat-bot.loops" },
|
||||
["redmew"] = { "info.redmew" },
|
||||
["afk"] = function(player, _is_command)
|
||||
local max = player
|
||||
for _, next_player in pairs(game.connected_players) do
|
||||
if max.afk_time < next_player.afk_time then
|
||||
max = next_player
|
||||
end
|
||||
end
|
||||
return {'chat-bot.afk', max.name, ExpUtil.format_locale_time(max.afk_time, "long", afk_time_units)}
|
||||
|
||||
return { "chat-bot.afk", max.name, ExpUtil.format_locale_time(max.afk_time, "long", afk_time_units) }
|
||||
end,
|
||||
['players'] = function(_player, _is_command)
|
||||
return {'chat-bot.players', #game.players}
|
||||
["players"] = function(_player, _is_command)
|
||||
return { "chat-bot.players", #game.players }
|
||||
end,
|
||||
['online'] = function(_player, _is_command)
|
||||
return {'chat-bot.players-online', #game.connected_players}
|
||||
["online"] = function(_player, _is_command)
|
||||
return { "chat-bot.players-online", #game.connected_players }
|
||||
end,
|
||||
['r!verify'] = function(player, _is_command)
|
||||
return {'chat-bot.verify', player.name}
|
||||
["r!verify"] = function(player, _is_command)
|
||||
return { "chat-bot.verify", player.name }
|
||||
end,
|
||||
},
|
||||
command_admin_only = false, --- @setting command_admin_only when true will only allow chat commands for admins
|
||||
command_permission = 'command/chat-bot', --- @setting command_permission the permission used to allow command prefixes
|
||||
command_prefix = '!', --- @setting command_prefix prefix used for commands below and to print to all players (if enabled above)
|
||||
command_permission = "command/chat-bot", --- @setting command_permission the permission used to allow command prefixes
|
||||
command_prefix = "!", --- @setting command_prefix prefix used for commands below and to print to all players (if enabled above)
|
||||
commands = { --- @setting commands will trigger only when command prefix is given
|
||||
['dev'] = {'chat-bot.not-real-dev'},
|
||||
['blame'] = function(player, _is_command)
|
||||
local names = {'Cooldude2606', 'arty714', 'badgamernl', 'mark9064', 'aldldl', 'Drahc_pro', player.name}
|
||||
["dev"] = { "chat-bot.not-real-dev" },
|
||||
["blame"] = function(player, _is_command)
|
||||
local names = { "Cooldude2606", "arty714", "badgamernl", "mark9064", "aldldl", "Drahc_pro", player.name }
|
||||
for _, next_player in pairs(game.connected_players) do
|
||||
names[#names + 1] = next_player.name
|
||||
end
|
||||
return {'chat-bot.blame', table.get_random_dictionary_entry(names)}
|
||||
|
||||
return { "chat-bot.blame", table.get_random_dictionary_entry(names) }
|
||||
end,
|
||||
['magic'] = {'chat-bot.magic'},
|
||||
['aids'] = {'chat-bot.aids'},
|
||||
['riot'] = {'chat-bot.riot'},
|
||||
['lenny'] = {'chat-bot.lenny'},
|
||||
['hodor'] = function(_player, _is_command)
|
||||
local options = {'?', '.', '!', '!!!'}
|
||||
return {'chat-bot.hodor', table.get_random_dictionary_entry(options)}
|
||||
["magic"] = { "chat-bot.magic" },
|
||||
["aids"] = { "chat-bot.aids" },
|
||||
["riot"] = { "chat-bot.riot" },
|
||||
["lenny"] = { "chat-bot.lenny" },
|
||||
["hodor"] = function(_player, _is_command)
|
||||
local options = { "?", ".", "!", "!!!" }
|
||||
return { "chat-bot.hodor", table.get_random_dictionary_entry(options) }
|
||||
end,
|
||||
['evolution'] = function(_player, _is_command)
|
||||
return {'chat-bot.current-evolution', string.format('%.2f', game.forces['enemy'].evolution_factor)}
|
||||
["evolution"] = function(_player, _is_command)
|
||||
return { "chat-bot.current-evolution", string.format("%.2f", game.forces["enemy"].evolution_factor) }
|
||||
end,
|
||||
['makepopcorn'] = function(player, _is_command)
|
||||
["makepopcorn"] = function(player, _is_command)
|
||||
local timeout = math.floor(180 * (math.random() + 0.5))
|
||||
send_message_async(true, {'chat-bot.reply', {'chat-bot.get-popcorn-1'}})
|
||||
send_message_async:start_after(timeout, true, {'chat-bot.reply', {'chat-bot.get-popcorn-2', player.name}})
|
||||
send_message_async(true, { "chat-bot.reply", { "chat-bot.get-popcorn-1" } })
|
||||
send_message_async:start_after(timeout, true, { "chat-bot.reply", { "chat-bot.get-popcorn-2", player.name } })
|
||||
end,
|
||||
['passsomesnaps'] = function(player, _is_command)
|
||||
["passsomesnaps"] = function(player, _is_command)
|
||||
local timeout = math.floor(180 * (math.random() + 0.5))
|
||||
send_message_async(player, {'chat-bot.reply', {'chat-bot.get-snaps-1'}})
|
||||
send_message_async:start_after(timeout, true, {'chat-bot.reply', {'chat-bot.get-snaps-2', player.name}})
|
||||
send_message_async:start_after(timeout*(math.random()+0.5), true, {'chat-bot.reply', {'chat-bot.get-snaps-3', player.name}})
|
||||
send_message_async(player, { "chat-bot.reply", { "chat-bot.get-snaps-1" } })
|
||||
send_message_async:start_after(timeout, true, { "chat-bot.reply", { "chat-bot.get-snaps-2", player.name } })
|
||||
send_message_async:start_after(timeout * (math.random() + 0.5), true, { "chat-bot.reply", { "chat-bot.get-snaps-3", player.name } })
|
||||
end,
|
||||
['makecocktail'] = function(player, _is_command)
|
||||
["makecocktail"] = function(player, _is_command)
|
||||
local timeout = math.floor(180 * (math.random() + 0.5))
|
||||
send_message_async(true, {'chat-bot.reply', {'chat-bot.get-cocktail-1'}})
|
||||
send_message_async:start_after(timeout, true, {'chat-bot.reply', {'chat-bot.get-cocktail-2', player.name}})
|
||||
send_message_async:start_after(timeout*(math.random()+0.5), true, {'chat-bot.reply', {'chat-bot.get-cocktail-3', player.name}})
|
||||
send_message_async(true, { "chat-bot.reply", { "chat-bot.get-cocktail-1" } })
|
||||
send_message_async:start_after(timeout, true, { "chat-bot.reply", { "chat-bot.get-cocktail-2", player.name } })
|
||||
send_message_async:start_after(timeout * (math.random() + 0.5), true, { "chat-bot.reply", { "chat-bot.get-cocktail-3", player.name } })
|
||||
end,
|
||||
['makecoffee'] = function(player, _is_command)
|
||||
["makecoffee"] = function(player, _is_command)
|
||||
local timeout = math.floor(180 * (math.random() + 0.5))
|
||||
send_message_async(true, {'chat-bot.reply', {'chat-bot.make-coffee-1'}})
|
||||
send_message_async:start_after(timeout, true, {'chat-bot.reply', {'chat-bot.make-coffee-2', player.name}})
|
||||
send_message_async(true, { "chat-bot.reply", { "chat-bot.make-coffee-1" } })
|
||||
send_message_async:start_after(timeout, true, { "chat-bot.reply", { "chat-bot.make-coffee-2", player.name } })
|
||||
end,
|
||||
['orderpizza'] = function(player, _is_command)
|
||||
["orderpizza"] = function(player, _is_command)
|
||||
local timeout = math.floor(180 * (math.random() + 0.5))
|
||||
send_message_async(true, {'chat-bot.reply', {'chat-bot.order-pizza-1'}})
|
||||
send_message_async:start_after(timeout, true, {'chat-bot.reply', {'chat-bot.order-pizza-2', player.name}})
|
||||
send_message_async:start_after(timeout*(math.random()+0.5), true, {'chat-bot.reply', {'chat-bot.order-pizza-3', player.name}})
|
||||
send_message_async(true, { "chat-bot.reply", { "chat-bot.order-pizza-1" } })
|
||||
send_message_async:start_after(timeout, true, { "chat-bot.reply", { "chat-bot.order-pizza-2", player.name } })
|
||||
send_message_async:start_after(timeout * (math.random() + 0.5), true, { "chat-bot.reply", { "chat-bot.order-pizza-3", player.name } })
|
||||
end,
|
||||
['maketea'] = function(player, _is_command)
|
||||
["maketea"] = function(player, _is_command)
|
||||
local timeout = math.floor(180 * (math.random() + 0.5))
|
||||
send_message_async(true, {'chat-bot.reply', {'chat-bot.make-tea-1'}})
|
||||
send_message_async:start_after(timeout, true, {'chat-bot.reply', {'chat-bot.make-tea-2', player.name}})
|
||||
send_message_async(true, { "chat-bot.reply", { "chat-bot.make-tea-1" } })
|
||||
send_message_async:start_after(timeout, true, { "chat-bot.reply", { "chat-bot.make-tea-2", player.name } })
|
||||
end,
|
||||
['meadplease'] = function(player, _is_command)
|
||||
["meadplease"] = function(player, _is_command)
|
||||
local timeout = math.floor(180 * (math.random() + 0.5))
|
||||
send_message_async(true, {'chat-bot.reply', {'chat-bot.get-mead-1'}})
|
||||
send_message_async:start_after(timeout, true, {'chat-bot.reply', {'chat-bot.get-mead-2', player.name}})
|
||||
send_message_async(true, { "chat-bot.reply", { "chat-bot.get-mead-1" } })
|
||||
send_message_async:start_after(timeout, true, { "chat-bot.reply", { "chat-bot.get-mead-2", player.name } })
|
||||
end,
|
||||
['passabeer'] = function(player, _is_command)
|
||||
["passabeer"] = function(player, _is_command)
|
||||
local timeout = math.floor(180 * (math.random() + 0.5))
|
||||
send_message_async(true, {'chat-bot.reply', {'chat-bot.get-beer-1'}})
|
||||
send_message_async:start_after(timeout, true, {'chat-bot.reply', {'chat-bot.get-beer-2', player.name}})
|
||||
end
|
||||
}
|
||||
send_message_async(true, { "chat-bot.reply", { "chat-bot.get-beer-1" } })
|
||||
send_message_async:start_after(timeout, true, { "chat-bot.reply", { "chat-bot.get-beer-2", player.name } })
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,20 +4,20 @@
|
||||
return {
|
||||
message_cycle = 60 * 15, --- @setting message_cycle 15 seconds default, how often (in ticks) the messages will cycle
|
||||
locations = { --- @setting locations defines the spawn locations for all compilatrons
|
||||
['Spawn']={x=0,y=0}
|
||||
["Spawn"] = { x = 0, y = 0 },
|
||||
},
|
||||
messages = { --- @setting messages the messages that each one will say, must be same name as its location
|
||||
['Spawn']={
|
||||
{'info.website'},
|
||||
{'info.read-readme'},
|
||||
{'info.discord'},
|
||||
{'info.softmod'},
|
||||
{'info.redmew'},
|
||||
{'info.custom-commands'},
|
||||
{'info.status'},
|
||||
{'info.lhd'},
|
||||
{'info.github'},
|
||||
{'info.patreon'},
|
||||
}
|
||||
}
|
||||
["Spawn"] = {
|
||||
{ "info.website" },
|
||||
{ "info.read-readme" },
|
||||
{ "info.discord" },
|
||||
{ "info.softmod" },
|
||||
{ "info.redmew" },
|
||||
{ "info.custom-commands" },
|
||||
{ "info.status" },
|
||||
{ "info.lhd" },
|
||||
{ "info.github" },
|
||||
{ "info.patreon" },
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -12,5 +12,5 @@ return {
|
||||
include_time_of_death = true, --- @setting include_time_of_death weather to include the time of death on the map marker
|
||||
map_icon = nil, --- @setting map_icon the icon that the map marker shows; nil means no icon; format as a SingleID
|
||||
show_light_at_corpse = true, --- @setting show_light_at_corpse if a light should be rendered at the corpse
|
||||
show_line_to_corpse=true --- @setting show_line_to_corpse if a line should be rendered from you to your corpse
|
||||
show_line_to_corpse = true, --- @setting show_line_to_corpse if a line should be rendered from you to your corpse
|
||||
}
|
||||
@@ -11,15 +11,15 @@ return {
|
||||
player_kicks = true,
|
||||
player_promotes = false,
|
||||
player_jail = true,
|
||||
['config']=true,
|
||||
['purge']=true,
|
||||
['c']=true,
|
||||
['command']=true,
|
||||
['silent-command']=true,
|
||||
['measured-command']=true,
|
||||
['banlist']=true,
|
||||
['permissions']=true,
|
||||
['editor']=true,
|
||||
['cheat']=true,
|
||||
['open']=false
|
||||
["config"] = true,
|
||||
["purge"] = true,
|
||||
["c"] = true,
|
||||
["command"] = true,
|
||||
["silent-command"] = true,
|
||||
["measured-command"] = true,
|
||||
["banlist"] = true,
|
||||
["permissions"] = true,
|
||||
["editor"] = true,
|
||||
["cheat"] = true,
|
||||
["open"] = false,
|
||||
}
|
||||
@@ -11,7 +11,7 @@ Commands.add_authenticator(function(player, command, tags, reject)
|
||||
if player.admin then
|
||||
return true
|
||||
else
|
||||
return reject{'command-auth.admin-only'}
|
||||
return reject{ "command-auth.admin-only" }
|
||||
end
|
||||
else
|
||||
return true
|
||||
|
||||
@@ -6,7 +6,7 @@ local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
|
||||
-- luacheck:ignore 212/tags
|
||||
Commands.add_authenticator(function(player, command, tags, reject)
|
||||
if Roles.player_allowed(player,'command/'..command) then
|
||||
if Roles.player_allowed(player, "command/" .. command) then
|
||||
return true
|
||||
else
|
||||
return reject()
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local Colours = require("modules/exp_util/include/color")
|
||||
|
||||
Commands.add_parse('color',function(input, _, reject)
|
||||
Commands.add_parse("color", function(input, _, reject)
|
||||
if not input then return end
|
||||
local color = Colours[input]
|
||||
if not color then
|
||||
return reject{'expcore-commands.reject-color'}
|
||||
return reject{ "expcore-commands.reject-color" }
|
||||
else
|
||||
return input
|
||||
end
|
||||
|
||||
@@ -22,120 +22,120 @@ see ./expcore/commands.lua for more details
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
|
||||
-- luacheck:ignore 212/player
|
||||
Commands.add_parse('boolean',function(input, player)
|
||||
Commands.add_parse("boolean", function(input, player)
|
||||
if not input then return end -- nil check
|
||||
input = input:lower()
|
||||
if input == 'yes'
|
||||
or input == 'y'
|
||||
or input == 'true'
|
||||
or input == '1' then
|
||||
if input == "yes"
|
||||
or input == "y"
|
||||
or input == "true"
|
||||
or input == "1" then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end)
|
||||
|
||||
Commands.add_parse('string-options',function(input, player, reject, options)
|
||||
Commands.add_parse("string-options", function(input, player, reject, options)
|
||||
if not input then return end -- nil check
|
||||
local option = _C.auto_complete(options, input)
|
||||
return option or reject{'expcore-commands.reject-string-options', table.concat(options, ', ')}
|
||||
return option or reject{ "expcore-commands.reject-string-options", table.concat(options, ", ") }
|
||||
end)
|
||||
|
||||
Commands.add_parse('string-max-length',function(input, player, reject, max_length)
|
||||
Commands.add_parse("string-max-length", function(input, player, reject, max_length)
|
||||
if not input then return end -- nil check
|
||||
local length = input:len()
|
||||
if length > max_length then
|
||||
return reject{'expcore-commands.reject-string-max-length',max_length}
|
||||
return reject{ "expcore-commands.reject-string-max-length", max_length }
|
||||
else
|
||||
return input
|
||||
end
|
||||
end)
|
||||
|
||||
Commands.add_parse('number',function(input, player, reject)
|
||||
Commands.add_parse("number", function(input, player, reject)
|
||||
if not input then return end -- nil check
|
||||
local number = tonumber(input)
|
||||
if not number then
|
||||
return reject{'expcore-commands.reject-number'}
|
||||
return reject{ "expcore-commands.reject-number" }
|
||||
else
|
||||
return number
|
||||
end
|
||||
end)
|
||||
|
||||
Commands.add_parse('integer',function(input, player, reject)
|
||||
Commands.add_parse("integer", function(input, player, reject)
|
||||
if not input then return end -- nil check
|
||||
local number = tonumber(input)
|
||||
if not number then
|
||||
return reject{'expcore-commands.reject-number'}
|
||||
return reject{ "expcore-commands.reject-number" }
|
||||
else
|
||||
return math.floor(number)
|
||||
end
|
||||
end)
|
||||
|
||||
Commands.add_parse('number-range',function(input, player, reject, range_min, range_max)
|
||||
local number = Commands.parse('number',input, player, reject)
|
||||
Commands.add_parse("number-range", function(input, player, reject, range_min, range_max)
|
||||
local number = Commands.parse("number", input, player, reject)
|
||||
if not number then return end -- nil check
|
||||
if number < range_min or number > range_max then
|
||||
return reject{'expcore-commands.reject-number-range',range_min, range_max}
|
||||
return reject{ "expcore-commands.reject-number-range", range_min, range_max }
|
||||
else
|
||||
return number
|
||||
end
|
||||
end)
|
||||
|
||||
Commands.add_parse('integer-range',function(input, player, reject, range_min, range_max)
|
||||
local number = Commands.parse('integer',input, player, reject)
|
||||
Commands.add_parse("integer-range", function(input, player, reject, range_min, range_max)
|
||||
local number = Commands.parse("integer", input, player, reject)
|
||||
if not number then return end -- nil check
|
||||
if number < range_min or number > range_max then
|
||||
return reject{'expcore-commands.reject-number-range',range_min, range_max}
|
||||
return reject{ "expcore-commands.reject-number-range", range_min, range_max }
|
||||
else
|
||||
return number
|
||||
end
|
||||
end)
|
||||
|
||||
Commands.add_parse('player',function(input, player, reject)
|
||||
Commands.add_parse("player", function(input, player, reject)
|
||||
if not input then return end -- nil check
|
||||
local input_player = game.players[input]
|
||||
if not input_player then
|
||||
return reject{'expcore-commands.reject-player',input}
|
||||
return reject{ "expcore-commands.reject-player", input }
|
||||
else
|
||||
return input_player
|
||||
end
|
||||
end)
|
||||
|
||||
Commands.add_parse('player-online',function(input, player, reject)
|
||||
local input_player = Commands.parse('player',input, player, reject)
|
||||
Commands.add_parse("player-online", function(input, player, reject)
|
||||
local input_player = Commands.parse("player", input, player, reject)
|
||||
if not input_player then return end -- nil check
|
||||
if not input_player.connected then
|
||||
return reject{'expcore-commands.reject-player-online'}
|
||||
return reject{ "expcore-commands.reject-player-online" }
|
||||
else
|
||||
return input_player
|
||||
end
|
||||
end)
|
||||
|
||||
Commands.add_parse('player-alive',function(input, player, reject)
|
||||
local input_player = Commands.parse('player-online',input, player, reject)
|
||||
Commands.add_parse("player-alive", function(input, player, reject)
|
||||
local input_player = Commands.parse("player-online", input, player, reject)
|
||||
if not input_player then return end -- nil check
|
||||
if not input_player.character or not input_player.character.health or input_player.character.health <= 0 then
|
||||
return reject{'expcore-commands.reject-player-alive'}
|
||||
return reject{ "expcore-commands.reject-player-alive" }
|
||||
else
|
||||
return input_player
|
||||
end
|
||||
end)
|
||||
|
||||
Commands.add_parse('force',function(input, player, reject)
|
||||
Commands.add_parse("force", function(input, player, reject)
|
||||
if not input then return end -- nil check
|
||||
local force = game.forces[input]
|
||||
if not force then
|
||||
return reject{'expcore-commands.reject-force'}
|
||||
return reject{ "expcore-commands.reject-force" }
|
||||
else
|
||||
return force
|
||||
end
|
||||
end)
|
||||
|
||||
Commands.add_parse('surface',function(input, player, reject)
|
||||
Commands.add_parse("surface", function(input, player, reject)
|
||||
if not input then return end
|
||||
local surface = game.surfaces[input]
|
||||
if not surface then
|
||||
return reject{'expcore-commands.reject-surface'}
|
||||
return reject{ "expcore-commands.reject-surface" }
|
||||
else
|
||||
return surface
|
||||
end
|
||||
|
||||
@@ -13,42 +13,43 @@ local auto_complete = _C.auto_complete --- @dep expcore.common
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
-- luacheck:ignore 212/player
|
||||
Commands.add_parse('role',function(input, player, reject)
|
||||
Commands.add_parse("role", function(input, player, reject)
|
||||
if not input then return end
|
||||
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'}
|
||||
return reject{ "expcore-role.reject-role" }
|
||||
else
|
||||
return role
|
||||
end
|
||||
end)
|
||||
|
||||
Commands.add_parse('player-role',function(input, player, reject)
|
||||
local input_player = Commands.parse('player',input, player, reject)
|
||||
Commands.add_parse("player-role", function(input, player, reject)
|
||||
local input_player = Commands.parse("player", input, player, reject)
|
||||
if not input_player then return end -- nil check
|
||||
local player_highest = Roles.get_player_highest_role(player)
|
||||
local input_player_highest = Roles.get_player_highest_role(input_player)
|
||||
if player_highest.index < input_player_highest.index then
|
||||
return input_player
|
||||
else
|
||||
return reject{'expcore-roles.reject-player-role'}
|
||||
return reject{ "expcore-roles.reject-player-role" }
|
||||
end
|
||||
end)
|
||||
|
||||
Commands.add_parse('player-role-online',function(input, player, reject)
|
||||
local input_player = Commands.parse('player-role',input, player, reject)
|
||||
Commands.add_parse("player-role-online", function(input, player, reject)
|
||||
local input_player = Commands.parse("player-role", input, player, reject)
|
||||
if not input_player then return end -- nil check
|
||||
return Commands.parse('player-online',input_player.name, player, reject)
|
||||
return Commands.parse("player-online", input_player.name, player, reject)
|
||||
end)
|
||||
|
||||
Commands.add_parse('player-role-alive',function(input, player, reject)
|
||||
local input_player = Commands.parse('player-role',input, player, reject)
|
||||
Commands.add_parse("player-role-alive", function(input, player, reject)
|
||||
local input_player = Commands.parse("player-role", input, player, reject)
|
||||
if not input_player then return end -- nil check
|
||||
return Commands.parse('player-alive',input_player.name, player, reject)
|
||||
return Commands.parse("player-alive", input_player.name, player, reject)
|
||||
end)
|
||||
@@ -25,7 +25,7 @@ end
|
||||
-- luacheck:ignore 212/player 212/tags
|
||||
Commands.add_authenticator(function(player, command, tags, reject)
|
||||
if disabled_commands[command] then
|
||||
return reject{'command-auth.command-disabled'}
|
||||
return reject{ "command-auth.command-disabled" }
|
||||
else
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -7,99 +7,99 @@
|
||||
-- local Event = require("modules/exp_legacy/utils/event") -- @dep utils.event
|
||||
local Permission_Groups = require("modules.exp_legacy.expcore.permission_groups") --- @dep expcore.permission_groups
|
||||
|
||||
Permission_Groups.new_group('Admin')
|
||||
Permission_Groups.new_group("Admin")
|
||||
:allow_all()
|
||||
:disallow{
|
||||
'add_permission_group', -- admin
|
||||
'delete_permission_group',
|
||||
'edit_permission_group',
|
||||
'import_permissions_string',
|
||||
'map_editor_action',
|
||||
'toggle_map_editor',
|
||||
'change_multiplayer_config',
|
||||
'set_heat_interface_mode',
|
||||
'set_heat_interface_temperature',
|
||||
'set_infinity_container_filter_item',
|
||||
'set_infinity_container_remove_unfiltered_items',
|
||||
'set_infinity_pipe_filter'
|
||||
"add_permission_group", -- admin
|
||||
"delete_permission_group",
|
||||
"edit_permission_group",
|
||||
"import_permissions_string",
|
||||
"map_editor_action",
|
||||
"toggle_map_editor",
|
||||
"change_multiplayer_config",
|
||||
"set_heat_interface_mode",
|
||||
"set_heat_interface_temperature",
|
||||
"set_infinity_container_filter_item",
|
||||
"set_infinity_container_remove_unfiltered_items",
|
||||
"set_infinity_pipe_filter",
|
||||
}
|
||||
|
||||
Permission_Groups.new_group('Trusted')
|
||||
Permission_Groups.new_group("Trusted")
|
||||
:allow_all()
|
||||
:disallow{
|
||||
'add_permission_group', -- admin
|
||||
'delete_permission_group',
|
||||
'edit_permission_group',
|
||||
'import_permissions_string',
|
||||
'map_editor_action',
|
||||
'toggle_map_editor',
|
||||
'change_multiplayer_config',
|
||||
'set_heat_interface_mode',
|
||||
'set_heat_interface_temperature',
|
||||
'set_infinity_container_filter_item',
|
||||
'set_infinity_container_remove_unfiltered_items',
|
||||
'set_infinity_pipe_filter',
|
||||
'admin_action' -- trusted
|
||||
"add_permission_group", -- admin
|
||||
"delete_permission_group",
|
||||
"edit_permission_group",
|
||||
"import_permissions_string",
|
||||
"map_editor_action",
|
||||
"toggle_map_editor",
|
||||
"change_multiplayer_config",
|
||||
"set_heat_interface_mode",
|
||||
"set_heat_interface_temperature",
|
||||
"set_infinity_container_filter_item",
|
||||
"set_infinity_container_remove_unfiltered_items",
|
||||
"set_infinity_pipe_filter",
|
||||
"admin_action", -- trusted
|
||||
}
|
||||
|
||||
Permission_Groups.new_group('Standard')
|
||||
Permission_Groups.new_group("Standard")
|
||||
:allow_all()
|
||||
:disallow{
|
||||
'add_permission_group', -- admin
|
||||
'delete_permission_group',
|
||||
'edit_permission_group',
|
||||
'import_permissions_string',
|
||||
'map_editor_action',
|
||||
'toggle_map_editor',
|
||||
'change_multiplayer_config',
|
||||
'set_heat_interface_mode',
|
||||
'set_heat_interface_temperature',
|
||||
'set_infinity_container_filter_item',
|
||||
'set_infinity_container_remove_unfiltered_items',
|
||||
'set_infinity_pipe_filter',
|
||||
'admin_action', -- trusted
|
||||
'change_programmable_speaker_alert_parameters', -- standard
|
||||
'drop_item',
|
||||
'change_rocket_silo_mode'
|
||||
"add_permission_group", -- admin
|
||||
"delete_permission_group",
|
||||
"edit_permission_group",
|
||||
"import_permissions_string",
|
||||
"map_editor_action",
|
||||
"toggle_map_editor",
|
||||
"change_multiplayer_config",
|
||||
"set_heat_interface_mode",
|
||||
"set_heat_interface_temperature",
|
||||
"set_infinity_container_filter_item",
|
||||
"set_infinity_container_remove_unfiltered_items",
|
||||
"set_infinity_pipe_filter",
|
||||
"admin_action", -- trusted
|
||||
"change_programmable_speaker_alert_parameters", -- standard
|
||||
"drop_item",
|
||||
"change_rocket_silo_mode",
|
||||
}
|
||||
|
||||
Permission_Groups.new_group('Guest')
|
||||
Permission_Groups.new_group("Guest")
|
||||
:allow_all()
|
||||
:disallow{
|
||||
'add_permission_group', -- admin
|
||||
'delete_permission_group',
|
||||
'edit_permission_group',
|
||||
'import_permissions_string',
|
||||
'map_editor_action',
|
||||
'toggle_map_editor',
|
||||
'change_multiplayer_config',
|
||||
'set_heat_interface_mode',
|
||||
'set_heat_interface_temperature',
|
||||
'set_infinity_container_filter_item',
|
||||
'set_infinity_container_remove_unfiltered_items',
|
||||
'set_infinity_pipe_filter',
|
||||
'admin_action', -- trusted
|
||||
'change_programmable_speaker_alert_parameters', -- standard
|
||||
'drop_item',
|
||||
'change_rocket_silo_mode',
|
||||
'change_programmable_speaker_parameters', -- guest
|
||||
'change_train_stop_station',
|
||||
"add_permission_group", -- admin
|
||||
"delete_permission_group",
|
||||
"edit_permission_group",
|
||||
"import_permissions_string",
|
||||
"map_editor_action",
|
||||
"toggle_map_editor",
|
||||
"change_multiplayer_config",
|
||||
"set_heat_interface_mode",
|
||||
"set_heat_interface_temperature",
|
||||
"set_infinity_container_filter_item",
|
||||
"set_infinity_container_remove_unfiltered_items",
|
||||
"set_infinity_pipe_filter",
|
||||
"admin_action", -- trusted
|
||||
"change_programmable_speaker_alert_parameters", -- standard
|
||||
"drop_item",
|
||||
"change_rocket_silo_mode",
|
||||
"change_programmable_speaker_parameters", -- guest
|
||||
"change_train_stop_station",
|
||||
-- 'deconstruct',
|
||||
'remove_cables',
|
||||
'remove_train_station',
|
||||
'reset_assembling_machine',
|
||||
'rotate_entity',
|
||||
"remove_cables",
|
||||
"remove_train_station",
|
||||
"reset_assembling_machine",
|
||||
"rotate_entity",
|
||||
-- 'use_artillery_remote', -- not in 2.0
|
||||
'launch_rocket',
|
||||
'cancel_research',
|
||||
"launch_rocket",
|
||||
"cancel_research",
|
||||
-- 'activate_cut', -- not in 2.0
|
||||
'flush_opened_entity_fluid',
|
||||
'flush_opened_entity_specific_fluid'
|
||||
"flush_opened_entity_fluid",
|
||||
"flush_opened_entity_specific_fluid",
|
||||
}
|
||||
|
||||
Permission_Groups.new_group('Restricted')
|
||||
Permission_Groups.new_group("Restricted")
|
||||
:disallow_all()
|
||||
:allow('write_to_console')
|
||||
:allow("write_to_console")
|
||||
|
||||
--[[ These events are used until a role system is added to make it easier for our admins
|
||||
|
||||
|
||||
@@ -6,204 +6,204 @@ local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep ex
|
||||
local Statistics = PlayerData.Statistics
|
||||
|
||||
--- Role flags that will run when a player changes roles
|
||||
Roles.define_flag_trigger('is_admin',function(player,state)
|
||||
Roles.define_flag_trigger("is_admin", function(player, state)
|
||||
player.admin = state
|
||||
end)
|
||||
Roles.define_flag_trigger('is_spectator',function(player,state)
|
||||
Roles.define_flag_trigger("is_spectator", function(player, state)
|
||||
player.spectator = state
|
||||
end)
|
||||
Roles.define_flag_trigger('is_jail',function(player,state)
|
||||
Roles.define_flag_trigger("is_jail", function(player, state)
|
||||
if player.character then
|
||||
player.character.active = not state
|
||||
end
|
||||
end)
|
||||
|
||||
--- Admin Roles
|
||||
Roles.new_role('System','SYS')
|
||||
:set_permission_group('Default', true)
|
||||
:set_flag('is_admin')
|
||||
:set_flag('is_spectator')
|
||||
:set_flag('report-immune')
|
||||
:set_flag('instant-respawn')
|
||||
Roles.new_role("System", "SYS")
|
||||
:set_permission_group("Default", true)
|
||||
:set_flag("is_admin")
|
||||
:set_flag("is_spectator")
|
||||
:set_flag("report-immune")
|
||||
:set_flag("instant-respawn")
|
||||
:set_allow_all()
|
||||
|
||||
Roles.new_role('Senior Administrator','SAdmin')
|
||||
:set_permission_group('Admin')
|
||||
Roles.new_role("Senior Administrator", "SAdmin")
|
||||
:set_permission_group("Admin")
|
||||
:set_custom_color{ r = 233, g = 63, b = 233 }
|
||||
:set_flag('is_admin')
|
||||
:set_flag('is_spectator')
|
||||
:set_flag('report-immune')
|
||||
:set_flag('instant-respawn')
|
||||
:set_parent('Administrator')
|
||||
:set_flag("is_admin")
|
||||
:set_flag("is_spectator")
|
||||
:set_flag("report-immune")
|
||||
:set_flag("instant-respawn")
|
||||
:set_parent("Administrator")
|
||||
:allow{
|
||||
'command/interface',
|
||||
'command/debug',
|
||||
'command/toggle-cheat-mode',
|
||||
'command/research-all'
|
||||
"command/interface",
|
||||
"command/debug",
|
||||
"command/toggle-cheat-mode",
|
||||
"command/research-all",
|
||||
}
|
||||
|
||||
Roles.new_role('Administrator','Admin')
|
||||
:set_permission_group('Admin')
|
||||
Roles.new_role("Administrator", "Admin")
|
||||
:set_permission_group("Admin")
|
||||
:set_custom_color{ r = 233, g = 63, b = 233 }
|
||||
:set_flag('is_admin')
|
||||
:set_flag('is_spectator')
|
||||
:set_flag('report-immune')
|
||||
:set_flag('instant-respawn')
|
||||
:set_parent('Moderator')
|
||||
:set_flag("is_admin")
|
||||
:set_flag("is_spectator")
|
||||
:set_flag("report-immune")
|
||||
:set_flag("instant-respawn")
|
||||
:set_parent("Moderator")
|
||||
:allow{
|
||||
'gui/warp-list/bypass-proximity',
|
||||
'gui/warp-list/bypass-cooldown',
|
||||
'command/connect-all',
|
||||
'command/collectdata'
|
||||
"gui/warp-list/bypass-proximity",
|
||||
"gui/warp-list/bypass-cooldown",
|
||||
"command/connect-all",
|
||||
"command/collectdata",
|
||||
}
|
||||
|
||||
Roles.new_role('Moderator','Mod')
|
||||
:set_permission_group('Admin')
|
||||
Roles.new_role("Moderator", "Mod")
|
||||
:set_permission_group("Admin")
|
||||
:set_custom_color{ r = 0, g = 170, b = 0 }
|
||||
:set_flag('is_admin')
|
||||
:set_flag('is_spectator')
|
||||
:set_flag('report-immune')
|
||||
:set_flag('instant-respawn')
|
||||
:set_parent('Trainee')
|
||||
:set_flag("is_admin")
|
||||
:set_flag("is_spectator")
|
||||
:set_flag("report-immune")
|
||||
:set_flag("instant-respawn")
|
||||
:set_parent("Trainee")
|
||||
:allow{
|
||||
'command/assign-role',
|
||||
'command/unassign-role',
|
||||
'command/repair',
|
||||
'command/kill/always',
|
||||
'command/clear-tag/always',
|
||||
'command/go-to-spawn/always',
|
||||
'command/clear-reports',
|
||||
'command/clear-warnings',
|
||||
'command/clear-inventory',
|
||||
"command/assign-role",
|
||||
"command/unassign-role",
|
||||
"command/repair",
|
||||
"command/kill/always",
|
||||
"command/clear-tag/always",
|
||||
"command/go-to-spawn/always",
|
||||
"command/clear-reports",
|
||||
"command/clear-warnings",
|
||||
"command/clear-inventory",
|
||||
-- 'command/bonus',
|
||||
'gui/bonus',
|
||||
'command/home',
|
||||
'command/home-set',
|
||||
'command/home-get',
|
||||
'command/return',
|
||||
'command/connect-player',
|
||||
'gui/rocket-info/toggle-active',
|
||||
'gui/rocket-info/remote_launch',
|
||||
'command/toggle-friendly-fire',
|
||||
'command/toggle-always-day',
|
||||
'fast-tree-decon'
|
||||
"gui/bonus",
|
||||
"command/home",
|
||||
"command/home-set",
|
||||
"command/home-get",
|
||||
"command/return",
|
||||
"command/connect-player",
|
||||
"gui/rocket-info/toggle-active",
|
||||
"gui/rocket-info/remote_launch",
|
||||
"command/toggle-friendly-fire",
|
||||
"command/toggle-always-day",
|
||||
"fast-tree-decon",
|
||||
}
|
||||
|
||||
Roles.new_role('Trainee','TrMod')
|
||||
:set_permission_group('Admin')
|
||||
Roles.new_role("Trainee", "TrMod")
|
||||
:set_permission_group("Admin")
|
||||
:set_custom_color{ r = 0, g = 170, b = 0 }
|
||||
:set_flag('is_admin')
|
||||
:set_flag('is_spectator')
|
||||
:set_flag('report-immune')
|
||||
:set_parent('Veteran')
|
||||
:set_flag("is_admin")
|
||||
:set_flag("is_spectator")
|
||||
:set_flag("report-immune")
|
||||
:set_parent("Veteran")
|
||||
:allow{
|
||||
'command/admin-chat',
|
||||
'command/admin-marker',
|
||||
'command/goto',
|
||||
'command/teleport',
|
||||
'command/bring',
|
||||
'command/give-warning',
|
||||
'command/get-warnings',
|
||||
'command/get-reports',
|
||||
'command/protect-entity',
|
||||
'command/protect-area',
|
||||
'command/jail',
|
||||
'command/unjail',
|
||||
'command/kick',
|
||||
'command/ban',
|
||||
'command/spectate',
|
||||
'command/follow',
|
||||
'command/search',
|
||||
'command/search-amount',
|
||||
'command/search-recent',
|
||||
'command/search-online',
|
||||
'command/personal-battery-recharge',
|
||||
'command/pollution-off',
|
||||
'command/pollution-clear',
|
||||
'command/bot-queue-get',
|
||||
'command/bot-queue-set',
|
||||
'command/game-speed',
|
||||
'command/kill-biters',
|
||||
'command/remove-biters',
|
||||
'gui/playerdata'
|
||||
"command/admin-chat",
|
||||
"command/admin-marker",
|
||||
"command/goto",
|
||||
"command/teleport",
|
||||
"command/bring",
|
||||
"command/give-warning",
|
||||
"command/get-warnings",
|
||||
"command/get-reports",
|
||||
"command/protect-entity",
|
||||
"command/protect-area",
|
||||
"command/jail",
|
||||
"command/unjail",
|
||||
"command/kick",
|
||||
"command/ban",
|
||||
"command/spectate",
|
||||
"command/follow",
|
||||
"command/search",
|
||||
"command/search-amount",
|
||||
"command/search-recent",
|
||||
"command/search-online",
|
||||
"command/personal-battery-recharge",
|
||||
"command/pollution-off",
|
||||
"command/pollution-clear",
|
||||
"command/bot-queue-get",
|
||||
"command/bot-queue-set",
|
||||
"command/game-speed",
|
||||
"command/kill-biters",
|
||||
"command/remove-biters",
|
||||
"gui/playerdata",
|
||||
}
|
||||
|
||||
--- Trusted Roles
|
||||
Roles.new_role('Board Member','Board')
|
||||
:set_permission_group('Trusted')
|
||||
Roles.new_role("Board Member", "Board")
|
||||
:set_permission_group("Trusted")
|
||||
:set_custom_color{ r = 247, g = 246, b = 54 }
|
||||
:set_flag('is_spectator')
|
||||
:set_flag('report-immune')
|
||||
:set_flag('instant-respawn')
|
||||
:set_parent('Sponsor')
|
||||
:set_flag("is_spectator")
|
||||
:set_flag("report-immune")
|
||||
:set_flag("instant-respawn")
|
||||
:set_parent("Sponsor")
|
||||
:allow{
|
||||
'command/goto',
|
||||
'command/repair',
|
||||
'command/spectate',
|
||||
'command/follow',
|
||||
'gui/playerdata'
|
||||
"command/goto",
|
||||
"command/repair",
|
||||
"command/spectate",
|
||||
"command/follow",
|
||||
"gui/playerdata",
|
||||
}
|
||||
|
||||
Roles.new_role('Senior Backer','Backer')
|
||||
:set_permission_group('Trusted')
|
||||
Roles.new_role("Senior Backer", "Backer")
|
||||
:set_permission_group("Trusted")
|
||||
:set_custom_color{ r = 238, g = 172, b = 44 }
|
||||
:set_flag('is_spectator')
|
||||
:set_flag('report-immune')
|
||||
:set_flag('instant-respawn')
|
||||
:set_parent('Sponsor')
|
||||
:set_flag("is_spectator")
|
||||
:set_flag("report-immune")
|
||||
:set_flag("instant-respawn")
|
||||
:set_parent("Sponsor")
|
||||
:allow{
|
||||
}
|
||||
|
||||
Roles.new_role('Sponsor','Spon')
|
||||
:set_permission_group('Trusted')
|
||||
Roles.new_role("Sponsor", "Spon")
|
||||
:set_permission_group("Trusted")
|
||||
:set_custom_color{ r = 238, g = 172, b = 44 }
|
||||
:set_flag('is_spectator')
|
||||
:set_flag('report-immune')
|
||||
:set_flag('instant-respawn')
|
||||
:set_parent('Supporter')
|
||||
:set_flag("is_spectator")
|
||||
:set_flag("report-immune")
|
||||
:set_flag("instant-respawn")
|
||||
:set_parent("Supporter")
|
||||
:allow{
|
||||
'gui/rocket-info/toggle-active',
|
||||
'gui/rocket-info/remote_launch',
|
||||
"gui/rocket-info/toggle-active",
|
||||
"gui/rocket-info/remote_launch",
|
||||
-- 'command/bonus',
|
||||
'gui/bonus',
|
||||
'command/home',
|
||||
'command/home-set',
|
||||
'command/home-get',
|
||||
'command/return',
|
||||
'fast-tree-decon'
|
||||
"gui/bonus",
|
||||
"command/home",
|
||||
"command/home-set",
|
||||
"command/home-get",
|
||||
"command/return",
|
||||
"fast-tree-decon",
|
||||
}
|
||||
|
||||
Roles.new_role('Supporter','Sup')
|
||||
:set_permission_group('Trusted')
|
||||
Roles.new_role("Supporter", "Sup")
|
||||
:set_permission_group("Trusted")
|
||||
:set_custom_color{ r = 230, g = 99, b = 34 }
|
||||
:set_flag('is_spectator')
|
||||
:set_parent('Veteran')
|
||||
:set_flag("is_spectator")
|
||||
:set_parent("Veteran")
|
||||
:allow{
|
||||
'command/tag-color',
|
||||
'command/jail',
|
||||
'command/unjail',
|
||||
'command/join-message',
|
||||
'command/join-message-clear'
|
||||
"command/tag-color",
|
||||
"command/jail",
|
||||
"command/unjail",
|
||||
"command/join-message",
|
||||
"command/join-message-clear",
|
||||
}
|
||||
|
||||
Roles.new_role('Partner','Part')
|
||||
:set_permission_group('Trusted')
|
||||
Roles.new_role("Partner", "Part")
|
||||
:set_permission_group("Trusted")
|
||||
:set_custom_color{ r = 140, g = 120, b = 200 }
|
||||
:set_flag('is_spectator')
|
||||
:set_parent('Veteran')
|
||||
:set_flag("is_spectator")
|
||||
:set_parent("Veteran")
|
||||
:allow{
|
||||
'command/jail',
|
||||
'command/unjail'
|
||||
"command/jail",
|
||||
"command/unjail",
|
||||
}
|
||||
|
||||
local hours10, hours250 = 10 * 216000, 250 * 60
|
||||
Roles.new_role('Veteran','Vet')
|
||||
:set_permission_group('Trusted')
|
||||
Roles.new_role("Veteran", "Vet")
|
||||
:set_permission_group("Trusted")
|
||||
:set_custom_color{ r = 140, g = 120, b = 200 }
|
||||
:set_parent('Member')
|
||||
:set_parent("Member")
|
||||
:allow{
|
||||
'command/chat-bot',
|
||||
'command/last-location'
|
||||
"command/chat-bot",
|
||||
"command/last-location",
|
||||
}
|
||||
:set_auto_assign_condition(function(player)
|
||||
if player.online_time >= hours10 then
|
||||
@@ -216,43 +216,43 @@ Roles.new_role('Veteran','Vet')
|
||||
end)
|
||||
|
||||
--- Standard User Roles
|
||||
Roles.new_role('Member','Mem')
|
||||
:set_permission_group('Standard')
|
||||
Roles.new_role("Member", "Mem")
|
||||
:set_permission_group("Standard")
|
||||
:set_custom_color{ r = 24, g = 172, b = 188 }
|
||||
:set_flag('deconlog-bypass')
|
||||
:set_parent('Regular')
|
||||
:set_flag("deconlog-bypass")
|
||||
:set_parent("Regular")
|
||||
:allow{
|
||||
'gui/task-list/add',
|
||||
'gui/task-list/edit',
|
||||
'gui/warp-list/add',
|
||||
'gui/warp-list/edit',
|
||||
'command/save-quickbar',
|
||||
'gui/vlayer-edit',
|
||||
'command/vlayer-info',
|
||||
'command/personal-logistic',
|
||||
'command/auto-research',
|
||||
'command/set-trains-to-automatic',
|
||||
'command/lawnmower',
|
||||
'command/waterfill',
|
||||
'command/artillery-target-remote',
|
||||
'command/clear-item-on-ground',
|
||||
'command/clear-blueprint',
|
||||
'gui/surveillance'
|
||||
"gui/task-list/add",
|
||||
"gui/task-list/edit",
|
||||
"gui/warp-list/add",
|
||||
"gui/warp-list/edit",
|
||||
"command/save-quickbar",
|
||||
"gui/vlayer-edit",
|
||||
"command/vlayer-info",
|
||||
"command/personal-logistic",
|
||||
"command/auto-research",
|
||||
"command/set-trains-to-automatic",
|
||||
"command/lawnmower",
|
||||
"command/waterfill",
|
||||
"command/artillery-target-remote",
|
||||
"command/clear-item-on-ground",
|
||||
"command/clear-blueprint",
|
||||
"gui/surveillance",
|
||||
}
|
||||
|
||||
local hours3, hours15 = 3 * 216000, 15 * 60
|
||||
Roles.new_role('Regular','Reg')
|
||||
:set_permission_group('Standard')
|
||||
Roles.new_role("Regular", "Reg")
|
||||
:set_permission_group("Standard")
|
||||
:set_custom_color{ r = 79, g = 155, b = 163 }
|
||||
:set_parent('Guest')
|
||||
:set_parent("Guest")
|
||||
:allow{
|
||||
'command/kill',
|
||||
'command/rainbow',
|
||||
'command/go-to-spawn',
|
||||
'command/me',
|
||||
'standard-decon',
|
||||
'bypass-entity-protection',
|
||||
'bypass-nukeprotect'
|
||||
"command/kill",
|
||||
"command/rainbow",
|
||||
"command/go-to-spawn",
|
||||
"command/me",
|
||||
"standard-decon",
|
||||
"bypass-entity-protection",
|
||||
"bypass-nukeprotect",
|
||||
}
|
||||
:set_auto_assign_condition(function(player)
|
||||
if player.online_time >= hours3 then
|
||||
@@ -265,103 +265,103 @@ Roles.new_role('Regular','Reg')
|
||||
end)
|
||||
|
||||
--- Guest/Default role
|
||||
local default = Roles.new_role('Guest','')
|
||||
:set_permission_group('Guest')
|
||||
local default = Roles.new_role("Guest", "")
|
||||
:set_permission_group("Guest")
|
||||
:set_custom_color{ r = 185, g = 187, b = 160 }
|
||||
:allow{
|
||||
'command/tag',
|
||||
'command/tag-clear',
|
||||
'command/search-help',
|
||||
'command/list-roles',
|
||||
'command/find-on-map',
|
||||
'command/report',
|
||||
'command/ratio',
|
||||
'command/server-ups',
|
||||
'command/save-data',
|
||||
'command/preference',
|
||||
'command/set-preference',
|
||||
'command/connect',
|
||||
'gui/player-list',
|
||||
'gui/rocket-info',
|
||||
'gui/science-info',
|
||||
'gui/task-list',
|
||||
'gui/warp-list',
|
||||
'gui/readme',
|
||||
'gui/vlayer',
|
||||
'gui/research',
|
||||
'gui/autofill',
|
||||
'gui/module',
|
||||
'gui/landfill',
|
||||
'gui/production'
|
||||
"command/tag",
|
||||
"command/tag-clear",
|
||||
"command/search-help",
|
||||
"command/list-roles",
|
||||
"command/find-on-map",
|
||||
"command/report",
|
||||
"command/ratio",
|
||||
"command/server-ups",
|
||||
"command/save-data",
|
||||
"command/preference",
|
||||
"command/set-preference",
|
||||
"command/connect",
|
||||
"gui/player-list",
|
||||
"gui/rocket-info",
|
||||
"gui/science-info",
|
||||
"gui/task-list",
|
||||
"gui/warp-list",
|
||||
"gui/readme",
|
||||
"gui/vlayer",
|
||||
"gui/research",
|
||||
"gui/autofill",
|
||||
"gui/module",
|
||||
"gui/landfill",
|
||||
"gui/production",
|
||||
}
|
||||
|
||||
--- Jail role
|
||||
Roles.new_role('Jail')
|
||||
:set_permission_group('Restricted')
|
||||
Roles.new_role("Jail")
|
||||
:set_permission_group("Restricted")
|
||||
:set_custom_color{ r = 50, g = 50, b = 50 }
|
||||
:set_block_auto_assign(true)
|
||||
:set_flag('defer_role_changes')
|
||||
:set_flag("defer_role_changes")
|
||||
:disallow(default.allowed)
|
||||
|
||||
--- System defaults which are required to be set
|
||||
Roles.set_root('System')
|
||||
Roles.set_default('Guest')
|
||||
Roles.set_root("System")
|
||||
Roles.set_default("Guest")
|
||||
|
||||
Roles.define_role_order{
|
||||
'System', -- Best to keep root at top
|
||||
'Senior Administrator',
|
||||
'Administrator',
|
||||
'Moderator',
|
||||
'Trainee',
|
||||
'Board Member',
|
||||
'Senior Backer',
|
||||
'Sponsor',
|
||||
'Supporter',
|
||||
'Partner',
|
||||
'Veteran',
|
||||
'Member',
|
||||
'Regular',
|
||||
'Jail',
|
||||
'Guest' -- Default must be last if you want to apply restrictions to other roles
|
||||
"System", -- Best to keep root at top
|
||||
"Senior Administrator",
|
||||
"Administrator",
|
||||
"Moderator",
|
||||
"Trainee",
|
||||
"Board Member",
|
||||
"Senior Backer",
|
||||
"Sponsor",
|
||||
"Supporter",
|
||||
"Partner",
|
||||
"Veteran",
|
||||
"Member",
|
||||
"Regular",
|
||||
"Jail",
|
||||
"Guest", -- Default must be last if you want to apply restrictions to other roles
|
||||
}
|
||||
|
||||
Roles.override_player_roles{
|
||||
['PHIDIAS0303']={'Moderator', 'Board Member', 'Member'},
|
||||
['aldldl']={'Administrator', 'Moderator','Member'},
|
||||
['arty714']={'Senior Administrator', 'Moderator', 'Member'},
|
||||
['Cooldude2606']={'Senior Administrator', 'Moderator', 'Member'},
|
||||
['Drahc_pro']={'Administrator', 'Moderator', 'Member'},
|
||||
['mark9064']={'Administrator', 'Moderator','Member'},
|
||||
['7h3w1z4rd']={'Moderator','Member'},
|
||||
['FlipHalfling90']={'Moderator','Member'},
|
||||
['hamsterbryan']={'Moderator','Member'},
|
||||
['HunterOfGames']={'Moderator','Member'},
|
||||
['NextIdea']={'Moderator','Member'},
|
||||
['TheKernel32']={'Moderator','Member'},
|
||||
['TheKernel64']={'Moderator','Member'},
|
||||
['tovernaar123']={'Moderator','Member'},
|
||||
['UUBlueFire']={'Moderator','Member'},
|
||||
['AssemblyStorm']={'Moderator', 'Member'},
|
||||
['banakeg']={'Moderator','Member'},
|
||||
['connormkii']={'Moderator', 'Member'},
|
||||
['cydes']={'Moderator','Member'},
|
||||
['darklich14']={'Moderator','Member'},
|
||||
['facere']={'Moderator','Member'},
|
||||
['freek18']={'Moderator','Member'},
|
||||
['Gizan']={'Moderator','Member'},
|
||||
['LoicB']={'Moderator','Member'},
|
||||
['M74132']={'Moderator','Member'},
|
||||
['mafisch3']={'Moderator','Member'},
|
||||
['maplesyrup01']={'Moderator','Member'},
|
||||
['ookl']={'Moderator','Member'},
|
||||
['Phoenix27833']={'Moderator','Member'},
|
||||
['porelos']={'Moderator','Member'},
|
||||
['Ruuyji']={'Moderator','Member'},
|
||||
['samy115']={'Moderator','Member'},
|
||||
['SilentLog']={'Moderator','Member'},
|
||||
['Tcheko']={'Moderator','Member'},
|
||||
['thadius856']={'Moderator','Member'},
|
||||
['whoami32']={'Moderator','Member'},
|
||||
['Windbomb']={'Moderator','Member'},
|
||||
['XenoCyber']={'Moderator','Member'}
|
||||
["PHIDIAS0303"] = { "Moderator", "Board Member", "Member" },
|
||||
["aldldl"] = { "Administrator", "Moderator", "Member" },
|
||||
["arty714"] = { "Senior Administrator", "Moderator", "Member" },
|
||||
["Cooldude2606"] = { "Senior Administrator", "Moderator", "Member" },
|
||||
["Drahc_pro"] = { "Administrator", "Moderator", "Member" },
|
||||
["mark9064"] = { "Administrator", "Moderator", "Member" },
|
||||
["7h3w1z4rd"] = { "Moderator", "Member" },
|
||||
["FlipHalfling90"] = { "Moderator", "Member" },
|
||||
["hamsterbryan"] = { "Moderator", "Member" },
|
||||
["HunterOfGames"] = { "Moderator", "Member" },
|
||||
["NextIdea"] = { "Moderator", "Member" },
|
||||
["TheKernel32"] = { "Moderator", "Member" },
|
||||
["TheKernel64"] = { "Moderator", "Member" },
|
||||
["tovernaar123"] = { "Moderator", "Member" },
|
||||
["UUBlueFire"] = { "Moderator", "Member" },
|
||||
["AssemblyStorm"] = { "Moderator", "Member" },
|
||||
["banakeg"] = { "Moderator", "Member" },
|
||||
["connormkii"] = { "Moderator", "Member" },
|
||||
["cydes"] = { "Moderator", "Member" },
|
||||
["darklich14"] = { "Moderator", "Member" },
|
||||
["facere"] = { "Moderator", "Member" },
|
||||
["freek18"] = { "Moderator", "Member" },
|
||||
["Gizan"] = { "Moderator", "Member" },
|
||||
["LoicB"] = { "Moderator", "Member" },
|
||||
["M74132"] = { "Moderator", "Member" },
|
||||
["mafisch3"] = { "Moderator", "Member" },
|
||||
["maplesyrup01"] = { "Moderator", "Member" },
|
||||
["ookl"] = { "Moderator", "Member" },
|
||||
["Phoenix27833"] = { "Moderator", "Member" },
|
||||
["porelos"] = { "Moderator", "Member" },
|
||||
["Ruuyji"] = { "Moderator", "Member" },
|
||||
["samy115"] = { "Moderator", "Member" },
|
||||
["SilentLog"] = { "Moderator", "Member" },
|
||||
["Tcheko"] = { "Moderator", "Member" },
|
||||
["thadius856"] = { "Moderator", "Member" },
|
||||
["whoami32"] = { "Moderator", "Member" },
|
||||
["Windbomb"] = { "Moderator", "Member" },
|
||||
["XenoCyber"] = { "Moderator", "Member" },
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@ return {
|
||||
["forcestats"] = true,
|
||||
["logistorage"] = false,
|
||||
["other"] = true,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -5,23 +5,23 @@ local table = require("modules.exp_legacy.overrides.table") -- @dep overrides.ta
|
||||
|
||||
local config = {
|
||||
-- General config
|
||||
icon = 'item/piercing-rounds-magazine', -- @setting icon that will be used for the toolbar
|
||||
icon = "item/piercing-rounds-magazine", -- @setting icon that will be used for the toolbar
|
||||
categories = {
|
||||
ammo = 'ammo',
|
||||
fuel = 'fuel',
|
||||
shell = 'shell'
|
||||
ammo = "ammo",
|
||||
fuel = "fuel",
|
||||
shell = "shell",
|
||||
},
|
||||
entities = {
|
||||
car = 'car',
|
||||
tank = 'tank',
|
||||
spidertron = 'spidertron',
|
||||
locomotive = 'locomotive',
|
||||
gun_turret = 'gun-turret',
|
||||
burner_mining_drill = 'burner-mining-drill',
|
||||
stone_furnace = 'stone-furnace',
|
||||
steel_furnace = 'steel-furnace'
|
||||
car = "car",
|
||||
tank = "tank",
|
||||
spidertron = "spidertron",
|
||||
locomotive = "locomotive",
|
||||
gun_turret = "gun-turret",
|
||||
burner_mining_drill = "burner-mining-drill",
|
||||
stone_furnace = "stone-furnace",
|
||||
steel_furnace = "steel-furnace",
|
||||
},
|
||||
default_entities = {}
|
||||
default_entities = {},
|
||||
}
|
||||
|
||||
local default_categories = {
|
||||
@@ -30,51 +30,51 @@ local default_categories = {
|
||||
entity = { config.entities.car, config.entities.tank, config.entities.gun_turret },
|
||||
inv = { defines.inventory.car_ammo, defines.inventory.turret_ammo },
|
||||
items = {
|
||||
{ name = 'uranium-rounds-magazine', amount = 10, enabled = false },
|
||||
{ name = 'piercing-rounds-magazine', amount = 10, enabled = false },
|
||||
{ name = 'firearm-magazine', amount = 10, enabled = false },
|
||||
}
|
||||
{ name = "uranium-rounds-magazine", amount = 10, enabled = false },
|
||||
{ name = "piercing-rounds-magazine", amount = 10, enabled = false },
|
||||
{ name = "firearm-magazine", amount = 10, enabled = false },
|
||||
},
|
||||
},
|
||||
{
|
||||
category = config.categories.ammo,
|
||||
entity = { config.entities.tank },
|
||||
inv = { defines.inventory.car_ammo },
|
||||
items = {
|
||||
{ name = 'flamethrower-ammo', amount = 10, enabled = false },
|
||||
}
|
||||
{ name = "flamethrower-ammo", amount = 10, enabled = false },
|
||||
},
|
||||
},
|
||||
{
|
||||
category = config.categories.shell,
|
||||
entity = { config.entities.tank },
|
||||
inv = { defines.inventory.car_ammo },
|
||||
items = {
|
||||
{ name = 'cannon-shell', amount = 10, enabled = false },
|
||||
{ name = 'explosive-cannon-shell', amount = 10, enabled = false },
|
||||
{ name = 'uranium-cannon-shell', amount = 10, enabled = false },
|
||||
{ name = 'explosive-uranium-cannon-shell', amount = 10, enabled = false },
|
||||
}
|
||||
{ name = "cannon-shell", amount = 10, enabled = false },
|
||||
{ name = "explosive-cannon-shell", amount = 10, enabled = false },
|
||||
{ name = "uranium-cannon-shell", amount = 10, enabled = false },
|
||||
{ name = "explosive-uranium-cannon-shell", amount = 10, enabled = false },
|
||||
},
|
||||
},
|
||||
{
|
||||
category = config.categories.ammo,
|
||||
entity = { config.entities.spidertron },
|
||||
inv = { defines.inventory.car_ammo },
|
||||
items = {
|
||||
{ name = 'rocket', amount = 10, enabled = false },
|
||||
{ name = 'explosive-rocket', amount = 10, enabled = false },
|
||||
{ name = 'atomic-bomb', amount = 10, enabled = false },
|
||||
}
|
||||
{ name = "rocket", amount = 10, enabled = false },
|
||||
{ name = "explosive-rocket", amount = 10, enabled = false },
|
||||
{ name = "atomic-bomb", amount = 10, enabled = false },
|
||||
},
|
||||
},
|
||||
{
|
||||
category = config.categories.fuel,
|
||||
entity = { config.entities.car, config.entities.tank, config.entities.locomotive, config.entities.burner_mining_drill, config.entities.stone_furnace, config.entities.steel_furnace },
|
||||
inv = { defines.inventory.fuel },
|
||||
items = {
|
||||
{ name = 'nuclear-fuel', amount = 10, enabled = false },
|
||||
{ name = 'rocket-fuel', amount = 10, enabled = false },
|
||||
{ name = 'solid-fuel', amount = 10, enabled = false },
|
||||
{ name = 'coal', amount = 10, enabled = false },
|
||||
}
|
||||
}
|
||||
{ name = "nuclear-fuel", amount = 10, enabled = false },
|
||||
{ name = "rocket-fuel", amount = 10, enabled = false },
|
||||
{ name = "solid-fuel", amount = 10, enabled = false },
|
||||
{ name = "coal", amount = 10, enabled = false },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local function get_items_by_inv(entity, inv)
|
||||
@@ -89,12 +89,13 @@ local function get_items_by_inv(entity, inv)
|
||||
inv = inv,
|
||||
name = item.name,
|
||||
amount = item.amount,
|
||||
enabled = item.enabled
|
||||
enabled = item.enabled,
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return items
|
||||
end
|
||||
|
||||
@@ -103,7 +104,7 @@ local function generate_default_setting(entity_name, inv, enabled)
|
||||
config.default_entities[entity_name] = {
|
||||
entity = entity_name,
|
||||
enabled = enabled,
|
||||
items = {}
|
||||
items = {},
|
||||
}
|
||||
end
|
||||
get_items_by_inv(config.default_entities[entity_name], inv)
|
||||
|
||||
@@ -38,7 +38,7 @@ end
|
||||
-- teleports one player to another
|
||||
local function teleport(from_player, to_player)
|
||||
local surface = to_player.surface
|
||||
local position = surface.find_non_colliding_position('character',to_player.position,32,1)
|
||||
local position = surface.find_non_colliding_position("character", to_player.position, 32, 1)
|
||||
if not position then return false end -- return false if no new position
|
||||
if from_player.driving then from_player.driving = false end -- kicks a player out a vehicle if in one
|
||||
from_player.teleport(position, surface)
|
||||
@@ -47,25 +47,25 @@ end
|
||||
|
||||
local function new_button(sprite, tooltip)
|
||||
return Gui.element{
|
||||
type = 'sprite-button',
|
||||
style = 'tool_button',
|
||||
type = "sprite-button",
|
||||
style = "tool_button",
|
||||
sprite = sprite,
|
||||
tooltip = tooltip
|
||||
tooltip = tooltip,
|
||||
}:style{
|
||||
padding = -1,
|
||||
height = 28,
|
||||
width = 28
|
||||
width = 28,
|
||||
}
|
||||
end
|
||||
|
||||
--- Teleports the user to the action player
|
||||
-- @element goto_player
|
||||
local goto_player = new_button('utility/export',{'player-list.goto-player'})
|
||||
local goto_player = new_button("utility/export", { "player-list.goto-player" })
|
||||
:on_click(function(player)
|
||||
local selected_player_name = get_action_player_name(player)
|
||||
local selected_player = game.players[selected_player_name]
|
||||
if not player.character or not selected_player.character then
|
||||
player.print({'expcore-commands.reject-player-alive'},Colors.orange_red)
|
||||
player.print({ "expcore-commands.reject-player-alive" }, Colors.orange_red)
|
||||
else
|
||||
teleport(player, selected_player)
|
||||
end
|
||||
@@ -73,12 +73,12 @@ end)
|
||||
|
||||
--- Teleports the action player to the user
|
||||
-- @element bring_player
|
||||
local bring_player = new_button('utility/import',{'player-list.bring-player'})
|
||||
local bring_player = new_button("utility/import", { "player-list.bring-player" })
|
||||
:on_click(function(player)
|
||||
local selected_player_name = get_action_player_name(player)
|
||||
local selected_player = game.players[selected_player_name]
|
||||
if not player.character or not selected_player.character then
|
||||
player.print({'expcore-commands.reject-player-alive'},Colors.orange_red)
|
||||
player.print({ "expcore-commands.reject-player-alive" }, Colors.orange_red)
|
||||
else
|
||||
teleport(selected_player, player)
|
||||
end
|
||||
@@ -86,62 +86,62 @@ end)
|
||||
|
||||
--- Reports the action player, requires a reason to be given
|
||||
-- @element report_player
|
||||
local report_player = new_button('utility/spawn_flag',{'player-list.report-player'})
|
||||
local report_player = new_button("utility/spawn_flag", { "player-list.report-player" })
|
||||
:on_click(function(player)
|
||||
local selected_player_name = get_action_player_name(player)
|
||||
if Reports.is_reported(selected_player_name, player.name) then
|
||||
player.print({'expcom-report.already-reported'},Colors.orange_red)
|
||||
player.print({ "expcom-report.already-reported" }, Colors.orange_red)
|
||||
else
|
||||
SelectedAction:set(player, 'command/report')
|
||||
SelectedAction:set(player, "command/report")
|
||||
end
|
||||
end)
|
||||
|
||||
local function report_player_callback(player, reason)
|
||||
local selected_player_name, selected_player_color = get_action_player_name(player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
game.print{'expcom-report.non-admin', selected_player_color,reason}
|
||||
Roles.print_to_roles_higher('Trainee',{'expcom-report.admin', selected_player_color,by_player_name_color,reason})
|
||||
game.print{ "expcom-report.non-admin", selected_player_color, reason }
|
||||
Roles.print_to_roles_higher("Trainee", { "expcom-report.admin", selected_player_color, by_player_name_color, reason })
|
||||
Reports.report_player(selected_player_name, player.name, reason)
|
||||
end
|
||||
|
||||
--- Gives the action player a warning, requires a reason
|
||||
-- @element warn_player
|
||||
local warn_player = new_button('utility/spawn_flag',{'player-list.warn-player'})
|
||||
local warn_player = new_button("utility/spawn_flag", { "player-list.warn-player" })
|
||||
:on_click(function(player)
|
||||
SelectedAction:set(player, 'command/give-warning')
|
||||
SelectedAction:set(player, "command/give-warning")
|
||||
end)
|
||||
|
||||
local function warn_player_callback(player, reason)
|
||||
local selected_player_name, selected_player_color = get_action_player_name(player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
game.print{'expcom-warnings.received', selected_player_color,by_player_name_color,reason}
|
||||
game.print{ "expcom-warnings.received", selected_player_color, by_player_name_color, reason }
|
||||
Warnings.add_warning(selected_player_name, player.name, reason)
|
||||
end
|
||||
|
||||
--- Jails the action player, requires a reason
|
||||
-- @element jail_player
|
||||
local jail_player = new_button('utility/multiplayer_waiting_icon',{'player-list.jail-player'})
|
||||
local jail_player = new_button("utility/multiplayer_waiting_icon", { "player-list.jail-player" })
|
||||
:on_click(function(player)
|
||||
local selected_player_name, selected_player_color = get_action_player_name(player)
|
||||
if Jail.is_jailed(selected_player_name) then
|
||||
player.print({'expcom-jail.already-jailed', selected_player_color},Colors.orange_red)
|
||||
player.print({ "expcom-jail.already-jailed", selected_player_color }, Colors.orange_red)
|
||||
else
|
||||
SelectedAction:set(player, 'command/jail')
|
||||
SelectedAction:set(player, "command/jail")
|
||||
end
|
||||
end)
|
||||
|
||||
local function jail_player_callback(player, reason)
|
||||
local selected_player_name, selected_player_color = get_action_player_name(player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
game.print{'expcom-jail.give', selected_player_color,by_player_name_color,reason}
|
||||
game.print{ "expcom-jail.give", selected_player_color, by_player_name_color, reason }
|
||||
Jail.jail_player(selected_player_name, player.name, reason)
|
||||
end
|
||||
|
||||
--- Kicks the action player, requires a reason
|
||||
-- @element kick_player
|
||||
local kick_player = new_button('utility/warning_icon',{'player-list.kick-player'})
|
||||
local kick_player = new_button("utility/warning_icon", { "player-list.kick-player" })
|
||||
:on_click(function(player)
|
||||
SelectedAction:set(player, 'command/kick')
|
||||
SelectedAction:set(player, "command/kick")
|
||||
end)
|
||||
|
||||
local function kick_player_callback(player, reason)
|
||||
@@ -151,9 +151,9 @@ end
|
||||
|
||||
--- Bans the action player, requires a reason
|
||||
-- @element ban_player
|
||||
local ban_player = new_button('utility/danger_icon',{'player-list.ban-player'})
|
||||
local ban_player = new_button("utility/danger_icon", { "player-list.ban-player" })
|
||||
:on_click(function(player)
|
||||
SelectedAction:set(player, 'command/ban')
|
||||
SelectedAction:set(player, "command/ban")
|
||||
end)
|
||||
|
||||
local function ban_player_callback(player, reason)
|
||||
@@ -164,42 +164,42 @@ end
|
||||
return {
|
||||
set_datastores = set_datastores,
|
||||
buttons = {
|
||||
['command/teleport'] = {
|
||||
["command/teleport"] = {
|
||||
auth = function(player, selected_player)
|
||||
return player.name ~= selected_player.name
|
||||
end, -- cant teleport to your self
|
||||
goto_player,
|
||||
bring_player
|
||||
bring_player,
|
||||
},
|
||||
['command/report'] = {
|
||||
["command/report"] = {
|
||||
auth = function(player, selected_player)
|
||||
if player == selected_player then return false end
|
||||
if not Roles.player_allowed(player,'command/give-warning') then
|
||||
return not Roles.player_has_flag(selected_player,'report-immune')
|
||||
if not Roles.player_allowed(player, "command/give-warning") then
|
||||
return not Roles.player_has_flag(selected_player, "report-immune")
|
||||
end
|
||||
end, -- can report any player that isn't immune and you aren't able to give warnings
|
||||
reason_callback = report_player_callback,
|
||||
report_player
|
||||
report_player,
|
||||
},
|
||||
['command/give-warning'] = {
|
||||
["command/give-warning"] = {
|
||||
auth = auth_lower_role, -- warn a lower user, replaces report
|
||||
reason_callback = warn_player_callback,
|
||||
warn_player
|
||||
warn_player,
|
||||
},
|
||||
['command/jail'] = {
|
||||
["command/jail"] = {
|
||||
auth = auth_lower_role,
|
||||
reason_callback = jail_player_callback,
|
||||
jail_player
|
||||
jail_player,
|
||||
},
|
||||
['command/kick'] = {
|
||||
["command/kick"] = {
|
||||
auth = auth_lower_role,
|
||||
reason_callback = kick_player_callback,
|
||||
kick_player
|
||||
kick_player,
|
||||
},
|
||||
['command/ban'] = {
|
||||
["command/ban"] = {
|
||||
auth = auth_lower_role,
|
||||
reason_callback = ban_player_callback,
|
||||
ban_player
|
||||
}
|
||||
}
|
||||
ban_player,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -10,26 +10,38 @@ return {
|
||||
show_total_rockets = true, --- @setting show_total_rockets false will not show the total number of rockets launched
|
||||
show_game_avg = true, --- @setting show_game_avg false will hide the avg across the entire map time
|
||||
rolling_avg = { --- @setting rolling_avg each number will be one statistic; 5 means the avg time taken for the last 5 rockets
|
||||
5,10,25
|
||||
}
|
||||
5, 10, 25,
|
||||
},
|
||||
},
|
||||
milestones = { --- @setting milestones each number will be one statistic; 5 means the time that the 5th rocket was launched
|
||||
show_milestones = true, --- @setting show_milestones false will hide this section all together
|
||||
1,2,5,
|
||||
10,20,50,
|
||||
100,200,500,
|
||||
1000,1500,2000,2500,
|
||||
3000,3500,4000,4500,
|
||||
5000
|
||||
1,
|
||||
2,
|
||||
5,
|
||||
10,
|
||||
20,
|
||||
50,
|
||||
100,
|
||||
200,
|
||||
500,
|
||||
1000,
|
||||
1500,
|
||||
2000,
|
||||
2500,
|
||||
3000,
|
||||
3500,
|
||||
4000,
|
||||
4500,
|
||||
5000,
|
||||
},
|
||||
progress = { --- @setting progress The data and buttons in the build progress section
|
||||
show_progress = true, --- @setting show_progress false will hide this section altogether
|
||||
allow_zoom_to_map = true, --- @setting allow_zoom_to_map false will disable the zoom to map feature
|
||||
allow_remote_launch = true, --- @setting allow_remote_launch false removes the remote launch button for all players
|
||||
remote_launch_admins_only = false, --- @setting remote_launch_admins_only true will remove the remote launch button for all non (game) admins
|
||||
remote_launch_role_permission = 'gui/rocket-info/remote_launch', --- @setting remote_launch_role_permission value used by custom permission system to allow or disallow the button
|
||||
remote_launch_role_permission = "gui/rocket-info/remote_launch", --- @setting remote_launch_role_permission value used by custom permission system to allow or disallow the button
|
||||
allow_toggle_active = true, --- @setting allow_toggle_active false removes the remote toggle auto launch button for all players
|
||||
toggle_active_admins_only = false, --- @setting toggle_active_admins_only true will remove the toggle auto launch button for all non (game) admins
|
||||
toggle_active_role_permission = 'gui/rocket-info/toggle-active' --- @setting toggle_active_role_permission value used by custom permission system to allow or disallow the button
|
||||
}
|
||||
toggle_active_role_permission = "gui/rocket-info/toggle-active", --- @setting toggle_active_role_permission value used by custom permission system to allow or disallow the button
|
||||
},
|
||||
}
|
||||
@@ -6,11 +6,11 @@ return {
|
||||
show_eta = true, --- @setting show_eta when true the eta for research completion will be shown
|
||||
color_cutoff = 0.8, --- @setting color_cutoff the amount that production can fall before the text changes color
|
||||
color_flux = 0.1, --- @setting color_flux the amount of fluctuation allowed in production before the icon changes color
|
||||
'automation-science-pack',
|
||||
'logistic-science-pack',
|
||||
'military-science-pack',
|
||||
'chemical-science-pack',
|
||||
'production-science-pack',
|
||||
'utility-science-pack',
|
||||
'space-science-pack',
|
||||
"automation-science-pack",
|
||||
"logistic-science-pack",
|
||||
"military-science-pack",
|
||||
"chemical-science-pack",
|
||||
"production-science-pack",
|
||||
"utility-science-pack",
|
||||
"space-science-pack",
|
||||
}
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
return {
|
||||
-- Adding tasks
|
||||
allow_add_task = 'all', --- @setting allow_add_task dictates who is allowed to add new tasks; values: all, admin, expcore.roles, none
|
||||
expcore_roles_allow_add_task = 'gui/task-list/add', --- @setting expcore_roles_allow_add_task if expcore.roles is used then this is the required permission
|
||||
allow_add_task = "all", --- @setting allow_add_task dictates who is allowed to add new tasks; values: all, admin, expcore.roles, none
|
||||
expcore_roles_allow_add_task = "gui/task-list/add", --- @setting expcore_roles_allow_add_task if expcore.roles is used then this is the required permission
|
||||
|
||||
-- Editing tasks
|
||||
allow_edit_task = 'expcore.roles', --- @setting allow_edit_task dictates who is allowed to edit existing tasks; values: all, admin, expcore.roles, none
|
||||
expcore_roles_allow_edit_task = 'gui/task-list/edit', --- @setting expcore_roles_allow_edit_task if expcore.roles is used then this is the required permission
|
||||
user_can_edit_own_tasks = true --- @settings if true then the user who made the task can edit it regardless of the allow_edit_task setting
|
||||
allow_edit_task = "expcore.roles", --- @setting allow_edit_task dictates who is allowed to edit existing tasks; values: all, admin, expcore.roles, none
|
||||
expcore_roles_allow_edit_task = "gui/task-list/edit", --- @setting expcore_roles_allow_edit_task if expcore.roles is used then this is the required permission
|
||||
user_can_edit_own_tasks = true, --- @settings if true then the user who made the task can edit it regardless of the allow_edit_task setting
|
||||
}
|
||||
@@ -5,48 +5,48 @@ return {
|
||||
-- General config
|
||||
update_smoothing = 10, --- @setting update_smoothing the amount of smoothing applied to updates to the cooldown timer, higher is better, max is 60
|
||||
minimum_distance = 100, --- @setting minimum_distance the minimum distance that is allowed between warps on the same force
|
||||
default_icon = {type = 'item', name = 'discharge-defense-equipment'}, --- @setting default_icon the default icon that will be used for warps
|
||||
default_icon = { type = "item", name = "discharge-defense-equipment" }, --- @setting default_icon the default icon that will be used for warps
|
||||
|
||||
-- Warp cooldowns
|
||||
bypass_warp_cooldown = 'expcore.roles', --- @setting bypass_warp_cooldown dictates who the warp cooldown is applied to; values: all, admin, expcore.roles, none
|
||||
expcore_roles_bypass_warp_cooldown = 'gui/warp-list/bypass-cooldown', --- @setting expcore_roles_bypass_warp_cooldown if expcore.roles is used then this is the required permission
|
||||
bypass_warp_cooldown = "expcore.roles", --- @setting bypass_warp_cooldown dictates who the warp cooldown is applied to; values: all, admin, expcore.roles, none
|
||||
expcore_roles_bypass_warp_cooldown = "gui/warp-list/bypass-cooldown", --- @setting expcore_roles_bypass_warp_cooldown if expcore.roles is used then this is the required permission
|
||||
cooldown_duration = 60, --- @setting cooldown_duration the duration of the warp cooldown in seconds
|
||||
|
||||
-- Warp proximity
|
||||
bypass_warp_proximity = 'expcore.roles', --- @setting bypass_warp_proximity dictates who the warp proximity is applied to; values: all, admin, expcore.roles, none
|
||||
expcore_roles_bypass_warp_proximity = 'gui/warp-list/bypass-proximity', --- @setting expcore_roles_bypass_warp_proximity if expcore.roles is used then this is the required permission
|
||||
bypass_warp_proximity = "expcore.roles", --- @setting bypass_warp_proximity dictates who the warp proximity is applied to; values: all, admin, expcore.roles, none
|
||||
expcore_roles_bypass_warp_proximity = "gui/warp-list/bypass-proximity", --- @setting expcore_roles_bypass_warp_proximity if expcore.roles is used then this is the required permission
|
||||
standard_proximity_radius = 4, --- @setting standard_proximity_radius the minimum distance a player is allowed to be to a warp in order to use it
|
||||
spawn_proximity_radius = 20, --- @setting spawn_proximity_radius the minimum distance a player is allowed to be from they spawn point to use warps
|
||||
|
||||
-- Adding warps
|
||||
allow_add_warp = 'expcore.roles', --- @setting allow_add_warp dictates who is allowed to add warps; values: all, admin, expcore.roles, none
|
||||
expcore_roles_allow_add_warp = 'gui/warp-list/add', --- @setting expcore_roles_allow_add_warp if expcore.roles is used then this is the required permission
|
||||
allow_add_warp = "expcore.roles", --- @setting allow_add_warp dictates who is allowed to add warps; values: all, admin, expcore.roles, none
|
||||
expcore_roles_allow_add_warp = "gui/warp-list/add", --- @setting expcore_roles_allow_add_warp if expcore.roles is used then this is the required permission
|
||||
|
||||
-- Editing warps
|
||||
allow_edit_warp = 'expcore.roles', --- @setting allow_edit_warp dictates who is allowed to edit warps; values: all, admin, expcore.roles, none
|
||||
expcore_roles_allow_edit_warp = 'gui/warp-list/edit', --- @setting expcore_roles_allow_edit_warp if expcore.roles is used then this is the required permission
|
||||
allow_edit_warp = "expcore.roles", --- @setting allow_edit_warp dictates who is allowed to edit warps; values: all, admin, expcore.roles, none
|
||||
expcore_roles_allow_edit_warp = "gui/warp-list/edit", --- @setting expcore_roles_allow_edit_warp if expcore.roles is used then this is the required permission
|
||||
user_can_edit_own_warps = false, --- @settings user_can_edit_own_warps if true then the user who made the warp can edit it regardless of the allow_edit_warp setting
|
||||
|
||||
-- Warp area generation
|
||||
entities = { --- @setting entities The entities which are created for warp areas
|
||||
{'small-lamp', -4, -2}, {'small-lamp', -2, -4}, {'medium-electric-pole',-3,-3}, -- Top left corner
|
||||
{'small-lamp', 3, -2}, {'small-lamp', 1, -4}, {'medium-electric-pole',2,-3}, -- Top right corner
|
||||
{'small-lamp', 3, 1}, {'small-lamp', 1, 3}, {'medium-electric-pole',2,2}, -- Bottom right corner
|
||||
{'small-lamp', -4, 1}, {'small-lamp', -2, 3}, {'medium-electric-pole',-3,2}, -- Bottom left corner
|
||||
{ "small-lamp", -4, -2 }, { "small-lamp", -2, -4 }, { "medium-electric-pole", -3, -3 }, -- Top left corner
|
||||
{ "small-lamp", 3, -2 }, { "small-lamp", 1, -4 }, { "medium-electric-pole", 2, -3 }, -- Top right corner
|
||||
{ "small-lamp", 3, 1 }, { "small-lamp", 1, 3 }, { "medium-electric-pole", 2, 2 }, -- Bottom right corner
|
||||
{ "small-lamp", -4, 1 }, { "small-lamp", -2, 3 }, { "medium-electric-pole", -3, 2 }, -- Bottom left corner
|
||||
},
|
||||
tiles = { --- @setting tiles The tiles which are created for warp areas
|
||||
{'black-refined-concrete',-4,-2}, {'black-refined-concrete',-4,-1}, {'black-refined-concrete',-4,0}, {'black-refined-concrete',-4,1},
|
||||
{'black-refined-concrete',-3,-3}, {'purple-refined-concrete',-3,-2}, {'purple-refined-concrete',-3,-1}, {'purple-refined-concrete',-3,0},
|
||||
{'purple-refined-concrete',-3,1}, {'black-refined-concrete',-3,2}, {'black-refined-concrete',-2,-4}, {'purple-refined-concrete',-2,-3},
|
||||
{'purple-refined-concrete',-2,-2}, {'purple-refined-concrete',-2,-1}, {'purple-refined-concrete',-2,0}, {'purple-refined-concrete',-2,1},
|
||||
{'purple-refined-concrete',-2,2}, {'black-refined-concrete',-2,3}, {'black-refined-concrete',-1,-4}, {'purple-refined-concrete',-1,-3},
|
||||
{'purple-refined-concrete',-1,-2}, {'purple-refined-concrete',-1,-1}, {'purple-refined-concrete',-1,0}, {'purple-refined-concrete',-1,1},
|
||||
{'purple-refined-concrete',-1,2}, {'black-refined-concrete',-1,3}, {'black-refined-concrete',0,-4}, {'purple-refined-concrete',0,-3},
|
||||
{'purple-refined-concrete',0,-2}, {'purple-refined-concrete',0,-1}, {'purple-refined-concrete',0,0}, {'purple-refined-concrete',0,1},
|
||||
{'purple-refined-concrete',0,2}, {'black-refined-concrete',0,3}, {'black-refined-concrete',1,-4}, {'purple-refined-concrete',1,-3},
|
||||
{'purple-refined-concrete',1,-2}, {'purple-refined-concrete',1,-1}, {'purple-refined-concrete',1,0}, {'purple-refined-concrete',1,1},
|
||||
{'purple-refined-concrete',1,2}, {'black-refined-concrete',1,3}, {'black-refined-concrete',2,-3}, {'purple-refined-concrete',2,-2},
|
||||
{'purple-refined-concrete',2,-1}, {'purple-refined-concrete',2,0}, {'purple-refined-concrete',2,1}, {'black-refined-concrete',2,2},
|
||||
{'black-refined-concrete',3,-2}, {'black-refined-concrete',3,-1}, {'black-refined-concrete',3,0}, {'black-refined-concrete',3,1}
|
||||
}
|
||||
{ "black-refined-concrete", -4, -2 }, { "black-refined-concrete", -4, -1 }, { "black-refined-concrete", -4, 0 }, { "black-refined-concrete", -4, 1 },
|
||||
{ "black-refined-concrete", -3, -3 }, { "purple-refined-concrete", -3, -2 }, { "purple-refined-concrete", -3, -1 }, { "purple-refined-concrete", -3, 0 },
|
||||
{ "purple-refined-concrete", -3, 1 }, { "black-refined-concrete", -3, 2 }, { "black-refined-concrete", -2, -4 }, { "purple-refined-concrete", -2, -3 },
|
||||
{ "purple-refined-concrete", -2, -2 }, { "purple-refined-concrete", -2, -1 }, { "purple-refined-concrete", -2, 0 }, { "purple-refined-concrete", -2, 1 },
|
||||
{ "purple-refined-concrete", -2, 2 }, { "black-refined-concrete", -2, 3 }, { "black-refined-concrete", -1, -4 }, { "purple-refined-concrete", -1, -3 },
|
||||
{ "purple-refined-concrete", -1, -2 }, { "purple-refined-concrete", -1, -1 }, { "purple-refined-concrete", -1, 0 }, { "purple-refined-concrete", -1, 1 },
|
||||
{ "purple-refined-concrete", -1, 2 }, { "black-refined-concrete", -1, 3 }, { "black-refined-concrete", 0, -4 }, { "purple-refined-concrete", 0, -3 },
|
||||
{ "purple-refined-concrete", 0, -2 }, { "purple-refined-concrete", 0, -1 }, { "purple-refined-concrete", 0, 0 }, { "purple-refined-concrete", 0, 1 },
|
||||
{ "purple-refined-concrete", 0, 2 }, { "black-refined-concrete", 0, 3 }, { "black-refined-concrete", 1, -4 }, { "purple-refined-concrete", 1, -3 },
|
||||
{ "purple-refined-concrete", 1, -2 }, { "purple-refined-concrete", 1, -1 }, { "purple-refined-concrete", 1, 0 }, { "purple-refined-concrete", 1, 1 },
|
||||
{ "purple-refined-concrete", 1, 2 }, { "black-refined-concrete", 1, 3 }, { "black-refined-concrete", 2, -3 }, { "purple-refined-concrete", 2, -2 },
|
||||
{ "purple-refined-concrete", 2, -1 }, { "purple-refined-concrete", 2, 0 }, { "purple-refined-concrete", 2, 1 }, { "black-refined-concrete", 2, 2 },
|
||||
{ "black-refined-concrete", 3, -2 }, { "black-refined-concrete", 3, -1 }, { "black-refined-concrete", 3, 0 }, { "black-refined-concrete", 3, 1 },
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
return {
|
||||
Cooldude2606 = 'Lua lets you set metatables on numbers, did you know that? Cooldude2606 knows this.',
|
||||
samy115 = 'Tremble in fear as the banhammer is now here, its owner: samy115',
|
||||
Cooldude2606 = "Lua lets you set metatables on numbers, did you know that? Cooldude2606 knows this.",
|
||||
samy115 = "Tremble in fear as the banhammer is now here, its owner: samy115",
|
||||
XenoCyber = '"Fire Fire Fire" oops wrong game, have no fear XenoCyber is here',
|
||||
HunterOfGames = 'Unable to support HunterOfGames. You must construct additional miners.',
|
||||
HunterOfGames = "Unable to support HunterOfGames. You must construct additional miners.",
|
||||
ookl = 'ookl says: "Pineapples are amazing, hello everyone!"',
|
||||
arty714 = 'Arty\'s Potato made it!'
|
||||
arty714 = "Arty\'s Potato made it!",
|
||||
}
|
||||
@@ -2,5 +2,5 @@
|
||||
-- @config lawnmower
|
||||
|
||||
return {
|
||||
destroy_decoratives = false
|
||||
destroy_decoratives = false,
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
-- @config logging
|
||||
|
||||
return {
|
||||
file_name = 'log/logging.log',
|
||||
file_name = "log/logging.log",
|
||||
rocket_launch_display = {
|
||||
[1] = true,
|
||||
[2] = true,
|
||||
@@ -11,20 +11,33 @@ return {
|
||||
[20] = true,
|
||||
[50] = true,
|
||||
[100] = true,
|
||||
[200] = true
|
||||
[200] = true,
|
||||
[500] = true,
|
||||
[1000] = true,
|
||||
[2000] = true,
|
||||
[5000] = true,
|
||||
[10000] = true,
|
||||
[20000] = true,
|
||||
[50000] = true,
|
||||
[100000] = true,
|
||||
[200000] = true,
|
||||
[500000] = true,
|
||||
[1000000] = true,
|
||||
[2000000] = true,
|
||||
[5000000] = true,
|
||||
[10000000] = true,
|
||||
},
|
||||
rocket_launch_display_rate = 500,
|
||||
disconnect_reason = {
|
||||
[defines.disconnect_reason.quit] = ' left the game',
|
||||
[defines.disconnect_reason.dropped] = ' was dropped from the game',
|
||||
[defines.disconnect_reason.reconnect] = ' is reconnecting',
|
||||
[defines.disconnect_reason.wrong_input] = ' was having a wrong input',
|
||||
[defines.disconnect_reason.desync_limit_reached] = ' had desync limit reached',
|
||||
[defines.disconnect_reason.cannot_keep_up] = ' cannot keep up',
|
||||
[defines.disconnect_reason.afk] = ' was afk',
|
||||
[defines.disconnect_reason.kicked] = ' was kicked',
|
||||
[defines.disconnect_reason.kicked_and_deleted] = ' was kicked and deleted',
|
||||
[defines.disconnect_reason.banned] = ' was banned',
|
||||
[defines.disconnect_reason.switching_servers] = ' is switching servers'
|
||||
}
|
||||
[defines.disconnect_reason.quit] = " left the game",
|
||||
[defines.disconnect_reason.dropped] = " was dropped from the game",
|
||||
[defines.disconnect_reason.reconnect] = " is reconnecting",
|
||||
[defines.disconnect_reason.wrong_input] = " was having a wrong input",
|
||||
[defines.disconnect_reason.desync_limit_reached] = " had desync limit reached",
|
||||
[defines.disconnect_reason.cannot_keep_up] = " cannot keep up",
|
||||
[defines.disconnect_reason.afk] = " was afk",
|
||||
[defines.disconnect_reason.kicked] = " was kicked",
|
||||
[defines.disconnect_reason.kicked_and_deleted] = " was kicked and deleted",
|
||||
[defines.disconnect_reason.banned] = " was banned",
|
||||
[defines.disconnect_reason.switching_servers] = " is switching servers",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
|
||||
return {
|
||||
fluid = true, --- @setting fluid When true, checks for for fluid pipes when removing miners
|
||||
chest = true --- @setting chest When true, checks for for chest when removing miners
|
||||
chest = true, --- @setting chest When true, checks for for chest when removing miners
|
||||
}
|
||||
|
||||
@@ -5,94 +5,94 @@ return {
|
||||
copy_paste_module = true,
|
||||
copy_paste_rotation = false,
|
||||
machine = {
|
||||
['electric-mining-drill'] = {
|
||||
['module'] = 'effectivity-module',
|
||||
['prod'] = true
|
||||
["electric-mining-drill"] = {
|
||||
["module"] = "effectivity-module",
|
||||
["prod"] = true,
|
||||
},
|
||||
['pumpjack'] = {
|
||||
['module'] = 'effectivity-module',
|
||||
['prod'] = true
|
||||
["pumpjack"] = {
|
||||
["module"] = "effectivity-module",
|
||||
["prod"] = true,
|
||||
},
|
||||
['assembling-machine-2'] = {
|
||||
['module'] = 'productivity-module',
|
||||
['prod'] = true
|
||||
["assembling-machine-2"] = {
|
||||
["module"] = "productivity-module",
|
||||
["prod"] = true,
|
||||
},
|
||||
['assembling-machine-3'] = {
|
||||
['module'] = 'productivity-module-3',
|
||||
['prod'] = true
|
||||
["assembling-machine-3"] = {
|
||||
["module"] = "productivity-module-3",
|
||||
["prod"] = true,
|
||||
},
|
||||
['electric-furnace'] = {
|
||||
['module'] = 'productivity-module-3',
|
||||
['prod'] = true
|
||||
["electric-furnace"] = {
|
||||
["module"] = "productivity-module-3",
|
||||
["prod"] = true,
|
||||
},
|
||||
['beacon'] = {
|
||||
['module'] = 'speed-module-3',
|
||||
['prod'] = false
|
||||
["beacon"] = {
|
||||
["module"] = "speed-module-3",
|
||||
["prod"] = false,
|
||||
},
|
||||
['oil-refinery'] = {
|
||||
['module'] = 'productivity-module-3',
|
||||
['prod'] = true
|
||||
["oil-refinery"] = {
|
||||
["module"] = "productivity-module-3",
|
||||
["prod"] = true,
|
||||
},
|
||||
['chemical-plant'] = {
|
||||
['module'] = 'productivity-module-3',
|
||||
['prod'] = true
|
||||
["chemical-plant"] = {
|
||||
["module"] = "productivity-module-3",
|
||||
["prod"] = true,
|
||||
},
|
||||
['centrifuge'] = {
|
||||
['module'] = 'productivity-module-3',
|
||||
['prod'] = true
|
||||
["centrifuge"] = {
|
||||
["module"] = "productivity-module-3",
|
||||
["prod"] = true,
|
||||
},
|
||||
['lab'] = {
|
||||
['module'] = 'productivity-module-3',
|
||||
['prod'] = true
|
||||
["lab"] = {
|
||||
["module"] = "productivity-module-3",
|
||||
["prod"] = true,
|
||||
},
|
||||
["rocket-silo"] = {
|
||||
["module"] = "productivity-module-3",
|
||||
["prod"] = true,
|
||||
},
|
||||
['rocket-silo'] = {
|
||||
['module'] = 'productivity-module-3',
|
||||
['prod'] = true
|
||||
}
|
||||
},
|
||||
module_allowed = {
|
||||
['advanced-circuit'] = true,
|
||||
['automation-science-pack'] = true,
|
||||
['battery'] = true,
|
||||
['chemical-science-pack'] = true,
|
||||
['copper-cable'] = true,
|
||||
['copper-plate'] = true,
|
||||
['electric-engine-unit'] = true,
|
||||
['electronic-circuit'] = true,
|
||||
['empty-barrel'] = true,
|
||||
['engine-unit'] = true,
|
||||
['explosives'] = true,
|
||||
['flying-robot-frame'] = true,
|
||||
['iron-gear-wheel'] = true,
|
||||
['iron-plate'] = true,
|
||||
['iron-stick'] = true,
|
||||
['logistic-science-pack'] = true,
|
||||
['low-density-structure'] = true,
|
||||
['lubricant'] = true,
|
||||
['military-science-pack'] = true,
|
||||
['nuclear-fuel'] = true,
|
||||
['plastic-bar'] = true,
|
||||
['processing-unit'] = true,
|
||||
['production-science-pack'] = true,
|
||||
['rocket-control-unit'] = true,
|
||||
['rocket-fuel'] = true,
|
||||
['rocket-part'] = true,
|
||||
['steel-plate'] = true,
|
||||
['stone-brick'] = true,
|
||||
['sulfur'] = true,
|
||||
['sulfuric-acid'] = true,
|
||||
['uranium-fuel-cell'] = true,
|
||||
['utility-science-pack'] = true,
|
||||
['basic-oil-processing'] = true,
|
||||
['advanced-oil-processing'] = true,
|
||||
['coal-liquefaction'] = true,
|
||||
['heavy-oil-cracking'] = true,
|
||||
['light-oil-cracking'] = true,
|
||||
['solid-fuel-from-light-oil'] = true,
|
||||
['solid-fuel-from-petroleum-gas'] = true,
|
||||
['solid-fuel-from-heavy-oil'] = true,
|
||||
['uranium-processing'] = true,
|
||||
['nuclear-fuel-reprocessing'] = true,
|
||||
['kovarex-enrichment-process'] = true
|
||||
}
|
||||
["advanced-circuit"] = true,
|
||||
["automation-science-pack"] = true,
|
||||
["battery"] = true,
|
||||
["chemical-science-pack"] = true,
|
||||
["copper-cable"] = true,
|
||||
["copper-plate"] = true,
|
||||
["electric-engine-unit"] = true,
|
||||
["electronic-circuit"] = true,
|
||||
["empty-barrel"] = true,
|
||||
["engine-unit"] = true,
|
||||
["explosives"] = true,
|
||||
["flying-robot-frame"] = true,
|
||||
["iron-gear-wheel"] = true,
|
||||
["iron-plate"] = true,
|
||||
["iron-stick"] = true,
|
||||
["logistic-science-pack"] = true,
|
||||
["low-density-structure"] = true,
|
||||
["lubricant"] = true,
|
||||
["military-science-pack"] = true,
|
||||
["nuclear-fuel"] = true,
|
||||
["plastic-bar"] = true,
|
||||
["processing-unit"] = true,
|
||||
["production-science-pack"] = true,
|
||||
["rocket-control-unit"] = true,
|
||||
["rocket-fuel"] = true,
|
||||
["rocket-part"] = true,
|
||||
["steel-plate"] = true,
|
||||
["stone-brick"] = true,
|
||||
["sulfur"] = true,
|
||||
["sulfuric-acid"] = true,
|
||||
["uranium-fuel-cell"] = true,
|
||||
["utility-science-pack"] = true,
|
||||
["basic-oil-processing"] = true,
|
||||
["advanced-oil-processing"] = true,
|
||||
["coal-liquefaction"] = true,
|
||||
["heavy-oil-cracking"] = true,
|
||||
["light-oil-cracking"] = true,
|
||||
["solid-fuel-from-light-oil"] = true,
|
||||
["solid-fuel-from-petroleum-gas"] = true,
|
||||
["solid-fuel-from-heavy-oil"] = true,
|
||||
["uranium-processing"] = true,
|
||||
["nuclear-fuel-reprocessing"] = true,
|
||||
["kovarex-enrichment-process"] = true,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ return {
|
||||
inventory = defines.inventory.character_ammo,
|
||||
event = defines.events.on_player_ammo_inventory_changed,
|
||||
items = {
|
||||
["atomic-bomb"] = true
|
||||
["atomic-bomb"] = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -21,7 +21,7 @@ return {
|
||||
inventory = defines.inventory.character_main,
|
||||
event = defines.events.on_player_main_inventory_changed,
|
||||
items = {
|
||||
["atomic-bomb"] = true
|
||||
["atomic-bomb"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -29,6 +29,6 @@ return {
|
||||
ignore_admins = true, -- @setting ignore_admins Ignore admins, true by default. Allows usage outside of the roles module
|
||||
disable_nuke_research = false, -- @setting disable_nuke_research Disable the nuke research, true by default
|
||||
disable_nuke_research_names = {
|
||||
["atomic-bomb"] = true
|
||||
} -- @setting disable_nuke_research_names The names of the researches to disabled
|
||||
["atomic-bomb"] = true,
|
||||
}, -- @setting disable_nuke_research_names The names of the researches to disabled
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,5 +5,5 @@ return {
|
||||
reference_point = { x = 0, y = 0 }, --- @setting reference_point where pollution is read from
|
||||
max_scalar = 0.5, --- @setting max_scalar the scale between true max and max
|
||||
min_scalar = 0.17, --- @setting min_scalar the scale between the lowest max and min
|
||||
update_delay = 15 --- @setting update_delay time in minutes between view updates
|
||||
update_delay = 15, --- @setting update_delay time in minutes between view updates
|
||||
}
|
||||
@@ -6,5 +6,5 @@ return {
|
||||
show_player_mentions = true, --- @setting show_player_mentions weather a mentioned player will have a popup when mentioned in chat
|
||||
show_player_damage = true, --- @setting show_player_damage weather to show damage done by players
|
||||
show_player_health = true, --- @setting show_player_health weather to show player health when attacked
|
||||
damage_location_variance=0.8 --- @setting damage_location_variance how close to the eade of an entity the popups will appear
|
||||
damage_location_variance = 0.8, --- @setting damage_location_variance how close to the eade of an entity the popups will appear
|
||||
}
|
||||
@@ -20,7 +20,7 @@ return {
|
||||
ArPiiX = { r = 0, g = 255, b = 0 },
|
||||
NextIdea = { r = 255, g = 255, b = 255 },
|
||||
hamsterbryan = { r = 0, g = 255, b = 0 },
|
||||
XenoCyber={r=0,g=128,b=255}
|
||||
XenoCyber = { r = 0, g = 128, b = 255 },
|
||||
},
|
||||
disallow = { --- @setting disallow colours which will not given to players; the value does not matter it is only the key which is checked
|
||||
black = { r = 0, g = 0, b = 0 },
|
||||
@@ -28,6 +28,6 @@ return {
|
||||
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}
|
||||
}
|
||||
info = { r = 255, g = 255, b = 255 },
|
||||
},
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
-- @config Preset-Player-Quickbar
|
||||
|
||||
return {
|
||||
dangerarea = {"transport-belt", "underground-belt", "splitter", "pipe", "pipe-to-ground", "inserter", "fast-inserter", "long-handed-inserter", "stack-inserter", "roboport", "small-electric-pole", "medium-electric-pole", "big-electric-pole", "substation", nil, "rail", "rail-signal", "rail-chain-signal", "landfill", "cliff-explosives", "fast-transport-belt", "fast-underground-belt", "fast-splitter", "pipe", "pipe-to-ground", "fast-inserter", "long-handed-inserter", "stack-inserter", "stack-filter-inserter", "roboport", [81] = "red-wire", [82] = "green-wire", [83] = "arithmetic-combinator", [84] = "decider-combinator", [85] = "constant-combinator", [86] = "power-switch", [91] = "logistic-chest-active-provider", [92] = "logistic-chest-passive-provider", [93] = "logistic-chest-storage", [94] = "logistic-chest-buffer", [95] = "logistic-chest-requester", [96] = "roboport"}
|
||||
dangerarea = { "transport-belt", "underground-belt", "splitter", "pipe", "pipe-to-ground", "inserter", "fast-inserter", "long-handed-inserter", "stack-inserter", "roboport", "small-electric-pole", "medium-electric-pole", "big-electric-pole", "substation", nil, "rail", "rail-signal", "rail-chain-signal", "landfill", "cliff-explosives", "fast-transport-belt", "fast-underground-belt", "fast-splitter", "pipe", "pipe-to-ground", "fast-inserter", "long-handed-inserter", "stack-inserter", "stack-filter-inserter", "roboport", [81] = "red-wire", [82] = "green-wire", [83] = "arithmetic-combinator", [84] = "decider-combinator", [85] = "constant-combinator", [86] = "power-switch", [91] = "logistic-chest-active-provider", [92] = "logistic-chest-passive-provider", [93] = "logistic-chest-storage", [94] = "logistic-chest-buffer", [95] = "logistic-chest-requester", [96] = "roboport" },
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
return {
|
||||
ignore_admins = true, --- @setting ignore_admins If admins are ignored by the protection filter
|
||||
ignore_permission = 'bypass-entity-protection', --- @setting ignore_permission Players with this permission will be ignored by the protection filter, leave nil if expcore.roles is not used
|
||||
ignore_permission = "bypass-entity-protection", --- @setting ignore_permission Players with this permission will be ignored by the protection filter, leave nil if expcore.roles is not used
|
||||
repeat_count = 5, --- @setting repeat_count Number of protected entities that must be removed within repeat_lifetime in order to trigger repeated removal protection
|
||||
repeat_lifetime = 3600 * 20, --- @setting repeat_lifetime The length of time, in ticks, that protected removals will be remembered for
|
||||
refresh_rate = 3600 * 5, --- @setting refresh_rate How often the age of protected removals are checked against repeat_lifetime
|
||||
@@ -8,12 +8,12 @@ return {
|
||||
|
||||
},
|
||||
always_protected_types = { --- @setting always_protected_types Types of entities which are always protected
|
||||
'boiler', 'generator', 'offshore-pump', 'power-switch', 'reactor', 'rocket-silo'
|
||||
"boiler", "generator", "offshore-pump", "power-switch", "reactor", "rocket-silo",
|
||||
},
|
||||
always_trigger_repeat_names = { --- @setting always_trigger_repeat_names Names of entities which always trigger repeated removal protection
|
||||
|
||||
},
|
||||
always_trigger_repeat_types = { --- @setting always_trigger_repeat_types Types of entities which always trigger repeated removal protection
|
||||
'reactor', 'rocket-silo'
|
||||
}
|
||||
"reactor", "rocket-silo",
|
||||
},
|
||||
}
|
||||
@@ -3,14 +3,14 @@
|
||||
|
||||
return {
|
||||
disallow = { --- @setting disallow items in this list will never be repaired
|
||||
['loader']=true,
|
||||
['fast-loader']=true,
|
||||
['express-loader']=true,
|
||||
['electric-energy-interface']=true,
|
||||
['infinity-chest']=true
|
||||
["loader"] = true,
|
||||
["fast-loader"] = true,
|
||||
["express-loader"] = true,
|
||||
["electric-energy-interface"] = true,
|
||||
["infinity-chest"] = true,
|
||||
},
|
||||
max_range = 50, --- @setting max_range the max range that can be used with the repair command
|
||||
allow_blueprint_repair = false, --- @setting allow_blueprint_repair when true will allow blueprints (things not destroyed by biters) to be build instantly using the repair command
|
||||
allow_ghost_revive = true, --- @setting allow_ghost_revive when true will allow ghosts (things destroyed by biters) to be build instantly using the repair command
|
||||
allow_heal_entities=true --- @setting allow_heal_entities when true will heal entities to full health that are within range
|
||||
allow_heal_entities = true, --- @setting allow_heal_entities when true will heal entities to full health that are within range
|
||||
}
|
||||
@@ -8,74 +8,74 @@ return {
|
||||
-- this enable 20 more inventory for each mining productivity level up to 4
|
||||
bonus_inventory = {
|
||||
enabled = true,
|
||||
name = 'character_inventory_slots_bonus',
|
||||
name = "character_inventory_slots_bonus",
|
||||
rate = 5,
|
||||
limit = 20
|
||||
limit = 20,
|
||||
},
|
||||
file_name = 'log/research.log',
|
||||
file_name = "log/research.log",
|
||||
milestone = {
|
||||
['automation'] = 600,
|
||||
['logistics'] = 300,
|
||||
['steel-processing'] = 300,
|
||||
['logistic-science-pack'] = 300,
|
||||
['electronics'] = 300,
|
||||
['fast-inserter'] = 300,
|
||||
['steel-axe'] = 300,
|
||||
['automation-2'] = 300,
|
||||
['advanced-material-processing'] = 300,
|
||||
['engine'] = 300,
|
||||
['fluid-handling'] = 300,
|
||||
['oil-processing'] = 300,
|
||||
['sulfur-processing'] = 300,
|
||||
['plastics'] = 300,
|
||||
['advanced-electronics'] = 300,
|
||||
['chemical-science-pack'] = 300,
|
||||
['modules'] = 300,
|
||||
['logistics-2'] = 300,
|
||||
['railway'] = 300,
|
||||
['research-speed-1'] = 300,
|
||||
['research-speed-2'] = 300,
|
||||
['battery'] = 300,
|
||||
['concrete'] = 300,
|
||||
['flammables'] = 300,
|
||||
['low-density-structure'] = 300,
|
||||
['advanced-material-processing-2'] = 300,
|
||||
['productivity-module'] = 300,
|
||||
['production-science-pack'] = 300,
|
||||
['advanced-electronics-2'] = 300,
|
||||
['advanced-oil-processing'] = 300,
|
||||
['electric-engine'] = 300,
|
||||
['robotics'] = 300,
|
||||
['construction-robotics'] = 300,
|
||||
['worker-robots-speed-1'] = 300,
|
||||
['worker-robots-speed-2'] = 300,
|
||||
['utility-science-pack'] = 300,
|
||||
['productivity-module-2'] = 300,
|
||||
['speed-module-2'] = 300,
|
||||
['rocket-fuel'] = 300,
|
||||
['effect-transmission'] = 300,
|
||||
['productivity-module-3'] = 300,
|
||||
['rocket-control-unit'] = 300,
|
||||
['speed-module-3'] = 300,
|
||||
['rocket-silo'] = 300,
|
||||
['space-science-pack'] = 300,
|
||||
["automation"] = 600,
|
||||
["logistics"] = 300,
|
||||
["steel-processing"] = 300,
|
||||
["logistic-science-pack"] = 300,
|
||||
["electronics"] = 300,
|
||||
["fast-inserter"] = 300,
|
||||
["steel-axe"] = 300,
|
||||
["automation-2"] = 300,
|
||||
["advanced-material-processing"] = 300,
|
||||
["engine"] = 300,
|
||||
["fluid-handling"] = 300,
|
||||
["oil-processing"] = 300,
|
||||
["sulfur-processing"] = 300,
|
||||
["plastics"] = 300,
|
||||
["advanced-electronics"] = 300,
|
||||
["chemical-science-pack"] = 300,
|
||||
["modules"] = 300,
|
||||
["logistics-2"] = 300,
|
||||
["railway"] = 300,
|
||||
["research-speed-1"] = 300,
|
||||
["research-speed-2"] = 300,
|
||||
["battery"] = 300,
|
||||
["concrete"] = 300,
|
||||
["flammables"] = 300,
|
||||
["low-density-structure"] = 300,
|
||||
["advanced-material-processing-2"] = 300,
|
||||
["productivity-module"] = 300,
|
||||
["production-science-pack"] = 300,
|
||||
["advanced-electronics-2"] = 300,
|
||||
["advanced-oil-processing"] = 300,
|
||||
["electric-engine"] = 300,
|
||||
["robotics"] = 300,
|
||||
["construction-robotics"] = 300,
|
||||
["worker-robots-speed-1"] = 300,
|
||||
["worker-robots-speed-2"] = 300,
|
||||
["utility-science-pack"] = 300,
|
||||
["productivity-module-2"] = 300,
|
||||
["speed-module-2"] = 300,
|
||||
["rocket-fuel"] = 300,
|
||||
["effect-transmission"] = 300,
|
||||
["productivity-module-3"] = 300,
|
||||
["rocket-control-unit"] = 300,
|
||||
["speed-module-3"] = 300,
|
||||
["rocket-silo"] = 300,
|
||||
["space-science-pack"] = 300,
|
||||
},
|
||||
inf_res = {
|
||||
-- Mining Productivity
|
||||
['mining-productivity-4'] = 4,
|
||||
["mining-productivity-4"] = 4,
|
||||
-- Robot Speed
|
||||
['worker-robots-speed-6'] = 6,
|
||||
["worker-robots-speed-6"] = 6,
|
||||
-- Laser Damage
|
||||
['energy-weapons-damage-7'] = 7,
|
||||
["energy-weapons-damage-7"] = 7,
|
||||
-- Explosive Damage
|
||||
['stronger-explosives-7'] = 7,
|
||||
["stronger-explosives-7"] = 7,
|
||||
-- Bullet Damage
|
||||
['physical-projectile-damage-7'] = 7,
|
||||
["physical-projectile-damage-7"] = 7,
|
||||
-- Flame Damage
|
||||
['refined-flammables-7'] = 7,
|
||||
["refined-flammables-7"] = 7,
|
||||
-- Artillery Range
|
||||
['artillery-shell-range-1'] = 1,
|
||||
["artillery-shell-range-1"] = 1,
|
||||
-- Artillery Speed
|
||||
['artillery-shell-speed-1'] = 1
|
||||
}
|
||||
["artillery-shell-speed-1"] = 1,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -45,36 +45,36 @@ return {
|
||||
-- ["water-mud"]=0, -- last tile, nothing to degrade to
|
||||
},
|
||||
degrade_order = { --- @setting degrade_order when a tile degrades it will turn into the next tile given here
|
||||
["refined-concrete"]='concrete',
|
||||
["refined-hazard-concrete-left"]='hazard-concrete-left',
|
||||
["refined-hazard-concrete-right"]='hazard-concrete-right',
|
||||
["concrete"]='stone-path',
|
||||
["hazard-concrete-left"]='stone-path',
|
||||
["hazard-concrete-right"]='stone-path',
|
||||
["stone-path"]='dry-dirt',
|
||||
["red-desert-0"]='dry-dirt',
|
||||
["dry-dirt"]='dirt-4',
|
||||
["refined-concrete"] = "concrete",
|
||||
["refined-hazard-concrete-left"] = "hazard-concrete-left",
|
||||
["refined-hazard-concrete-right"] = "hazard-concrete-right",
|
||||
["concrete"] = "stone-path",
|
||||
["hazard-concrete-left"] = "stone-path",
|
||||
["hazard-concrete-right"] = "stone-path",
|
||||
["stone-path"] = "dry-dirt",
|
||||
["red-desert-0"] = "dry-dirt",
|
||||
["dry-dirt"] = "dirt-4",
|
||||
-- grass four (main grass tiles)
|
||||
["grass-1"]='grass-2',
|
||||
["grass-2"]='grass-3',
|
||||
["grass-3"]='grass-4',
|
||||
["grass-4"]='dirt-4',
|
||||
["grass-1"] = "grass-2",
|
||||
["grass-2"] = "grass-3",
|
||||
["grass-3"] = "grass-4",
|
||||
["grass-4"] = "dirt-4",
|
||||
-- red three (main red tiles)
|
||||
["red-desert-1"]='red-desert-2',
|
||||
["red-desert-2"]='red-desert-3',
|
||||
["red-desert-3"]='dirt-4',
|
||||
["red-desert-1"] = "red-desert-2",
|
||||
["red-desert-2"] = "red-desert-3",
|
||||
["red-desert-3"] = "dirt-4",
|
||||
-- sand three (main sand tiles)
|
||||
["sand-1"]='sand-2',
|
||||
["sand-2"]='sand-3',
|
||||
["sand-3"]='dirt-4',
|
||||
["sand-1"] = "sand-2",
|
||||
["sand-2"] = "sand-3",
|
||||
["sand-3"] = "dirt-4",
|
||||
-- dirt 3 (main dirt tiles)
|
||||
["dirt-1"]='dirt-2',
|
||||
["dirt-2"]='dirt-3',
|
||||
["dirt-3"]='dirt-4',
|
||||
["dirt-1"] = "dirt-2",
|
||||
["dirt-2"] = "dirt-3",
|
||||
["dirt-3"] = "dirt-4",
|
||||
-- last three/four (all sets of three merge here)
|
||||
["dirt-4"]='dirt-5',
|
||||
["dirt-5"]='dirt-6',
|
||||
["dirt-6"]='dirt-7',
|
||||
["dirt-4"] = "dirt-5",
|
||||
["dirt-5"] = "dirt-6",
|
||||
["dirt-6"] = "dirt-7",
|
||||
-- ["dirt-7"]=0, -- last tile, nothing to degrade to
|
||||
-- land fill chain
|
||||
-- ["landfill"]='grass-2', -- 'water-shallow'
|
||||
@@ -82,35 +82,35 @@ return {
|
||||
-- ["water-mud"]=0, -- last tile, nothing to degrade to
|
||||
},
|
||||
entities = { --- @setting entities entities in this list will degrade the tiles under them when they are placed
|
||||
['stone-furnace']=true,
|
||||
['steel-furnace']=true,
|
||||
['electric-furnace']=true,
|
||||
['assembling-machine-1']=true,
|
||||
['assembling-machine-2']=true,
|
||||
['assembling-machine-3']=true,
|
||||
['beacon']=true,
|
||||
['centrifuge']=true,
|
||||
['chemical-plant']=true,
|
||||
['oil-refinery']=true,
|
||||
['storage-tank']=true,
|
||||
['nuclear-reactor']=true,
|
||||
['steam-engine']=true,
|
||||
['steam-turbine']=true,
|
||||
['boiler']=true,
|
||||
['heat-exchanger']=true,
|
||||
['stone-wall']=true,
|
||||
['gate']=true,
|
||||
['gun-turret']=true,
|
||||
['laser-turret']=true,
|
||||
['flamethrower-turret']=true,
|
||||
['radar']=true,
|
||||
['lab']=true,
|
||||
['big-electric-pole']=true,
|
||||
['substation']=true,
|
||||
['rocket-silo']=true,
|
||||
['pumpjack']=true,
|
||||
['electric-mining-drill']=true,
|
||||
['roboport']=true,
|
||||
['accumulator']=true
|
||||
}
|
||||
["stone-furnace"] = true,
|
||||
["steel-furnace"] = true,
|
||||
["electric-furnace"] = true,
|
||||
["assembling-machine-1"] = true,
|
||||
["assembling-machine-2"] = true,
|
||||
["assembling-machine-3"] = true,
|
||||
["beacon"] = true,
|
||||
["centrifuge"] = true,
|
||||
["chemical-plant"] = true,
|
||||
["oil-refinery"] = true,
|
||||
["storage-tank"] = true,
|
||||
["nuclear-reactor"] = true,
|
||||
["steam-engine"] = true,
|
||||
["steam-turbine"] = true,
|
||||
["boiler"] = true,
|
||||
["heat-exchanger"] = true,
|
||||
["stone-wall"] = true,
|
||||
["gate"] = true,
|
||||
["gun-turret"] = true,
|
||||
["laser-turret"] = true,
|
||||
["flamethrower-turret"] = true,
|
||||
["radar"] = true,
|
||||
["lab"] = true,
|
||||
["big-electric-pole"] = true,
|
||||
["substation"] = true,
|
||||
["rocket-silo"] = true,
|
||||
["pumpjack"] = true,
|
||||
["electric-mining-drill"] = true,
|
||||
["roboport"] = true,
|
||||
["accumulator"] = true,
|
||||
},
|
||||
}
|
||||
@@ -6,34 +6,34 @@ return {
|
||||
-- Enable predefined patches: 128, else: 32
|
||||
deconstruction_radius = 20, -- @setting deconstruction_radius All entities within this radius will be removed
|
||||
tile_radius = 20,
|
||||
deconstruction_tile = 'concrete', --- @setting deconstruction_tile Tile to be placed in the deconstruction radius, use nil for map gen
|
||||
deconstruction_tile = "concrete", --- @setting deconstruction_tile Tile to be placed in the deconstruction radius, use nil for map gen
|
||||
landfill_radius = 50, --- @setting pattern_radius All water within this radius will be land filled
|
||||
},
|
||||
turrets = { --- @setting turrets Settings relating to adding turrets to spawn
|
||||
enabled = true, --- @setting enabled Whether turrets will be added to spawn
|
||||
ammo_type = 'uranium-rounds-magazine', --- @setting ammo_type The ammo type that will be used during refills
|
||||
ammo_type = "uranium-rounds-magazine", --- @setting ammo_type The ammo type that will be used during refills
|
||||
refill_time = 60 * 60 * 5, --- @setting refill_time The time in ticks between each refill of the turrets, only change if having lag issues
|
||||
offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to turrets
|
||||
locations = { --- @setting locations The locations of all turrets, this list can change during runtime
|
||||
{ surface = 1, position = { x = -3, y = -3 } },
|
||||
{ surface = 1, position = { x = 3, y = -3 } },
|
||||
{ surface = 1, position = { x = -3, y = 3 } },
|
||||
{surface=1,position={x=3,y=3}}
|
||||
}
|
||||
{ surface = 1, position = { x = 3, y = 3 } },
|
||||
},
|
||||
},
|
||||
afk_belts = { --- @setting afk_belts Settings relating to adding afk belts to spawn
|
||||
enabled = true, --- @setting enabled Whether afk belts will be added to spawn
|
||||
belt_type = 'transport-belt', --- @setting belt_type The belt to be used as afk belts
|
||||
belt_type = "transport-belt", --- @setting belt_type The belt to be used as afk belts
|
||||
protected = true, --- @setting protected Whether belts will be protected from player interaction
|
||||
offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to afk belts
|
||||
locations = { --- @setting locations The locations to spawn afk belts at, given as the top left position
|
||||
{ -5, -5 }, { 5, -5 },
|
||||
{-5,5}, {5,5}
|
||||
}
|
||||
{ -5, 5 }, { 5, 5 },
|
||||
},
|
||||
},
|
||||
water = { --- @setting water Settings relating to adding water to spawn
|
||||
enabled = true, --- @setting enabled Whether water tiles will be added to spawn
|
||||
water_tile = 'water-mud', --- @setting water_tile The tile to be used as the water tile
|
||||
water_tile = "water-mud", --- @setting water_tile The tile to be used as the water tile
|
||||
offset = { x = 0, y = 0 }, --- @setting offset The position offset to apply to water tiles
|
||||
locations = { --- @setting locations The location of the water tiles {x,y}
|
||||
-- Each is a 3x3 with the closest tile to 0,0 removed
|
||||
@@ -41,7 +41,7 @@ return {
|
||||
{ 7, -9 }, { 7, -10 }, { 8, -8 }, { 8, -9 }, { 8, -10 }, { 9, -8 }, { 9, -9 }, { 9, -10 }, -- Top Right
|
||||
{ -8, -9 }, { -8, -10 }, { -9, -8 }, { -9, -9 }, { -9, -10 }, { -10, -8 }, { -10, -9 }, { -10, -10 }, -- Top Left
|
||||
{ -8, 8 }, { -8, 9 }, { -9, 7 }, { -9, 8 }, { -9, 9 }, { -10, 7 }, { -10, 8 }, { -10, 9 }, -- Bottom Left
|
||||
}
|
||||
},
|
||||
},
|
||||
entities = { --- @setting entities Settings relating to adding entities to spawn
|
||||
enabled = true, --- @setting enabled Whether entities will be added to spawn
|
||||
@@ -49,25 +49,25 @@ return {
|
||||
operable = true, --- @setting operable Whether entities can be opened by players, must be true if chests are used
|
||||
offset = { x = 0, y = -2 }, --- @setting offset The position offset to apply to entities
|
||||
locations = { --- @setting locations The location and names of entities {name,x,y}
|
||||
{'stone-wall',-10,-5},{'stone-wall',-10,-4},{'stone-wall',-10,-3},{'stone-wall',-10,-2},{'stone-wall',-10,-1},{'stone-wall',-10,0},{'stone-wall',-10,3},{'stone-wall',-10,4},{'stone-wall',-10,5},
|
||||
{'stone-wall',-10,6},{'stone-wall',-10,7},{'stone-wall',-10,8},{'small-lamp',-8,-4},{'small-lamp',-8,-1},{'iron-chest',-8,0},{'iron-chest',-8,3},{'small-lamp',-8,4},
|
||||
{'small-lamp',-8,7},{'stone-wall',-7,-8},{'small-electric-pole',-7,-2},{'iron-chest',-7,0},{'iron-chest',-7,3},{'small-electric-pole',-7,5},{'stone-wall',-7,11},{'stone-wall',-6,-8},{'small-lamp',-6,-6},
|
||||
{'iron-chest',-6,0},{'iron-chest',-6,3},{'small-lamp',-6,9},{'stone-wall',-6,11},{'stone-wall',-5,-8},{'small-lamp',-5,-1},{'iron-chest',-5,0},{'iron-chest',-5,3},{'small-lamp',-5,4},{'stone-wall',-5,11},
|
||||
{'stone-wall',-4,-8},{'small-electric-pole',-4,-5},{'iron-chest',-4,0},{'iron-chest',-4,3},{'small-electric-pole',-4,8},{'stone-wall',-4,11},{'stone-wall',-3,-8},{'small-lamp',-3,-6},{'small-lamp',-3,-3},{'small-lamp',-3,6},
|
||||
{'small-lamp',-3,9},{'stone-wall',-3,11},{'stone-wall',-2,-8},{'iron-chest',-2,-6},{'iron-chest',-2,-5},{'iron-chest',-2,-4},{'iron-chest',-2,-3},{'iron-chest',-2,-2},{'iron-chest',-2,5},{'iron-chest',-2,6},
|
||||
{'iron-chest',-2,7},{'iron-chest',-2,8},{'iron-chest',-2,9},{'stone-wall',-2,11},{'stone-wall',1,-8},{'iron-chest',1,-6},
|
||||
{'iron-chest',1,-5},{'iron-chest',1,-4},{'iron-chest',1,-3},{'iron-chest',1,-2},{'iron-chest',1,5},{'iron-chest',1,6},{'iron-chest',1,7},{'iron-chest',1,8},{'iron-chest',1,9},{'stone-wall',1,11},
|
||||
{'stone-wall',2,-8},{'small-lamp',2,-6},{'small-lamp',2,-3},{'small-lamp',2,6},{'small-lamp',2,9},{'stone-wall',2,11},{'stone-wall',3,-8},{'small-electric-pole',3,-5},{'iron-chest',3,0},{'iron-chest',3,3},
|
||||
{'small-electric-pole',3,8},{'stone-wall',3,11},{'stone-wall',4,-8},{'small-lamp',4,-1},{'iron-chest',4,0},{'iron-chest',4,3},{'small-lamp',4,4},{'stone-wall',4,11},{'stone-wall',5,-8},{'small-lamp',5,-6},
|
||||
{'iron-chest',5,0},{'iron-chest',5,3},{'small-lamp',5,9},{'stone-wall',5,11},{'stone-wall',6,-8},{'small-electric-pole',6,-2},{'iron-chest',6,0},{'iron-chest',6,3},{'small-electric-pole',6,5},{'stone-wall',6,11},
|
||||
{'small-lamp',7,-4},{'small-lamp',7,-1},{'iron-chest',7,0},{'iron-chest',7,3},{'small-lamp',7,4},{'small-lamp',7,7},{'stone-wall',9,-5},
|
||||
{'stone-wall',9,-4},{'stone-wall',9,-3},{'stone-wall',9,-2},{'stone-wall',9,-1},{'stone-wall',9,0},{'stone-wall',9,3},{'stone-wall',9,4},{'stone-wall',9,5},{'stone-wall',9,6},{'stone-wall',9,7},
|
||||
{'stone-wall',9,8}
|
||||
}
|
||||
{ "stone-wall", -10, -5 }, { "stone-wall", -10, -4 }, { "stone-wall", -10, -3 }, { "stone-wall", -10, -2 }, { "stone-wall", -10, -1 }, { "stone-wall", -10, 0 }, { "stone-wall", -10, 3 }, { "stone-wall", -10, 4 }, { "stone-wall", -10, 5 },
|
||||
{ "stone-wall", -10, 6 }, { "stone-wall", -10, 7 }, { "stone-wall", -10, 8 }, { "small-lamp", -8, -4 }, { "small-lamp", -8, -1 }, { "iron-chest", -8, 0 }, { "iron-chest", -8, 3 }, { "small-lamp", -8, 4 },
|
||||
{ "small-lamp", -8, 7 }, { "stone-wall", -7, -8 }, { "small-electric-pole", -7, -2 }, { "iron-chest", -7, 0 }, { "iron-chest", -7, 3 }, { "small-electric-pole", -7, 5 }, { "stone-wall", -7, 11 }, { "stone-wall", -6, -8 }, { "small-lamp", -6, -6 },
|
||||
{ "iron-chest", -6, 0 }, { "iron-chest", -6, 3 }, { "small-lamp", -6, 9 }, { "stone-wall", -6, 11 }, { "stone-wall", -5, -8 }, { "small-lamp", -5, -1 }, { "iron-chest", -5, 0 }, { "iron-chest", -5, 3 }, { "small-lamp", -5, 4 }, { "stone-wall", -5, 11 },
|
||||
{ "stone-wall", -4, -8 }, { "small-electric-pole", -4, -5 }, { "iron-chest", -4, 0 }, { "iron-chest", -4, 3 }, { "small-electric-pole", -4, 8 }, { "stone-wall", -4, 11 }, { "stone-wall", -3, -8 }, { "small-lamp", -3, -6 }, { "small-lamp", -3, -3 }, { "small-lamp", -3, 6 },
|
||||
{ "small-lamp", -3, 9 }, { "stone-wall", -3, 11 }, { "stone-wall", -2, -8 }, { "iron-chest", -2, -6 }, { "iron-chest", -2, -5 }, { "iron-chest", -2, -4 }, { "iron-chest", -2, -3 }, { "iron-chest", -2, -2 }, { "iron-chest", -2, 5 }, { "iron-chest", -2, 6 },
|
||||
{ "iron-chest", -2, 7 }, { "iron-chest", -2, 8 }, { "iron-chest", -2, 9 }, { "stone-wall", -2, 11 }, { "stone-wall", 1, -8 }, { "iron-chest", 1, -6 },
|
||||
{ "iron-chest", 1, -5 }, { "iron-chest", 1, -4 }, { "iron-chest", 1, -3 }, { "iron-chest", 1, -2 }, { "iron-chest", 1, 5 }, { "iron-chest", 1, 6 }, { "iron-chest", 1, 7 }, { "iron-chest", 1, 8 }, { "iron-chest", 1, 9 }, { "stone-wall", 1, 11 },
|
||||
{ "stone-wall", 2, -8 }, { "small-lamp", 2, -6 }, { "small-lamp", 2, -3 }, { "small-lamp", 2, 6 }, { "small-lamp", 2, 9 }, { "stone-wall", 2, 11 }, { "stone-wall", 3, -8 }, { "small-electric-pole", 3, -5 }, { "iron-chest", 3, 0 }, { "iron-chest", 3, 3 },
|
||||
{ "small-electric-pole", 3, 8 }, { "stone-wall", 3, 11 }, { "stone-wall", 4, -8 }, { "small-lamp", 4, -1 }, { "iron-chest", 4, 0 }, { "iron-chest", 4, 3 }, { "small-lamp", 4, 4 }, { "stone-wall", 4, 11 }, { "stone-wall", 5, -8 }, { "small-lamp", 5, -6 },
|
||||
{ "iron-chest", 5, 0 }, { "iron-chest", 5, 3 }, { "small-lamp", 5, 9 }, { "stone-wall", 5, 11 }, { "stone-wall", 6, -8 }, { "small-electric-pole", 6, -2 }, { "iron-chest", 6, 0 }, { "iron-chest", 6, 3 }, { "small-electric-pole", 6, 5 }, { "stone-wall", 6, 11 },
|
||||
{ "small-lamp", 7, -4 }, { "small-lamp", 7, -1 }, { "iron-chest", 7, 0 }, { "iron-chest", 7, 3 }, { "small-lamp", 7, 4 }, { "small-lamp", 7, 7 }, { "stone-wall", 9, -5 },
|
||||
{ "stone-wall", 9, -4 }, { "stone-wall", 9, -3 }, { "stone-wall", 9, -2 }, { "stone-wall", 9, -1 }, { "stone-wall", 9, 0 }, { "stone-wall", 9, 3 }, { "stone-wall", 9, 4 }, { "stone-wall", 9, 5 }, { "stone-wall", 9, 6 }, { "stone-wall", 9, 7 },
|
||||
{ "stone-wall", 9, 8 },
|
||||
},
|
||||
},
|
||||
pattern = {
|
||||
enabled = true, --- @setting enabled Whether pattern tiles will be added to spawn
|
||||
pattern_tile = 'stone-path', --- @setting pattern_tile The tile to be used for the pattern
|
||||
pattern_tile = "stone-path", --- @setting pattern_tile The tile to be used for the pattern
|
||||
offset = { x = 0, y = -2 }, --- @setting offset The position offset to apply to pattern tiles
|
||||
locations = { --- @setting locations The location of the pattern tiles {x,y}
|
||||
{ -49, -3 }, { -49, -2 }, { -49, 1 }, { -49, 2 }, { -49, 5 }, { -49, 6 }, { -48, -4 }, { -48, -3 }, { -48, -2 }, { -48, 1 }, { -48, 2 }, { -48, 5 }, { -48, 6 }, { -48, 7 }, { -47, -7 }, { -47, -6 }, { -47, -5 }, { -47, -4 }, { -47, -3 }, { -47, -2 }, { -47, 5 }, { -47, 6 }, { -47, 7 }, { -47, 8 }, { -47, 9 }, { -47, 10 }, { -46, -8 }, { -46, -7 }, { -46, -6 }, { -46, -5 },
|
||||
@@ -176,79 +176,79 @@ return {
|
||||
{ 41, 21 }, { 41, 22 }, { 42, -19 }, { 42, -18 }, { 42, -17 }, { 42, -1 }, { 42, 0 }, { 42, 1 }, { 42, 2 }, { 42, 3 }, { 42, 4 }, { 42, 20 }, { 42, 21 }, { 42, 22 }, { 43, -18 }, { 43, -17 }, { 43, -16 }, { 43, -15 }, { 43, -14 }, { 43, -13 }, { 43, -12 }, { 43, -9 }, { 43, -8 }, { 43, -1 }, { 43, 0 }, { 43, 1 }, { 43, 2 }, { 43, 3 }, { 43, 4 }, { 43, 11 },
|
||||
{ 43, 12 }, { 43, 15 }, { 43, 16 }, { 43, 17 }, { 43, 18 }, { 43, 19 }, { 43, 20 }, { 43, 21 }, { 44, -17 }, { 44, -16 }, { 44, -15 }, { 44, -14 }, { 44, -13 }, { 44, -12 }, { 44, -9 }, { 44, -8 }, { 44, -7 }, { 44, -2 }, { 44, -1 }, { 44, 0 }, { 44, 1 }, { 44, 2 }, { 44, 3 }, { 44, 4 }, { 44, 5 }, { 44, 10 }, { 44, 11 }, { 44, 12 }, { 44, 15 }, { 44, 16 },
|
||||
{ 44, 17 }, { 44, 18 }, { 44, 19 }, { 44, 20 }, { 45, -8 }, { 45, -7 }, { 45, -6 }, { 45, -5 }, { 45, -4 }, { 45, -3 }, { 45, -2 }, { 45, -1 }, { 45, 4 }, { 45, 5 }, { 45, 6 }, { 45, 7 }, { 45, 8 }, { 45, 9 }, { 45, 10 }, { 45, 11 }, { 46, -7 }, { 46, -6 }, { 46, -5 }, { 46, -4 }, { 46, -3 }, { 46, -2 }, { 46, 5 }, { 46, 6 }, { 46, 7 }, { 46, 8 },
|
||||
{46,9},{46,10},{47,-4},{47,-3},{47,-2},{47,1},{47,2},{47,5},{47,6},{47,7},{48,-3},{48,-2},{48,1},{48,2},{48,5},{48,6}
|
||||
}
|
||||
{ 46, 9 }, { 46, 10 }, { 47, -4 }, { 47, -3 }, { 47, -2 }, { 47, 1 }, { 47, 2 }, { 47, 5 }, { 47, 6 }, { 47, 7 }, { 48, -3 }, { 48, -2 }, { 48, 1 }, { 48, 2 }, { 48, 5 }, { 48, 6 },
|
||||
},
|
||||
},
|
||||
resource_tiles = {
|
||||
enabled = false,
|
||||
resources = {
|
||||
{
|
||||
enabled = false,
|
||||
name = 'iron-ore',
|
||||
name = "iron-ore",
|
||||
amount = 4000,
|
||||
size = { 26, 27 },
|
||||
-- offset = {-64,-32}
|
||||
offset = {-64,-64}
|
||||
offset = { -64, -64 },
|
||||
},
|
||||
{
|
||||
enabled = false,
|
||||
name = 'copper-ore',
|
||||
name = "copper-ore",
|
||||
amount = 4000,
|
||||
size = { 26, 27 },
|
||||
-- offset = {-64, 0}
|
||||
offset = {64, -64}
|
||||
offset = { 64, -64 },
|
||||
},
|
||||
{
|
||||
enabled = false,
|
||||
name = 'stone',
|
||||
name = "stone",
|
||||
amount = 4000,
|
||||
size = { 22, 20 },
|
||||
-- offset = {-64, 32}
|
||||
offset = {-64, 64}
|
||||
offset = { -64, 64 },
|
||||
},
|
||||
{
|
||||
enabled = false,
|
||||
name = 'coal',
|
||||
name = "coal",
|
||||
amount = 4000,
|
||||
size = { 22, 20 },
|
||||
-- offset = {-64, -64}
|
||||
offset = {64, 64}
|
||||
offset = { 64, 64 },
|
||||
},
|
||||
{
|
||||
enabled = false,
|
||||
name = 'uranium-ore',
|
||||
name = "uranium-ore",
|
||||
amount = 4000,
|
||||
size = { 22, 20 },
|
||||
-- offset = {-64, -96}
|
||||
offset = {0, 64}
|
||||
}
|
||||
}
|
||||
offset = { 0, 64 },
|
||||
},
|
||||
},
|
||||
},
|
||||
resource_patches = {
|
||||
enabled = false,
|
||||
resources = {
|
||||
{
|
||||
enabled = false,
|
||||
name = 'crude-oil',
|
||||
name = "crude-oil",
|
||||
num_patches = 4,
|
||||
amount = 4000000,
|
||||
-- offset = {-80, -12},
|
||||
offset = { -12, 64 },
|
||||
-- offset_next = {0, 6}
|
||||
offset_next = {6, 0}
|
||||
}
|
||||
}
|
||||
offset_next = { 6, 0 },
|
||||
},
|
||||
},
|
||||
},
|
||||
resource_refill_nearby = {
|
||||
enabled = false,
|
||||
range = 128,
|
||||
resources_name = {
|
||||
'iron-ore',
|
||||
'copper-ore',
|
||||
'stone',
|
||||
'coal',
|
||||
'uranium-ore'
|
||||
"iron-ore",
|
||||
"copper-ore",
|
||||
"stone",
|
||||
"coal",
|
||||
"uranium-ore",
|
||||
},
|
||||
amount = { 2500, 4000 },
|
||||
},
|
||||
amount = {2500, 4000}
|
||||
}
|
||||
}
|
||||
@@ -7,5 +7,5 @@ return {
|
||||
__x__
|
||||
__y__
|
||||
]]
|
||||
station_name = '[L] __icon__'
|
||||
station_name = "[L] __icon__",
|
||||
}
|
||||
@@ -27,20 +27,20 @@ return {
|
||||
JoinCount = e.on_player_joined_game,
|
||||
TilesRemoved = e.on_player_mined_tile,
|
||||
CapsulesUsed = e.on_player_used_capsule,
|
||||
EntityRepaired= e.on_player_repaired_entity
|
||||
EntityRepaired = e.on_player_repaired_entity,
|
||||
},
|
||||
display_order = { --- @setting display_order The order that the statistics should be shown in when in a gui or command
|
||||
'Playtime', 'AfkTime',
|
||||
'MapsPlayed', 'JoinCount',
|
||||
'ChatMessages', 'CommandsUsed',
|
||||
'RocketsLaunched', 'ResearchCompleted',
|
||||
'MachinesBuilt', 'MachinesRemoved',
|
||||
'TilesBuilt', 'TilesRemoved',
|
||||
'TreesDestroyed', 'OreMined',
|
||||
'ItemsCrafted', 'ItemsPickedUp',
|
||||
'Kills', 'Deaths',
|
||||
'DamageDealt', 'DistanceTravelled',
|
||||
'CapsulesUsed', 'EntityRepaired',
|
||||
'DeconstructionPlannerUsed', 'MapTagsMade'
|
||||
}
|
||||
"Playtime", "AfkTime",
|
||||
"MapsPlayed", "JoinCount",
|
||||
"ChatMessages", "CommandsUsed",
|
||||
"RocketsLaunched", "ResearchCompleted",
|
||||
"MachinesBuilt", "MachinesRemoved",
|
||||
"TilesBuilt", "TilesRemoved",
|
||||
"TreesDestroyed", "OreMined",
|
||||
"ItemsCrafted", "ItemsPickedUp",
|
||||
"Kills", "Deaths",
|
||||
"DamageDealt", "DistanceTravelled",
|
||||
"CapsulesUsed", "EntityRepaired",
|
||||
"DeconstructionPlannerUsed", "MapTagsMade",
|
||||
},
|
||||
}
|
||||
@@ -10,7 +10,7 @@ return {
|
||||
unlimited_surface_area = false, --- @setting unlimited_surface_area When true the vlayer has an unlimited surface area, landfill is not required
|
||||
modded_auto_downgrade = false, --- @setting modded_auto_downgrade When true modded items will be converted into their base game equivalent, original items can not be recovered
|
||||
|
||||
mimic_surface = 'nauvis', --- @setting mimic_surface Surface name/index the vlayer will copy its settings from, use nil to use the settings below
|
||||
mimic_surface = "nauvis", --- @setting mimic_surface Surface name/index the vlayer will copy its settings from, use nil to use the settings below
|
||||
surface = { --- @setting surface When mimic_surface is nil these settings will be used instead, see LuaSurface for details
|
||||
always_day = false,
|
||||
solar_power_multiplier = 1,
|
||||
@@ -20,14 +20,14 @@ return {
|
||||
dusk = 0.25,
|
||||
evening = 0.45,
|
||||
morning = 0.55,
|
||||
dawn = 0.75
|
||||
dawn = 0.75,
|
||||
},
|
||||
|
||||
interface_limit = { --- @setting interface_limit Sets the limit for the number of vlayer interfaces that can be created
|
||||
energy = 1, -- >1 allows for disconnected power networks to receive power
|
||||
circuit = 10, -- No caveats
|
||||
storage_input = 10, -- No caveats
|
||||
storage_output = 1 -- >0 allows for item teleportation (allowed_items only)
|
||||
storage_output = 1, -- >0 allows for item teleportation (allowed_items only)
|
||||
},
|
||||
|
||||
allowed_items = { --- @setting allowed_items List of all items allowed in vlayer storage and their properties
|
||||
@@ -40,36 +40,36 @@ return {
|
||||
capacity = 0: The energy capacity of the item in MJ, used for accumulators
|
||||
surface_area = 0: The surface area provided by the item, used for landfill
|
||||
]]
|
||||
['solar-panel'] = {
|
||||
["solar-panel"] = {
|
||||
starting_value = 0,
|
||||
required_area = 9,
|
||||
production = 0.06 -- MW
|
||||
production = 0.06, -- MW
|
||||
},
|
||||
['accumulator'] = {
|
||||
["accumulator"] = {
|
||||
starting_value = 0,
|
||||
required_area = 4,
|
||||
discharge = 0.3, -- MW
|
||||
capacity = 5 -- MJ
|
||||
capacity = 5, -- MJ
|
||||
},
|
||||
['landfill'] = {
|
||||
["landfill"] = {
|
||||
starting_value = 0,
|
||||
required_area = 0,
|
||||
surface_area = 6 -- Tiles
|
||||
surface_area = 6, -- Tiles
|
||||
},
|
||||
['wood'] = {
|
||||
["wood"] = {
|
||||
starting_value = 0,
|
||||
required_area = 0,
|
||||
surface_area = 0,
|
||||
fuel_value = 2, -- MJ
|
||||
power = true -- turn all wood to power to reduce trash
|
||||
power = true, -- turn all wood to power to reduce trash
|
||||
},
|
||||
['coal'] = {
|
||||
["coal"] = {
|
||||
starting_value = 0,
|
||||
required_area = 0,
|
||||
surface_area = 0,
|
||||
fuel_value = 4, -- MJ
|
||||
power = false -- turn all coal to power to reduce trash
|
||||
}
|
||||
power = false, -- turn all coal to power to reduce trash
|
||||
},
|
||||
--[[
|
||||
['iron-ore'] = {
|
||||
starting_value = 0,
|
||||
@@ -100,75 +100,75 @@ return {
|
||||
},
|
||||
|
||||
modded_items = { --- @setting modded_items List of all modded items allowed in vlayer storage and their base game equivalent
|
||||
['solar-panel-2'] = {
|
||||
["solar-panel-2"] = {
|
||||
starting_value = 0,
|
||||
base_game_equivalent = 'solar-panel',
|
||||
multiplier = 4
|
||||
base_game_equivalent = "solar-panel",
|
||||
multiplier = 4,
|
||||
},
|
||||
['solar-panel-3'] = {
|
||||
["solar-panel-3"] = {
|
||||
starting_value = 0,
|
||||
base_game_equivalent = 'solar-panel',
|
||||
multiplier = 16
|
||||
base_game_equivalent = "solar-panel",
|
||||
multiplier = 16,
|
||||
},
|
||||
['solar-panel-4'] = {
|
||||
["solar-panel-4"] = {
|
||||
starting_value = 0,
|
||||
base_game_equivalent = 'solar-panel',
|
||||
multiplier = 64
|
||||
base_game_equivalent = "solar-panel",
|
||||
multiplier = 64,
|
||||
},
|
||||
['solar-panel-5'] = {
|
||||
["solar-panel-5"] = {
|
||||
starting_value = 0,
|
||||
base_game_equivalent = 'solar-panel',
|
||||
multiplier = 256
|
||||
base_game_equivalent = "solar-panel",
|
||||
multiplier = 256,
|
||||
},
|
||||
['solar-panel-6'] = {
|
||||
["solar-panel-6"] = {
|
||||
starting_value = 0,
|
||||
base_game_equivalent = 'solar-panel',
|
||||
multiplier = 1024
|
||||
base_game_equivalent = "solar-panel",
|
||||
multiplier = 1024,
|
||||
},
|
||||
['solar-panel-7'] = {
|
||||
["solar-panel-7"] = {
|
||||
starting_value = 0,
|
||||
base_game_equivalent = 'solar-panel',
|
||||
multiplier = 4096
|
||||
base_game_equivalent = "solar-panel",
|
||||
multiplier = 4096,
|
||||
},
|
||||
['solar-panel-8'] = {
|
||||
["solar-panel-8"] = {
|
||||
starting_value = 0,
|
||||
base_game_equivalent = 'solar-panel',
|
||||
multiplier = 16384
|
||||
base_game_equivalent = "solar-panel",
|
||||
multiplier = 16384,
|
||||
},
|
||||
['accumulator-2'] = {
|
||||
["accumulator-2"] = {
|
||||
starting_value = 0,
|
||||
base_game_equivalent = 'accumulator',
|
||||
multiplier = 4
|
||||
base_game_equivalent = "accumulator",
|
||||
multiplier = 4,
|
||||
},
|
||||
['accumulator-3'] = {
|
||||
["accumulator-3"] = {
|
||||
starting_value = 0,
|
||||
base_game_equivalent = 'accumulator',
|
||||
multiplier = 16
|
||||
base_game_equivalent = "accumulator",
|
||||
multiplier = 16,
|
||||
},
|
||||
['accumulator-4'] = {
|
||||
["accumulator-4"] = {
|
||||
starting_value = 0,
|
||||
base_game_equivalent = 'accumulator',
|
||||
multiplier = 64
|
||||
base_game_equivalent = "accumulator",
|
||||
multiplier = 64,
|
||||
},
|
||||
['accumulator-5'] = {
|
||||
["accumulator-5"] = {
|
||||
starting_value = 0,
|
||||
base_game_equivalent = 'accumulator',
|
||||
multiplier = 256
|
||||
base_game_equivalent = "accumulator",
|
||||
multiplier = 256,
|
||||
},
|
||||
['accumulator-6'] = {
|
||||
["accumulator-6"] = {
|
||||
starting_value = 0,
|
||||
base_game_equivalent = 'accumulator',
|
||||
multiplier = 1024
|
||||
base_game_equivalent = "accumulator",
|
||||
multiplier = 1024,
|
||||
},
|
||||
['accumulator-7'] = {
|
||||
["accumulator-7"] = {
|
||||
starting_value = 0,
|
||||
base_game_equivalent = 'accumulator',
|
||||
multiplier = 4096
|
||||
base_game_equivalent = "accumulator",
|
||||
multiplier = 4096,
|
||||
},
|
||||
['accumulator-8'] = {
|
||||
["accumulator-8"] = {
|
||||
starting_value = 0,
|
||||
base_game_equivalent = 'accumulator',
|
||||
multiplier = 16384
|
||||
base_game_equivalent = "accumulator",
|
||||
multiplier = 16384,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
return {
|
||||
actions = { --- @setting actions what actions are taking at number of warnings
|
||||
-- if a localized string is used then __1__ will by_player_name and __2__ will be the current warning count (auto inserted)
|
||||
{'warnings.received',''},
|
||||
{'warnings.received',''},
|
||||
{'warnings.received',{'warnings.pre-kick'}},
|
||||
{ "warnings.received", "" },
|
||||
{ "warnings.received", "" },
|
||||
{ "warnings.received", { "warnings.pre-kick" } },
|
||||
function(player, by_player_name, number_of_warnings)
|
||||
game.kick_player(player,{'warnings.received',by_player_name,number_of_warnings,{'warnings.kick'}})
|
||||
game.kick_player(player, { "warnings.received", by_player_name, number_of_warnings, { "warnings.kick" } })
|
||||
end,
|
||||
{'warnings.received',{'warnings.pre-pre-ban'}},
|
||||
{'warnings.received',{'warnings.pre-ban'}},
|
||||
{ "warnings.received", { "warnings.pre-pre-ban" } },
|
||||
{ "warnings.received", { "warnings.pre-ban" } },
|
||||
function(player, by_player_name, number_of_warnings)
|
||||
game.ban_player(player,{'warnings.received',by_player_name,number_of_warnings,{'warnings.ban',{'links.website'}}})
|
||||
end
|
||||
game.ban_player(player, { "warnings.received", by_player_name, number_of_warnings, { "warnings.ban", { "links.website" } } })
|
||||
end,
|
||||
},
|
||||
script_warning_cool_down = 30, --- @setting script_warning_cool_down time for a script warning (given by script) to be removed (in minutes)
|
||||
script_warning_limit=5 --- @setting script_warning_limit the number of script warnings (given by script) that are allowed before full warnings are given
|
||||
script_warning_limit = 5, --- @setting script_warning_limit the number of script warnings (given by script) that are allowed before full warnings are given
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
--- Please go to ./config if you want to change settings, each file is commented with what it does
|
||||
-- if it is not in ./config then you should not attempt to change it unless you know what you are doing
|
||||
-- all files which are loaded (including the config files) are present in ./config/file_loader.lua
|
||||
@@ -11,8 +10,8 @@ xpcall = function (func, error_handler, ...)
|
||||
return table.unpack(rtn)
|
||||
end
|
||||
|
||||
log('[START] -----| Explosive Gaming Scenario Loader |-----')
|
||||
log('[INFO] Setting up lua environment')
|
||||
log("[START] -----| Explosive Gaming Scenario Loader |-----")
|
||||
log("[INFO] Setting up lua environment")
|
||||
|
||||
-- Require the global overrides
|
||||
require("modules.exp_legacy.overrides.table") -- Adds alot more functions to the table module
|
||||
@@ -20,37 +19,38 @@ storage.version = require("modules.exp_legacy.overrides.version") -- The current
|
||||
_C = require("modules.exp_legacy.expcore.common") -- _C is used to store lots of common functions expected to be used
|
||||
|
||||
-- Please go to config/file_loader.lua to edit the files that are loaded
|
||||
log('[INFO] Reading loader config')
|
||||
log("[INFO] Reading loader config")
|
||||
local files = require("modules.exp_legacy.config._file_loader")
|
||||
|
||||
-- Error handler for loading files
|
||||
local errors = {}
|
||||
local error_count = 0
|
||||
local error_format = '[ERROR] %s :: %s'
|
||||
local error_format = "[ERROR] %s :: %s"
|
||||
local currently_loading = nil
|
||||
local function error_handler(err)
|
||||
error_count = error_count + 1
|
||||
if err:find('module '..currently_loading..' not found;', nil, true) then
|
||||
log('[ERROR] File not found: '..currently_loading)
|
||||
if err:find("module " .. currently_loading .. " not found;", nil, true) then
|
||||
log("[ERROR] File not found: " .. currently_loading)
|
||||
errors[error_count] = error_format:format(currently_loading, err)
|
||||
else
|
||||
log('[ERROR] Failed to load: '..currently_loading)
|
||||
log("[ERROR] Failed to load: " .. currently_loading)
|
||||
errors[error_count] = debug.traceback(error_format:format(currently_loading, err))
|
||||
end
|
||||
end
|
||||
|
||||
-- Loads all files from the config and logs that they are loaded
|
||||
local total_file_count = string.format('%3d', #files)
|
||||
local total_file_count = string.format("%3d", #files)
|
||||
for index, path in pairs(files) do
|
||||
currently_loading = path
|
||||
log(string.format('[INFO] Loading file %3d/%s (%s)', index, total_file_count, path))
|
||||
log(string.format("[INFO] Loading file %3d/%s (%s)", index, total_file_count, path))
|
||||
xpcall(require, error_handler, "modules.exp_legacy." .. path)
|
||||
end
|
||||
|
||||
-- Logs all errors again to make it make it easy to find
|
||||
log('[INFO] All files loaded with '..error_count..' errors:')
|
||||
log("[INFO] All files loaded with " .. error_count .. " errors:")
|
||||
for _, error in ipairs(errors) do log(error) end
|
||||
log('[END] -----| Explosive Gaming Scenario Loader |-----')
|
||||
|
||||
log("[END] -----| Explosive Gaming Scenario Loader |-----")
|
||||
|
||||
--- Register all event handlers via clusterio
|
||||
local Event = require("modules/exp_legacy/utils/event")
|
||||
|
||||
@@ -191,9 +191,9 @@ local trace = debug.traceback
|
||||
local Commands = {
|
||||
--- Constant values used by the command system
|
||||
defines = {
|
||||
error = 'CommandError',
|
||||
unauthorized = 'CommandErrorUnauthorized',
|
||||
success = 'CommandSuccess'
|
||||
error = "CommandError",
|
||||
unauthorized = "CommandErrorUnauthorized",
|
||||
success = "CommandSuccess",
|
||||
},
|
||||
--- An array of all custom commands that are registered
|
||||
commands = {},
|
||||
@@ -243,7 +243,7 @@ Commands.remove_authenticator(admin_authenticator)
|
||||
|
||||
]]
|
||||
function Commands.remove_authenticator(authenticator)
|
||||
if type(authenticator) == 'number' then
|
||||
if type(authenticator) == "number" then
|
||||
-- If a number is passed then it is assumed to be the index
|
||||
if Commands.authenticators[authenticator] then
|
||||
Commands.authenticators[authenticator] = nil
|
||||
@@ -281,15 +281,15 @@ function Commands.authorize(player, command_name)
|
||||
-- This is the reject function given to authenticators
|
||||
local failure_message
|
||||
local function reject(message)
|
||||
failure_message = message or {'expcore-commands.unauthorized'}
|
||||
failure_message = message or { "expcore-commands.unauthorized" }
|
||||
return Commands.defines.unauthorized
|
||||
end
|
||||
|
||||
-- This is the internal error function used when an authenticator errors
|
||||
local function authenticator_error(err)
|
||||
log('[ERROR] Authorization failed: '..trace(err))
|
||||
log("[ERROR] Authorization failed: " .. trace(err))
|
||||
if Commands.authorization_failure_on_error then
|
||||
return reject('Internal Error')
|
||||
return reject("Internal Error")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -298,7 +298,7 @@ function Commands.authorize(player, command_name)
|
||||
-- player: LuaPlayer, command: string, flags: table, reject: function(error_message: string)
|
||||
local _, rtn = xpcall(authenticator, authenticator_error, player, command_name, command_data.flags, reject)
|
||||
if rtn == false or rtn == Commands.defines.unauthorized or rtn == reject or failure_message ~= nil then
|
||||
if failure_message == nil then failure_message = {'expcore-commands.unauthorized'} end
|
||||
if failure_message == nil then failure_message = { "expcore-commands.unauthorized" } end
|
||||
return false, failure_message
|
||||
end
|
||||
end
|
||||
@@ -370,7 +370,10 @@ end)
|
||||
function Commands.parse(name, input, player, reject, ...)
|
||||
if not Commands.parsers[name] then return end
|
||||
local success, rtn = pcall(Commands.parsers[name], input, player, reject, ...)
|
||||
if not success then error(rtn, 2) return end
|
||||
if not success then
|
||||
error(rtn, 2)
|
||||
return
|
||||
end
|
||||
if not rtn or rtn == Commands.defines.error then return end
|
||||
return rtn
|
||||
end
|
||||
@@ -398,6 +401,7 @@ function Commands.get(player)
|
||||
allowed[name] = command_data
|
||||
end
|
||||
end
|
||||
|
||||
return allowed
|
||||
end
|
||||
|
||||
@@ -420,12 +424,13 @@ function Commands.search(keyword, player)
|
||||
-- Loops over custom commands
|
||||
for name, command_data in pairs(custom_commands) do
|
||||
-- combines name help and aliases into one message to be searched
|
||||
local search = string.format('%s %s %s %s', name, command_data.help, command_data.searchable_description, table.concat(command_data.aliases, ' '))
|
||||
local search = string.format("%s %s %s %s", name, command_data.help, command_data.searchable_description, table.concat(command_data.aliases, " "))
|
||||
|
||||
if search:lower():match(keyword) then
|
||||
matches[name] = command_data
|
||||
end
|
||||
end
|
||||
|
||||
-- Loops over the names of game commands
|
||||
for name, description in pairs(commands.game_commands) do
|
||||
if name:lower():match(keyword) then
|
||||
@@ -433,11 +438,12 @@ function Commands.search(keyword, player)
|
||||
matches[name] = {
|
||||
name = name,
|
||||
help = description,
|
||||
description = '',
|
||||
aliases = {}
|
||||
description = "",
|
||||
aliases = {},
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
return matches
|
||||
end
|
||||
|
||||
@@ -458,8 +464,8 @@ function Commands.new_command(name, help, descr)
|
||||
local command = setmetatable({
|
||||
name = name,
|
||||
help = help,
|
||||
searchable_description = descr or '',
|
||||
callback = function() Commands.internal_error(false, name, 'No callback registered') end,
|
||||
searchable_description = descr or "",
|
||||
callback = function() Commands.internal_error(false, name, "No callback registered") end,
|
||||
auto_concat = false,
|
||||
min_param_count = 0,
|
||||
max_param_count = 0,
|
||||
@@ -467,7 +473,7 @@ function Commands.new_command(name, help, descr)
|
||||
aliases = {}, -- stores aliases to this command
|
||||
params = {}, -- [param_name] = {optional: boolean, default: any, parse: function, parse_args: table}
|
||||
}, {
|
||||
__index = Commands._prototype
|
||||
__index = Commands._prototype,
|
||||
})
|
||||
Commands.commands[name] = command
|
||||
return command
|
||||
@@ -492,7 +498,7 @@ end)
|
||||
]]
|
||||
function Commands._prototype:add_param(name, optional, parse, ...)
|
||||
local parse_args = { ... }
|
||||
if type(optional) ~= 'boolean' then
|
||||
if type(optional) ~= "boolean" then
|
||||
parse_args = { parse, ... }
|
||||
parse = optional
|
||||
optional = false
|
||||
@@ -501,7 +507,7 @@ function Commands._prototype:add_param(name, optional, parse, ...)
|
||||
self.params[name] = {
|
||||
optional = optional,
|
||||
parse = parse or function(string) return string end,
|
||||
parse_args = parse_args
|
||||
parse_args = parse_args,
|
||||
}
|
||||
|
||||
self.max_param_count = self.max_param_count + 1
|
||||
@@ -532,6 +538,7 @@ function Commands._prototype:set_defaults(defaults)
|
||||
self.params[name].default = value
|
||||
end
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -565,6 +572,7 @@ function Commands._prototype:add_alias(...)
|
||||
for index, alias in ipairs{ ... } do
|
||||
self.aliases[start_index + index] = alias
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -600,14 +608,15 @@ function Commands._prototype:register(callback)
|
||||
self.callback = callback
|
||||
|
||||
-- Generates a description to be used
|
||||
local description = ''
|
||||
local description = ""
|
||||
for param_name, param_details in pairs(self.params) do
|
||||
if param_details.optional then
|
||||
description = string.format('%s [%s]', description, param_name)
|
||||
description = string.format("%s [%s]", description, param_name)
|
||||
else
|
||||
description = string.format('%s <%s>', description, param_name)
|
||||
description = string.format("%s <%s>", description, param_name)
|
||||
end
|
||||
end
|
||||
|
||||
self.description = description
|
||||
|
||||
-- Last resort error handler for commands
|
||||
@@ -622,7 +631,7 @@ function Commands._prototype:register(callback)
|
||||
end
|
||||
|
||||
-- Registers the command under its own name
|
||||
local help = {'expcore-commands.command-help', description, self.help}
|
||||
local help = { "expcore-commands.command-help", description, self.help }
|
||||
commands.add_command(self.name, help, command_callback)
|
||||
|
||||
-- Adds any aliases that it has
|
||||
@@ -650,7 +659,7 @@ return 'Your message has been printed'
|
||||
]]
|
||||
function Commands.success(value)
|
||||
if value ~= nil then player_return(value) end
|
||||
player_return({'expcore-commands.command-ran'}, 'cyan')
|
||||
player_return({ "expcore-commands.command-ran" }, "cyan")
|
||||
return Commands.defines.success
|
||||
end
|
||||
|
||||
@@ -675,10 +684,10 @@ return Commands.error('The player you selected is offline')
|
||||
|
||||
]]
|
||||
function Commands.error(error_message, play_sound)
|
||||
error_message = error_message or ''
|
||||
player_return({'expcore-commands.command-fail', error_message}, 'orange_red')
|
||||
error_message = error_message or ""
|
||||
player_return({ "expcore-commands.command-fail", error_message }, "orange_red")
|
||||
if play_sound ~= false then
|
||||
play_sound = play_sound or 'utility/wire_pickup'
|
||||
play_sound = play_sound or "utility/wire_pickup"
|
||||
if game.player then game.player.play_sound{ path = play_sound } end
|
||||
end
|
||||
return Commands.defines.error
|
||||
@@ -700,22 +709,22 @@ end
|
||||
]]
|
||||
function Commands.internal_error(success, command_name, error_message)
|
||||
if not success then
|
||||
Commands.error('Internal Error, Please contact an admin', 'utility/cannot_build')
|
||||
log{'expcore-commands.command-error-log-format', command_name, error_message}
|
||||
Commands.error("Internal Error, Please contact an admin", "utility/cannot_build")
|
||||
log{ "expcore-commands.command-error-log-format", command_name, error_message }
|
||||
end
|
||||
return not success
|
||||
end
|
||||
|
||||
--- Logs command usage to file
|
||||
local function command_log(player, command, comment, params, raw, details)
|
||||
local player_name = player and player.name or '<Server>'
|
||||
write_json('log/commands.log', {
|
||||
local player_name = player and player.name or "<Server>"
|
||||
write_json("log/commands.log", {
|
||||
player_name = player_name,
|
||||
command_name = command.name,
|
||||
comment = comment,
|
||||
details = details,
|
||||
params = params,
|
||||
raw = raw
|
||||
raw = raw,
|
||||
})
|
||||
end
|
||||
|
||||
@@ -733,46 +742,46 @@ function Commands.run_command(command_event)
|
||||
-- Check if the player is allowed to use the command
|
||||
local authorized, auth_fail = Commands.authorize(player, command_data.name)
|
||||
if not authorized then
|
||||
command_log(player, command_data, 'Failed Auth', {}, command_event.parameter)
|
||||
Commands.error(auth_fail, 'utility/cannot_build')
|
||||
command_log(player, command_data, "Failed Auth", {}, command_event.parameter)
|
||||
Commands.error(auth_fail, "utility/cannot_build")
|
||||
return
|
||||
end
|
||||
|
||||
-- Check for parameter being nil
|
||||
if command_data.min_param_count > 0 and not command_event.parameter then
|
||||
command_log(player, command_data, 'No Params Given', {}, command_event.parameter)
|
||||
Commands.error{'expcore-commands.invalid-inputs', command_data.name, command_data.description}
|
||||
command_log(player, command_data, "No Params Given", {}, command_event.parameter)
|
||||
Commands.error{ "expcore-commands.invalid-inputs", command_data.name, command_data.description }
|
||||
return
|
||||
end
|
||||
|
||||
-- Extract quoted arguments
|
||||
local raw_input = command_event.parameter or ''
|
||||
local raw_input = command_event.parameter or ""
|
||||
local quote_params = {}
|
||||
local input_string = raw_input:gsub('"[^"]-"', function(word)
|
||||
local no_spaces = word:gsub('%s', '%%s')
|
||||
local no_spaces = word:gsub("%s", "%%s")
|
||||
quote_params[no_spaces] = word:sub(2, -2)
|
||||
return ' '..no_spaces..' '
|
||||
return " " .. no_spaces .. " "
|
||||
end)
|
||||
|
||||
-- Extract unquoted arguments
|
||||
local raw_params = {}
|
||||
local last_index = 0
|
||||
local param_number = 0
|
||||
for word in input_string:gmatch('%S+') do
|
||||
for word in input_string:gmatch("%S+") do
|
||||
param_number = param_number + 1
|
||||
if param_number > command_data.max_param_count then
|
||||
-- there are too many params given to the command
|
||||
if not command_data.auto_concat then
|
||||
-- error as they should not be more
|
||||
command_log(player, command_data, 'Invalid Input: Too Many Params', raw_params, raw_input)
|
||||
Commands.error{'expcore-commands.invalid-inputs', command_data.name, command_data.description}
|
||||
command_log(player, command_data, "Invalid Input: Too Many Params", raw_params, raw_input)
|
||||
Commands.error{ "expcore-commands.invalid-inputs", command_data.name, command_data.description }
|
||||
return
|
||||
else
|
||||
-- concat to the last param
|
||||
if quote_params[word] then
|
||||
raw_params[last_index] = raw_params[last_index] .. ' "' .. quote_params[word] .. '"'
|
||||
else
|
||||
raw_params[last_index] = raw_params[last_index]..' '..word
|
||||
raw_params[last_index] = raw_params[last_index] .. " " .. word
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -790,8 +799,8 @@ function Commands.run_command(command_event)
|
||||
-- Check the param count
|
||||
local param_count = #raw_params
|
||||
if param_count < command_data.min_param_count then
|
||||
command_log(player, command_data, 'Invalid Input: Not Enough Params', raw_params, raw_input)
|
||||
Commands.error{'expcore-commands.invalid-inputs', command_data.name, command_data.description}
|
||||
command_log(player, command_data, "Invalid Input: Not Enough Params", raw_params, raw_input)
|
||||
Commands.error{ "expcore-commands.invalid-inputs", command_data.name, command_data.description }
|
||||
return
|
||||
end
|
||||
|
||||
@@ -801,48 +810,46 @@ function Commands.run_command(command_event)
|
||||
for param_name, param_data in pairs(command_data.params) do
|
||||
local parse_callback = param_data.parse
|
||||
-- If its a string this get it from the parser table
|
||||
if type(parse_callback) == 'string' then
|
||||
if type(parse_callback) == "string" then
|
||||
parse_callback = Commands.parsers[parse_callback]
|
||||
end
|
||||
|
||||
-- If its not a function throw and error
|
||||
if type(parse_callback) ~= 'function' then
|
||||
Commands.internal_error(false, command_data.name, 'Invalid param parse '..tostring(param_data.parse))
|
||||
command_log(player, command_data, 'Internal Error: Invalid Param Parse', params, raw_input, tostring(param_data.parse))
|
||||
if type(parse_callback) ~= "function" then
|
||||
Commands.internal_error(false, command_data.name, "Invalid param parse " .. tostring(param_data.parse))
|
||||
command_log(player, command_data, "Internal Error: Invalid Param Parse", params, raw_input, tostring(param_data.parse))
|
||||
return
|
||||
end
|
||||
|
||||
-- This is the reject function given to parse callbacks
|
||||
local function reject(error_message)
|
||||
error_message = error_message or ''
|
||||
command_log(player, command_data, 'Invalid Param Given', raw_params, input_string)
|
||||
return Commands.error{'expcore-commands.invalid-param', param_name, error_message}
|
||||
error_message = error_message or ""
|
||||
command_log(player, command_data, "Invalid Param Given", raw_params, input_string)
|
||||
return Commands.error{ "expcore-commands.invalid-param", param_name, error_message }
|
||||
end
|
||||
|
||||
-- input: string, player: LuaPlayer, reject: function, ... extra args
|
||||
local success, param_parsed = pcall(parse_callback, raw_params[index], player, reject, table.unpack(param_data.parse_args))
|
||||
if Commands.internal_error(success, command_data.name, param_parsed) then
|
||||
return command_log(player, command_data, 'Internal Error: Param Parse Fail', params, raw_input, param_parsed)
|
||||
return command_log(player, command_data, "Internal Error: Param Parse Fail", params, raw_input, param_parsed)
|
||||
end
|
||||
|
||||
if param_data.optional == true and raw_params[index] == nil then
|
||||
-- If the param is optional and nil then it is set to default
|
||||
param_parsed = param_data.default
|
||||
if type(param_parsed) == 'function' then
|
||||
if type(param_parsed) == "function" then
|
||||
success, param_parsed = pcall(param_parsed, player)
|
||||
if Commands.internal_error(success, command_data.name, param_parsed) then
|
||||
return command_log(player, command_data, 'Internal Error: Default Value Fail', params, raw_input, param_parsed)
|
||||
return command_log(player, command_data, "Internal Error: Default Value Fail", params, raw_input, param_parsed)
|
||||
end
|
||||
end
|
||||
|
||||
elseif param_parsed == nil or param_parsed == Commands.defines.error or param_parsed == reject then
|
||||
-- No value was returned or error was returned, if nil then give generic error
|
||||
if param_parsed ~= Commands.defines.error then
|
||||
command_log(player, command_data, 'Invalid Param Given', raw_params, raw_input, param_name)
|
||||
Commands.error{'expcore-commands.command-error-param-format', param_name, 'please make sure it is the correct type'}
|
||||
command_log(player, command_data, "Invalid Param Given", raw_params, raw_input, param_name)
|
||||
Commands.error{ "expcore-commands.command-error-param-format", param_name, "please make sure it is the correct type" }
|
||||
end
|
||||
return
|
||||
|
||||
end
|
||||
|
||||
-- Add the param to the table to be passed to the command callback
|
||||
@@ -855,16 +862,16 @@ function Commands.run_command(command_event)
|
||||
params[command_data.max_param_count + 1] = raw_input
|
||||
local success, rtn = pcall(command_data.callback, player, table.unpack(params))
|
||||
if Commands.internal_error(success, command_data.name, rtn) then
|
||||
return command_log(player, command_data, 'Internal Error: Command Callback Fail', raw_params, command_event.parameter, rtn)
|
||||
return command_log(player, command_data, "Internal Error: Command Callback Fail", raw_params, command_event.parameter, rtn)
|
||||
end
|
||||
|
||||
-- Give output to the player
|
||||
if rtn == Commands.defines.error or rtn == Commands.error then
|
||||
return command_log(player, command_data, 'Custom Error', raw_params, raw_input)
|
||||
return command_log(player, command_data, "Custom Error", raw_params, raw_input)
|
||||
elseif rtn ~= Commands.defines.success and rtn ~= Commands.success then
|
||||
Commands.success(rtn)
|
||||
end
|
||||
command_log(player, command_data, 'Success', raw_params, raw_input)
|
||||
command_log(player, command_data, "Success", raw_params, raw_input)
|
||||
end
|
||||
|
||||
return Commands
|
||||
|
||||
@@ -60,6 +60,7 @@ function Common.multi_type_check(value, test_types)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -95,12 +96,12 @@ validate_argument_type(value, 'number', 2, 'repeat_count')
|
||||
]]
|
||||
function Common.validate_argument_type(value, test_type, param_number, param_name)
|
||||
if not Common.test_type(value, test_type) then
|
||||
local function_name = debug.getinfo(2, 'n').name or '<anon>'
|
||||
local function_name = debug.getinfo(2, "n").name or "<anon>"
|
||||
local error_message
|
||||
if param_name then
|
||||
error_message = string.format('Bad argument #%d to %q; %q is of type %s expected %s', param_number, function_name, param_name, type(value), test_type)
|
||||
error_message = string.format("Bad argument #%d to %q; %q is of type %s expected %s", param_number, function_name, param_name, type(value), test_type)
|
||||
else
|
||||
error_message = string.format('Bad argument #%d to %q; argument is of type %s expected %s', param_number, function_name, type(value), test_type)
|
||||
error_message = string.format("Bad argument #%d to %q; argument is of type %s expected %s", param_number, function_name, type(value), test_type)
|
||||
end
|
||||
return error(error_message, 3)
|
||||
end
|
||||
@@ -123,12 +124,12 @@ validate_argument_type(value, {'string', 'table'}, 2, 'player')
|
||||
]]
|
||||
function Common.validate_argument_multi_type(value, test_types, param_number, param_name)
|
||||
if not Common.multi_type_check(value, test_types) then
|
||||
local function_name = debug.getinfo(2, 'n').name or '<anon>'
|
||||
local function_name = debug.getinfo(2, "n").name or "<anon>"
|
||||
local error_message
|
||||
if param_name then
|
||||
error_message = string.format('Bad argument #%2d to %q; %q is of type %s expected %s', param_number, function_name, param_name, type(value), table.concat(test_types, ' or '))
|
||||
error_message = string.format("Bad argument #%2d to %q; %q is of type %s expected %s", param_number, function_name, param_name, type(value), table.concat(test_types, " or "))
|
||||
else
|
||||
error_message = string.format('Bad argument #%2d to %q; argument is of type %s expected %s', param_number, function_name, type(value), table.concat(test_types, ' or '))
|
||||
error_message = string.format("Bad argument #%2d to %q; argument is of type %s expected %s", param_number, function_name, type(value), table.concat(test_types, " or "))
|
||||
end
|
||||
return error(error_message, 3)
|
||||
end
|
||||
@@ -139,8 +140,8 @@ end
|
||||
-- @usage error_if_runtime()
|
||||
function Common.error_if_runtime()
|
||||
if package.lifecycle == 8 then
|
||||
local function_name = debug.getinfo(2, 'n').name or '<anon>'
|
||||
error(function_name..' can not be called during runtime', 3)
|
||||
local function_name = debug.getinfo(2, "n").name or "<anon>"
|
||||
error(function_name .. " can not be called during runtime", 3)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -171,7 +172,7 @@ local value = Common.resolve_value(self.defaut_value, self)
|
||||
|
||||
]]
|
||||
function Common.resolve_value(value, ...)
|
||||
return value and type(value) == 'function' and value(...) or value
|
||||
return value and type(value) == "function" and value(...) or value
|
||||
end
|
||||
|
||||
--- Converts a varible into its boolean value, nil and false return false
|
||||
@@ -190,8 +191,8 @@ end
|
||||
--- Returns a string for a number with comma seperators
|
||||
-- @usage comma_value(input_number)
|
||||
function Common.comma_value(n) -- credit http://richard.warburton.it
|
||||
local left, num, right = string.match(n, '^([^%d]*%d)(%d*)(.-)$')
|
||||
return left .. (num:reverse():gsub('(%d%d%d)', '%1, '):reverse()) .. right
|
||||
local left, num, right = string.match(n, "^([^%d]*%d)(%d*)(.-)$")
|
||||
return left .. (num:reverse():gsub("(%d%d%d)", "%1, "):reverse()) .. right
|
||||
end
|
||||
|
||||
--[[-- Sets a table element to value while also returning value.
|
||||
@@ -218,7 +219,7 @@ write_json('dump', tbl)
|
||||
|
||||
]]
|
||||
function Common.write_json(path, tbl)
|
||||
game.write_file(path, game.table_to_json(tbl)..'\n', true, 0)
|
||||
game.write_file(path, game.table_to_json(tbl) .. "\n", true, 0)
|
||||
end
|
||||
|
||||
--[[-- Calls a require that will not error if the file is not found
|
||||
@@ -232,8 +233,11 @@ local Module = opt_require 'expcore.common'
|
||||
]]
|
||||
function Common.opt_require(path)
|
||||
local success, rtn = pcall(require, path)
|
||||
if success then return rtn
|
||||
else return nil, rtn end
|
||||
if success then
|
||||
return rtn
|
||||
else
|
||||
return nil, rtn
|
||||
end
|
||||
end
|
||||
|
||||
--[[-- Returns a desync safe file path for the current file
|
||||
@@ -246,7 +250,7 @@ local file_path = get_file_path()
|
||||
]]
|
||||
function Common.get_file_path(offset)
|
||||
offset = offset or 0
|
||||
return debug.getinfo(offset+2, 'S').short_src:sub(10, -5)
|
||||
return debug.getinfo(offset + 2, "S").short_src:sub(10, -5)
|
||||
end
|
||||
|
||||
--[[-- Converts a table to an enum
|
||||
@@ -264,18 +268,21 @@ local colors = enum{
|
||||
function Common.enum(tbl)
|
||||
local rtn = {}
|
||||
for k, v in pairs(tbl) do
|
||||
if type(k) ~= 'number' then
|
||||
if type(k) ~= "number" then
|
||||
rtn[v] = k
|
||||
end
|
||||
end
|
||||
|
||||
for k, v in pairs(tbl) do
|
||||
if type(k) == 'number' then
|
||||
if type(k) == "number" then
|
||||
table.insert(rtn, v)
|
||||
end
|
||||
end
|
||||
|
||||
for k, v in pairs(rtn) do
|
||||
rtn[v] = k
|
||||
end
|
||||
|
||||
return rtn
|
||||
end
|
||||
|
||||
@@ -297,7 +304,7 @@ local key = auto_complete(tbl, "foo", true, true)
|
||||
|
||||
]]
|
||||
function Common.auto_complete(options, input, use_key, rtn_key)
|
||||
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
|
||||
@@ -319,7 +326,7 @@ local player_name = get_actor()
|
||||
|
||||
]]
|
||||
function Common.get_actor(player_name)
|
||||
return game.player and game.player.name or player_name or '<server>'
|
||||
return game.player and game.player.name or player_name or "<server>"
|
||||
end
|
||||
|
||||
--[[-- Returns a message with valid chat tags to change its colour
|
||||
@@ -333,8 +340,8 @@ local message = format_chat_colour('Hello, World!', { r=355, g=100, b=100 })
|
||||
]]
|
||||
function Common.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)
|
||||
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
|
||||
@@ -348,8 +355,8 @@ local message = format_chat_colour_localized('Hello, World!', { r=355, g=100, b=
|
||||
]]
|
||||
function Common.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}
|
||||
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
|
||||
@@ -363,7 +370,7 @@ local message = format_chat_player_name(game.player, true)
|
||||
]]
|
||||
function Common.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_name = player and player.name or "<Server>"
|
||||
local player_chat_colour = player and player.chat_color or Colours.white
|
||||
if raw_string then
|
||||
return Common.format_chat_colour(player_name, player_chat_colour)
|
||||
@@ -388,37 +395,41 @@ player_return('Hello, World!', nil, player)
|
||||
|
||||
]]
|
||||
function Common.player_return(value, colour, player)
|
||||
colour = Common.type_check(colour, 'table') and colour or Colours[colour] ~= Colours.white and Colours[colour] or Colours.white
|
||||
colour = Common.type_check(colour, "table") and colour or Colours[colour] ~= Colours.white and Colours[colour] or Colours.white
|
||||
player = player or game.player
|
||||
-- converts the value to a string
|
||||
local returnAsString
|
||||
if Common.type_check(value, 'table') or type(value) == 'userdata' then
|
||||
if Common.type_check(value.__self, 'userdata') or type(value) == 'userdata' then
|
||||
if Common.type_check(value, "table") or type(value) == "userdata" then
|
||||
if Common.type_check(value.__self, "userdata") or type(value) == "userdata" then
|
||||
-- value is userdata
|
||||
returnAsString = 'Cant Display Userdata'
|
||||
elseif Common.type_check(value[1], 'string') and string.find(value[1], '.+[.].+') and not string.find(value[1], '%s') then
|
||||
returnAsString = "Cant Display Userdata"
|
||||
elseif Common.type_check(value[1], "string") and string.find(value[1], ".+[.].+") and not string.find(value[1], "%s") then
|
||||
-- value is a locale string
|
||||
returnAsString = value
|
||||
elseif getmetatable(value) ~= nil and not tostring(value):find('table: 0x') then
|
||||
elseif getmetatable(value) ~= nil and not tostring(value):find("table: 0x") then
|
||||
-- value has a tostring meta method
|
||||
returnAsString = tostring(value)
|
||||
else
|
||||
-- value is a table
|
||||
returnAsString = table.inspect(value, {depth=5, indent=' ', newline='\n'})
|
||||
returnAsString = table.inspect(value, { depth = 5, indent = " ", newline = "\n" })
|
||||
end
|
||||
elseif Common.type_check(value, 'function') then
|
||||
elseif Common.type_check(value, "function") then
|
||||
-- value is a function
|
||||
returnAsString = 'Cant Display Functions'
|
||||
else returnAsString = tostring(value) end
|
||||
returnAsString = "Cant Display Functions"
|
||||
else
|
||||
returnAsString = tostring(value)
|
||||
end
|
||||
-- returns to the player or the server
|
||||
if player then
|
||||
-- allows any valid player identifier to be used
|
||||
player = Game.get_player_from_any(player)
|
||||
if not player then error('Invalid Player given to player_return', 2) end
|
||||
if not player then error("Invalid Player given to player_return", 2) end
|
||||
-- plays a nice sound that is different to normal message sound
|
||||
player.play_sound{path='utility/scenario_message'}
|
||||
player.play_sound{ path = "utility/scenario_message" }
|
||||
player.print(returnAsString, colour)
|
||||
else rcon.print(returnAsString) end
|
||||
else
|
||||
rcon.print(returnAsString)
|
||||
end
|
||||
end
|
||||
|
||||
--[[-- Formats tick into a clean format, denominations from highest to lowest
|
||||
@@ -451,7 +462,7 @@ function Common.format_time(ticks, options)
|
||||
long = false,
|
||||
time = false,
|
||||
string = false,
|
||||
null=false
|
||||
null = false,
|
||||
}
|
||||
-- Basic numbers that are used in calculations
|
||||
local max_days, max_hours, max_minutes, max_seconds = ticks / 5184000, ticks / 216000, ticks / 3600, ticks / 60
|
||||
@@ -470,44 +481,44 @@ function Common.format_time(ticks, options)
|
||||
end
|
||||
-- Creates the null time format, does not work with long
|
||||
if options.null and not options.long then
|
||||
rtn_days='--'
|
||||
rtn_hours='--'
|
||||
rtn_minutes='--'
|
||||
rtn_seconds='--'
|
||||
rtn_days = "--"
|
||||
rtn_hours = "--"
|
||||
rtn_minutes = "--"
|
||||
rtn_seconds = "--"
|
||||
end
|
||||
-- Format options
|
||||
local suffix = 'time-symbol-'
|
||||
local suffix_2 = '-short'
|
||||
local suffix = "time-symbol-"
|
||||
local suffix_2 = "-short"
|
||||
if options.long then
|
||||
suffix = ''
|
||||
suffix_2 = ''
|
||||
suffix = ""
|
||||
suffix_2 = ""
|
||||
end
|
||||
local div = options.string and ' ' or 'time-format.simple-format-tagged'
|
||||
local div = options.string and " " or "time-format.simple-format-tagged"
|
||||
if options.time then
|
||||
div = options.string and ':' or 'time-format.simple-format-div'
|
||||
div = options.string and ":" or "time-format.simple-format-div"
|
||||
suffix = false
|
||||
end
|
||||
-- Adds formatting
|
||||
if suffix ~= false then
|
||||
if options.string then
|
||||
-- format it as a string
|
||||
local long = suffix == ''
|
||||
rtn_days = long and rtn_days..' days' or rtn_days..'d'
|
||||
rtn_hours = long and rtn_hours..' hours' or rtn_hours..'h'
|
||||
rtn_minutes = long and rtn_minutes..' minutes' or rtn_minutes..'m'
|
||||
rtn_seconds = long and rtn_seconds..' seconds' or rtn_seconds..'s'
|
||||
local long = suffix == ""
|
||||
rtn_days = long and rtn_days .. " days" or rtn_days .. "d"
|
||||
rtn_hours = long and rtn_hours .. " hours" or rtn_hours .. "h"
|
||||
rtn_minutes = long and rtn_minutes .. " minutes" or rtn_minutes .. "m"
|
||||
rtn_seconds = long and rtn_seconds .. " seconds" or rtn_seconds .. "s"
|
||||
else
|
||||
rtn_days = {suffix..'days'..suffix_2, rtn_days}
|
||||
rtn_hours = {suffix..'hours'..suffix_2, rtn_hours}
|
||||
rtn_minutes = {suffix..'minutes'..suffix_2, rtn_minutes}
|
||||
rtn_seconds = {suffix..'seconds'..suffix_2, rtn_seconds}
|
||||
rtn_days = { suffix .. "days" .. suffix_2, rtn_days }
|
||||
rtn_hours = { suffix .. "hours" .. suffix_2, rtn_hours }
|
||||
rtn_minutes = { suffix .. "minutes" .. suffix_2, rtn_minutes }
|
||||
rtn_seconds = { suffix .. "seconds" .. suffix_2, rtn_seconds }
|
||||
end
|
||||
elseif not options.null then
|
||||
-- weather string or not it has same format
|
||||
rtn_days = string.format('%02d', rtn_days)
|
||||
rtn_hours = string.format('%02d', rtn_hours)
|
||||
rtn_minutes = string.format('%02d', rtn_minutes)
|
||||
rtn_seconds = string.format('%02d', rtn_seconds)
|
||||
rtn_days = string.format("%02d", rtn_days)
|
||||
rtn_hours = string.format("%02d", rtn_hours)
|
||||
rtn_minutes = string.format("%02d", rtn_minutes)
|
||||
rtn_seconds = string.format("%02d", rtn_seconds)
|
||||
end
|
||||
-- The final return is construed
|
||||
local rtn
|
||||
@@ -542,10 +553,10 @@ copy_items_stack(game.player.get_main_inventory().get_contents())
|
||||
|
||||
]]
|
||||
function Common.copy_items_stack(items, surface, position, radius, chest_type)
|
||||
chest_type = chest_type or 'iron-chest'
|
||||
chest_type = chest_type or "iron-chest"
|
||||
surface = surface or game.surfaces[1]
|
||||
if position and type(position) ~= 'table' then return end
|
||||
if type(items) ~= '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 }
|
||||
local r = radius or 32
|
||||
@@ -555,7 +566,7 @@ function Common.copy_items_stack(items, surface, position, radius, chest_type)
|
||||
-- Makes a new empty chest when it is needed
|
||||
local function make_new_chest()
|
||||
local pos = surface.find_non_colliding_position(chest_type, position, 32, 1)
|
||||
local chest = surface.create_entity{name=chest_type, position=pos, force='neutral'}
|
||||
local chest = surface.create_entity{ name = chest_type, position = pos, force = "neutral" }
|
||||
table.insert(entities, chest)
|
||||
count = count + 1
|
||||
return chest
|
||||
@@ -581,11 +592,12 @@ function Common.copy_items_stack(items, surface, position, radius, chest_type)
|
||||
local item = items[i]
|
||||
if item.valid_for_read then
|
||||
local chest = next_chest(item)
|
||||
if not chest or not chest.valid then return error(string.format('Cant move item %s to %s{%s, %s} no valid chest in radius', item.name, surface.name, p.x, p.y)) end
|
||||
if not chest or not chest.valid then return error(string.format("Cant move item %s to %s{%s, %s} no valid chest in radius", item.name, surface.name, p.x, p.y)) end
|
||||
chest.insert(item)
|
||||
last_chest = chest
|
||||
end
|
||||
end
|
||||
|
||||
return last_chest
|
||||
end
|
||||
|
||||
@@ -603,21 +615,21 @@ move_items_stack(game.player.get_main_inventory())
|
||||
|
||||
]]
|
||||
function Common.move_items_stack(items, surface, position, radius, chest_type)
|
||||
chest_type = chest_type or 'steel-chest'
|
||||
chest_type = chest_type or "steel-chest"
|
||||
surface = surface or game.surfaces[1]
|
||||
|
||||
if position and type(position) ~= 'table' then
|
||||
if position and type(position) ~= "table" then
|
||||
return
|
||||
end
|
||||
|
||||
if type(items) ~= 'table' then
|
||||
if type(items) ~= "table" then
|
||||
return
|
||||
end
|
||||
|
||||
-- Finds all entities of the given type
|
||||
local p = position or { x = 0, y = 0 }
|
||||
local r = radius or 32
|
||||
local entities = surface.find_entities_filtered{area={{p.x - r, p.y - r}, {p.x + r, p.y + r}}, name={chest_type, 'iron-chest'}} or {}
|
||||
local entities = surface.find_entities_filtered{ area = { { p.x - r, p.y - r }, { p.x + r, p.y + r } }, name = { chest_type, "iron-chest" } } or {}
|
||||
local count = #entities
|
||||
local current = 0
|
||||
local last_entity = nil
|
||||
@@ -664,7 +676,7 @@ function Common.move_items_stack(items, surface, position, radius, chest_type)
|
||||
]]
|
||||
|
||||
local pos = surface.find_non_colliding_position(chest_type, p, r, 1, true)
|
||||
last_entity = surface.create_entity{name=chest_type, position=pos, force='neutral'}
|
||||
last_entity = surface.create_entity{ name = chest_type, position = pos, force = "neutral" }
|
||||
|
||||
count = count + 1
|
||||
entities[count] = last_entity
|
||||
@@ -753,11 +765,11 @@ print_grid_value(0, game.player.surface, { x=0, y=0 })
|
||||
|
||||
]]
|
||||
function Common.print_grid_value(value, surface, position, scale, offset, immutable)
|
||||
local is_string = type(value) == 'string'
|
||||
local is_string = type(value) == "string"
|
||||
local color = Colours.white
|
||||
local text = value
|
||||
|
||||
if type(immutable) ~= 'boolean' then
|
||||
if type(immutable) ~= "boolean" then
|
||||
immutable = false
|
||||
end
|
||||
|
||||
@@ -775,12 +787,12 @@ function Common.print_grid_value(value, surface, position, scale, offset, immuta
|
||||
text = math.floor(100 * value) * 0.01
|
||||
|
||||
if (0 == text) then
|
||||
text = '0.00'
|
||||
text = "0.00"
|
||||
end
|
||||
end
|
||||
|
||||
if not immutable then
|
||||
local text_entity = surface.find_entity('flying-text', position)
|
||||
local text_entity = surface.find_entity("flying-text", position)
|
||||
|
||||
if text_entity then
|
||||
text_entity.text = text
|
||||
@@ -790,10 +802,10 @@ function Common.print_grid_value(value, surface, position, scale, offset, immuta
|
||||
end
|
||||
|
||||
surface.create_entity{
|
||||
name = 'flying-text',
|
||||
name = "flying-text",
|
||||
color = color,
|
||||
text = text,
|
||||
position = position
|
||||
position = position,
|
||||
}.active = false
|
||||
end
|
||||
|
||||
@@ -805,7 +817,7 @@ clear_flying_text(game.player.surface)
|
||||
|
||||
]]
|
||||
function Common.clear_flying_text(surface)
|
||||
local entities = surface.find_entities_filtered{name ='flying-text'}
|
||||
local entities = surface.find_entities_filtered{ name = "flying-text" }
|
||||
for _, entity in pairs(entities) do
|
||||
if entity and entity.valid then
|
||||
entity.destroy()
|
||||
|
||||
@@ -169,8 +169,8 @@ end)
|
||||
--- Metatable used on datastores
|
||||
DatastoreManager.metatable = {
|
||||
__index = function(self, key) return rawget(self.children, key) or rawget(Datastore, key) end,
|
||||
__newidnex = function(_, _, _) error('Datastore can not be modified', 2) end,
|
||||
__call = function(self, ...) return self:get(...) end
|
||||
__newidnex = function(_, _, _) error("Datastore can not be modified", 2) end,
|
||||
__call = function(self, ...) return self:get(...) end,
|
||||
}
|
||||
|
||||
--[[-- Make a new datastore connection, if a connection already exists then it is returned
|
||||
@@ -188,7 +188,7 @@ function DatastoreManager.connect(datastoreName, saveToDisk, autoSave, propagate
|
||||
if Datastores[datastoreName] then return Datastores[datastoreName] end
|
||||
if package.lifecycle ~= package.lifecycle_stage.control then
|
||||
-- Only allow this function to be called during the control stage
|
||||
error('New datastore connection can not be created during runtime', 2)
|
||||
error("New datastore connection can not be created during runtime", 2)
|
||||
end
|
||||
|
||||
local new_datastore = {
|
||||
@@ -202,7 +202,7 @@ function DatastoreManager.connect(datastoreName, saveToDisk, autoSave, propagate
|
||||
children = {},
|
||||
metadata = {},
|
||||
events = {},
|
||||
data = {}
|
||||
data = {},
|
||||
}
|
||||
|
||||
Data[datastoreName] = new_datastore.data
|
||||
@@ -220,7 +220,7 @@ local BarData = Datastore.combine('ExampleData', 'Bar')
|
||||
|
||||
]]
|
||||
function DatastoreManager.combine(datastoreName, subDatastoreName)
|
||||
local datastore = assert(Datastores[datastoreName], 'Datastore not found '..tostring(datastoreName))
|
||||
local datastore = assert(Datastores[datastoreName], "Datastore not found " .. tostring(datastoreName))
|
||||
return datastore:combine(subDatastoreName)
|
||||
end
|
||||
|
||||
@@ -235,27 +235,23 @@ Datastore.ingest('request', 'ExampleData', 'TestKey', 'Foo')
|
||||
|
||||
]]
|
||||
function DatastoreManager.ingest(action, datastoreName, key, valueJson)
|
||||
local datastore = assert(Datastores[datastoreName], 'Datastore ingest error, Datastore not found '..tostring(datastoreName))
|
||||
assert(type(action) == 'string', 'Datastore ingest error, Action is not a string got: '..type(action))
|
||||
assert(type(key) == 'string', 'Datastore ingest error, Key is not a string got: '..type(key))
|
||||
local datastore = assert(Datastores[datastoreName], "Datastore ingest error, Datastore not found " .. tostring(datastoreName))
|
||||
assert(type(action) == "string", "Datastore ingest error, Action is not a string got: " .. type(action))
|
||||
assert(type(key) == "string", "Datastore ingest error, Key is not a string got: " .. type(key))
|
||||
|
||||
if action == 'remove' then
|
||||
if action == "remove" then
|
||||
datastore:raw_set(key)
|
||||
|
||||
elseif action == 'message' then
|
||||
elseif action == "message" then
|
||||
local success, value = pcall(game.json_to_table, valueJson)
|
||||
if not success or value == nil then value = tonumber(valueJson) or valueJson end
|
||||
datastore:raise_event('on_message', key, value)
|
||||
|
||||
elseif action == 'propagate' or action == 'request' then
|
||||
datastore:raise_event("on_message", key, value)
|
||||
elseif action == "propagate" or action == "request" then
|
||||
local success, value = pcall(game.json_to_table, valueJson)
|
||||
if not success or value == nil then value = tonumber(valueJson) or valueJson end
|
||||
local old_value = datastore:raw_get(key)
|
||||
value = datastore:raise_event('on_load', key, value, old_value)
|
||||
value = datastore:raise_event("on_load", key, value, old_value)
|
||||
datastore:set(key, value)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--[[-- Debug, Use to get all datastores, or return debug info on a datastore
|
||||
@@ -270,7 +266,7 @@ local debug_info = Datastore.debug('ExampleData')
|
||||
]]
|
||||
function DatastoreManager.debug(datastoreName)
|
||||
if not datastoreName then return Datastores end
|
||||
local datastore = assert(Datastores[datastoreName], 'Datastore not found '..tostring(datastoreName))
|
||||
local datastore = assert(Datastores[datastoreName], "Datastore not found " .. tostring(datastoreName))
|
||||
return datastore:debug()
|
||||
end
|
||||
|
||||
@@ -309,10 +305,12 @@ function Datastore:debug()
|
||||
|
||||
local children = {}
|
||||
for name in pairs(self.children) do children[#children + 1] = name end
|
||||
|
||||
if #children > 0 then debug_info.children = children end
|
||||
|
||||
local events = {}
|
||||
for name, handlers in pairs(self.events) do events[name] = #handlers end
|
||||
|
||||
if next(events) then debug_info.events = events end
|
||||
|
||||
if next(self.metadata) then debug_info.metadata = self.metadata end
|
||||
@@ -360,7 +358,7 @@ function Datastore:raw_set(key, value)
|
||||
end
|
||||
end
|
||||
|
||||
local function serialize_error(err) error('An error ocurred in a datastore serializer: '..trace(err)) end
|
||||
local function serialize_error(err) error("An error ocurred in a datastore serializer: " .. trace(err)) end
|
||||
--[[-- Internal, Return the serialized key
|
||||
@tparam any rawKey The key that needs to be serialized, if it is already a string then it is returned
|
||||
@treturn string The key after it has been serialized
|
||||
@@ -370,8 +368,8 @@ key = self:serialize(key)
|
||||
|
||||
]]
|
||||
function Datastore:serialize(rawKey)
|
||||
if type(rawKey) == 'string' then return rawKey end
|
||||
assert(self.serializer, 'Datastore does not have a serializer and received non string key')
|
||||
if type(rawKey) == "string" then return rawKey end
|
||||
assert(self.serializer, "Datastore does not have a serializer and received non string key")
|
||||
local success, key = xpcall(self.serializer, serialize_error, rawKey)
|
||||
return success and key or nil
|
||||
end
|
||||
@@ -391,9 +389,9 @@ self:write_action('save', 'TestKey', 'Foo')
|
||||
function Datastore:write_action(action, key, value)
|
||||
local data = { action, self.name, key }
|
||||
if value ~= nil then
|
||||
data[4] = type(value) == 'table' and game.table_to_json(value) or value
|
||||
data[4] = type(value) == "table" and game.table_to_json(value) or value
|
||||
end
|
||||
game.write_file('ext/datastore.out', table.concat(data, ' ')..'\n', true, 0)
|
||||
game.write_file("ext/datastore.out", table.concat(data, " ") .. "\n", true, 0)
|
||||
end
|
||||
|
||||
----- Datastore Local
|
||||
@@ -409,7 +407,7 @@ local BarData = ExampleData:combine('Bar')
|
||||
|
||||
]]
|
||||
function Datastore:combine(subDatastoreName)
|
||||
local new_datastore = DatastoreManager.connect(self.name..'.'..subDatastoreName)
|
||||
local new_datastore = DatastoreManager.connect(self.name .. "." .. subDatastoreName)
|
||||
self.children[subDatastoreName] = new_datastore
|
||||
new_datastore.value_name = subDatastoreName
|
||||
new_datastore.serializer = self.serializer
|
||||
@@ -431,7 +429,7 @@ end)
|
||||
|
||||
]]
|
||||
function Datastore:set_serializer(callback)
|
||||
assert(type(callback) == 'function', 'Callback must be a function')
|
||||
assert(type(callback) == "function", "Callback must be a function")
|
||||
self.serializer = callback
|
||||
end
|
||||
|
||||
@@ -501,7 +499,7 @@ function Datastore:set(key, value)
|
||||
else
|
||||
self:raw_set(key, value)
|
||||
end
|
||||
self:raise_event('on_update', key, value, old_value)
|
||||
self:raise_event("on_update", key, value, old_value)
|
||||
if self.auto_save then self:save(key) end
|
||||
return value
|
||||
end
|
||||
@@ -521,7 +519,7 @@ function Datastore:increment(key, delta)
|
||||
return self:set(key, value + (delta or 1))
|
||||
end
|
||||
|
||||
local function update_error(err) log('An error occurred in datastore update:\n\t'..trace(err)) end
|
||||
local function update_error(err) log("An error occurred in datastore update:\n\t" .. trace(err)) end
|
||||
--[[-- Use a function to update the value locally, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save
|
||||
@tparam any key The key that you want to apply the update to, must be a string unless a serializer is set
|
||||
@tparam function callback The function that will be used to update the value at this key
|
||||
@@ -546,7 +544,7 @@ function Datastore:update(key, callback)
|
||||
elseif raw_value == nil then
|
||||
self:set(key, value)
|
||||
else
|
||||
self:raise_event('on_update', key, value, old_value)
|
||||
self:raise_event("on_update", key, value, old_value)
|
||||
if self.auto_save then self:save(key) end
|
||||
end
|
||||
end
|
||||
@@ -563,12 +561,12 @@ function Datastore:remove(key)
|
||||
key = self:serialize(key)
|
||||
local old_value = self:raw_get(key)
|
||||
self:raw_set(key)
|
||||
self:raise_event('on_update', key, nil, old_value)
|
||||
if self.save_to_disk then self:write_action('remove', key) end
|
||||
self:raise_event("on_update", key, nil, old_value)
|
||||
if self.save_to_disk then self:write_action("remove", key) end
|
||||
if self.parent and self.parent.auto_save then return self.parent:save(key) end
|
||||
end
|
||||
|
||||
local function filter_error(err) log('An error ocurred in a datastore filter:\n\t'..trace(err)) end
|
||||
local function filter_error(err) log("An error ocurred in a datastore filter:\n\t" .. trace(err)) end
|
||||
--[[-- Internal, Used to filter elements from a table
|
||||
@tparam table tbl The table that will have the filter applied to it
|
||||
@tparam[opt] function callback The function that will be used as a filter, if none giving then the provided table is returned
|
||||
@@ -587,6 +585,7 @@ local function filter(tbl, callback)
|
||||
local success, add = xpcall(callback, filter_error, key, value)
|
||||
if success and add then rtn[key] = value end
|
||||
end
|
||||
|
||||
return rtn
|
||||
end
|
||||
|
||||
@@ -613,6 +612,7 @@ function Datastore:get_all(callback)
|
||||
for key, value in pairs(self.parent:get_all()) do
|
||||
data[key] = value[value_name]
|
||||
end
|
||||
|
||||
return filter(data, callback)
|
||||
end
|
||||
end
|
||||
@@ -635,7 +635,7 @@ function Datastore:update_all(callback)
|
||||
if success and new_value ~= nil then
|
||||
self:set(key, new_value)
|
||||
else
|
||||
self:raise_event('on_update', key, value, old_value)
|
||||
self:raise_event("on_update", key, value, old_value)
|
||||
if self.auto_save then self:save(key) end
|
||||
end
|
||||
end
|
||||
@@ -655,7 +655,7 @@ ExampleData:request('TestKey')
|
||||
function Datastore:request(key)
|
||||
if self.parent then return self.parent:request(key) end
|
||||
key = self:serialize(key)
|
||||
self:write_action('request', key)
|
||||
self:write_action("request", key)
|
||||
end
|
||||
|
||||
--[[-- Save a value to an external source, will trigger on_save before data is saved, save_to_disk must be set to true
|
||||
@@ -670,8 +670,8 @@ function Datastore:save(key)
|
||||
if self.parent then self.parent:save(key) end
|
||||
if not self.save_to_disk then return end
|
||||
key = self:serialize(key)
|
||||
local value = self:raise_event('on_save', key, copy(self:raw_get(key)))
|
||||
local action = self.propagate_changes and 'propagate' or 'save'
|
||||
local value = self:raise_event("on_save", key, copy(self:raw_get(key)))
|
||||
local action = self.propagate_changes and "propagate" or "save"
|
||||
self:write_action(action, key, value)
|
||||
end
|
||||
|
||||
@@ -686,7 +686,7 @@ ExampleData:unload('TestKey')
|
||||
function Datastore:unload(key)
|
||||
if self.parent then return self.parent:unload(key) end
|
||||
key = self:serialize(key)
|
||||
self:raise_event('on_unload', key, copy(self:raw_get(key)))
|
||||
self:raise_event("on_unload", key, copy(self:raw_get(key)))
|
||||
self:save(key)
|
||||
self:raw_set(key)
|
||||
end
|
||||
@@ -702,7 +702,7 @@ ExampleData:message('TestKey', 'Foo')
|
||||
]]
|
||||
function Datastore:message(key, message)
|
||||
key = self:serialize(key)
|
||||
self:write_action('message', key, message)
|
||||
self:write_action("message", key, message)
|
||||
end
|
||||
|
||||
--[[-- Save all the keys in the datastore, optional filter callback
|
||||
@@ -746,7 +746,7 @@ end
|
||||
----- Events
|
||||
-- @section events
|
||||
|
||||
local function event_error(err) log('An error ocurred in a datastore event handler:\n\t'..trace(err)) end
|
||||
local function event_error(err) log("An error ocurred in a datastore event handler:\n\t" .. trace(err)) end
|
||||
--[[-- Internal, Raise an event on this datastore
|
||||
@tparam string event_name The name of the event to raise for this datastore
|
||||
@tparam string key The key that this event is being raised for
|
||||
@@ -761,11 +761,11 @@ value = self:raise_event('on_save', key, value)
|
||||
]]
|
||||
function Datastore:raise_event(event_name, key, value, old_value, source)
|
||||
-- Raise the event for the children of this datastore
|
||||
if source ~= 'child' and next(self.children) then
|
||||
if type(value) ~= 'table' then value = {} end
|
||||
if source ~= "child" and next(self.children) then
|
||||
if type(value) ~= "table" then value = {} end
|
||||
for value_name, child in pairs(self.children) do
|
||||
local old_child_value = old_value and old_value[value_name] or nil
|
||||
value[value_name] = child:raise_event(event_name, key, value[value_name], old_child_value, 'parent')
|
||||
value[value_name] = child:raise_event(event_name, key, value[value_name], old_child_value, "parent")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -779,13 +779,13 @@ function Datastore:raise_event(event_name, key, value, old_value, source)
|
||||
end
|
||||
|
||||
-- Raise the event for the parent of this datastore
|
||||
if source ~= 'parent' and self.parent then
|
||||
if source ~= "parent" and self.parent then
|
||||
local parent_value = self.parent:raw_get(key, true)
|
||||
self.parent:raise_event(event_name, key, parent_value, parent_value, 'child')
|
||||
self.parent:raise_event(event_name, key, parent_value, parent_value, "child")
|
||||
end
|
||||
|
||||
-- If this is the save event and the table is empty then return nil
|
||||
if event_name == 'on_save' and next(self.children) and not next(value) then return end
|
||||
if event_name == "on_save" and next(self.children) and not next(value) then return end
|
||||
return value
|
||||
end
|
||||
|
||||
@@ -799,7 +799,7 @@ Datastore.on_load = event_factory('on_load')
|
||||
]]
|
||||
local function event_factory(event_name)
|
||||
return function(self, callback)
|
||||
assert(type(callback) == 'function', 'Handler must be a function')
|
||||
assert(type(callback) == "function", "Handler must be a function")
|
||||
local handlers = self.events[event_name]
|
||||
if not handlers then
|
||||
self.events[event_name] = { callback }
|
||||
@@ -817,7 +817,7 @@ ExampleData:on_load(function(key, value)
|
||||
game.print('Test data loaded for: '..key)
|
||||
end)
|
||||
]]
|
||||
Datastore.on_load = event_factory('on_load')
|
||||
Datastore.on_load = event_factory("on_load")
|
||||
|
||||
--[[-- Register a callback that triggers before data is saved, returned value is saved externally
|
||||
@tparam function callback The handler that will be registered to the on_load event
|
||||
@@ -827,7 +827,7 @@ ExampleData:on_save(function(key, value)
|
||||
game.print('Test data saved for: '..key)
|
||||
end)
|
||||
]]
|
||||
Datastore.on_save = event_factory('on_save')
|
||||
Datastore.on_save = event_factory("on_save")
|
||||
|
||||
--[[-- Register a callback that triggers before data is unloaded, returned value is ignored
|
||||
@tparam function callback The handler that will be registered to the on_load event
|
||||
@@ -837,7 +837,7 @@ ExampleData:on_load(function(key, value)
|
||||
game.print('Test data unloaded for: '..key)
|
||||
end)
|
||||
]]
|
||||
Datastore.on_unload = event_factory('on_unload')
|
||||
Datastore.on_unload = event_factory("on_unload")
|
||||
|
||||
--[[-- Register a callback that triggers when a message is received, returned value is ignored
|
||||
@tparam function callback The handler that will be registered to the on_load event
|
||||
@@ -847,7 +847,7 @@ ExampleData:on_message(function(key, value)
|
||||
game.print('Test data message for: '..key)
|
||||
end)
|
||||
]]
|
||||
Datastore.on_message = event_factory('on_message')
|
||||
Datastore.on_message = event_factory("on_message")
|
||||
|
||||
--[[-- Register a callback that triggers any time a value is changed, returned value is ignored
|
||||
@tparam function callback The handler that will be registered to the on_load event
|
||||
@@ -857,7 +857,7 @@ ExampleData:on_update(function(key, value)
|
||||
game.print('Test data updated for: '..key)
|
||||
end)
|
||||
]]
|
||||
Datastore.on_update = event_factory('on_update')
|
||||
Datastore.on_update = event_factory("on_update")
|
||||
|
||||
----- Module Return
|
||||
return DatastoreManager
|
||||
|
||||
@@ -47,8 +47,8 @@ local servers = External.get_servers()
|
||||
|
||||
]]
|
||||
function External.get_servers()
|
||||
assert(ext, 'No external data was found, use External.valid() to ensure external data exists.')
|
||||
return assert(ext.servers, 'No server list was found, please ensure that the external service is running')
|
||||
assert(ext, "No external data was found, use External.valid() to ensure external data exists.")
|
||||
return assert(ext.servers, "No server list was found, please ensure that the external service is running")
|
||||
end
|
||||
|
||||
--[[-- Gets a table of all the servers filtered by name, key is the server id, value is the server details
|
||||
@@ -60,14 +60,15 @@ local servers = External.get_servers_filtered(public)
|
||||
|
||||
]]
|
||||
function External.get_servers_filtered(search)
|
||||
assert(ext, 'No external data was found, use External.valid() to ensure external data exists.')
|
||||
local servers = assert(ext.servers, 'No server list was found, please ensure that the external service is running')
|
||||
assert(ext, "No external data was found, use External.valid() to ensure external data exists.")
|
||||
local servers = assert(ext.servers, "No server list was found, please ensure that the external service is running")
|
||||
local found_servers = {}
|
||||
search = search:lower()
|
||||
for server_id, server in pairs(servers) do
|
||||
local str = concat{ server.name, server.short_name, server.id }
|
||||
if str:lower():find(search, 1, true) then found_servers[server_id] = server end
|
||||
end
|
||||
|
||||
return found_servers
|
||||
end
|
||||
|
||||
@@ -79,9 +80,9 @@ local server = External.get_current_server()
|
||||
|
||||
]]
|
||||
function External.get_current_server()
|
||||
assert(ext, 'No external data was found, use External.valid() to ensure external data exists.')
|
||||
local servers = assert(ext.servers, 'No server list was found, please ensure that the external service is running')
|
||||
local server_id = assert(ext.current, 'No current id was found, please ensure that the external service is running')
|
||||
assert(ext, "No external data was found, use External.valid() to ensure external data exists.")
|
||||
local servers = assert(ext.servers, "No server list was found, please ensure that the external service is running")
|
||||
local server_id = assert(ext.current, "No current id was found, please ensure that the external service is running")
|
||||
return servers[server_id]
|
||||
end
|
||||
|
||||
@@ -94,8 +95,8 @@ local server = External.get_server_details('eu-01')
|
||||
|
||||
]]
|
||||
function External.get_server_details(server_id)
|
||||
assert(ext, 'No external data was found, use External.valid() to ensure external data exists.')
|
||||
local servers = assert(ext.servers, 'No server list was found, please ensure that the external service is running')
|
||||
assert(ext, "No external data was found, use External.valid() to ensure external data exists.")
|
||||
local servers = assert(ext.servers, "No server list was found, please ensure that the external service is running")
|
||||
return servers[server_id]
|
||||
end
|
||||
|
||||
@@ -109,10 +110,10 @@ local status = External.get_server_status('eu-01')
|
||||
|
||||
]]
|
||||
function External.get_server_status(server_id, raw)
|
||||
assert(var, 'No external data was found, use External.valid() to ensure external data exists.')
|
||||
local servers = assert(var.status, 'No server status was found, please ensure that the external service is running')
|
||||
local current = assert(ext.current, 'No current id was found, please ensure that the external service is running')
|
||||
return not raw and server_id == current and 'Current' or servers[server_id]
|
||||
assert(var, "No external data was found, use External.valid() to ensure external data exists.")
|
||||
local servers = assert(var.status, "No server status was found, please ensure that the external service is running")
|
||||
local current = assert(ext.current, "No current id was found, please ensure that the external service is running")
|
||||
return not raw and server_id == current and "Current" or servers[server_id]
|
||||
end
|
||||
|
||||
--[[-- Gets the ups of the current server
|
||||
@@ -121,8 +122,8 @@ local server_ups = External.get_server_ups()
|
||||
|
||||
]]
|
||||
function External.get_server_ups()
|
||||
assert(var, 'No external data was found, use External.valid() to ensure external data exists.')
|
||||
return assert(var.server_ups, 'No server ups was found, please ensure that the external service is running')
|
||||
assert(var, "No external data was found, use External.valid() to ensure external data exists.")
|
||||
return assert(var.server_ups, "No server ups was found, please ensure that the external service is running")
|
||||
end
|
||||
|
||||
--[[-- Connect a player to the given server
|
||||
@@ -138,14 +139,14 @@ External.request_connection(player, 'eu-01', true)
|
||||
|
||||
]]
|
||||
function External.request_connection(player, server_id, self_requested)
|
||||
local server = { address = server_id, name = 'Unknown Server', description = 'This server is not ran by us, please check the address of the server.' }
|
||||
local server = { address = server_id, name = "Unknown Server", description = "This server is not ran by us, please check the address of the server." }
|
||||
if ext and ext.servers and ext.servers[server_id] then server = ext.servers[server_id] end
|
||||
local message = 'Please press the connect button below to join.'
|
||||
if not self_requested then message = 'You have been asked to switch to a different server.\n'..message end
|
||||
local message = "Please press the connect button below to join."
|
||||
if not self_requested then message = "You have been asked to switch to a different server.\n" .. message end
|
||||
player.connect_to_server{
|
||||
address = server.address,
|
||||
name = '\n[color=orange][font=heading-1]'..server.name..'[/font][/color]\n',
|
||||
description = server.description..'\n'..message
|
||||
name = "\n[color=orange][font=heading-1]" .. server.name .. "[/font][/color]\n",
|
||||
description = server.description .. "\n" .. message,
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -140,5 +140,4 @@ if Roles and Event then
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
return Gui
|
||||
@@ -13,16 +13,16 @@ local Event = require("modules/exp_legacy/utils/event")
|
||||
-- @element hide_top_flow
|
||||
local hide_top_flow =
|
||||
Gui.element{
|
||||
type = 'sprite-button',
|
||||
sprite = 'utility/preset',
|
||||
style = 'tool_button',
|
||||
tooltip = {'gui_util.button_tooltip'},
|
||||
name = Gui.unique_static_name
|
||||
type = "sprite-button",
|
||||
sprite = "utility/preset",
|
||||
style = "tool_button",
|
||||
tooltip = { "gui_util.button_tooltip" },
|
||||
name = Gui.unique_static_name,
|
||||
}
|
||||
:style{
|
||||
padding = -2,
|
||||
width = 18,
|
||||
height = 36
|
||||
height = 36,
|
||||
}
|
||||
:on_click(function(player, _, _)
|
||||
Gui.toggle_top_flow(player, false)
|
||||
@@ -33,16 +33,16 @@ Gui.core_defines.hide_top_flow = hide_top_flow
|
||||
-- @element show_top_flow
|
||||
local show_top_flow =
|
||||
Gui.element{
|
||||
type = 'sprite-button',
|
||||
sprite = 'utility/preset',
|
||||
style = 'tool_button',
|
||||
tooltip = {'gui_util.button_tooltip'},
|
||||
name = Gui.unique_static_name
|
||||
type = "sprite-button",
|
||||
sprite = "utility/preset",
|
||||
style = "tool_button",
|
||||
tooltip = { "gui_util.button_tooltip" },
|
||||
name = Gui.unique_static_name,
|
||||
}
|
||||
:style{
|
||||
padding = -2,
|
||||
width = 18,
|
||||
height = 20
|
||||
height = 20,
|
||||
}
|
||||
:on_click(function(player, _, _)
|
||||
Gui.toggle_top_flow(player, true)
|
||||
@@ -53,16 +53,16 @@ Gui.core_defines.show_top_flow = show_top_flow
|
||||
-- @element hide_left_flow
|
||||
local hide_left_flow =
|
||||
Gui.element{
|
||||
type = 'sprite-button',
|
||||
sprite = 'utility/close_black',
|
||||
style = 'tool_button',
|
||||
tooltip = {'expcore-gui.left-button-tooltip'},
|
||||
name = Gui.unique_static_name
|
||||
type = "sprite-button",
|
||||
sprite = "utility/close_black",
|
||||
style = "tool_button",
|
||||
tooltip = { "expcore-gui.left-button-tooltip" },
|
||||
name = Gui.unique_static_name,
|
||||
}
|
||||
:style{
|
||||
padding = -3,
|
||||
width = 18,
|
||||
height = 20
|
||||
height = 20,
|
||||
}
|
||||
:on_click(function(player, _, _)
|
||||
Gui.hide_left_flow(player)
|
||||
@@ -80,7 +80,7 @@ Event.add(defines.events.on_player_created, function(event)
|
||||
|
||||
-- Draw the left flow
|
||||
local left_flow = Gui.get_left_flow(player)
|
||||
local button_flow = left_flow.add{ type = 'flow', name = 'gui_core_buttons', direction = 'vertical' }
|
||||
local button_flow = left_flow.add{ type = "flow", name = "gui_core_buttons", direction = "vertical" }
|
||||
local show_top = show_top_flow(button_flow)
|
||||
local hide_left = hide_left_flow(button_flow)
|
||||
show_top.visible = false
|
||||
|
||||
@@ -26,16 +26,16 @@ local alignment = Gui.alignment(element, 'example_center_top_alignment', 'center
|
||||
Gui.alignment =
|
||||
Gui.element(function(_, parent, name, _, _)
|
||||
return parent.add{
|
||||
name = name or 'alignment',
|
||||
type = 'flow',
|
||||
name = name or "alignment",
|
||||
type = "flow",
|
||||
}
|
||||
end)
|
||||
:style(function(style, _, _, horizontal_align, vertical_align)
|
||||
style.padding = { 1, 2 }
|
||||
style.vertical_align = vertical_align or 'center'
|
||||
style.horizontal_align = horizontal_align or 'right'
|
||||
style.vertically_stretchable = style.vertical_align ~= 'center'
|
||||
style.horizontally_stretchable = style.horizontal_align ~= 'center'
|
||||
style.vertical_align = vertical_align or "center"
|
||||
style.horizontal_align = horizontal_align or "right"
|
||||
style.vertically_stretchable = style.vertical_align ~= "center"
|
||||
style.horizontally_stretchable = style.horizontal_align ~= "center"
|
||||
end)
|
||||
|
||||
--[[-- Draw a scroll pane that has a table inside of it
|
||||
@@ -55,12 +55,12 @@ Gui.element(function(_, parent, height, column_count, name)
|
||||
-- Draw the scroll
|
||||
local scroll_pane =
|
||||
parent.add{
|
||||
name = name or 'scroll',
|
||||
type = 'scroll-pane',
|
||||
direction = 'vertical',
|
||||
horizontal_scroll_policy = 'never',
|
||||
vertical_scroll_policy = 'auto',
|
||||
style = 'scroll_pane_under_subheader'
|
||||
name = name or "scroll",
|
||||
type = "scroll-pane",
|
||||
direction = "vertical",
|
||||
horizontal_scroll_policy = "never",
|
||||
vertical_scroll_policy = "auto",
|
||||
style = "scroll_pane_under_subheader",
|
||||
}
|
||||
|
||||
-- Set the style of the scroll pane
|
||||
@@ -72,9 +72,9 @@ Gui.element(function(_, parent, height, column_count, name)
|
||||
-- Draw the table
|
||||
local scroll_table =
|
||||
scroll_pane.add{
|
||||
type = 'table',
|
||||
name = 'table',
|
||||
column_count = column_count
|
||||
type = "table",
|
||||
name = "table",
|
||||
column_count = column_count,
|
||||
}
|
||||
|
||||
-- Return the scroll table
|
||||
@@ -83,8 +83,8 @@ end)
|
||||
:style{
|
||||
padding = 0,
|
||||
cell_padding = 0,
|
||||
vertical_align = 'center',
|
||||
horizontally_stretchable = true
|
||||
vertical_align = "center",
|
||||
horizontally_stretchable = true,
|
||||
}
|
||||
|
||||
--[[-- Used to add a frame with the header style, has the option for a right alignment flow for buttons
|
||||
@@ -109,9 +109,9 @@ Gui.element(function(_, parent, caption, tooltip, add_alignment, name, label_nam
|
||||
-- Draw the header
|
||||
local header =
|
||||
parent.add{
|
||||
name = name or 'header',
|
||||
type = 'frame',
|
||||
style = 'subheader_frame'
|
||||
name = name or "header",
|
||||
type = "frame",
|
||||
style = "subheader_frame",
|
||||
}
|
||||
|
||||
-- Change the style of the header
|
||||
@@ -123,11 +123,11 @@ Gui.element(function(_, parent, caption, tooltip, add_alignment, name, label_nam
|
||||
-- Draw the caption label
|
||||
if caption then
|
||||
header.add{
|
||||
name = label_name or 'header_label',
|
||||
type = 'label',
|
||||
style = 'frame_title',
|
||||
name = label_name or "header_label",
|
||||
type = "label",
|
||||
style = "frame_title",
|
||||
caption = caption,
|
||||
tooltip = tooltip
|
||||
tooltip = tooltip,
|
||||
}
|
||||
end
|
||||
|
||||
@@ -157,9 +157,9 @@ Gui.element(function(_, parent, caption, tooltip, add_alignment, name)
|
||||
-- Draw the header
|
||||
local footer =
|
||||
parent.add{
|
||||
name = name or 'footer',
|
||||
type = 'frame',
|
||||
style = 'subfooter_frame'
|
||||
name = name or "footer",
|
||||
type = "frame",
|
||||
style = "subfooter_frame",
|
||||
}
|
||||
|
||||
-- Change the style of the footer
|
||||
@@ -171,11 +171,11 @@ Gui.element(function(_, parent, caption, tooltip, add_alignment, name)
|
||||
-- Draw the caption label
|
||||
if caption then
|
||||
footer.add{
|
||||
name = 'footer_label',
|
||||
type = 'label',
|
||||
style = 'frame_title',
|
||||
name = "footer_label",
|
||||
type = "label",
|
||||
style = "frame_title",
|
||||
caption = caption,
|
||||
tooltip = tooltip
|
||||
tooltip = tooltip,
|
||||
}
|
||||
end
|
||||
|
||||
@@ -199,16 +199,16 @@ Gui.element(function(_, parent, name, _)
|
||||
local frame =
|
||||
parent.add{
|
||||
name = name,
|
||||
type = 'frame'
|
||||
type = "frame",
|
||||
}
|
||||
frame.style.horizontally_stretchable = false
|
||||
|
||||
-- Return the container
|
||||
return frame.add{
|
||||
name = 'container',
|
||||
type = 'frame',
|
||||
direction = 'vertical',
|
||||
style = 'inside_shallow_frame_packed'
|
||||
name = "container",
|
||||
type = "frame",
|
||||
direction = "vertical",
|
||||
style = "inside_shallow_frame_packed",
|
||||
}
|
||||
end)
|
||||
:style(function(style, element, _, width)
|
||||
@@ -230,16 +230,19 @@ local bar = Gui.bar(parent, 100)
|
||||
Gui.bar =
|
||||
Gui.element(function(_, parent)
|
||||
return parent.add{
|
||||
type = 'progressbar',
|
||||
type = "progressbar",
|
||||
size = 1,
|
||||
value = 1
|
||||
value = 1,
|
||||
}
|
||||
end)
|
||||
:style(function(style, _, width)
|
||||
style.height = 3
|
||||
style.color = { r = 255, g = 255, b = 255 }
|
||||
if width then style.width = width
|
||||
else style.horizontally_stretchable = true end
|
||||
if width then
|
||||
style.width = width
|
||||
else
|
||||
style.horizontally_stretchable = true
|
||||
end
|
||||
end)
|
||||
|
||||
--[[-- Used to make a label which is centered and of a certian size
|
||||
@@ -256,13 +259,13 @@ local label = Gui.centered_label(parent, 100, 'This is centered')
|
||||
Gui.centered_label =
|
||||
Gui.element(function(_, parent, width, caption, tooltip)
|
||||
local label = parent.add{
|
||||
type = 'label',
|
||||
type = "label",
|
||||
caption = caption,
|
||||
tooltip = tooltip,
|
||||
}
|
||||
|
||||
local style = label.style
|
||||
style.horizontal_align = 'center'
|
||||
style.horizontal_align = "center"
|
||||
style.single_line = false
|
||||
style.width = width
|
||||
|
||||
@@ -282,15 +285,15 @@ local label = Gui.centered_label(parent, 100, 'This is centered')
|
||||
]]
|
||||
Gui.title_label =
|
||||
Gui.element(function(_, parent, width, caption, tooltip)
|
||||
local title_flow = parent.add{ type='flow' }
|
||||
title_flow.style.vertical_align = 'center'
|
||||
local title_flow = parent.add{ type = "flow" }
|
||||
title_flow.style.vertical_align = "center"
|
||||
|
||||
Gui.bar(title_flow, width)
|
||||
local title_label = title_flow.add{
|
||||
type = 'label',
|
||||
type = "label",
|
||||
caption = caption,
|
||||
tooltip = tooltip,
|
||||
style = 'frame_title'
|
||||
style = "frame_title",
|
||||
}
|
||||
Gui.bar(title_flow)
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
]]
|
||||
|
||||
local Gui = require("modules.exp_legacy.expcore.gui.prototype")
|
||||
local mod_gui = require 'mod-gui'
|
||||
local mod_gui = require "mod-gui"
|
||||
|
||||
local hide_left_flow = Gui.core_defines.hide_left_flow.name
|
||||
|
||||
@@ -12,7 +12,7 @@ local hide_left_flow = Gui.core_defines.hide_left_flow.name
|
||||
-- @section leftFlow
|
||||
|
||||
-- Triggered when a user changed the visibility of a left flow element by clicking a button
|
||||
Gui.events.on_visibility_changed_by_click = 'on_visibility_changed_by_click'
|
||||
Gui.events.on_visibility_changed_by_click = "on_visibility_changed_by_click"
|
||||
|
||||
--- Contains the uids of the elements that will shown on the left flow and their join functions
|
||||
-- @table left_elements
|
||||
@@ -68,7 +68,7 @@ function Gui.left_toolbar_button(sprite, tooltip, element_define, authenticator)
|
||||
button:raise_event{
|
||||
name = Gui.events.on_visibility_changed_by_click,
|
||||
element = Gui.get_top_element(player, button),
|
||||
state = Gui.toggle_left_element(player, element_define)
|
||||
state = Gui.toggle_left_element(player, element_define),
|
||||
}
|
||||
end)
|
||||
|
||||
@@ -121,17 +121,17 @@ function Gui.draw_left_flow(player)
|
||||
end, debug.traceback)
|
||||
|
||||
if not draw_success then
|
||||
log('There as been an error with an element draw function: '..element_define.defined_at..'\n\t'..left_element)
|
||||
log("There as been an error with an element draw function: " .. element_define.defined_at .. "\n\t" .. left_element)
|
||||
goto continue
|
||||
end
|
||||
|
||||
-- Check if it should be open by default
|
||||
local open_on_join = element_define.open_on_join
|
||||
local visible = type(open_on_join) == 'boolean' and open_on_join or false
|
||||
if type(open_on_join) == 'function' then
|
||||
local visible = type(open_on_join) == "boolean" and open_on_join or false
|
||||
if type(open_on_join) == "function" then
|
||||
local success, err = xpcall(open_on_join, debug.traceback, player)
|
||||
if not success then
|
||||
log('There as been an error with an open on join hander for a gui element:\n\t'..err)
|
||||
log("There as been an error with an open on join hander for a gui element:\n\t" .. err)
|
||||
goto continue
|
||||
end
|
||||
visible = err
|
||||
@@ -188,6 +188,7 @@ function Gui.update_left_flow(player)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
hide_button.visible = false
|
||||
return false
|
||||
end
|
||||
@@ -220,7 +221,7 @@ function Gui.hide_left_flow(player)
|
||||
element_define.toolbar_button:raise_event{
|
||||
name = Gui.events.on_visibility_changed_by_click,
|
||||
element = button,
|
||||
state = false
|
||||
state = false,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,7 +23,7 @@ local Gui = {
|
||||
--- The prototype used to store the functions of an element define
|
||||
_prototype_element = {},
|
||||
--- The prototype metatable applied to new element defines
|
||||
_mt_element = {}
|
||||
_mt_element = {},
|
||||
}
|
||||
|
||||
--- Allow access to the element prototype methods
|
||||
@@ -115,10 +115,10 @@ function Gui.element(element_define)
|
||||
local uid = Gui.uid + 1
|
||||
Gui.uid = uid
|
||||
element.uid = uid
|
||||
Gui.debug_info[uid] = { draw = 'None', style = 'None', events = {} }
|
||||
Gui.debug_info[uid] = { draw = "None", style = "None", events = {} }
|
||||
|
||||
-- Add the definition function
|
||||
if type(element_define) == 'table' then
|
||||
if type(element_define) == "table" then
|
||||
Gui.debug_info[uid].draw = element_define
|
||||
if element_define.name == Gui.unique_static_name then
|
||||
element_define.name = "ExpGui_" .. tostring(uid)
|
||||
@@ -128,6 +128,7 @@ function Gui.element(element_define)
|
||||
element[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
element._draw = function(_, parent)
|
||||
return parent.add(element_define)
|
||||
end
|
||||
@@ -183,7 +184,7 @@ end)
|
||||
function Gui._prototype_element:style(style_define)
|
||||
_C.error_if_runtime()
|
||||
-- Add the definition function
|
||||
if type(style_define) == 'table' then
|
||||
if type(style_define) == "table" then
|
||||
Gui.debug_info[self.uid].style = style_define
|
||||
self._style = function(style)
|
||||
for key, value in pairs(style_define) do
|
||||
@@ -295,7 +296,7 @@ function Gui._prototype_element:raise_event(event)
|
||||
|
||||
local success, err = xpcall(handler, debug.traceback, player, element, event)
|
||||
if not success then
|
||||
error('There as been an error with an event handler for a gui element:\n\t'..err)
|
||||
error("There as been an error with an event handler for a gui element:\n\t" .. err)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
]]
|
||||
|
||||
local Gui = require("modules.exp_legacy.expcore.gui.prototype")
|
||||
local mod_gui = require 'mod-gui' --- @dep mod-gui
|
||||
local mod_gui = require "mod-gui" --- @dep mod-gui
|
||||
|
||||
local toolbar_button_size = 36
|
||||
local hide_top_flow = Gui.core_defines.hide_top_flow.name
|
||||
@@ -14,7 +14,7 @@ local show_top_flow = Gui.core_defines.show_top_flow.name
|
||||
-- @section topFlow
|
||||
|
||||
-- Triggered when a user changed the visibility of a left flow element by clicking a button
|
||||
Gui.events.on_toolbar_button_toggled = 'on_toolbar_button_toggled'
|
||||
Gui.events.on_toolbar_button_toggled = "on_toolbar_button_toggled"
|
||||
|
||||
--- Contains the uids of the elements that will shown on the top flow and their auth functions
|
||||
-- @table top_elements
|
||||
@@ -26,7 +26,7 @@ Gui.top_flow_button_style = mod_gui.button_style
|
||||
|
||||
--- The style that should be used for buttons on the top flow when their flow is visible
|
||||
-- @field Gui.top_flow_button_toggled_style
|
||||
Gui.top_flow_button_toggled_style = 'menu_button_continue'
|
||||
Gui.top_flow_button_toggled_style = "menu_button_continue"
|
||||
|
||||
--[[-- Styles a top flow button depending on the state given
|
||||
@tparam LuaGuiElement button the button element to style
|
||||
@@ -142,7 +142,7 @@ function Gui.update_top_flow(player)
|
||||
|
||||
-- Set the visible state
|
||||
local allowed = element_define.authenticator
|
||||
if type(allowed) == 'function' then allowed = allowed(player) end
|
||||
if type(allowed) == "function" then allowed = allowed(player) end
|
||||
element.visible = allowed or false
|
||||
|
||||
-- If its not visible and there is a left element, then hide it
|
||||
@@ -243,7 +243,7 @@ function Gui.toggle_toolbar_button(player, element_define, state)
|
||||
name = Gui.events.on_toolbar_button_toggled,
|
||||
element = toolbar_button,
|
||||
player = player,
|
||||
state = state
|
||||
state = state,
|
||||
}
|
||||
return state
|
||||
end
|
||||
@@ -262,16 +262,16 @@ end)
|
||||
]]
|
||||
function Gui.toolbar_button(sprite, tooltip, authenticator)
|
||||
return Gui.element{
|
||||
type = 'sprite-button',
|
||||
type = "sprite-button",
|
||||
sprite = sprite,
|
||||
tooltip = tooltip,
|
||||
style = Gui.top_flow_button_style,
|
||||
name = Gui.unique_static_name
|
||||
name = Gui.unique_static_name,
|
||||
}
|
||||
:style{
|
||||
minimal_width = toolbar_button_size,
|
||||
height = toolbar_button_size,
|
||||
padding = -2
|
||||
padding = -2,
|
||||
}
|
||||
:add_to_top_flow(authenticator)
|
||||
end
|
||||
@@ -294,16 +294,16 @@ end)
|
||||
function Gui.toolbar_toggle_button(sprite, tooltip, authenticator)
|
||||
local button =
|
||||
Gui.element{
|
||||
type = 'sprite-button',
|
||||
type = "sprite-button",
|
||||
sprite = sprite,
|
||||
tooltip = tooltip,
|
||||
style = Gui.top_flow_button_style,
|
||||
name = Gui.unique_static_name
|
||||
name = Gui.unique_static_name,
|
||||
}
|
||||
:style{
|
||||
minimal_width = toolbar_button_size,
|
||||
height = toolbar_button_size,
|
||||
padding = -2
|
||||
padding = -2,
|
||||
}
|
||||
:add_to_top_flow(authenticator)
|
||||
|
||||
|
||||
@@ -23,14 +23,13 @@ Permission_Groups.new_group('Restricted') -- this defines a new group called "Re
|
||||
|
||||
]]
|
||||
|
||||
|
||||
local Game = require("modules.exp_legacy.utils.game") --- @dep utils.game
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Async = require("modules/exp_util/async")
|
||||
|
||||
local Permissions_Groups = {
|
||||
groups = {}, -- store for the different groups that are created
|
||||
_prototype={} -- stores functions that are used on group instances
|
||||
_prototype = {}, -- stores functions that are used on group instances
|
||||
}
|
||||
|
||||
-- Async function to add players to permission groups
|
||||
@@ -63,9 +62,9 @@ function Permissions_Groups.new_group(name)
|
||||
local group = setmetatable({
|
||||
name = name,
|
||||
actions = {},
|
||||
allow_all_actions=true
|
||||
allow_all_actions = true,
|
||||
}, {
|
||||
__index= Permissions_Groups._prototype
|
||||
__index = Permissions_Groups._prototype,
|
||||
})
|
||||
Permissions_Groups.groups[name] = group
|
||||
return group
|
||||
@@ -149,7 +148,7 @@ group:set_action('toggle_map_editor', false)
|
||||
function Permissions_Groups._prototype:set_action(action, state)
|
||||
local input_action = defines.input_action[action]
|
||||
if input_action == nil then input_action = action end
|
||||
assert(type(input_action) == 'number', tostring(action)..' is not a valid input action')
|
||||
assert(type(input_action) == "number", tostring(action) .. " is not a valid input action")
|
||||
self.actions[input_action] = state
|
||||
return self
|
||||
end
|
||||
@@ -165,12 +164,13 @@ group:allow{
|
||||
|
||||
]]
|
||||
function Permissions_Groups._prototype:allow(actions)
|
||||
if type(actions) ~= 'table' then
|
||||
if type(actions) ~= "table" then
|
||||
actions = { actions }
|
||||
end
|
||||
for _, action in pairs(actions) do
|
||||
self:set_action(action, true)
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -189,12 +189,13 @@ group:disallow{
|
||||
|
||||
]]
|
||||
function Permissions_Groups._prototype:disallow(actions)
|
||||
if type(actions) ~= 'table' then
|
||||
if type(actions) ~= "table" then
|
||||
actions = { actions }
|
||||
end
|
||||
for _, action in pairs(actions) do
|
||||
self:set_action(action, false)
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -231,7 +232,7 @@ local allowed = group:is_allowed('write_to_console')
|
||||
|
||||
]]
|
||||
function Permissions_Groups._prototype:is_allowed(action)
|
||||
if type(action) == 'string' then
|
||||
if type(action) == "string" then
|
||||
action = defines.input_action[action]
|
||||
end
|
||||
local state = self.actions[action]
|
||||
@@ -260,6 +261,7 @@ function Permissions_Groups._prototype:create()
|
||||
for _, action in pairs(defines.input_action) do
|
||||
group.set_allows_action(action, self:is_allowed(action))
|
||||
end
|
||||
|
||||
return group
|
||||
end
|
||||
|
||||
@@ -347,6 +349,7 @@ function Permissions_Groups._prototype:print(message)
|
||||
for _, player in pairs(players) do
|
||||
player.print(message)
|
||||
end
|
||||
|
||||
return #players
|
||||
end
|
||||
|
||||
|
||||
@@ -48,41 +48,42 @@ local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse") --- @dep config.expcore.command_general_parse
|
||||
|
||||
--- Common player data that acts as the root store for player data
|
||||
local PlayerData = Datastore.connect('PlayerData', true) -- saveToDisk
|
||||
local PlayerData = Datastore.connect("PlayerData", true) -- saveToDisk
|
||||
PlayerData:set_serializer(Datastore.name_serializer) -- use player name
|
||||
|
||||
--- Store and enum for the data saving preference
|
||||
local DataSavingPreference = PlayerData:combine('DataSavingPreference')
|
||||
local PreferenceEnum = { 'All', 'Statistics', 'Settings', 'Required' }
|
||||
local DataSavingPreference = PlayerData:combine("DataSavingPreference")
|
||||
local PreferenceEnum = { "All", "Statistics", "Settings", "Required" }
|
||||
for k, v in ipairs(PreferenceEnum) do PreferenceEnum[v] = k end
|
||||
DataSavingPreference:set_default('All')
|
||||
|
||||
DataSavingPreference:set_default("All")
|
||||
DataSavingPreference:set_metadata{
|
||||
name = {'expcore-data.preference'},
|
||||
tooltip = {'expcore-data.preference-tooltip'},
|
||||
value_tooltip ={'expcore-data.preference-value-tooltip'}
|
||||
name = { "expcore-data.preference" },
|
||||
tooltip = { "expcore-data.preference-tooltip" },
|
||||
value_tooltip = { "expcore-data.preference-value-tooltip" },
|
||||
}
|
||||
|
||||
--- Sets your data saving preference
|
||||
-- @command set-data-preference
|
||||
Commands.new_command('set-preference', 'Allows you to set your data saving preference')
|
||||
:add_param('option', false, 'string-options', PreferenceEnum)
|
||||
Commands.new_command("set-preference", "Allows you to set your data saving preference")
|
||||
:add_param("option", false, "string-options", PreferenceEnum)
|
||||
:register(function(player, option)
|
||||
DataSavingPreference:set(player, option)
|
||||
return {'expcore-data.set-preference', option}
|
||||
return { "expcore-data.set-preference", option }
|
||||
end)
|
||||
|
||||
--- Gets your data saving preference
|
||||
-- @command data-preference
|
||||
Commands.new_command('preference', 'Shows you what your current data saving preference is')
|
||||
Commands.new_command("preference", "Shows you what your current data saving preference is")
|
||||
:register(function(player)
|
||||
return {'expcore-data.get-preference', DataSavingPreference:get(player)}
|
||||
return { "expcore-data.get-preference", DataSavingPreference:get(player) }
|
||||
end)
|
||||
|
||||
--- Gets your data and writes it to a file
|
||||
Commands.new_command('save-data', 'Writes all your player data to a file on your computer')
|
||||
Commands.new_command("save-data", "Writes all your player data to a file on your computer")
|
||||
:register(function(player)
|
||||
player.print{'expcore-data.get-data'}
|
||||
game.write_file('expgaming_player_data.json', game.table_to_json(PlayerData:get(player, {})), false, player.index)
|
||||
player.print{ "expcore-data.get-data" }
|
||||
game.write_file("expgaming_player_data.json", game.table_to_json(PlayerData:get(player, {})), false, player.index)
|
||||
end)
|
||||
|
||||
--- Async function called after 5 seconds with no player data loaded
|
||||
@@ -90,8 +91,8 @@ local check_data_loaded_async =
|
||||
Async.register(function(player)
|
||||
local player_data = PlayerData:get(player)
|
||||
if not player_data or not player_data.valid then
|
||||
player.print{'expcore-data.data-failed'}
|
||||
Datastore.ingest('request', 'PlayerData', player.name, '{"valid":false}')
|
||||
player.print{ "expcore-data.data-failed" }
|
||||
Datastore.ingest("request", "PlayerData", player.name, '{"valid":false}')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -99,7 +100,7 @@ end)
|
||||
PlayerData:on_load(function(player_name, player_data, existing_data)
|
||||
if not player_data or player_data.valid == false then return end
|
||||
if existing_data and existing_data.valid == false then
|
||||
game.players[player_name].print{'expcore-data.data-restore'}
|
||||
game.players[player_name].print{ "expcore-data.data-restore" }
|
||||
end
|
||||
player_data.valid = true
|
||||
end)
|
||||
@@ -122,7 +123,7 @@ end)
|
||||
|
||||
--- Display your data preference when your data loads
|
||||
DataSavingPreference:on_load(function(player_name, dataPreference)
|
||||
game.players[player_name].print{'expcore-data.get-preference', dataPreference or DataSavingPreference.default}
|
||||
game.players[player_name].print{ "expcore-data.get-preference", dataPreference or DataSavingPreference.default }
|
||||
end)
|
||||
|
||||
--- Load player data when they join
|
||||
@@ -139,15 +140,17 @@ Event.add(defines.events.on_player_left_game, function(event)
|
||||
local player_data = PlayerData:get(player)
|
||||
if player_data and player_data.valid == true then
|
||||
PlayerData:unload(player)
|
||||
else PlayerData:raw_set(player.name) end
|
||||
else
|
||||
PlayerData:raw_set(player.name)
|
||||
end
|
||||
end)
|
||||
|
||||
----- Module Return -----
|
||||
return {
|
||||
All = PlayerData, -- Root for all of a players data
|
||||
Statistics = PlayerData:combine('Statistics'), -- Common place for stats
|
||||
Settings = PlayerData:combine('Settings'), -- Common place for settings
|
||||
Required = PlayerData:combine('Required'), -- Common place for required data
|
||||
Statistics = PlayerData:combine("Statistics"), -- Common place for stats
|
||||
Settings = PlayerData:combine("Settings"), -- Common place for settings
|
||||
Required = PlayerData:combine("Required"), -- Common place for required data
|
||||
DataSavingPreference = DataSavingPreference, -- Stores what data groups will be saved
|
||||
PreferenceEnum = PreferenceEnum -- Enum for the allowed options for data saving preference
|
||||
PreferenceEnum = PreferenceEnum, -- Enum for the allowed options for data saving preference
|
||||
}
|
||||
@@ -130,13 +130,13 @@ local Roles = {
|
||||
events = {
|
||||
on_role_assigned = script.generate_event_name(),
|
||||
on_role_unassigned = script.generate_event_name(),
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
--- When global is loaded it will have the metatable re-assigned to the roles
|
||||
Storage.register({
|
||||
Roles.config.players,
|
||||
Roles.config.deferred_roles
|
||||
Roles.config.deferred_roles,
|
||||
}, function(tbl)
|
||||
Roles.config.players = tbl[1]
|
||||
Roles.config.deferred_roles = tbl[2]
|
||||
@@ -150,12 +150,12 @@ end)
|
||||
-- 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 = by_player_name or game.player and game.player.name or '<server>'
|
||||
by_player_name = by_player_name or game.player and game.player.name or "<server>"
|
||||
local by_player = game.players[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.events.on_role_assigned
|
||||
if type == 'unassign' then
|
||||
if type == "unassign" then
|
||||
event = Roles.events.on_role_unassigned
|
||||
end
|
||||
-- Get the names of the roles
|
||||
@@ -163,27 +163,28 @@ local function emit_player_roles_updated(player, type, roles, by_player_name, sk
|
||||
for index, role in ipairs(roles) do
|
||||
role_names[index] = role.name
|
||||
end
|
||||
|
||||
-- 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)
|
||||
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'}
|
||||
if type == "assign" then
|
||||
player.play_sound{ path = "utility/achievement_unlocked" }
|
||||
else
|
||||
player.play_sound{path='utility/game_lost'}
|
||||
player.play_sound{ path = "utility/game_lost" }
|
||||
end
|
||||
script.raise_event(event, {
|
||||
name = event,
|
||||
tick = game.tick,
|
||||
player_index = player.index,
|
||||
by_player_index = by_player_index,
|
||||
roles=role_names
|
||||
roles = role_names,
|
||||
})
|
||||
write_json('log/roles.log', {
|
||||
write_json("log/roles.log", {
|
||||
player_name = player.name,
|
||||
by_player_name = by_player_name,
|
||||
type = type,
|
||||
roles_changed=role_names
|
||||
roles_changed = role_names,
|
||||
})
|
||||
end
|
||||
|
||||
@@ -195,13 +196,14 @@ game.player.print(Roles.debug())
|
||||
|
||||
]]
|
||||
function Roles.debug()
|
||||
local output = ''
|
||||
local output = ""
|
||||
for index, role_name in ipairs(Roles.config.order) do
|
||||
local role = Roles.config.roles[role_name]
|
||||
local color = role.custom_color or Colours.white
|
||||
color = string.format('[color=%d, %d, %d]', color.r, color.g, color.b)
|
||||
output = output..string.format('\n%s %s) %s[/color]', color, index, serpent.line(role))
|
||||
color = string.format("[color=%d, %d, %d]", color.r, color.g, color.b)
|
||||
output = output .. string.format("\n%s %s) %s[/color]", color, index, serpent.line(role))
|
||||
end
|
||||
|
||||
return output
|
||||
end
|
||||
|
||||
@@ -237,6 +239,7 @@ function Roles.print_to_roles_higher(role, message)
|
||||
roles[#roles + 1] = role_name
|
||||
end
|
||||
end
|
||||
|
||||
Roles.print_to_roles(roles, message)
|
||||
end
|
||||
|
||||
@@ -257,6 +260,7 @@ function Roles.print_to_roles_lower(role, message)
|
||||
roles[#roles + 1] = role_name
|
||||
end
|
||||
end
|
||||
|
||||
Roles.print_to_roles(roles, message)
|
||||
end
|
||||
|
||||
@@ -296,12 +300,12 @@ local role = Roles.get_role_from_any('Moderator')
|
||||
]]
|
||||
function Roles.get_role_from_any(any)
|
||||
local t_any = type(any)
|
||||
if t_any == 'number' or tonumber(any) then
|
||||
if t_any == "number" or tonumber(any) then
|
||||
any = tonumber(any)
|
||||
return Roles.get_role_by_order(any)
|
||||
elseif t_any == 'string' then
|
||||
elseif t_any == "string" then
|
||||
return Roles.get_role_by_name(any)
|
||||
elseif t_any == 'table' then
|
||||
elseif t_any == "table" then
|
||||
return Roles.get_role_by_name(any.name)
|
||||
end
|
||||
end
|
||||
@@ -323,6 +327,7 @@ function Roles.get_player_roles(player)
|
||||
for index, role_name in ipairs(roles) do
|
||||
rtn[index + 1] = Roles.config.roles[role_name]
|
||||
end
|
||||
|
||||
return rtn
|
||||
end
|
||||
|
||||
@@ -343,6 +348,7 @@ function Roles.get_player_highest_role(player)
|
||||
highest = role
|
||||
end
|
||||
end
|
||||
|
||||
return highest
|
||||
end
|
||||
|
||||
@@ -370,7 +376,7 @@ function Roles.assign_player(player, roles, by_player_name, skip_checks, silent)
|
||||
if not player then return end
|
||||
|
||||
-- Convert the roles into a table (allows for optional array)
|
||||
if type(roles) ~= 'table' or roles.name then
|
||||
if type(roles) ~= "table" or roles.name then
|
||||
roles = { roles }
|
||||
end
|
||||
|
||||
@@ -394,10 +400,11 @@ function Roles.assign_player(player, roles, by_player_name, skip_checks, silent)
|
||||
end
|
||||
else
|
||||
assign_later[role.name] = {
|
||||
count = 1, by_player_name = by_player_name or "<server>", silent = silent
|
||||
count = 1, by_player_name = by_player_name or "<server>", silent = silent,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Roles.config.deferred_roles[valid_player.name] = assign_later
|
||||
return
|
||||
end
|
||||
@@ -407,7 +414,7 @@ function Roles.assign_player(player, roles, by_player_name, skip_checks, silent)
|
||||
end
|
||||
|
||||
if valid_player then
|
||||
emit_player_roles_updated(valid_player, 'assign', role_objects, by_player_name, silent)
|
||||
emit_player_roles_updated(valid_player, "assign", role_objects, by_player_name, silent)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -431,7 +438,7 @@ function Roles.unassign_player(player, roles, by_player_name, skip_checks, silen
|
||||
if not player then return end
|
||||
|
||||
-- Convert the roles into a table (allows for optional array)
|
||||
if type(roles) ~= 'table' or roles.name then
|
||||
if type(roles) ~= "table" or roles.name then
|
||||
roles = { roles }
|
||||
end
|
||||
|
||||
@@ -456,10 +463,11 @@ function Roles.unassign_player(player, roles, by_player_name, skip_checks, silen
|
||||
end
|
||||
else
|
||||
assign_later[role.name] = {
|
||||
count = -1, by_player_name = by_player_name or "<server>", silent = silent
|
||||
count = -1, by_player_name = by_player_name or "<server>", silent = silent,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Roles.config.deferred_roles[valid_player.name] = assign_later
|
||||
end
|
||||
|
||||
@@ -490,17 +498,20 @@ function Roles.unassign_player(player, roles, by_player_name, skip_checks, silen
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for assign_by_player_name, assign_roles in pairs(assigns) do
|
||||
if #assign_roles > 0 then emit_player_roles_updated(valid_player, 'assign', assign_roles, assign_by_player_name) end
|
||||
if #assign_roles > 0 then emit_player_roles_updated(valid_player, "assign", assign_roles, assign_by_player_name) end
|
||||
end
|
||||
|
||||
for unassign_by_player_name, unassign_roles in pairs(unassigns) do
|
||||
if #unassign_roles > 0 then emit_player_roles_updated(valid_player, 'unassign', unassign_roles, unassign_by_player_name) end
|
||||
if #unassign_roles > 0 then emit_player_roles_updated(valid_player, "unassign", unassign_roles, unassign_by_player_name) end
|
||||
end
|
||||
|
||||
Roles.config.deferred_roles[player.name] = nil
|
||||
end
|
||||
|
||||
if valid_player and #role_changes > 0 then
|
||||
emit_player_roles_updated(valid_player, 'unassign', role_changes, by_player_name, silent)
|
||||
emit_player_roles_updated(valid_player, "unassign", role_changes, by_player_name, silent)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -522,6 +533,7 @@ function Roles.override_player_roles(player_name,roles)
|
||||
local player_roles = Roles.config.players
|
||||
if not roles then
|
||||
for k in pairs(player_roles) do player_roles[k] = nil end
|
||||
|
||||
for k, new_roles in pairs(player_name) do player_roles[k] = new_roles end
|
||||
else
|
||||
Roles.config.players[player_name] = roles
|
||||
@@ -549,6 +561,7 @@ function Roles.player_has_role(player, search_role)
|
||||
for _, role in ipairs(roles) do
|
||||
if role.name == search_role.name then return true end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -569,6 +582,7 @@ function Roles.player_has_flag(player, flag_name)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -589,6 +603,7 @@ function Roles.player_allowed(player, action)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -616,7 +631,7 @@ function Roles.define_role_order(order)
|
||||
Roles.config.order = {}
|
||||
local done = {}
|
||||
for index, role in ipairs(order) do
|
||||
if type(role) == 'table' and role.name then
|
||||
if type(role) == "table" and role.name then
|
||||
done[role.name] = true
|
||||
Roles.config.order[index] = role.name
|
||||
else
|
||||
@@ -624,17 +639,19 @@ function Roles.define_role_order(order)
|
||||
Roles.config.order[index] = role
|
||||
end
|
||||
end
|
||||
|
||||
-- Check no roles were missed
|
||||
for role_name in pairs(Roles.config.roles) do
|
||||
if not done[role_name] then
|
||||
error('Role missing '..role_name..' from role order, all defined roles must be included.', 2)
|
||||
error("Role missing " .. role_name .. " from role order, all defined roles must be included.", 2)
|
||||
end
|
||||
end
|
||||
|
||||
-- Re-links roles to they parents as this is called at the end of the config
|
||||
for index, role_name in pairs(Roles.config.order) do
|
||||
local role = Roles.config.roles[role_name]
|
||||
if not role then
|
||||
error('Role with name '..role_name..' has not beed defined, either define it or remove it from the order list.', 2)
|
||||
error("Role with name " .. role_name .. " has not beed defined, either define it or remove it from the order list.", 2)
|
||||
end
|
||||
role.index = index
|
||||
local parent = Roles.config.roles[role.parent]
|
||||
@@ -696,13 +713,13 @@ local role = Roles.new_role('Moderator', 'Mod')
|
||||
]]
|
||||
function Roles.new_role(name, short_hand)
|
||||
_C.error_if_runtime()
|
||||
if Roles.config.roles[name] then return error('Role name is non unique') end
|
||||
if Roles.config.roles[name] then return error("Role name is non unique") end
|
||||
local role = setmetatable({
|
||||
name = name,
|
||||
short_hand = short_hand or name,
|
||||
allowed_actions = {},
|
||||
allow_all_actions = false,
|
||||
flags={}
|
||||
flags = {},
|
||||
}, { __index = Roles._prototype })
|
||||
Roles.config.roles[name] = role
|
||||
return role
|
||||
@@ -738,12 +755,13 @@ role:allow{
|
||||
|
||||
]]
|
||||
function Roles._prototype:allow(actions)
|
||||
if type(actions) ~= 'table' then
|
||||
if type(actions) ~= "table" then
|
||||
actions = { actions }
|
||||
end
|
||||
for _, action in ipairs(actions) do
|
||||
self.allowed_actions[action] = true
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -759,12 +777,13 @@ role:disallow{
|
||||
|
||||
]]
|
||||
function Roles._prototype:disallow(actions)
|
||||
if type(actions) ~= 'table' then
|
||||
if type(actions) ~= "table" then
|
||||
actions = { actions }
|
||||
end
|
||||
for _, action in ipairs(actions) do
|
||||
self.allowed_actions[action] = false
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -850,7 +869,7 @@ role:set_custom_color{ r=255, g=100, b=100}
|
||||
|
||||
]]
|
||||
function Roles._prototype:set_custom_color(color)
|
||||
if type(color) ~= 'table' then
|
||||
if type(color) ~= "table" then
|
||||
color = Colours[color]
|
||||
end
|
||||
self.custom_color = color
|
||||
@@ -972,13 +991,14 @@ function Roles._prototype:add_player(player, skip_check, skip_event)
|
||||
for _, role_name in ipairs(player_roles) do
|
||||
if role_name == self.name then return false end
|
||||
end
|
||||
|
||||
player_roles[#player_roles + 1] = self.name
|
||||
else
|
||||
Roles.config.players[player_name] = { self.name }
|
||||
end
|
||||
-- Emits event if required
|
||||
if valid_player and not skip_event then
|
||||
emit_player_roles_updated(valid_player, 'assign', {self})
|
||||
emit_player_roles_updated(valid_player, "assign", { self })
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -1018,13 +1038,14 @@ function Roles._prototype:remove_player(player, skip_check, skip_event)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if #player_roles == 0 then
|
||||
Roles.config.players[player_name] = nil
|
||||
end
|
||||
end
|
||||
-- Emits event if required
|
||||
if valid_player and not skip_event then
|
||||
emit_player_roles_updated(valid_player, 'unassign', {self})
|
||||
emit_player_roles_updated(valid_player, "unassign", { self })
|
||||
end
|
||||
return found
|
||||
end
|
||||
@@ -1055,6 +1076,7 @@ function Roles._prototype:get_players(online)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return players
|
||||
end
|
||||
|
||||
@@ -1071,6 +1093,7 @@ function Roles._prototype:print(message)
|
||||
for _, player in ipairs(players) do
|
||||
player.print(message)
|
||||
end
|
||||
|
||||
return #players
|
||||
end
|
||||
|
||||
@@ -1082,6 +1105,7 @@ local function role_update(event)
|
||||
local state = Roles.player_has_flag(player, flag)
|
||||
async_function(player, state)
|
||||
end
|
||||
|
||||
-- Updates the players permission group
|
||||
local highest = Roles.get_player_highest_role(player)
|
||||
if highest.permission_group then
|
||||
@@ -1114,7 +1138,7 @@ local function auto_assign(event)
|
||||
if not lookup[role] then
|
||||
local success, rtn = pcall(condition, player)
|
||||
if not success then
|
||||
log{'expcore-roles.error-log-format-assign', role.name, rtn}
|
||||
log{ "expcore-roles.error-log-format-assign", role.name, rtn }
|
||||
elseif rtn == true then
|
||||
ctn = ctn + 1
|
||||
assigns[ctn] = role
|
||||
@@ -1139,6 +1163,5 @@ Event.on_nth_tick(3600, function()
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
-- Return Roles
|
||||
return Roles
|
||||
@@ -17,7 +17,7 @@ Event.add(defines.events.on_player_created, function(event)
|
||||
end
|
||||
-- spawn items
|
||||
for item, callback in pairs(items) do
|
||||
if type(callback) == 'function' then
|
||||
if type(callback) == "function" then
|
||||
local stats = player.force.get_item_production_statistics(player.surface)
|
||||
local made = stats.get_input_count(item)
|
||||
local success, count = pcall(callback, made, stats.get_input_count, player)
|
||||
@@ -38,9 +38,9 @@ Event.add(defines.events.on_player_created, function(event)
|
||||
end)
|
||||
|
||||
Event.on_init(function()
|
||||
remote.call('freeplay', 'set_created_items', {})
|
||||
remote.call('freeplay', 'set_chart_distance', 0)
|
||||
remote.call('freeplay', 'set_skip_intro', config.skip_intro)
|
||||
remote.call("freeplay", "set_created_items", {})
|
||||
remote.call("freeplay", "set_chart_distance", 0)
|
||||
remote.call("freeplay", "set_skip_intro", config.skip_intro)
|
||||
if config.research_queue_from_start then
|
||||
for _, force in pairs(game.forces) do
|
||||
-- force.research_queue_enabled = true
|
||||
@@ -48,7 +48,7 @@ Event.on_init(function()
|
||||
end
|
||||
if not config.disable_base_game_silo_script then
|
||||
if config.skip_victory then
|
||||
remote.call('silo_script', 'set_no_victory', true)
|
||||
remote.call("silo_script", "set_no_victory", true)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -22,7 +22,7 @@ end)
|
||||
local kick_player_async =
|
||||
Async.register(function(player)
|
||||
if game.tick - primitives.last_active < config.kick_time then return end -- Safety Catch
|
||||
game.kick_player(player, 'AFK while no active players on the server')
|
||||
game.kick_player(player, "AFK while no active players on the server")
|
||||
end)
|
||||
|
||||
--- Check for an active player every update_time number of ticks
|
||||
@@ -48,9 +48,9 @@ Event.on_nth_tick(config.update_time, function()
|
||||
local res = player.display_resolution
|
||||
local uis = player.display_scale
|
||||
player.gui.screen.add{
|
||||
type = 'frame',
|
||||
name = 'afk-kick',
|
||||
caption = {'afk-kick.message'},
|
||||
type = "frame",
|
||||
name = "afk-kick",
|
||||
caption = { "afk-kick.message" },
|
||||
}.location = { x = res.width * (0.5 - 0.11 * uis), y = res.height * (0.5 - 0.14 * uis) }
|
||||
|
||||
-- Kick the player, some delay needed because network delay
|
||||
|
||||
@@ -18,7 +18,7 @@ Event.add(defines.events.on_console_chat, function(event)
|
||||
|
||||
-- Sends the message as text above them
|
||||
if config.show_player_messages then
|
||||
send_text(player, {'chat-popup.message', player.name, event.message})
|
||||
send_text(player, { "chat-popup.message", player.name, event.message })
|
||||
end
|
||||
|
||||
if not config.show_player_mentions then return end
|
||||
@@ -30,9 +30,8 @@ Event.add(defines.events.on_console_chat, function(event)
|
||||
for _, mentioned_player in pairs(game.connected_players) do
|
||||
if mentioned_player.index ~= player.index then
|
||||
if search_string:find(mentioned_player.name:lower(), 1, true) then
|
||||
send_text(mentioned_player, {'chat-popup.ping', player.name})
|
||||
send_text(mentioned_player, { "chat-popup.ping", player.name })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end)
|
||||
@@ -18,16 +18,16 @@ Event.add(defines.events.on_console_chat, function(event)
|
||||
for key_word, reply in pairs(config.messages) do
|
||||
if message:find(key_word) then
|
||||
local is_command = message:find(prefix .. key_word)
|
||||
if type(reply) == 'function' then
|
||||
if type(reply) == "function" then
|
||||
reply = reply(player, is_command)
|
||||
end
|
||||
|
||||
if is_command and allowed then
|
||||
game.print{'chat-bot.reply', reply}
|
||||
game.print{ "chat-bot.reply", reply }
|
||||
elseif is_command then
|
||||
player.print{'chat-bot.disallow'}
|
||||
player.print{ "chat-bot.disallow" }
|
||||
elseif not allowed then
|
||||
player.print{'chat-bot.reply', reply}
|
||||
player.print{ "chat-bot.reply", reply }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -36,17 +36,15 @@ Event.add(defines.events.on_console_chat, function(event)
|
||||
|
||||
for key_word, reply in pairs(config.commands) do
|
||||
if message:find(prefix .. key_word) then
|
||||
if type(reply) == 'function' then
|
||||
if type(reply) == "function" then
|
||||
local msg = reply(player, true)
|
||||
|
||||
if reply then
|
||||
game.print{'chat-bot.reply', msg}
|
||||
game.print{ "chat-bot.reply", msg }
|
||||
end
|
||||
|
||||
else
|
||||
game.print{'chat-bot.reply', reply}
|
||||
game.print{ "chat-bot.reply", reply }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -10,12 +10,12 @@ local locations = config.locations
|
||||
|
||||
local Public = {
|
||||
compilatrons = {},
|
||||
current_messages={}
|
||||
current_messages = {},
|
||||
}
|
||||
|
||||
Storage.register({
|
||||
compilatrons = Public.compilatrons,
|
||||
current_messages = Public.current_messages
|
||||
current_messages = Public.current_messages,
|
||||
}, function(tbl)
|
||||
Public.compilatrons = tbl.compilatrons
|
||||
Public.current_messages = tbl.current_messages
|
||||
@@ -25,7 +25,7 @@ local speech_bubble_async =
|
||||
Async.register(function(data)
|
||||
local message =
|
||||
data.ent.surface.create_entity{
|
||||
name = 'compi-speech-bubble',
|
||||
name = "compi-speech-bubble",
|
||||
text = messages[data.name][data.msg_number],
|
||||
source = data.ent,
|
||||
position = { 0, 0 },
|
||||
@@ -33,7 +33,7 @@ Async.register(function(data)
|
||||
|
||||
Public.current_messages[data.name] = {
|
||||
message = message,
|
||||
msg_number = data.msg_number
|
||||
msg_number = data.msg_number,
|
||||
}
|
||||
end)
|
||||
|
||||
@@ -77,9 +77,9 @@ function Public.add_compilatron(entity, name)
|
||||
|
||||
Public.compilatrons[name] = entity
|
||||
local message =
|
||||
entity.surface.create_entity(
|
||||
{name = 'compi-speech-bubble', text = messages[name][1], position = {0, 0}, source = entity}
|
||||
)
|
||||
entity.surface.create_entity
|
||||
{ name = "compi-speech-bubble", text = messages[name][1], position = { 0, 0 }, source = entity }
|
||||
|
||||
Public.current_messages[name] = { message = message, msg_number = 1 }
|
||||
end
|
||||
|
||||
@@ -88,8 +88,8 @@ end
|
||||
-- @tparam string location the location tag that is in the config file
|
||||
function Public.spawn_compilatron(surface, location)
|
||||
local position = locations[location]
|
||||
local pos = surface.find_non_colliding_position('small-biter', position, 1.5, 0.5)
|
||||
local compi = surface.create_entity {name='small-biter', position=pos, force=game.forces.neutral}
|
||||
local pos = surface.find_non_colliding_position("small-biter", position, 1.5, 0.5)
|
||||
local compi = surface.create_entity{ name = "small-biter", position = pos, force = game.forces.neutral }
|
||||
Public.add_compilatron(compi, location)
|
||||
end
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@ Event.add(defines.events.on_entity_damaged, function(event)
|
||||
|
||||
-- Sets the message
|
||||
local message
|
||||
if entity.name == 'character' and config.show_player_health then
|
||||
message = {'damage-popup.player-health', health}
|
||||
elseif entity.name ~= 'character' and cause and cause.name == 'character' and config.show_player_damage then
|
||||
message = {'damage-popup.player-damage', damage}
|
||||
if entity.name == "character" and config.show_player_health then
|
||||
message = { "damage-popup.player-health", health }
|
||||
elseif entity.name ~= "character" and cause and cause.name == "character" and config.show_player_damage then
|
||||
message = { "damage-popup.player-damage", damage }
|
||||
end
|
||||
|
||||
-- Outputs the message as floating text
|
||||
@@ -38,5 +38,4 @@ Event.add(defines.events.on_entity_damaged, function(event)
|
||||
text_colour
|
||||
)
|
||||
end
|
||||
|
||||
end)
|
||||
@@ -10,7 +10,7 @@ local format_time, move_items = _C.format_time, _C.move_items_stack --- @dep exp
|
||||
local corpse_lifetime = 60 * 60 * 15
|
||||
|
||||
local deaths = {
|
||||
archive={} -- deaths moved here after body is gone
|
||||
archive = {}, -- deaths moved here after body is gone
|
||||
-- {player_name='Cooldude2606', time_of_death='15H 15M', position={x=0, y=0}, corpse=LuaEntity, tag=LuaCustomChartTag}
|
||||
}
|
||||
Storage.register(deaths, function(tbl)
|
||||
@@ -20,15 +20,15 @@ end)
|
||||
--- Creates a new death marker and saves it to the given death
|
||||
local function create_map_tag(death)
|
||||
local player = game.players[death.player_name]
|
||||
local message = player.name..' died'
|
||||
local message = player.name .. " died"
|
||||
if config.include_time_of_death then
|
||||
local time = format_time(death.time_of_death, { hours = true, minutes = true, string = true })
|
||||
message = message..' at '..time
|
||||
message = message .. " at " .. time
|
||||
end
|
||||
death.tag = player.force.add_chart_tag(player.surface, {
|
||||
position = death.position,
|
||||
icon = config.map_icon,
|
||||
text=message
|
||||
text = message,
|
||||
})
|
||||
end
|
||||
|
||||
@@ -62,7 +62,7 @@ end
|
||||
-- when a player dies a new death is added to the records and a map marker is made
|
||||
Event.add(defines.events.on_player_died, function(event)
|
||||
local player = game.players[event.player_index]
|
||||
local corpse = player.surface.find_entity('character-corpse', player.position)
|
||||
local corpse = player.surface.find_entity("character-corpse", player.position)
|
||||
if config.use_chests_as_bodies then
|
||||
local items = corpse.get_inventory(defines.inventory.character_corpse)
|
||||
local chest = move_items(items, corpse.surface, corpse.position)
|
||||
@@ -74,7 +74,7 @@ Event.add(defines.events.on_player_died, function(event)
|
||||
player_name = player.name,
|
||||
time_of_death = event.tick,
|
||||
position = player.position,
|
||||
corpse = corpse
|
||||
corpse = corpse,
|
||||
}
|
||||
if config.show_map_markers then
|
||||
create_map_tag(death)
|
||||
@@ -84,11 +84,11 @@ Event.add(defines.events.on_player_died, function(event)
|
||||
-- Draw a light attached to the corpse with the player color
|
||||
if config.show_light_at_corpse then
|
||||
rendering.draw_light{
|
||||
sprite = 'utility/light_medium',
|
||||
sprite = "utility/light_medium",
|
||||
color = player.color,
|
||||
target = corpse,
|
||||
force = player.force,
|
||||
surface = player.surface
|
||||
surface = player.surface,
|
||||
}
|
||||
end
|
||||
end)
|
||||
@@ -122,7 +122,7 @@ if config.show_line_to_corpse then
|
||||
dash_length = 1,
|
||||
gap_length = 1,
|
||||
surface = player.surface,
|
||||
draw_on_ground = true
|
||||
draw_on_ground = true,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ local function pos_to_string(pos)
|
||||
end
|
||||
|
||||
local function pos_to_gps_string(pos)
|
||||
return '[gps=' .. string.format('%.1f', pos.x) .. ',' .. string.format('%.1f', pos.y) .. ']'
|
||||
return "[gps=" .. string.format("%.1f", pos.x) .. "," .. string.format("%.1f", pos.y) .. "]"
|
||||
end
|
||||
|
||||
--- Print a message to all players who match the value of admin
|
||||
@@ -46,17 +46,17 @@ if config.decon_area then
|
||||
|
||||
local player = game.get_player(e.player_index)
|
||||
|
||||
if Roles.player_has_flag(player, 'deconlog-bypass') then
|
||||
if Roles.player_has_flag(player, "deconlog-bypass") then
|
||||
return
|
||||
end
|
||||
|
||||
local items = e.surface.find_entities_filtered{ area = e.area, force = player.force }
|
||||
|
||||
if #items > 250 then
|
||||
print_to_players(true, {'deconlog.decon', player.name, e.surface.name, pos_to_gps_string(e.area.left_top), pos_to_gps_string(e.area.right_bottom), format_number(#items)})
|
||||
print_to_players(true, { "deconlog.decon", player.name, e.surface.name, pos_to_gps_string(e.area.left_top), pos_to_gps_string(e.area.right_bottom), format_number(#items) })
|
||||
end
|
||||
|
||||
add_log(get_secs() .. ',' .. player.name .. ',decon_area,' .. e.surface.name .. ',' .. pos_to_string(e.area.left_top) .. ',' .. pos_to_string(e.area.right_bottom))
|
||||
add_log(get_secs() .. "," .. player.name .. ",decon_area," .. e.surface.name .. "," .. pos_to_string(e.area.left_top) .. "," .. pos_to_string(e.area.right_bottom))
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ local function append_playtime(player_name)
|
||||
return player_name
|
||||
end
|
||||
|
||||
return player.name ..' (' .. format_time(player.online_time, playtime_format) .. ')'
|
||||
return player.name .. " (" .. format_time(player.online_time, playtime_format) .. ")"
|
||||
end
|
||||
|
||||
local function get_player_name(event)
|
||||
@@ -28,22 +28,22 @@ local function get_player_name(event)
|
||||
end
|
||||
|
||||
local function to_hex(color)
|
||||
local hex_digits = '0123456789ABCDEF'
|
||||
local hex_digits = "0123456789ABCDEF"
|
||||
local function hex(bit)
|
||||
local major, minor = math.modf(bit / 16)
|
||||
major, minor = major + 1, minor * 16 + 1
|
||||
return hex_digits:sub(major, major) .. hex_digits:sub(minor, minor)
|
||||
end
|
||||
|
||||
return '0x' .. hex(color.r) .. hex(color.g) .. hex(color.b)
|
||||
return "0x" .. hex(color.r) .. hex(color.g) .. hex(color.b)
|
||||
end
|
||||
|
||||
local function emit_event(args)
|
||||
local title = args.title or ''
|
||||
local color = args.color or '0x0'
|
||||
local description = args.description or ''
|
||||
local title = args.title or ""
|
||||
local color = args.color or "0x0"
|
||||
local description = args.description or ""
|
||||
|
||||
if type(color) == 'table' then
|
||||
if type(color) == "table" then
|
||||
color = to_hex(color)
|
||||
end
|
||||
|
||||
@@ -63,8 +63,8 @@ local function emit_event(args)
|
||||
|
||||
local done = { title = true, color = true, description = true }
|
||||
local fields = { {
|
||||
name='Server Details',
|
||||
value=string.format('Server: ${serverName} Time: %s\nTotal: %d Online: %d Admins: %d', tick_formatted, #game.players, players_online, admins_online)
|
||||
name = "Server Details",
|
||||
value = string.format("Server: ${serverName} Time: %s\nTotal: %d Online: %d Admins: %d", tick_formatted, #game.players, players_online, admins_online),
|
||||
} }
|
||||
|
||||
for key, value in pairs(args) do
|
||||
@@ -73,10 +73,10 @@ local function emit_event(args)
|
||||
local field = {
|
||||
name = key,
|
||||
value = value,
|
||||
inline=false
|
||||
inline = false,
|
||||
}
|
||||
|
||||
local new_value, inline = value:gsub('<inline>', '', 1)
|
||||
local new_value, inline = value:gsub("<inline>", "", 1)
|
||||
if inline > 0 then
|
||||
field.value = new_value
|
||||
field.inline = true
|
||||
@@ -86,11 +86,11 @@ local function emit_event(args)
|
||||
end
|
||||
end
|
||||
|
||||
write_json('ext/discord.out',{
|
||||
write_json("ext/discord.out", {
|
||||
title = title,
|
||||
description = description,
|
||||
color = color,
|
||||
fields=fields
|
||||
fields = fields,
|
||||
})
|
||||
end
|
||||
|
||||
@@ -100,12 +100,12 @@ if config.entity_protection then
|
||||
Event.add(EntityProtection.events.on_repeat_violation, function(event)
|
||||
local player_name = get_player_name(event)
|
||||
emit_event{
|
||||
title='Entity Protection',
|
||||
description='A player removed protected entities',
|
||||
title = "Entity Protection",
|
||||
description = "A player removed protected entities",
|
||||
color = Colors.yellow,
|
||||
['Player']='<inline>' .. append_playtime(player_name),
|
||||
['Entity']='<inline>' .. event.entity.name,
|
||||
['Location']='X ' .. event.entity.position.x .. ' Y ' .. event.entity.position.y
|
||||
["Player"] = "<inline>" .. append_playtime(player_name),
|
||||
["Entity"] = "<inline>" .. event.entity.name,
|
||||
["Location"] = "X " .. event.entity.position.x .. " Y " .. event.entity.position.y,
|
||||
}
|
||||
end)
|
||||
end
|
||||
@@ -116,25 +116,25 @@ if config.player_reports then
|
||||
Event.add(Reports.events.on_player_reported, function(event)
|
||||
local player_name, by_player_name = get_player_name(event)
|
||||
emit_event{
|
||||
title='Report',
|
||||
description='A player was reported',
|
||||
title = "Report",
|
||||
description = "A player was reported",
|
||||
color = Colors.yellow,
|
||||
['Player']='<inline>' .. append_playtime(player_name),
|
||||
['By']='<inline>' .. append_playtime(by_player_name),
|
||||
['Report Count']='<inline>' .. Reports.count_reports(player_name),
|
||||
['Reason']=event.reason
|
||||
["Player"] = "<inline>" .. append_playtime(player_name),
|
||||
["By"] = "<inline>" .. append_playtime(by_player_name),
|
||||
["Report Count"] = "<inline>" .. Reports.count_reports(player_name),
|
||||
["Reason"] = event.reason,
|
||||
}
|
||||
end)
|
||||
Event.add(Reports.events.on_report_removed, function(event)
|
||||
if event.batch ~= 1 then return end
|
||||
local player_name = get_player_name(event)
|
||||
emit_event{
|
||||
title='Reports Removed',
|
||||
description='A player has a report removed',
|
||||
title = "Reports Removed",
|
||||
description = "A player has a report removed",
|
||||
color = Colors.green,
|
||||
['Player']='<inline>' .. player_name,
|
||||
['By']='<inline>' .. event.removed_by_name,
|
||||
['Report Count']='<inline>' .. event.batch_count
|
||||
["Player"] = "<inline>" .. player_name,
|
||||
["By"] = "<inline>" .. event.removed_by_name,
|
||||
["Report Count"] = "<inline>" .. event.batch_count,
|
||||
}
|
||||
end)
|
||||
end
|
||||
@@ -146,25 +146,25 @@ if config.player_warnings then
|
||||
local player_name, by_player_name = get_player_name(event)
|
||||
local player = game.get_player(player_name)
|
||||
emit_event{
|
||||
title='Warning',
|
||||
description='A player has been given a warning',
|
||||
title = "Warning",
|
||||
description = "A player has been given a warning",
|
||||
color = Colors.yellow,
|
||||
['Player']='<inline>' .. player_name,
|
||||
['By']='<inline>' .. by_player_name,
|
||||
['Warning Count']='<inline>' .. Warnings.count_warnings(player),
|
||||
['Reason']=event.reason
|
||||
["Player"] = "<inline>" .. player_name,
|
||||
["By"] = "<inline>" .. by_player_name,
|
||||
["Warning Count"] = "<inline>" .. Warnings.count_warnings(player),
|
||||
["Reason"] = event.reason,
|
||||
}
|
||||
end)
|
||||
Event.add(Warnings.events.on_warning_removed, function(event)
|
||||
if event.batch ~= 1 then return end
|
||||
local player_name = get_player_name(event)
|
||||
emit_event{
|
||||
title='Warnings Removed',
|
||||
description='A player has a warning removed',
|
||||
title = "Warnings Removed",
|
||||
description = "A player has a warning removed",
|
||||
color = Colors.green,
|
||||
['Player']='<inline>' .. player_name,
|
||||
['By']='<inline>' .. event.removed_by_name,
|
||||
['Warning Count']='<inline>' .. event.batch_count
|
||||
["Player"] = "<inline>" .. player_name,
|
||||
["By"] = "<inline>" .. event.removed_by_name,
|
||||
["Warning Count"] = "<inline>" .. event.batch_count,
|
||||
}
|
||||
end)
|
||||
end
|
||||
@@ -175,22 +175,22 @@ if config.player_jail then
|
||||
Event.add(Jail.events.on_player_jailed, function(event)
|
||||
local player_name, by_player_name = get_player_name(event)
|
||||
emit_event{
|
||||
title='Jail',
|
||||
description='A player has been jailed',
|
||||
title = "Jail",
|
||||
description = "A player has been jailed",
|
||||
color = Colors.yellow,
|
||||
['Player']='<inline>' .. player_name,
|
||||
['By']='<inline>' .. by_player_name,
|
||||
['Reason']=event.reason
|
||||
["Player"] = "<inline>" .. player_name,
|
||||
["By"] = "<inline>" .. by_player_name,
|
||||
["Reason"] = event.reason,
|
||||
}
|
||||
end)
|
||||
Event.add(Jail.events.on_player_unjailed, function(event)
|
||||
local player_name, by_player_name = get_player_name(event)
|
||||
emit_event{
|
||||
title='Unjail',
|
||||
description='A player has been unjailed',
|
||||
title = "Unjail",
|
||||
description = "A player has been unjailed",
|
||||
color = Colors.green,
|
||||
['Player']='<inline>' .. player_name,
|
||||
['By']='<inline>' .. by_player_name
|
||||
["Player"] = "<inline>" .. player_name,
|
||||
["By"] = "<inline>" .. by_player_name,
|
||||
}
|
||||
end)
|
||||
end
|
||||
@@ -201,12 +201,12 @@ if config.player_bans then
|
||||
if event.by_player then
|
||||
local by_player = game.players[event.by_player]
|
||||
emit_event{
|
||||
title='Banned',
|
||||
description='A player has been banned',
|
||||
title = "Banned",
|
||||
description = "A player has been banned",
|
||||
color = Colors.red,
|
||||
['Player']='<inline>' .. event.player_name,
|
||||
['By']='<inline>' .. by_player.name,
|
||||
['Reason']=event.reason
|
||||
["Player"] = "<inline>" .. event.player_name,
|
||||
["By"] = "<inline>" .. by_player.name,
|
||||
["Reason"] = event.reason,
|
||||
}
|
||||
end
|
||||
end)
|
||||
@@ -214,11 +214,11 @@ if config.player_bans then
|
||||
if event.by_player then
|
||||
local by_player = game.players[event.by_player]
|
||||
emit_event{
|
||||
title='Un-Banned',
|
||||
description='A player has been un-banned',
|
||||
title = "Un-Banned",
|
||||
description = "A player has been un-banned",
|
||||
color = Colors.green,
|
||||
['Player']='<inline>' .. event.player_name,
|
||||
['By']='<inline>' .. by_player.name
|
||||
["Player"] = "<inline>" .. event.player_name,
|
||||
["By"] = "<inline>" .. by_player.name,
|
||||
}
|
||||
end
|
||||
end)
|
||||
@@ -229,19 +229,19 @@ if config.player_mutes then
|
||||
Event.add(defines.events.on_player_muted, function(event)
|
||||
local player_name = get_player_name(event)
|
||||
emit_event{
|
||||
title='Muted',
|
||||
description='A player has been muted',
|
||||
title = "Muted",
|
||||
description = "A player has been muted",
|
||||
color = Colors.yellow,
|
||||
['Player']='<inline>' .. player_name
|
||||
["Player"] = "<inline>" .. player_name,
|
||||
}
|
||||
end)
|
||||
Event.add(defines.events.on_player_unmuted, function(event)
|
||||
local player_name = get_player_name(event)
|
||||
emit_event{
|
||||
title='Un-Muted',
|
||||
description='A player has been un-muted',
|
||||
title = "Un-Muted",
|
||||
description = "A player has been un-muted",
|
||||
color = Colors.green,
|
||||
['Player']='<inline>' .. player_name
|
||||
["Player"] = "<inline>" .. player_name,
|
||||
}
|
||||
end)
|
||||
end
|
||||
@@ -253,12 +253,12 @@ if config.player_kicks then
|
||||
local player_name = get_player_name(event)
|
||||
local by_player = game.players[event.by_player]
|
||||
emit_event{
|
||||
title='Kick',
|
||||
description='A player has been kicked',
|
||||
title = "Kick",
|
||||
description = "A player has been kicked",
|
||||
color = Colors.orange,
|
||||
['Player']='<inline>' .. player_name,
|
||||
['By']='<inline>' .. by_player.name,
|
||||
['Reason']=event.reason
|
||||
["Player"] = "<inline>" .. player_name,
|
||||
["By"] = "<inline>" .. by_player.name,
|
||||
["Reason"] = event.reason,
|
||||
}
|
||||
end
|
||||
end)
|
||||
@@ -269,19 +269,19 @@ if config.player_promotes then
|
||||
Event.add(defines.events.on_player_promoted, function(event)
|
||||
local player_name = get_player_name(event)
|
||||
emit_event{
|
||||
title='Promote',
|
||||
description='A player has been promoted',
|
||||
title = "Promote",
|
||||
description = "A player has been promoted",
|
||||
color = Colors.green,
|
||||
['Player']='<inline>' .. player_name
|
||||
["Player"] = "<inline>" .. player_name,
|
||||
}
|
||||
end)
|
||||
Event.add(defines.events.on_player_demoted, function(event)
|
||||
local player_name = get_player_name(event)
|
||||
emit_event{
|
||||
title='Demote',
|
||||
description='A player has been demoted',
|
||||
title = "Demote",
|
||||
description = "A player has been demoted",
|
||||
color = Colors.yellow,
|
||||
['Player']='<inline>' .. player_name
|
||||
["Player"] = "<inline>" .. player_name,
|
||||
}
|
||||
end)
|
||||
end
|
||||
@@ -292,11 +292,11 @@ Event.add(defines.events.on_console_command, function(event)
|
||||
local player_name = get_player_name(event)
|
||||
if config[event.command] then
|
||||
emit_event{
|
||||
title=event.command:gsub('^%l', string.upper),
|
||||
description='/' .. event.command .. ' was used',
|
||||
title = event.command:gsub("^%l", string.upper),
|
||||
description = "/" .. event.command .. " was used",
|
||||
color = Colors.grey,
|
||||
['By']='<inline>' .. player_name,
|
||||
['Details'] = event.parameters ~= '' and event.parameters or nil
|
||||
["By"] = "<inline>" .. player_name,
|
||||
["Details"] = event.parameters ~= "" and event.parameters or nil,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,11 +7,11 @@ local controllers_with_inventory = {
|
||||
}
|
||||
|
||||
Event.add(defines.events.on_player_mined_entity, function(event)
|
||||
if (not event.entity.valid) or (event.entity.type ~= 'inserter') or event.entity.drop_target then
|
||||
if (not event.entity.valid) or (event.entity.type ~= "inserter") or event.entity.drop_target then
|
||||
return
|
||||
end
|
||||
|
||||
local item_entity = event.entity.surface.find_entity('item-on-ground', event.entity.drop_position)
|
||||
local item_entity = event.entity.surface.find_entity("item-on-ground", event.entity.drop_position)
|
||||
|
||||
if item_entity then
|
||||
local player = game.get_player(event.player_index)
|
||||
|
||||
@@ -8,25 +8,25 @@ local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local config = require("modules.exp_legacy.config.lawnmower") --- @dep config.lawnmower
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
Commands.new_command('lawnmower', {'expcom-lawnmower.description'}, 'Clean up biter corpse, decoratives and nuclear hole')
|
||||
:add_param('range', false, 'integer-range', 1, 200)
|
||||
Commands.new_command("lawnmower", "Clean up biter corpse, decoratives and nuclear hole")
|
||||
:add_param("range", false, "integer-range", 1, 200)
|
||||
:register(function(player, range)
|
||||
local tile_to_do = {}
|
||||
|
||||
player.surface.destroy_decoratives({position=player.position, radius=range})
|
||||
player.surface.destroy_decoratives{ position = player.position, radius = range }
|
||||
|
||||
local entities = player.surface.find_entities_filtered{position=player.position, radius=range, type='corpse'}
|
||||
local entities = player.surface.find_entities_filtered{ position = player.position, radius = range, type = "corpse" }
|
||||
|
||||
for _, entity in pairs(entities) do
|
||||
if (entity.name ~= 'transport-caution-corpse' and entity.name ~= 'invisible-transport-caution-corpse') then
|
||||
if (entity.name ~= "transport-caution-corpse" and entity.name ~= "invisible-transport-caution-corpse") then
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
|
||||
local tiles = player.surface.find_tiles_filtered{position=player.position, radius=range, name={'nuclear-ground'}}
|
||||
local tiles = player.surface.find_tiles_filtered{ position = player.position, radius = range, name = { "nuclear-ground" } }
|
||||
|
||||
for _, tile in pairs(tiles) do
|
||||
table.insert(tile_to_do, {name='grass-1', position=tile.position})
|
||||
table.insert(tile_to_do, { name = "grass-1", position = tile.position })
|
||||
end
|
||||
|
||||
player.surface.set_tiles(tile_to_do)
|
||||
@@ -35,7 +35,7 @@ Commands.new_command('lawnmower', {'expcom-lawnmower.description'}, 'Clean up bi
|
||||
end)
|
||||
|
||||
local function destroy_decoratives(entity)
|
||||
if entity.type ~= 'entity-ghost' and entity.type ~= 'tile-ghost' and entity.prototype.selectable_in_game then
|
||||
if entity.type ~= "entity-ghost" and entity.type ~= "tile-ghost" and entity.prototype.selectable_in_game then
|
||||
entity.surface.destroy_decoratives{ area = entity.selection_box }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,16 +8,13 @@ local config_res = require("modules.exp_legacy.config.research") --- @dep config
|
||||
|
||||
local function add_log(data)
|
||||
game.write_file(config.file_name, data, true, 0)
|
||||
game.write_file(config.file_name, '\n', true, 0)
|
||||
game.write_file(config.file_name, "\n", true, 0)
|
||||
end
|
||||
|
||||
Event.add(defines.events.on_rocket_launched, function(event)
|
||||
if event and event.rocket and event.rocket.force and event.rocket.force.rockets_launched then
|
||||
if event.rocket.force.rockets_launched >= config.rocket_launch_display_rate and event.rocket.force.rockets_launched % config.rocket_launch_display_rate == 0 then
|
||||
add_log('[ROCKET] ' .. event.rocket.force.rockets_launched .. ' rockets launched')
|
||||
|
||||
elseif config.rocket_launch_display[event.rocket.force.rockets_launched] then
|
||||
add_log('[ROCKET] ' .. event.rocket.force.rockets_launched .. ' rockets launched')
|
||||
if config.rocket_launch_display[event.rocket.force.rockets_launched] then
|
||||
add_log("[ROCKET] " .. event.rocket.force.rockets_launched .. " rockets launched")
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -25,15 +22,13 @@ end)
|
||||
Event.add(defines.events.on_pre_player_died, function(event)
|
||||
if event and event.player_index then
|
||||
if event.cause then
|
||||
if event.cause.type and event.cause.type == 'character' and event.cause.player and event.cause.player.index then
|
||||
add_log('[DEATH] ' .. game.players[event.player_index].name .. ' died because of ' .. (game.players[event.cause.player.index].name or 'unknown reason'))
|
||||
|
||||
if event.cause.type and event.cause.type == "character" and event.cause.player and event.cause.player.index then
|
||||
add_log("[DEATH] " .. game.players[event.player_index].name .. " died because of " .. (game.players[event.cause.player.index].name or "unknown reason"))
|
||||
else
|
||||
add_log('[DEATH] ' .. game.players[event.player_index].name .. ' died because of ' .. (event.cause.name or 'unknown reason'))
|
||||
add_log("[DEATH] " .. game.players[event.player_index].name .. " died because of " .. (event.cause.name or "unknown reason"))
|
||||
end
|
||||
|
||||
else
|
||||
add_log('[DEATH] ' .. game.players[event.player_index].name .. ' died because of unknown reason')
|
||||
add_log("[DEATH] " .. game.players[event.player_index].name .. " died because of unknown reason")
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -45,27 +40,25 @@ Event.add(defines.events.on_research_finished, function(event)
|
||||
end
|
||||
|
||||
if (event.research.level and config_res.inf_res[event.research.name]) and (event.research.level >= config_res.inf_res[event.research.name]) then
|
||||
add_log({'logging.add-l', event.research.prototype.localised_name, event.research.level - 1})
|
||||
|
||||
add_log{ "logging.add-l", event.research.prototype.localised_name, event.research.level - 1 }
|
||||
else
|
||||
add_log({'logging.add-n', event.research.prototype.localised_name})
|
||||
add_log{ "logging.add-n", event.research.prototype.localised_name }
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Event.add(defines.events.on_player_joined_game, function(event)
|
||||
if event and event.player_index then
|
||||
add_log('[JOIN] ' .. game.players[event.player_index].name .. ' joined the game')
|
||||
add_log("[JOIN] " .. game.players[event.player_index].name .. " joined the game")
|
||||
end
|
||||
end)
|
||||
|
||||
Event.add(defines.events.on_player_left_game, function(event)
|
||||
if event and event.player_index then
|
||||
if event.reason then
|
||||
add_log('[LEAVE] ' .. game.players[event.player_index].name .. config.disconnect_reason[event.reason])
|
||||
|
||||
add_log("[LEAVE] " .. game.players[event.player_index].name .. config.disconnect_reason[event.reason])
|
||||
else
|
||||
add_log('[LEAVE] ' .. game.players[event.player_index].name .. config.disconnect_reason[defines.disconnect_reason.quit])
|
||||
add_log("[LEAVE] " .. game.players[event.player_index].name .. config.disconnect_reason[defines.disconnect_reason.quit])
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -12,7 +12,6 @@ miner_data.queue = {}
|
||||
local function drop_target(entity)
|
||||
if entity.drop_target then
|
||||
return entity.drop_target
|
||||
|
||||
else
|
||||
local entities = entity.surface.find_entities_filtered{ position = entity.drop_position }
|
||||
|
||||
@@ -43,7 +42,7 @@ local function check_entity(entity)
|
||||
return true
|
||||
end
|
||||
|
||||
if entity.has_flag('not-deconstructable') then
|
||||
if entity.has_flag("not-deconstructable") then
|
||||
-- if it can deconstruct
|
||||
return true
|
||||
end
|
||||
@@ -58,13 +57,13 @@ local function chest_check(entity)
|
||||
return
|
||||
end
|
||||
|
||||
if target.type ~= 'logistic-container' and target.type ~= 'container' then
|
||||
if target.type ~= "logistic-container" and target.type ~= "container" then
|
||||
-- not a chest
|
||||
return
|
||||
end
|
||||
|
||||
local radius = 2
|
||||
local entities = target.surface.find_entities_filtered{area={{target.position.x - radius, target.position.y - radius}, {target.position.x + radius, target.position.y + radius}}, type={'mining-drill', 'inserter'}}
|
||||
local entities = target.surface.find_entities_filtered{ area = { { target.position.x - radius, target.position.y - radius }, { target.position.x + radius, target.position.y + radius } }, type = { "mining-drill", "inserter" } }
|
||||
|
||||
for _, e in pairs(entities) do
|
||||
if drop_target(e) == target then
|
||||
@@ -85,7 +84,7 @@ local function miner_check(entity)
|
||||
local ef = entity.force
|
||||
local er = entity.prototype.mining_drill_radius
|
||||
|
||||
for _, r in pairs(entity.surface.find_entities_filtered{area={{x=ep.x - er, y=ep.y - er}, {x=ep.x + er, y=ep.y + er}}, type='resource'}) do
|
||||
for _, r in pairs(entity.surface.find_entities_filtered{ area = { { x = ep.x - er, y = ep.y - er }, { x = ep.x + er, y = ep.y + er } }, type = "resource" }) do
|
||||
if r.amount > 0 then
|
||||
return
|
||||
end
|
||||
@@ -108,8 +107,8 @@ local function miner_check(entity)
|
||||
local half = math.floor(entity.get_radius())
|
||||
local r = 1 + er
|
||||
|
||||
local entities = es.find_entities_filtered{area={{ep.x - r, ep.y - r}, {ep.x + r, ep.y + r}}, type={'mining-drill', 'pipe', 'pipe-to-ground'}}
|
||||
local entities_t = es.find_entities_filtered{area={{ep.x - r, ep.y - r}, {ep.x + r, ep.y + r}}, ghost_type={'pipe', 'pipe-to-ground'}}
|
||||
local entities = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, type = { "mining-drill", "pipe", "pipe-to-ground" } }
|
||||
local entities_t = es.find_entities_filtered{ area = { { ep.x - r, ep.y - r }, { ep.x + r, ep.y + r } }, ghost_type = { "pipe", "pipe-to-ground" } }
|
||||
|
||||
table.array_insert(entities, entities_t)
|
||||
|
||||
@@ -118,17 +117,14 @@ local function miner_check(entity)
|
||||
for h = 1, half do
|
||||
table.insert(pipe_build, { x = h, y = 0 })
|
||||
end
|
||||
|
||||
elseif (e.position.x < ep.x) and (e.position.y == ep.y) then
|
||||
for h = 1, half do
|
||||
table.insert(pipe_build, { x = -h, y = 0 })
|
||||
end
|
||||
|
||||
elseif (e.position.x == ep.x) and (e.position.y > ep.y) then
|
||||
for h = 1, half do
|
||||
table.insert(pipe_build, { x = 0, y = h })
|
||||
end
|
||||
|
||||
elseif (e.position.x == ep.x) and (e.position.y < ep.y) then
|
||||
for h = 1, half do
|
||||
table.insert(pipe_build, { x = 0, y = -h })
|
||||
@@ -144,7 +140,7 @@ local function miner_check(entity)
|
||||
table.insert(miner_data.queue, { t = game.tick + 5, e = entity })
|
||||
|
||||
for _, pos in ipairs(pipe_build) do
|
||||
es.create_entity{name='entity-ghost', position={x=ep.x + pos.x, y=ep.y + pos.y}, force=ef, inner_name='pipe', raise_built=true}
|
||||
es.create_entity{ name = "entity-ghost", position = { x = ep.x + pos.x, y = ep.y + pos.y }, force = ef, inner_name = "pipe", raise_built = true }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -153,7 +149,7 @@ Event.add(defines.events.on_resource_depleted, function(event)
|
||||
return
|
||||
end
|
||||
|
||||
local entities = event.entity.surface.find_entities_filtered{area={{event.entity.position.x - 1, event.entity.position.y - 1}, {event.entity.position.x + 1, event.entity.position.y + 1}}, type='mining-drill'}
|
||||
local entities = event.entity.surface.find_entities_filtered{ area = { { event.entity.position.x - 1, event.entity.position.y - 1 }, { event.entity.position.x + 1, event.entity.position.y + 1 } }, type = "mining-drill" }
|
||||
|
||||
if #entities == 0 then
|
||||
return
|
||||
@@ -171,7 +167,6 @@ Event.on_nth_tick(10, function(event)
|
||||
if not q.e or not q.e.valid then
|
||||
table.remove(miner_data.queue, k)
|
||||
break
|
||||
|
||||
elseif event.tick >= q.t then
|
||||
q.e.order_deconstruction(q.e.force)
|
||||
table.remove(miner_data.queue, k)
|
||||
|
||||
@@ -6,7 +6,6 @@ local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcor
|
||||
local config = require("modules.exp_legacy.config.nukeprotect") --- @dep config.nukeprotect
|
||||
local move_items_stack = _C.move_items_stack --- @dep expcore.common
|
||||
|
||||
|
||||
local function check_items(player, type)
|
||||
-- if the player has perms to be ignored, then they should be
|
||||
if config.ignore_permisison and Roles.player_allowed(player, config.ignore_permisison) then return end
|
||||
@@ -17,9 +16,9 @@ local function check_items(player, type)
|
||||
for i = 1, #inventory do
|
||||
local item = inventory[i]
|
||||
if item.valid and item.valid_for_read and config[tostring(type)][item.name] then
|
||||
player.print({ "nukeprotect.found", { "item-name." .. item.name } })
|
||||
player.print{ "nukeprotect.found", { "item-name." .. item.name } }
|
||||
-- insert the items into the table so all items are transferred at once
|
||||
move_items_stack({ item })
|
||||
move_items_stack{ item }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -35,7 +34,6 @@ for _, inventory in ipairs(config.inventories) do
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if config.disable_nuke_research then
|
||||
Event.add(defines.events.on_research_started, function(event)
|
||||
local name = event.research.name
|
||||
|
||||
@@ -30,8 +30,8 @@ Event.add(Protection.events.on_repeat_violation, function(event)
|
||||
end
|
||||
|
||||
local player_name_color = format_chat_player_name(player)
|
||||
Jail.jail_player(player, '<protection>', 'Removed too many protected entities, please wait for a moderator.')
|
||||
game.print{'protection-jail.jail', player_name_color}
|
||||
Jail.jail_player(player, "<protection>", "Removed too many protected entities, please wait for a moderator.")
|
||||
game.print{ "protection-jail.jail", player_name_color }
|
||||
end)
|
||||
|
||||
--- Clear the counter when they leave the game (stops a build up of data)
|
||||
|
||||
@@ -22,7 +22,7 @@ Event.add(Reports.events.on_player_reported, function(event)
|
||||
-- player less than 30 min
|
||||
if (Reports.count_reports(player) > 1) and (total_playtime > math.max(player.online_time * 2, 108000)) then
|
||||
local player_name_color = format_chat_player_name(player)
|
||||
Jail.jail_player(player, '<reports>', 'Reported by too many players, please wait for a moderator.')
|
||||
game.print{'report-jail.jail', player_name_color}
|
||||
Jail.jail_player(player, "<reports>", "Reported by too many players, please wait for a moderator.")
|
||||
game.print{ "report-jail.jail", player_name_color }
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -49,6 +49,7 @@ local function degrade_entity(entity)
|
||||
table.insert(tiles, { name = degrade_tile_name, position = p })
|
||||
end
|
||||
end
|
||||
|
||||
surface.set_tiles(tiles)
|
||||
end
|
||||
|
||||
@@ -75,6 +76,7 @@ local function get_tile_strength(surface, position)
|
||||
strength = strength + check_strength
|
||||
end
|
||||
end
|
||||
|
||||
return strength / 9
|
||||
end
|
||||
|
||||
|
||||
@@ -22,16 +22,16 @@ end
|
||||
|
||||
-- Get or create the force used for entities in spawn
|
||||
local function get_spawn_force()
|
||||
local force = game.forces['spawn']
|
||||
local force = game.forces["spawn"]
|
||||
|
||||
if force and force.valid then
|
||||
return force
|
||||
end
|
||||
|
||||
force = game.create_force('spawn')
|
||||
force.set_cease_fire('player', true)
|
||||
force = game.create_force("spawn")
|
||||
force.set_cease_fire("player", true)
|
||||
-- force.set_friend('player', true)
|
||||
game.forces['player'].set_cease_fire('spawn', true)
|
||||
game.forces["player"].set_cease_fire("spawn", true)
|
||||
-- game.forces['player'].set_friend('spawn', true)
|
||||
|
||||
return force
|
||||
@@ -57,11 +57,11 @@ local function spawn_turrets()
|
||||
for _, turret_pos in pairs(turrets) do
|
||||
local surface = game.surfaces[turret_pos.surface]
|
||||
local pos = turret_pos.position
|
||||
local turret = surface.find_entity('gun-turret', pos)
|
||||
local turret = surface.find_entity("gun-turret", pos)
|
||||
|
||||
-- Makes a new turret if it is not found
|
||||
if not turret or not turret.valid then
|
||||
turret = surface.create_entity{name='gun-turret', position=pos, force='spawn'}
|
||||
turret = surface.create_entity{ name = "gun-turret", position = pos, force = "spawn" }
|
||||
protect_entity(turret)
|
||||
end
|
||||
|
||||
@@ -83,7 +83,7 @@ local function spawn_belts(surface, position)
|
||||
local set_position = apply_offset(position, belt_set)
|
||||
for _, belt in pairs(belt_details) do
|
||||
local pos = apply_offset(set_position, belt)
|
||||
local belt_entity = surface.create_entity{name=belt_type, position=pos, force='neutral', direction=belt[3]}
|
||||
local belt_entity = surface.create_entity{ name = belt_type, position = pos, force = "neutral", direction = belt[3] }
|
||||
|
||||
if config.afk_belts.protected then
|
||||
protect_entity(belt_entity)
|
||||
@@ -113,6 +113,7 @@ local function spawn_water(surface, position)
|
||||
for _, tile in pairs(config.water.locations) do
|
||||
table.insert(tiles_to_make, { name = water_tile, position = apply_offset(position, tile) })
|
||||
end
|
||||
|
||||
surface.set_tiles(tiles_to_make)
|
||||
end
|
||||
|
||||
@@ -121,7 +122,7 @@ local function spawn_entities(surface, position)
|
||||
position = apply_offset(position, config.entities.offset)
|
||||
for _, entity in pairs(config.entities.locations) do
|
||||
local pos = apply_offset(position, { x = entity[2], y = entity[3] })
|
||||
entity = surface.create_entity{name=entity[1], position=pos, force='neutral'}
|
||||
entity = surface.create_entity{ name = entity[1], position = pos, force = "neutral" }
|
||||
|
||||
if config.entities.protected then
|
||||
protect_entity(entity)
|
||||
@@ -143,7 +144,7 @@ local function spawn_area(surface, position)
|
||||
local fill_tile = surface.get_tile(position).name
|
||||
|
||||
-- Make sure a non water tile is used for each tile
|
||||
if surface.get_tile(position).collides_with('player') then fill_tile = 'landfill' end
|
||||
if surface.get_tile(position).collides_with("player") then fill_tile = "landfill" end
|
||||
if decon_tile == nil then decon_tile = fill_tile end
|
||||
|
||||
local tiles_to_make = {}
|
||||
@@ -156,7 +157,7 @@ local function spawn_area(surface, position)
|
||||
if dst < tr2 then
|
||||
-- If it is inside the decon radius always set the tile
|
||||
table.insert(tiles_to_make, { name = decon_tile, position = pos })
|
||||
elseif dst < fr2 and surface.get_tile(pos).collides_with('player') then
|
||||
elseif dst < fr2 and surface.get_tile(pos).collides_with("player") then
|
||||
-- If it is inside the fill radius only set the tile if it is water
|
||||
table.insert(tiles_to_make, { name = fill_tile, position = pos })
|
||||
end
|
||||
@@ -164,10 +165,11 @@ local function spawn_area(surface, position)
|
||||
end
|
||||
|
||||
-- Remove entities then set the tiles
|
||||
local entities_to_remove = surface.find_entities_filtered{position=position, radius=dr, name='character', invert=true}
|
||||
local entities_to_remove = surface.find_entities_filtered{ position = position, radius = dr, name = "character", invert = true }
|
||||
for _, entity in pairs(entities_to_remove) do
|
||||
entity.destroy()
|
||||
end
|
||||
|
||||
surface.set_tiles(tiles_to_make)
|
||||
end
|
||||
|
||||
@@ -176,7 +178,7 @@ local function spawn_resource_tiles(surface)
|
||||
if v.enabled then
|
||||
for x = v.offset[1], v.offset[1] + v.size[1] do
|
||||
for y = v.offset[2], v.offset[2] + v.size[2] do
|
||||
surface.create_entity({name=v.name, amount=v.amount, position={x, y}})
|
||||
surface.create_entity{ name = v.name, amount = v.amount, position = { x, y } }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -187,7 +189,7 @@ local function spawn_resource_patches(surface)
|
||||
for _, v in ipairs(config.resource_patches.resources) do
|
||||
if v.enabled then
|
||||
for i = 1, v.num_patches do
|
||||
surface.create_entity({name=v.name, amount=v.amount, position={v.offset[1] + v.offset_next[1] * (i - 1), v.offset[2] + v.offset_next[2] * (i - 1)}})
|
||||
surface.create_entity{ name = v.name, amount = v.amount, position = { v.offset[1] + v.offset_next[1] * (i - 1), v.offset[2] + v.offset_next[2] * (i - 1) } }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,14 +5,14 @@ local config = require("modules.exp_legacy.config.station_auto_name") --- @dep c
|
||||
|
||||
-- Credit to Cooldude2606 for using his lua magic to make this function.
|
||||
local directions = {
|
||||
['W'] = -0.875,
|
||||
['NW'] = -0.625,
|
||||
['N'] = -0.375,
|
||||
['NE'] = -0.125,
|
||||
['E'] = 0.125,
|
||||
['SE'] = 0.375,
|
||||
['S'] = 0.625,
|
||||
['SW'] = 0.875
|
||||
["W"] = -0.875,
|
||||
["NW"] = -0.625,
|
||||
["N"] = -0.375,
|
||||
["NE"] = -0.125,
|
||||
["E"] = 0.125,
|
||||
["SE"] = 0.375,
|
||||
["S"] = 0.625,
|
||||
["SW"] = 0.875,
|
||||
}
|
||||
|
||||
local function Angle(entity)
|
||||
@@ -22,10 +22,11 @@ local function Angle(entity)
|
||||
return direction
|
||||
end
|
||||
end
|
||||
return 'W'
|
||||
|
||||
return "W"
|
||||
end
|
||||
|
||||
local custom_string = ' *'
|
||||
local custom_string = " *"
|
||||
local custom_string_len = #custom_string
|
||||
|
||||
local function station_name_changer(event)
|
||||
@@ -34,10 +35,9 @@ local function station_name_changer(event)
|
||||
if name == "entity-ghost" then
|
||||
if entity.ghost_name ~= "train-stop" then return end
|
||||
local backername = entity.backer_name
|
||||
if backername ~= '' then
|
||||
if backername ~= "" then
|
||||
entity.backer_name = backername .. custom_string
|
||||
end
|
||||
|
||||
elseif name == "train-stop" then -- only do the event if its a train stop
|
||||
local backername = entity.backer_name
|
||||
if backername:sub(-custom_string_len) == custom_string then
|
||||
@@ -63,24 +63,23 @@ local function station_name_changer(event)
|
||||
recourse_closed = item
|
||||
closest_distance = distance
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local item_name = recourse_closed.name
|
||||
if item_name then -- prevent errors if something went wrong
|
||||
local item_name2 = item_name:gsub("^%l", string.upper):gsub('-', ' ') -- removing the - and making first letter capital
|
||||
local item_name2 = item_name:gsub("^%l", string.upper):gsub("-", " ") -- removing the - and making first letter capital
|
||||
|
||||
local item_type = 'item'
|
||||
if item_name == 'crude-oil' then
|
||||
item_type = 'fluid'
|
||||
local item_type = "item"
|
||||
if item_name == "crude-oil" then
|
||||
item_type = "fluid"
|
||||
end
|
||||
|
||||
entity.backer_name = config.station_name:gsub('__icon__', '[img=' .. item_type .. '.' .. item_name .. ']')
|
||||
:gsub('__item_name__', item_name2)
|
||||
:gsub('__backer_name__', entity.backer_name)
|
||||
:gsub('__direction__', Angle(entity))
|
||||
:gsub('__x__', math.floor(entity.position.x))
|
||||
:gsub('__y__', math.floor(entity.position.y))
|
||||
entity.backer_name = config.station_name:gsub("__icon__", "[img=" .. item_type .. "." .. item_name .. "]")
|
||||
:gsub("__item_name__", item_name2)
|
||||
:gsub("__backer_name__", entity.backer_name)
|
||||
:gsub("__direction__", Angle(entity))
|
||||
:gsub("__x__", math.floor(entity.position.x))
|
||||
:gsub("__y__", math.floor(entity.position.y))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -18,27 +18,30 @@ end)
|
||||
local function get_permission(player_index)
|
||||
if cache[player_index] == nil then
|
||||
local player = game.players[player_index]
|
||||
if Roles.player_allowed(player, 'fast-tree-decon') then cache[player_index] = 'fast'
|
||||
elseif Roles.player_allowed(player, 'standard-decon') then cache[player_index] = 'standard'
|
||||
else cache[player_index] = player.force end
|
||||
if Roles.player_allowed(player, "fast-tree-decon") then
|
||||
cache[player_index] = "fast"
|
||||
elseif Roles.player_allowed(player, "standard-decon") then
|
||||
cache[player_index] = "standard"
|
||||
else
|
||||
cache[player_index] = player.force
|
||||
end
|
||||
end
|
||||
|
||||
return cache[player_index]
|
||||
end
|
||||
|
||||
-- Left menu button to toggle between fast decon and normal decon marking
|
||||
local HasEnabledDecon = PlayerData.Settings:combine('HasEnabledDecon')
|
||||
local HasEnabledDecon = PlayerData.Settings:combine("HasEnabledDecon")
|
||||
HasEnabledDecon:set_default(false)
|
||||
|
||||
Gui.toolbar_toggle_button("entity/tree-01", {'tree-decon.main-tooltip'}, function (player)
|
||||
Gui.toolbar_toggle_button("entity/tree-01", { "tree-decon.main-tooltip" }, function(player)
|
||||
return Roles.player_allowed(player, "fast-tree-decon")
|
||||
end)
|
||||
:on_event(Gui.events.on_toolbar_button_toggled, function(player, _, event)
|
||||
HasEnabledDecon:set(player, event.state)
|
||||
player.print{'tree-decon.toggle-msg', event.state and {'tree-decon.enabled'} or {'tree-decon.disabled'}}
|
||||
player.print{ "tree-decon.toggle-msg", event.state and { "tree-decon.enabled" } or { "tree-decon.disabled" } }
|
||||
end)
|
||||
|
||||
|
||||
-- Add trees to queue when marked, only allows simple entities and for players with role permission
|
||||
Event.add(defines.events.on_marked_for_deconstruction, function(event)
|
||||
-- Check which type of decon a player is allowed
|
||||
@@ -52,24 +55,23 @@ Event.add(defines.events.on_marked_for_deconstruction, function(event)
|
||||
-- Not allowed to decon this entity
|
||||
local last_user = entity.last_user
|
||||
local allow = get_permission(index)
|
||||
if last_user and allow ~= 'standard' and allow ~= 'fast' then
|
||||
if last_user and allow ~= "standard" and allow ~= "fast" then
|
||||
entity.cancel_deconstruction(allow)
|
||||
return
|
||||
end
|
||||
|
||||
-- Allowed to decon this entity, but not fast
|
||||
if allow ~= 'fast' then return end
|
||||
if allow ~= "fast" then return end
|
||||
|
||||
local player = game.get_player(index)
|
||||
if not HasEnabledDecon:get(player) then return end
|
||||
|
||||
-- Allowed fast decon on this entity, just trees
|
||||
local head = tree_queue._head + 1
|
||||
if not last_user and entity.type ~= 'cliff' then
|
||||
if not last_user and entity.type ~= "cliff" then
|
||||
tree_queue[head] = entity
|
||||
tree_queue._head = head
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
-- Remove trees at random till the queue is empty
|
||||
@@ -89,6 +91,7 @@ Event.add(defines.events.on_tick, function()
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
|
||||
tree_queue._head = head
|
||||
end)
|
||||
|
||||
@@ -101,15 +104,15 @@ end)
|
||||
|
||||
-- Clear trees when hit with a car
|
||||
Event.add(defines.events.on_entity_damaged, function(event)
|
||||
if not (event.damage_type.name == 'impact' and event.force) then
|
||||
if not (event.damage_type.name == "impact" and event.force) then
|
||||
return
|
||||
end
|
||||
|
||||
if not (event.entity.type == 'tree' or event.entity.type == 'simple-entity') then
|
||||
if not (event.entity.type == "tree" or event.entity.type == "simple-entity") then
|
||||
return
|
||||
end
|
||||
|
||||
if (not event.cause) or (event.cause.type ~= 'car')then
|
||||
if (not event.cause) or (event.cause.type ~= "car") then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
@@ -10,17 +10,18 @@ require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
--- 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', {'expcom-admin-chat.description'}, 'Sends a message in chat that only admins can see.')
|
||||
:add_param('message', false)
|
||||
Commands.new_command("admin-chat", { "expcom-admin-chat.description" }, "Sends a message in chat that only admins can see.")
|
||||
:add_param("message", false)
|
||||
:enable_auto_concat()
|
||||
:set_flag('admin_only')
|
||||
:add_alias('ac')
|
||||
:set_flag("admin_only")
|
||||
:add_alias("ac")
|
||||
:register(function(player, message)
|
||||
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{'expcom-admin-chat.format', player_name_colour, message}
|
||||
return_player.print{ "expcom-admin-chat.format", player_name_colour, message }
|
||||
end
|
||||
end
|
||||
|
||||
return Commands.success -- prevents command complete message from showing
|
||||
end)
|
||||
|
||||
@@ -13,7 +13,7 @@ local markers = {} -- Stores all admin markers
|
||||
--- Storage variables
|
||||
Storage.register({
|
||||
admins = admins,
|
||||
markers = markers
|
||||
markers = markers,
|
||||
}, function(tbl)
|
||||
admins = tbl.admins
|
||||
markers = tbl.markers
|
||||
@@ -21,18 +21,18 @@ end)
|
||||
|
||||
--- Toggle admin marker mode, can only be applied to yourself
|
||||
-- @command admin-marker
|
||||
Commands.new_command('admin-marker', {'expcom-admin-marker.description'}, 'Toggles admin marker mode, new markers can only be edited by admins')
|
||||
:set_flag('admin_only')
|
||||
:add_alias('am', 'admin-markers')
|
||||
Commands.new_command("admin-marker", { "expcom-admin-marker.description" }, "Toggles admin marker mode, new markers can only be edited by admins")
|
||||
:set_flag("admin_only")
|
||||
:add_alias("am", "admin-markers")
|
||||
:register(function(player)
|
||||
if admins[player.name] then
|
||||
-- Exit admin mode
|
||||
admins[player.name] = nil
|
||||
return Commands.success{'expcom-admin-marker.exit'}
|
||||
return Commands.success{ "expcom-admin-marker.exit" }
|
||||
else
|
||||
-- Enter admin mode
|
||||
admins[player.name] = true
|
||||
return Commands.success{'expcom-admin-marker.enter'}
|
||||
return Commands.success{ "expcom-admin-marker.enter" }
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -43,7 +43,7 @@ Event.add(defines.events.on_chart_tag_added, function(event)
|
||||
if not admins[player.name] then return end
|
||||
local tag = event.tag
|
||||
markers[tag.force.name .. tag.tag_number] = true
|
||||
Commands.print({'expcom-admin-marker.place'}, nil, player)
|
||||
Commands.print({ "expcom-admin-marker.place" }, nil, player)
|
||||
end)
|
||||
|
||||
--- Listen for players leaving the game, leave admin mode to avoid unexpected admin markers
|
||||
@@ -61,18 +61,18 @@ local function maintain_tag(event)
|
||||
local player = game.get_player(event.player_index)
|
||||
if player.admin then
|
||||
-- Player is admin, tell them it was an admin marker
|
||||
Commands.print({'expcom-admin-marker.edit'}, nil, player)
|
||||
Commands.print({ "expcom-admin-marker.edit" }, nil, player)
|
||||
elseif event.name == defines.events.on_chart_tag_modified then
|
||||
-- Tag was modified, revert the changes
|
||||
tag.text = event.old_text
|
||||
tag.last_user = event.old_player
|
||||
if event.old_icon then tag.icon = event.old_icon end
|
||||
player.play_sound{path='utility/wire_pickup'}
|
||||
Commands.print({'expcom-admin-marker.revert'}, nil, player)
|
||||
player.play_sound{ path = "utility/wire_pickup" }
|
||||
Commands.print({ "expcom-admin-marker.revert" }, nil, player)
|
||||
else
|
||||
-- Tag was removed, remake the tag
|
||||
player.play_sound{path='utility/wire_pickup'}
|
||||
Commands.print({'expcom-admin-marker.revert'}, 'orange_red', player)
|
||||
player.play_sound{ path = "utility/wire_pickup" }
|
||||
Commands.print({ "expcom-admin-marker.revert" }, "orange_red", player)
|
||||
local new_tag = tag.force.add_chart_tag(tag.surface, {
|
||||
last_user = tag.last_user,
|
||||
position = tag.position,
|
||||
|
||||
@@ -6,21 +6,17 @@
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
local Selection = require("modules.exp_legacy.modules.control.selection") --- @dep modules.control.selection
|
||||
local SelectionArtyArea = 'ArtyArea'
|
||||
local SelectionArtyArea = "ArtyArea"
|
||||
|
||||
local function location_break(player, pos)
|
||||
if player.force.is_chunk_charted(player.surface, { x = math.floor(pos.left_top.x / 32), y = math.floor(pos.left_top.y / 32) }) then
|
||||
return true
|
||||
|
||||
elseif player.force.is_chunk_charted(player.surface, { x = math.floor(pos.left_top.x / 32), y = math.floor(pos.right_bottom.y / 32) }) then
|
||||
return true
|
||||
|
||||
elseif player.force.is_chunk_charted(player.surface, { x = math.floor(pos.right_bottom.x / 32), y = math.floor(pos.left_top.y / 32) }) then
|
||||
return true
|
||||
|
||||
elseif player.force.is_chunk_charted(player.surface, { x = math.floor(pos.right_bottom.x / 32), y = math.floor(pos.right_bottom.y / 32) }) then
|
||||
return true
|
||||
|
||||
else
|
||||
return false
|
||||
end
|
||||
@@ -30,7 +26,7 @@ end
|
||||
local function aabb_align_expand(aabb)
|
||||
return {
|
||||
left_top = { x = math.floor(aabb.left_top.x), y = math.floor(aabb.left_top.y) },
|
||||
right_bottom = {x = math.ceil(aabb.right_bottom.x), y = math.ceil(aabb.right_bottom.y)}
|
||||
right_bottom = { x = math.ceil(aabb.right_bottom.x), y = math.ceil(aabb.right_bottom.y) },
|
||||
}
|
||||
end
|
||||
|
||||
@@ -50,7 +46,7 @@ Selection.on_selection(SelectionArtyArea, function(event)
|
||||
local count = 0
|
||||
local hit = {}
|
||||
|
||||
for _, e in pairs(player.surface.find_entities_filtered({area=area, type={'unit-spawner', 'turret'}, force='enemy'})) do
|
||||
for _, e in pairs(player.surface.find_entities_filtered{ area = area, type = { "unit-spawner", "turret" }, force = "enemy" }) do
|
||||
local skip = false
|
||||
|
||||
for _, pos in ipairs(hit) do
|
||||
@@ -61,7 +57,7 @@ Selection.on_selection(SelectionArtyArea, function(event)
|
||||
end
|
||||
|
||||
if not skip then
|
||||
player.surface.create_entity{name='artillery-flare', position=e.position, force=player.force, life_time=240, movement={0, 0}, height=0, vertical_speed=0, frame_speed=0}
|
||||
player.surface.create_entity{ name = "artillery-flare", position = e.position, force = player.force, life_time = 240, movement = { 0, 0 }, height = 0, vertical_speed = 0, frame_speed = 0 }
|
||||
table.insert(hit, e.position)
|
||||
count = count + 1
|
||||
|
||||
@@ -72,7 +68,7 @@ Selection.on_selection(SelectionArtyArea, function(event)
|
||||
end
|
||||
end)
|
||||
|
||||
Commands.new_command('artillery-target-remote', {'expcom-artillery.description'}, 'Artillery Target Remote')
|
||||
Commands.new_command("artillery-target-remote", { "expcom-artillery.description" }, "Artillery Target Remote")
|
||||
:register(function(player)
|
||||
if Selection.is_selecting(player, SelectionArtyArea) then
|
||||
Selection.stop(player)
|
||||
|
||||
@@ -6,20 +6,20 @@
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
Commands.new_command('bot-queue-get', {'expcom-bot-queue.description-get'}, 'Get bot queue')
|
||||
:set_flag('admin_only')
|
||||
Commands.new_command("bot-queue-get", { "expcom-bot-queue.description-get" }, "Get bot queue")
|
||||
:set_flag("admin_only")
|
||||
:register(function(player)
|
||||
local s = player.force.max_successful_attempts_per_tick_per_construction_queue
|
||||
local f = player.force.max_failed_attempts_per_tick_per_construction_queue
|
||||
return Commands.success{'expcom-bot-queue.result', player.name, s, f}
|
||||
return Commands.success{ "expcom-bot-queue.result", player.name, s, f }
|
||||
end)
|
||||
|
||||
Commands.new_command('bot-queue-set', {'expcom-bot-queue.description-set'}, 'Set bot queue')
|
||||
:add_param('amount', 'integer-range', 1, 20)
|
||||
:set_flag('admin_only')
|
||||
Commands.new_command("bot-queue-set", { "expcom-bot-queue.description-set" }, "Set bot queue")
|
||||
:add_param("amount", "integer-range", 1, 20)
|
||||
:set_flag("admin_only")
|
||||
:register(function(player, amount)
|
||||
player.force.max_successful_attempts_per_tick_per_construction_queue = 3 * amount
|
||||
player.force.max_failed_attempts_per_tick_per_construction_queue = 1 * amount
|
||||
game.print{'expcom-bot-queue.result', player.name, 3 * amount, 1 * amount}
|
||||
game.print{ "expcom-bot-queue.result", player.name, 3 * amount, 1 * amount }
|
||||
return Commands.success
|
||||
end)
|
||||
|
||||
@@ -9,37 +9,37 @@ require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
--- 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', {'expcom-cheat.description-cheat'}, 'Toggles cheat mode for your player, or another player.')
|
||||
:add_param('player', true, 'player')
|
||||
Commands.new_command("toggle-cheat-mode", { "expcom-cheat.description-cheat" }, "Toggles cheat mode for your player, or another player.")
|
||||
:add_param("player", true, "player")
|
||||
:set_defaults{ player = function(player)
|
||||
return player -- default is the user using the command
|
||||
end }
|
||||
:set_flag('admin_only')
|
||||
:set_flag("admin_only")
|
||||
:register(function(_, player)
|
||||
player.cheat_mode = not player.cheat_mode
|
||||
return Commands.success
|
||||
end)
|
||||
|
||||
Commands.new_command('research-all', {'expcom-cheat.description-res'}, 'Set all research for your force.')
|
||||
:set_flag('admin_only')
|
||||
:add_param('force', true, 'force')
|
||||
Commands.new_command("research-all", { "expcom-cheat.description-res" }, "Set all research for your force.")
|
||||
:set_flag("admin_only")
|
||||
:add_param("force", true, "force")
|
||||
:set_defaults{ force = function(player)
|
||||
return player.force
|
||||
end }
|
||||
:register(function(player, force)
|
||||
force.research_all_technologies()
|
||||
game.print{'expcom-cheat.res', player.name}
|
||||
game.print{ "expcom-cheat.res", player.name }
|
||||
return Commands.success
|
||||
end)
|
||||
|
||||
Commands.new_command('toggle-always-day', {'expcom-cheat.description-day'}, 'Toggles always day in surface.')
|
||||
:set_flag('admin_only')
|
||||
:add_param('surface', true, 'surface')
|
||||
Commands.new_command("toggle-always-day", { "expcom-cheat.description-day" }, "Toggles always day in surface.")
|
||||
:set_flag("admin_only")
|
||||
:add_param("surface", true, "surface")
|
||||
:set_defaults{ surface = function(player)
|
||||
return player.surface
|
||||
end }
|
||||
:register(function(player, surface)
|
||||
surface.always_day = not surface.always_day
|
||||
game.print{'expcom-cheat.day', player.name, surface.always_day}
|
||||
game.print{ "expcom-cheat.day", player.name, surface.always_day }
|
||||
return Commands.success
|
||||
end)
|
||||
|
||||
@@ -10,13 +10,13 @@ require("modules.exp_legacy.config.expcore.command_role_parse")
|
||||
--- Clears a players inventory
|
||||
-- @command clear-inventory
|
||||
-- @tparam LuaPlayer player the player to clear the inventory of
|
||||
Commands.new_command('clear-inventory', {'expcom-clr-inv.description'}, 'Clears a players inventory')
|
||||
:add_param('player', false, 'player-role')
|
||||
:add_alias('clear-inv', 'move-inventory', 'move-inv')
|
||||
Commands.new_command("clear-inventory", { "expcom-clr-inv.description" }, "Clears a players inventory")
|
||||
:add_param("player", false, "player-role")
|
||||
:add_alias("clear-inv", "move-inventory", "move-inv")
|
||||
:register(function(_, player)
|
||||
local inv = player.get_main_inventory()
|
||||
if not inv then
|
||||
return Commands.error{'expcore-commands.reject-player-alive'}
|
||||
return Commands.error{ "expcore-commands.reject-player-alive" }
|
||||
end
|
||||
move_items_stack(inv)
|
||||
inv.clear()
|
||||
|
||||
@@ -30,20 +30,20 @@ local function get_server_id(server)
|
||||
end
|
||||
|
||||
if server_count > 1 then
|
||||
return false, Commands.error{'expcom-connect.too-many-matching', concat(server_names, ', ')}
|
||||
return false, Commands.error{ "expcom-connect.too-many-matching", concat(server_names, ", ") }
|
||||
elseif server_count == 1 then
|
||||
local server_id, server_details = next(servers)
|
||||
local status = External.get_server_status(server_id)
|
||||
if server_id == current_server.id then
|
||||
return false, Commands.error{'expcom-connect.same-server', server_details.name}
|
||||
elseif status == 'Offline' then
|
||||
return false, Commands.error{'expcom-connect.offline', server_details.name}
|
||||
return false, Commands.error{ "expcom-connect.same-server", server_details.name }
|
||||
elseif status == "Offline" then
|
||||
return false, Commands.error{ "expcom-connect.offline", server_details.name }
|
||||
end
|
||||
return true, server_id
|
||||
elseif server_count_before > 0 then
|
||||
return false, Commands.error{'expcom-connect.wrong-version', concat(server_names_before, ', ')}
|
||||
return false, Commands.error{ "expcom-connect.wrong-version", concat(server_names_before, ", ") }
|
||||
else
|
||||
return false, Commands.error{'expcom-connect.none-matching'}
|
||||
return false, Commands.error{ "expcom-connect.none-matching" }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -51,10 +51,10 @@ end
|
||||
-- @command connect
|
||||
-- @tparam string server The address or name of the server to connect to
|
||||
-- @tparam[opt=false] boolean is_address If an address was given for the server param
|
||||
Commands.new_command('connect', {'expcom-connect.description'}, 'Connect to another server')
|
||||
:add_param('server')
|
||||
:add_param('is_address', true, 'boolean')
|
||||
:add_alias('join', 'server')
|
||||
Commands.new_command("connect", { "expcom-connect.description" }, "Connect to another server")
|
||||
:add_param("server")
|
||||
:add_param("is_address", true, "boolean")
|
||||
:add_alias("join", "server")
|
||||
:register(function(player, server, is_address)
|
||||
local server_id = server
|
||||
if not is_address and External.valid() then
|
||||
@@ -71,10 +71,10 @@ end)
|
||||
-- @tparam string address The address or name of the server to connect to
|
||||
-- @tparam LuaPlayer player The player to connect to a different server
|
||||
-- @tparam[opt=false] boolean is_address If an address was given for the server param
|
||||
Commands.new_command('connect-player', {'expcom-connect.description-player'}, 'Send a player to a different server')
|
||||
:add_param('player', 'player-role')
|
||||
:add_param('server')
|
||||
:add_param('is_address', true, 'boolean')
|
||||
Commands.new_command("connect-player", { "expcom-connect.description-player" }, "Send a player to a different server")
|
||||
:add_param("player", "player-role")
|
||||
:add_param("server")
|
||||
:add_param("is_address", true, "boolean")
|
||||
:register(function(_, player, server, is_address)
|
||||
local server_id = server
|
||||
if not is_address and External.valid() then
|
||||
@@ -90,9 +90,9 @@ end)
|
||||
-- @command connect-all
|
||||
-- @tparam string address The address or name of the server to connect to
|
||||
-- @tparam[opt=false] boolean is_address If an address was given for the server param
|
||||
Commands.new_command('connect-all', {'expcom-connect.description-all'}, 'Connect all players to another server')
|
||||
:add_param('server')
|
||||
:add_param('is_address', true, 'boolean')
|
||||
Commands.new_command("connect-all", { "expcom-connect.description-all" }, "Connect all players to another server")
|
||||
:add_param("server")
|
||||
:add_param("is_address", true, "boolean")
|
||||
:register(function(_, server, is_address)
|
||||
local server_id = server
|
||||
if not is_address and External.valid() then
|
||||
|
||||
@@ -8,7 +8,7 @@ local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore
|
||||
|
||||
--- Opens the debug pannel for viewing tables.
|
||||
-- @command debug
|
||||
Commands.new_command('debug', {'expcom-debug.description'}, 'Opens the debug pannel for viewing tables.')
|
||||
Commands.new_command("debug", { "expcom-debug.description" }, "Opens the debug pannel for viewing tables.")
|
||||
:register(function(player)
|
||||
DebugView.open_dubug(player)
|
||||
end)
|
||||
|
||||
@@ -6,24 +6,24 @@
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
Commands.new_command('kill-biters', {'expcom-enemy.description-kill'}, 'Kill all biters only')
|
||||
:set_flag('admin_only')
|
||||
Commands.new_command("kill-biters", { "expcom-enemy.description-kill" }, "Kill all biters only")
|
||||
:set_flag("admin_only")
|
||||
:register(function(_, _)
|
||||
game.forces['enemy'].kill_all_units()
|
||||
game.forces["enemy"].kill_all_units()
|
||||
return Commands.success
|
||||
end)
|
||||
|
||||
Commands.new_command('remove-biters', {'expcom-enemy.description-remove'}, 'Remove biters and prevent generation')
|
||||
:set_flag('admin_only')
|
||||
:add_param('surface', true, 'surface')
|
||||
Commands.new_command("remove-biters", { "expcom-enemy.description-remove" }, "Remove biters and prevent generation")
|
||||
:set_flag("admin_only")
|
||||
:add_param("surface", true, "surface")
|
||||
:set_defaults{ surface = function(player)
|
||||
return player.surface
|
||||
end }
|
||||
:register(function(_, surface)
|
||||
for _, entity in pairs(surface.find_entities_filtered({force='enemy'})) do
|
||||
for _, entity in pairs(surface.find_entities_filtered{ force = "enemy" }) do
|
||||
entity.destroy()
|
||||
end
|
||||
|
||||
surface.map_gen_settings.autoplace_controls['enemy-base'].size = 'none'
|
||||
surface.map_gen_settings.autoplace_controls["enemy-base"].size = "none"
|
||||
return Commands.success
|
||||
end)
|
||||
|
||||
@@ -9,9 +9,9 @@ require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
--- 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', {'expcom-find.description'}, 'Find a player on your map.')
|
||||
:add_param('player', false, 'player-online')
|
||||
:add_alias('find', 'zoom-to')
|
||||
Commands.new_command("find-on-map", { "expcom-find.description" }, "Find a player on your map.")
|
||||
:add_param("player", false, "player-online")
|
||||
:add_alias("find", "zoom-to")
|
||||
:register(function(player, action_player)
|
||||
local position = action_player.position
|
||||
player.zoom_to_world(position, 1.75)
|
||||
|
||||
@@ -7,13 +7,13 @@ local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
-- For Modded Server Use
|
||||
Commands.new_command('toggle-friendly-fire', {'expcom-ff.description'}, 'Toggle friendly fire')
|
||||
:add_param('force', true, 'force')
|
||||
Commands.new_command("toggle-friendly-fire", { "expcom-ff.description" }, "Toggle friendly fire")
|
||||
:add_param("force", true, "force")
|
||||
:set_defaults{ force = function(player)
|
||||
return player.force
|
||||
end }
|
||||
:register(function(player, force)
|
||||
force.friendly_fire = not force.friendly_fire
|
||||
game.print{'expcom-ff.ff', player.name, force.friendly_fire}
|
||||
game.print{ "expcom-ff.ff", player.name, force.friendly_fire }
|
||||
return Commands.success
|
||||
end)
|
||||
|
||||
@@ -18,17 +18,17 @@ end)
|
||||
-- @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('search-help', {'expcom-chelp.description'}, 'Searches for a keyword in all commands you are allowed to use.')
|
||||
:add_alias('chelp', 'shelp', 'commands')
|
||||
:add_param('keyword', true)
|
||||
:add_param('page', true, 'integer')
|
||||
:set_defaults{keyword='', page=1}
|
||||
Commands.new_command("search-help", { "expcom-chelp.description" }, "Searches for a keyword in all commands you are allowed to use.")
|
||||
:add_alias("chelp", "shelp", "commands")
|
||||
:add_param("keyword", true)
|
||||
:add_param("page", true, "integer")
|
||||
:set_defaults{ keyword = "", page = 1 }
|
||||
:register(function(player, keyword, page)
|
||||
local player_index = player and player.index or 0
|
||||
-- if keyword is a number then treat it as page number
|
||||
if tonumber(keyword) then
|
||||
page = math.floor(tonumber(keyword))
|
||||
keyword = ''
|
||||
keyword = ""
|
||||
end
|
||||
|
||||
-- gets a value for pages, might have result in cache
|
||||
@@ -38,7 +38,6 @@ Commands.new_command('search-help', {'expcom-chelp.description'}, 'Searches for
|
||||
if search_cache[player_index] and search_cache[player_index].keyword == keyword:lower() then
|
||||
pages = search_cache[player_index].pages
|
||||
found = search_cache[player_index].found
|
||||
|
||||
else
|
||||
pages = { {} }
|
||||
local current_page = 1
|
||||
@@ -55,37 +54,37 @@ Commands.new_command('search-help', {'expcom-chelp.description'}, 'Searches for
|
||||
-- adds the new command to the page
|
||||
page_count = page_count + 1
|
||||
found = found + 1
|
||||
local alias_format = #command_data.aliases > 0 and {'expcom-chelp.alias', table.concat(command_data.aliases, ', ')} or ''
|
||||
local alias_format = #command_data.aliases > 0 and { "expcom-chelp.alias", table.concat(command_data.aliases, ", ") } or ""
|
||||
table.insert(pages[current_page], {
|
||||
'expcom-chelp.format',
|
||||
"expcom-chelp.format",
|
||||
command_data.name,
|
||||
command_data.description,
|
||||
command_data.help,
|
||||
alias_format
|
||||
alias_format,
|
||||
})
|
||||
end
|
||||
|
||||
-- adds the result to the cache
|
||||
search_cache[player_index] = {
|
||||
keyword = keyword:lower(),
|
||||
pages = pages,
|
||||
found=found
|
||||
found = found,
|
||||
}
|
||||
end
|
||||
|
||||
-- print the requested page
|
||||
keyword = keyword == '' and '<all>' or keyword
|
||||
Commands.print({'expcom-chelp.title', keyword}, 'cyan')
|
||||
keyword = keyword == "" and "<all>" or keyword
|
||||
Commands.print({ "expcom-chelp.title", keyword }, "cyan")
|
||||
|
||||
if pages[page] then
|
||||
for _, command in pairs(pages[page]) do
|
||||
Commands.print(command)
|
||||
end
|
||||
|
||||
Commands.print({'expcom-chelp.footer', found, page, #pages}, 'cyan')
|
||||
|
||||
Commands.print({ "expcom-chelp.footer", found, page, #pages }, "cyan")
|
||||
else
|
||||
Commands.print({'expcom-chelp.footer', found, page, #pages}, 'cyan')
|
||||
return Commands.error{'expcom-chelp.out-of-range', page}
|
||||
Commands.print({ "expcom-chelp.footer", found, page, #pages }, "cyan")
|
||||
return Commands.error{ "expcom-chelp.out-of-range", page }
|
||||
end
|
||||
-- blocks command complete message
|
||||
return Commands.success
|
||||
|
||||
@@ -14,7 +14,7 @@ end)
|
||||
|
||||
local function teleport(player, position)
|
||||
local surface = player.surface
|
||||
local pos = surface.find_non_colliding_position('character', position, 32, 1)
|
||||
local pos = surface.find_non_colliding_position("character", position, 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(pos, surface)
|
||||
@@ -24,27 +24,27 @@ end
|
||||
local function floor_pos(position)
|
||||
return {
|
||||
x = math.floor(position.x),
|
||||
y=math.floor(position.y)
|
||||
y = math.floor(position.y),
|
||||
}
|
||||
end
|
||||
|
||||
--- Teleports you to your home location
|
||||
-- @command home
|
||||
Commands.new_command('home', {'expcom-home.description-home'}, 'Teleports you to your home location')
|
||||
Commands.new_command("home", { "expcom-home.description-home" }, "Teleports you to your home location")
|
||||
:register(function(player)
|
||||
local home = homes[player.index]
|
||||
if not home or not home[1] then
|
||||
return Commands.error{'expcom-home.no-home'}
|
||||
return Commands.error{ "expcom-home.no-home" }
|
||||
end
|
||||
local rtn = floor_pos(player.position)
|
||||
teleport(player, home[1])
|
||||
home[2] = rtn
|
||||
Commands.print{'expcom-home.return-set', rtn.x, rtn.y}
|
||||
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', {'expcom-home.description-home-set'}, 'Sets your home location to your current position')
|
||||
Commands.new_command("home-set", { "expcom-home.description-home-set" }, "Sets your home location to your current position")
|
||||
:register(function(player)
|
||||
local home = homes[player.index]
|
||||
if not home then
|
||||
@@ -53,31 +53,31 @@ Commands.new_command('home-set', {'expcom-home.description-home-set'}, 'Sets you
|
||||
end
|
||||
local pos = floor_pos(player.position)
|
||||
home[1] = pos
|
||||
Commands.print{'expcom-home.home-set', pos.x, pos.y}
|
||||
Commands.print{ "expcom-home.home-set", pos.x, pos.y }
|
||||
end)
|
||||
|
||||
--- Returns your current home location
|
||||
-- @command home-get
|
||||
Commands.new_command('home-get', {'expcom-home.description-home-get'}, 'Returns your current home location')
|
||||
Commands.new_command("home-get", { "expcom-home.description-home-get" }, "Returns your current home location")
|
||||
:register(function(player)
|
||||
local home = homes[player.index]
|
||||
if not home or not home[1] then
|
||||
return Commands.error{'expcom-home.no-home'}
|
||||
return Commands.error{ "expcom-home.no-home" }
|
||||
end
|
||||
local pos = home[1]
|
||||
Commands.print{'expcom-home.home-get', pos.x, pos.y}
|
||||
Commands.print{ "expcom-home.home-get", pos.x, pos.y }
|
||||
end)
|
||||
|
||||
--- Teleports you to previous location
|
||||
-- @command return
|
||||
Commands.new_command('return', {'expcom-home.description-return'}, 'Teleports you to previous location')
|
||||
Commands.new_command("return", { "expcom-home.description-return" }, "Teleports you to previous location")
|
||||
:register(function(player)
|
||||
local home = homes[player.index]
|
||||
if not home or not home[2] then
|
||||
return Commands.error{'expcom-home.no-return'}
|
||||
return Commands.error{ "expcom-home.no-return" }
|
||||
end
|
||||
local rtn = floor_pos(player.position)
|
||||
teleport(player, home[2])
|
||||
home[2] = rtn
|
||||
Commands.print{'expcom-home.return-set', rtn.x, rtn.y}
|
||||
Commands.print{ "expcom-home.return-set", rtn.x, rtn.y }
|
||||
end)
|
||||
|
||||
@@ -8,18 +8,18 @@ local Storage = require("modules/exp_util/storage")
|
||||
|
||||
-- modules that are loaded into the interface env to be accessed
|
||||
local interface_modules = {
|
||||
['Commands'] = Commands,
|
||||
['output'] = _C.player_return,
|
||||
['Group'] = 'expcore.permission_groups',
|
||||
['Roles'] = 'expcore.roles',
|
||||
['Gui'] = 'expcore.gui',
|
||||
['Datastore'] = 'expcore.datastore',
|
||||
['External'] = 'expcore.external'
|
||||
["Commands"] = Commands,
|
||||
["output"] = _C.player_return,
|
||||
["Group"] = "expcore.permission_groups",
|
||||
["Roles"] = "expcore.roles",
|
||||
["Gui"] = "expcore.gui",
|
||||
["Datastore"] = "expcore.datastore",
|
||||
["External"] = "expcore.external",
|
||||
}
|
||||
|
||||
-- loads all the modules given in the above table
|
||||
for key, value in pairs(interface_modules) do
|
||||
if type(value) == 'string' then
|
||||
if type(value) == "string" then
|
||||
interface_modules[key] = _C.opt_require(value)
|
||||
end
|
||||
end
|
||||
@@ -42,7 +42,7 @@ end
|
||||
-- @tparam string name The name that the value is assigned to
|
||||
-- @tparam function callback The function that will be called to get the value
|
||||
local function add_interface_callback(name, callback)
|
||||
if type(callback) == 'function' then
|
||||
if type(callback) == "function" then
|
||||
interface_callbacks[name] = callback
|
||||
end
|
||||
end
|
||||
@@ -61,20 +61,20 @@ end
|
||||
--- Sends an invocation to be ran and returns the result.
|
||||
-- @command interface
|
||||
-- @tparam string invocation the command that will be run
|
||||
Commands.new_command('interface', {'expcom-interface.description'}, 'Sends an invocation to be ran and returns the result.')
|
||||
:add_param('invocation', false)
|
||||
Commands.new_command("interface", { "expcom-interface.description" }, "Sends an invocation to be ran and returns the result.")
|
||||
:add_param("invocation", false)
|
||||
:enable_auto_concat()
|
||||
:set_flag('admin_only')
|
||||
:set_flag("admin_only")
|
||||
:register(function(player, invocation)
|
||||
-- If the invocation has no white space then prepend return to it
|
||||
if not invocation:find('%s') and not invocation:find('return') then
|
||||
invocation = 'return '..invocation
|
||||
if not invocation:find("%s") and not invocation:find("return") then
|
||||
invocation = "return " .. invocation
|
||||
end
|
||||
|
||||
-- _env will be the new _ENV that the invocation will run inside of
|
||||
local _env = setmetatable({}, {
|
||||
__index = get_index,
|
||||
__newindex = interface_env
|
||||
__newindex = interface_env,
|
||||
})
|
||||
|
||||
-- If the command is ran by a player then load the dynamic values
|
||||
@@ -86,30 +86,30 @@ Commands.new_command('interface', {'expcom-interface.description'}, 'Sends an in
|
||||
end
|
||||
|
||||
-- Compile the invocation with the custom _env value
|
||||
local invocation_func, compile_error = load(invocation, 'interface', nil, _env)
|
||||
local invocation_func, compile_error = load(invocation, "interface", nil, _env)
|
||||
if compile_error then return Commands.error(compile_error) end
|
||||
|
||||
-- Run the invocation
|
||||
local success, rtn = pcall(invocation_func)
|
||||
if not success then
|
||||
local err = rtn:gsub('%.%.%..-/temp/currently%-playing', '')
|
||||
local err = rtn:gsub("%.%.%..-/temp/currently%-playing", "")
|
||||
return Commands.error(err)
|
||||
end
|
||||
return Commands.success(rtn)
|
||||
end)
|
||||
|
||||
-- Adds some basic callbacks for the interface
|
||||
add_interface_callback('player', function(player) return player end)
|
||||
add_interface_callback('surface', function(player) return player.surface end)
|
||||
add_interface_callback('force', function(player) return player.force end)
|
||||
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)
|
||||
add_interface_callback("player", function(player) return player end)
|
||||
add_interface_callback("surface", function(player) return player.surface end)
|
||||
add_interface_callback("force", function(player) return player.force end)
|
||||
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)
|
||||
|
||||
-- Module Return
|
||||
return {
|
||||
add_interface_module = add_interface_module,
|
||||
add_interface_callback = add_interface_callback,
|
||||
interface_env = interface_env,
|
||||
clean_stack_trace = function(str) return str:gsub('%.%.%..-/temp/currently%-playing', '') end
|
||||
clean_stack_trace = function(str) return str:gsub("%.%.%..-/temp/currently%-playing", "") end,
|
||||
}
|
||||
|
||||
@@ -12,36 +12,36 @@ require("modules.exp_legacy.config.expcore.command_role_parse")
|
||||
-- @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', {'expcom-jail.description-jail'}, 'Puts a player into jail and removes all other roles.')
|
||||
:add_param('player', false, 'player-role')
|
||||
:add_param('reason', true)
|
||||
Commands.new_command("jail", { "expcom-jail.description-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)
|
||||
reason = reason or 'Non Given.'
|
||||
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)
|
||||
local player_name = player and player.name or '<server>'
|
||||
local player_name = player and player.name or "<server>"
|
||||
if Jail.jail_player(action_player, player_name, reason) then
|
||||
game.print{'expcom-jail.give', action_player_name_color, by_player_name_color, reason}
|
||||
game.print{ "expcom-jail.give", action_player_name_color, by_player_name_color, reason }
|
||||
else
|
||||
return Commands.error{'expcom-jail.already-jailed', action_player_name_color}
|
||||
return Commands.error{ "expcom-jail.already-jailed", action_player_name_color }
|
||||
end
|
||||
end)
|
||||
|
||||
--- Removes a player from jail.
|
||||
-- @command unjail
|
||||
-- @tparam LuaPlayer the player that will be unjailed
|
||||
Commands.new_command('unjail', {'expcom-jail.description-unjail'}, 'Removes a player from jail.')
|
||||
:add_param('player', false, 'player-role')
|
||||
:add_alias('clear-jail', 'remove-jail')
|
||||
Commands.new_command("unjail", { "expcom-jail.description-unjail" }, "Removes a player from jail.")
|
||||
:add_param("player", false, "player-role")
|
||||
:add_alias("clear-jail", "remove-jail")
|
||||
:enable_auto_concat()
|
||||
:register(function(player, action_player)
|
||||
local action_player_name_color = format_chat_player_name(action_player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
local player_name = player and player.name or '<server>'
|
||||
local player_name = player and player.name or "<server>"
|
||||
if Jail.unjail_player(action_player, player_name) then
|
||||
game.print{'expcom-jail.remove', action_player_name_color, by_player_name_color}
|
||||
game.print{ "expcom-jail.remove", action_player_name_color, by_player_name_color }
|
||||
else
|
||||
return Commands.error{'expcom-jail.not-jailed', action_player_name_color}
|
||||
return Commands.error{ "expcom-jail.not-jailed", action_player_name_color }
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -11,8 +11,8 @@ require("modules.exp_legacy.config.expcore.command_role_parse")
|
||||
--- 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', {'expcom-kill.description'}, 'Kills yourself or another player.')
|
||||
:add_param('player', true, 'player-role-alive')
|
||||
Commands.new_command("kill", { "expcom-kill.description" }, "Kills yourself or another player.")
|
||||
: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
|
||||
@@ -22,15 +22,13 @@ end}
|
||||
:register(function(player, action_player)
|
||||
if not action_player then
|
||||
-- can only be nil if no player given and the user is dead
|
||||
return Commands.error{'expcom-kill.already-dead'}
|
||||
return Commands.error{ "expcom-kill.already-dead" }
|
||||
end
|
||||
if player == action_player then
|
||||
action_player.character.die()
|
||||
|
||||
elseif Roles.player_allowed(player, 'command/kill/always') then
|
||||
elseif Roles.player_allowed(player, "command/kill/always") then
|
||||
action_player.character.die()
|
||||
|
||||
else
|
||||
return Commands.error{'expcore-commands.unauthorized'}
|
||||
return Commands.error{ "expcore-commands.unauthorized" }
|
||||
end
|
||||
end)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user