Merge branch 'release/6.2.0' into dev
This commit is contained in:
78
README.md
78
README.md
@@ -24,63 +24,66 @@
|
|||||||
|
|
||||||
## Explosive Gaming
|
## Explosive Gaming
|
||||||
|
|
||||||
Explosive Gaming (often ExpGaming) is a server hosting community with a strong focus on Factorio and games that follow similar ideas. Our Factorio server are known for hosting large maps with the main goal of being a "mega base" which can produce as much as possible within our reset schedule. Although these servers tend to attract the more experienced players, our servers are open to everyone. You can find us through our [website], [discord], [wiki], or in the public games tab in Factorio (ExpGaming S1, ExpGaming S2, etc.).
|
Explosive Gaming (often ExpGaming) is a server hosting community with a strong focus on [Factorio](factorio) and games with similar themes. We are best known for our weekly reset Factorio server with a vanilla+ scenario. Although our servers tend to attract the more experienced players, our servers are open to everyone. You can find us through our [website], [discord], or the public server list with the name ExpGaming.
|
||||||
|
|
||||||
## Use and Installation
|
## Use and Installation
|
||||||
|
|
||||||
1) Download this [git repository](https://github.com/explosivegaming/scenario/archive/master.zip) for the stable release. The dev branch can be found [here](https://github.com/explosivegaming/scenario/archive/dev.zip) for those who want the latest features. See [releases](#releases) for other release branches.
|
1) Download our [git repository](stable-dl) for the stable release. For the latest features you can download our [dev branch](experimental-dl). See [releases](#releases) for other major releases.
|
||||||
|
|
||||||
2) Extract the downloaded zip file from the branch you downloaded into Factorio's scenario directory:
|
2) Extract the downloaded zip file into your Factorio scenario directory:
|
||||||
* Windows: `%appdata%\Factorio\scenarios`
|
* Windows: `%appdata%\Factorio\scenarios`
|
||||||
* Linux: `~/.factorio/scenarios`
|
* Linux: `~/.factorio/scenarios`
|
||||||
|
|
||||||
3) Within the scenario you can find `./config/_file_loader.lua` which contains a list of all the modules that will be loaded by the scenario; simply comment out (or remove) features you do not want but note that some modules may load other modules as dependencies even when removed from the list.
|
3) Within the scenario you can find `./config/_file_loader.lua` which contains a list of all the modules which will be loaded by the scenario. Comment out (or remove) features you do not want. Be aware modules may load other modules as dependencies even when removed from the list.
|
||||||
|
|
||||||
4) More advanced users may want to play with the other configs files within `./config` but please be aware that some of the config files will require a basic understanding of lua while others may just be a list of values.
|
4) More advanced users can adjust other configs files within `./config` but please be aware some files will require a basic understanding of lua.
|
||||||
|
|
||||||
5) Once you have made any config changes that you wish to make open Factorio, select play, then start scenario (or host scenario from within multiplayer tab), and select the scenario which will be called `scenario-master` if you have downloaded the latest stable release and have not changed the folder name.
|
5) Once you have made your config changes: open Factorio, select either single or multiplayer, select (host) new game, and finally select our scenario which will be called `scenario-master` or `scenario-dev` under user scenarios.
|
||||||
|
|
||||||
6) The scenario will now load all the selected modules and start the map, any errors or exceptions raised in the scenario should not cause a game/server crash, so if any features do not work as expected then it may be returning an error in the log.
|
6) You will now be asked to generate your map and the scenario will load all selected modules. If any module does not load as expected please check `factorio-current.log` in your Factorio directory for errors and report them to our [issues page](issues).
|
||||||
Please report these errors to [the issues page](issues).
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
All are welcome to make pull requests and issues for this scenario, if you are in any doubt, please ask someone in our [discord]. If you do not know lua and don't feel like learning you can always make a [feature request]. To find out what we already have please read our [docs]. Please keep in mind while making code changes:
|
All are welcome to make bug reports, feature requests, and pull requests for our scenario. We do not require you to have any lua or coding knowledge to make bug reports and feature requests. If you have any questions ask us in our [discord].
|
||||||
|
|
||||||
|
For developers wanting to add features please follow these guidelines:
|
||||||
|
|
||||||
|
* All code is documented using ldoc, the end result can be found [here](docs).
|
||||||
|
* Changes should be made on your own fork and merged into `dev` through a pull request.
|
||||||
|
* Pull requests are automatically linted and documentation checked.
|
||||||
|
* Pull requests are manually reviewed to maintain code and language quality.
|
||||||
* New features should have the branch names: `feature/feature-name`
|
* New features should have the branch names: `feature/feature-name`
|
||||||
* New features are merged into `dev` after it has been completed, this can be done through a pull request.
|
* Bug fixes should have the branch names: `fix/bug-name`
|
||||||
* After a number of features have been added a release branch is made: `release/X.Y.0`
|
|
||||||
* Bug fixes and localization can be made to the release branch with a pull request rather than into dev.
|
|
||||||
* A release is merged into `master` on the following friday after it is considered stable.
|
|
||||||
* Patches may be named `patch/X.Y.Z` and will be merged into `dev` and then `master` when appropriate.
|
|
||||||
|
|
||||||
## Releases
|
## Releases
|
||||||
|
|
||||||
| Scenario Version* | Version Name | Factorio Version** |
|
| Release* | Release Name | Factorio Version** |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| [v6.1][s6.1] | External Data Overhaul | [v1.0.0][f1.0.0] |
|
| [6.2][s6.2] | Mega Feature Bundle | [1.1.32][f1.1.32] |
|
||||||
| [v6.0][s6.0] | Gui / 0.18 Overhaul | [v0.18.17][f0.18.17] |
|
| [6.1][s6.1] | External Data Overhaul | [1.0.0][f1.0.0] |
|
||||||
| [v5.10][s5.10] | Data Store Rewrite | [v0.17.71][f0.17.71] |
|
| [6.0][s6.0] | Gui / 0.18 Overhaul | [0.18.17][f0.18.17] |
|
||||||
| [v5.9][s5.9] | Control Modules and Documentation | [v0.17.63][f0.17.63] |
|
| [5.10][s5.10] | Data Store Rewrite | [0.17.71][f0.17.71] |
|
||||||
| [v5.8][s5.8] | Home and Chat Bot | [v0.17.47][f0.17.49] |
|
| [5.9][s5.9] | Control Modules and Documentation | [0.17.63][f0.17.63] |
|
||||||
| [v5.7][s5.7] | Warp System | [v0.17.47][f0.17.47] |
|
| [5.8][s5.8] | Home and Chat Bot | [0.17.47][f0.17.49] |
|
||||||
| [v5.6][s5.6] | Information Guis | [v0.17.44][f0.17.44] |
|
| [5.7][s5.7] | Warp System | [0.17.47][f0.17.47] |
|
||||||
| [v5.5][s5.5] | Gui System | [v0.17.43][f0.17.43] |
|
| [5.6][s5.6] | Information Guis | [0.17.44][f0.17.44] |
|
||||||
| [v5.4][s5.4] | Admin Controls | [v0.17.32][f0.17.32] |
|
| [5.5][s5.5] | Gui System | [0.17.43][f0.17.43] |
|
||||||
| [v5.3][s5.3] | Custom Roles | [v0.17.28][f0.17.28] |
|
| [5.4][s5.4] | Admin Controls | [0.17.32][f0.17.32] |
|
||||||
| [v5.2][s5.2] | Quality of life | [v0.17.22][f0.17.22] |
|
| [5.3][s5.3] | Custom Roles | [0.17.28][f0.17.28] |
|
||||||
| [v5.1][s5.1] | Permission Groups | [v0.17.13][f0.17.13] |
|
| [5.2][s5.2] | Quality of life | [0.17.22][f0.17.22] |
|
||||||
| [v5.0][s5.0] | 0.17 Overhaul| [v0.17][f0.17.9] |
|
| [5.1][s5.1] | Permission Groups | [0.17.13][f0.17.13] |
|
||||||
| [v4.0][s4.0] | Softmod Manager | [v0.16.51][f0.16.51] |
|
| [5.0][s5.0] | 0.17 Overhaul| [0.17][f0.17.9] |
|
||||||
| [v3.0][s3.0] | 0.16 Overhaul | [v0.16][f0.16] |
|
| [4.0][s4.0] | Softmod Manager | [0.16.51][f0.16.51] |
|
||||||
| [v2.0][s2.0] | Localization and clean up | [v0.15][f0.15] |
|
| [3.0][s3.0] | 0.16 Overhaul | [0.16][f0.16] |
|
||||||
| [v1.0][s1.0] | Modulation | [v0.15][f0.15] |
|
| [2.0][s2.0] | Localization and clean up | [0.15][f0.15] |
|
||||||
| [v0.1][s0.1] | First Tracked Version | [v0.14][f0.14] |
|
| [1.0][s1.0] | Modulation | [0.15][f0.15] |
|
||||||
|
| [0.1][s0.1] | First Tracked Version | [0.14][f0.14] |
|
||||||
|
|
||||||
\* Scenario patch versions have been omitted.
|
\* Scenario patch releases have been omitted and can be found [here](https://github.com/explosivegaming/scenario/releases).
|
||||||
|
|
||||||
\*\* Factorio versions show the version they were made for, often the minimum requirement.
|
\*\* Factorio versions show the version they were made for, often the minimum requirement to run the scenario.
|
||||||
|
|
||||||
|
[s6.2]: https://github.com/explosivegaming/scenario/releases/tag/6.2.0
|
||||||
[s6.1]: https://github.com/explosivegaming/scenario/releases/tag/6.1.0
|
[s6.1]: https://github.com/explosivegaming/scenario/releases/tag/6.1.0
|
||||||
[s6.0]: https://github.com/explosivegaming/scenario/releases/tag/6.0.0
|
[s6.0]: https://github.com/explosivegaming/scenario/releases/tag/6.0.0
|
||||||
[s5.10]: https://github.com/explosivegaming/scenario/releases/tag/5.10.0
|
[s5.10]: https://github.com/explosivegaming/scenario/releases/tag/5.10.0
|
||||||
@@ -100,6 +103,7 @@ All are welcome to make pull requests and issues for this scenario, if you are i
|
|||||||
[s1.0]: https://github.com/explosivegaming/scenario/releases/tag/v1.0
|
[s1.0]: https://github.com/explosivegaming/scenario/releases/tag/v1.0
|
||||||
[s0.1]: https://github.com/explosivegaming/scenario/releases/tag/v0.1
|
[s0.1]: https://github.com/explosivegaming/scenario/releases/tag/v0.1
|
||||||
|
|
||||||
|
[f1.1.32]: https://wiki.factorio.com/Version_history/1.1.0#1.1.32
|
||||||
[f1.0.0]: https://wiki.factorio.com/Version_history/1.0.0#1.0.0
|
[f1.0.0]: https://wiki.factorio.com/Version_history/1.0.0#1.0.0
|
||||||
[f0.18.17]: https://wiki.factorio.com/Version_history/0.18.0#0.18.17
|
[f0.18.17]: https://wiki.factorio.com/Version_history/0.18.0#0.18.17
|
||||||
[f0.17.71]: https://wiki.factorio.com/Version_history/0.17.0#0.17.71
|
[f0.17.71]: https://wiki.factorio.com/Version_history/0.17.0#0.17.71
|
||||||
@@ -122,8 +126,10 @@ All are welcome to make pull requests and issues for this scenario, if you are i
|
|||||||
|
|
||||||
The Explosive Gaming codebase is licensed under the [GNU General Public License v3.0](LICENSE)
|
The Explosive Gaming codebase is licensed under the [GNU General Public License v3.0](LICENSE)
|
||||||
|
|
||||||
|
[stable-dl]: https://github.com/explosivegaming/scenario/archive/master.zip
|
||||||
|
[experimental-dl]: https://github.com/explosivegaming/scenario/archive/dev.zip
|
||||||
|
[factorio]: https://factorio.com/
|
||||||
[docs]: https://explosivegaming.github.io/scenario/
|
[docs]: https://explosivegaming.github.io/scenario/
|
||||||
[issues]: https://github.com/explosivegaming/scenario/issues/new/choose
|
[issues]: https://github.com/explosivegaming/scenario/issues/new/choose
|
||||||
[website]: https://explosivegaming.nl
|
[website]: https://explosivegaming.nl
|
||||||
[discord]: https://discord.explosivegaming.nl
|
[discord]: https://discord.explosivegaming.nl
|
||||||
[wiki]: https://wiki.explosivegaming.nl
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ return {
|
|||||||
'modules.addons.tree-decon',
|
'modules.addons.tree-decon',
|
||||||
'modules.addons.afk-kick',
|
'modules.addons.afk-kick',
|
||||||
'modules.addons.report-jail',
|
'modules.addons.report-jail',
|
||||||
|
'modules.addons.protection-jail',
|
||||||
|
|
||||||
--- Data
|
--- Data
|
||||||
'modules.data.statistics',
|
'modules.data.statistics',
|
||||||
@@ -63,12 +64,12 @@ return {
|
|||||||
'modules.gui.readme',
|
'modules.gui.readme',
|
||||||
'modules.gui.rocket-info',
|
'modules.gui.rocket-info',
|
||||||
'modules.gui.science-info',
|
'modules.gui.science-info',
|
||||||
|
'modules.gui.autofill',
|
||||||
'modules.gui.warp-list',
|
'modules.gui.warp-list',
|
||||||
'modules.gui.task-list',
|
'modules.gui.task-list',
|
||||||
'modules.gui.player-list',
|
'modules.gui.player-list',
|
||||||
'modules.gui.server-ups',
|
'modules.gui.server-ups',
|
||||||
'modules.commands.debug',
|
'modules.commands.debug',
|
||||||
'modules.gui.autofill',
|
|
||||||
|
|
||||||
--- Config Files
|
--- Config Files
|
||||||
'config.expcore.command_auth_admin', -- commands tagged with admin_only are blocked for non admins
|
'config.expcore.command_auth_admin', -- commands tagged with admin_only are blocked for non admins
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ return {
|
|||||||
['discord'] = {'info.discord'},
|
['discord'] = {'info.discord'},
|
||||||
['expgaming'] = {'info.website'},
|
['expgaming'] = {'info.website'},
|
||||||
['website'] = {'info.website'},
|
['website'] = {'info.website'},
|
||||||
['wiki'] = {'info.wiki'},
|
|
||||||
['status'] = {'info.status'},
|
['status'] = {'info.status'},
|
||||||
['github'] = {'info.github'},
|
['github'] = {'info.github'},
|
||||||
['patreon'] = {'info.patreon'},
|
['patreon'] = {'info.patreon'},
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ return {
|
|||||||
{'info.read-readme'},
|
{'info.read-readme'},
|
||||||
{'info.discord'},
|
{'info.discord'},
|
||||||
{'info.softmod'},
|
{'info.softmod'},
|
||||||
{'info.wiki'},
|
|
||||||
{'info.redmew'},
|
{'info.redmew'},
|
||||||
{'info.custom-commands'},
|
{'info.custom-commands'},
|
||||||
{'info.status'},
|
{'info.status'},
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
-- @config Discord-Alerts
|
-- @config Discord-Alerts
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
show_playtime=true,
|
||||||
entity_protection=true,
|
entity_protection=true,
|
||||||
player_reports=true,
|
player_reports=true,
|
||||||
player_warnings=true,
|
player_warnings=true,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ end)
|
|||||||
|
|
||||||
--- Admin Roles
|
--- Admin Roles
|
||||||
Roles.new_role('System','SYS')
|
Roles.new_role('System','SYS')
|
||||||
:set_permission_group('Admin')
|
:set_permission_group('Default', true)
|
||||||
:set_flag('is_admin')
|
:set_flag('is_admin')
|
||||||
:set_flag('is_spectator')
|
:set_flag('is_spectator')
|
||||||
:set_flag('report-immune')
|
:set_flag('report-immune')
|
||||||
|
|||||||
44
control.lua
44
control.lua
@@ -18,36 +18,38 @@ Debug = require 'overrides.debug' -- Global Debug module
|
|||||||
_C = require 'expcore.common' -- _C is used to store lots of common functions expected to be used
|
_C = require '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
|
-- Please go to config/file_loader.lua to edit the files that are loaded
|
||||||
log('[INFO] Getting file loader config')
|
log('[INFO] Reading loader config')
|
||||||
local files = require 'config._file_loader' --- @dep config._file_loader
|
local files = require 'config._file_loader'
|
||||||
|
|
||||||
|
-- Error handler for loading files
|
||||||
|
local errors = {}
|
||||||
|
local error_count = 0
|
||||||
|
local error_format = '[ERROR] %s :: %s'
|
||||||
|
local currently_loading = nil
|
||||||
|
local function error_handler(err)
|
||||||
|
error_count = error_count + 1
|
||||||
|
if err:find('module '..currently_loading..' not found;', nil, true) then
|
||||||
|
log('[ERROR] File not found: '..currently_loading)
|
||||||
|
errors[error_count] = error_format:format(currently_loading, err)
|
||||||
|
else
|
||||||
|
log('[ERROR] Failed to load: '..currently_loading)
|
||||||
|
errors[error_count] = debug.traceback(error_format:format(currently_loading, err))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Loads all files from the config and logs that they are loaded
|
-- Loads all files from the config and logs that they are loaded
|
||||||
local total_file_count = string.format('%3d', #files)
|
local total_file_count = string.format('%3d', #files)
|
||||||
local errors = {}
|
|
||||||
for index, path in pairs(files) do
|
for index, path in pairs(files) do
|
||||||
|
currently_loading = path
|
||||||
-- Loads the next file in the list
|
|
||||||
log(string.format('[INFO] Loading file %3d/%s (%s)', index, total_file_count, path))
|
log(string.format('[INFO] Loading file %3d/%s (%s)', index, total_file_count, path))
|
||||||
local success, file = pcall(require, path)
|
xpcall(require, error_handler, path)
|
||||||
|
|
||||||
-- Error Checking
|
|
||||||
if not success then
|
|
||||||
-- Failed to load a file
|
|
||||||
log('[ERROR] Failed to load file: '..path)
|
|
||||||
table.insert(errors, '[ERROR] '..path..' :: '..file)
|
|
||||||
elseif type(file) == 'string' and file:find('not found') then
|
|
||||||
-- Returned a file not found message
|
|
||||||
log('[ERROR] File not found: '..path)
|
|
||||||
table.insert(errors, '[ERROR] '..path..' :: Not Found')
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Override the default require; require can no longer load new scripts
|
-- Override the default require; require can no longer load new scripts
|
||||||
log('[INFO] Require Overright! No more requires can be made!')
|
log('[INFO] Require Overwrite! No more requires can be made!')
|
||||||
require 'overrides.require'
|
require 'overrides.require'
|
||||||
|
|
||||||
-- Logs all errors again to make it make it easy to find
|
-- Logs all errors again to make it make it easy to find
|
||||||
log('[INFO] All files loaded with '..#errors..' errors:')
|
log('[INFO] All files loaded with '..error_count..' errors:')
|
||||||
for _, error in pairs(errors) do log(error) end
|
for _, error in ipairs(errors) do log(error) end
|
||||||
log('[END] -----| Explosive Gaming Scenario Loader |-----')
|
log('[END] -----| Explosive Gaming Scenario Loader |-----')
|
||||||
@@ -142,15 +142,15 @@ end
|
|||||||
@tparam boolean state the state that you want to set it to, true = allow, false = disallow
|
@tparam boolean state the state that you want to set it to, true = allow, false = disallow
|
||||||
@treturn Permissions_Groups._prototype returns self so function can be chained
|
@treturn Permissions_Groups._prototype returns self so function can be chained
|
||||||
|
|
||||||
@usage-- Set an action to be disalowed
|
@usage-- Set an action to be disallowed
|
||||||
group:set_action('toggle_map_editor', false)
|
group:set_action('toggle_map_editor', false)
|
||||||
|
|
||||||
]]
|
]]
|
||||||
function Permissions_Groups._prototype:set_action(action, state)
|
function Permissions_Groups._prototype:set_action(action, state)
|
||||||
if type(action) == 'string' then
|
local input_action = defines.input_action[action]
|
||||||
action = defines.input_action[action]
|
if input_action == nil then input_action = action end
|
||||||
end
|
assert(type(input_action) == 'number', tostring(action)..' is not a valid input action')
|
||||||
self.actions[action] = state
|
self.actions[input_action] = state
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ player-damage=__1__
|
|||||||
[links]
|
[links]
|
||||||
discord=https://discord.explosivegaming.nl
|
discord=https://discord.explosivegaming.nl
|
||||||
website=https://www.explosivegaming.nl
|
website=https://www.explosivegaming.nl
|
||||||
wiki=https://wiki.explosivegaming.nl/
|
|
||||||
status=https://status.explosivegaming.nl
|
status=https://status.explosivegaming.nl
|
||||||
github=https://github.com/explosivegaming/scenario
|
github=https://github.com/explosivegaming/scenario
|
||||||
patreon=https://www.patreon.com/ExpGaming
|
patreon=https://www.patreon.com/ExpGaming
|
||||||
@@ -19,7 +18,6 @@ players-online=There are __1__ players online
|
|||||||
total-map-time=This map has been on for __1__
|
total-map-time=This map has been on for __1__
|
||||||
discord=Join us on our discord at: https://discord.explosivegaming.nl
|
discord=Join us on our discord at: https://discord.explosivegaming.nl
|
||||||
website=Please visit our website at: https://www.explosivegaming.nl
|
website=Please visit our website at: https://www.explosivegaming.nl
|
||||||
wiki=You can get more information about us and the custom scenario from our wiki: https://wiki.explosivegaming.nl/
|
|
||||||
status=Want to check if out servers are down? Visit: https://status.explosivegaming.nl
|
status=Want to check if out servers are down? Visit: https://status.explosivegaming.nl
|
||||||
github=Want to help improve our server with some extra features? Help us at: https://github.com/explosivegaming/scenario
|
github=Want to help improve our server with some extra features? Help us at: https://github.com/explosivegaming/scenario
|
||||||
patreon=Consider supporting our server at: https://www.patreon.com/ExpGaming
|
patreon=Consider supporting our server at: https://www.patreon.com/ExpGaming
|
||||||
@@ -81,4 +79,7 @@ verify=Please return to our discord and type r!verify __1__
|
|||||||
message=All players were kicked because everyone was AFK.
|
message=All players were kicked because everyone was AFK.
|
||||||
|
|
||||||
[report-jail]
|
[report-jail]
|
||||||
jail=__1__ was jailed because they were reported too many times.
|
jail=__1__ was jailed because they were reported too many times. Please wait for a moderator.
|
||||||
|
|
||||||
|
[protection-jail]
|
||||||
|
jail=__1__ was jailed because they removed too many protected entities. Please wait for a moderator.
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ set=Your bonus has been set to __1__.
|
|||||||
wip=This command is temporary and will be replaced at some point in the future.
|
wip=This command is temporary and will be replaced at some point in the future.
|
||||||
|
|
||||||
[expcom-ratio]
|
[expcom-ratio]
|
||||||
notSelecting=Please select an entetiy with a recpie.
|
notSelecting=Please select an entity with a recipe.
|
||||||
item-in=You need __1__ per second of [item=__2__].
|
item-in=You need __1__ per second of [item=__2__].
|
||||||
fluid-in=You need __1__ per second of [fluid=__2__].
|
fluid-in=You need __1__ per second of [fluid=__2__].
|
||||||
item-out=This will result in: __1__ [item=__2__] per second.
|
item-out=This will result in: __1__ [item=__2__] per second.
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ Event.on_nth_tick(config.update_time, function()
|
|||||||
-- Check for active players
|
-- Check for active players
|
||||||
for _, player in ipairs(game.connected_players) do
|
for _, player in ipairs(game.connected_players) do
|
||||||
if player.afk_time < config.afk_time
|
if player.afk_time < config.afk_time
|
||||||
or config.admin_as_active and config.player.admin
|
or config.admin_as_active and player.admin
|
||||||
or config.trust_as_active and player.online_time > config.trust_time
|
or config.trust_as_active and player.online_time > config.trust_time
|
||||||
or config.active_role and Roles.player_has_role(player, config.active_role) then
|
or config.active_role and Roles.player_has_role(player, config.active_role) then
|
||||||
-- Active player was found
|
-- Active player was found
|
||||||
|
|||||||
@@ -6,6 +6,14 @@ local Colors = require 'utils.color_presets' --- @dep utils.color_presets
|
|||||||
local write_json, format_time = _C.write_json, _C.format_time --- @dep expcore.common
|
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 'config.discord_alerts' --- @dep config.discord_alerts
|
||||||
|
|
||||||
|
local playtime_format = { short = true, hours = true, minutes = true, string = true }
|
||||||
|
local function append_playtime(player_name)
|
||||||
|
if not config.show_playtime then return player_name end
|
||||||
|
local player = game.get_player(player_name)
|
||||||
|
if not player then return player_name end
|
||||||
|
return player.name..' ('..format_time(player.online_time, playtime_format)..')'
|
||||||
|
end
|
||||||
|
|
||||||
local function get_player_name(event)
|
local function get_player_name(event)
|
||||||
local player = game.players[event.player_index]
|
local player = game.players[event.player_index]
|
||||||
return player.name, event.by_player_name
|
return player.name, event.by_player_name
|
||||||
@@ -85,7 +93,7 @@ if config.entity_protection then
|
|||||||
title='Entity Protection',
|
title='Entity Protection',
|
||||||
description='A player removed protected entities',
|
description='A player removed protected entities',
|
||||||
color=Colors.yellow,
|
color=Colors.yellow,
|
||||||
['Player']='<inline>'..player_name,
|
['Player']='<inline>'..append_playtime(player_name),
|
||||||
['Entity']='<inline>'..event.entity.name
|
['Entity']='<inline>'..event.entity.name
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
@@ -100,8 +108,8 @@ if config.player_reports then
|
|||||||
title='Report',
|
title='Report',
|
||||||
description='A player was reported',
|
description='A player was reported',
|
||||||
color=Colors.yellow,
|
color=Colors.yellow,
|
||||||
['Player']='<inline>'..player_name,
|
['Player']='<inline>'..append_playtime(player_name),
|
||||||
['By']='<inline>'..by_player_name,
|
['By']='<inline>'..append_playtime(by_player_name),
|
||||||
['Report Count']='<inline>'..Reports.count_reports(player_name),
|
['Report Count']='<inline>'..Reports.count_reports(player_name),
|
||||||
['Reason']=event.reason
|
['Reason']=event.reason
|
||||||
}
|
}
|
||||||
|
|||||||
37
modules/addons/protection-jail.lua
Normal file
37
modules/addons/protection-jail.lua
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
--- 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 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)
|
||||||
|
repeat_count = tbl
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- When a protection is triggered increment their counter and jail if needed
|
||||||
|
Event.add(Protection.events.on_repeat_violation, function(event)
|
||||||
|
local player = game.get_player(event.player_index)
|
||||||
|
|
||||||
|
-- Increment the counter
|
||||||
|
if repeat_count[player.index] then
|
||||||
|
repeat_count[player.index] = repeat_count[player.index] + 1
|
||||||
|
else
|
||||||
|
repeat_count[player.index] = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Jail if needed
|
||||||
|
if repeat_count[player.index] < 3 then return end
|
||||||
|
local player_name_color = format_chat_player_name(player)
|
||||||
|
Jail.jail_player(player, '<protection>', 'Removed too many protected entities, please wait for a moderator.')
|
||||||
|
game.print{'protection-jail.jail', player_name_color}
|
||||||
|
end)
|
||||||
|
|
||||||
|
--- Clear the counter when they leave the game (stops a build up of data)
|
||||||
|
Event.add(defines.events.on_player_left_game, function(event)
|
||||||
|
repeat_count[event.player_index] = nil
|
||||||
|
end)
|
||||||
@@ -55,7 +55,7 @@ local function sort_players(players, func)
|
|||||||
for index, player in ipairs(players) do
|
for index, player in ipairs(players) do
|
||||||
local value = func(player)
|
local value = func(player)
|
||||||
-- Check if the item will make the top 5 elements
|
-- Check if the item will make the top 5 elements
|
||||||
if value > threshold or index <= 5 then
|
if index <= 5 or value > threshold then
|
||||||
local inserted = false
|
local inserted = false
|
||||||
values[player] = value
|
values[player] = value
|
||||||
-- Find where in the top 5 to insert the element
|
-- Find where in the top 5 to insert the element
|
||||||
|
|||||||
@@ -91,6 +91,13 @@ function Jail.jail_player(player, by_player_name, reason)
|
|||||||
local roles = get_roles(player)
|
local roles = get_roles(player)
|
||||||
old_roles[player.name] = roles
|
old_roles[player.name] = roles
|
||||||
|
|
||||||
|
player.walking_state = { walking = false }
|
||||||
|
player.riding_state = { acceleration = defines.riding.acceleration.nothing, direction = player.riding_state.direction }
|
||||||
|
player.mining_state = { mining = false }
|
||||||
|
player.shooting_state = { state = defines.shooting.not_shooting }
|
||||||
|
player.picking_state = false
|
||||||
|
player.repair_state = { repairing = false }
|
||||||
|
|
||||||
assign_roles(player, 'Jail', by_player_name, nil, true)
|
assign_roles(player, 'Jail', by_player_name, nil, true)
|
||||||
unassign_roles(player, roles, by_player_name, nil, true)
|
unassign_roles(player, roles, by_player_name, nil, true)
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ Event.add(defines.events.on_pre_player_mined_item, function(event)
|
|||||||
local player = game.get_player(event.player_index)
|
local player = game.get_player(event.player_index)
|
||||||
-- Check if the player should be ignored
|
-- Check if the player should be ignored
|
||||||
if config.ignore_admins and player.admin then return end
|
if config.ignore_admins and player.admin then return end
|
||||||
if entity.last_user.index == player.index then return end
|
if entity.last_user == nil or entity.last_user.index == player.index then return end
|
||||||
if config.ignore_permission and Roles.player_allowed(player, config.ignore_permission) then return end
|
if config.ignore_permission and Roles.player_allowed(player, config.ignore_permission) then return end
|
||||||
|
|
||||||
-- Check if the entity is protected
|
-- Check if the entity is protected
|
||||||
|
|||||||
@@ -35,9 +35,11 @@ function Public.start_spectate(player)
|
|||||||
assert(player and player.valid, 'Invalid player given to follower')
|
assert(player and player.valid, 'Invalid player given to follower')
|
||||||
if spectating[player.index] or not player.character then return false end
|
if spectating[player.index] or not player.character then return false end
|
||||||
local character = player.character
|
local character = player.character
|
||||||
|
local opened = player.opened
|
||||||
player.set_controller{ type = defines.controllers.spectator }
|
player.set_controller{ type = defines.controllers.spectator }
|
||||||
player.associate_character(character)
|
player.associate_character(character)
|
||||||
spectating[player.index] = character
|
spectating[player.index] = character
|
||||||
|
if opened then player.opened = opened end -- Maintain opened after controller change
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ PlayerBonus:set_metadata{
|
|||||||
--- Apply a bonus amount to a player
|
--- Apply a bonus amount to a player
|
||||||
local function apply_bonus(player, amount)
|
local function apply_bonus(player, amount)
|
||||||
if not amount then return end
|
if not amount then return end
|
||||||
|
if not player.character then return end
|
||||||
for bonus, min_max in pairs(config) do
|
for bonus, min_max in pairs(config) do
|
||||||
local increase = min_max[2]*amount
|
local increase = min_max[2]*amount
|
||||||
player[bonus] = min_max[1]+increase
|
player[bonus] = min_max[1]+increase
|
||||||
|
|||||||
@@ -85,6 +85,11 @@ end)
|
|||||||
element.sprite = 'utility/confirm_slot'
|
element.sprite = 'utility/confirm_slot'
|
||||||
element.style = 'shortcut_bar_button_green'
|
element.style = 'shortcut_bar_button_green'
|
||||||
end
|
end
|
||||||
|
-- Correct the button size
|
||||||
|
local style = element.style
|
||||||
|
style.padding = -2
|
||||||
|
style.height = 22
|
||||||
|
style.width = 22
|
||||||
end)
|
end)
|
||||||
|
|
||||||
--- Draw a section header and main scroll
|
--- Draw a section header and main scroll
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ local task_list =
|
|||||||
}
|
}
|
||||||
scroll_pane.style.horizontally_stretchable = true
|
scroll_pane.style.horizontally_stretchable = true
|
||||||
scroll_pane.style.padding = 0
|
scroll_pane.style.padding = 0
|
||||||
scroll_pane.style.maximal_height = 280
|
scroll_pane.style.maximal_height = 224
|
||||||
|
|
||||||
local flow =
|
local flow =
|
||||||
scroll_pane.add {
|
scroll_pane.add {
|
||||||
@@ -572,12 +572,6 @@ local update_task = function(player, task_list_element, task_id)
|
|||||||
element[task_list_item.name].tooltip = {"task-list.last-edit", last_edit_name, format_time(last_edit_time)}
|
element[task_list_item.name].tooltip = {"task-list.last-edit", last_edit_name, format_time(last_edit_time)}
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Button on the top flow used to toggle the task list container
|
|
||||||
-- @element toggle_task_list
|
|
||||||
Gui.left_toolbar_button('utility/not_enough_repair_packs_icon', {'task-list.main-tooltip'}, task_list_container, function(player)
|
|
||||||
return Roles.player_allowed(player, 'gui/task-list')
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Update the footer task edit view
|
-- Update the footer task edit view
|
||||||
local update_task_edit_footer = function(player, task_id)
|
local update_task_edit_footer = function(player, task_id)
|
||||||
local task = Tasks.get_task(task_id)
|
local task = Tasks.get_task(task_id)
|
||||||
|
|||||||
@@ -616,6 +616,7 @@ local function update_all_warp_force(force)
|
|||||||
local frame = Gui.get_left_element(player, warp_list_container)
|
local frame = Gui.get_left_element(player, warp_list_container)
|
||||||
local warp_table = frame.container.scroll.table
|
local warp_table = frame.container.scroll.table
|
||||||
|
|
||||||
|
warp_table.clear() -- Needed to re-sort the warps
|
||||||
for _, warp_id in ipairs(warp_ids) do
|
for _, warp_id in ipairs(warp_ids) do
|
||||||
update_warp(player, warp_table, warp_id)
|
update_warp(player, warp_table, warp_id)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
return {
|
return {
|
||||||
expgaming_lua = '6.0.0',
|
expgaming_lua = '6.2.0',
|
||||||
expgaming_api = '2.0.0',
|
expgaming_api = '2.0.0',
|
||||||
redmew_lua = '2019-02-24-76871ee'
|
redmew_lua = '2019-02-24-76871ee'
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user