From 9f0b4cf825db016c8cffe303bdebe2c50c2f345a Mon Sep 17 00:00:00 2001 From: oof2win2 Date: Sat, 14 Aug 2021 14:06:13 +0000 Subject: [PATCH 01/11] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20GUI=20showing=20it?= =?UTF-8?q?ems=20when=20it=20shouldn't?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- expcore/gui/top_flow.lua | 3 ++- expcore/roles.lua | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/expcore/gui/top_flow.lua b/expcore/gui/top_flow.lua index e2cb38c1..6320dca5 100644 --- a/expcore/gui/top_flow.lua +++ b/expcore/gui/top_flow.lua @@ -73,7 +73,8 @@ function Gui.update_top_flow(player) end -- Set the visible state - local allowed = type(authenticator) == 'function' and authenticator(player) or authenticator + local allowed = authenticator + if type(allowed) == 'function' then allowed = allowed(player) end element.visible = is_visible and allowed or false end end diff --git a/expcore/roles.lua b/expcore/roles.lua index edcc989e..530f0a4f 100644 --- a/expcore/roles.lua +++ b/expcore/roles.lua @@ -114,6 +114,7 @@ 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 Gui = require 'expcore.gui' --- @dep expcore.gui local write_json = _C.write_json --- @dep expcore.common local Roles = { @@ -378,6 +379,7 @@ function Roles.assign_player(player, roles, by_player_name, skip_checks, silent) end if valid_player then emit_player_roles_updated(valid_player, 'assign', roles, by_player_name, silent) + Gui.update_top_flow(valid_player) end end @@ -410,6 +412,7 @@ function Roles.unassign_player(player, roles, by_player_name, skip_checks, silen end if valid_player then emit_player_roles_updated(valid_player, 'unassign', roles, by_player_name, silent) + Gui.update_top_flow(valid_player) end end From a494391680a548dd3cae8f1c76f2a7e2e6d4074e Mon Sep 17 00:00:00 2001 From: oof2win2 Date: Sat, 14 Aug 2021 14:33:47 +0000 Subject: [PATCH 02/11] :wrench: Made Gui not required for Roles --- expcore/gui/_require.lua | 13 +++++++++++++ expcore/roles.lua | 3 --- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/expcore/gui/_require.lua b/expcore/gui/_require.lua index 51fc0a14..78aac647 100644 --- a/expcore/gui/_require.lua +++ b/expcore/gui/_require.lua @@ -128,4 +128,17 @@ require 'expcore.gui.left_flow' require 'expcore.gui.helper_functions' require 'expcore.gui.defines' +local Roles = _C.opt_require('expcore.roles') +local Event = _C.opt_require('utils.event') + +if Roles and Event then + Event.add(Roles.events.on_role_assigned, function(e) + Gui.update_top_flow(game.get_player(e.player_index)) + end) + Event.add(Roles.events.on_role_unassigned, function(e) + Gui.update_top_flow(game.get_player(e.player_index)) + end) +end + + return Gui \ No newline at end of file diff --git a/expcore/roles.lua b/expcore/roles.lua index 530f0a4f..edcc989e 100644 --- a/expcore/roles.lua +++ b/expcore/roles.lua @@ -114,7 +114,6 @@ 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 Gui = require 'expcore.gui' --- @dep expcore.gui local write_json = _C.write_json --- @dep expcore.common local Roles = { @@ -379,7 +378,6 @@ function Roles.assign_player(player, roles, by_player_name, skip_checks, silent) end if valid_player then emit_player_roles_updated(valid_player, 'assign', roles, by_player_name, silent) - Gui.update_top_flow(valid_player) end end @@ -412,7 +410,6 @@ function Roles.unassign_player(player, roles, by_player_name, skip_checks, silen end if valid_player then emit_player_roles_updated(valid_player, 'unassign', roles, by_player_name, silent) - Gui.update_top_flow(valid_player) end end From 08027967b7e39b785373bce2b04fda093925a8b3 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 14 Aug 2021 17:23:22 +0100 Subject: [PATCH 03/11] Corrected link issue in readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f90ab184..51e765a1 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ All are welcome to make bug reports, feature requests, and pull requests for our For developers wanting to add features please follow these guidelines: -* All code is documented using ldoc, the end result can be found [here](docs). +* All code is documented using ldoc, the end result can be found [here](online-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. @@ -129,7 +129,7 @@ The Explosive Gaming codebase is licensed under the [GNU General Public 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/ +[online-docs]: https://explosivegaming.github.io/scenario/ [issues]: https://github.com/explosivegaming/scenario/issues/new/choose [website]: https://explosivegaming.nl [discord]: https://discord.explosivegaming.nl From c3662b5c4c4354b801a0d5b94bdbacd5d8ed96c6 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 14 Aug 2021 17:28:55 +0100 Subject: [PATCH 04/11] Revmoed endding slash for urls --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 51e765a1..2f390b9c 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ All are welcome to make bug reports, feature requests, and pull requests for our For developers wanting to add features please follow these guidelines: -* All code is documented using ldoc, the end result can be found [here](online-docs). +* 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. @@ -128,8 +128,8 @@ The Explosive Gaming codebase is licensed under the [GNU General Public 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/ -[online-docs]: https://explosivegaming.github.io/scenario/ +[factorio]: https://factorio.com +[docs]: https://explosivegaming.github.io/scenario [issues]: https://github.com/explosivegaming/scenario/issues/new/choose [website]: https://explosivegaming.nl [discord]: https://discord.explosivegaming.nl From 96f8b177e0e340f26dd372bc70834aa6348786e7 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 14 Aug 2021 17:40:02 +0100 Subject: [PATCH 05/11] Fixed reference style linking --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2f390b9c..d314341b 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,11 @@ ## Explosive Gaming -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. +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 -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. +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 into your Factorio scenario directory: * Windows: `%appdata%\Factorio\scenarios` @@ -40,7 +40,7 @@ Explosive Gaming (often ExpGaming) is a server hosting community with a strong f 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) 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). +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]. ## Contributing @@ -48,7 +48,7 @@ All are welcome to make bug reports, feature requests, and pull requests for our For developers wanting to add features please follow these guidelines: -* All code is documented using ldoc, the end result can be found [here](docs). +* 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. @@ -79,7 +79,7 @@ For developers wanting to add features please follow these guidelines: | [1.0][s1.0] | Modulation | [0.15][f0.15] | | [0.1][s0.1] | First Tracked Version | [0.14][f0.14] | -\* Scenario patch releases have been omitted and can be found [here](https://github.com/explosivegaming/scenario/releases). +\* Scenario patch releases have been omitted and can be found [here][releases]. \*\* Factorio versions show the version they were made for, often the minimum requirement to run the scenario. @@ -128,6 +128,7 @@ The Explosive Gaming codebase is licensed under the [GNU General Public License [stable-dl]: https://github.com/explosivegaming/scenario/archive/master.zip [experimental-dl]: https://github.com/explosivegaming/scenario/archive/dev.zip +[releases]: https://github.com/explosivegaming/scenario/releases [factorio]: https://factorio.com [docs]: https://explosivegaming.github.io/scenario [issues]: https://github.com/explosivegaming/scenario/issues/new/choose From f3ce3eb80bb9e00cc204e754134acad08514c8f7 Mon Sep 17 00:00:00 2001 From: oof2win2 Date: Sat, 14 Aug 2021 14:06:13 +0000 Subject: [PATCH 06/11] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20GUI=20showing=20it?= =?UTF-8?q?ems=20when=20it=20shouldn't?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- expcore/gui/top_flow.lua | 3 ++- expcore/roles.lua | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/expcore/gui/top_flow.lua b/expcore/gui/top_flow.lua index 39bfb99f..064ee906 100644 --- a/expcore/gui/top_flow.lua +++ b/expcore/gui/top_flow.lua @@ -73,7 +73,8 @@ function Gui.update_top_flow(player) end -- Set the visible state - local allowed = type(authenticator) == 'function' and authenticator(player) or authenticator + local allowed = authenticator + if type(allowed) == 'function' then allowed = allowed(player) end element.visible = is_visible and allowed or false end end diff --git a/expcore/roles.lua b/expcore/roles.lua index 2028cd23..ad14ac09 100644 --- a/expcore/roles.lua +++ b/expcore/roles.lua @@ -114,6 +114,7 @@ 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 Gui = require 'expcore.gui' --- @dep expcore.gui local write_json = _C.write_json --- @dep expcore.common local Roles = { @@ -378,6 +379,7 @@ function Roles.assign_player(player, roles, by_player_name, skip_checks, silent) end if valid_player then emit_player_roles_updated(valid_player, 'assign', roles, by_player_name, silent) + Gui.update_top_flow(valid_player) end end @@ -410,6 +412,7 @@ function Roles.unassign_player(player, roles, by_player_name, skip_checks, silen end if valid_player then emit_player_roles_updated(valid_player, 'unassign', roles, by_player_name, silent) + Gui.update_top_flow(valid_player) end end From 15c3ced9dddac7533769d4154467e45499219c7c Mon Sep 17 00:00:00 2001 From: oof2win2 Date: Sat, 14 Aug 2021 14:33:47 +0000 Subject: [PATCH 07/11] :wrench: Made Gui not required for Roles --- expcore/gui/_require.lua | 13 +++++++++++++ expcore/roles.lua | 3 --- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/expcore/gui/_require.lua b/expcore/gui/_require.lua index 51fc0a14..78aac647 100644 --- a/expcore/gui/_require.lua +++ b/expcore/gui/_require.lua @@ -128,4 +128,17 @@ require 'expcore.gui.left_flow' require 'expcore.gui.helper_functions' require 'expcore.gui.defines' +local Roles = _C.opt_require('expcore.roles') +local Event = _C.opt_require('utils.event') + +if Roles and Event then + Event.add(Roles.events.on_role_assigned, function(e) + Gui.update_top_flow(game.get_player(e.player_index)) + end) + Event.add(Roles.events.on_role_unassigned, function(e) + Gui.update_top_flow(game.get_player(e.player_index)) + end) +end + + return Gui \ No newline at end of file diff --git a/expcore/roles.lua b/expcore/roles.lua index ad14ac09..2028cd23 100644 --- a/expcore/roles.lua +++ b/expcore/roles.lua @@ -114,7 +114,6 @@ 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 Gui = require 'expcore.gui' --- @dep expcore.gui local write_json = _C.write_json --- @dep expcore.common local Roles = { @@ -379,7 +378,6 @@ function Roles.assign_player(player, roles, by_player_name, skip_checks, silent) end if valid_player then emit_player_roles_updated(valid_player, 'assign', roles, by_player_name, silent) - Gui.update_top_flow(valid_player) end end @@ -412,7 +410,6 @@ function Roles.unassign_player(player, roles, by_player_name, skip_checks, silen end if valid_player then emit_player_roles_updated(valid_player, 'unassign', roles, by_player_name, silent) - Gui.update_top_flow(valid_player) end end From b06ada8761dbc6d1fbf7b728b9e8e3ede36f30da Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 14 Aug 2021 17:23:22 +0100 Subject: [PATCH 08/11] Corrected link issue in readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f90ab184..51e765a1 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ All are welcome to make bug reports, feature requests, and pull requests for our For developers wanting to add features please follow these guidelines: -* All code is documented using ldoc, the end result can be found [here](docs). +* All code is documented using ldoc, the end result can be found [here](online-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. @@ -129,7 +129,7 @@ The Explosive Gaming codebase is licensed under the [GNU General Public 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/ +[online-docs]: https://explosivegaming.github.io/scenario/ [issues]: https://github.com/explosivegaming/scenario/issues/new/choose [website]: https://explosivegaming.nl [discord]: https://discord.explosivegaming.nl From a94a753d714390f22001b9c8a3ab6c514eb5757c Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 14 Aug 2021 17:28:55 +0100 Subject: [PATCH 09/11] Revmoed endding slash for urls --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 51e765a1..2f390b9c 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ All are welcome to make bug reports, feature requests, and pull requests for our For developers wanting to add features please follow these guidelines: -* All code is documented using ldoc, the end result can be found [here](online-docs). +* 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. @@ -128,8 +128,8 @@ The Explosive Gaming codebase is licensed under the [GNU General Public 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/ -[online-docs]: https://explosivegaming.github.io/scenario/ +[factorio]: https://factorio.com +[docs]: https://explosivegaming.github.io/scenario [issues]: https://github.com/explosivegaming/scenario/issues/new/choose [website]: https://explosivegaming.nl [discord]: https://discord.explosivegaming.nl From 2edfa56ee1374c011500884fb5153c8d8e3d3e30 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 14 Aug 2021 17:40:02 +0100 Subject: [PATCH 10/11] Fixed reference style linking --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2f390b9c..d314341b 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,11 @@ ## Explosive Gaming -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. +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 -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. +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 into your Factorio scenario directory: * Windows: `%appdata%\Factorio\scenarios` @@ -40,7 +40,7 @@ Explosive Gaming (often ExpGaming) is a server hosting community with a strong f 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) 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). +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]. ## Contributing @@ -48,7 +48,7 @@ All are welcome to make bug reports, feature requests, and pull requests for our For developers wanting to add features please follow these guidelines: -* All code is documented using ldoc, the end result can be found [here](docs). +* 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. @@ -79,7 +79,7 @@ For developers wanting to add features please follow these guidelines: | [1.0][s1.0] | Modulation | [0.15][f0.15] | | [0.1][s0.1] | First Tracked Version | [0.14][f0.14] | -\* Scenario patch releases have been omitted and can be found [here](https://github.com/explosivegaming/scenario/releases). +\* Scenario patch releases have been omitted and can be found [here][releases]. \*\* Factorio versions show the version they were made for, often the minimum requirement to run the scenario. @@ -128,6 +128,7 @@ The Explosive Gaming codebase is licensed under the [GNU General Public License [stable-dl]: https://github.com/explosivegaming/scenario/archive/master.zip [experimental-dl]: https://github.com/explosivegaming/scenario/archive/dev.zip +[releases]: https://github.com/explosivegaming/scenario/releases [factorio]: https://factorio.com [docs]: https://explosivegaming.github.io/scenario [issues]: https://github.com/explosivegaming/scenario/issues/new/choose From 6d07a3d09780826e2ff65676083b6d4e1a1b38e9 Mon Sep 17 00:00:00 2001 From: Windsinger Date: Sun, 23 Oct 2022 19:20:51 +0200 Subject: [PATCH 11/11] Update reports.lua As discussed on discord --- modules/control/reports.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/control/reports.lua b/modules/control/reports.lua index 62d3bea7..d7004316 100644 --- a/modules/control/reports.lua +++ b/modules/control/reports.lua @@ -132,7 +132,7 @@ function Reports.report_player(player, by_player_name, reason) if not player then return end local player_name = player.name - if reason == nil or not reason:find("/S") then reason = 'No reason given' end + if reason == nil or not reason:find("%S") then reason = 'No reason given' end local reports = user_reports[player_name] if not reports then @@ -222,4 +222,4 @@ function Reports.remove_all(player, removed_by_name) return true end -return Reports \ No newline at end of file +return Reports