mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
Add startable legacy code
This commit is contained in:
@@ -1,14 +1,23 @@
|
||||
--- This file defines the different triggers for the chat bot
|
||||
-- @config Chat-Reply
|
||||
|
||||
local Async = require 'expcore.async'
|
||||
local format_time = _C.format_time --- @dep expcore.common
|
||||
local ExpUtil = require("modules/exp_util")
|
||||
local Async = require("modules/exp_util/async")
|
||||
|
||||
-- eg Async(async_message, is_command or player, message)
|
||||
local async_message = Async.register(function(player, message)
|
||||
if player == true then game.print(message) else player.print(message) end
|
||||
local send_message_async =
|
||||
Async.register(function(player, message)
|
||||
if player == true then
|
||||
game.print(message)
|
||||
else
|
||||
player.print(message)
|
||||
end
|
||||
end)
|
||||
|
||||
local afk_time_units = {
|
||||
minutes = true,
|
||||
seconds = true,
|
||||
}
|
||||
|
||||
-- luacheck:ignore 212/player 212/is_command
|
||||
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
|
||||
@@ -37,7 +46,7 @@ return {
|
||||
max = next_player
|
||||
end
|
||||
end
|
||||
return {'chat-bot.afk', max.name, format_time(max.afk_time, {minutes = true, seconds = true, long = true})}
|
||||
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}
|
||||
@@ -74,46 +83,46 @@ return {
|
||||
end,
|
||||
['makepopcorn'] = function(player, _is_command)
|
||||
local timeout = math.floor(180*(math.random()+0.5))
|
||||
Async(async_message, true, {'chat-bot.reply', {'chat-bot.get-popcorn-1'}})
|
||||
Async.wait(timeout, async_message, 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)
|
||||
local timeout = math.floor(180*(math.random()+0.5))
|
||||
Async(async_message, player, {'chat-bot.reply', {'chat-bot.get-snaps-1'}})
|
||||
Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.get-snaps-2', player.name}})
|
||||
Async.wait(timeout*(math.random()+0.5), async_message, 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)
|
||||
local timeout = math.floor(180*(math.random()+0.5))
|
||||
Async(async_message, true, {'chat-bot.reply', {'chat-bot.get-cocktail-1'}})
|
||||
Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.get-cocktail-2', player.name}})
|
||||
Async.wait(timeout*(math.random()+0.5), async_message, 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)
|
||||
local timeout = math.floor(180*(math.random()+0.5))
|
||||
Async(async_message, true, {'chat-bot.reply', {'chat-bot.make-coffee-1'}})
|
||||
Async.wait(timeout, async_message, 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)
|
||||
local timeout = math.floor(180*(math.random()+0.5))
|
||||
Async(async_message, true, {'chat-bot.reply', {'chat-bot.order-pizza-1'}})
|
||||
Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.order-pizza-2', player.name}})
|
||||
Async.wait(timeout*(math.random()+0.5), async_message, 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)
|
||||
local timeout = math.floor(180*(math.random()+0.5))
|
||||
Async(async_message, true, {'chat-bot.reply', {'chat-bot.make-tea-1'}})
|
||||
Async.wait(timeout, async_message, 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)
|
||||
local timeout = math.floor(180*(math.random()+0.5))
|
||||
Async(async_message, true, {'chat-bot.reply', {'chat-bot.get-mead-1'}})
|
||||
Async.wait(timeout, async_message, 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)
|
||||
local timeout = math.floor(180*(math.random()+0.5))
|
||||
Async(async_message, true, {'chat-bot.reply', {'chat-bot.get-beer-1'}})
|
||||
Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.get-beer-2', player.name}})
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
-- either way you can change the requirements to be "admin" if you wanted to
|
||||
-- @config Commands-Auth-Admin
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
|
||||
-- luacheck:ignore 212/command
|
||||
Commands.add_authenticator(function(player, command, tags, reject)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- This will make commands only work if the role has been allowed it in the role config
|
||||
-- @config Commands-Auth-Roles
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
|
||||
-- luacheck:ignore 212/tags
|
||||
Commands.add_authenticator(function(player, command, tags, reject)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- This will make commands only work when a valid color from the presets has been selected
|
||||
-- @config Commands-Color-Parse
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Colours = require 'utils.color_presets' --- @dep utils.color_presets
|
||||
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)
|
||||
if not input then return end
|
||||
|
||||
@@ -19,7 +19,7 @@ see ./expcore/commands.lua for more details
|
||||
surface
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
|
||||
-- luacheck:ignore 212/player
|
||||
Commands.add_parse('boolean',function(input, player)
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
player-role-alive
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
local auto_complete = _C.auto_complete --- @dep expcore.common
|
||||
require 'config.expcore.command_general_parse'
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
-- luacheck:ignore 212/player
|
||||
Commands.add_parse('role',function(input, player, reject)
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
-- this config adds Commands.disable and Commands.enable to enable and disable commands for all users
|
||||
-- @config Commands-Auth-Runtime-Disable
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
|
||||
local disabled_commands = {}
|
||||
Global.register(disabled_commands, function(tbl)
|
||||
Storage.register(disabled_commands, function(tbl)
|
||||
disabled_commands = tbl
|
||||
end)
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
-- then use :allow{} and :disallow{} to specify certain actions to allow/disallow
|
||||
-- @config Permission-Groups
|
||||
|
||||
--local Event = require 'utils.event' -- @dep utils.event
|
||||
local Permission_Groups = require 'expcore.permission_groups' --- @dep expcore.permission_groups
|
||||
--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')
|
||||
:allow_all()
|
||||
@@ -60,7 +60,7 @@ Permission_Groups.new_group('Standard')
|
||||
'admin_action', -- trusted
|
||||
'change_programmable_speaker_alert_parameters', -- standard
|
||||
'drop_item',
|
||||
'set_auto_launch_rocket'
|
||||
'change_rocket_silo_mode'
|
||||
}
|
||||
|
||||
Permission_Groups.new_group('Guest')
|
||||
@@ -81,7 +81,7 @@ Permission_Groups.new_group('Guest')
|
||||
'admin_action', -- trusted
|
||||
'change_programmable_speaker_alert_parameters', -- standard
|
||||
'drop_item',
|
||||
'set_auto_launch_rocket',
|
||||
'change_rocket_silo_mode',
|
||||
'change_programmable_speaker_parameters', -- guest
|
||||
'change_train_stop_station',
|
||||
--'deconstruct',
|
||||
@@ -89,10 +89,10 @@ Permission_Groups.new_group('Guest')
|
||||
'remove_train_station',
|
||||
'reset_assembling_machine',
|
||||
'rotate_entity',
|
||||
'use_artillery_remote',
|
||||
--'use_artillery_remote', -- not in 2.0
|
||||
'launch_rocket',
|
||||
'cancel_research',
|
||||
'activate_cut',
|
||||
--'activate_cut', -- not in 2.0
|
||||
'flush_opened_entity_fluid',
|
||||
'flush_opened_entity_specific_fluid'
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- This is the main config file for the role system; file includes defines for roles and role flags and default values
|
||||
-- @config Roles
|
||||
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
|
||||
local Statistics = PlayerData.Statistics
|
||||
|
||||
--- Role flags that will run when a player changes roles
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- This file contains all the different settings for the autofill system and gui
|
||||
-- @config Autofill
|
||||
|
||||
local table = require 'overrides.table' -- @dep overrides.table
|
||||
local table = require("modules.exp_legacy.overrides.table") -- @dep overrides.table
|
||||
|
||||
local config = {
|
||||
-- General config
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
-- the key used for the name of the button is the permission name used by the role system;
|
||||
-- @config Player-List
|
||||
|
||||
local Gui = require 'expcore.gui' --- @dep expcore.gui
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local Reports = require 'modules.control.reports' --- @dep modules.control.reports
|
||||
local Warnings = require 'modules.control.warnings' --- @dep modules.control.warnings
|
||||
local Jail = require 'modules.control.jail' --- @dep modules.control.jail
|
||||
local Colors = require 'utils.color_presets' --- @dep utils.color_presets
|
||||
local Gui = require("modules.exp_legacy.expcore.gui") --- @dep expcore.gui
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
local Reports = require("modules.exp_legacy.modules.control.reports") --- @dep modules.control.reports
|
||||
local Warnings = require("modules.exp_legacy.modules.control.warnings") --- @dep modules.control.warnings
|
||||
local Jail = require("modules.exp_legacy.modules.control.jail") --- @dep modules.control.jail
|
||||
local Colors = require("modules/exp_util/include/color")
|
||||
local format_chat_player_name = _C.format_chat_player_name --- @dep expcore.common
|
||||
|
||||
local SelectedPlayer, SelectedAction
|
||||
|
||||
@@ -8,20 +8,13 @@ log('[START] -----| Explosive Gaming Scenario Loader |-----')
|
||||
log('[INFO] Setting up lua environment')
|
||||
|
||||
-- Require the global overrides
|
||||
require 'overrides.stages' -- Data stages used in factorio, often used to test for runtime
|
||||
require 'overrides.print' -- Overrides the _G.print function
|
||||
require 'overrides.math' -- Omitting the math library is a very bad idea
|
||||
require 'overrides.table' -- Adds alot more functions to the table module
|
||||
global.version = require 'overrides.version' -- The current version for exp gaming scenario
|
||||
inspect = require 'overrides.inspect' -- Used to covert any value into human readable string
|
||||
Debug = require 'overrides.debug' -- Global Debug module
|
||||
_C = require 'expcore.common' -- _C is used to store lots of common functions expected to be used
|
||||
_CHEATS = false
|
||||
_DEBUG = false
|
||||
require("modules.exp_legacy.overrides.table") -- Adds alot more functions to the table module
|
||||
storage.version = require("modules.exp_legacy.overrides.version") -- The current version for exp gaming scenario
|
||||
_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')
|
||||
local files = require 'config._file_loader'
|
||||
local files = require("modules.exp_legacy.config._file_loader")
|
||||
|
||||
-- Error handler for loading files
|
||||
local errors = {}
|
||||
@@ -44,14 +37,14 @@ 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))
|
||||
xpcall(require, error_handler, path)
|
||||
xpcall(require, error_handler, "modules.exp_legacy." .. path)
|
||||
end
|
||||
|
||||
-- Override the default require; require can no longer load new scripts
|
||||
log('[INFO] Require Overwrite! No more requires can be made!')
|
||||
require 'overrides.require'
|
||||
|
||||
-- Logs all errors again to make it make it easy to find
|
||||
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")
|
||||
return Event.real_handlers
|
||||
@@ -1,101 +0,0 @@
|
||||
--[[-- Core Module - Async
|
||||
- An extention of task and token to allow a single require to register and run async functions.
|
||||
@core Async
|
||||
@alias Async
|
||||
|
||||
@usage
|
||||
-- To use Async you must register the allowed functions when the file is loaded, often this will just be giving access to
|
||||
-- some functions within a module if you expect that at part may be blocked by in game permissions or a custom system you have made
|
||||
-- you may also want to register functions that you want to have a time delay, such as waiting 2 seconds before printing a message
|
||||
|
||||
-- When player.admin is called (either command or gui element event) by a player who isnt admin then it will error
|
||||
-- here we register the function to promote the player so that it will run async and outside the player scope
|
||||
local promote_player =
|
||||
Async.register(function(player)
|
||||
player.admin = true
|
||||
end)
|
||||
|
||||
-- This will allow us to bypass the error by running one tick later outside of any player scope
|
||||
Async(promote_player, game.player)
|
||||
|
||||
-- Here we make an sync function that we want to have a delay, note the delay is not defined here
|
||||
local print_message =
|
||||
Async.register(function(player, message)
|
||||
player.print(message)
|
||||
end)
|
||||
|
||||
-- We can then call the async function with a delay using the wait function
|
||||
Async.wait(60, print_message, game.player, 'One second has passed!')
|
||||
|
||||
]]
|
||||
local Task = require 'utils.task' --- @dep utils.task
|
||||
local Token = require 'utils.token' --- @dep utils.token
|
||||
|
||||
local Async = {}
|
||||
|
||||
local internal_run =
|
||||
Token.register(function(params)
|
||||
local func = Token.get(params.token)
|
||||
return func(table.unpack(params.params))
|
||||
end)
|
||||
|
||||
--[[-- Register a new async function, must called when the file is loaded
|
||||
@function register
|
||||
@tparam function callback the function that can be called as an async function
|
||||
@treturn string the uid of the async function which can be passed to Async.run and Async.wait
|
||||
|
||||
@usage-- Registering a function to set the admin state of a player
|
||||
local set_admin =
|
||||
Async.register(function(player, state)
|
||||
if player.valid then
|
||||
player.admin = state
|
||||
end
|
||||
end)
|
||||
|
||||
@usage-- Registering a function to print to a player
|
||||
local print_to_player =
|
||||
Async.register(function(player, message)
|
||||
if player.valid then
|
||||
player.print(message)
|
||||
end
|
||||
end)
|
||||
|
||||
]]
|
||||
Async.register = Token.register
|
||||
|
||||
--[[-- Runs an async function, you may supply any number of arguments as required by that function
|
||||
@tparam string token the token of the async function you want to run
|
||||
@tparam[opt] any ... the other params that you want to pass to your function
|
||||
|
||||
@usage-- Make a player admin regardless of if you are admin
|
||||
Async.run(set_admin, player, true)
|
||||
|
||||
]]
|
||||
function Async.run(token, ...)
|
||||
Task.queue_task(internal_run, {
|
||||
token = token,
|
||||
params = {...}
|
||||
})
|
||||
end
|
||||
|
||||
--[[-- Runs an async function after the given number of ticks, you may supply any number of arguments as required by that function
|
||||
@tparam number ticks the number of ticks that you want the function to run after
|
||||
@tparam string token the token of the async function you want to run
|
||||
@tparam[opt] any ... the other params that you want to pass to your function
|
||||
|
||||
@usage-- Print a message to a player after 5 seconds
|
||||
Async.wait(300, print_to_player, 'Hello, World!')
|
||||
|
||||
]]
|
||||
function Async.wait(ticks, token, ...)
|
||||
Task.set_timeout_in_ticks(ticks, internal_run, {
|
||||
token = token,
|
||||
params = {...}
|
||||
})
|
||||
end
|
||||
|
||||
return setmetatable(Async, {
|
||||
__call = function(self, ...)
|
||||
self.run(...)
|
||||
end
|
||||
})
|
||||
@@ -185,7 +185,6 @@ end)
|
||||
|
||||
]]
|
||||
|
||||
local Game = require 'utils.game' --- @dep utils.game
|
||||
local player_return, write_json = _C.player_return, _C.write_json --- @dep expcore.common
|
||||
local trace = debug.traceback
|
||||
|
||||
@@ -392,20 +391,13 @@ local commands = Commands.get()
|
||||
|
||||
]]
|
||||
function Commands.get(player)
|
||||
player = Game.get_player_from_any(player)
|
||||
|
||||
if not player then
|
||||
return Commands.commands
|
||||
end
|
||||
|
||||
if not player then return Commands.commands end
|
||||
local allowed = {}
|
||||
|
||||
for name, command_data in pairs(Commands.commands) do
|
||||
if Commands.authorize(player, name) then
|
||||
allowed[name] = command_data
|
||||
end
|
||||
end
|
||||
|
||||
return allowed
|
||||
end
|
||||
|
||||
@@ -425,7 +417,6 @@ function Commands.search(keyword, player)
|
||||
local custom_commands = Commands.get(player)
|
||||
local matches = {}
|
||||
keyword = keyword:lower()
|
||||
|
||||
-- Loops over custom commands
|
||||
for name, command_data in pairs(custom_commands) do
|
||||
-- combines name help and aliases into one message to be searched
|
||||
@@ -435,7 +426,6 @@ function Commands.search(keyword, player)
|
||||
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
|
||||
@@ -448,7 +438,6 @@ function Commands.search(keyword, player)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
return matches
|
||||
end
|
||||
|
||||
@@ -480,9 +469,7 @@ function Commands.new_command(name, help, descr)
|
||||
}, {
|
||||
__index = Commands._prototype
|
||||
})
|
||||
|
||||
Commands.commands[name] = command
|
||||
|
||||
return command
|
||||
end
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
@alias Common
|
||||
]]
|
||||
|
||||
local Colours = require 'utils.color_presets' --- @dep utils.color_presets
|
||||
local Game = require 'utils.game' --- @dep utils.game
|
||||
local Colours = require("modules/exp_util/include/color")
|
||||
local Game = require("modules.exp_legacy.utils.game") --- @dep utils.game
|
||||
|
||||
local Common = {}
|
||||
|
||||
@@ -138,21 +138,12 @@ end
|
||||
--- Will raise an error if called during runtime
|
||||
-- @usage error_if_runtime()
|
||||
function Common.error_if_runtime()
|
||||
if _LIFECYCLE == 8 then
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
--- Will raise an error if the function is a closure
|
||||
-- @usage error_if_runetime_closure(func)
|
||||
function Common.error_if_runetime_closure(func)
|
||||
if _LIFECYCLE == 8 and Debug.is_closure(func) then
|
||||
local function_name = debug.getinfo(2, 'n').name or '<anon>'
|
||||
error(function_name..' can not be called during runtime with a closure', 3)
|
||||
end
|
||||
end
|
||||
|
||||
--- Value Returns.
|
||||
-- @section valueReturns
|
||||
|
||||
@@ -255,7 +246,7 @@ local file_path = get_file_path()
|
||||
]]
|
||||
function Common.get_file_path(offset)
|
||||
offset = offset or 0
|
||||
return debug.getinfo(offset+2, 'S').source:match('^.+/currently%-playing/(.+)$'):sub(1, -5)
|
||||
return debug.getinfo(offset+2, 'S').short_src:sub(10, -5)
|
||||
end
|
||||
|
||||
--[[-- Converts a table to an enum
|
||||
|
||||
@@ -146,7 +146,7 @@ PlayerData.Statistics:combine('JoinCount')
|
||||
|
||||
]]
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
|
||||
local DatastoreManager = {}
|
||||
local Datastores = {}
|
||||
@@ -156,9 +156,8 @@ local copy = table.deep_copy
|
||||
local trace = debug.traceback
|
||||
|
||||
--- Save datastores in the global table
|
||||
global.datastores = Data
|
||||
Event.on_load(function()
|
||||
Data = global.datastores
|
||||
Storage.register(Data, function(tbl)
|
||||
Data = tbl
|
||||
for datastoreName, datastore in pairs(Datastores) do
|
||||
datastore.data = Data[datastoreName]
|
||||
end
|
||||
@@ -187,7 +186,7 @@ local ExampleData = Datastore.connect('ExampleData', true) -- saveToDisk
|
||||
]]
|
||||
function DatastoreManager.connect(datastoreName, saveToDisk, autoSave, propagateChanges)
|
||||
if Datastores[datastoreName] then return Datastores[datastoreName] end
|
||||
if _LIFECYCLE ~= _STAGE.control then
|
||||
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)
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@alias External
|
||||
|
||||
@usage-- Printing all server to chat
|
||||
local External = require 'expcore.external' --- @dep expcore.external
|
||||
local External = require("modules.exp_legacy.expcore.external") --- @dep expcore.external
|
||||
|
||||
local message = 'id: %s name: %s version: %s status: %s'
|
||||
for server_id, server in pairs(External.get_servers()) do
|
||||
@@ -29,11 +29,11 @@ end
|
||||
|
||||
]]
|
||||
function External.valid()
|
||||
if global.ext == nil then return false end
|
||||
if ext == global.ext and var == ext.var then
|
||||
if storage.ext == nil then return false end
|
||||
if ext == storage.ext and var == ext.var then
|
||||
return var ~= nil
|
||||
else
|
||||
ext = global.ext
|
||||
ext = storage.ext
|
||||
var = ext.var
|
||||
return var ~= nil
|
||||
end
|
||||
|
||||
@@ -1 +1 @@
|
||||
return require 'expcore.gui._require'
|
||||
return require("modules.exp_legacy.expcore.gui._require")
|
||||
|
||||
@@ -121,15 +121,15 @@ end)
|
||||
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui.prototype'
|
||||
require 'expcore.gui.helper_functions'
|
||||
require 'expcore.gui.core_defines'
|
||||
require 'expcore.gui.top_flow'
|
||||
require 'expcore.gui.left_flow'
|
||||
require 'expcore.gui.defines'
|
||||
local Gui = require("modules.exp_legacy.expcore.gui.prototype")
|
||||
require("modules.exp_legacy.expcore.gui.helper_functions")
|
||||
require("modules.exp_legacy.expcore.gui.core_defines")
|
||||
require("modules.exp_legacy.expcore.gui.top_flow")
|
||||
require("modules.exp_legacy.expcore.gui.left_flow")
|
||||
require("modules.exp_legacy.expcore.gui.defines")
|
||||
|
||||
local Roles = _C.opt_require('expcore.roles')
|
||||
local Event = _C.opt_require('utils.event')
|
||||
local Roles = _C.opt_require("modules.exp_legacy.expcore.roles")
|
||||
local Event = _C.opt_require("modules/exp_legacy/utils/event")
|
||||
|
||||
if Roles and Event then
|
||||
Event.add(Roles.events.on_role_assigned, function(e)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
@module Gui
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui.prototype'
|
||||
local Event = require 'utils.event'
|
||||
local Gui = require("modules.exp_legacy.expcore.gui.prototype")
|
||||
local Event = require("modules/exp_legacy/utils/event")
|
||||
|
||||
--- Core Defines.
|
||||
-- @section coreDefines
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@module Gui
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui.prototype'
|
||||
local Gui = require("modules.exp_legacy.expcore.gui.prototype")
|
||||
|
||||
--- Defines.
|
||||
-- @section defines
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@module Gui
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui.prototype'
|
||||
local Gui = require("modules.exp_legacy.expcore.gui.prototype")
|
||||
|
||||
--- Helper Functions.
|
||||
-- @section helperFunctions
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@module Gui
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui.prototype'
|
||||
local Gui = require("modules.exp_legacy.expcore.gui.prototype")
|
||||
local mod_gui = require 'mod-gui'
|
||||
|
||||
local hide_left_flow = Gui.core_defines.hide_left_flow.name
|
||||
@@ -89,7 +89,7 @@ end
|
||||
function Gui.inject_left_flow_order(provider)
|
||||
Gui.get_left_flow_order = provider
|
||||
local debug_info = debug.getinfo(2, "Sn")
|
||||
local file_name = debug_info.source:match('^.+/currently%-playing/(.+)$'):sub(1, -5)
|
||||
local file_name = debug_info.short_src:sub(10, -5)
|
||||
local func_name = debug_info.name or ("<anonymous:"..debug_info.linedefined..">")
|
||||
Gui._left_flow_order_src = file_name..":"..func_name
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@module Gui
|
||||
]]
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
|
||||
local Gui = {
|
||||
--- The current highest uid that is being used by a define, will not increase during runtime
|
||||
@@ -58,7 +58,7 @@ end
|
||||
--- Get where a function was defined as a string
|
||||
local function get_defined_at(level)
|
||||
local debug_info = debug.getinfo(level, "Sn")
|
||||
local file_name = debug_info.source:match('^.+/currently%-playing/(.+)$'):sub(1, -5)
|
||||
local file_name = debug_info.short_src:sub(10, -5)
|
||||
local func_name = debug_info.name or ("<anonymous:"..debug_info.linedefined..">")
|
||||
return file_name..":"..func_name
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@module Gui
|
||||
]]
|
||||
|
||||
local Gui = require 'expcore.gui.prototype'
|
||||
local Gui = require("modules.exp_legacy.expcore.gui.prototype")
|
||||
local mod_gui = require 'mod-gui' --- @dep mod-gui
|
||||
|
||||
local toolbar_button_size = 36
|
||||
@@ -107,7 +107,7 @@ end
|
||||
function Gui.inject_top_flow_order(provider)
|
||||
Gui.get_top_flow_order = provider
|
||||
local debug_info = debug.getinfo(2, "Sn")
|
||||
local file_name = debug_info.source:match('^.+/currently%-playing/(.+)$'):sub(1, -5)
|
||||
local file_name = debug_info.short_src:sub(10, -5)
|
||||
local func_name = debug_info.name or ("<anonymous:"..debug_info.linedefined..">")
|
||||
Gui._top_flow_order_src = file_name..":"..func_name
|
||||
end
|
||||
|
||||
@@ -24,9 +24,9 @@ Permission_Groups.new_group('Restricted') -- this defines a new group called "Re
|
||||
]]
|
||||
|
||||
|
||||
local Game = require 'utils.game' --- @dep utils.game
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Async = require 'expcore.async' --- @dep expcore.async
|
||||
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
|
||||
@@ -34,18 +34,18 @@ local Permissions_Groups = {
|
||||
}
|
||||
|
||||
-- Async function to add players to permission groups
|
||||
local add_to_permission_group =
|
||||
local add_to_permission_group_async =
|
||||
Async.register(function(permission_group, player)
|
||||
permission_group.add_player(player)
|
||||
end)
|
||||
Permissions_Groups.async_token_add_to_permission_group = add_to_permission_group
|
||||
Permissions_Groups.add_to_permission_group_async = add_to_permission_group_async
|
||||
|
||||
-- Async function to remove players from permission groups
|
||||
local remove_from_permission_group =
|
||||
local remove_from_permission_group_async =
|
||||
Async.register(function(permission_group, player)
|
||||
permission_group.remove_player(player)
|
||||
end)
|
||||
Permissions_Groups.async_token_remove_from_permission_group = remove_from_permission_group
|
||||
Permissions_Groups.remove_from_permission_group_async = remove_from_permission_group_async
|
||||
|
||||
--- Getters.
|
||||
-- Functions that get permission groups
|
||||
@@ -286,7 +286,7 @@ function Permissions_Groups._prototype:add_player(player)
|
||||
player = Game.get_player_from_any(player)
|
||||
local group = self:get_raw()
|
||||
if not group or not player then return false end
|
||||
Async(add_to_permission_group, group, player)
|
||||
add_to_permission_group_async(group, player)
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -302,7 +302,7 @@ function Permissions_Groups._prototype:remove_player(player)
|
||||
player = Game.get_player_from_any(player)
|
||||
local group = self:get_raw()
|
||||
if not group or not player then return false end
|
||||
Async(remove_from_permission_group, group, player)
|
||||
remove_from_permission_group_async(group, player)
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@core PlayerData
|
||||
|
||||
@usage-- Adding a colour setting for players
|
||||
local PlayerData = require 'expcore.player_data'
|
||||
local PlayerData = require("modules.exp_legacy.expcore.player_data")
|
||||
local PlayerColors = PlayerData.Settings:combine('Color')
|
||||
|
||||
-- Set the players color when their data is loaded
|
||||
@@ -19,8 +19,8 @@ PlayerColors:on_save(function(player_name, _)
|
||||
end)
|
||||
|
||||
@usage-- Add a playtime statistic for players
|
||||
local Event = require 'utils.event'
|
||||
local PlayerData = require 'expcore.player_data'
|
||||
local Event = require("modules/exp_legacy/utils/event")
|
||||
local PlayerData = require("modules.exp_legacy.expcore.player_data")
|
||||
local Playtime = PlayerData.Statistics:combine('Playtime')
|
||||
|
||||
-- When playtime reaches an hour interval tell the player and say thanks
|
||||
@@ -41,11 +41,11 @@ end)
|
||||
|
||||
]]
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Async = require 'expcore.async' --- @dep expcore.async
|
||||
local Datastore = require 'expcore.datastore' --- @dep expcore.datastore
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse' --- @dep config.expcore.command_general_parse
|
||||
local Async = require("modules/exp_util/async")
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Datastore = require("modules.exp_legacy.expcore.datastore") --- @dep expcore.datastore
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
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
|
||||
@@ -86,7 +86,8 @@ Commands.new_command('save-data', 'Writes all your player data to a file on your
|
||||
end)
|
||||
|
||||
--- Async function called after 5 seconds with no player data loaded
|
||||
local check_data_loaded = Async.register(function(player)
|
||||
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'}
|
||||
@@ -127,7 +128,7 @@ end)
|
||||
--- Load player data when they join
|
||||
Event.add(defines.events.on_player_joined_game, function(event)
|
||||
local player = game.players[event.player_index]
|
||||
Async.wait(300, check_data_loaded, player)
|
||||
check_data_loaded_async:start_after(300, player)
|
||||
PlayerData:raw_set(player.name)
|
||||
PlayerData:request(player)
|
||||
end)
|
||||
|
||||
@@ -108,12 +108,12 @@ Roles.define_role_order{
|
||||
|
||||
]]
|
||||
|
||||
local Game = require 'utils.game' --- @dep utils.game
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Groups = require 'expcore.permission_groups' --- @dep expcore.permission_groups
|
||||
local Async = require 'expcore.async' --- @dep expcore.async
|
||||
local Colours = require 'utils.color_presets' --- @dep utils.color_presets
|
||||
local Async = require("modules/exp_util/async")
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local Game = require("modules.exp_legacy.utils.game") --- @dep utils.game
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Groups = require("modules.exp_legacy.expcore.permission_groups") --- @dep expcore.permission_groups
|
||||
local Colours = require("modules/exp_util/include/color")
|
||||
local write_json = _C.write_json --- @dep expcore.common
|
||||
|
||||
local Roles = {
|
||||
@@ -134,7 +134,10 @@ local Roles = {
|
||||
}
|
||||
|
||||
--- When global is loaded it will have the metatable re-assigned to the roles
|
||||
Global.register({ Roles.config.players, Roles.config.deferred_roles }, function(tbl)
|
||||
Storage.register({
|
||||
Roles.config.players,
|
||||
Roles.config.deferred_roles
|
||||
}, function(tbl)
|
||||
Roles.config.players = tbl[1]
|
||||
Roles.config.deferred_roles = tbl[2]
|
||||
end)
|
||||
@@ -652,7 +655,6 @@ end)
|
||||
|
||||
]]
|
||||
function Roles.define_flag_trigger(name, callback)
|
||||
_C.error_if_runtime()
|
||||
Roles.config.flags[name] = Async.register(callback)
|
||||
end
|
||||
|
||||
@@ -1076,9 +1078,9 @@ end
|
||||
local function role_update(event)
|
||||
local player = game.players[event.player_index]
|
||||
-- Updates flags given to the player
|
||||
for flag, async_token in pairs(Roles.config.flags) do
|
||||
for flag, async_function in pairs(Roles.config.flags) do
|
||||
local state = Roles.player_has_flag(player, flag)
|
||||
Async(async_token, player, state)
|
||||
async_function(player, state)
|
||||
end
|
||||
-- Updates the players permission group
|
||||
local highest = Roles.get_player_highest_role(player)
|
||||
@@ -1086,7 +1088,7 @@ local function role_update(event)
|
||||
if highest.permission_group[1] then
|
||||
local group = game.permissions.get_group(highest.permission_group[2])
|
||||
if group then
|
||||
Async(Groups.async_token_add_to_permission_group, group, player)
|
||||
Groups.add_to_permission_group_async(group, player)
|
||||
end
|
||||
else
|
||||
Groups.set_player_group(player, highest.permission_group)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"require": [
|
||||
],
|
||||
"dependencies": {
|
||||
"clusterio": "*"
|
||||
"clusterio": "*",
|
||||
"exp_util": "*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- Adds a better method of player starting items based on production levels.
|
||||
-- @addon Advanced-Start
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local config = require 'config.advanced_start' --- @dep config.advanced_start
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local config = require("modules.exp_legacy.config.advanced_start") --- @dep config.advanced_start
|
||||
local items = config.items
|
||||
|
||||
Event.add(defines.events.on_player_created, function(event)
|
||||
@@ -43,7 +43,7 @@ Event.on_init(function()
|
||||
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
|
||||
--force.research_queue_enabled = true
|
||||
end
|
||||
end
|
||||
if not config.disable_base_game_silo_script then
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
--- Kicks players when all players on the server are afk
|
||||
-- @addon afk-kick
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local config = require 'config.afk_kick' --- @dep config.afk_kick
|
||||
local Async = require 'expcore.async' --- @dep expcore.async
|
||||
local Async = require("modules/exp_util/async")
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local config = require("modules.exp_legacy.config.afk_kick") --- @dep config.afk_kick
|
||||
|
||||
--- Optional roles require
|
||||
local Roles
|
||||
if config.active_role then
|
||||
Roles = require 'expcore.roles'
|
||||
Roles = require("modules.exp_legacy.expcore.roles")
|
||||
end
|
||||
|
||||
--- Globals
|
||||
local primitives = { last_active = 0 }
|
||||
Global.register(primitives, function(tbl)
|
||||
Storage.register(primitives, function(tbl)
|
||||
primitives = tbl
|
||||
end)
|
||||
|
||||
--- Kicks an afk player, used to add a delay so the gui has time to appear
|
||||
local kick_player =
|
||||
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')
|
||||
@@ -54,7 +54,7 @@ Event.on_nth_tick(config.update_time, function()
|
||||
}.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
|
||||
Async.wait(10, kick_player, player)
|
||||
kick_player_async:start_after(10, player)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
-- also displays a ping above users who are named in the message
|
||||
-- @addon Chat-Popups
|
||||
|
||||
local Game = require 'utils.game' --- @dep utils.game
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local config = require 'config.popup_messages' --- @dep config.popup_messages
|
||||
local FloatingText = require("modules/exp_util/floating_text")
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local config = require("modules.exp_legacy.config.popup_messages") --- @dep config.popup_messages
|
||||
|
||||
local send_text = Game.print_player_floating_text -- (player_index, text, color)
|
||||
local send_text = FloatingText.print_as_player -- (player, text)
|
||||
|
||||
Event.add(defines.events.on_console_chat, function(event)
|
||||
if not event.player_index or event.player_index < 1 then return end
|
||||
@@ -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.index, {'chat-popup.message', player.name, event.message}, player.chat_color)
|
||||
send_text(player, {'chat-popup.message', player.name, event.message})
|
||||
end
|
||||
|
||||
if not config.show_player_mentions then return end
|
||||
@@ -30,7 +30,7 @@ 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.index, {'chat-popup.ping', player.name}, player.chat_color)
|
||||
send_text(mentioned_player, {'chat-popup.ping', player.name})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- Adds auto replies to chat messages; as well as chat commands
|
||||
-- @addon Chat-Reply
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local config = require 'config.chat_reply' --- @dep config.chat_reply
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
local config = require("modules.exp_legacy.config.chat_reply") --- @dep config.chat_reply
|
||||
|
||||
Event.add(defines.events.on_console_chat, function(event)
|
||||
local player_index = event.player_index
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
--- Adds a compilatron that walks around the spawn area; adapted from redmew code
|
||||
-- @addon Compilatron
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Task = require 'utils.task' --- @dep utils.task
|
||||
local Token = require 'utils.token' --- @dep utils.token
|
||||
local config = require 'config.compilatron' --- @dep config.compilatron
|
||||
local Async = require("modules/exp_util/async")
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local config = require("modules.exp_legacy.config.compilatron") --- @dep config.compilatron
|
||||
local messages = config.messages
|
||||
local locations = config.locations
|
||||
|
||||
@@ -14,7 +13,7 @@ local Public = {
|
||||
current_messages={}
|
||||
}
|
||||
|
||||
Global.register({
|
||||
Storage.register({
|
||||
compilatrons = Public.compilatrons,
|
||||
current_messages = Public.current_messages
|
||||
}, function(tbl)
|
||||
@@ -22,20 +21,21 @@ Global.register({
|
||||
Public.current_messages = tbl.current_messages
|
||||
end)
|
||||
|
||||
--- This will re-create the speech bubble after it de-spawns called with set_timeout
|
||||
local callback =
|
||||
Token.register(
|
||||
function(data)
|
||||
local ent = data.ent
|
||||
local name = data.name
|
||||
local msg_number = data.msg_number
|
||||
local message =
|
||||
ent.surface.create_entity(
|
||||
{name = 'compi-speech-bubble', text = messages[name][msg_number], position = {0, 0}, source = ent}
|
||||
)
|
||||
Public.current_messages[name] = {message = message, msg_number = msg_number}
|
||||
end
|
||||
)
|
||||
local speech_bubble_async =
|
||||
Async.register(function(data)
|
||||
local message =
|
||||
data.entity.surface.create_entity{
|
||||
name = 'compi-speech-bubble',
|
||||
text = messages[data.name][data.msg_number],
|
||||
source = data.entity,
|
||||
position = {0, 0},
|
||||
}
|
||||
|
||||
Public.current_messages[data.name] = {
|
||||
message = message,
|
||||
msg_number = data.msg_number
|
||||
}
|
||||
end)
|
||||
|
||||
--- This will move the messages onto the next message in the loop
|
||||
local function circle_messages()
|
||||
@@ -57,7 +57,7 @@ local function circle_messages()
|
||||
msg_number = 1
|
||||
end
|
||||
-- this calls the callback above to re-spawn the message after some time
|
||||
Task.set_timeout_in_ticks(300, callback, {ent = ent, name = name, msg_number = msg_number})
|
||||
speech_bubble_async:start_after(300, {ent = ent, name = name, msg_number = msg_number})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
-- also shows player health when a player is attacked
|
||||
-- @addon Damage-Popups
|
||||
|
||||
local Game = require 'utils.game' --- @dep utils.game
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local config = require 'config.popup_messages' --- @dep config.popup_messages
|
||||
local FloatingText = require("modules/exp_util/floating_text")
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local config = require("modules.exp_legacy.config.popup_messages") --- @dep config.popup_messages
|
||||
|
||||
Event.add(defines.events.on_entity_damaged, function(event)
|
||||
local entity = event.entity
|
||||
@@ -31,7 +31,7 @@ Event.add(defines.events.on_entity_damaged, function(event)
|
||||
|
||||
-- Outputs the message as floating text
|
||||
if message then
|
||||
Game.print_floating_text(
|
||||
FloatingText.print(
|
||||
entity.surface,
|
||||
position,
|
||||
message,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- Makes markers on the map where places have died and reclaims items if not recovered
|
||||
-- @addon Death-Logger
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local config = require 'config.death_logger' --- @dep config.death_logger
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local config = require("modules.exp_legacy.config.death_logger") --- @dep config.death_logger
|
||||
local format_time, move_items = _C.format_time, _C.move_items_stack --- @dep expcore.common
|
||||
|
||||
-- Max amount of ticks a corpse can be alive
|
||||
@@ -13,7 +13,7 @@ local deaths = {
|
||||
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}
|
||||
}
|
||||
Global.register(deaths, function(tbl)
|
||||
Storage.register(deaths, function(tbl)
|
||||
deaths = tbl
|
||||
end)
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- Log certain actions into a file when events are triggered
|
||||
-- @addon Deconlog
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
local format_time = _C.format_time --- @dep expcore.common
|
||||
local format_number = require('util').format_number --- @dep util
|
||||
local config = require 'config.deconlog' --- @dep config.deconlog
|
||||
local format_number = require("util").format_number --- @dep util
|
||||
local config = require("modules.exp_legacy.config.deconlog") --- @dep config.deconlog
|
||||
|
||||
local filepath = "log/decon.log"
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- Sends alert messages to our discord server when certain events are triggered
|
||||
-- @addon Discord-Alerts
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Colors = require 'utils.color_presets' --- @dep utils.color_presets
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Colors = require("modules/exp_util/include/color")
|
||||
local write_json, format_time = _C.write_json, _C.format_time --- @dep expcore.common
|
||||
local config = require 'config.discord_alerts' --- @dep config.discord_alerts
|
||||
local config = require("modules.exp_legacy.config.discord_alerts") --- @dep config.discord_alerts
|
||||
|
||||
local playtime_format = {hours = true, minutes = true, short = true, string = true}
|
||||
|
||||
@@ -96,7 +96,7 @@ end
|
||||
|
||||
--- Repeated protected entity mining
|
||||
if config.entity_protection then
|
||||
local EntityProtection = require 'modules.control.protection' --- @dep modules.control.protection
|
||||
local EntityProtection = require("modules.exp_legacy.modules.control.protection") --- @dep modules.control.protection
|
||||
Event.add(EntityProtection.events.on_repeat_violation, function(event)
|
||||
local player_name = get_player_name(event)
|
||||
emit_event{
|
||||
@@ -112,7 +112,7 @@ end
|
||||
|
||||
--- Reports added and removed
|
||||
if config.player_reports then
|
||||
local Reports = require 'modules.control.reports' --- @dep modules.control.reports
|
||||
local Reports = require("modules.exp_legacy.modules.control.reports") --- @dep modules.control.reports
|
||||
Event.add(Reports.events.on_player_reported, function(event)
|
||||
local player_name, by_player_name = get_player_name(event)
|
||||
emit_event{
|
||||
@@ -141,7 +141,7 @@ end
|
||||
|
||||
--- Warnings added and removed
|
||||
if config.player_warnings then
|
||||
local Warnings = require 'modules.control.warnings' --- @dep modules.control.warnings
|
||||
local Warnings = require("modules.exp_legacy.modules.control.warnings") --- @dep modules.control.warnings
|
||||
Event.add(Warnings.events.on_warning_added, function(event)
|
||||
local player_name, by_player_name = get_player_name(event)
|
||||
local player = game.get_player(player_name)
|
||||
@@ -171,7 +171,7 @@ end
|
||||
|
||||
--- When a player is jailed or unjailed
|
||||
if config.player_jail then
|
||||
local Jail = require 'modules.control.jail'
|
||||
local Jail = require("modules.exp_legacy.modules.control.jail")
|
||||
Event.add(Jail.events.on_player_jailed, function(event)
|
||||
local player_name, by_player_name = get_player_name(event)
|
||||
emit_event{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- Allows the FAGC clientside bot to receive information about bans and unbans and propagate that information to other servers
|
||||
-- @addon FAGC
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
|
||||
-- Clear the file on startup to minimize its size
|
||||
Event.on_init(function()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local Event = require 'utils.event'
|
||||
local Event = require("modules/exp_legacy/utils/event")
|
||||
|
||||
local controllers_with_inventory = {
|
||||
[defines.controllers.character] = true,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- Will move players items to spawn when they are banned or kicked, option to clear on leave
|
||||
-- @addon Inventory-Clear
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local events = require 'config.inventory_clear' --- @dep config.inventory_clear
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local events = require("modules.exp_legacy.config.inventory_clear") --- @dep config.inventory_clear
|
||||
local move_items_stack = _C.move_items_stack --- @dep expcore.common
|
||||
|
||||
local function clear_items(event)
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
@addon Lawnmower
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local config = require 'config.lawnmower' --- @dep config.lawnmower
|
||||
require 'config.expcore.command_general_parse'
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
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)
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
@addon Logging
|
||||
]]
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local config = require 'config.logging' --- @dep config.logging
|
||||
local config_res = require 'config.research' --- @dep config.research
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local config = require("modules.exp_legacy.config.logging") --- @dep config.logging
|
||||
local config_res = require("modules.exp_legacy.config.research") --- @dep config.research
|
||||
|
||||
local function add_log(data)
|
||||
game.write_file(config.file_name, data, true, 0)
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
local Event = require 'utils.event_core' --- @dep utils.event_core
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local config = require 'config.miner' --- @dep config.miner
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event_core
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local config = require("modules.exp_legacy.config.miner") --- @dep config.miner
|
||||
|
||||
local miner_data = {}
|
||||
|
||||
Global.register(miner_data, function(tbl)
|
||||
Storage.register(miner_data, function(tbl)
|
||||
miner_data = tbl
|
||||
end)
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- Disable new players from having certain items in their inventory, most commonly nukes
|
||||
-- @addon Nukeprotect
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local config = require 'config.nukeprotect' --- @dep config.nukeprotect
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
local config = require("modules.exp_legacy.config.nukeprotect") --- @dep config.nukeprotect
|
||||
local move_items_stack = _C.move_items_stack --- @dep expcore.common
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- Makes polution look much nice of the map, ie not one big red mess
|
||||
-- @addon Pollution-Grading
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local config = require 'config.pollution_grading' --- @dep config.pollution_grading
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local config = require("modules.exp_legacy.config.pollution_grading") --- @dep config.pollution_grading
|
||||
|
||||
local delay = config.update_delay * 3600 -- convert from minutes to ticks
|
||||
Event.on_nth_tick(delay, function()
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- When a player triggers protection multiple times they are automatically jailed
|
||||
-- @addon protection-jail
|
||||
|
||||
local Event = require 'utils.event' ---@dep utils.event
|
||||
local Global = require 'utils.global' ---@dep utils.global
|
||||
local Jail = require 'modules.control.jail' ---@dep modules.control.jail
|
||||
local Protection = require 'modules.control.protection' --- @dep modules.control.protection
|
||||
local Event = require("modules/exp_legacy/utils/event") ---@dep utils.event
|
||||
local Storage = require("modules/exp_util/storage") ---@dep utils.global
|
||||
local Jail = require("modules.exp_legacy.modules.control.jail") ---@dep modules.control.jail
|
||||
local Protection = require("modules.exp_legacy.modules.control.protection") --- @dep modules.control.protection
|
||||
local format_chat_player_name = _C.format_chat_player_name --- @dep expcore.common
|
||||
|
||||
--- Stores how many times the repeat violation was triggered
|
||||
local repeat_count = {}
|
||||
Global.register(repeat_count, function(tbl)
|
||||
Storage.register(repeat_count, function(tbl)
|
||||
repeat_count = tbl
|
||||
end)
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- When a player is reported, the player is automatically jailed if the combined playtime of the reporters exceeds the reported player
|
||||
-- @addon report-jail
|
||||
|
||||
local Event = require 'utils.event' ---@dep utils.event
|
||||
local Jail = require 'modules.control.jail' ---@dep modules.control.jail
|
||||
local Reports = require 'modules.control.reports' --- @dep modules.control.reports
|
||||
local Event = require("modules/exp_legacy/utils/event") ---@dep utils.event
|
||||
local Jail = require("modules.exp_legacy.modules.control.jail") ---@dep modules.control.jail
|
||||
local Reports = require("modules.exp_legacy.modules.control.reports") --- @dep modules.control.reports
|
||||
local format_chat_player_name = _C.format_chat_player_name --- @dep expcore.common
|
||||
|
||||
--- Returns the playtime of the reporter. Used when calculating the total playtime of all reporters
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- When a player walks around the tiles under them will degrade over time, the same is true when entites are built
|
||||
-- @addon Scorched-Earth
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local print_grid_value, clear_flying_text = _C.print_grid_value, _C.clear_flying_text --- @dep expcore.common
|
||||
local config = require 'config.scorched_earth' --- @dep config.scorched_earth
|
||||
local config = require("modules.exp_legacy.config.scorched_earth") --- @dep config.scorched_earth
|
||||
|
||||
-- Loops over the config and finds the wile which has the highest value for strength
|
||||
local max_strength = 0
|
||||
@@ -16,7 +16,7 @@ end
|
||||
|
||||
-- Used for debugging the degrade chances
|
||||
local debug_players = {}
|
||||
Global.register(debug_players, function(tbl)
|
||||
Storage.register(debug_players, function(tbl)
|
||||
debug_players = tbl
|
||||
end)
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
--- Adds a custom spawn area with chests and afk turrets
|
||||
-- @addon Spawn-Area
|
||||
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local config = require 'config.spawn_area' --- @dep config.spawn_area
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local config = require("modules.exp_legacy.config.spawn_area") --- @dep config.spawn_area
|
||||
|
||||
local turrets = config.turrets.locations
|
||||
Global.register(turrets, function(tbl)
|
||||
Storage.register(turrets, function(tbl)
|
||||
turrets = tbl
|
||||
end)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---LuaPlayerBuiltEntityEventFilters
|
||||
---Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name = "fast-inserter"}})
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local config = require 'config.station_auto_name' --- @dep config.chat_reply
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local config = require("modules.exp_legacy.config.station_auto_name") --- @dep config.chat_reply
|
||||
|
||||
--Credit to Cooldude2606 for using his lua magic to make this function.
|
||||
local directions = {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
--- Makes trees which are marked for decon "decay" quickly to allow faster building
|
||||
-- @addon Tree-Decon
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local Gui = require 'expcore.gui' --- @dep expcore.gui
|
||||
local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
local Gui = require("modules.exp_legacy.expcore.gui") --- @dep expcore.gui
|
||||
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
|
||||
|
||||
-- Global queue used to store trees that need to be removed, also cache for player roles
|
||||
-- Storage queue used to store trees that need to be removed, also cache for player roles
|
||||
local cache = {}
|
||||
local tree_queue = { _head=0 }
|
||||
Global.register({tree_queue, cache}, function(tbl)
|
||||
Storage.register({tree_queue, cache}, function(tbl)
|
||||
tree_queue = tbl[1]
|
||||
cache = tbl[2]
|
||||
end)
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@commands Admin-Chat
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local format_chat_player_name = _C.format_chat_player_name --- @dep expcore.common
|
||||
require 'config.expcore.command_general_parse'
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
--- Sends a message in chat that only admins can see
|
||||
-- @command admin-chat
|
||||
@@ -17,7 +17,6 @@ Commands.new_command('admin-chat', {'expcom-admin-chat.description'}, 'Sends a m
|
||||
: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}
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
@commands Admin-Markers
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
|
||||
local admins = {} -- Stores all players in admin marker mode
|
||||
local markers = {} -- Stores all admin markers
|
||||
|
||||
--- Global variables
|
||||
Global.register({
|
||||
--- Storage variables
|
||||
Storage.register({
|
||||
admins = admins,
|
||||
markers = markers
|
||||
}, function(tbl)
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@commands Artillery
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
local Selection = require 'modules.control.selection' --- @dep modules.control.selection
|
||||
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 function location_break(player, pos)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
@commands Bot Queue
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
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')
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
@commands Cheat-Mode
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
--- Toggles cheat mode for your player, or another player.
|
||||
-- @command toggle-cheat-mode
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@commands Clear-Inventory
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local move_items_stack = _C.move_items_stack --- @dep expcore.common
|
||||
require 'config.expcore.command_role_parse'
|
||||
require("modules.exp_legacy.config.expcore.command_role_parse")
|
||||
|
||||
--- Clears a players inventory
|
||||
-- @command clear-inventory
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
@commands Connect
|
||||
]]
|
||||
|
||||
local Async = require 'expcore.async' --- @dep expcore.async
|
||||
local External = require 'expcore.external' --- @dep expcore.external
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_role_parse'
|
||||
local Async = require("modules/exp_util/async")
|
||||
local External = require("modules.exp_legacy.expcore.external") --- @dep expcore.external
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
require("modules.exp_legacy.config.expcore.command_role_parse")
|
||||
local concat = table.concat
|
||||
|
||||
local request_connection = Async.register(External.request_connection)
|
||||
local request_connection_async = Async.register(External.request_connection)
|
||||
|
||||
local function get_server_id(server)
|
||||
local current_server = External.get_current_server()
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
@commands Debug
|
||||
]]
|
||||
|
||||
local DebugView = require 'modules.gui.debug.main_view' --- @dep modules.gui.debug.main_view
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local DebugView = require("modules.exp_legacy.modules.gui.debug.main_view") --- @dep modules.gui.debug.main_view
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
|
||||
--- Opens the debug pannel for viewing tables.
|
||||
-- @command debug
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
@commands Enemy
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
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')
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
@commands Find
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
--- Find a player on your map.
|
||||
-- @command find-on-map
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
@commands Toggle Friendly Fire
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
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')
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
@commands Help
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
require 'config.expcore.command_general_parse'
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
local results_per_page = 5
|
||||
|
||||
local search_cache = {}
|
||||
Global.register(search_cache, function(tbl)
|
||||
Storage.register(search_cache, function(tbl)
|
||||
search_cache = tbl
|
||||
end)
|
||||
|
||||
@@ -25,7 +25,6 @@ Commands.new_command('search-help', {'expcom-chelp.description'}, 'Searches for
|
||||
: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))
|
||||
@@ -45,7 +44,6 @@ Commands.new_command('search-help', {'expcom-chelp.description'}, 'Searches for
|
||||
local current_page = 1
|
||||
local page_count = 0
|
||||
local commands = Commands.search(keyword, player)
|
||||
|
||||
-- loops other all commands returned by search, includes game commands
|
||||
for _, command_data in pairs(commands) do
|
||||
-- if the number of results if greater than the number already added then it moves onto a new page
|
||||
@@ -54,7 +52,6 @@ Commands.new_command('search-help', {'expcom-chelp.description'}, 'Searches for
|
||||
current_page = current_page + 1
|
||||
table.insert(pages, {})
|
||||
end
|
||||
|
||||
-- adds the new command to the page
|
||||
page_count = page_count + 1
|
||||
found = found + 1
|
||||
@@ -67,7 +64,6 @@ Commands.new_command('search-help', {'expcom-chelp.description'}, 'Searches for
|
||||
alias_format
|
||||
})
|
||||
end
|
||||
|
||||
-- adds the result to the cache
|
||||
search_cache[player_index] = {
|
||||
keyword=keyword:lower(),
|
||||
@@ -91,7 +87,6 @@ Commands.new_command('search-help', {'expcom-chelp.description'}, 'Searches for
|
||||
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
|
||||
end)
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
@commands Home
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
require 'config.expcore.command_general_parse'
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
local homes = {}
|
||||
Global.register(homes, function(tbl)
|
||||
Storage.register(homes, function(tbl)
|
||||
homes = tbl
|
||||
end)
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
@commands Interface
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
|
||||
-- modules that are loaded into the interface env to be accessed
|
||||
local interface_modules = {
|
||||
@@ -13,7 +13,6 @@ local interface_modules = {
|
||||
['Group'] = 'expcore.permission_groups',
|
||||
['Roles'] = 'expcore.roles',
|
||||
['Gui'] = 'expcore.gui',
|
||||
['Async'] = 'expcore.async',
|
||||
['Datastore'] = 'expcore.datastore',
|
||||
['External'] = 'expcore.external'
|
||||
}
|
||||
@@ -27,7 +26,7 @@ end
|
||||
|
||||
local interface_env = {} -- used as a persistent sandbox for interface commands
|
||||
local interface_callbacks = {} -- saves callbacks which can load new values per use
|
||||
Global.register(interface_env, function(tbl)
|
||||
Storage.register(interface_env, function(tbl)
|
||||
interface_env = tbl
|
||||
end)
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
@commands Jail
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Jail = require 'modules.control.jail' --- @dep modules.control.jail
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local Jail = require("modules.exp_legacy.modules.control.jail") --- @dep modules.control.jail
|
||||
local format_chat_player_name = _C.format_chat_player_name --- @dep expcore.common
|
||||
require 'config.expcore.command_role_parse'
|
||||
require("modules.exp_legacy.config.expcore.command_role_parse")
|
||||
|
||||
--- Puts a player into jail and removes all other roles.
|
||||
-- @command jail
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
@commands Kill
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
require 'config.expcore.command_general_parse'
|
||||
require 'config.expcore.command_role_parse'
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
require("modules.exp_legacy.config.expcore.command_role_parse")
|
||||
|
||||
--- Kills yourself or another player.
|
||||
-- @command kill
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@commands LastLocation
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local format_chat_player_name = _C.format_chat_player_name --- @dep expcore.common
|
||||
require 'config.expcore.command_general_parse'
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
--- Get the last location of a player.
|
||||
-- @command last-location
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@commands Me
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
|
||||
--- Sends an action message in the chat
|
||||
-- @command me
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
@commands Pollution Handle
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
Commands.new_command('pollution-clear', {'expcom-pol.description-clr'}, 'Clear pollution')
|
||||
:set_flag('admin_only')
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
@commands Protection
|
||||
]]
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local format_chat_player_name = _C.format_chat_player_name --- @dep expcore.common
|
||||
local EntityProtection = require 'modules.control.protection' --- @dep modules.control.protection
|
||||
local Selection = require 'modules.control.selection' --- @dep modules.control.selection
|
||||
local EntityProtection = require("modules.exp_legacy.modules.control.protection") --- @dep modules.control.protection
|
||||
local Selection = require("modules.exp_legacy.modules.control.selection") --- @dep modules.control.selection
|
||||
|
||||
local SelectionProtectEntity = 'ProtectEntity'
|
||||
local SelectionProtectArea = 'ProtectArea'
|
||||
|
||||
local renders = {} -- Stores all renders for a player
|
||||
Global.register({
|
||||
Storage.register({
|
||||
renders = renders
|
||||
}, function(tbl)
|
||||
renders = tbl.renders
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@commands Rainbow
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local format_chat_colour = _C.format_chat_colour --- @dep expcore.common
|
||||
|
||||
local function step_component(c1, c2)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
local Commands = require 'expcore.commands'
|
||||
local Commands = require("modules.exp_legacy.expcore.commands")
|
||||
|
||||
local function Modules(moduleInventory) -- returns the multiplier of the modules
|
||||
local effect1 = moduleInventory.get_item_count("productivity-module") -- type 1
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@commands Repair
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local config = require 'config.repair' --- @dep config.repair
|
||||
require 'config.expcore.command_general_parse'
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local config = require("modules.exp_legacy.config.repair") --- @dep config.repair
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
local max_time_to_live = 4294967295 -- unit32 max
|
||||
--- Repairs entities on your force around you
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
@commands Reports
|
||||
]]
|
||||
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Reports = require 'modules.control.reports' --- @dep modules.control.reports
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local Reports = require("modules.exp_legacy.modules.control.reports") --- @dep modules.control.reports
|
||||
local format_chat_player_name = _C.format_chat_player_name--- @dep expcore.common
|
||||
require 'config.expcore.command_general_parse'
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
--- Print a message to all players who match the value of admin
|
||||
local function print_to_players(admin, message)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local config = require 'config.research' --- @dep config.research
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local config = require("modules.exp_legacy.config.research") --- @dep config.research
|
||||
|
||||
local research = {}
|
||||
Global.register(research, function(tbl)
|
||||
Storage.register(research, function(tbl)
|
||||
research = tbl
|
||||
end)
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@commands Roles
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local Colours = require 'utils.color_presets' --- @dep utils.color_presets
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
local Colours = require("modules/exp_util/include/color")
|
||||
local format_chat_player_name, format_chat_colour_localized = _C.format_chat_player_name, _C.format_chat_colour_localized
|
||||
|
||||
--- Assigns a role to a player
|
||||
@@ -68,12 +68,10 @@ Commands.new_command('list-roles', {'expcom-roles.description-list-roles'}, 'Lis
|
||||
local role_name = format_chat_colour_localized(role.name, colour)
|
||||
if index == 1 then
|
||||
message = {'expcom-roles.list', role_name}
|
||||
|
||||
if player then
|
||||
local player_name_colour = format_chat_player_name(player)
|
||||
message = {'expcom-roles.list-player', player_name_colour, role_name}
|
||||
end
|
||||
|
||||
else
|
||||
message = {'expcom-roles.list-element', message, role_name}
|
||||
end
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
@commands InventorySearch
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local format_number = require('util').format_number --- @dep util
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local format_number = require("util").format_number --- @dep util
|
||||
local format_chat_player_name = _C.format_chat_player_name --- @dep expcore.common
|
||||
local format_time = _C.format_time
|
||||
require 'config.expcore.command_general_parse'
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
--- Input parse for items by name
|
||||
local function item_parse(input, _, reject)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
@commands Spawn
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
|
||||
local function teleport(player)
|
||||
local surface = player.surface
|
||||
@@ -52,12 +52,10 @@ Commands.new_command('go-to-spawn', {'expcom-spawn.description'}, 'Teleport to s
|
||||
:register(function(player, action_player)
|
||||
if not action_player then
|
||||
return Commands.error{'expcom-spawn.unavailable'}
|
||||
|
||||
elseif action_player == player then
|
||||
if not teleport(player) then
|
||||
return Commands.error{'expcom-spawn.unavailable'}
|
||||
end
|
||||
|
||||
elseif Roles.player_allowed(player, 'command/go-to-spawn/always') then
|
||||
if not teleport(action_player) then
|
||||
return Commands.error{'expcom-spawn.unavailable'}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@commands Spectate
|
||||
]]
|
||||
|
||||
local Spectate = require 'modules.control.spectate' --- @dep modules.control.spectate
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
local Spectate = require("modules.exp_legacy.modules.control.spectate") --- @dep modules.control.spectate
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
--- Toggles spectator mode for the caller
|
||||
-- @command spectate
|
||||
@@ -13,7 +13,6 @@ Commands.new_command('spectate', {'expcom-spectate.description-spectate'}, 'Togg
|
||||
:register(function(player)
|
||||
if Spectate.is_spectating(player) then
|
||||
Spectate.stop_spectate(player)
|
||||
|
||||
else
|
||||
Spectate.start_spectate(player)
|
||||
end
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
@commands Set game speed
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
Commands.new_command('game-speed', {'expcom-speed.description'}, 'Set game speed')
|
||||
:add_param('amount', 'number-range', 0.2, 8)
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
]]
|
||||
|
||||
local copy_items_stack = _C.copy_items_stack --- @dep expcore.common
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
Commands.new_command('clear-item-on-ground', {'expcom-surface-clearing.description-ci'}, 'Clear Item On Ground')
|
||||
:add_param('range', false, 'integer-range', 1, 1000)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
@commands Teleport
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
local function teleport(from_player, to_player)
|
||||
local surface = to_player.surface
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@commands Set Automatic Train
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
local format_number = require('util').format_number
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
local format_number = require("util").format_number
|
||||
|
||||
Commands.new_command('set-trains-to-automatic', {'expcom-train.description'}, 'Set All Trains to Automatic')
|
||||
:register(function(player)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- Adds a virtual layer to store power to save space.
|
||||
-- @commands Vlayer
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
local vlayer = require 'modules.control.vlayer'
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
local vlayer = require("modules.exp_legacy.modules.control.vlayer")
|
||||
|
||||
Commands.new_command('vlayer-info', {'vlayer.description-vi'}, 'Vlayer Info')
|
||||
:register(function(_)
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
@commands Warnings
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Warnings = require 'modules.control.warnings' --- @dep modules.control.warnings
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local Warnings = require("modules.exp_legacy.modules.control.warnings") --- @dep modules.control.warnings
|
||||
local format_chat_player_name = _C.format_chat_player_name --- @dep expcore.common
|
||||
local config = require 'config.warnings' --- @dep config.warnings
|
||||
require 'config.expcore.command_role_parse'
|
||||
local config = require("modules.exp_legacy.config.warnings") --- @dep config.warnings
|
||||
require("modules.exp_legacy.config.expcore.command_role_parse")
|
||||
|
||||
--- Gives a warning to a player; may lead to automatic script action.
|
||||
-- @command give-warning
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- Adds a waterfill
|
||||
-- @commands Waterfill
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
local Selection = require 'modules.control.selection' --- @dep modules.control.selection
|
||||
local SelectionConvertArea = 'WaterfillConvertArea'
|
||||
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 SelectionConvertArea = 'ConvertArea'
|
||||
|
||||
--- Align an aabb to the grid by expanding it
|
||||
local function aabb_align_expand(aabb)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
@usage
|
||||
-- import the module from the control modules
|
||||
local Jail = require 'modules.control.jail' --- @dep modules.control.jail
|
||||
local Jail = require("modules.exp_legacy.modules.control.jail") --- @dep modules.control.jail
|
||||
|
||||
-- This will move 'MrBiter' to the jail role and remove all other roles from them
|
||||
-- the player name and reason are only so they can be included in the event for user feedback
|
||||
@@ -16,8 +16,8 @@
|
||||
Jail.unjail_player('MrBiter', 'Cooldude2606')
|
||||
]]
|
||||
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local Game = require 'utils.game' --- @dep utils.game
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
local Game = require("modules.exp_legacy.utils.game") --- @dep utils.game
|
||||
|
||||
local valid_player = Game.get_player_from_any
|
||||
local assign_roles = Roles.assign_player
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
@usage
|
||||
-- import the module from the control modules
|
||||
local Production = require 'modules.control.production' --- @dep modules.control.production
|
||||
local Production = require("modules.exp_legacy.modules.control.production") --- @dep modules.control.production
|
||||
|
||||
-- This will return the less precise index from the one given
|
||||
-- this means that one_second will return one_minute or ten_hours will return fifty_hours
|
||||
@@ -32,8 +32,8 @@
|
||||
|
||||
]]
|
||||
|
||||
local Colors = require 'utils.color_presets' --- @dep utils.color_presets
|
||||
local format_number = require('util').format_number --- @dep util
|
||||
local Colors = require("modules/exp_util/include/color")
|
||||
local format_number = require("util").format_number --- @dep util
|
||||
|
||||
local precision_index = defines.flow_precision_index
|
||||
local Production = {}
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
@alias Protection
|
||||
]]
|
||||
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local config = require 'config.protection' --- @dep config.protection
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local config = require("modules.exp_legacy.config.protection") --- @dep config.protection
|
||||
local EntityProtection = {
|
||||
protected_entity_names = table.deep_copy(config.always_protected_names),
|
||||
protected_entity_types = table.deep_copy(config.always_protected_types),
|
||||
@@ -36,17 +36,17 @@ end
|
||||
-- Require roles if a permission is assigned in the config
|
||||
local Roles
|
||||
if config.ignore_permission then
|
||||
Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
end
|
||||
|
||||
----- Global Variables -----
|
||||
----- Storage Variables -----
|
||||
--- Variables stored in the global table
|
||||
|
||||
local protected_entities = {} -- All entities which are protected
|
||||
local protected_areas = {} -- All areas which are protected
|
||||
local repeats = {} -- Stores repeat removals by players
|
||||
|
||||
Global.register({
|
||||
Storage.register({
|
||||
protected_entities = protected_entities,
|
||||
protected_areas = protected_areas,
|
||||
repeats = repeats
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
@usage
|
||||
-- import the module from the control modules
|
||||
local Reports = require 'modules.control.reports' --- @dep modules.control.reports
|
||||
local Reports = require("modules.exp_legacy.modules.control.reports") --- @dep modules.control.reports
|
||||
|
||||
-- This will place a report on "MrBiter" (must be a valid player) the report will have been made
|
||||
-- by "Cooldude2606" (must be the player name) with the reason 'Liking biters too much' this can be
|
||||
@@ -24,8 +24,8 @@
|
||||
|
||||
]]
|
||||
|
||||
local Game = require 'utils.game' --- @dep utils.game
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Game = require("modules.exp_legacy.utils.game") --- @dep utils.game
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
|
||||
local valid_player = Game.get_player_from_any
|
||||
|
||||
@@ -50,7 +50,7 @@ local Reports = {
|
||||
}
|
||||
|
||||
local user_reports = Reports.user_reports
|
||||
Global.register(user_reports, function(tbl)
|
||||
Storage.register(user_reports, function(tbl)
|
||||
Reports.user_reports = tbl
|
||||
user_reports = Reports.user_reports
|
||||
end)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
@usage
|
||||
-- import the module from the control modules
|
||||
local Rockets = require 'modules.control.rockets' --- @dep modules.control.rockets
|
||||
local Rockets = require("modules.exp_legacy.modules.control.rockets") --- @dep modules.control.rockets
|
||||
|
||||
-- Some basic information is stored for each silo that has been built
|
||||
-- the data includes: the tick it was built, the rockets launched from it and more
|
||||
@@ -25,9 +25,9 @@
|
||||
|
||||
]]
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local config = require 'config.gui.rockets' --- @dep config.rockets
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local config = require("modules.exp_legacy.config.gui.rockets") --- @dep config.rockets
|
||||
|
||||
local largest_rolling_avg = 0
|
||||
for _, avg_over in pairs(config.stats.rolling_avg) do
|
||||
@@ -45,7 +45,7 @@ local Rockets = {
|
||||
local rocket_times = Rockets.times
|
||||
local rocket_stats = Rockets.stats
|
||||
local rocket_silos = Rockets.silos
|
||||
Global.register({
|
||||
Storage.register({
|
||||
rocket_times = rocket_times,
|
||||
rocket_stats = rocket_stats,
|
||||
rocket_silos = rocket_silos
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
@alias Selection
|
||||
]]
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local Selection = {
|
||||
events = {
|
||||
--- When a player enters selection mode
|
||||
@@ -24,7 +24,7 @@ local Selection = {
|
||||
local selection_tool = { name='selection-tool' }
|
||||
|
||||
local selections = {}
|
||||
Global.register({
|
||||
Storage.register({
|
||||
selections = selections
|
||||
}, function(tbl)
|
||||
selections = tbl.selections
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Gui = require 'expcore.gui' --- @dep expcore.gui
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local Gui = require("modules.exp_legacy.expcore.gui") --- @dep expcore.gui
|
||||
|
||||
----- Locals -----
|
||||
local follow_label -- Gui constructor
|
||||
@@ -9,8 +9,8 @@ local following = {}
|
||||
local spectating = {}
|
||||
local Public = {}
|
||||
|
||||
----- Global data -----
|
||||
Global.register({
|
||||
----- Storage data -----
|
||||
Storage.register({
|
||||
following = following,
|
||||
spectating = spectating
|
||||
}, function(tbl)
|
||||
|
||||
@@ -10,8 +10,8 @@ Tasks.update_task(task_id, 'We need more iron!', game.player.name)
|
||||
|
||||
]]
|
||||
|
||||
local Datastore = require 'expcore.datastore' --- @dep expcore.datastore
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Datastore = require("modules.exp_legacy.expcore.datastore") --- @dep expcore.datastore
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
|
||||
--- Stores all data for the warp gui
|
||||
local TaskData = Datastore.connect('TaskData')
|
||||
@@ -19,9 +19,9 @@ TaskData:set_serializer(function(raw_key) return raw_key.task_id end)
|
||||
|
||||
local Tasks = {}
|
||||
|
||||
-- Global lookup table for force name to task ids
|
||||
-- Storage lookup table for force name to task ids
|
||||
local force_tasks = {_uid=1}
|
||||
Global.register(force_tasks, function(tbl)
|
||||
Storage.register(force_tasks, function(tbl)
|
||||
force_tasks = tbl
|
||||
end)
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
@alias vlayer
|
||||
]]
|
||||
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local config = require 'config.vlayer' --- @dep config.vlayer
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local config = require("modules.exp_legacy.config.vlayer") --- @dep config.vlayer
|
||||
local move_items_stack = _C.move_items_stack
|
||||
|
||||
local mega = 1000000
|
||||
@@ -35,7 +35,7 @@ local vlayer_data = {
|
||||
surface = table.deep_copy(config.surface)
|
||||
}
|
||||
|
||||
Global.register(vlayer_data, function(tbl)
|
||||
Storage.register(vlayer_data, function(tbl)
|
||||
vlayer_data = tbl
|
||||
end)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
@usage
|
||||
-- import the module from the control modules
|
||||
local Warnings = require 'modules.control.warnings' --- @dep modules.control.warnings
|
||||
local Warnings = require("modules.exp_legacy.modules.control.warnings") --- @dep modules.control.warnings
|
||||
|
||||
-- This will add a warning to the player
|
||||
Warnings.add_warning('MrBiter', 'Cooldude2606', 'Killed too many biters')
|
||||
@@ -21,15 +21,15 @@
|
||||
Warnings.clear_warnings('MrBiter', 'Cooldude2606')
|
||||
]]
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Game = require 'utils.game' --- @dep utils.game
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local config = require 'config.warnings' --- @dep config.warnings
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Game = require("modules.exp_legacy.utils.game") --- @dep utils.game
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local config = require("modules.exp_legacy.config.warnings") --- @dep config.warnings
|
||||
|
||||
local valid_player = Game.get_player_from_any
|
||||
|
||||
--- Stores the quickbar filters for a player
|
||||
local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
|
||||
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
|
||||
local PlayerWarnings = PlayerData.Required:combine('Warnings')
|
||||
PlayerWarnings:set_metadata{
|
||||
stringify = function(value)
|
||||
@@ -75,7 +75,7 @@ local Warnings = {
|
||||
}
|
||||
|
||||
local user_script_warnings = Warnings.user_script_warnings
|
||||
Global.register(user_script_warnings, function(tbl)
|
||||
Storage.register(user_script_warnings, function(tbl)
|
||||
Warnings.user_script_warnings = tbl
|
||||
user_script_warnings = tbl
|
||||
end)
|
||||
|
||||
@@ -21,9 +21,9 @@ Warps.make_warp_tag(warp_id)
|
||||
|
||||
]]
|
||||
|
||||
local Datastore = require 'expcore.datastore' --- @dep expcore.datastore
|
||||
local Global = require 'utils.global' --- @dep utils.global
|
||||
local config = require 'config.gui.warps' --- @dep config.warps
|
||||
local Datastore = require("modules.exp_legacy.expcore.datastore") --- @dep expcore.datastore
|
||||
local Storage = require("modules/exp_util/storage")
|
||||
local config = require("modules.exp_legacy.config.gui.warps") --- @dep config.warps
|
||||
|
||||
--- Stores all data for the warp system
|
||||
local WrapData = Datastore.connect('WrapData')
|
||||
@@ -31,10 +31,10 @@ WrapData:set_serializer(function(raw_key) return raw_key.warp_id end)
|
||||
|
||||
local Warps = {}
|
||||
|
||||
-- Global lookup table for force name to task ids
|
||||
-- Storage lookup table for force name to task ids
|
||||
local force_warps = {_uid=1}
|
||||
---@cast force_warps table<string, { spawn: string, [number]: string }>
|
||||
Global.register(force_warps, function(tbl)
|
||||
Storage.register(force_warps, function(tbl)
|
||||
force_warps = tbl
|
||||
end)
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- Stores if you use alt mode or not and auto applies it
|
||||
-- @data Alt-View
|
||||
|
||||
local Event = require 'utils.event' ---@dep utils.event
|
||||
local Event = require("modules/exp_legacy/utils/event") ---@dep utils.event
|
||||
|
||||
--- Stores the visible state of alt mode
|
||||
local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
|
||||
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
|
||||
local UsesAlt = PlayerData.Settings:combine('UsesAlt')
|
||||
UsesAlt:set_default(false)
|
||||
UsesAlt:set_metadata{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user