diff --git a/README.md b/README.md index c78e995b..affbc44a 100644 --- a/README.md +++ b/README.md @@ -24,13 +24,13 @@ ## 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 with in our reset schedule. Although these server tend to the more experienced players our server are open to everyone. You can find us through our [website], [discord], [wiki], or in the public games tab in factorio (ExpGaming S1). +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.). ## 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. -2) Extract the downloaded zip file from the branch you downloaded into factorio's scenario directory: +2) Extract the downloaded zip file from the branch you downloaded into Factorio's scenario directory: * Windows: `%appdata%\Factorio\scenarios` * Linux: `~/.factorio/scenarios` @@ -38,25 +38,29 @@ Explosive Gaming (often ExpGaming) is a server hosting community with a strong f 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. -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 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. -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 don't work as expected then it may be returning an error in the log, please report these errors to [the issues page](issues). +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. +Please report these errors to [the issues page](issues). ## 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]. Please keep in mind while making code changes: +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]. All our docs can be found [here][docs]. Please keep in mind while making code changes: * New features should have the branch names: `feature/feature-name` -* New features are merged into `dev` after it has been completed. -* After a number of features have been added a release branch is made: `release/X.Y.0`; this branch should have no new features and only bug fixes or localization. -* A release is merged into `master` on the following friday in time for the the weekly reset. -* Patches may be named `patch/X.Y.Z` and fill be merged into `master` and `dev` when appropriate. +* New features are merged into `dev` after it has been completed, this can be done through a pull request. +* 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 | Scenario Version* | Version Name | Factorio Version** | |---|---|---| -| [v5.7][s5.8] | Home and Chat Bot | [v0.17.47][f0.17.49] | +| [v5.10][s5.10] | Data Store Rewrite | [v0.17.71][f0.17.71] | +| [v5.9][s5.9] | Control Modules and Documentation | [v0.17.63][f0.17.63] | +| [v5.8][s5.8] | Home and Chat Bot | [v0.17.47][f0.17.49] | | [v5.7][s5.7] | Warp System | [v0.17.47][f0.17.47] | | [v5.6][s5.6] | Information Guis | [v0.17.44][f0.17.44] | | [v5.5][s5.5] | Gui System | [v0.17.43][f0.17.43] | @@ -75,6 +79,8 @@ All are welcome to make pull requests and issues for this scenario, if you are i \*\* Factorio versions show the version they were made for, often the minimum requirement. +[s5.10]: https://github.com/explosivegaming/scenario/releases/tag/5.10.0 +[s5.9]: https://github.com/explosivegaming/scenario/releases/tag/5.9.0 [s5.8]: https://github.com/explosivegaming/scenario/releases/tag/5.8.0 [s5.7]: https://github.com/explosivegaming/scenario/releases/tag/5.7.0 [s5.6]: https://github.com/explosivegaming/scenario/releases/tag/5.6.0 @@ -90,6 +96,8 @@ 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 [s0.1]: https://github.com/explosivegaming/scenario/releases/tag/v0.1 +[f0.17.71]: https://wiki.factorio.com/Version_history/0.17.0#0.17.71 +[f0.17.63]: https://wiki.factorio.com/Version_history/0.17.0#0.17.63 [f0.17.49]: https://wiki.factorio.com/Version_history/0.17.0#0.17.49 [f0.17.47]: https://wiki.factorio.com/Version_history/0.17.0#0.17.47 [f0.17.44]: https://wiki.factorio.com/Version_history/0.17.0#0.17.44 @@ -108,6 +116,7 @@ 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) +[docs]: https://explosivegaming.github.io/scenario/ [issues]: https://github.com/explosivegaming/scenario/issues/new/choose [website]: https://explosivegaming.nl [discord]: https://discord.explosivegaming.nl diff --git a/config/_file_loader.lua b/config/_file_loader.lua index f6c11fcb..e37d3a0d 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -1,7 +1,8 @@ ---- This contains a list of all files that will be loaded and the order they are loaded in --- to stop a file from loading add "--" in front of it, remove the "--" to have the file be loaded --- config files should be loaded after all modules are loaded --- core files should be required by modules and not be present in this list +--- This contains a list of all files that will be loaded and the order they are loaded in; +-- to stop a file from loading add "--" in front of it, remove the "--" to have the file be loaded; +-- config files should be loaded after all modules are loaded; +-- core files should be required by modules and not be present in this list; +-- @config File-Loader return { --'example.file_not_loaded', 'modules.factorio-control', -- base factorio free play scenario @@ -12,6 +13,7 @@ return { 'modules.commands.tag', 'modules.commands.teleport', 'modules.commands.cheat-mode', + 'modules.commands.ratio', 'modules.commands.interface', 'modules.commands.help', 'modules.commands.roles', @@ -26,6 +28,8 @@ return { 'modules.commands.bonus', 'modules.commands.home', -- QoL Addons + 'modules.addons.station-auto-name', + 'modules.addons.greetings', 'modules.addons.chat-popups', 'modules.addons.damage-popups', 'modules.addons.death-logger', diff --git a/config/action_buttons.lua b/config/action_buttons.lua index d1f6846d..2ce10565 100644 --- a/config/action_buttons.lua +++ b/config/action_buttons.lua @@ -1,20 +1,26 @@ ---- Config for the different action buttons that show on the player list --- each button has the button define(s) given along side an auth function, and optional reason callback --- if a reason callback is used then Store.set(action_name_store,player.name,'BUTTON_NAME') should be called during on_click --- buttons can be removed from the gui by commenting them out of the config at the bottom of this file --- the key used for the name of the button is the permision name used by the role system -local Gui = require 'expcore.gui' -local Roles = require 'expcore.roles' -local Store = require 'expcore.store' -local Game = require 'utils.game' -local Reports = require 'modules.addons.reports-control' -local Warnings = require 'modules.addons.warnings-control' -local Jail = require 'modules.addons.jail-control' -local Colors = require 'resources.color_presets' -local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') +--- Config for the different action buttons that show on the player list; +-- each button has the button define(s) given along side an auth function, and optional reason callback; +-- if a reason callback is used then Store.set(action_name_store,player.name,'BUTTON_NAME') should be called during on_click; +-- buttons can be removed from the gui by commenting them out of the config at the bottom of this file; +-- the key used for the name of the button is the permission name used by the role system; +-- @config Player-List -local action_player_store = 'gui.left.player-list.action-player' -local action_name_store = 'gui.left.player-list.action-name' +local Gui = require 'expcore.gui' --- @dep expcore.gui +local Roles = require 'expcore.roles' --- @dep expcore.roles +local Store = require 'expcore.store' --- @dep expcore.store +local Game = require 'utils.game' --- @dep utils.game +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 'resources.color_presets' --- @dep resources.color_presets +local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') --- @dep expcore.common + +local selected_player_store = '' +local selected_action_store = '' +local function set_store_uids(player,action) + selected_player_store = player + selected_action_store = action +end -- common style used by all action buttons local function tool_button_style(style) @@ -24,9 +30,9 @@ local function tool_button_style(style) end -- auth that will only allow when on player's of lower roles -local function auth_lower_role(player,action_player_name) +local function auth_lower_role(player,selected_player_name) local player_highest = Roles.get_player_highest_role(player) - local action_player_highest = Roles.get_player_highest_role(action_player_name) + local action_player_highest = Roles.get_player_highest_role(selected_player_name) if player_highest.index < action_player_highest.index then return true end @@ -34,10 +40,10 @@ end -- gets the action player and a coloured name for the action to be used on local function get_action_player_name(player) - local action_player_name = Store.get(action_player_store,player.name) - local action_player = Game.get_player_from_any(action_player_name) - local action_player_name_color = format_chat_player_name(action_player) - return action_player,action_player_name_color + local selected_player_name = Store.get(selected_player_store,player) + local selected_player = Game.get_player_from_any(selected_player_name) + local selected_player_color = format_chat_player_name(selected_player) + return selected_player_name, selected_player_color end -- telports one player to another @@ -50,218 +56,230 @@ local function teleport(from_player,to_player) return true end --- teleports the user to the action player +--- Teleports the user to the action player +-- @element goto_player local goto_player = Gui.new_button() :set_sprites('utility/export') :set_tooltip{'player-list.goto-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player_name = get_action_player_name(player) - local action_player = Game.get_player_from_any(action_player_name) - if not player.character or not action_player.character then + local selected_player_name = get_action_player_name(player) + local selected_player = Game.get_player_from_any(selected_player_name) + if not player.character or not selected_player.character then player.print({'expcore-commands.reject-player-alive'},Colors.orange_red) else - teleport(player,action_player) + teleport(player,selected_player) end end) --- teleports the action player to the user +--- Teleports the action player to the user +-- @element bring_player local bring_player = Gui.new_button() :set_sprites('utility/import') :set_tooltip{'player-list.bring-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player_name = get_action_player_name(player) - local action_player = Game.get_player_from_any(action_player_name) - if not player.character or not action_player.character then + local selected_player_name = get_action_player_name(player) + local selected_player = Game.get_player_from_any(selected_player_name) + if not player.character or not selected_player.character then player.print({'expcore-commands.reject-player-alive'},Colors.orange_red) else - teleport(action_player,player) + teleport(selected_player,player) end end) --- kills the action player, if there are alive +--- Kills the action player, if there are alive +-- @element kill_player local kill_player = Gui.new_button() :set_sprites('utility/too_far') :set_tooltip{'player-list.kill-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player_name = get_action_player_name(player) - local action_player = Game.get_player_from_any(action_player_name) - if action_player.character then - action_player.character.die() + local selected_player_name = get_action_player_name(player) + local selected_player = Game.get_player_from_any(selected_player_name) + if selected_player.character then + selected_player.character.die() else player.print({'expcom-kill.already-dead'},Colors.orange_red) end end) --- reports the action player, requires a reason to be given +--- Reports the action player, requires a reason to be given +-- @element report_player local report_player = Gui.new_button() :set_sprites('utility/spawn_flag') :set_tooltip{'player-list.report-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player_name = get_action_player_name(player) - if Reports.player_is_reported_by(action_player_name,player.name) then + local selected_player_name = get_action_player_name(player) + if Reports.is_reported(selected_player_name,player.name) then player.print({'expcom-report.already-reported'},Colors.orange_red) else - Store.set(action_name_store,player.name,'command/report') + Store.set(selected_action_store,player,'command/report') end end) local function report_player_callback(player,reason) - local action_player_name,action_player_name_color = get_action_player_name(player) + local selected_player_name, selected_player_color = get_action_player_name(player) local by_player_name_color = format_chat_player_name(player) - game.print{'expcom-report.non-admin',action_player_name_color,reason} - Roles.print_to_roles_higher('Trainee',{'expcom-report.admin',action_player_name_color,by_player_name_color,reason}) - Reports.report_player(action_player_name,reason,player.name) + game.print{'expcom-report.non-admin', selected_player_color,reason} + Roles.print_to_roles_higher('Trainee',{'expcom-report.admin', selected_player_color,by_player_name_color,reason}) + Reports.report_player(selected_player_name,player.name,reason) end --- gives the action player a warning, requires a reason +--- Gives the action player a warning, requires a reason +-- @element warn_player local warn_player = Gui.new_button() :set_sprites('utility/spawn_flag') :set_tooltip{'player-list.warn-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - Store.set(action_name_store,player.name,'command/give-warning') + Store.set(selected_action_store,player,'command/give-warning') end) local function warn_player_callback(player,reason) - local action_player_name,action_player_name_color = get_action_player_name(player) + local selected_player_name, selected_player_color = get_action_player_name(player) local by_player_name_color = format_chat_player_name(player) - game.print{'expcom-warnings.received',action_player_name_color,by_player_name_color,reason} - Warnings.add_warnings(action_player_name,player.name) + game.print{'expcom-warnings.received', selected_player_color,by_player_name_color,reason} + Warnings.add_warning(selected_player_name,player.name,reason) end --- jails the action player, requires a reason +--- Jails the action player, requires a reason +-- @element jail_player local jail_player = Gui.new_button() :set_sprites('utility/item_editor_icon') :set_tooltip{'player-list.jail-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player_name,action_player_name_color = get_action_player_name(player) - if Roles.player_has_role(action_player_name,'Jail') then - player.print({'expcom-jail.already-jailed',action_player_name_color},Colors.orange_red) + local selected_player_name, selected_player_color = get_action_player_name(player) + if Jail.is_jailed(selected_player_name) then + player.print({'expcom-jail.already-jailed', selected_player_color},Colors.orange_red) else - Store.set(action_name_store,player.name,'command/jail') + Store.set(selected_action_store,player,'command/jail') end end) local function jail_player_callback(player,reason) - local action_player_name,action_player_name_color = get_action_player_name(player) + local selected_player_name, selected_player_color = get_action_player_name(player) local by_player_name_color = format_chat_player_name(player) - game.print{'expcom-jail.give',action_player_name_color,by_player_name_color,reason} - Jail.jail_player(action_player_name,player.name) + game.print{'expcom-jail.give', selected_player_color,by_player_name_color,reason} + Jail.jail_player(selected_player_name,player.name,reason) end --- temp bans the action player, requires a reason +--- Temp bans the action player, requires a reason +-- @element temp_ban_player local temp_ban_player = Gui.new_button() :set_sprites('utility/clock') :set_tooltip{'player-list.temp-ban-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player_name,action_player_name_color = get_action_player_name(player) - if Roles.player_has_role(action_player_name,'Jail') then - player.print({'expcom-jail.already-banned',action_player_name_color},Colors.orange_red) + local selected_player_name, selected_player_color = get_action_player_name(player) + if Jail.is_jailed(selected_player_name) then + player.print({'expcom-jail.already-banned', selected_player_color},Colors.orange_red) else - Store.set(action_name_store,player.name,'command/temp-ban') + Store.set(selected_action_store,player,'command/temp-ban') end end) local function temp_ban_player_callback(player,reason) - local action_player,action_player_name_color = get_action_player_name(player) + local selected_player, selected_player_color = get_action_player_name(player) local by_player_name_color = format_chat_player_name(player) - game.print{'expcom-jail.temp-ban',action_player_name_color,by_player_name_color,reason} - Jail.temp_ban_player(action_player,player.name,reason) + game.print{'expcom-jail.temp-ban', selected_player_color,by_player_name_color,reason} + Jail.temp_ban_player(selected_player,player.name,reason) end --- kicks the action player, requires a reason +--- Kicks the action player, requires a reason +-- @element kick_player local kick_player = Gui.new_button() :set_sprites('utility/warning_icon') :set_tooltip{'player-list.kick-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - Store.set(action_name_store,player.name,'command/kick') + Store.set(selected_action_store,player,'command/kick') end) local function kick_player_callback(player,reason) - local action_player = get_action_player_name(player) - game.kick_player(action_player,reason) + local selected_player = get_action_player_name(player) + game.kick_player(selected_player,reason) end --- bans the action player, requires a reason +--- Bans the action player, requires a reason +-- @element ban_player local ban_player = Gui.new_button() :set_sprites('utility/danger_icon') :set_tooltip{'player-list.ban-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - Store.set(action_name_store,player.name,'command/ban') + Store.set(selected_action_store,player,'command/ban') end) local function ban_player_callback(player,reason) - local action_player = get_action_player_name(player) - game.ban_player(action_player,reason) + local selected_player = get_action_player_name(player) + game.ban_player(selected_player,reason) end return { - ['command/teleport'] = { - auth=function(player,action_player) - return player.name ~= action_player.name - end, -- cant teleport to your self - goto_player, - bring_player - }, - ['command/kill'] = { - auth=function(player,action_player) - if player.name == action_player.name then - return true - elseif Roles.player_allowed(player,'command/kill/always') then - return auth_lower_role(player,action_player) - end - end, -- player must be lower role, or your self - kill_player - }, - ['command/report'] = { - auth=function(player,action_player) - if not Roles.player_allowed(player,'command/give-warning') then - return not Roles.player_has_flag(action_player,'report-immune') - end - end, -- can report any player that isnt immune and you arnt able to give warnings - reason_callback=report_player_callback, - report_player - }, - ['command/give-warning'] = { - auth=auth_lower_role, -- warn a lower user, replaces report - reason_callback=warn_player_callback, - warn_player - }, - ['command/jail'] = { - auth=auth_lower_role, - reason_callback=jail_player_callback, - jail_player - }, - ['command/temp-ban'] = { - auth=auth_lower_role, - reason_callback=temp_ban_player_callback, - temp_ban_player - }, - ['command/kick'] = { - auth=auth_lower_role, - reason_callback=kick_player_callback, - kick_player - }, - ['command/ban'] = { - auth=auth_lower_role, - reason_callback=ban_player_callback, - ban_player + set_store_uids = set_store_uids, + buttons = { + ['command/teleport'] = { + auth=function(player,selected_player) + return player.name ~= selected_player.name + end, -- cant teleport to your self + goto_player, + bring_player + }, + ['command/kill'] = { + auth=function(player,selected_player) + if player.name == selected_player.name then + return true + elseif Roles.player_allowed(player,'command/kill/always') then + return auth_lower_role(player,selected_player) + end + end, -- player must be lower role, or your self + kill_player + }, + ['command/report'] = { + auth=function(player,selected_player) + if not Roles.player_allowed(player,'command/give-warning') then + return not Roles.player_has_flag(selected_player,'report-immune') + end + end, -- can report any player that isn't immune and you aren't able to give warnings + reason_callback=report_player_callback, + report_player + }, + ['command/give-warning'] = { + auth=auth_lower_role, -- warn a lower user, replaces report + reason_callback=warn_player_callback, + warn_player + }, + ['command/jail'] = { + auth=auth_lower_role, + reason_callback=jail_player_callback, + jail_player + }, + ['command/temp-ban'] = { + auth=auth_lower_role, + reason_callback=temp_ban_player_callback, + temp_ban_player + }, + ['command/kick'] = { + auth=auth_lower_role, + reason_callback=kick_player_callback, + kick_player + }, + ['command/ban'] = { + auth=auth_lower_role, + reason_callback=ban_player_callback, + ban_player + } } } \ No newline at end of file diff --git a/config/advanced_start.lua b/config/advanced_start.lua index 586530ad..c5b56854 100644 --- a/config/advanced_start.lua +++ b/config/advanced_start.lua @@ -1,4 +1,5 @@ --- This file is used to setup the map starting settings and the items players will start with +-- @config Advanced-Start --- These are called factories because they return another function -- use these as a simple methods of adding new items @@ -61,14 +62,14 @@ end ]] return { - skip_intro=true, -- skips the intro given in the default factorio free play scenario - skip_victory=true, -- will skip the victory screen when a rocket is launched - disable_base_game_silo_script=true, -- will not load the silo script at all - research_queue_from_start=true, -- when true the research queue is useible from the start - friendly_fire=false, -- weather players will be able to attack each other on the same force - enemy_expansion=false, -- a catch all for in case the map settings file fails to load - chart_radius=10*32, -- the number of tiles that will be charted when the map starts - items = { -- items and there condition for being given + skip_intro=true, --- @setting skip_intro skips the intro given in the default factorio free play scenario + skip_victory=true, --- @setting skip_victory will skip the victory screen when a rocket is launched + disable_base_game_silo_script=true, --- @setting disable_base_game_silo_script will not load the silo script at all + research_queue_from_start=true, --- @setting research_queue_from_start when true the research queue is useible from the start + friendly_fire=false, --- @setting friendly_fire weather players will be able to attack each other on the same force + enemy_expansion=false, --- @setting enemy_expansion a catch all for in case the map settings file fails to load + chart_radius=10*32, --- @setting chart_radius the number of tiles that will be charted when the map starts + items = { --- @setting items items and there condition for being given -- ['item-name'] = function(amount_made,production_stats,player) return end -- 0 means no items given -- Plates ['iron-plate']=scale_amount_made(100,10,10), @@ -78,8 +79,8 @@ return { ['electronic-circuit']=scale_amount_made(1000,0,6), ['iron-gear-wheel']=scale_amount_made(1000,0,6), -- Starting Items - ['burner-mining-drill']=cutoff_time(5*minutes,4,0), - ['stone-furnace']=cutoff_time(5*minutes,4,0), + ['burner-mining-drill']=cutoff_time(10*minutes,4,0), + ['stone-furnace']=cutoff_time(10*minutes,4,0), -- Armor ['light-armor']=cutoff_amount_made_unless(5,0,1,'heavy-armor',5), ['heavy-armor']=cutoff_amount_made(5,0,1), @@ -90,4 +91,4 @@ return { ['firearm-magazine']=cutoff_amount_made_unless(100,10,0,'piercing-rounds-magazine',100), ['piercing-rounds-magazine']=cutoff_amount_made(100,0,10), } -} \ No newline at end of file +} diff --git a/config/bonuses.lua b/config/bonuses.lua index d74ddfbf..b96b48a2 100644 --- a/config/bonuses.lua +++ b/config/bonuses.lua @@ -1,4 +1,6 @@ --- Lists all bonuses which can be used, name followed by min max +-- @config Bonuses + return { character_mining_speed_modifier={0,3}, character_crafting_speed_modifier={0,3}, diff --git a/config/chat_reply.lua b/config/chat_reply.lua index aff00871..81cf57c5 100644 --- a/config/chat_reply.lua +++ b/config/chat_reply.lua @@ -1,8 +1,16 @@ --- This file defines the different triggers for the chat bot -local format_time = ext_require('expcore.common','format_time') +-- @config Chat-Reply + +local Async = require 'expcore.async' +local format_time = ext_require('expcore.common','format_time') --- @dep expcore.common + +local async_message = Async.register(function(player, message) + player.print(message) +end) + return { - allow_command_prefix_for_messages = true, -- when true any message trigger will print to all player when prefixed - messages = { -- will trigger when ever the word is said + allow_command_prefix_for_messages = true, --- @setting allow_command_prefix_for_messages when true any message trigger will print to all player when prefixed + messages = { --- @setting messages will trigger when ever the word is said ['discord']={'info.discord'}, ['expgaming']={'info.website'}, ['website']={'info.website'}, @@ -15,11 +23,11 @@ return { ['script']={'info.softmod'}, ['loop']={'chat-bot.loops'}, ['loops']={'chat-bot.loops'}, - ['rhd']={'chat-bot.lhd'}, - ['lhd']={'chat-bot.lhd'}, + ['rhd']={'info.lhd'}, + ['lhd']={'info.lhd'}, ['roundabout']={'chat-bot.loops'}, ['roundabouts']={'chat-bot.loops'}, - ['redmew']={'chat-bot.redmew'}, + ['redmew']={'info.redmew'}, ['afk']=function(player) local max=player for _,next_player in pairs(game.connected_players) do @@ -39,13 +47,13 @@ return { return {'chat-bot.map-time',format_time(game.tick,{days=true,hours=true,minutes=true,seconds=true,long=true})} end, }, - command_admin_only = false, -- when true will only allow chat commands for admins - command_permission = 'command/chat-bot', -- the permision used to allow command prefixs - command_prefix = '!', -- prefix used for commands below and to print to all players (if enabled above) - commands = { -- will trigger only when command prefix is given + command_admin_only = false, --- @setting command_admin_only when true will only allow chat commands for admins + command_permission = 'command/chat-bot', --- @setting command_permission the permission used to allow command prefixes + command_prefix = '!', --- @setting command_prefix prefix used for commands below and to print to all players (if enabled above) + commands = { --- @setting commands will trigger only when command prefix is given ['dev']={'chat-bot.not-real-dev'}, ['blame']=function(player) - local names = {'Cooldude2606','arty714','badgamernl',player.name} + local names = {'Cooldude2606','arty714','badgamernl', 'mark9064', 'aldldl', 'Drahc_pro',player.name} for _,next_player in pairs(game.connected_players) do names[#names + 1] = next_player.name end @@ -62,5 +70,48 @@ return { ['evolution']=function() return {'chat-bot.current-evolution',string.format('%.2f',game.forces['enemy'].evolution_factor)} end, + ['makepopcorn']=function(player) + local timeout = math.floor(180*(math.random()+0.5)) + Async(async_message,player,{'chat-bot.reply',{'chat-bot.get-popcorn-1'}}) + Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.get-popcorn-2',player.name}}) + end, + ['passsomesnaps']=function(player) + 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,player,{'chat-bot.reply',{'chat-bot.get-snaps-2',player.name}}) + Async.wait(timeout*(math.random()+0.5),async_message,player,{'chat-bot.reply',{'chat-bot.get-snaps-3',player.name}}) + end, + ['makecocktail']=function(player) + local timeout = math.floor(180*(math.random()+0.5)) + Async(async_message,player,{'chat-bot.reply',{'chat-bot.get-cocktail-1'}}) + Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.get-cocktail-2',player.name}}) + Async.wait(timeout*(math.random()+0.5),async_message,player,{'chat-bot.reply',{'chat-bot.get-cocktail-3',player.name}}) + end, + ['makecoffee']=function(player) + local timeout = math.floor(180*(math.random()+0.5)) + Async(async_message,player,{'chat-bot.reply',{'chat-bot.make-coffee-1'}}) + Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.make-coffee-2',player.name}}) + end, + ['orderpizza']=function(player) + local timeout = math.floor(180*(math.random()+0.5)) + Async(async_message,player,{'chat-bot.reply',{'chat-bot.order-pizza-1'}}) + Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.order-pizza-2',player.name}}) + Async.wait(timeout*(math.random()+0.5),async_message,player,{'chat-bot.reply',{'chat-bot.order-pizza-3',player.name}}) + end, + ['maketea']=function(player) + local timeout = math.floor(180*(math.random()+0.5)) + Async(async_message,player,{'chat-bot.reply',{'chat-bot.make-tea-1'}}) + Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.make-tea-2',player.name}}) + end, + ['meadplease']=function(player) + local timeout = math.floor(180*(math.random()+0.5)) + Async(async_message,player,{'chat-bot.reply',{'chat-bot.get-mead-1'}}) + Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.get-mead-2',player.name}}) + end, + ['passabeer']=function(player) + local timeout = math.floor(180*(math.random()+0.5)) + Async(async_message,player,{'chat-bot.reply',{'chat-bot.get-beer-1'}}) + Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.get-beer-2',player.name}}) + end } -} \ No newline at end of file +} diff --git a/config/compilatron.lua b/config/compilatron.lua index 116eb5b6..6b69601d 100644 --- a/config/compilatron.lua +++ b/config/compilatron.lua @@ -1,10 +1,12 @@ --- config file for the compliatrons including where they spawn and what messages they show +--- Config file for the compliatrons including where they spawn and what messages they show +-- @config Compilatron + return { - message_cycle=60*15, -- 15 seconds default, how often (in ticks) the messages will cycle - locations={ -- defines the spawn locations for all compilatrons + message_cycle=60*15, --- @setting message_cycle 15 seconds default, how often (in ticks) the messages will cycle + locations={ --- @setting locations defines the spawn locations for all compilatrons ['Spawn']={x=0,y=0} }, - messages={ -- the messages that each one will say, must be same name as its location + messages={ --- @setting messages the messages that each one will say, must be same name as its location ['Spawn']={ {'info.website'}, {'info.read-readme'}, diff --git a/config/death_logger.lua b/config/death_logger.lua index 7e03c2bb..1c5c578b 100644 --- a/config/death_logger.lua +++ b/config/death_logger.lua @@ -1,12 +1,14 @@ ---- This config controls what happens when a player dies mostly about map markers and item collection --- allow_teleport_to_body_command and allow_collect_bodies_command can be over ridden if command_auth_runtime_disable is present +--- This config controls what happens when a player dies mostly about map markers and item collection; +-- allow_teleport_to_body_command and allow_collect_bodies_command can be over ridden if command_auth_runtime_disable is present; -- if not present then the commands will not be loaded into the game +-- @config Death-Logger + return { - --allow_teleport_to_body_command=false, -- allows use of /return-to-body which teleports you to your last death - --allow_collect_bodies_command=false, -- allows use of /collect-body which returns all your items to you and removes the body - use_chests_as_bodies=false, -- weather items should be moved into a chest when a player dies - auto_collect_bodies=true, -- enables items being returned to the spawn point in chests upon corpse expiring - show_map_markers=true, -- shows markers on the map where bodies are - include_time_of_death=true, -- weather to include the time of death on the map marker - map_icon=nil -- the icon that the map marker shows; nil means no icon; format as a SingleID + --WIP_allow_teleport_to_body_command=false, -- allows use of /return-to-body which teleports you to your last death + --WIP_allow_collect_bodies_command=false, -- allows use of /collect-body which returns all your items to you and removes the body + use_chests_as_bodies=false, --- @setting use_chests_as_bodies weather items should be moved into a chest when a player dies + auto_collect_bodies=true, --- @setting auto_collect_bodies enables items being returned to the spawn point in chests upon corpse expiring + show_map_markers=true, --- @setting show_map_markers shows markers on the map where bodies are + include_time_of_death=true, --- @setting include_time_of_death weather to include the time of death on the map marker + map_icon=nil --- @setting map_icon the icon that the map marker shows; nil means no icon; format as a SingleID } \ No newline at end of file diff --git a/config/discord_alerts.lua b/config/discord_alerts.lua index 2eeb922f..1d2c58d0 100644 --- a/config/discord_alerts.lua +++ b/config/discord_alerts.lua @@ -1,4 +1,6 @@ --- Config file used to enable and disable different push messages for discord +-- @config Discord-Alerts + return { player_reports=true, player_warnings=true, diff --git a/config/expcore-commands/auth_admin.lua b/config/expcore-commands/auth_admin.lua index 19ef9198..5f2b8723 100644 --- a/config/expcore-commands/auth_admin.lua +++ b/config/expcore-commands/auth_admin.lua @@ -1,7 +1,9 @@ ---- This is a very simple config file which adds a admin only auth function --- not much to change here its more so it can be enabled and disabled from ./config/file_loader.lua +--- This is a very simple config file which adds a admin only auth functio; +-- not much to change here its more so it can be enabled and disabled from ./config/file_loader.lua; -- either way you can change the requirements to be "admin" if you wanted to -local Commands = require 'expcore.commands' +-- @config Commands-Auth-Admin + +local Commands = require 'expcore.commands' --- @dep expcore.commands Commands.add_authenticator(function(player,command,tags,reject) if tags.admin_only then diff --git a/config/expcore-commands/auth_roles.lua b/config/expcore-commands/auth_roles.lua index 3011166e..cb7e0db9 100644 --- a/config/expcore-commands/auth_roles.lua +++ b/config/expcore-commands/auth_roles.lua @@ -1,6 +1,8 @@ --- This will make commands only work if the role has been allowed it in the role config -local Commands = require 'expcore.commands' -local Roles = require 'expcore.roles' +-- @config Commands-Auth-Roles + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local Roles = require 'expcore.roles' --- @dep expcore.roles Commands.add_authenticator(function(player,command,tags,reject) if Roles.player_allowed(player,'command/'..command) then diff --git a/config/expcore-commands/auth_runtime_disable.lua b/config/expcore-commands/auth_runtime_disable.lua index 0f4861fb..204869f5 100644 --- a/config/expcore-commands/auth_runtime_disable.lua +++ b/config/expcore-commands/auth_runtime_disable.lua @@ -1,17 +1,23 @@ ---- This config for command auth allows commands to be globally enabled and disabled during runtime +--- This config for command auth allows commands to be globally enabled and disabled during runtime; -- this config adds Commands.disable and Commands.enable to enable and disable commands for all users -local Commands = require 'expcore.commands' -local Global = require 'utils.global' +-- @config Commands-Auth-Runtime-Disable + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local Global = require 'utils.global' --- @dep utils.global local disabled_commands = {} Global.register(disabled_commands,function(tbl) disabled_commands = tbl end) +--- Stops a command from be used by any one +-- @tparam string command_name the name of the command to disable function Commands.disable(command_name) disabled_commands[command_name] = true end +--- Allows a command to be used again after disable was used +-- @tparam string command_name the name of the command to enable function Commands.enable(command_name) disabled_commands[command_name] = nil end diff --git a/config/expcore-commands/parse_general.lua b/config/expcore-commands/parse_general.lua index 513aa845..7b9e282a 100644 --- a/config/expcore-commands/parse_general.lua +++ b/config/expcore-commands/parse_general.lua @@ -1,13 +1,10 @@ ---- This file contains some common command param parse functions --- this file is less of a config and more of a requirement but you may wish to change how some behave --- as such you need to be confident with lua but you edit this config file --- use Commands.add_parse('name',function(input,player,reject) end) to add a parse --- see ./expcore/commands.lua for more details -local Commands = require 'expcore.commands' -local Game = require 'utils.game' - ---[[ ->>>>Adds Parses: +--[[-- This file contains some common command param parse functions; +this file is less of a config and more of a requirement but you may wish to change how some behave; +as such you need to be confident with lua but you edit this config file; +use Commands.add_parse('name',function(input,player,reject) end) to add a parse; +see ./expcore/commands.lua for more details +@config Commands-Parse +@usage Adds Parses: boolean string-options - options: array string-max-length - max_length: number @@ -22,6 +19,11 @@ local Game = require 'utils.game' surface ]] +local Commands = require 'expcore.commands' --- @dep expcore.commands +local Game = require 'utils.game' --- @dep utils.game + + + Commands.add_parse('boolean',function(input,player,reject) if not input then return end -- nil check input = input:lower() diff --git a/config/expcore-commands/parse_roles.lua b/config/expcore-commands/parse_roles.lua index 3d468aaf..20b0d51f 100644 --- a/config/expcore-commands/parse_roles.lua +++ b/config/expcore-commands/parse_roles.lua @@ -1,7 +1,15 @@ ---- Adds some parse functions that can be used with the role system -local Commands = require 'expcore.commands' -local Roles = require 'expcore.roles' -local auto_complete = ext_require('expcore.common','auto_complete') +--[[-- Adds some parse functions that can be used with the role system +@config Commands-Parse-Roles +@usage Adds Parses: + role + player-role + player-role-online + player-role-alive +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local Roles = require 'expcore.roles' --- @dep expcore.roles +local auto_complete = ext_require('expcore.common','auto_complete') --- @dep expcore.common require 'config.expcore-commands.parse_general' Commands.add_parse('role',function(input,player,reject) diff --git a/config/permission_groups.lua b/config/permission_groups.lua index 9b2ac4f1..74fc894b 100644 --- a/config/permission_groups.lua +++ b/config/permission_groups.lua @@ -1,10 +1,12 @@ ---- Use this file to add new permission groups to the game --- start with Permission_Groups.new_group('name') --- then use either :allow_all() or :disallow_all() to set the default for non specified actions +--- Use this file to add new permission groups to the game; +-- start with Permission_Groups.new_group('name'); +-- then use either :allow_all() or :disallow_all() to set the default for non specified actions; -- then use :allow{} and :disallow{} to specify certain actions to allow/disallow -local Event = require 'utils.event' -local Game = require 'utils.game' -local Permission_Groups = require 'expcore.permission_groups' +-- @config Permission-Groups + +--local Event = require 'utils.event' -- @dep utils.event +--local Game = require 'utils.game' -- @dep utils.game +local Permission_Groups = require 'expcore.permission_groups' --- @dep expcore.permission_groups Permission_Groups.new_group('Admin') :allow_all() @@ -59,7 +61,6 @@ Permission_Groups.new_group('Standard') 'admin_action', -- trusted 'change_programmable_speaker_alert_parameters', -- standard 'drop_item', - 'reset_assembling_machine', 'set_auto_launch_rocket' } @@ -81,7 +82,6 @@ Permission_Groups.new_group('Guest') 'admin_action', -- trusted 'change_programmable_speaker_alert_parameters', -- standard 'drop_item', - 'reset_assembling_machine', 'set_auto_launch_rocket', 'change_programmable_speaker_parameters', -- guest 'change_train_stop_station', @@ -92,7 +92,8 @@ Permission_Groups.new_group('Guest') 'rotate_entity', 'use_artillery_remote', 'launch_rocket', - 'cancel_research' + 'cancel_research', + 'activate_cut' } Permission_Groups.new_group('Restricted') @@ -136,4 +137,4 @@ Event.on_nth_tick(check_interval,function(event) for _,player in pairs(game.connected_players) do assign_group(player) end -end)]] \ No newline at end of file +end)]] diff --git a/config/pollution_grading.lua b/config/pollution_grading.lua index b19fd3ef..fdb73369 100644 --- a/config/pollution_grading.lua +++ b/config/pollution_grading.lua @@ -1,7 +1,9 @@ --- This controls how pollution is viewed on the map +--- This controls how pollution is viewed on the map +-- @config Pollution-Grading + return { - reference_point = {x=0,y=0}, -- where pollution is read from - max_scalar = 0.5, -- the scale between true max and max - min_scalar = 0.17, -- the scale between the lowest max and min - update_delay = 15 -- time in minutes between view updates + reference_point = {x=0,y=0}, --- @setting reference_point where pollution is read from + max_scalar = 0.5, --- @setting max_scalar the scale between true max and max + min_scalar = 0.17, --- @setting min_scalar the scale between the lowest max and min + update_delay = 15 --- @setting update_delay time in minutes between view updates } \ No newline at end of file diff --git a/config/popup_messages.lua b/config/popup_messages.lua index bee5b53c..75db9a47 100644 --- a/config/popup_messages.lua +++ b/config/popup_messages.lua @@ -1,8 +1,10 @@ --- A combination of config settings for different popup values like chat and damage +-- @config Popup-Messages + return { - show_player_messages=true, -- weather a message in chat will make a popup above them - show_player_mentions=true, -- weather a mentioned player will have a popup when mentioned in chat - show_player_damage=true, -- weather to show damage done by players - show_player_health=true, -- weather to show player health when attacked - damage_location_variance=0.8 -- how close to the eade of an entity the popups will appear + show_player_messages=true, --- @setting show_player_messages weather a message in chat will make a popup above them + show_player_mentions=true, --- @setting show_player_mentions weather a mentioned player will have a popup when mentioned in chat + show_player_damage=true, --- @setting show_player_damage weather to show damage done by players + show_player_health=true, --- @setting show_player_health weather to show player health when attacked + damage_location_variance=0.8 --- @setting damage_location_variance how close to the eade of an entity the popups will appear } \ No newline at end of file diff --git a/config/preset_player_colours.lua b/config/preset_player_colours.lua index d10fd64a..d186fa01 100644 --- a/config/preset_player_colours.lua +++ b/config/preset_player_colours.lua @@ -1,6 +1,8 @@ --- preset colours that players get when they join the server, if not in the list then will be given a random colour (which isnt disallowed) +--- Preset colours that players get when they join the server, if not in the list then will be given a random colour (which isnt disallowed) +-- @config Preset-Player-Colours + return { - players={ + players={ --- @setting players list of all players and the colour in rgb256 that they will recive upon joining BADgamerNL={r=255,g=20,b=147}, arty714={r=150,g=68,b=161}, Cooldude2606={r=57,g=192,b=207}, @@ -11,9 +13,12 @@ return { aldldl={r=0,g=131,b=255}, NAD4X4={r=135,g=206,b=250}, cydes={r=82,g=249,b=155}, - UUBlueFire={r=0,g=204,b=255} + UUBlueFire={r=0,g=204,b=255}, + CmonMate497={r=103,g=224,b=194}, + s4sh={r=255,g=120,b=0}, + ArPiiX={r=0,g=255,b=0} }, - disallow = { -- the value does not matter it is only the key which is checked + disallow = { --- @setting disallow colours which will not given to players; the value does not matter it is only the key which is checked black = {r = 0, g = 0, b = 0}, white = {r = 255, g = 255, b = 255}, jailed = {r = 255, g = 255, b = 255}, diff --git a/config/repair.lua b/config/repair.lua index 5980c8c2..0dbb1224 100644 --- a/config/repair.lua +++ b/config/repair.lua @@ -1,14 +1,16 @@ --- config file for the repair command +--- Config file for the repair command +-- @config Repair + return { - disallow = { -- items in this list will never be repaired + disallow = { --- @setting disallow items in this list will never be repaired ['loader']=true, ['fast-loader']=true, ['express-loader']=true, ['electric-energy-interface']=true, ['infinity-chest']=true }, - max_range=50, -- the max range that can be used with the repair command - allow_blueprint_repair=false, -- when true will allow blueprints (things not destroied by biters) to be build instently using the repair command - allow_ghost_revive=true, -- when true will allow ghosts (things destoried by biters) to be build instently using the repair command - allow_heal_entities=true -- when true will heal entities to full health that are within range + max_range=50, --- @setting max_range the max range that can be used with the repair command + allow_blueprint_repair=false, --- @setting allow_blueprint_repair when true will allow blueprints (things not destroyed by biters) to be build instantly using the repair command + allow_ghost_revive=true, --- @setting allow_ghost_revive when true will allow ghosts (things destroyed by biters) to be build instantly using the repair command + allow_heal_entities=true --- @setting allow_heal_entities when true will heal entities to full health that are within range } \ No newline at end of file diff --git a/config/rockets.lua b/config/rockets.lua index 7025ae16..00432a9d 100644 --- a/config/rockets.lua +++ b/config/rockets.lua @@ -1,18 +1,20 @@ --- This file controls what will show in each section of the rocket info gui +-- @config Rockets + return { - stats = { --- The data that will show in the stats section - show_stats=true, -- false will hide this section all together - show_first_rocket = true, -- false will not show when the first rocket was launched - show_last_rocket = true, -- false will not show when the last rocket was launched - show_fastest_rocket = true, -- false will not show the time taken for the fastest rocket - show_total_rockets = true, -- false will not show the total number of rockets launched - show_game_avg = true, -- false will hide the avg across the entire map time - rolling_avg = { -- each number will be one stat; 5 means the avg time taken for the last 5 rockets + stats = { --- @setting stats The data that will show in the stats section + show_stats=true, --- @setting show_stats false will hide this section all together + show_first_rocket = true, --- @setting show_first_rocket false will not show when the first rocket was launched + show_last_rocket = true, --- @setting show_last_rocket false will not show when the last rocket was launched + show_fastest_rocket = true, --- @setting show_fastest_rocket false will not show the time taken for the fastest rocket + show_total_rockets = true, --- @setting show_total_rockets false will not show the total number of rockets launched + show_game_avg = true, --- @setting show_game_avg false will hide the avg across the entire map time + rolling_avg = { --- @setting rolling_avg each number will be one statistic; 5 means the avg time taken for the last 5 rockets 5,10,25 } }, - milestones = { -- each number will be one stat; 5 means the time that the 5th rocket was launched - show_milestones=true, -- false will hide this section all together + milestones = { --- @setting milestones each number will be one statistic; 5 means the time that the 5th rocket was launched + show_milestones=true, --- @setting show_milestones false will hide this section all together 1,2,5, 10,20,50, 100,200,500, @@ -20,14 +22,14 @@ return { 3000,3500,4000,4500, 5000 }, - progress = { --- The data and buttons in the build progress section - show_progress = true, -- false will hide this section altogether - allow_zoom_to_map = true, -- false will disable the zoom to map feature - allow_remote_launch = true, -- false removes the remote launch button for all players - remote_launch_admins_only = false, -- true will remove the remote launch button for all non (game) admins - remote_launch_role_permision = 'gui/rocket-info/remote_launch', -- value used by custom permission system to allow or disllow the button - allow_toggle_active = true, -- false removes the remote toggle auto launch button for all players - toggle_active_admins_only = false, -- true will remove the toggle auto launch button for all non (game) admins - toggle_active_role_permision = 'gui/rocket-info/toggle-active' -- value used by custom permission system to allow or disllow the button + progress = { --- @setting progress The data and buttons in the build progress section + show_progress = true, --- @setting show_progress false will hide this section altogether + allow_zoom_to_map = true, --- @setting allow_zoom_to_map false will disable the zoom to map feature + allow_remote_launch = true, --- @setting allow_remote_launch false removes the remote launch button for all players + remote_launch_admins_only = false, --- @setting remote_launch_admins_only true will remove the remote launch button for all non (game) admins + remote_launch_role_permission = 'gui/rocket-info/remote_launch', --- @setting remote_launch_role_permission value used by custom permission system to allow or disallow the button + allow_toggle_active = true, --- @setting allow_toggle_active false removes the remote toggle auto launch button for all players + toggle_active_admins_only = false, --- @setting toggle_active_admins_only true will remove the toggle auto launch button for all non (game) admins + toggle_active_role_permission = 'gui/rocket-info/toggle-active' --- @setting toggle_active_role_permission value used by custom permission system to allow or disallow the button } } \ No newline at end of file diff --git a/config/roles.lua b/config/roles.lua index a17c7966..dbdb3c31 100644 --- a/config/roles.lua +++ b/config/roles.lua @@ -1,11 +1,13 @@ --- This is the main config file for the role system; file includes defines for roles and role flags and default values -local Roles = require 'expcore.roles' +-- @config Roles + +local Roles = require 'expcore.roles' --- @dep expcore.roles -- Use these to adjust for ticks ie game.tick < 5*minutes local seconds, minutes, hours = 60, 3600, 216000 --[[ - -- cant use a factory as it has upvalues ;-; + -- cant use a factory as it has up values ;-; local function playtime(time_required) return function(player) if player.online_time > time_required then @@ -208,6 +210,7 @@ local default = Roles.new_role('Guest','') 'command/list-roles', 'command/find-on-map', 'command/report', + 'command/ratio', 'gui/player-list', 'gui/rocket-info', 'gui/science-info', @@ -283,4 +286,5 @@ Roles.override_player_roles{ Tcheko={'Moderator','Member'}, WhomstThouAmMe={'Moderator','Member'}, Windbomb={'Moderator','Member'}, + tovernaar123={'Member'}, } diff --git a/config/science.lua b/config/science.lua index 3cd3ce5f..d9e77d5f 100644 --- a/config/science.lua +++ b/config/science.lua @@ -1,8 +1,10 @@ --- config file for the science info gui +--- Config file for the science info gui +-- @config Science + return { -- list of all science packs to be shown in the gui - show_eta=true, -- when true the eta for research completion will be shown - required_for_green=5, -- the amount required for the text to show as green - required_for_red=-5, -- the amount required for the text to show as red + show_eta=true, --- @setting show_eta when true the eta for research completion will be shown + color_clamp=5, --- @setting color_clamp the amount required for the text to show as green or red + color_flux=0.1, --- @setting color_flux the ammount of flucuation allowed in production before icon change 'automation-science-pack', 'logistic-science-pack', 'military-science-pack', diff --git a/config/scorched_earth.lua b/config/scorched_earth.lua index 1a46e20d..64ab9568 100644 --- a/config/scorched_earth.lua +++ b/config/scorched_earth.lua @@ -1,7 +1,9 @@ --- This file controls the placement/degrading of tiles as players build and walk +-- @config Scorched-Earth + return { - weakness_value=50, -- lower value will make tiles more likely to degrade - strengths={ -- this decides how "strong" a tile is, bigger number means less likely to degrade + weakness_value=50, --- @setting weakness_value lower value will make tiles more likely to degrade + strengths={ --- @setting strengths this decides how "strong" a tile is, bigger number means less likely to degrade -- debug: /interface require('modules.addons.worn-paths')(player.name,true) -- note: tiles are effected by the tiles around them, so player paths will not degrade as fast when made wider -- note: values are relative to the tile with the highest value, recommended to keep highest tile as a "nice" number @@ -42,7 +44,7 @@ return { --["water-shallow"]=90, --["water-mud"]=0, -- last tile, nothing to degrade to }, - degrade_order={ -- when a tile degrades it will turn into the next tile given here + degrade_order={ --- @setting degrade_order when a tile degrades it will turn into the next tile given here ["refined-concrete"]='concrete', ["refined-hazard-concrete-left"]='hazard-concrete-left', ["refined-hazard-concrete-right"]='hazard-concrete-right', @@ -79,7 +81,7 @@ return { --["water-shallow"]='water-mud', --["water-mud"]=0, -- last tile, nothing to degrade to }, - entities={ -- entities in this list will degrade the tiles under them when they are placed + entities={ --- @setting entities entities in this list will degrade the tiles under them when they are placed ['stone-furnace']=true, ['steel-furnace']=true, ['electric-furnace']=true, diff --git a/config/spawn_area.lua b/config/spawn_area.lua index 4d8f8eaf..889fc20e 100644 --- a/config/spawn_area.lua +++ b/config/spawn_area.lua @@ -1,33 +1,35 @@ --- Used to config the spawn generation settings yes there is alot here i know just ignore the long tables at the end (they were generated with a command) +-- @config Spawn-Area + return { - infinite_ammo_turrets = { -- These turrets will have they ammo refilled automatically and can not be looted - enabled=true, -- weather the turrets will be created and refilled - ammo_type='uranium-rounds-magazine', -- the ammo type that will be used - locations={ -- locations of all turrets, this is default it can be changed during runtime + infinite_ammo_turrets = { --- @setting infinite_ammo_turrets These turrets will have they ammo refilled automatically and can not be looted + enabled=true, --- @setting enabled weather the turrets will be created and refilled + ammo_type='uranium-rounds-magazine', --- @setting ammo_type the ammo type that will be used + locations={ --- @setting locations locations of all turrets, this is default it can be changed during runtime {surface=1,position={x=-3,y=-3}}, {surface=1,position={x=3 ,y=-3}}, {surface=1,position={x=-3,y=3 }}, {surface=1,position={x=3 ,y=3 }} } }, - afk_belts = { - enabled=true, -- weather afk belts will be generated - locations={ -- top left connors of any afk belt loops to be added + afk_belts = { --- @setting afk_belts setting relating to afk belts round the spawn point + enabled=true, --- @setting enabled weather afk belts will be generated + locations={ --- @setting locations top left connors of any afk belt loops to be added {x=-5,y=-5}, {x=5, y=-5}, {x=-5,y=5 }, {x=5, y=5 } } }, - corrections = { -- Some settings that have no where else to go - protect_entities=true, - offset = {x=0,y=-2}, -- a global offset value to correct the x and y values of the tables below - deconstruction_radius=20, -- when the spawn is made this area will have all entities removed first - deconstruction_tile='concrete', -- this is the tile that will spawn in the deconstruction radius - pattern_radius = 50, -- this is the radius of the pattern all water in this area will be filled - pattern_tile = 'stone-path' -- the tile that is used for the pattern + corrections = { --- @setting corrections Some settings that have no where else to go + protect_entities=true, --- @setting protect_entities if the spawn entites will be protected + offset = {x=0,y=-2}, --- @setting offset a global offset value to correct the x and y values of the tables below + deconstruction_radius=20, --- @setting deconstruction_radius when the spawn is made this area will have all entities removed first + deconstruction_tile='concrete', --- @setting deconstruction_tile this is the tile that will spawn in the deconstruction radius + pattern_radius = 50, --- @setting pattern_radius this is the radius of the pattern all water in this area will be filled + pattern_tile = 'stone-path' --- @setting pattern_tile the tile that is used for the pattern }, - entities = { -- All entities that will be created as part of spawn {entity-name,x-pos,y-pos} + entities = { --- @setting entities All entities that will be created as part of spawn {entity-name,x-pos,y-pos} {"stone-wall",-10,-6},{"stone-wall",-10,-5},{"stone-wall",-10,-4},{"stone-wall",-10,-3},{"stone-wall",-10,-2},{"stone-wall",-10,-1},{"stone-wall",-10,0},{"stone-wall",-10,3},{"stone-wall",-10,4},{"stone-wall",-10,5}, {"stone-wall",-10,6},{"stone-wall",-10,7},{"stone-wall",-10,8},{"stone-wall",-10,9},{"stone-wall",-8,-8},{"small-lamp",-8,-4},{"small-lamp",-8,-1},{"iron-chest",-8,0},{"iron-chest",-8,3},{"small-lamp",-8,4}, {"small-lamp",-8,7},{"stone-wall",-8,11},{"stone-wall",-7,-8},{"small-electric-pole",-7,-2},{"iron-chest",-7,0},{"iron-chest",-7,3},{"small-electric-pole",-7,5},{"stone-wall",-7,11},{"stone-wall",-6,-8},{"small-lamp",-6,-6}, @@ -43,7 +45,7 @@ return { {"stone-wall",9,-4},{"stone-wall",9,-3},{"stone-wall",9,-2},{"stone-wall",9,-1},{"stone-wall",9,0},{"stone-wall",9,3},{"stone-wall",9,4},{"stone-wall",9,5},{"stone-wall",9,6},{"stone-wall",9,7}, {"stone-wall",9,8},{"stone-wall",9,9} }, - tiles = { -- The location of the "pattern" tiles {x-pos,y-pos} + tiles = { --- @setting tiles The location of the "pattern" tiles {x-pos,y-pos} {-49,-3},{-49,-2},{-49,1},{-49,2},{-49,5},{-49,6},{-48,-4},{-48,-3},{-48,-2},{-48,1},{-48,2},{-48,5},{-48,6},{-48,7},{-47,-7},{-47,-6},{-47,-5},{-47,-4},{-47,-3},{-47,-2},{-47,5},{-47,6},{-47,7},{-47,8},{-47,9},{-47,10},{-46,-8},{-46,-7},{-46,-6},{-46,-5}, {-46,-4},{-46,-3},{-46,-2},{-46,-1},{-46,4},{-46,5},{-46,6},{-46,7},{-46,8},{-46,9},{-46,10},{-46,11},{-45,-17},{-45,-16},{-45,-15},{-45,-14},{-45,-13},{-45,-12},{-45,-9},{-45,-8},{-45,-7},{-45,-2},{-45,-1},{-45,0},{-45,1},{-45,2},{-45,3},{-45,4},{-45,5},{-45,10}, {-45,11},{-45,12},{-45,15},{-45,16},{-45,17},{-45,18},{-45,19},{-45,20},{-44,-18},{-44,-17},{-44,-16},{-44,-15},{-44,-14},{-44,-13},{-44,-12},{-44,-9},{-44,-8},{-44,-1},{-44,0},{-44,1},{-44,2},{-44,3},{-44,4},{-44,11},{-44,12},{-44,15},{-44,16},{-44,17},{-44,18},{-44,19}, diff --git a/config/tasks.lua b/config/tasks.lua index cc80d192..95165ee0 100644 --- a/config/tasks.lua +++ b/config/tasks.lua @@ -1,7 +1,9 @@ --- config file for the tasks gui +--- Config file for the tasks gui +-- @config Tasks + return { - any_user_can_add_new_task = true, -- when false only people with edit permission can make new reports - user_can_edit_own_tasks = true, -- when false only people with edit permission can edit reports - only_admins_can_edit = false, -- true will hide the edit and delete buttons from non (game) admins - edit_tasks_role_permision = 'gui/task-list/edit' -- value used with custom permision system + any_user_can_add_new_task = true, --- @setting any_user_can_add_new_task when false only people with edit permission can make new reports + user_can_edit_own_tasks = true, --- @setting user_can_edit_own_tasks when false only people with edit permission can edit reports + only_admins_can_edit = false, --- @setting only_admins_can_edit true will hide the edit and delete buttons from non (game) admins + edit_tasks_role_permission = 'gui/task-list/edit' --- @setting edit_tasks_role_permission value used with custom permission system } \ No newline at end of file diff --git a/config/warnings.lua b/config/warnings.lua index 7fd627a4..24f85867 100644 --- a/config/warnings.lua +++ b/config/warnings.lua @@ -1,6 +1,8 @@ --- Config file for the warning system, this is very similar to reports but is for the use of moderators rather than normal users. +-- @config Warnings + return { - actions = { -- what actions are taking at number of warnings + actions = { --- @setting actions what actions are taking at number of warnings -- if a localized string is used then __1__ will by_player_name and __2__ will be the current warning count (auto inserted) {'warnings.received',''}, {'warnings.received',''}, @@ -14,6 +16,6 @@ return { game.ban_player(player,{'warnings.received',by_player_name,number_of_warnings,{'warnings.ban',{'links.website'}}}) end }, - temp_warning_cool_down=30, -- time for a temp warning (given by script) to be removed (in minutes) - temp_warning_limit=5 -- the number of temp warnings (given by script) that are allowed before full warnings are given + script_warning_cool_down=30, --- @setting script_warning_cool_down time for a script warning (given by script) to be removed (in minutes) + script_warning_limit=5 --- @setting script_warning_limit the number of script warnings (given by script) that are allowed before full warnings are given } \ No newline at end of file diff --git a/config/warps.lua b/config/warps.lua index bd7fb4c8..fb620108 100644 --- a/config/warps.lua +++ b/config/warps.lua @@ -1,23 +1,25 @@ --- This file contains all the different settings for the warp system and gui +-- @config Warps + return { - recharge_time = 60, -- The amount of time in seconds that the player must wait between warps, acts as a balance - update_smothing = 10, -- Higher is better, the amount of smothing applied to recharge timer and other gui updates, max is 60 - minimum_distance = 100, -- The minimum distance that must be between warp points, creating new ones is blocked when too close - activation_range = 4, -- The distance the player must be to a warp in order to use the warp gui, gui can still be viewd but not used - spawn_activation_range = 20, -- A second activation range which is used for the forces spawn point - default_icon = 'discharge-defense-equipment', -- The deafult icon which is used by warps; must be an item name - user_can_edit_own_warps = false, -- When true the user can always edit warps which they created regaudless of other settings - any_user_can_add_new_warp = false, -- When true any user is able to create new warps, however editing may still be restricted - only_admins_can_edit = false, -- When true only admins can edit warps - edit_warps_role_permision = 'gui/warp-list/edit', -- Role permission used by the role system to allow editing warps - bypass_warp_limits_permision = 'gui/warp-list/no-limit', -- Role permission used by the role system to allow bypassing the time and distance restrctions - entities = { -- The entites which are created for warps + recharge_time = 60, --- @setting recharge_time The amount of time in seconds that the player must wait between warps, acts as a balance + update_smoothing = 10, --- @setting update_smoothing Higher is better, the amount of smoothing applied to recharge timer and other gui updates, max is 60 + minimum_distance = 100, --- @setting minimum_distance The minimum distance that must be between warp points, creating new ones is blocked when too close + activation_range = 4, --- @setting activation_range The distance the player must be to a warp in order to use the warp gui, gui can still be viewed but not used + spawn_activation_range = 20, --- @setting spawn_activation_range A second activation range which is used for the forces spawn point + default_icon = 'discharge-defense-equipment', --- @setting default_icon The default icon which is used by warps; must be an item name + user_can_edit_own_warps = false, --- @setting user_can_edit_own_warps When true the user can always edit warps which they created regardless of other settings + any_user_can_add_new_warp = false, --- @setting any_user_can_add_new_warp When true any user is able to create new warps, however editing may still be restricted + only_admins_can_edit = false, --- @setting only_admins_can_edit When true only admins can edit warps + edit_warps_role_permission = 'gui/warp-list/edit', --- @setting edit_warps_role_permission Role permission used by the role system to allow editing warps + bypass_warp_limits_permission = 'gui/warp-list/no-limit', --- @setting bypass_warp_limits_permission Role permission used by the role system to allow bypassing the time and distance restrictions + entities = { --- @setting entities The entities which are created for warps {'small-lamp',-3,-2},{'small-lamp',-3,2},{'small-lamp',3,-2},{'small-lamp',3,2}, {'small-lamp',-2,-3},{'small-lamp',2,-3},{'small-lamp',-2,3},{'small-lamp',2,3}, {'small-electric-pole',-3,-3},{'small-electric-pole',3,3},{'small-electric-pole',-3,3},{'small-electric-pole',3,-3} }, - base_tile = 'tutorial-grid', -- The tile which is used for the warps - tiles = { -- The tiles which are created for warps + base_tile = 'tutorial-grid', --- @setting base_tile The tile which is used for the warps + tiles = { --- @setting tiles The tiles which are created for warps {-3,-2},{-3,-1},{-3,0},{-3,1},{-3,2},{3,-2},{3,-1},{3,0},{3,1},{3,2}, {-2,-3},{-1,-3},{0,-3},{1,-3},{2,-3},{-2,3},{-1,3},{0,3},{1,3},{2,3} } diff --git a/control.lua b/control.lua index 29d79064..82237d76 100644 --- a/control.lua +++ b/control.lua @@ -18,15 +18,15 @@ require 'utils.print_override' require 'utils.math' -- Global Debug and make sure our version file is registered -Debug = require 'utils.debug' +Debug = require 'utils.debug' --- @dep utils.debug require 'resources.version' -- Global require function used to extract parts of a module, because simply being in common is not good enough -ext_require = require('expcore.common').ext_require +ext_require = require('expcore.common').ext_require --- @dep expcore.common.ext_require -- Please go to config/file_loader.lua to edit the files that are loaded log('[INFO] Getting file loader config') -local files = require 'config._file_loader' +local files = require 'config._file_loader' --- @dep config._file_loader -- Loads all files from the config and logs that they are loaded local total_file_count = string.format('%3d',#files) @@ -50,6 +50,10 @@ for index,path in pairs(files) do end +-- Override the default require; require can no longer load new scripts +log('[INFO] Require Overright! No more requires can be made!') +require 'utils.require_override' + -- Logs all errors again to make it make it easy to find log('[INFO] All files loaded with '..#errors..' errors:') for _,error in pairs(errors) do log(error) end diff --git a/description.json b/description.json new file mode 100644 index 00000000..95633c16 --- /dev/null +++ b/description.json @@ -0,0 +1,4 @@ +{ + "order": "ExpGaming", + "multiplayer-compatible": true +} diff --git a/doc/index.html b/doc/index.html deleted file mode 100644 index 45c80e3f..00000000 --- a/doc/index.html +++ /dev/null @@ -1,376 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- - - -

Modules

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
config._file_loaderThis contains a list of all files that will be loaded and the order they are loaded in - to stop a file from loading add "--" in front of it, remove the "--" to have the file be loaded - config files should be loaded after all modules are loaded - core files should be required by modules and not be present in this list
config.action_buttonsConfig for the different action buttons that show on the player list - each button has the button define(s) given along side an auth function, and optional reason callback - if a reason callback is used then Store.set_child(action_name_store,player.name,'BUTTON_NAME') should be called during on_click - buttons can be removed from the gui by commenting them out of the config at the bottom of this file - the key used for the name of the button is the permision name used by the role system
config.advanced_startThis file is used to setup the map starting settings and the items players will start with
config.death_loggerThis config controls what happens when a player dies mostly about map markers and item collection - allow_teleport_to_body_command and allow_collect_bodies_command can be over ridden if command_auth_runtime_disable is present - if not present then the commands will not be loaded into the game
config.expcore-commands.auth_adminThis is a very simple config file which adds a admin only auth function - not much to change here its more so it can be enabled and disabled from ./config/file_loader.lua - either way you can change the requirements to be "admin" if you wanted to
config.expcore-commands.auth_rolesThis will make commands only work if the role has been allowed it in the role config
config.expcore-commands.auth_runtime_disableThis config for command auth allows commands to be globally enabled and disabled during runtime - this config adds Commands.disable and Commands.enable to enable and disable commands for all users
config.expcore-commands.parse_generalThis file contains some common command param parse functions - this file is less of a config and more of a requirement but you may wish to change how some behave - as such you need to be confident with lua but you edit this config file - use Commands.add_parse('name',function(input,player,reject) end) to add a parse - see ./expcore/commands.lua for more details
config.expcore-commands.parse_rolesAdds some parse functions that can be used with the role system
config.permission_groupsUse this file to add new permission groups to the game - start with Permission_Groups.new_group('name') - then use either :allow_all() or :disallow_all() to set the default for non specified actions - then use :allow{} and :disallow{} to specify certain actions to allow/disallow
config.popup_messagesA combination of config settings for different popup values like chat and damage
config.rocketsThis file controls what will show in each section of the rocket info gui
config.rolesThis is the main config file for the role system; file includes defines for roles and role flags and default values
config.scorched_earthThis file controls the placement/degrading of tiles as players build and walk
config.spawn_areaUsed to config the spawn generation settings yes there is alot here i know just ignore the long tables at the end (they were generated with a command)
config.warningsConfig file for the warning system, this is very similar to reports but is for the use of moderators rather than normal users.
controlPlease go to ./config if you want to change settings, each file is commented with what it does - if it is not in ./config then you should not attempt to change it unless you know what you are doing - all files which are loaded (including the config files) are present in ./config/file_loader.lua - this file is the landing point for all scenarios please DO NOT edit directly, further comments are to aid development
expcore.commandsFactorio command making module that makes commands with better parse and more modularity
expcore.commonAdds some commonly used functions used in many modules
expcore.guiThis file is used to require all the different elements of the gui module - each module has an outline here but for more details see their seperate files in ./gui
expcore.gui.buttonsGui class define for buttons and sprite buttons -[[
expcore.gui.centerGui structure define for center gui frames -[[
expcore.gui.checkboxsGui class define for checkboxs and radiobuttons -[[
expcore.gui.coreCore gui file for making element defines and element classes (use require 'expcore.gui') - see utils.gui for event handlering - see expcore.gui.test for examples for element defines -[[
expcore.gui.dropdownGui class define for dropdowns and list boxs -[[
expcore.gui.elem-buttonGui class defines for elem buttons -[[
expcore.gui.instancesThis file is a breakout from core which forcues on instance management of defines -[[
expcore.gui.leftGui structure define for left frames -[[
expcore.gui.popupsGui structure define for popup gui -[[
expcore.gui.progress-barGui element define for progess bars -[[
expcore.gui.sliderGui class define for silders -[[
expcore.gui.testThis file creates a teste gui that is used to test every input method - note that this does not cover every permutation only features in indepentance - for example store in most cases is just by player name, but other store methods are tested with checkbox
expcore.gui.textGui class define for text fields and text boxs -[[
expcore.gui.toolbarGui structure for the toolbar (top left) -[[
expcore.permission_groupsPermission group making for factorio so you never have to make one by hand again
expcore.rolesFactorio role system to manage custom permissions
expcore.storeAdds an easy way to store and watch for updates to a value -[[
modules.addons.advanced-startAdds a better method of player starting items based on production levels.
modules.addons.chat-popupsCreates flying text entities when a player sends a message in chat - also displays a ping above users who are named in the message
modules.addons.damage-popupsDisplays the amount of dmg that is done by players to entities - also shows player health when a player is attacked
modules.gui.player-listGui left frame define for a player list
modules.gui.rocket-infoAdds a rocket infomation gui which shows general stats, milestones and build progress of rockets
modules.gui.science-infoAdds a science info gui that shows production usage and net for the different science packs as well as an eta
modules.gui.task-listAdds a task list to the game which players can add remove and edit items on
utils.alien_evolution_progressinfo - Original (javascript) version: https://hastebin.com/udakacavap.js - Can be tested against: https://wiki.factorio.com/Enemies#Spawn_chances_by_evolution_factor
utils.coreMeasures distance between pos1 and pos2
utils.debug
utils.eventThis Module allows for registering multiple handlers to the same event, overcoming the limitation of script.register.
utils.event_coreDo not use this function, use Event.add instead as it has safety checks.
utils.mathTakes two points and calculates the slope of a line
utils.recipe_lockerLocks recipes, preventing them from being enabled by research.
utils.state_machineThis module provides a classical mealy/moore state machine.
utils.tableSearches a table to remove a specific element without an index
utils.taskAllows you to set a timer (in ticks) after which the tokened function will be run with params given as an argument - Cannot be called before init
utils.timestampsource https://github.com/daurnimator/luatz/blob/master/luatz/timetable.lua - edited down to just what is needed.
- -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/ldoc.css b/doc/ldoc.css deleted file mode 100644 index 7d74ca23..00000000 --- a/doc/ldoc.css +++ /dev/null @@ -1,307 +0,0 @@ -/* BEGIN RESET - -Copyright (c) 2010, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.com/yui/license.html -version: 2.8.2r1 -*/ -html { - color: #000; - background: #FFF; -} -body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { - margin: 0; - padding: 0; -} -table { - border-collapse: collapse; - border-spacing: 0; -} -fieldset,img { - border: 0; -} -address,caption,cite,code,dfn,em,strong,th,var,optgroup { - font-style: inherit; - font-weight: inherit; -} -del,ins { - text-decoration: none; -} -li { - list-style: disc; - margin-left: 20px; -} -caption,th { - text-align: left; -} -h1,h2,h3,h4,h5,h6 { - font-size: 100%; - font-weight: bold; -} -q:before,q:after { - content: ''; -} -abbr,acronym { - border: 0; - font-variant: normal; -} -sup { - vertical-align: baseline; -} -sub { - vertical-align: baseline; -} -legend { - color: #000; -} -input,button,textarea,select,optgroup,option { - font-family: inherit; - font-size: inherit; - font-style: inherit; - font-weight: inherit; -} -input,button,textarea,select {*font-size:100%; -} -/* END RESET */ - -body { - margin-left: 1em; - margin-right: 1em; - font-family: arial, helvetica, geneva, sans-serif; - background-color: #ffffff; margin: 0px; -} - -code, tt { font-family: monospace; font-size: 1.1em; } -span.parameter { font-family:monospace; } -span.parameter:after { content:":"; } -span.types:before { content:"("; } -span.types:after { content:")"; } -.type { font-weight: bold; font-style:italic } - -body, p, td, th { font-size: .95em; line-height: 1.2em;} - -p, ul { margin: 10px 0 0 0px;} - -strong { font-weight: bold;} - -em { font-style: italic;} - -h1 { - font-size: 1.5em; - margin: 0 0 20px 0; -} -h2, h3, h4 { margin: 15px 0 10px 0; } -h2 { font-size: 1.25em; } -h3 { font-size: 1.15em; } -h4 { font-size: 1.06em; } - -a:link { font-weight: bold; color: #004080; text-decoration: none; } -a:visited { font-weight: bold; color: #006699; text-decoration: none; } -a:link:hover { text-decoration: underline; } - -hr { - color:#cccccc; - background: #00007f; - height: 1px; -} - -blockquote { margin-left: 3em; } - -ul { list-style-type: disc; } - -p.name { - font-family: "Andale Mono", monospace; - padding-top: 1em; -} - -pre.example { - background-color: rgb(245, 245, 245); - border: 1px solid silver; - padding: 10px; - margin: 10px 0 10px 0; - font-family: "Andale Mono", monospace; - font-size: .85em; -} - -pre { - background-color: rgb(245, 245, 245); - border: 1px solid silver; - padding: 10px; - margin: 10px 0 10px 0; - overflow: auto; - font-family: "Andale Mono", monospace; -} - - -table.index { border: 1px #00007f; } -table.index td { text-align: left; vertical-align: top; } - -#container { - margin-left: 1em; - margin-right: 1em; - background-color: #f0f0f0; -} - -#product { - text-align: center; - border-bottom: 1px solid #cccccc; - background-color: #ffffff; -} - -#product big { - font-size: 2em; -} - -#main { - background-color: #f0f0f0; - border-left: 2px solid #cccccc; -} - -#navigation { - float: left; - width: 14em; - vertical-align: top; - background-color: #f0f0f0; - overflow: visible; -} - -#navigation h2 { - background-color:#e7e7e7; - font-size:1.1em; - color:#000000; - text-align: left; - padding:0.2em; - border-top:1px solid #dddddd; - border-bottom:1px solid #dddddd; -} - -#navigation ul -{ - font-size:1em; - list-style-type: none; - margin: 1px 1px 10px 1px; -} - -#navigation li { - text-indent: -1em; - display: block; - margin: 3px 0px 0px 22px; -} - -#navigation li li a { - margin: 0px 3px 0px -1em; -} - -#content { - margin-left: 14em; - padding: 1em; - width: 700px; - border-left: 2px solid #cccccc; - border-right: 2px solid #cccccc; - background-color: #ffffff; -} - -#about { - clear: both; - padding: 5px; - border-top: 2px solid #cccccc; - background-color: #ffffff; -} - -@media print { - body { - font: 12pt "Times New Roman", "TimeNR", Times, serif; - } - a { font-weight: bold; color: #004080; text-decoration: underline; } - - #main { - background-color: #ffffff; - border-left: 0px; - } - - #container { - margin-left: 2%; - margin-right: 2%; - background-color: #ffffff; - } - - #content { - padding: 1em; - background-color: #ffffff; - } - - #navigation { - display: none; - } - pre.example { - font-family: "Andale Mono", monospace; - font-size: 10pt; - page-break-inside: avoid; - } -} - -table.module_list { - border-width: 1px; - border-style: solid; - border-color: #cccccc; - border-collapse: collapse; -} -table.module_list td { - border-width: 1px; - padding: 3px; - border-style: solid; - border-color: #cccccc; -} -table.module_list td.name { background-color: #f0f0f0; min-width: 200px; } -table.module_list td.summary { width: 100%; } - - -table.function_list { - border-width: 1px; - border-style: solid; - border-color: #cccccc; - border-collapse: collapse; -} -table.function_list td { - border-width: 1px; - padding: 3px; - border-style: solid; - border-color: #cccccc; -} -table.function_list td.name { background-color: #f0f0f0; min-width: 200px; } -table.function_list td.summary { width: 100%; } - -ul.nowrap { - overflow:auto; - white-space:nowrap; -} - -dl.table dt, dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;} -dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;} -dl.table h3, dl.function h3 {font-size: .95em;} - -/* stop sublists from having initial vertical space */ -ul ul { margin-top: 0px; } -ol ul { margin-top: 0px; } -ol ol { margin-top: 0px; } -ul ol { margin-top: 0px; } - -/* make the target distinct; helps when we're navigating to a function */ -a:target + * { - background-color: #FF9; -} - -/* styles for prettification of source */ -pre .comment { color: #558817; } -pre .constant { color: #a8660d; } -pre .escape { color: #844631; } -pre .keyword { color: #aa5050; font-weight: bold; } -pre .library { color: #0e7c6b; } -pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; } -pre .string { color: #8080ff; } -pre .number { color: #f8660d; } -pre .operator { color: #2239a8; font-weight: bold; } -pre .preprocessor, pre .prepro { color: #a33243; } -pre .global { color: #800080; } -pre .prompt { color: #558817; } -pre .url { color: #272fc2; text-decoration: underline; } diff --git a/doc/modules/config._file_loader.html b/doc/modules/config._file_loader.html deleted file mode 100644 index 2b4403f7..00000000 --- a/doc/modules/config._file_loader.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module config._file_loader

-

This contains a list of all files that will be loaded and the order they are loaded in - to stop a file from loading add "--" in front of it, remove the "--" to have the file be loaded - config files should be loaded after all modules are loaded - core files should be required by modules and not be present in this list

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/config.action_buttons.html b/doc/modules/config.action_buttons.html deleted file mode 100644 index ae1730dc..00000000 --- a/doc/modules/config.action_buttons.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module config.action_buttons

-

Config for the different action buttons that show on the player list - each button has the button define(s) given along side an auth function, and optional reason callback - if a reason callback is used then Store.set_child(action_name_store,player.name,'BUTTON_NAME') should be called during on_click - buttons can be removed from the gui by commenting them out of the config at the bottom of this file - the key used for the name of the button is the permision name used by the role system

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/config.advanced_start.html b/doc/modules/config.advanced_start.html deleted file mode 100644 index e1826c7e..00000000 --- a/doc/modules/config.advanced_start.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - - -
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/config.death_logger.html b/doc/modules/config.death_logger.html deleted file mode 100644 index 98437177..00000000 --- a/doc/modules/config.death_logger.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module config.death_logger

-

This config controls what happens when a player dies mostly about map markers and item collection - allow_teleport_to_body_command and allow_collect_bodies_command can be over ridden if command_auth_runtime_disable is present - if not present then the commands will not be loaded into the game

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/config.expcore-commands.auth_admin.html b/doc/modules/config.expcore-commands.auth_admin.html deleted file mode 100644 index 3a780c6b..00000000 --- a/doc/modules/config.expcore-commands.auth_admin.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module config.expcore-commands.auth_admin

-

This is a very simple config file which adds a admin only auth function - not much to change here its more so it can be enabled and disabled from ./config/file_loader.lua - either way you can change the requirements to be "admin" if you wanted to

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/config.expcore-commands.auth_roles.html b/doc/modules/config.expcore-commands.auth_roles.html deleted file mode 100644 index 328cf7df..00000000 --- a/doc/modules/config.expcore-commands.auth_roles.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - - -
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/config.expcore-commands.auth_runtime_disable.html b/doc/modules/config.expcore-commands.auth_runtime_disable.html deleted file mode 100644 index f8f18960..00000000 --- a/doc/modules/config.expcore-commands.auth_runtime_disable.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module config.expcore-commands.auth_runtime_disable

-

This config for command auth allows commands to be globally enabled and disabled during runtime - this config adds Commands.disable and Commands.enable to enable and disable commands for all users

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/config.expcore-commands.parse_general.html b/doc/modules/config.expcore-commands.parse_general.html deleted file mode 100644 index 3b6006bd..00000000 --- a/doc/modules/config.expcore-commands.parse_general.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module config.expcore-commands.parse_general

-

This file contains some common command param parse functions - this file is less of a config and more of a requirement but you may wish to change how some behave - as such you need to be confident with lua but you edit this config file - use Commands.add_parse('name',function(input,player,reject) end) to add a parse - see ./expcore/commands.lua for more details

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/config.expcore-commands.parse_roles.html b/doc/modules/config.expcore-commands.parse_roles.html deleted file mode 100644 index 45f17c50..00000000 --- a/doc/modules/config.expcore-commands.parse_roles.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - - -
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/config.permission_groups.html b/doc/modules/config.permission_groups.html deleted file mode 100644 index c9572f7f..00000000 --- a/doc/modules/config.permission_groups.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module config.permission_groups

-

Use this file to add new permission groups to the game - start with Permission_Groups.new_group('name') - then use either :allow_all() or :disallow_all() to set the default for non specified actions - then use :allow{} and :disallow{} to specify certain actions to allow/disallow

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/config.popup_messages.html b/doc/modules/config.popup_messages.html deleted file mode 100644 index 93daa302..00000000 --- a/doc/modules/config.popup_messages.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - - -
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/config.rockets.html b/doc/modules/config.rockets.html deleted file mode 100644 index 93c35073..00000000 --- a/doc/modules/config.rockets.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module config.rockets

-

This file controls what will show in each section of the rocket info gui

-

- - -

Fields

- - - - - - - - - -
show_statsThe data that will show in the stats section
show_progressThe data and buttons in the build progress section
- -
-
- - -

Fields

- -
-
- - show_stats -
-
- The data that will show in the stats section - - - - - - - -
-
- - show_progress -
-
- The data and buttons in the build progress section - - - - - - - -
-
- - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/config.roles.html b/doc/modules/config.roles.html deleted file mode 100644 index 62b973ec..00000000 --- a/doc/modules/config.roles.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - - -
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/config.scorched_earth.html b/doc/modules/config.scorched_earth.html deleted file mode 100644 index 22741e11..00000000 --- a/doc/modules/config.scorched_earth.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - - -
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/config.spawn_area.html b/doc/modules/config.spawn_area.html deleted file mode 100644 index e25138fb..00000000 --- a/doc/modules/config.spawn_area.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module config.spawn_area

-

Used to config the spawn generation settings yes there is alot here i know just ignore the long tables at the end (they were generated with a command)

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/config.warnings.html b/doc/modules/config.warnings.html deleted file mode 100644 index d087da36..00000000 --- a/doc/modules/config.warnings.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - - -
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/control.html b/doc/modules/control.html deleted file mode 100644 index 73a8a5b4..00000000 --- a/doc/modules/control.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module control

-

Please go to ./config if you want to change settings, each file is commented with what it does - if it is not in ./config then you should not attempt to change it unless you know what you are doing - all files which are loaded (including the config files) are present in ./config/file_loader.lua - this file is the landing point for all scenarios please DO NOT edit directly, further comments are to aid development

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/expcore.commands.html b/doc/modules/expcore.commands.html deleted file mode 100644 index a41d8db7..00000000 --- a/doc/modules/expcore.commands.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - - -
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/expcore.common.html b/doc/modules/expcore.common.html deleted file mode 100644 index 83fc1ed4..00000000 --- a/doc/modules/expcore.common.html +++ /dev/null @@ -1,996 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module expcore.common

-

Adds some commonly used functions used in many modules

-

-[[

-

Info:

-
    -
  • Author: cooldude2606
  • -
- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Common.type_check (value[, test_type=nil])Compare types faster for faster validation of params
Common.type_check_error (value, test_type, error_message, level)Raises an error if the value is of the wrong type
Common.param_check (value, test_type, param_name, param_number)Raises an error when the value is the incorrect type, uses a consistent error message format
Common.player_return (value[, colour=defines.colour.white[, player=game.player]])Will return a value of any type to the player/server console, allows colour for in-game players
Common.write_json (path, tbl)Writes a table object to a file in json format
Common.opt_require (path)Calls a require that will not error if the file is not found
Common.ext_require (path, ...)Calls a require and returns only the keys given, file must return a table
Common.format_time (ticks, options)Formats tick into a clean format, denominations from highest to lowest - long will use words rather than letters - time will use : separates - string will return a string not a locale string - when a denomination is false it will overflow into the next one
Common.move_items (items[, surface=navies[, position={0[, radius=32[, chest_type=iron-chest]]]])Moves items to the position and stores them in the closest entity of the type given
Common.print_grid_value (value, surface, position, scale, offset, immutable)https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4a2/map_gen/maps/diggy/debug.lua#L31 - Prints a colored value on a location.
Common.print_colored_grid_value (value, surface, position, offset, immutable, color_value, base_color, delta_color, under_bound, over_bound)Prints a colored value on a location.
Common.clear_flying_text (surface)Clears all flying text entites on a surface
Common.string_contains (s, contains)Tests if a string contains a given substring.
Common.extract_keys (tbl, ...)Extracts certain keys from a table
Common.enum (tbl)Converts a table to an enum
Common.auto_complete (options, input[, use_key=false[, rtn_key=false]])Returns the closest match to the input
Common.table_keys (tbl)Returns all the keys of a table
Common.table_values (tbl)Returns all the values of a table
Common.table_alphanumsort (tbl)Returns the list is a sorted way that would be expected by people (this is by key)
Common.table_keysort (tbl)Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above)
Common.format_chat_colour (message, color)Returns a message with valid chat tags to change its colour
Common.format_chat_colour_localized (message, color)Returns a message with valid chat tags to change its colour, using localization
Common.format_chat_player_name (player[, raw_string=false])Returns the players name in the players color
- -
-
- - -

Functions

- -
-
- - Common.type_check (value[, test_type=nil]) -
-
- Compare types faster for faster validation of params - - -

Parameters:

-
    -
  • value - any - the value to be tested -
  • -
  • test_type - string - the type to test for if not given then it tests for nil - (default nil) -
  • -
- -

Returns:

-
    - - boolean - is v of type test_type -
- - - -

Usage:

-
    -
  • type_check('foo','string') -- return true
  • -
  • type_check('foo') -- return false
  • -
- -
-
- - Common.type_check_error (value, test_type, error_message, level) -
-
- Raises an error if the value is of the wrong type - - -

Parameters:

-
    -
  • value - any - the value that you want to test the type of -
  • -
  • test_type - string - the type that the value should be -
  • -
  • error_message - string - the error message that is returned -
  • -
  • level - number - the level to call the error on (level = 1 means the caller) -
  • -
- -

Returns:

-
    - - boolean - true if no error was called -
- - - -

Usage:

-
    -
    type_check_error('foo','number','Value must be a number') -- will raise error "Value must be a number"
    -
- -
-
- - Common.param_check (value, test_type, param_name, param_number) -
-
- Raises an error when the value is the incorrect type, uses a consistent error message format - - -

Parameters:

-
    -
  • value - any - the value that you want to test the type of -
  • -
  • test_type - string - the type that the value should be -
  • -
  • param_name - string - the name of the param -
  • -
  • param_number - number - the number param it is -
  • -
- -

Returns:

-
    - - boolean - true if no error was raised -
- - - -

Usage:

-
    -
    param_check('foo','number','repeat_count',2) -- will raise error "Invalid param #02 given to <anon>; repeat_count is not of type number"
    -
- -
-
- - Common.player_return (value[, colour=defines.colour.white[, player=game.player]]) -
-
- Will return a value of any type to the player/server console, allows colour for in-game players - - -

Parameters:

-
    -
  • value - any value of any type that will be returned to the player or console -
  • -
  • colour - defines.color or string - the colour of the text for the player, ignored when printing to console - (default defines.colour.white) -
  • -
  • player - LuaPlayer - the player that return will go to, if no game.player then returns to server - (default game.player) -
  • -
- - - - -

Usage:

-
    -
  • player_return('Hello, World!') -- returns 'Hello, World!' to game.player or server console
  • -
  • player_return('Hello, World!','green') -- returns 'Hello, World!' to game.player with colour green or server console
  • -
  • player_return('Hello, World!',nil,player) -- returns 'Hello, World!' to the given player
  • -
- -
-
- - Common.write_json (path, tbl) -
-
- Writes a table object to a file in json format - - -

Parameters:

-
    -
  • path - string - the path of the file to write include / to use dir -
  • -
  • tbl - table - the table that will be converted to a json string and wrote to file -
  • -
- - - - - -
-
- - Common.opt_require (path) -
-
- Calls a require that will not error if the file is not found - - -

Parameters:

-
    -
  • path - string - the path that you want to require -
  • -
- -

Returns:

-
    - - the returns from that file or nil, error if not loaded -
- - - -

Usage:

-
    -
    local file = opt_require('file.not.present') -- will not cause any error
    -
- -
-
- - Common.ext_require (path, ...) -
-
- Calls a require and returns only the keys given, file must return a table - - -

Parameters:

-
    -
  • path - string - the path that you want to require -
  • -
  • ... - string - the name of the keys that you want returned -
  • -
- -

Returns:

-
    - - the keys in the order given -
- - - -

Usage:

-
    -
    local extract, param_check = ext_require('expcore.common','extract','param_check')
    -
- -
-
- - Common.format_time (ticks, options) -
-
- Formats tick into a clean format, denominations from highest to lowest - long will use words rather than letters - time will use : separates - string will return a string not a locale string - when a denomination is false it will overflow into the next one - - -

Parameters:

-
    -
  • ticks - number - the number of ticks that represents a time -
  • -
  • options - table - table a of options to use for the format -
  • -
- -

Returns:

-
    - - string - a locale string that can be used -
- - - - -
-
- - Common.move_items (items[, surface=navies[, position={0[, radius=32[, chest_type=iron-chest]]]]) -
-
- Moves items to the position and stores them in the closest entity of the type given - - -

Parameters:

-
    -
  • items - table - items which are to be added to the chests, ['name']=count -
  • -
  • surface - LuaSurface - the surface that the items will be moved to - (default navies) -
  • -
  • position - table - the position that the items will be moved to {x=100,y=100} - (default {0) -
  • -
  • radius - number - the radius in which the items are allowed to be placed - (default 32) -
  • -
  • chest_type - string - the chest type that the items should be moved into - (default iron-chest) -
  • -
- - - - - -
-
- - Common.print_grid_value (value, surface, position, scale, offset, immutable) -
-
- https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4a2/map_gen/maps/diggy/debug.lua#L31 - Prints a colored value on a location. - - -

Parameters:

-
    -
  • value - between -1 and 1 -
  • -
  • surface - LuaSurface -
  • -
  • position - Position {x, y} -
  • -
  • scale - float -
  • -
  • offset - float -
  • -
  • immutable - bool if immutable, only set, never do a surface lookup, values never change -
  • -
- - - - - -
-
- - Common.print_colored_grid_value (value, surface, position, offset, immutable, color_value, base_color, delta_color, under_bound, over_bound) -
-
- Prints a colored value on a location. When given a color_value and a delta_color, - will change the color of the text from the base to base + value * delta. This will - make the color of the text range from 'base_color' to 'base_color + delta_color' - as the color_value ranges from 0 to 1 - - -

Parameters:

-
    -
  • value - of number to be displayed -
  • -
  • surface - LuaSurface -
  • -
  • position - Position {x, y} -
  • -
  • offset - float position offset -
  • -
  • immutable - bool if immutable, only set, never do a surface lookup, values never change -
  • -
  • color_value - float How far along the range of values of colors the value is to be displayed -
  • -
  • base_color - {r,g,b} The color for the text to be if color_value is 0 -
  • -
  • delta_color - {r,g,b} The amount to correct the base_color if color_value is 1 -
  • -
  • under_bound - {r,g,b} The color to be used if color_value < 0 -
  • -
  • over_bound - {r,g,b} The color to be used if color_value > 1 -
  • -
- - - - - -
-
- - Common.clear_flying_text (surface) -
-
- Clears all flying text entites on a surface - - -

Parameters:

-
    -
  • surface - LuaSurface - the surface to clear -
  • -
- - - - - -
-
- - Common.string_contains (s, contains) -
-
- Tests if a string contains a given substring. - - -

Parameters:

-
    -
  • s - string - the string to check for the substring -
  • -
  • contains - string - the substring to test for -
  • -
- -

Returns:

-
    - - boolean - true if the substring was found in the string -
- - - - -
-
- - Common.extract_keys (tbl, ...) -
-
- Extracts certain keys from a table - - -

Parameters:

-
    -
  • tbl - table - table the which contains the keys -
  • -
  • ... - string - the names of the keys you want extracted -
  • -
- -

Returns:

-
    - - the keys in the order given -
- - - -

Usage:

-
    -
    local key_three, key_one = extract({key_one='foo',key_two='bar',key_three=true},'key_three','key_one')
    -
- -
-
- - Common.enum (tbl) -
-
- Converts a table to an enum - - -

Parameters:

-
    -
  • tbl - table - table the that will be converted -
  • -
- -

Returns:

-
    - - table - the new table that acts like an enum -
- - - - -
-
- - Common.auto_complete (options, input[, use_key=false[, rtn_key=false]]) -
-
- Returns the closest match to the input - - -

Parameters:

-
    -
  • options - table - table a of options for the auto complete -
  • -
  • input - string - string the input that will be completed -
  • -
  • use_key - boolean - when true the keys of options will be used as the options - (default false) -
  • -
  • rtn_key - boolean - when true the the key will be returned rather than the value - (default false) -
  • -
- -

Returns:

-
    - - the list item found that matches the input -
- - - - -
-
- - Common.table_keys (tbl) -
-
- Returns all the keys of a table - - -

Parameters:

-
    -
  • tbl - table - table the to get the keys of -
  • -
- -

Returns:

-
    - - table - an array of the table keys -
- - - - -
-
- - Common.table_values (tbl) -
-
- Returns all the values of a table - - -

Parameters:

-
    -
  • tbl - table - table the to get the values of -
  • -
- -

Returns:

-
    - - table - an array of the table values -
- - - - -
-
- - Common.table_alphanumsort (tbl) -
-
- Returns the list is a sorted way that would be expected by people (this is by key) - - -

Parameters:

-
    -
  • tbl - table - the table to be sorted -
  • -
- -

Returns:

-
    - - table - the sorted table -
- - - - -
-
- - Common.table_keysort (tbl) -
-
- Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above) - - -

Parameters:

-
    -
  • tbl - table - the table to be sorted -
  • -
- -

Returns:

-
    - - table - the sorted table -
- - - - -
-
- - Common.format_chat_colour (message, color) -
-
- Returns a message with valid chat tags to change its colour - - -

Parameters:

-
    -
  • message - string - the message that will be in the output -
  • -
  • color - table - a color which contains r,g,b as its keys -
  • -
- -

Returns:

-
    - - string - the message with the color tags included -
- - - - -
-
- - Common.format_chat_colour_localized (message, color) -
-
- Returns a message with valid chat tags to change its colour, using localization - - -

Parameters:

-
    -
  • message - string or table - the message that will be in the output -
  • -
  • color - table - a color which contains r,g,b as its keys -
  • -
- -

Returns:

-
    - - table - the message with the color tags included -
- - - - -
-
- - Common.format_chat_player_name (player[, raw_string=false]) -
-
- Returns the players name in the players color - - -

Parameters:

-
    -
  • player - LuaPlayer - the player to use the name and color of -
  • -
  • raw_string - boolean - when true a is returned rather than a localized string - (default false) -
  • -
- -

Returns:

-
    - - table - the players name with tags for the players color -
- - - - -
-
- - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/expcore.gui.core.html b/doc/modules/expcore.gui.core.html deleted file mode 100644 index 523bda7b..00000000 --- a/doc/modules/expcore.gui.core.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module expcore.gui.core

-

Core gui file for making element defines and element classes (use require 'expcore.gui') - see utils.gui for event handlering - see expcore.gui.test for examples for element defines -[[

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/expcore.gui.html b/doc/modules/expcore.gui.html deleted file mode 100644 index 810d6e38..00000000 --- a/doc/modules/expcore.gui.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module expcore.gui

-

This file is used to require all the different elements of the gui module - each module has an outline here but for more details see their seperate files in ./gui

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/expcore.gui.instances.html b/doc/modules/expcore.gui.instances.html deleted file mode 100644 index b379c6a8..00000000 --- a/doc/modules/expcore.gui.instances.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - - -
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/expcore.gui.test.html b/doc/modules/expcore.gui.test.html deleted file mode 100644 index be35af41..00000000 --- a/doc/modules/expcore.gui.test.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module expcore.gui.test

-

This file creates a teste gui that is used to test every input method - note that this does not cover every permutation only features in indepentance - for example store in most cases is just by player name, but other store methods are tested with checkbox

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/expcore.permission_groups.html b/doc/modules/expcore.permission_groups.html deleted file mode 100644 index 33781f3f..00000000 --- a/doc/modules/expcore.permission_groups.html +++ /dev/null @@ -1,660 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module expcore.permission_groups

-

Permission group making for factorio so you never have to make one by hand again

-

-[[

-

Info:

-
    -
  • Author: Cooldude2606
  • -
- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Permissions_Groups.new_group (name)Defines a new permission group that can have it actions set in the config
Permissions_Groups.get_group_by_name (name)Returns the group with the given name, case sensitive
Permissions_Groups.get_group_from_player (player)Returns the group that a player is in
Permissions_Groups.reload_permissions ()Reloads/creates all permission groups and sets them to they configured state
Permissions_Groups.lockdown_permissions (exempt)Removes all permissions from every permission group except for "Default" and any passed as exempt
Permissions_Groups.set_player_group (player, group)Sets a player's group to the one given, a player can only have one group at a time
Permissions_Groups._prototype:set_action (action, state)Sets the allow state of an action for this group, used internally but is safe to use else where
Permissions_Groups._prototype:allow (actions)Sets an action or actions to be allowed for this group even with disallow_all triggered, Do not use in runtime
Permissions_Groups._prototype:disallow (actions)Sets an action or actions to be disallowed for this group even with allow_all triggered, Do not use in runtime
Permissions_Groups._prototype:allow_all ()Sets the default state for any actions not given to be allowed, useful with :disallow
Permissions_Groups._prototype:disallow_all ()Sets the default state for any action not given to be disallowed, useful with :allow
Permissions_Groups._prototype:is_allowed (action)Returns if an input action is allowed for this group
Permissions_Groups._prototype:get_raw ()Returns the LuaPermissionGroup that was created with this group object, used internally
Permissions_Groups._prototype:create ()Creates or updates the permission group with the configured actions, used internally
Permissions_Groups._prototype:add_player (player)Adds a player to this group
Permissions_Groups._prototype:remove_player (player)Removes a player from this group
Permissions_Groups._prototype:get_players ([online])Returns all player that are in this group with the option to filter to online/offline only
Permissions_Groups._prototype:print (message)Prints a message to every player in this group
- -
-
- - -

Functions

- -
-
- - Permissions_Groups.new_group (name) -
-
- Defines a new permission group that can have it actions set in the config - - -

Parameters:

-
    -
  • name - string - the name of the new group -
  • -
- -

Returns:

-
    - - Permissions_Groups._prototype - the new group made with function to allow and disallow actions -
- - - - -
-
- - Permissions_Groups.get_group_by_name (name) -
-
- Returns the group with the given name, case sensitive - - -

Parameters:

-
    -
  • name - string - the name of the group to get -
  • -
- -

Returns:

-
    - - Permissions_Groups._prototype or nil - the group with that name or nil if non found -
- - - - -
-
- - Permissions_Groups.get_group_from_player (player) -
-
- Returns the group that a player is in - - -

Parameters:

-
    -
  • player - LuaPlayer - the player to get the group of can be name index etc -
  • -
- -

Returns:

-
    - - Permissions_Groups._prototype or nil - the group with that player or nil if non found -
- - - - -
-
- - Permissions_Groups.reload_permissions () -
-
- Reloads/creates all permission groups and sets them to they configured state - - - - - - - -
-
- - Permissions_Groups.lockdown_permissions (exempt) -
-
- Removes all permissions from every permission group except for "Default" and any passed as exempt - - -

Parameters:

-
    -
  • exempt - string or Array - groups that you want to be except, "Default" is always exempt -
  • -
- -

Returns:

-
    - - number - the number of groups that had they permissions removed -
- - - - -
-
- - Permissions_Groups.set_player_group (player, group) -
-
- Sets a player's group to the one given, a player can only have one group at a time - - -

Parameters:

-
    -
  • player - LuaPlayer - the player to effect can be name index etc -
  • -
  • group - string - the name of the group to give to the player -
  • -
- -

Returns:

-
    - - boolean - true if the player was added successfully, false other wise -
- - - - -
-
- - Permissions_Groups._prototype:set_action (action, state) -
-
- Sets the allow state of an action for this group, used internally but is safe to use else where - - -

Parameters:

-
    -
  • action - string or defines.input_action - the action that you want to set the state of -
  • -
  • state - boolean - the state that you want to set it to, true = allow, false = disallow -
  • -
- -

Returns:

-
    - - Permissions_Groups._prototype - returns self so function can be chained -
- - - - -
-
- - Permissions_Groups._prototype:allow (actions) -
-
- Sets an action or actions to be allowed for this group even with disallow_all triggered, Do not use in runtime - - -

Parameters:

-
    -
  • actions - string or Array - the action or actions that you want to allow for this group -
  • -
- -

Returns:

-
    - - Permissions_Groups._prototype - returns self so function can be chained -
- - - - -
-
- - Permissions_Groups._prototype:disallow (actions) -
-
- Sets an action or actions to be disallowed for this group even with allow_all triggered, Do not use in runtime - - -

Parameters:

-
    -
  • actions - string or Array - the action or actions that you want to disallow for this group -
  • -
- -

Returns:

-
    - - Permissions_Groups._prototype - returns self so function can be chained -
- - - - -
-
- - Permissions_Groups._prototype:allow_all () -
-
- Sets the default state for any actions not given to be allowed, useful with :disallow - - - -

Returns:

-
    - - Permissions_Groups._prototype - returns self so function can be chained -
- - - - -
-
- - Permissions_Groups._prototype:disallow_all () -
-
- Sets the default state for any action not given to be disallowed, useful with :allow - - - -

Returns:

-
    - - Permissions_Groups._prototype - returns self so function can be chained -
- - - - -
-
- - Permissions_Groups._prototype:is_allowed (action) -
-
- Returns if an input action is allowed for this group - - -

Parameters:

-
    -
  • action - string or defines.input_action - the action that you want to test for -
  • -
- -

Returns:

-
    - - boolean - true if the group is allowed the action, false other wise -
- - - - -
-
- - Permissions_Groups._prototype:get_raw () -
-
- Returns the LuaPermissionGroup that was created with this group object, used internally - - - -

Returns:

-
    - - LuaPermissionGroup - the raw lua permission group -
- - - - -
-
- - Permissions_Groups._prototype:create () -
-
- Creates or updates the permission group with the configured actions, used internally - - - -

Returns:

-
    - - LuaPermissionGroup - the permission group that was created -
- - - - -
-
- - Permissions_Groups._prototype:add_player (player) -
-
- Adds a player to this group - - -

Parameters:

-
    -
  • player - LuaPlayer - LuaPlayer the player you want to add to this group can be name or index etc -
  • -
- -

Returns:

-
    - - boolean - true if the player was added successfully, false other wise -
- - - - -
-
- - Permissions_Groups._prototype:remove_player (player) -
-
- Removes a player from this group - - -

Parameters:

-
    -
  • player - LuaPlayer - LuaPlayer the player you want to remove from this group can be name or index etc -
  • -
- -

Returns:

-
    - - boolean - true if the player was removed successfully, false other wise -
- - - - -
-
- - Permissions_Groups._prototype:get_players ([online]) -
-
- Returns all player that are in this group with the option to filter to online/offline only - - -

Parameters:

-
    -
  • online - boolean - if nil returns all players, if true online players only, if false returns online players only - (optional) -
  • -
- -

Returns:

-
    - - table - a table of players that are in this group; filtered if online param is given -
- - - - -
-
- - Permissions_Groups._prototype:print (message) -
-
- Prints a message to every player in this group - - -

Parameters:

-
    -
  • message - string - the message that you want to send to the players -
  • -
- -

Returns:

-
    - - number - the number of players that received the message -
- - - - -
-
- - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/expcore.roles.html b/doc/modules/expcore.roles.html deleted file mode 100644 index 493741d1..00000000 --- a/doc/modules/expcore.roles.html +++ /dev/null @@ -1,1307 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module expcore.roles

-

Factorio role system to manage custom permissions

-

-[[

-

Info:

-
    -
  • Author: Cooldude2606
  • -
- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Roles.debug ()Returns a string which contains all roles in index order displaying all data for them
Roles.print_to_roles (roles, message)Prints a message to all players in the given roles, may send duplicate message however factorio blocks spam
Roles.print_to_roles_higher (role, message)Prints a message to all players who have the given role or one which is higher (excluding default)
Roles.print_to_roles_lower (role, message)Prints a message to all players who have the given role or one which is lower (excluding default)
Roles.get_role_by_name (name)Get a role for the given name
Roles.get_role_by_order (index)Get a role with the given order index
Roles.get_role_from_any (any)Gets a role from a name,index or role object (where it is just returned) - nb: this function is used for the input for most outward facing functions
Roles.get_player_roles (player)Gets all the roles of the given player, this will always contain the default role
Roles.get_player_highest_role (player)Gets the highest role which the player has, can be used to compeer one player to another
Roles.assign_player (player, roles[, by_player_name=[, silent=false]])Gives a player the given role(s) with an option to pass a by player name used in the log
Roles.unassign_player (player, roles[, by_player_name=[, silent=false]])Removes a player from the given role(s) with an option to pass a by player name used in the log
Roles.override_player_roles (roles)Overrides all player roles with the given table of roles, useful to mass set roles on game start
Roles.player_has_role (player, search_role)A test for weather a player has the given role
Roles.player_has_flag (player, flag_name)A test for weather a player has the given flag true for at least one of they roles
Roles.player_allowed (player, action)A test for weather a player has at least one role which is allowed the given action
Roles.define_role_order (order)Used to set the role order, higher in the list is better, must be called at least once in config - nb: function also re links parents due to expected position in the config file
Roles.define_flag_trigger (name, callback)Defines a new trigger for when a tag is added or removed from a player
Roles.set_default (name)Sets the default role which every player will have, this needs to be called at least once
Roles.set_root (name)Sets the root role which will always have all permissions, any server actions act from this role
Roles.new_role (name[, short_hand=name])Defines a new role and returns the prototype to allow configuration
Roles._prototype:set_allow_all ([state=true])Sets the default allow state of the role, true will allow all actions
Roles._prototype:allow (actions)Sets the allow actions for this role, actions in this list will be allowed for this role
Roles._prototype:disallow (actions)Sets the disallow actions for this role, will prevent actions from being allowed regardless of inheritance
Roles._prototype:is_allowed (action)Test for if a role is allowed the given action, mostly internal see Roles.player_allowed
Roles._prototype:set_flag (name[, value=true])Sets the state of a flag for a role, flags can be used to apply effects to players
Roles._prototype:clear_flags ()Clears all flags from this role, individual flags can be removed with set_flag(name,false)
Roles._prototype:has_flag (name)A test for if the role has a flag set
Roles._prototype:set_custom_tag (tag)Sets a custom player tag for the role, can be accessed by other code
Roles._prototype:set_custom_color (color)Sets a custom colour for the role, can be accessed by other code
Roles._prototype:set_permission_group (name[, use_factorio_api=false])Sets the permission group for this role, players will be moved to the group of they highest role
Roles._prototype:set_parent (role)Sets the parent for a role, any action not in allow or disallow will be looked for in its parents - nb: this is a recursive action, and changing the allows and disallows will effect all children roles
Roles._prototype:set_auto_promote_condition (callback)Sets an auto promote condition that is checked every 5 seconds, if true is returned then the player will recive the role - nb: this is one way, failing false after already gaining the role will not revoke the role
Roles._prototype:set_block_auto_promote ([state=true])Sets the role to not allow players to have auto promote effect them, useful to keep people locked to a punishment
Roles._prototype:add_player (player, skip_check, skip_event)Adds a player to this role, players can have more than one role at a time, used internally see Roles.assign
Roles._prototype:remove_player (player, skip_check, skip_event)Removes a player from this role, players can have more than one role at a time, used internally see Roles.unassign
Roles._prototype:get_players ([online=nil])Returns an array of all the players who have this role, can be filtered by online status
Roles._prototype:print (message)Will print a message to all players with this role
- -
-
- - -

Functions

- -
-
- - Roles.debug () -
-
- Returns a string which contains all roles in index order displaying all data for them - - - -

Returns:

-
    - - string - the debug output string -
- - - - -
-
- - Roles.print_to_roles (roles, message) -
-
- Prints a message to all players in the given roles, may send duplicate message however factorio blocks spam - - -

Parameters:

-
    -
  • roles - table - table a of roles which to send the message to -
  • -
  • message - string - the message to send to the players -
  • -
- - - - - -
-
- - Roles.print_to_roles_higher (role, message) -
-
- Prints a message to all players who have the given role or one which is higher (excluding default) - - -

Parameters:

-
    -
  • role - string - the name of the role to send the message to -
  • -
  • message - string - the message to send to the players -
  • -
- - - - - -
-
- - Roles.print_to_roles_lower (role, message) -
-
- Prints a message to all players who have the given role or one which is lower (excluding default) - - -

Parameters:

-
    -
  • role - string - the name of the role to send the message to -
  • -
  • message - string - the message to send to the players -
  • -
- - - - - -
-
- - Roles.get_role_by_name (name) -
-
- Get a role for the given name - - -

Parameters:

-
    -
  • name - string - the name of the role to get -
  • -
- -

Returns:

-
    - - Roles._prototype - the role with that name or nil -
- - - - -
-
- - Roles.get_role_by_order (index) -
-
- Get a role with the given order index - - -

Parameters:

-
    -
  • index - number - the place in the oder list of the role to get -
  • -
- -

Returns:

-
    - - Roles._prototype - the role with that index in the order list or nil -
- - - - -
-
- - Roles.get_role_from_any (any) -
-
- Gets a role from a name,index or role object (where it is just returned) - nb: this function is used for the input for most outward facing functions - - -

Parameters:

-
    -
  • any - number, string or table - the value used to find the role -
  • -
- -

Returns:

-
    - - Roles._prototype - the role that was found or nil see above -
- - - - -
-
- - Roles.get_player_roles (player) -
-
- Gets all the roles of the given player, this will always contain the default role - - -

Parameters:

-
    -
  • player - LuaPlayer - the player to get the roles of -
  • -
- -

Returns:

-
    - - table - a table where the values are the roles which the player has -
- - - - -
-
- - Roles.get_player_highest_role (player) -
-
- Gets the highest role which the player has, can be used to compeer one player to another - - -

Parameters:

-
    -
  • player - LuaPlayer - the player to get the highest role of -
  • -
- -

Returns:

-
    - - the - role with the highest order index which this player has -
- - - - -
-
- - Roles.assign_player (player, roles[, by_player_name=[, silent=false]]) -
-
- Gives a player the given role(s) with an option to pass a by player name used in the log - - -

Parameters:

-
    -
  • player - LuaPlayer - the player that will be assigned the roles -
  • -
  • roles - table - table a of roles that the player will be given, can be one role and can be role names -
  • -
  • by_player_name - string - the name of the player that will be shown in the log - (default ) -
  • -
  • silent - boolean - when true there will be no game message printed - (default false) -
  • -
- - - - - -
-
- - Roles.unassign_player (player, roles[, by_player_name=[, silent=false]]) -
-
- Removes a player from the given role(s) with an option to pass a by player name used in the log - - -

Parameters:

-
    -
  • player - LuaPlayer - the player that will have the roles removed -
  • -
  • roles - table - table a of roles to be removed from the player, can be one role and can be role names -
  • -
  • by_player_name - string - the name of the player that will be shown in the logs - (default ) -
  • -
  • silent - boolean - when true there will be no game message printed - (default false) -
  • -
- - - - - -
-
- - Roles.override_player_roles (roles) -
-
- Overrides all player roles with the given table of roles, useful to mass set roles on game start - - -

Parameters:

-
    -
  • roles - table - table a which is indexed by case sensitive player names and has the value of a table of role names -
  • -
- - - - - -
-
- - Roles.player_has_role (player, search_role) -
-
- A test for weather a player has the given role - - -

Parameters:

-
    -
  • player - LuaPlayer - the player to test the roles of -
  • -
  • search_role - string, number or table - a pointer to the role that is being searched for -
  • -
- -

Returns:

-
    - - boolean - true if the player has the role, false otherwise, nil for errors -
- - - - -
-
- - Roles.player_has_flag (player, flag_name) -
-
- A test for weather a player has the given flag true for at least one of they roles - - -

Parameters:

-
    -
  • player - LuaPlayer - the player to test the roles of -
  • -
  • flag_name - string - the name of the flag that is being looked for -
  • -
- -

Returns:

-
    - - boolean - true if the player has at least one role which has the flag set to true, false otherwise, nil for errors -
- - - - -
-
- - Roles.player_allowed (player, action) -
-
- A test for weather a player has at least one role which is allowed the given action - - -

Parameters:

-
    -
  • player - LuaPlayer - the player to test the roles of -
  • -
  • action - string - the name of the action that is being tested for -
  • -
- -

Returns:

-
    - - boolean - true if the player has at least one role which is allowed this action, false otherwise, nil for errors -
- - - - -
-
- - Roles.define_role_order (order) -
-
- Used to set the role order, higher in the list is better, must be called at least once in config - nb: function also re links parents due to expected position in the config file - - -

Parameters:

-
    -
  • order - table - table a which is keyed only by numbers (start 1) and values are roles in order with highest first -
  • -
- - - - - -
-
- - Roles.define_flag_trigger (name, callback) -
-
- Defines a new trigger for when a tag is added or removed from a player - - -

Parameters:

-
    -
  • name - string - the name of the flag which the roles will have -
  • -
  • callback - function - the function that is called when roles are assigned - flag param - player - the player that has had they roles changed - flag param - state - the state of the flag, aka if the flag is present -
  • -
- - - - - -
-
- - Roles.set_default (name) -
-
- Sets the default role which every player will have, this needs to be called at least once - - -

Parameters:

-
    -
  • name - string - the name of the default role -
  • -
- - - - - -
-
- - Roles.set_root (name) -
-
- Sets the root role which will always have all permissions, any server actions act from this role - - -

Parameters:

-
    -
  • name - string - the name of the root role -
  • -
- - - - - -
-
- - Roles.new_role (name[, short_hand=name]) -
-
- Defines a new role and returns the prototype to allow configuration - - -

Parameters:

-
    -
  • name - string - the name of the new role, must be unique -
  • -
  • short_hand - string - the shortened version of the name - (default name) -
  • -
- -

Returns:

-
    - - Roles._prototype - the start of the config chain for this role -
- - - - -
-
- - Roles._prototype:set_allow_all ([state=true]) -
-
- Sets the default allow state of the role, true will allow all actions - - -

Parameters:

-
    -
  • state - boolean - true will allow all actions - (default true) -
  • -
- -

Returns:

-
    - - Roles._prototype - allows chaining -
- - - - -
-
- - Roles._prototype:allow (actions) -
-
- Sets the allow actions for this role, actions in this list will be allowed for this role - - -

Parameters:

-
    -
  • actions - table - indexed with numbers and is an array of action names, order has no effect -
  • -
- -

Returns:

-
    - - Roles._prototype - allows chaining -
- - - - -
-
- - Roles._prototype:disallow (actions) -
-
- Sets the disallow actions for this role, will prevent actions from being allowed regardless of inheritance - - -

Parameters:

-
    -
  • actions - table - indexed with numbers and is an array of action names, order has no effect -
  • -
- -

Returns:

-
    - - Roles._prototype - allows chaining -
- - - - -
-
- - Roles._prototype:is_allowed (action) -
-
- Test for if a role is allowed the given action, mostly internal see Roles.player_allowed - - -

Parameters:

-
    -
  • action - string - the name of the action to test if it is allowed -
  • -
- -

Returns:

-
    - - boolean - true if action is allowed, false otherwise -
- - - - -
-
- - Roles._prototype:set_flag (name[, value=true]) -
-
- Sets the state of a flag for a role, flags can be used to apply effects to players - - -

Parameters:

-
    -
  • name - string - the name of the flag to set the value of -
  • -
  • value - boolean - the state to set the flag to - (default true) -
  • -
- -

Returns:

-
    - - Roles._prototype - allows chaining -
- - - - -
-
- - Roles._prototype:clear_flags () -
-
- Clears all flags from this role, individual flags can be removed with set_flag(name,false) - - - -

Returns:

-
    - - Roles._prototype - allows chaining -
- - - - -
-
- - Roles._prototype:has_flag (name) -
-
- A test for if the role has a flag set - - -

Parameters:

-
    -
  • name - string - the name of the flag to test for -
  • -
- -

Returns:

-
    - - boolean - true if the flag is set, false otherwise -
- - - - -
-
- - Roles._prototype:set_custom_tag (tag) -
-
- Sets a custom player tag for the role, can be accessed by other code - - -

Parameters:

-
    -
  • tag - string - the value that the tag will be -
  • -
- -

Returns:

-
    - - Roles._prototype - allows chaining -
- - - - -
-
- - Roles._prototype:set_custom_color (color) -
-
- Sets a custom colour for the role, can be accessed by other code - - -

Parameters:

-
    -
  • color - table - ?string|table can either be and rgb colour or the name of a colour defined in the presets -
  • -
- -

Returns:

-
    - - Roles._prototype - allows chaining -
- - - - -
-
- - Roles._prototype:set_permission_group (name[, use_factorio_api=false]) -
-
- Sets the permission group for this role, players will be moved to the group of they highest role - - -

Parameters:

-
    -
  • name - string - the name of the permission group to have players moved to -
  • -
  • use_factorio_api - boolean - when true the custom permission group module is ignored - (default false) -
  • -
- -

Returns:

-
    - - Roles._prototype - allows chaining -
- - - - -
-
- - Roles._prototype:set_parent (role) -
-
- Sets the parent for a role, any action not in allow or disallow will be looked for in its parents - nb: this is a recursive action, and changing the allows and disallows will effect all children roles - - -

Parameters:

-
    -
  • role - string - the name of the role that will be the parent; has imminent effect if role is already defined -
  • -
- -

Returns:

-
    - - Roles._prototype - allows chaining -
- - - - -
-
- - Roles._prototype:set_auto_promote_condition (callback) -
-
- Sets an auto promote condition that is checked every 5 seconds, if true is returned then the player will recive the role - nb: this is one way, failing false after already gaining the role will not revoke the role - - -

Parameters:

-
    -
  • callback - function - receives only one param which is player to promote, return true to promote the player -
  • -
- -

Returns:

-
    - - Roles._prototype - allows chaining -
- - - - -
-
- - Roles._prototype:set_block_auto_promote ([state=true]) -
-
- Sets the role to not allow players to have auto promote effect them, useful to keep people locked to a punishment - - -

Parameters:

-
    -
  • state - boolean - when true the players with this role will not be auto promoted - (default true) -
  • -
- -

Returns:

-
    - - Roles._prototype - allows chaining -
- - - - -
-
- - Roles._prototype:add_player (player, skip_check, skip_event) -
-
- Adds a player to this role, players can have more than one role at a time, used internally see Roles.assign - - -

Parameters:

-
    -
  • player - LuaPlayer - the player that will be given this role -
  • -
  • skip_check - boolean - when true player will be taken as the player name (use when player has not yet joined) -
  • -
  • skip_event - boolean - when true the event emit will be skipped, this is used internally with Roles.assign -
  • -
- -

Returns:

-
    - - boolean - true if the player was added successfully -
- - - - -
-
- - Roles._prototype:remove_player (player, skip_check, skip_event) -
-
- Removes a player from this role, players can have more than one role at a time, used internally see Roles.unassign - - -

Parameters:

-
    -
  • player - LuaPlayer - the player that will lose this role -
  • -
  • skip_check - boolean - when true player will be taken as the player name (use when player has not yet joined) -
  • -
  • skip_event - boolean - when true the event emit will be skipped, this is used internally with Roles.unassign -
  • -
- -

Returns:

-
    - - boolean - true if the player was removed successfully -
- - - - -
-
- - Roles._prototype:get_players ([online=nil]) -
-
- Returns an array of all the players who have this role, can be filtered by online status - - -

Parameters:

-
    -
  • online - boolean - when given will filter by this online state, nil will return all players - (default nil) -
  • -
- -

Returns:

-
    - - table - all the players who have this role, indexed order is meaningless -
- - - - -
-
- - Roles._prototype:print (message) -
-
- Will print a message to all players with this role - - -

Parameters:

-
    -
  • message - string - the message that will be printed to the players -
  • -
- -

Returns:

-
    - - number - the number of players who received the message -
- - - - -
-
- - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/expcore.store.html b/doc/modules/expcore.store.html deleted file mode 100644 index 57e11bed..00000000 --- a/doc/modules/expcore.store.html +++ /dev/null @@ -1,464 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module expcore.store

-

Adds an easy way to store and watch for updates to a value -[[

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Store.is_registered (location)Check for if a lcoation is registered
Store.uid_location ()Returns a unqiue name that can be used for a store
Store.register (location, callback[, start_value])Registers a new location with an update callback which is triggered when the value updates
Store.register_synced (location, callback[, start_value])Registers a new cross server synced location with an update callback, and external script is required for cross server
Store.add_watch (location, callback)Adds a function that will be checked every tick for a change in the returned value, when the value changes it will be saved in the store
Store.get (location[, no_error=false])Gets the value stored at a location, this location must be registered
Store.set (location, value)Sets the value at a location, this location must be registered, if server synced it will emit the change to file
Store.get_children (location)Gets all non nil children at a location, children can be added and removed during runtime - this is similar to Store.get but will always return a table even if it is empty
Store.get_child (location, child)Gets the value of the child to a location, children can be added and removed during runtime
Store.set_child (location, child, value)Sets the value of the chlid to a location, children can be added and removed during runtime - when a child is set it will call the update handler of the parent allowing children be to added at runtime - this may be used when a player joins the game and the child is the players name
- -
-
- - -

Functions

- -
-
- - Store.is_registered (location) -
-
- Check for if a lcoation is registered - - -

Parameters:

-
    -
  • location - string - the location to test for -
  • -
- -

Returns:

-
    - - boolean - true if registered -
- - - - -
-
- - Store.uid_location () -
-
- Returns a unqiue name that can be used for a store - - - -

Returns:

-
    - - string - a unqiue name -
- - - - -
-
- - Store.register (location, callback[, start_value]) -
-
- Registers a new location with an update callback which is triggered when the value updates - - -

Parameters:

-
    -
  • location - string - string a unique that points to the data, string used rather than token to allow migration -
  • -
  • callback - function - this callback will be called when the stored value is set to a new value -
  • -
  • start_value - any - this value will be the inital value that is stored at this location - (optional) -
  • -
- - - - - -
-
- - Store.register_synced (location, callback[, start_value]) -
-
- Registers a new cross server synced location with an update callback, and external script is required for cross server - - -

Parameters:

-
    -
  • location - string - string a unique that points to the data, string used rather than token to allow migration -
  • -
  • callback - function - this callback will be called when the stored value is set to a new value -
  • -
  • start_value - any - this value will be the inital value that is stored at this location - (optional) -
  • -
- - - - - -
-
- - Store.add_watch (location, callback) -
-
- Adds a function that will be checked every tick for a change in the returned value, when the value changes it will be saved in the store - - -

Parameters:

-
    -
  • location - string - the location where the data will be saved and compeared to, must already be a registered location -
  • -
  • callback - function - this function will be called every tick to check for a change in value -
  • -
- - - - - -
-
- - Store.get (location[, no_error=false]) -
-
- Gets the value stored at a location, this location must be registered - - -

Parameters:

-
    -
  • location - string - the location to get the data from -
  • -
  • no_error - boolean - when true no error is returned if the location is not registered - (default false) -
  • -
- -

Returns:

-
    - - any - the data which was stored at the location -
- - - - -
-
- - Store.set (location, value) -
-
- Sets the value at a location, this location must be registered, if server synced it will emit the change to file - - -

Parameters:

-
    -
  • location - string - the location to set the data to -
  • -
  • value - any - the new value to set at the location, value may be reverted if there is a watch callback -
  • -
- -

Returns:

-
    - - boolean - true if it was successful -
- - - - -
-
- - Store.get_children (location) -
-
- Gets all non nil children at a location, children can be added and removed during runtime - this is similar to Store.get but will always return a table even if it is empty - - -

Parameters:

-
    -
  • location - string - the location to get the children of -
  • -
- -

Returns:

-
    - - table - a table containg all the children and they values -
- - - - -
-
- - Store.get_child (location, child) -
-
- Gets the value of the child to a location, children can be added and removed during runtime - - -

Parameters:

-
    -
  • location - string - the location of which the child is located -
  • -
  • child - string - the child element to get the value of -
  • -
- -

Returns:

-
    - - any - the value which was stored at that location -
- - - - -
-
- - Store.set_child (location, child, value) -
-
- Sets the value of the chlid to a location, children can be added and removed during runtime - when a child is set it will call the update handler of the parent allowing children be to added at runtime - this may be used when a player joins the game and the child is the players name - - -

Parameters:

-
    -
  • location - string - the location of which the child is located -
  • -
  • child - string - the child element to set the value of -
  • -
  • value - any - the value to set at this location -
  • -
- -

Returns:

-
    - - boolean - true if it was successful -
- - - - -
-
- - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/modules.addons.advanced-start.html b/doc/modules/modules.addons.advanced-start.html deleted file mode 100644 index 771f4611..00000000 --- a/doc/modules/modules.addons.advanced-start.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - - -
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/modules.addons.chat-popups.html b/doc/modules/modules.addons.chat-popups.html deleted file mode 100644 index b7f53d32..00000000 --- a/doc/modules/modules.addons.chat-popups.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module modules.addons.chat-popups

-

Creates flying text entities when a player sends a message in chat - also displays a ping above users who are named in the message

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/modules.addons.damage-popups.html b/doc/modules/modules.addons.damage-popups.html deleted file mode 100644 index 7789ebd5..00000000 --- a/doc/modules/modules.addons.damage-popups.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - - -
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/modules.gui.player-list.html b/doc/modules/modules.gui.player-list.html deleted file mode 100644 index 7fc8957c..00000000 --- a/doc/modules/modules.gui.player-list.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - - -
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/modules.gui.rocket-info.html b/doc/modules/modules.gui.rocket-info.html deleted file mode 100644 index 310b86a0..00000000 --- a/doc/modules/modules.gui.rocket-info.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - - -
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/modules.gui.science-info.html b/doc/modules/modules.gui.science-info.html deleted file mode 100644 index 8df96f38..00000000 --- a/doc/modules/modules.gui.science-info.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - - -
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/modules.gui.task-list.html b/doc/modules/modules.gui.task-list.html deleted file mode 100644 index a14412da..00000000 --- a/doc/modules/modules.gui.task-list.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - - -
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/utils.alien_evolution_progress.html b/doc/modules/utils.alien_evolution_progress.html deleted file mode 100644 index a26633ee..00000000 --- a/doc/modules/utils.alien_evolution_progress.html +++ /dev/null @@ -1,158 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module utils.alien_evolution_progress

-

info - Original (javascript) version: https://hastebin.com/udakacavap.js - Can be tested against: https://wiki.factorio.com/Enemies#Spawn_chances_by_evolution_factor

-

- - -

Functions

- - - - - -
AlienEvolutionProgress.create_spawner_request (total_aliens)Creates the spawner_request structure required for AlienEvolutionProgress.get_aliens for all -available spawners.
- -
-
- - -

Functions

- -
-
- - AlienEvolutionProgress.create_spawner_request (total_aliens) -
-
- Creates the spawner_request structure required for AlienEvolutionProgress.get_aliens for all -available spawners. If dividing the total spawners by the total aliens causes a fraction, the -fraction will decide a chance to spawn. 1 alien for 2 spawners will have 50% on both. - - -

Parameters:

-
    -
  • total_aliens - table -
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/utils.core.html b/doc/modules/utils.core.html deleted file mode 100644 index 41b857d2..00000000 --- a/doc/modules/utils.core.html +++ /dev/null @@ -1,452 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module utils.core

-

Measures distance between pos1 and pos2

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Module.print_except (msg, player, color)Takes msg and prints it to all players except provided player
Module.print_admins (msg, source)Prints a message to all online admins
Module.get_actor ()Returns a valid string with the name of the actor of a command.
Module.format_time (ticks)Takes a time in ticks and returns a string with the time in format "x hour(s) x minute(s)"
Module.cant_run (name)Prints a message letting the player know they cannot run a command
Module.log_command (actor, command, parameters)Logs the use of a command and its user
Module.verify_mult_types (arg, arg_types)Asserts the argument is one of type arg_types
Module.random_RGB ()Returns a random RGB color as a table
Module.set_and_return (tbl, key, value)Sets a table element to value while also returning value.
-

Fields

- - - - - - - - - - - - - -
Module.move_positionMoves a position according to the parameters given - Notice: only accepts cardinal directions as direction
Module.opposite_directionTakes a direction and gives you the opposite
Module.is_module_availableTakes the string of a module and returns whether is it available or not
- -
-
- - -

Functions

- -
-
- - Module.print_except (msg, player, color) -
-
- Takes msg and prints it to all players except provided player - - -

Parameters:

-
    -
  • msg - table if locale is used -
  • -
  • player - the player not to send the message to -
  • -
  • color - the color to use for the message, defaults to white - - - - - - - - -
    - - Module.print_admins (msg, source) -
    -
    - Prints a message to all online admins - - -

    Parameters:

    -
      -
    • msg - table if locale is used -
    • -
    • source - string must be the name of a player, nil for server. -
    • -
    - - - - - -
    -
    - - Module.get_actor () -
    -
    - Returns a valid string with the name of the actor of a command. - - - - - - - -
    -
    - - Module.format_time (ticks) -
    -
    - Takes a time in ticks and returns a string with the time in format "x hour(s) x minute(s)" - - -

    Parameters:

    -
      -
    • ticks - -
    • -
    - - - - - -
    -
    - - Module.cant_run (name) -
    -
    - Prints a message letting the player know they cannot run a command - - -

    Parameters:

    -
      -
    • name - string name of the command -
    • -
    - - - - - -
    -
    - - Module.log_command (actor, command, parameters) -
    -
    - Logs the use of a command and its user - - -

    Parameters:

    -
      -
    • actor - string with the actor's name (usually acquired by calling get_actor) -
    • -
    • command - the command's name as table element -
    • -
    • parameters - the command's parameters as a table (optional) -
    • -
    - - - - - -
    -
    - - Module.verify_mult_types (arg, arg_types) -
    -
    - Asserts the argument is one of type arg_types - - -

    Parameters:

    -
      -
    • arg - the variable to check -
    • -
    • arg_types - the type as a table of sings -
    • -
    - -

    Returns:

    -
      - - boolean -
    - - - - -
    -
    - - Module.random_RGB () -
    -
    - Returns a random RGB color as a table - - - - - - - -
    -
    - - Module.set_and_return (tbl, key, value) -
    -
    - Sets a table element to value while also returning value. - - -

    Parameters:

    -
      -
    • tbl - table to change the element of -
    • -
    • key - string -
    • -
    • value - nil|boolean|number|string|table to set the element to -
    • -
    - -

    Returns:

    -
      - - value -
    - - - - -
    - -

    Fields

    - -
    -
    - - Module.move_position -
    -
    - Moves a position according to the parameters given - Notice: only accepts cardinal directions as direction - - -
      -
    • position -
    table containing a map position - -
  • direction - north, east, south, west -
  • -
  • distance - -
  • - - - - - - - -
    - - Module.opposite_direction -
    -
    - Takes a direction and gives you the opposite - - -
      -
    • direction - north, east, south, west, northeast, northwest, southeast, southwest -
    • -
    - - - - - -
    -
    - - Module.is_module_available -
    -
    - Takes the string of a module and returns whether is it available or not - - -
      -
    • name - the name of the module (ex. 'utils.core') -
    • -
    - - - - - -
    - - - - - -
    -generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
    - - - diff --git a/doc/modules/utils.debug.html b/doc/modules/utils.debug.html deleted file mode 100644 index 2c4eb4aa..00000000 --- a/doc/modules/utils.debug.html +++ /dev/null @@ -1,306 +0,0 @@ - - - - - Reference - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    Debug.print (message, stack_traceback)Shows the given message if debug is enabled.
    Debug.get_meta_value (object, key)Returns the value of the key inside the object - or 'InvalidLuaObject' if the LuaObject is invalid.
    Debug.object_type (object)Returns the Lua data type or the factorio LuaObject type - or 'NoHelpLuaObject' if the LuaObject does not have a help function - or 'InvalidLuaObject' if the LuaObject is invalid.
    Debug.print_position (position, message)Shows the given message if debug is on.
    Debug.cheat (callback)Executes the given callback if cheating is enabled.
    Debug.is_closure (func)Returns true if the function is a closure, false otherwise.
    - -
    -
    - - -

    Functions

    - -
    -
    - - Debug.print (message, stack_traceback) -
    -
    - Shows the given message if debug is enabled. Uses serpent to print non scalars. - - -

    Parameters:

    -
      -
    • message - -
    • -
    • stack_traceback - levels of stack trace to give, defaults to 1 level if nil -
    • -
    - - - - - -
    -
    - - Debug.get_meta_value (object, key) -
    -
    - Returns the value of the key inside the object - or 'InvalidLuaObject' if the LuaObject is invalid. - or 'InvalidLuaObjectKey' if the LuaObject does not have an entry at that key - - -

    Parameters:

    -
      -
    • object - LuaObject or metatable - -
    • key - -
    • - - -

      Returns:

      -
        - - -
      - - - - - -
      - - Debug.object_type (object) -
      -
      - Returns the Lua data type or the factorio LuaObject type - or 'NoHelpLuaObject' if the LuaObject does not have a help function - or 'InvalidLuaObject' if the LuaObject is invalid. - - -

      Parameters:

      -
        -
      • object - -
      • -
      - -

      Returns:

      -
        - - string -
      - - - - -
      -
      - - Debug.print_position (position, message) -
      -
      - Shows the given message if debug is on. - - -

      Parameters:

      -
        -
      • position - Position -
      • -
      • message - string -
      • -
      - - - - - -
      -
      - - Debug.cheat (callback) -
      -
      - Executes the given callback if cheating is enabled. - - -

      Parameters:

      -
        -
      • callback - function -
      • -
      - - - - - -
      -
      - - Debug.is_closure (func) -
      -
      - Returns true if the function is a closure, false otherwise. - A closure is a function that contains 'upvalues' or in other words - has a reference to a local variable defined outside the function's scope. - - -

      Parameters:

      -
        -
      • func - -
      • -
      - -

      Returns:

      -
        - - boolean -
      - - - - -
      - - - - - -
      -generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
      - - - diff --git a/doc/modules/utils.event.html b/doc/modules/utils.event.html deleted file mode 100644 index 2a9f5538..00000000 --- a/doc/modules/utils.event.html +++ /dev/null @@ -1,568 +0,0 @@ - - - - - Reference - - - - -
      - -
      - -
      -
      -
      - - -
      - - - - - - -
      - -

      Module utils.event

      -

      This Module allows for registering multiple handlers to the same event, overcoming the limitation of script.register.

      -

      -

      ** Event.add(event_name, handler) ** -

      Handlers added with Event.add must be added at the control stage or in Event.on_init or Event.on_load. - Remember that for each player, on_init or on_load is run, never both. So if you can't add the handler in the - control stage add the handler in both on_init and on_load. - Handlers added with Event.add cannot be removed. - For handlers that need to be removed or added at runtime use Event.add_removable.

      -

      Usage:

      -
        -
      • - local Event = require 'utils.event'
        - Event.add(
        -     defines.events.on_built_entity,
        -     function(event)
        -         game.print(serpent.block(event)) -- prints the content of the event table to console.
        -     end
        - )
        -
        - ** Event.add_removable(event_name, token) **
        -
        - For conditional event handlers. Event.add_removable can be safely called at runtime without desync risk.
        - Only use this if you need to add the handler at runtime or need to remove the handler, otherwise use Event.add
        -
        - Event.add_removable can be safely used at the control stage or in Event.on_init. If used in on_init you don't
        - need to also add in on_load (unlike Event.add).
        - Event.add_removable cannot be called in on_load, doing so will crash the game on loading.
        - Token is used because it's a desync risk to store closures inside the global table.
        -
      • -
      • - local Token = require 'utils.token'
        - local Event = require 'utils.event'
        -
        - Token.register must not be called inside an event handler.
        - local handler =
        -     Token.register(
        -     function(event)
        -         game.print(serpent.block(event)) -- prints the content of the event table to console.
        -     end
        - )
        -
        - The below code would typically be inside another event or a custom command.
        - Event.add_removable(defines.events.on_built_entity, handler)
        -
        - When you no longer need the handler.
        - Event.remove_removable(defines.events.on_built_entity, handler)
        -
        - It's not an error to register the same token multiple times to the same event, however when
        - removing only the first occurrence is removed.
        -
        - ** Event.add_removable_function(event_name, func) **
        -
        - Only use this function if you can't use Event.add_removable. i.e you are registering the handler at the console.
        - The same restrictions that apply to Event.add_removable also apply to Event.add_removable_function.
        - func cannot be a closure in this case, as there is no safe way to store closures in the global table.
        - A closure is a function that uses a local variable not defined in the function.
        -
      • -
      • - local Event = require 'utils.event'
        -
        - If you want to remove the handler you will need to keep a reference to it.
        - global.handler = function(event)
        -     game.print(serpent.block(event)) -- prints the content of the event table to console.
        - end
        -
        - The below code would typically be used at the command console.
        - Event.add_removable_function(defines.events.on_built_entity, global.handler)
        -
        - When you no longer need the handler.
        - Event.remove_removable_function(defines.events.on_built_entity, global.handler)
        -
        - ** Other Events **
        -
        - Use Event.on_init(handler) for script.on_init(handler)
        - Use Event.on_load(handler) for script.on_load(handler)
        -
        - Use Event.on_nth_tick(tick, handler) for script.on_nth_tick(tick, handler)
        - Favour this event over Event.add(defines.events.on_tick, handler)
        - There are also Event.add_removable_nth_tick(tick, token) and Event.add_removable_nth_tick_function(tick, func)
        - That work the same as above.
        -
        - ** Custom Scenario Events **
        -
        - local Event = require 'utils.event'
        -
        - local event_id = script.generate_event_name()
        -
        - Event.add(
        -     event_id,
        -     function(event)
        -         game.print(serpent.block(event)) -- prints the content of the event table to console.
        -     end
        - )
        -
        - The table contains extra information that you want to pass to the handler.
        - script.raise_event(event_id, {extra = 'data'})
      • -
      - - -

      Functions

      -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Event.add (event_name, handler)Register a handler for the event_name event.
      Event.on_init (handler)Register a handler for the script.on_init event.
      Event.on_load (handler)Register a handler for the script.on_load event.
      Event.on_nth_tick (tick, handler)Register a handler for the nth_tick event.
      Event.add_removable (event_name, token)Register a token handler that can be safely added and removed at runtime.
      Event.remove_removable (event_name, token)Removes a token handler for the given event_name.
      Event.add_removable_function (event_name, func)Register a handler that can be safely added and removed at runtime.
      Event.remove_removable_function (event_name, func)Removes a handler for the given event_name.
      Event.add_removable_nth_tick (tick, token)Register a token handler for the nth tick that can be safely added and removed at runtime.
      Event.remove_removable_nth_tick (tick, token)Removes a token handler for the nth tick.
      Event.add_removable_nth_tick_function (tick, func)Register a handler for the nth tick that can be safely added and removed at runtime.
      Event.remove_removable_nth_tick_function (tick, func)Removes a handler for the nth tick.
      - -
      -
      - - -

      Functions

      - -
      -
      - - Event.add (event_name, handler) -
      -
      - Register a handler for the event_name event. - This function must be called in the control stage or in Event.on_init or Event.on_load. - See documentation at top of file for details on using events. - - -

      Parameters:

      -
        -
      • event_name - -
      • -
      • handler - -
      • -
      - - - - - -
      -
      - - Event.on_init (handler) -
      -
      - Register a handler for the script.on_init event. - This function must be called in the control stage or in Event.on_init or Event.on_load - See documentation at top of file for details on using events. - - -

      Parameters:

      -
        -
      • handler - -
      • -
      - - - - - -
      -
      - - Event.on_load (handler) -
      -
      - Register a handler for the script.on_load event. - This function must be called in the control stage or in Event.on_init or Event.on_load - See documentation at top of file for details on using events. - - -

      Parameters:

      -
        -
      • handler - -
      • -
      - - - - - -
      -
      - - Event.on_nth_tick (tick, handler) -
      -
      - Register a handler for the nth_tick event. - This function must be called in the control stage or in Event.on_init or Event.on_load. - See documentation at top of file for details on using events. - - -

      Parameters:

      -
        -
      • tick - The handler will be called every nth tick -
      • -
      • handler - -
      • -
      - - - - - -
      -
      - - Event.add_removable (event_name, token) -
      -
      - Register a token handler that can be safely added and removed at runtime. - Do NOT call this method during on_load. - See documentation at top of file for details on using events. - - -

      Parameters:

      -
        -
      • event_name - -
      • -
      • token - -
      • -
      - - - - - -
      -
      - - Event.remove_removable (event_name, token) -
      -
      - Removes a token handler for the given event_name. - Do NOT call this method during on_load. - See documentation at top of file for details on using events. - - -

      Parameters:

      -
        -
      • event_name - -
      • -
      • token - -
      • -
      - - - - - -
      -
      - - Event.add_removable_function (event_name, func) -
      -
      - Register a handler that can be safely added and removed at runtime. - The handler must not be a closure, as that is a desync risk. - Do NOT call this method during on_load. - See documentation at top of file for details on using events. - - -

      Parameters:

      -
        -
      • event_name - -
      • -
      • func - -
      • -
      - - - - - -
      -
      - - Event.remove_removable_function (event_name, func) -
      -
      - Removes a handler for the given event_name. - Do NOT call this method during on_load. - See documentation at top of file for details on using events. - - -

      Parameters:

      -
        -
      • event_name - -
      • -
      • func - -
      • -
      - - - - - -
      -
      - - Event.add_removable_nth_tick (tick, token) -
      -
      - Register a token handler for the nth tick that can be safely added and removed at runtime. - Do NOT call this method during on_load. - See documentation at top of file for details on using events. - - -

      Parameters:

      -
        -
      • tick - -
      • -
      • token - -
      • -
      - - - - - -
      -
      - - Event.remove_removable_nth_tick (tick, token) -
      -
      - Removes a token handler for the nth tick. - Do NOT call this method during on_load. - See documentation at top of file for details on using events. - - -

      Parameters:

      -
        -
      • tick - -
      • -
      • token - -
      • -
      - - - - - -
      -
      - - Event.add_removable_nth_tick_function (tick, func) -
      -
      - Register a handler for the nth tick that can be safely added and removed at runtime. - The handler must not be a closure, as that is a desync risk. - Do NOT call this method during on_load. - See documentation at top of file for details on using events. - - -

      Parameters:

      -
        -
      • tick - -
      • -
      • func - -
      • -
      - - - - - -
      -
      - - Event.remove_removable_nth_tick_function (tick, func) -
      -
      - Removes a handler for the nth tick. - Do NOT call this method during on_load. - See documentation at top of file for details on using events. - - -

      Parameters:

      -
        -
      • tick - -
      • -
      • func - -
      • -
      - - - - - -
      -
      - - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/utils.event_core.html b/doc/modules/utils.event_core.html deleted file mode 100644 index c0f45322..00000000 --- a/doc/modules/utils.event_core.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module utils.event_core

-

Do not use this function, use Event.add instead as it has safety checks.

-

- - -

Functions

- - - - - - - - - - - - - -
Public.on_init (handler)Do not use this function, use Event.on_init instead as it has safety checks.
Public.on_load (handler)Do not use this function, use Event.on_load instead as it has safety checks.
Public.on_nth_tick (tick, handler)Do not use this function, use Event.on_nth_tick instead as it has safety checks.
- -
-
- - -

Functions

- -
-
- - Public.on_init (handler) -
-
- Do not use this function, use Event.on_init instead as it has safety checks. - - -

Parameters:

-
    -
  • handler - -
  • -
- - - - - -
-
- - Public.on_load (handler) -
-
- Do not use this function, use Event.on_load instead as it has safety checks. - - -

Parameters:

-
    -
  • handler - -
  • -
- - - - - -
-
- - Public.on_nth_tick (tick, handler) -
-
- Do not use this function, use Event.on_nth_tick instead as it has safety checks. - - -

Parameters:

-
    -
  • tick - -
  • -
  • handler - -
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/utils.math.html b/doc/modules/utils.math.html deleted file mode 100644 index 2760964b..00000000 --- a/doc/modules/utils.math.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module utils.math

-

Takes two points and calculates the slope of a line

-

- - -

Functions

- - - - - -
calculate_y_intercept (x, slope)Calculates the y-intercept of a line
- -
-
- - -

Functions

- -
-
- - calculate_y_intercept (x, slope) -
-
- Calculates the y-intercept of a line - - -

Parameters:

-
    -
  • x - , y numbers - coordinates of point on line -
  • -
  • slope - number - the slope of a line -
  • -
- -

Returns:

-
    - - number - the y-intercept of a line -
- - - - -
-
- - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/utils.recipe_locker.html b/doc/modules/utils.recipe_locker.html deleted file mode 100644 index 756989d6..00000000 --- a/doc/modules/utils.recipe_locker.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module utils.recipe_locker

-

Locks recipes, preventing them from being enabled by research.

-

- Does not check if they should be enabled/disabled by existing research.

- - -

Functions

- - - - - -
Public.unlock_recipes (tbl)Unlocks recipes, allowing them to be enabled by research.
- -
-
- - -

Functions

- -
-
- - Public.unlock_recipes (tbl) -
-
- Unlocks recipes, allowing them to be enabled by research. - Does not check if they should be enabled/disabled by existing research. - - -

Parameters:

-
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/utils.table.html b/doc/modules/utils.table.html deleted file mode 100644 index cfe0c528..00000000 --- a/doc/modules/utils.table.html +++ /dev/null @@ -1,583 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module utils.table

-

Searches a table to remove a specific element without an index

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fast_remove (tbl, index)Removes an item from an array in O(1) time.
add_all (t1, t2)Adds the contents of table t2 to table t1
index_of (t, e)Checks if a table contains an element
index_of_in_array (t, e)Checks if the arrayed portion of a table contains an element
contains (t, e)Checks if a table contains an element
array_contains (t, e)Checks if the arrayed portion of a table contains an element
set (t, index, element)Adds an element into a specific index position while shuffling the rest down
get_random_dictionary_entry (t, key)Chooses a random entry from a table - because this uses math.random, it cannot be used outside of events
get_random_weighted (weight_table, item_index, weight_index)Chooses a random entry from a weighted table - because this uses math.random, it cannot be used outside of events
shuffle_table (t)Creates a fisher-yates shuffle of a sequential number-indexed table - because this uses math.random, it cannot be used outside of events if no rng is supplied - from: http://www.sdknews.com/cross-platform/corona/tutorial-how-to-shuffle-table-items
clear_table (t, array)Clears all existing entries in a table
-

Fields

- - - - - - - - - - - - - - - - - - - - - -
inspectSimilar to serpent.block, returns a string with a pretty representation of a table.
sizeTakes a table and returns the number of entries in the table.
deep_copyCreates a deepcopy of a table.
mergeMerges multiple tables.
equalsDetermines if two tables are structurally equal.
- -
-
- - -

Functions

- -
-
- - fast_remove (tbl, index) -
-
- Removes an item from an array in O(1) time. - The catch is that fast_remove doesn't guarantee to maintain the order of items in the array. - - -

Parameters:

-
    -
  • tbl - arrayed table - -
  • index - Must be >= 0. The case where index > #tbl is handled. -
  • - - - - - - - -
    - - add_all (t1, t2) -
    -
    - Adds the contents of table t2 to table t1 - - -

    Parameters:

    -
      -
    • t1 -
    to insert into - -
  • t2 -
  • to insert from - - - - - - - - -
    - - index_of (t, e) -
    -
    - Checks if a table contains an element - - -

    Parameters:

    -
      -
    • t -
    - -
  • e - table element -
  • - - - - - - - -
    - - index_of_in_array (t, e) -
    -
    - Checks if the arrayed portion of a table contains an element - - -

    Parameters:

    -
      -
    • t -
    - -
  • e - table element -
  • - - - - - - - -
    - - contains (t, e) -
    -
    - Checks if a table contains an element - - -

    Parameters:

    -
      -
    • t -
    - -
  • e - table element -
  • - - - - - - - -
    - - array_contains (t, e) -
    -
    - Checks if the arrayed portion of a table contains an element - - -

    Parameters:

    -
      -
    • t -
    - -
  • e - table element -
  • - - - - - - - -
    - - set (t, index, element) -
    -
    - Adds an element into a specific index position while shuffling the rest down - - -

    Parameters:

    -
      -
    • t -
    to add into - -
  • index - the position in the table to add to -
  • -
  • element - to add to the table -
  • - - - - - - - -
    - - get_random_dictionary_entry (t, key) -
    -
    - Chooses a random entry from a table - because this uses math.random, it cannot be used outside of events - - -

    Parameters:

    -
      -
    • t -
    - -
  • key - to indicate whether to return the key or value -
  • - - -

    Returns:

    -
      - - a random element of table t -
    - - - - - -
    - - get_random_weighted (weight_table, item_index, weight_index) -
    -
    - Chooses a random entry from a weighted table - because this uses math.random, it cannot be used outside of events - - -

    Parameters:

    -
      -
    • weight_table -
    of tables with items and their weights - -
  • item_index - of the index of items, defaults to 1 -
  • -
  • weight_index - of the index of the weights, defaults to 2 -
  • - - -

    Returns:

    -
      - - table element -
    - - -

    See also:

    -
      -
    - - - -
    - - shuffle_table (t) -
    -
    - Creates a fisher-yates shuffle of a sequential number-indexed table - because this uses math.random, it cannot be used outside of events if no rng is supplied - from: http://www.sdknews.com/cross-platform/corona/tutorial-how-to-shuffle-table-items - - -

    Parameters:

    -
      -
    • t -
    to shuffle - - - - - - - - -
    - - clear_table (t, array) -
    -
    - Clears all existing entries in a table - - -

    Parameters:

    -
      -
    • t -
    to clear - -
  • array - to indicate whether the table is an array or not -
  • - - - - - - - - -

    Fields

    - -
    -
    - - inspect -
    -
    - Similar to serpent.block, returns a string with a pretty representation of a table. - Notice: This method is not appropriate for saving/restoring tables. It is meant to be used by the programmer mainly while debugging a program. - depth sets the maximum depth that will be printed out. When the max depth is reached, inspect will stop parsing tables and just return {...} - process is a function which allow altering the passed object before transforming it into a string. - A typical way to use it would be to remove certain values so that they don't appear at all. - return the prettied table - - -
      -
    • table -
    the table to serialize - -
  • options -
  • options are depth, newline, indent, process - - - - - - - - -
    - - size -
    -
    - Takes a table and returns the number of entries in the table. (Slower than #table, faster than iterating via pairs) - - - - - - - -
    -
    - - deep_copy -
    -
    - Creates a deepcopy of a table. Metatables and LuaObjects inside the table are shallow copies. - Shallow copies meaning it copies the reference to the object instead of the object itself. - - -
      -
    • object -
    the object to copy - - - - - - - - -
    - - merge -
    -
    - Merges multiple tables. Tables later in the list will overwrite entries from tables earlier in the list. - Ex. merge({{1, 2, 3}, {[2] = 0}, {[3] = 0}}) will return {1, 0, 0} - - -
      -
    • tables -
    takes a table of tables to merge - - - - - - - - -
    - - equals -
    -
    - Determines if two tables are structurally equal. - Notice: tables that are LuaObjects or contain LuaObjects won't be compared correctly, use == operator for LuaObjects - - -
      -
    • tbl1 -
    - -
  • tbl2 -
  • - - - - - - - - - - - - - -
    -generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
    - - - diff --git a/doc/modules/utils.task.html b/doc/modules/utils.task.html deleted file mode 100644 index fa44cb8b..00000000 --- a/doc/modules/utils.task.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - Reference - - - - -
    - -
    - -
    -
    -
    - - -
    - - - - - - -
    - -

    Module utils.task

    -

    Allows you to set a timer (in ticks) after which the tokened function will be run with params given as an argument - Cannot be called before init

    -

    - - -

    Functions

    -
    - - - - - - - - -
    Task.set_timeout (sec, func_token, params)Allows you to set a timer (in seconds) after which the tokened function will be run with params given as an argument - Cannot be called before init
    Task.queue_task (func_token, params, weight)Queueing allows you to split up heavy tasks which don't need to be completed in the same tick.
    - -
    -
    - - -

    Functions

    - -
    -
    - - Task.set_timeout (sec, func_token, params) -
    -
    - Allows you to set a timer (in seconds) after which the tokened function will be run with params given as an argument - Cannot be called before init - - -

    Parameters:

    -
      -
    • sec - -
    • -
    • func_token - a token for a function store via the token system -
    • -
    • params - the argument to send to the tokened function -
    • -
    - - - - - -
    -
    - - Task.queue_task (func_token, params, weight) -
    -
    - Queueing allows you to split up heavy tasks which don't need to be completed in the same tick. - Queued tasks are generally run 1 per tick. If the queue backs up, more tasks will be processed per tick. - Ex. if the task is expected to repeat multiple times (ie. the function returns true and loops several ticks) - - -

    Parameters:

    -
      -
    • func_token - a token for a function stored via the token system - If this function returns `true` it will run again the next tick, delaying other queued tasks (see weight) -
    • -
    • params - the argument to send to the tokened function -
    • -
    • weight - (defaults to 1) weight is the number of ticks a task is expected to take. -
    • -
    - - - - - -
    -
    - - -
-
-
-generated by LDoc 1.4.3 -Last updated 2019-05-29 22:30:49 -
-
- - diff --git a/doc/modules/utils.timestamp.html b/doc/modules/utils.timestamp.html deleted file mode 100644 index e2b2a781..00000000 --- a/doc/modules/utils.timestamp.html +++ /dev/null @@ -1,217 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module utils.timestamp

-

source https://github.com/daurnimator/luatz/blob/master/luatz/timetable.lua - edited down to just what is needed.

-

- - -

Functions

- - - - - - - - - - - - - -
Public.to_timetable (sec)Converts unix epoch timestamp into table {year: number, month: number, day: number, hour: number, min: number, sec: number}
Public.from_timetable (timetable)Converts timetable into unix epoch timestamp
Public.to_string (secs)Converts unix epoch timestamp into human readable string.
- -
-
- - -

Functions

- -
-
- - Public.to_timetable (sec) -
-
- Converts unix epoch timestamp into table {year: number, month: number, day: number, hour: number, min: number, sec: number} - - -

Parameters:

-
    -
  • sec - unix epoch timestamp -
  • -
- -

Returns:

-
    - - {year: number, month: number, day: number, hour: number, min: number, sec: number} -
- - - - -
-
- - Public.from_timetable (timetable) -
-
- Converts timetable into unix epoch timestamp - - -

Parameters:

-
+
+
+ + + + diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html new file mode 100644 index 00000000..c9ea0f82 --- /dev/null +++ b/docs/addons/Chat-Popups.html @@ -0,0 +1,357 @@ + + + + + + + + Chat-Popups addon + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Chat-Popups addon

+

Creates flying text entities when a player sends a message in chat; + also displays a ping above users who are named in the message

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
utils.game
utils.event
config.popup_messages
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.popup_messages +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html new file mode 100644 index 00000000..d6eda160 --- /dev/null +++ b/docs/addons/Chat-Reply.html @@ -0,0 +1,384 @@ + + + + + + + + Chat-Reply addon + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Chat-Reply addon

+

Adds auto replies to chat messages; aswell as chat commands

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + +
utils.event
utils.game
expcore.roles
config.chat_reply
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.chat_reply +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html new file mode 100644 index 00000000..4fafcaa9 --- /dev/null +++ b/docs/addons/Compilatron.html @@ -0,0 +1,593 @@ + + + + + + + + Compilatron addon + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Compilatron addon

+

Adds a compilatron that walks around the spawn area; adapted from redmew code

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + +
utils.event
utils.global
utils.game
utils.task
utils.token
config.compilatron
+ + +

Functions

+ + + + + + + + + + + + +
Public.add_compilatron(entity, name)This will add a compilatron to the global and start his message cycle
Public.spawn_compilatron(surface, location)This spawns a new compilatron on a surface with the given location tag (not a position)
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.task +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.token +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.compilatron +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Public.add_compilatron(entity, name) +
+
+
+
+ +

This will add a compilatron to the global and start his message cycle

+

+ + + Parameters: + +
    + + + + + +
  • + + entity + + : + + (LuaEntity) + + the compilatron entity that moves around + +
  • + + + + + +
  • + + name + + : + + (string) + + the name of the location that the complitron is at + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Public.spawn_compilatron(surface, location) +
+
+
+
+ +

This spawns a new compilatron on a surface with the given location tag (not a position)

+

+ + + Parameters: + +
    + + + + + +
  • + + surface + + : + + (LuaSurface) + + the surface to spawn the compilatron on + +
  • + + + + + +
  • + + location + + : + + (string) + + the location tag that is in the config file + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html new file mode 100644 index 00000000..a445fe5a --- /dev/null +++ b/docs/addons/Damage-Popups.html @@ -0,0 +1,357 @@ + + + + + + + + Damage-Popups addon + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Damage-Popups addon

+

Displays the amount of dmg that is done by players to entities; + also shows player health when a player is attacked

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
utils.game
utils.event
config.popup_messages
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.popup_messages +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html new file mode 100644 index 00000000..faadc765 --- /dev/null +++ b/docs/addons/Death-Logger.html @@ -0,0 +1,412 @@ + + + + + + + + Death-Logger addon + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Death-Logger addon

+

Makes markers on the map where places have died and reclaims items if not recovered

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + +
utils.event
utils.game
utils.global
config.death_logger
expcore.common
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.death_logger +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html new file mode 100644 index 00000000..e0ecba4b --- /dev/null +++ b/docs/addons/Discord-Alerts.html @@ -0,0 +1,468 @@ + + + + + + + + Discord-Alerts addon + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Discord-Alerts addon

+

Sends alert messages to our discord server when certain events are triggered

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + + + + +
utils.event
utils.game
resources.color_presets
expcore.common
config.discord_alerts
modules.control.reports
modules.control.warnings
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.discord_alerts +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.reports +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.warnings +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/addons/Player-Colours.html b/docs/addons/Player-Colours.html new file mode 100644 index 00000000..8a60609c --- /dev/null +++ b/docs/addons/Player-Colours.html @@ -0,0 +1,412 @@ + + + + + + + + Player-Colours addon + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Player-Colours addon

+

Gives players random colours when they join, also applies preset colours to those who have them

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + +
resources.color_presets
utils.game
utils.event
config.preset_player_colours
utils.global
+ + +
+ + +

Dependencies

+
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.preset_player_colours +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html new file mode 100644 index 00000000..46baddb7 --- /dev/null +++ b/docs/addons/Pollution-Grading.html @@ -0,0 +1,328 @@ + + + + + + + + Pollution-Grading addon + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Pollution-Grading addon

+

Makes polution look much nice of the map, ie not one big red mess

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
utils.event
config.pollution_grading
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.pollution_grading +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html new file mode 100644 index 00000000..c4f4487d --- /dev/null +++ b/docs/addons/Scorched-Earth.html @@ -0,0 +1,412 @@ + + + + + + + + Scorched-Earth addon + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Scorched-Earth addon

+

When a player walks around the tiles under them will degrade over time, the same is true when entites are built

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + +
utils.event
utils.game
utils.global
expcore.common
config.scorched_earth
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.scorched_earth +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html new file mode 100644 index 00000000..6b3002a3 --- /dev/null +++ b/docs/addons/Spawn-Area.html @@ -0,0 +1,384 @@ + + + + + + + + Spawn-Area addon + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Spawn-Area addon

+

Adds a custom spawn area with chests and afk turrets

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + +
utils.global
utils.event
utils.game
config.spawn_area
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.spawn_area +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html new file mode 100644 index 00000000..04b6b9fe --- /dev/null +++ b/docs/commands/Admin-Chat.html @@ -0,0 +1,396 @@ + + + + + + + + Admin-Chat commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Admin-Chat commands

+

Commands Module - Admin Chat + - Adds a command that allows admins to talk in a private chat

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
expcore.common
+ + +

Commands

+ + + + + + + + +
admin-chatSends a message in chat that only admins can see
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + admin-chat +
+
+
+
+ +

Sends a message in chat that only admins can see

+

+ + + Command Parameters: + +
    + + + + + +
  • + + message + + : + + (string) + + the message to send in the admin chat + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Bonus.html b/docs/commands/Bonus.html new file mode 100644 index 00000000..3786a596 --- /dev/null +++ b/docs/commands/Bonus.html @@ -0,0 +1,508 @@ + + + + + + + + Bonus commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Bonus commands

+

Commands Module - Bonus + - Adds a command that allows players to have increased stats

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + +
expcore.commands
expcore.roles
utils.event
utils.game
expcore.store
config.bonuses
+ + +

Commands

+ + + + + + + + +
bonusChanges the amount of bonus you receive
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.store +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.bonuses +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + bonus +
+
+
+
+ +

Changes the amount of bonus you receive

+

+ + + Command Parameters: + +
    + + + + + +
  • + + amount + + : + + (number) + + range 0-50 the percent increase for your bonus + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html new file mode 100644 index 00000000..81523c11 --- /dev/null +++ b/docs/commands/Cheat-Mode.html @@ -0,0 +1,369 @@ + + + + + + + + Cheat-Mode commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Cheat-Mode commands

+

Commands Module - Cheat Mode + - Adds a command that allows players to enter cheat mode

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + +
expcore.commands
+ + +

Commands

+ + + + + + + + +
toggle-cheat-modeToggles cheat mode for your player, or another player.
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + toggle-cheat-mode +
+
+
+
+ +

Toggles cheat mode for your player, or another player.

+

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + player to toggle chest mode of, can be nil for self + + (default: self) +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html new file mode 100644 index 00000000..a250f390 --- /dev/null +++ b/docs/commands/Clear-Inventory.html @@ -0,0 +1,396 @@ + + + + + + + + Clear-Inventory commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Clear-Inventory commands

+

Commands Module - Clear Inventory + - Adds a command that allows admins to clear people's inventorys

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
expcore.common
+ + +

Commands

+ + + + + + + + +
clear-inventoryClears a players inventory
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + clear-inventory +
+
+
+
+ +

Clears a players inventory

+

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to clear the inventory of + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html new file mode 100644 index 00000000..0af8bb1c --- /dev/null +++ b/docs/commands/Debug.html @@ -0,0 +1,373 @@ + + + + + + + + Debug commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Debug commands

+

Commands Module - Debug + - Adds a command that opens the debug frame

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
modules.gui.debug.main_view
expcore.commands
+ + +

Commands

+ + + + + + + + +
debugOpens the debug pannel for viewing tables.
+ + +
+ + +

Dependencies

+
+
+
+
+ # + modules.gui.debug.main_view +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + debug +
+
+
+
+ +

Opens the debug pannel for viewing tables.

+

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Find.html b/docs/commands/Find.html new file mode 100644 index 00000000..0f1ae48d --- /dev/null +++ b/docs/commands/Find.html @@ -0,0 +1,368 @@ + + + + + + + + Find commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Find commands

+

Commands Module - Find + - Adds a command that zooms in on the given player

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + +
expcore.commands
+ + +

Commands

+ + + + + + + + +
find-on-mapFind a player on your map.
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + find-on-map +
+
+
+
+ +

Find a player on your map.

+

+ + + Command Parameters: + +
    + + + + + +
  • + + the + + : + + (LuaPlayer) + + player to find on the map + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Help.html b/docs/commands/Help.html new file mode 100644 index 00000000..024c376f --- /dev/null +++ b/docs/commands/Help.html @@ -0,0 +1,412 @@ + + + + + + + + Help commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Help commands

+

Commands Module - Help + - Adds a better help command that allows searching of descriotions and names

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
utils.global
+ + +

Commands

+ + + + + + + + +
chelpSearches for a keyword in all commands you are allowed to use.
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + chelp +
+
+
+
+ +

Searches for a keyword in all commands you are allowed to use.

+

+ + + Command Parameters: + +
    + + + + + +
  • + + keyword + + : + + (string) + + the keyword that will be looked for + +
  • + + + + + +
  • + + page + + : + + (number) + + the page of help to view, must be in range of pages + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Home.html b/docs/commands/Home.html new file mode 100644 index 00000000..d4881527 --- /dev/null +++ b/docs/commands/Home.html @@ -0,0 +1,466 @@ + + + + + + + + Home commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Home commands

+

Commands Module - Home + - Adds a command that allows setting and teleporting to your home position

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
utils.global
+ + +

Commands

+ + + + + + + + + + + + + + + + + + + + +
homeTeleports you to your home location
home-setSets your home location to your current position
home-getReturns your current home location
returnTeleports you to previous location
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + home +
+
+
+
+ +

Teleports you to your home location

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + home-set +
+
+
+
+ +

Sets your home location to your current position

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + home-get +
+
+
+
+ +

Returns your current home location

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + return +
+
+
+
+ +

Teleports you to previous location

+

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html new file mode 100644 index 00000000..eeaf7d3d --- /dev/null +++ b/docs/commands/Interface.html @@ -0,0 +1,424 @@ + + + + + + + + Interface commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Interface commands

+

Commands Module - Interface + - Adds a command that acts as a direct link to the the active softmod, for debug use

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
expcore.commands
utils.global
expcore.common
+ + +

Commands

+ + + + + + + + +
interfaceSends an innovation to be ran and returns the result.
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + interface +
+
+
+
+ +

Sends an innovation to be ran and returns the result.

+

+ + + Command Parameters: + +
    + + + + + +
  • + + innovation + + : + + (string) + + the command that will be run + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html new file mode 100644 index 00000000..67d43bef --- /dev/null +++ b/docs/commands/Jail.html @@ -0,0 +1,619 @@ + + + + + + + + Jail commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Jail commands

+

Commands Module - Jail + - Adds a commands that allow admins to jail, unjail, and temp ban players

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
expcore.commands
modules.control.jail
expcore.common
+ + +

Commands

+ + + + + + + + + + + + + + + + + + + + +
jailPuts a player into jail and removes all other roles.
unjailRemoves a player from jail.
temp-banTemp bans a player until the next reset; this requires a reason; this will clear the players inventory.
clear-temp-banRemoves temp ban from a player; this will not restore their items.
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.jail +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + jail +
+
+
+
+ +

Puts a player into jail and removes all other roles.

+

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will be jailed + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason why the player is being jailed + + (optional) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + unjail +
+
+
+
+ +

Removes a player from jail.

+

+ + + Command Parameters: + +
    + + + + + +
  • + + the + + : + + (LuaPlayer) + + player that will be unjailed + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + temp-ban +
+
+
+
+ +

Temp bans a player until the next reset; this requires a reason; this will clear the players inventory.

+

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will be temp banned + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player is being temp banned + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + clear-temp-ban +
+
+
+
+ +

Removes temp ban from a player; this will not restore their items.

+

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to revoke the temp ban from + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html new file mode 100644 index 00000000..967cb7e1 --- /dev/null +++ b/docs/commands/Kill.html @@ -0,0 +1,397 @@ + + + + + + + + Kill commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Kill commands

+

Commands Module - Kill + - Adds a command that allows players to kill them selfs and others

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
expcore.roles
+ + +

Commands

+ + + + + + + + +
killKills yourself or another player.
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + kill +
+
+
+
+ +

Kills yourself or another player.

+

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to kill, must be alive to be valid + + (default: self) +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Me.html b/docs/commands/Me.html new file mode 100644 index 00000000..fbba050f --- /dev/null +++ b/docs/commands/Me.html @@ -0,0 +1,368 @@ + + + + + + + + Me commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Me commands

+

Commands Module - Me + - Adds a command that adds * around your message in the chat

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + +
expcore.commands
+ + +

Commands

+ + + + + + + + +
meSends an action message in the chat
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + me +
+
+
+
+ +

Sends an action message in the chat

+

+ + + Command Parameters: + +
    + + + + + +
  • + + action + + : + + (string) + + the action that follows your name in chat + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html new file mode 100644 index 00000000..f30d335d --- /dev/null +++ b/docs/commands/Rainbow.html @@ -0,0 +1,396 @@ + + + + + + + + Rainbow commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Rainbow commands

+

Commands Module - Rainbow + - Adds a command that prints your message in rainbow font

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
expcore.common
+ + +

Commands

+ + + + + + + + +
rainbowSends an rainbow message in the chat
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + rainbow +
+
+
+
+ +

Sends an rainbow message in the chat

+

+ + + Command Parameters: + +
    + + + + + +
  • + + message + + : + + (string) + + the message that will be printed in chat + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html new file mode 100644 index 00000000..361a22d7 --- /dev/null +++ b/docs/commands/Repair.html @@ -0,0 +1,329 @@ + + + + + + + + Repair commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Repair commands

+

Commands Module - Repair + - Adds a command that allows an admin to repair and revive a large area

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
config.repair
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.repair +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html new file mode 100644 index 00000000..f94af164 --- /dev/null +++ b/docs/commands/Reports.html @@ -0,0 +1,593 @@ + + + + + + + + Reports commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Reports commands

+

Commands Module - Reports + - Adds a commands that allow players to report other players

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + +
expcore.roles
expcore.commands
modules.control.reports
expcore.common
+ + +

Commands

+ + + + + + + + + + + + + + + + +
reportReports a player and notifies moderators
get-reportsGets a list of all reports that a player has on them.
clear-reportsClears all reports from a player or just the report from one player.
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.reports +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + report +
+
+
+
+ +

Reports a player and notifies moderators

+

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to report, some players are immune + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason the player is being reported + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + get-reports +
+
+
+
+ +

Gets a list of all reports that a player has on them.

+

If no player then lists all players and the number of reports on them.

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the report for + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + clear-reports +
+
+
+
+ +

Clears all reports from a player or just the report from one player.

+

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to clear the report(s) from + +
  • + + + + + +
  • + + from + + : + + (LuaPlayer) + + -player remove only the report made by this player + + (default: all) +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html new file mode 100644 index 00000000..3bc1f04d --- /dev/null +++ b/docs/commands/Roles.html @@ -0,0 +1,565 @@ + + + + + + + + Roles commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Roles commands

+

Commands Module - Roles + - Adds a commands that allow interaction with the role system

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
expcore.commands
expcore.roles
resources.color_presets
+ + +

Commands

+ + + + + + + + + + + + + + + + +
assign-roleAssigns a role to a player
unassign-roleUnassigns a role from a player
list-rolesLists all roles in they correct order
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + assign-role +
+
+
+
+ +

Assigns a role to a player

+

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to assign the role to + +
  • + + + + + +
  • + + role + + : + + (string) + + the name of the role to assign to the player, supports auto complete after enter + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + unassign-role +
+
+
+
+ +

Unassigns a role from a player

+

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to unassign the role from + +
  • + + + + + +
  • + + role + + : + + (string) + + the name of the role to unassign from the player, supports auto complete after enter + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + list-roles +
+
+
+
+ +

Lists all roles in they correct order

+

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + list only the roles which this player has + + (default: all) +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html new file mode 100644 index 00000000..257da669 --- /dev/null +++ b/docs/commands/Spawn.html @@ -0,0 +1,397 @@ + + + + + + + + Spawn commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Spawn commands

+

Commands Module - Spawn + - Adds a command that allows players to teleport to their spawn point

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
expcore.roles
+ + +

Commands

+ + + + + + + + +
go-to-spawnTeleport to spawn
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + go-to-spawn +
+
+
+
+ +

Teleport to spawn

+

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to teleport to their spawn point + + (default: self) +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Tag.html b/docs/commands/Tag.html new file mode 100644 index 00000000..63606adc --- /dev/null +++ b/docs/commands/Tag.html @@ -0,0 +1,451 @@ + + + + + + + + Tag commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Tag commands

+

Commands Module - Tag + - Adds a command that allows players to have a custom tag after their name

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
expcore.roles
+ + +

Commands

+ + + + + + + + + + + + +
tagSets your player tag.
tag-clearClears your tag.
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + tag +
+
+
+
+ +

Sets your player tag.

+

+ + + Command Parameters: + +
    + + + + + +
  • + + tag + + : + + (string) + + the tag that will be after the name, there is a max length + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + tag-clear +
+
+
+
+ +

Clears your tag.

+

Or another player if you are admin.

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to remove the tag from, nil will apply to self + + (default: self) +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html new file mode 100644 index 00000000..472651ba --- /dev/null +++ b/docs/commands/Teleport.html @@ -0,0 +1,492 @@ + + + + + + + + Teleport commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Teleport commands

+

Commands Module - Teleport + - Adds a command that allows players to teleport to other players

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + +
expcore.commands
+ + +

Commands

+ + + + + + + + + + + + + + + + +
teleportTeleports a player to another player.
bringTeleports a player to you.
gotoTeleports you to a player.
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + teleport +
+
+
+
+ +

Teleports a player to another player.

+

+ + + Command Parameters: + +
    + + + + + +
  • + + from_player + + : + + (LuaPlayer) + + the player that will be teleported, must be alive + +
  • + + + + + +
  • + + to_player + + : + + (LuaPlayer) + + the player to teleport to, must be online (if dead goes to where they died) + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + bring +
+
+
+
+ +

Teleports a player to you.

+

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will be teleported, must be alive + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + goto +
+
+
+
+ +

Teleports you to a player.

+

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to teleport to, must be online (if dead goes to where they died) + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html new file mode 100644 index 00000000..a62c9b8e --- /dev/null +++ b/docs/commands/Warnings.html @@ -0,0 +1,577 @@ + + + + + + + + Warnings commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Warnings commands

+

Commands Module - Warnings + - Adds a commands that allow admins to warn other players

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + +
expcore.commands
modules.control.warnings
expcore.common
config.warnings
+ + +

Commands

+ + + + + + + + + + + + + + + + +
give-warningGives a warning to a player; may lead to automatic script action.
get-warningsGets the number of warnings a player has.
clear-warningsClears all warnings (and script warnings) from a player
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.warnings +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.warnings +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + give-warning +
+
+
+
+ +

Gives a warning to a player; may lead to automatic script action.

+

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player the will recive a warning + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason the player is being given a warning + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + get-warnings +
+
+
+
+ +

Gets the number of warnings a player has.

+

If no player then lists all players and the number of warnings they have.

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the warning for, if nil all players are listed + + (default: list) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + clear-warnings +
+
+
+
+ +

Clears all warnings (and script warnings) from a player

+

+ + + Command Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to clear the warnings from + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/config.ld b/docs/config.ld new file mode 100644 index 00000000..01c7486c --- /dev/null +++ b/docs/config.ld @@ -0,0 +1,101 @@ +file = '../' +dir = '../docs' +project = 'ExpGaming Scenario' +title = 'ExpGaming Scenario' +description = 'Explosive Gaming\'s server scenario for 0.17' + +convert_opt = true +sort = false +not_luadoc = true +no_lua_ref = true +template_escape = ">" +topics = {"../README.md", "../LICENSE"} +style = '../docs' +template = '../docs' +no_space_before_args = true +merge=true + +new_type("core", "Core", true) +new_type("control", "Control", true) +new_type("addon", "Addons", true) +new_type("gui", "Guis", true) +new_type("commands", "Commands", true) +new_type("config", "Configs", true, "Settings") + +new_type("dep", "Dependencies", false) +new_type("setting", "Settings", false) +new_type("element", "Elements", false, "Properties / Events") +new_type("event", "Events", false, "Event Parameters") +new_type("command", "Commands", false, "Command Parameters") + +local api_url = "http://lua-api.factorio.com/latest/%s.html%s" + +custom_see_handler("^Lua([%w_]*)%.?([%.?[%w_]*]*)$", + function(name, section) + local link_txt = "Lua" .. name .. (#section > 0 and "." .. section or "") + local link_url = api_url:format("Lua" .. name, #section > 0 and "#" .. link_txt or "") + return link_txt, link_url + end +) + +custom_see_handler("^Concepts%.([%.?[%w_]*]*)$", + function(section) + local link_txt = "Concepts." .. section + local link_url = api_url:format("Concepts", #section > 0 and "#" .. section or "") + return link_txt, link_url + end +) + +custom_see_handler("^defines%.?([%.?[%w_]*]*)$", + function(section) + local link_txt = "defines." .. section + local link_url + if section == "color" or section == "time" then + link_url = "../modules/"..link_txt..".html" + else + link_url = api_url:format("defines", #section > 0 and "#" .. link_txt or "") + end + return link_txt, link_url + end +) + +custom_see_handler("^Common%.([%.?[%w_]*]*)$", + function(section) + local link_txt = "Common." .. section + local link_url = api_url:format("Common", #section > 0 and "#" .. link_txt or "") + return link_txt, link_url + end +) + +local wikipat = "https://en.wikipedia.org/wiki/%s" +custom_see_handler("^wiki (.+)", + function(name) + local url = wikipat:format(name) + return name, url + end +) + +-- https://forums.factorio.com/viewtopic.php?t=32039#p202158 +custom_see_handler("^(http[s]?%:%/%/.-) (.+)$", + function(url, name) + return name, url + end +) + +local lua_url = "https://www.lua.org/pil/%s.html%s" + +custom_see_handler("^boolean$", function() return "boolean", api_url:format("Builtin-Types", "#boolean") end) +custom_see_handler("^int$", function() return "int", api_url:format("Builtin-Types", "#int") end) +custom_see_handler("^uint$", function() return "uint", api_url:format("Builtin-Types", "#uint") end) +custom_see_handler("^uint8$", function() return "uint8", api_url:format("Builtin-Types", "#uint8") end) +custom_see_handler("^uint64$", function() return "uint64", api_url:format("Builtin-Types", "#uint64") end) +custom_see_handler("^string$", function() return "string", api_url:format("Builtin-Types", "#string") end) +custom_see_handler("^float$", function() return "float", api_url:format("Builtin-Types", "#float") end) +custom_see_handler("^double$", function() return "double", api_url:format("Builtin-Types", "#double") end) +custom_see_handler("^nil$", function() return "nil", lua_url:format("2.1", "") end) +custom_see_handler("^number$", function() return "number", lua_url:format("2.3", "") end) +custom_see_handler("^table$", function() return "table", lua_url:format("2.5", "") end) +custom_see_handler("^function$", function() return "function", lua_url:format("2.6", "") end) +custom_see_handler("^userdata$", function() return "userdata", lua_url:format("2.7", "") end) +custom_see_handler("^thread$", function() return "thread", lua_url:format("9", "#CoroutineSec") end) +custom_see_handler("^array$", function() return "array", lua_url:format("11.1", "") end) \ No newline at end of file diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html new file mode 100644 index 00000000..02b2965a --- /dev/null +++ b/docs/configs/Advanced-Start.html @@ -0,0 +1,514 @@ + + + + + + + + Advanced-Start config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Advanced-Start config

+

This file is used to setup the map starting settings and the items players will start with

+

+ + + + + + + + + + + + + +

Settings

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
skip_intro
skip_victory
disable_base_game_silo_script
research_queue_from_start
friendly_fire
enemy_expansion
chart_radius
items
+ + +
+ + +

Settings

+
+
+
+
+ # + skip_intro +
+
+
+
+ +

+

skips the intro given in the default factorio free play scenario

+ + + + + + + + + + + + + + +
+
+
+
+ # + skip_victory +
+
+
+
+ +

+

will skip the victory screen when a rocket is launched

+ + + + + + + + + + + + + + +
+
+
+
+ # + disable_base_game_silo_script +
+
+
+
+ +

+

will not load the silo script at all

+ + + + + + + + + + + + + + +
+
+
+
+ # + research_queue_from_start +
+
+
+
+ +

+

when true the research queue is useible from the start

+ + + + + + + + + + + + + + +
+
+
+
+ # + friendly_fire +
+
+
+
+ +

+

weather players will be able to attack each other on the same force

+ + + + + + + + + + + + + + +
+
+
+
+ # + enemy_expansion +
+
+
+
+ +

+

a catch all for in case the map settings file fails to load

+ + + + + + + + + + + + + + +
+
+
+
+ # + chart_radius +
+
+
+
+ +

+

the number of tiles that will be charted when the map starts

+ + + + + + + + + + + + + + +
+
+
+
+ # + items +
+
+
+
+ +

+

items and there condition for being given + ['item-name'] = function(amount_made,production_stats,player) return end -- 0 means no items given + Plates

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html new file mode 100644 index 00000000..2e3966d2 --- /dev/null +++ b/docs/configs/Bonuses.html @@ -0,0 +1,245 @@ + + + + + + + + Bonuses config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Bonuses config

+

Lists all bonuses which can be used, name followed by min max

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html new file mode 100644 index 00000000..727827bc --- /dev/null +++ b/docs/configs/Chat-Reply.html @@ -0,0 +1,493 @@ + + + + + + + + Chat-Reply config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Chat-Reply config

+

This file defines the different triggers for the chat bot

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + +
expcore.common
+ + +

Settings

+ + + + + + + + + + + + + + + + + + + + + + +
allow_command_prefix_for_messages
messages
command_admin_only
command_permission
command_prefix
commands
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Settings

+
+
+
+
+ # + allow_command_prefix_for_messages +
+
+
+
+ +

+

when true any message trigger will print to all player when prefixed

+ + + + + + + + + + + + + + +
+
+
+
+ # + messages +
+
+
+
+ +

+

will trigger when ever the word is said

+ + + + + + + + + + + + + + +
+
+
+
+ # + command_admin_only +
+
+
+
+ +

+

when true will only allow chat commands for admins

+ + + + + + + + + + + + + + +
+
+
+
+ # + command_permission +
+
+
+
+ +

+

the permission used to allow command prefixes

+ + + + + + + + + + + + + + +
+
+
+
+ # + command_prefix +
+
+
+
+ +

+

prefix used for commands below and to print to all players (if enabled above)

+ + + + + + + + + + + + + + +
+
+
+
+ # + commands +
+
+
+
+ +

+

will trigger only when command prefix is given

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html new file mode 100644 index 00000000..fd824730 --- /dev/null +++ b/docs/configs/Commands-Auth-Admin.html @@ -0,0 +1,302 @@ + + + + + + + + Commands-Auth-Admin config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Commands-Auth-Admin config

+

This is a very simple config file which adds a admin only auth functio; + not much to change here its more so it can be enabled and disabled from ./config/file_loader.lua; + either way you can change the requirements to be "admin" if you wanted to

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + +
expcore.commands
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html new file mode 100644 index 00000000..4f49a827 --- /dev/null +++ b/docs/configs/Commands-Auth-Roles.html @@ -0,0 +1,328 @@ + + + + + + + + Commands-Auth-Roles config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Commands-Auth-Roles config

+

This will make commands only work if the role has been allowed it in the role config

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
expcore.roles
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html new file mode 100644 index 00000000..9aacac5f --- /dev/null +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -0,0 +1,450 @@ + + + + + + + + Commands-Auth-Runtime-Disable config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Commands-Auth-Runtime-Disable config

+

This config for command auth allows commands to be globally enabled and disabled during runtime; + this config adds Commands.disable and Commands.enable to enable and disable commands for all users

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
utils.global
+ + +

Functions

+ + + + + + + + + + + + +
Commands.disable(command_name)Stops a command from be used by any one
Commands.enable(command_name)Allows a command to be used again after disable was used
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Commands.disable(command_name) +
+
+
+
+ +

Stops a command from be used by any one

+

+ + + Parameters: + +
    + + + + + +
  • + + command_name + + : + + (string) + + the name of the command to disable + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Commands.enable(command_name) +
+
+
+
+ +

Allows a command to be used again after disable was used

+

+ + + Parameters: + +
    + + + + + +
  • + + command_name + + : + + (string) + + the name of the command to enable + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html new file mode 100644 index 00000000..64d71e20 --- /dev/null +++ b/docs/configs/Commands-Parse-Roles.html @@ -0,0 +1,362 @@ + + + + + + + + Commands-Parse-Roles config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Commands-Parse-Roles config

+

Adds some parse functions that can be used with the role system

+

+ + + + + + +

Usage

+
 Adds Parses:
+    role
+    player-role
+    player-role-online
+    player-role-alive
+ + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
expcore.commands
expcore.roles
expcore.common
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html new file mode 100644 index 00000000..574f8aa4 --- /dev/null +++ b/docs/configs/Commands-Parse.html @@ -0,0 +1,346 @@ + + + + + + + + Commands-Parse config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Commands-Parse config

+

This file contains some common command param parse functions; +this file is less of a config and more of a requirement but you may wish to change how some behave; +as such you need to be confident with lua but you edit this config file; +use Commands.add_parse('name',function(input,player,reject) end) to add a parse; +see ./expcore/commands.lua for more details

+

+ + + + + + +

Usage

+
 Adds Parses:
+    boolean
+    string-options - options: array
+    string-max-length - max_length: number
+    number
+    integer
+    number-range - range_min: number, range_max: number
+    integer-range - range_min: number, range_max: number
+    player
+    player-online
+    player-alive
+    force
+    surface
+ + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
utils.game
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Commands.auth_admin.html b/docs/configs/Commands.auth_admin.html new file mode 100644 index 00000000..b63055ce --- /dev/null +++ b/docs/configs/Commands.auth_admin.html @@ -0,0 +1,289 @@ + + + + + + + + Commands.auth_admin config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Commands.auth_admin config

+

This is a very simple config file which adds a admin only auth functio + not much to change here its more so it can be enabled and disabled from ./config/file_loader.lua + either way you can change the requirements to be "admin" if you wanted to

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + +
expcore.commands
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Commands.auth_roles.html b/docs/configs/Commands.auth_roles.html new file mode 100644 index 00000000..c25d1e43 --- /dev/null +++ b/docs/configs/Commands.auth_roles.html @@ -0,0 +1,315 @@ + + + + + + + + Commands.auth_roles config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Commands.auth_roles config

+

This will make commands only work if the role has been allowed it in the role config

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
expcore.roles
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Commands.auth_runtime_disable.html b/docs/configs/Commands.auth_runtime_disable.html new file mode 100644 index 00000000..e146ff0e --- /dev/null +++ b/docs/configs/Commands.auth_runtime_disable.html @@ -0,0 +1,437 @@ + + + + + + + + Commands.auth_runtime_disable config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Commands.auth_runtime_disable config

+

This config for command auth allows commands to be globally enabled and disabled during runtime + this config adds Commands.disable and Commands.enable to enable and disable commands for all users

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
utils.global
+ + +

Functions

+ + + + + + + + + + + + +
Commands.disable(command_name)Stops a command from be used by any one
Commands.enable(command_name)Allows a command to be used again after disable was used
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Commands.disable(command_name) +
+
+
+
+ +

Stops a command from be used by any one

+

+ + + Parameters: + +
    + + + + + +
  • + + command_name + + : + + (string) + + the name of the command to disable + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Commands.enable(command_name) +
+
+
+
+ +

Allows a command to be used again after disable was used

+

+ + + Parameters: + +
    + + + + + +
  • + + command_name + + : + + (string) + + the name of the command to enable + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Commands.parse_general.html b/docs/configs/Commands.parse_general.html new file mode 100644 index 00000000..49dd695d --- /dev/null +++ b/docs/configs/Commands.parse_general.html @@ -0,0 +1,333 @@ + + + + + + + + Commands.parse_general config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Commands.parse_general config

+

This file contains some common command param parse functions +this file is less of a config and more of a requirement but you may wish to change how some behave +as such you need to be confident with lua but you edit this config file +use Commands.add_parse('name',function(input,player,reject) end) to add a parse +see ./expcore/commands.lua for more details

+

+ + + + + + +

Usage

+
 Adds Parses:
+    boolean
+    string-options - options: array
+    string-max-length - max_length: number
+    number
+    integer
+    number-range - range_min: number, range_max: number
+    integer-range - range_min: number, range_max: number
+    player
+    player-online
+    player-alive
+    force
+    surface
+ + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
utils.game
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Commands.parse_roles.html b/docs/configs/Commands.parse_roles.html new file mode 100644 index 00000000..76e5c918 --- /dev/null +++ b/docs/configs/Commands.parse_roles.html @@ -0,0 +1,349 @@ + + + + + + + + Commands.parse_roles config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Commands.parse_roles config

+

Adds some parse functions that can be used with the role system

+

+ + + + + + +

Usage

+
 Adds Parses:
+    role
+    player-role
+    player-role-online
+    player-role-alive
+ + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
expcore.commands
expcore.roles
expcore.common
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html new file mode 100644 index 00000000..98043b31 --- /dev/null +++ b/docs/configs/Compilatron.html @@ -0,0 +1,362 @@ + + + + + + + + Compilatron config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Compilatron config

+

Config file for the compliatrons including where they spawn and what messages they show

+

+ + + + + + + + + + + + + +

Settings

+ + + + + + + + + + + + + +
message_cycle
locations
messages
+ + +
+ + +

Settings

+
+
+
+
+ # + message_cycle +
+
+
+
+ +

+

15 seconds default, how often (in ticks) the messages will cycle

+ + + + + + + + + + + + + + +
+
+
+
+ # + locations +
+
+
+
+ +

+

defines the spawn locations for all compilatrons

+ + + + + + + + + + + + + + +
+
+
+
+ # + messages +
+
+
+
+ +

+

the messages that each one will say, must be same name as its location

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html new file mode 100644 index 00000000..859cf7d9 --- /dev/null +++ b/docs/configs/Death-Logger.html @@ -0,0 +1,424 @@ + + + + + + + + Death-Logger config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Death-Logger config

+

This config controls what happens when a player dies mostly about map markers and item collection; + allow_teleport_to_body_command and allow_collect_bodies_command can be over ridden if command_auth_runtime_disable is present; + if not present then the commands will not be loaded into the game

+

+ + + + + + + + + + + + + +

Settings

+ + + + + + + + + + + + + + + + + + + +
use_chests_as_bodies
auto_collect_bodies
show_map_markers
include_time_of_death
map_icon
+ + +
+ + +

Settings

+
+
+
+
+ # + use_chests_as_bodies +
+
+
+
+ +

+

weather items should be moved into a chest when a player dies

+ + + + + + + + + + + + + + +
+
+
+
+ # + auto_collect_bodies +
+
+
+
+ +

+

enables items being returned to the spawn point in chests upon corpse expiring

+ + + + + + + + + + + + + + +
+
+
+
+ # + show_map_markers +
+
+
+
+ +

+

shows markers on the map where bodies are

+ + + + + + + + + + + + + + +
+
+
+
+ # + include_time_of_death +
+
+
+
+ +

+

weather to include the time of death on the map marker

+ + + + + + + + + + + + + + +
+
+
+
+ # + map_icon +
+
+
+
+ +

+

the icon that the map marker shows; nil means no icon; format as a SingleID

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html new file mode 100644 index 00000000..4139d6e6 --- /dev/null +++ b/docs/configs/Discord-Alerts.html @@ -0,0 +1,245 @@ + + + + + + + + Discord-Alerts config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Discord-Alerts config

+

Config file used to enable and disable different push messages for discord

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html new file mode 100644 index 00000000..8aa4661f --- /dev/null +++ b/docs/configs/File-Loader.html @@ -0,0 +1,248 @@ + + + + + + + + File-Loader config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

File-Loader config

+

This contains a list of all files that will be loaded and the order they are loaded in; + to stop a file from loading add "--" in front of it, remove the "--" to have the file be loaded; + config files should be loaded after all modules are loaded; + core files should be required by modules and not be present in this list;

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html new file mode 100644 index 00000000..305e744d --- /dev/null +++ b/docs/configs/Permission-Groups.html @@ -0,0 +1,303 @@ + + + + + + + + Permission-Groups config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Permission-Groups config

+

Use this file to add new permission groups to the game; + start with Permission_Groups.new_group('name'); + then use either :allow_all() or :disallow_all() to set the default for non specified actions; + then use :allow{} and :disallow{} to specify certain actions to allow/disallow

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + +
expcore.permission_groups
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.permission_groups +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html new file mode 100644 index 00000000..2c9fc83f --- /dev/null +++ b/docs/configs/Player-List.html @@ -0,0 +1,820 @@ + + + + + + + + Player-List config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Player-List config

+

Config for the different action buttons that show on the player list; + each button has the button define(s) given along side an auth function, and optional reason callback; + if a reason callback is used then Store.set(action_name_store,player.name,'BUTTON_NAME') should be called during on_click; + buttons can be removed from the gui by commenting them out of the config at the bottom of this file; + the key used for the name of the button is the permission name used by the role system;

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui
expcore.roles
expcore.store
utils.game
modules.control.reports
modules.control.warnings
modules.control.jail
resources.color_presets
expcore.common
+ + +

Elements

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
goto_playerTeleports the user to the action player
bring_playerTeleports the action player to the user
kill_playerKills the action player, if there are alive
report_playerReports the action player, requires a reason to be given
warn_playerGives the action player a warning, requires a reason
jail_playerJails the action player, requires a reason
temp_ban_playerTemp bans the action player, requires a reason
kick_playerKicks the action player, requires a reason
ban_playerBans the action player, requires a reason
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.store +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.reports +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.warnings +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.jail +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Elements

+
+
+
+
+ # + goto_player +
+
+
+
+ +

Teleports the user to the action player

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + bring_player +
+
+
+
+ +

Teleports the action player to the user

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + kill_player +
+
+
+
+ +

Kills the action player, if there are alive

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + report_player +
+
+
+
+ +

Reports the action player, requires a reason to be given

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + warn_player +
+
+
+
+ +

Gives the action player a warning, requires a reason

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + jail_player +
+
+
+
+ +

Jails the action player, requires a reason

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + temp_ban_player +
+
+
+
+ +

Temp bans the action player, requires a reason

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + kick_player +
+
+
+
+ +

Kicks the action player, requires a reason

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + ban_player +
+
+
+
+ +

Bans the action player, requires a reason

+

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html new file mode 100644 index 00000000..64d7f6f0 --- /dev/null +++ b/docs/configs/Pollution-Grading.html @@ -0,0 +1,392 @@ + + + + + + + + Pollution-Grading config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Pollution-Grading config

+

This controls how pollution is viewed on the map

+

+ + + + + + + + + + + + + +

Settings

+ + + + + + + + + + + + + + + + +
reference_point
max_scalar
min_scalar
update_delay
+ + +
+ + +

Settings

+
+
+
+
+ # + reference_point +
+
+
+
+ +

+

where pollution is read from

+ + + + + + + + + + + + + + +
+
+
+
+ # + max_scalar +
+
+
+
+ +

+

the scale between true max and max

+ + + + + + + + + + + + + + +
+
+
+
+ # + min_scalar +
+
+
+
+ +

+

the scale between the lowest max and min

+ + + + + + + + + + + + + + +
+
+
+
+ # + update_delay +
+
+
+
+ +

+

time in minutes between view updates

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html new file mode 100644 index 00000000..114b8348 --- /dev/null +++ b/docs/configs/Popup-Messages.html @@ -0,0 +1,422 @@ + + + + + + + + Popup-Messages config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Popup-Messages config

+

A combination of config settings for different popup values like chat and damage

+

+ + + + + + + + + + + + + +

Settings

+ + + + + + + + + + + + + + + + + + + +
show_player_messages
show_player_mentions
show_player_damage
show_player_health
damage_location_variance
+ + +
+ + +

Settings

+
+
+
+
+ # + show_player_messages +
+
+
+
+ +

+

weather a message in chat will make a popup above them

+ + + + + + + + + + + + + + +
+
+
+
+ # + show_player_mentions +
+
+
+
+ +

+

weather a mentioned player will have a popup when mentioned in chat

+ + + + + + + + + + + + + + +
+
+
+
+ # + show_player_damage +
+
+
+
+ +

+

weather to show damage done by players

+ + + + + + + + + + + + + + +
+
+
+
+ # + show_player_health +
+
+
+
+ +

+

weather to show player health when attacked

+ + + + + + + + + + + + + + +
+
+
+
+ # + damage_location_variance +
+
+
+
+ +

+

how close to the eade of an entity the popups will appear

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html new file mode 100644 index 00000000..824291f5 --- /dev/null +++ b/docs/configs/Preset-Player-Colours.html @@ -0,0 +1,332 @@ + + + + + + + + Preset-Player-Colours config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Preset-Player-Colours config

+

Preset colours that players get when they join the server, if not in the list then will be given a random colour (which isnt disallowed)

+

+ + + + + + + + + + + + + +

Settings

+ + + + + + + + + + +
players
disallow
+ + +
+ + +

Settings

+
+
+
+
+ # + players +
+
+
+
+ +

+

list of all players and the colour in rgb256 that they will recive upon joining

+ + + + + + + + + + + + + + +
+
+
+
+ # + disallow +
+
+
+
+ +

+

colours which will not given to players; the value does not matter it is only the key which is checked

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html new file mode 100644 index 00000000..e61920c5 --- /dev/null +++ b/docs/configs/Repair.html @@ -0,0 +1,422 @@ + + + + + + + + Repair config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Repair config

+

Config file for the repair command

+

+ + + + + + + + + + + + + +

Settings

+ + + + + + + + + + + + + + + + + + + +
disallow
max_range
allow_blueprint_repair
allow_ghost_revive
allow_heal_entities
+ + +
+ + +

Settings

+
+
+
+
+ # + disallow +
+
+
+
+ +

+

items in this list will never be repaired

+ + + + + + + + + + + + + + +
+
+
+
+ # + max_range +
+
+
+
+ +

+

the max range that can be used with the repair command

+ + + + + + + + + + + + + + +
+
+
+
+ # + allow_blueprint_repair +
+
+
+
+ +

+

when true will allow blueprints (things not destroyed by biters) to be build instantly using the repair command

+ + + + + + + + + + + + + + +
+
+
+
+ # + allow_ghost_revive +
+
+
+
+ +

+

when true will allow ghosts (things destroyed by biters) to be build instantly using the repair command

+ + + + + + + + + + + + + + +
+
+
+
+ # + allow_heal_entities +
+
+
+
+ +

+

when true will heal entities to full health that are within range

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html new file mode 100644 index 00000000..929fbf4c --- /dev/null +++ b/docs/configs/Rockets.html @@ -0,0 +1,842 @@ + + + + + + + + Rockets config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Rockets config

+

This file controls what will show in each section of the rocket info gui

+

+ + + + + + + + + + + + + +

Settings

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
stats
show_stats
show_first_rocket
show_last_rocket
show_fastest_rocket
show_total_rockets
show_game_avg
rolling_avg
milestones
show_milestones
progress
show_progress
allow_zoom_to_map
allow_remote_launch
remote_launch_admins_only
remote_launch_role_permission
allow_toggle_active
toggle_active_admins_only
toggle_active_role_permission
+ + +
+ + +

Settings

+
+
+
+
+ # + stats +
+
+
+
+ +

+

The data that will show in the stats section

+ + + + + + + + + + + + + + +
+
+
+
+ # + show_stats +
+
+
+
+ +

+

false will hide this section all together

+ + + + + + + + + + + + + + +
+
+
+
+ # + show_first_rocket +
+
+
+
+ +

+

false will not show when the first rocket was launched

+ + + + + + + + + + + + + + +
+
+
+
+ # + show_last_rocket +
+
+
+
+ +

+

false will not show when the last rocket was launched

+ + + + + + + + + + + + + + +
+
+
+
+ # + show_fastest_rocket +
+
+
+
+ +

+

false will not show the time taken for the fastest rocket

+ + + + + + + + + + + + + + +
+
+
+
+ # + show_total_rockets +
+
+
+
+ +

+

false will not show the total number of rockets launched

+ + + + + + + + + + + + + + +
+
+
+
+ # + show_game_avg +
+
+
+
+ +

+

false will hide the avg across the entire map time

+ + + + + + + + + + + + + + +
+
+
+
+ # + rolling_avg +
+
+
+
+ +

+

each number will be one statistic; 5 means the avg time taken for the last 5 rockets

+ + + + + + + + + + + + + + +
+
+
+
+ # + milestones +
+
+
+
+ +

+

each number will be one statistic; 5 means the time that the 5th rocket was launched

+ + + + + + + + + + + + + + +
+
+
+
+ # + show_milestones +
+
+
+
+ +

+

false will hide this section all together

+ + + + + + + + + + + + + + +
+
+
+
+ # + progress +
+
+
+
+ +

+

The data and buttons in the build progress section

+ + + + + + + + + + + + + + +
+
+
+
+ # + show_progress +
+
+
+
+ +

+

false will hide this section altogether

+ + + + + + + + + + + + + + +
+
+
+
+ # + allow_zoom_to_map +
+
+
+
+ +

+

false will disable the zoom to map feature

+ + + + + + + + + + + + + + +
+
+
+
+ # + allow_remote_launch +
+
+
+
+ +

+

false removes the remote launch button for all players

+ + + + + + + + + + + + + + +
+
+
+
+ # + remote_launch_admins_only +
+
+
+
+ +

+

true will remove the remote launch button for all non (game) admins

+ + + + + + + + + + + + + + +
+
+
+
+ # + remote_launch_role_permission +
+
+
+
+ +

+

value used by custom permission system to allow or disallow the button

+ + + + + + + + + + + + + + +
+
+
+
+ # + allow_toggle_active +
+
+
+
+ +

+

false removes the remote toggle auto launch button for all players

+ + + + + + + + + + + + + + +
+
+
+
+ # + toggle_active_admins_only +
+
+
+
+ +

+

true will remove the toggle auto launch button for all non (game) admins

+ + + + + + + + + + + + + + +
+
+
+
+ # + toggle_active_role_permission +
+
+
+
+ +

+

value used by custom permission system to allow or disallow the button

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html new file mode 100644 index 00000000..5c7aabf3 --- /dev/null +++ b/docs/configs/Roles.html @@ -0,0 +1,300 @@ + + + + + + + + Roles config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Roles config

+

This is the main config file for the role system; file includes defines for roles and role flags and default values

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + +
expcore.roles
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Science.html b/docs/configs/Science.html new file mode 100644 index 00000000..c9c7fd1c --- /dev/null +++ b/docs/configs/Science.html @@ -0,0 +1,362 @@ + + + + + + + + Science config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Science config

+

Config file for the science info gui

+

+ + + + + + + + + + + + + +

Settings

+ + + + + + + + + + + + + +
show_eta
color_clamp
color_flux
+ + +
+ + +

Settings

+
+
+
+
+ # + show_eta +
+
+
+
+ +

+

when true the eta for research completion will be shown

+ + + + + + + + + + + + + + +
+
+
+
+ # + color_clamp +
+
+
+
+ +

+

the amount required for the text to show as green or red

+ + + + + + + + + + + + + + +
+
+
+
+ # + color_flux +
+
+
+
+ +

+

the ammount of flucuation allowed in production before icon change

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html new file mode 100644 index 00000000..3c038550 --- /dev/null +++ b/docs/configs/Scorched-Earth.html @@ -0,0 +1,396 @@ + + + + + + + + Scorched-Earth config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Scorched-Earth config

+

This file controls the placement/degrading of tiles as players build and walk

+

+ + + + + + + + + + + + + +

Settings

+ + + + + + + + + + + + + + + + +
weakness_value
strengths
degrade_order
entities
+ + +
+ + +

Settings

+
+
+
+
+ # + weakness_value +
+
+
+
+ +

+

lower value will make tiles more likely to degrade

+ + + + + + + + + + + + + + +
+
+
+
+ # + strengths +
+
+
+
+ +

+

this decides how "strong" a tile is, bigger number means less likely to degrade + debug: /interface require('modules.addons.worn-paths')(player.name,true) + note: tiles are effected by the tiles around them, so player paths will not degrade as fast when made wider + note: values are relative to the tile with the highest value, recommended to keep highest tile as a "nice" number + note: tiles not in list will never degrade under any conditions (which is why some are omitted such as water)

+ + + + + + + + + + + + + + +
+
+
+
+ # + degrade_order +
+
+
+
+ +

+

when a tile degrades it will turn into the next tile given here

+ + + + + + + + + + + + + + +
+
+
+
+ # + entities +
+
+
+
+ +

+

entities in this list will degrade the tiles under them when they are placed

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html new file mode 100644 index 00000000..4395fc07 --- /dev/null +++ b/docs/configs/Spawn-Area.html @@ -0,0 +1,752 @@ + + + + + + + + Spawn-Area config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Spawn-Area config

+

Used to config the spawn generation settings yes there is alot here i know just ignore the long tables at the end (they were generated with a command)

+

+ + + + + + + + + + + + + +

Settings

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
infinite_ammo_turrets
enabled
ammo_type
locations
afk_belts
enabled
locations
corrections
protect_entities
offset
deconstruction_radius
deconstruction_tile
pattern_radius
pattern_tile
entities
tiles
+ + +
+ + +

Settings

+
+
+
+
+ # + infinite_ammo_turrets +
+
+
+
+ +

+

These turrets will have they ammo refilled automatically and can not be looted

+ + + + + + + + + + + + + + +
+
+
+
+ # + enabled +
+
+
+
+ +

+

weather the turrets will be created and refilled

+ + + + + + + + + + + + + + +
+
+
+
+ # + ammo_type +
+
+
+
+ +

+

the ammo type that will be used

+ + + + + + + + + + + + + + +
+
+
+
+ # + locations +
+
+
+
+ +

+

locations of all turrets, this is default it can be changed during runtime

+ + + + + + + + + + + + + + +
+
+
+
+ # + afk_belts +
+
+
+
+ +

+

setting relating to afk belts round the spawn point

+ + + + + + + + + + + + + + +
+
+
+
+ # + enabled +
+
+
+
+ +

+

weather afk belts will be generated

+ + + + + + + + + + + + + + +
+
+
+
+ # + locations +
+
+
+
+ +

+

top left connors of any afk belt loops to be added

+ + + + + + + + + + + + + + +
+
+
+
+ # + corrections +
+
+
+
+ +

+

Some settings that have no where else to go

+ + + + + + + + + + + + + + +
+
+
+
+ # + protect_entities +
+
+
+
+ +

+

if the spawn entites will be protected

+ + + + + + + + + + + + + + +
+
+
+
+ # + offset +
+
+
+
+ +

+

a global offset value to correct the x and y values of the tables below

+ + + + + + + + + + + + + + +
+
+
+
+ # + deconstruction_radius +
+
+
+
+ +

+

when the spawn is made this area will have all entities removed first

+ + + + + + + + + + + + + + +
+
+
+
+ # + deconstruction_tile +
+
+
+
+ +

+

this is the tile that will spawn in the deconstruction radius

+ + + + + + + + + + + + + + +
+
+
+
+ # + pattern_radius +
+
+
+
+ +

+

this is the radius of the pattern all water in this area will be filled

+ + + + + + + + + + + + + + +
+
+
+
+ # + pattern_tile +
+
+
+
+ +

+

the tile that is used for the pattern

+ + + + + + + + + + + + + + +
+
+
+
+ # + entities +
+
+
+
+ +

+

All entities that will be created as part of spawn {entity-name,x-pos,y-pos}

+ + + + + + + + + + + + + + +
+
+
+
+ # + tiles +
+
+
+
+ +

+

The location of the "pattern" tiles {x-pos,y-pos}

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html new file mode 100644 index 00000000..1bd48171 --- /dev/null +++ b/docs/configs/Tasks.html @@ -0,0 +1,392 @@ + + + + + + + + Tasks config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Tasks config

+

Config file for the tasks gui

+

+ + + + + + + + + + + + + +

Settings

+ + + + + + + + + + + + + + + + +
any_user_can_add_new_task
user_can_edit_own_tasks
only_admins_can_edit
edit_tasks_role_permission
+ + +
+ + +

Settings

+
+
+
+
+ # + any_user_can_add_new_task +
+
+
+
+ +

+

when false only people with edit permission can make new reports

+ + + + + + + + + + + + + + +
+
+
+
+ # + user_can_edit_own_tasks +
+
+
+
+ +

+

when false only people with edit permission can edit reports

+ + + + + + + + + + + + + + +
+
+
+
+ # + only_admins_can_edit +
+
+
+
+ +

+

true will hide the edit and delete buttons from non (game) admins

+ + + + + + + + + + + + + + +
+
+
+
+ # + edit_tasks_role_permission +
+
+
+
+ +

+

value used with custom permission system

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html new file mode 100644 index 00000000..78291b18 --- /dev/null +++ b/docs/configs/Warnings.html @@ -0,0 +1,363 @@ + + + + + + + + Warnings config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Warnings config

+

Config file for the warning system, this is very similar to reports but is for the use of moderators rather than normal users.

+

+ + + + + + + + + + + + + +

Settings

+ + + + + + + + + + + + + +
actions
script_warning_cool_down
script_warning_limit
+ + +
+ + +

Settings

+
+
+
+
+ # + actions +
+
+
+
+ +

+

what actions are taking at number of warnings + if a localized string is used then __1__ will by_player_name and __2__ will be the current warning count (auto inserted)

+ + + + + + + + + + + + + + +
+
+
+
+ # + script_warning_cool_down +
+
+
+
+ +

+

time for a script warning (given by script) to be removed (in minutes)

+ + + + + + + + + + + + + + +
+
+
+
+ # + script_warning_limit +
+
+
+
+ +

+

the number of script warnings (given by script) that are allowed before full warnings are given

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html new file mode 100644 index 00000000..c8a87917 --- /dev/null +++ b/docs/configs/Warps.html @@ -0,0 +1,692 @@ + + + + + + + + Warps config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Warps config

+

This file contains all the different settings for the warp system and gui

+

+ + + + + + + + + + + + + +

Settings

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
recharge_time
update_smoothing
minimum_distance
activation_range
spawn_activation_range
default_icon
user_can_edit_own_warps
any_user_can_add_new_warp
only_admins_can_edit
edit_warps_role_permission
bypass_warp_limits_permission
entities
base_tile
tiles
+ + +
+ + +

Settings

+
+
+
+
+ # + recharge_time +
+
+
+
+ +

+

The amount of time in seconds that the player must wait between warps, acts as a balance

+ + + + + + + + + + + + + + +
+
+
+
+ # + update_smoothing +
+
+
+
+ +

+

Higher is better, the amount of smoothing applied to recharge timer and other gui updates, max is 60

+ + + + + + + + + + + + + + +
+
+
+
+ # + minimum_distance +
+
+
+
+ +

+

The minimum distance that must be between warp points, creating new ones is blocked when too close

+ + + + + + + + + + + + + + +
+
+
+
+ # + activation_range +
+
+
+
+ +

+

The distance the player must be to a warp in order to use the warp gui, gui can still be viewed but not used

+ + + + + + + + + + + + + + +
+
+
+
+ # + spawn_activation_range +
+
+
+
+ +

+

A second activation range which is used for the forces spawn point

+ + + + + + + + + + + + + + +
+
+
+
+ # + default_icon +
+
+
+
+ +

+

The default icon which is used by warps; must be an item name

+ + + + + + + + + + + + + + +
+
+
+
+ # + user_can_edit_own_warps +
+
+
+
+ +

+

When true the user can always edit warps which they created regardless of other settings

+ + + + + + + + + + + + + + +
+
+
+
+ # + any_user_can_add_new_warp +
+
+
+
+ +

+

When true any user is able to create new warps, however editing may still be restricted

+ + + + + + + + + + + + + + +
+
+
+
+ # + only_admins_can_edit +
+
+
+
+ +

+

When true only admins can edit warps

+ + + + + + + + + + + + + + +
+
+
+
+ # + edit_warps_role_permission +
+
+
+
+ +

+

Role permission used by the role system to allow editing warps

+ + + + + + + + + + + + + + +
+
+
+
+ # + bypass_warp_limits_permission +
+
+
+
+ +

+

Role permission used by the role system to allow bypassing the time and distance restrictions

+ + + + + + + + + + + + + + +
+
+
+
+ # + entities +
+
+
+
+ +

+

The entities which are created for warps

+ + + + + + + + + + + + + + +
+
+
+
+ # + base_tile +
+
+
+
+ +

+

The tile which is used for the warps

+ + + + + + + + + + + + + + +
+
+
+
+ # + tiles +
+
+
+
+ +

+

The tiles which are created for warps

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/control/Jail.html b/docs/control/Jail.html new file mode 100644 index 00000000..46633de1 --- /dev/null +++ b/docs/control/Jail.html @@ -0,0 +1,1216 @@ + + + + + + + + Jail control + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Jail control

+

Control Module - Jail + - Adds a way to jail players and temp ban players.

+

+ + + + + + +

Usage

+

+    -- import the module from the control modules
+    local Jail = require '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
+    Jail.jail_player('MrBiter','Cooldude2606','Likes biters too much')
+
+    -- This will give 'MrBiter' all his roles back and remove him from jail
+    -- again as above the player name is only used in the event for user feedback
+    Jail.unjail_player('MrBiter','Cooldude2606')
+
+    -- Temp ban works the same as jail but will store the reason and move the players items to spawn
+    -- this is meant to be used as a more permiment jail but not as strong as a ban
+    Jail.temp_ban_player('MrBiter','Cooldude2606','Likes biters too much')
+ + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + +
expcore.roles
utils.game
utils.global
expcore.common
+ + +

Events

+ + + + + + + + + + + + + + + + + + + + +
on_player_jailedWhen a player is assigned to jail
on_player_unjailedWhen a player is unassigned from jail
on_player_temp_bannedWhen a player is temp banned
on_player_untemp_bannedWhen a temp ban is removed from a player
+ + +

Jail

+ + + + + + + + + + + + + + + + +
is_jailed(player)Checks if the player is currently in jail
jail_player(player, by_player_name[, reason='Non given.'])Moves a player to jail and removes all other roles
unjail_player(player, by_player_name)Moves a player out of jail and restores all roles previously removed
+ + +

Temp ban

+ + + + + + + + + + + + + + + + +
is_temp_banned(player)Checks if a player is temp banned
temp_ban_player(player, by_player_name[, reason='Non given.'])Temp bans a player by moving them to jail, clearing all other roles, storing the reason, and moving their items to spawn
untemp_ban_player(player, by_player_name)Rrmoves a player from temp ban by clearing the stored reason, removing them from jail, and restoring previous roles
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Events

+
+
+
+
+ # + on_player_jailed +
+
+
+
+ +

When a player is assigned to jail

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who was jailed + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who jailed the other player + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player was jailed + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_player_unjailed +
+
+
+
+ +

When a player is unassigned from jail

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who was unjailed + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who unjailed the other player + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_player_temp_banned +
+
+
+
+ +

When a player is temp banned

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who was temp banned + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who temp banned the other player + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player was temp banned + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_player_untemp_banned +
+
+
+
+ +

When a temp ban is removed from a player

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who was untemp banned + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who untemp banned the other player + +
  • + + +
+ + + + + + + + + + + + + +
+
+

Jail

+
+
+
+
+ # + is_jailed(player) +
+
+
+
+ +

Checks if the player is currently in jail

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to check if they are in jail + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the player is currently in jail +
  • +
+ + + + + + + + + +
+
+
+
+ # + jail_player(player, by_player_name[, reason='Non given.']) +
+
+
+
+ +

Moves a player to jail and removes all other roles

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player who will be jailed + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who is doing the jailing + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player is being jailed + + (default: 'Non given.') +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + wheather the user was jailed successfully +
  • +
+ + + + + + + + + +
+
+
+
+ # + unjail_player(player, by_player_name) +
+
+
+
+ +

Moves a player out of jail and restores all roles previously removed

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will be unjailed + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player that is doing the unjail + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the player was unjailed successfully +
  • +
+ + + + + + + + + +
+
+

Temp ban

+
+
+
+
+ # + is_temp_banned(player) +
+
+
+
+ +

Checks if a player is temp banned

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to check if they are temp banned + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the player is temp banned +
  • +
+ + + + + + + + + +
+
+
+
+ # + temp_ban_player(player, by_player_name[, reason='Non given.']) +
+
+
+
+ +

Temp bans a player by moving them to jail, clearing all other roles, storing the reason, and moving their items to spawn

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will be temp banned + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who is doing the temp ban + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player is being temp banned + + (default: 'Non given.') +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the player was successfully temp banned +
  • +
+ + + + + + + + + +
+
+
+
+ # + untemp_ban_player(player, by_player_name) +
+
+
+
+ +

Rrmoves a player from temp ban by clearing the stored reason, removing them from jail, and restoring previous roles

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player who is being removed from temp ban + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who is doing the untemp ban + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the player was successfully removed +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/control/Production.html b/docs/control/Production.html new file mode 100644 index 00000000..ea5291cb --- /dev/null +++ b/docs/control/Production.html @@ -0,0 +1,1337 @@ + + + + + + + + Production control + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Production control

+

Control Module - Production + - Common functions used to track production of items

+

+ + + + + + +

Usage

+

+    -- import the module from the control modules
+    local Production = require '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
+    -- the other precision work like wise
+    Production.precision_up(defines.flow_precision_index.one_second)
+
+    -- The get production function is used to get production, consumion and net
+    -- it may be used for any item and with any precision level, use total for total
+    Production.get_production(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute)
+
+    -- The fluctuations works by compearing recent production with the average over time
+    -- again any precision may be used, apart from one_thousand_hours as there would be no valid average
+    Production.get_fluctuations(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute)
+
+    -- ETA is calculated based on what function you use but all share a similar method
+    -- for production eta it will take current production average given by the precision
+    -- and work out how many ticks it will require to make the required amount (1000 by default)
+    Production.get_production_eta(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute,250000)
+
+    -- Both get_color and format_number are helper functions to help format production stats
+    -- get_color will return green,orange,red,or grey based on the active_value
+    -- the passive_value is used when active_value is 0 and can only return orange,red,or grey
+    Production.get_color(clamp,active_value,passive_value)
+ + + + + + + +

Dependencies

+ + + + + + + + + + +
resources.color_presets
util
+ + +

Precision

+ + + + + + + + + + + + + + + + +
precision_up(precision)Gets the next lesser precision index value, eg 1 second -> 1 minute
precision_down(precision)Gets the next greater precision index value, eg 1 minute -> 1 second
precision_ticks(precision)Gets the number of tick that precision is given over, eg 1 minute -> 60 ticks
+ + +

Statistics

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
get_production_total(force, item_name)Returns the production data for the whole game time
get_production(force, item_name, precision)Returns the production data for the given precision game time
get_fluctuations(force, item_name, precision)Returns the current fluctuation from the average
get_production_eta(force, item_name, precision[, required=1000])Returns the amount of ticks required to produce a certain amount
get_consumsion_eta(force, item_name, precision[, required=1000])Returns the amount of ticks required to consume a certain amount
get_net_eta(force, item_name, precision[, required=1000])Returns the amount of ticks required to produce but not consume a certain amount
+ + +

Formating

+ + + + + + + + + + + + +
get_color(clamp, active_value, passive_value)Returns a color value bassed on the value that was given
format_number(value)Returns three parts used to format a number
+ + +
+ + +

Dependencies

+
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + util +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Precision

+
+
+
+
+ # + precision_up(precision) +
+
+
+
+ +

Gets the next lesser precision index value, eg 1 second -> 1 minute

+

+ + + Parameters: + + + + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + precision_down(precision) +
+
+
+
+ +

Gets the next greater precision index value, eg 1 minute -> 1 second

+

+ + + Parameters: + + + + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + precision_ticks(precision) +
+
+
+
+ +

Gets the number of tick that precision is given over, eg 1 minute -> 60 ticks

+

+ + + Parameters: + + + + + + + Returns: +
    +
  • + (number) + the number of ticks in this time +
  • +
+ + + + + + + + + +
+
+

Statistics

+
+
+
+
+ # + get_production_total(force, item_name) +
+
+
+
+ +

Returns the production data for the whole game time

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + contains total made, used and net +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_production(force, item_name, precision) +
+
+
+
+ +

Returns the production data for the given precision game time

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + + + + +
  • + + precision + + : + + (defines.flow_precision_index) + + the precision that you want the data given to + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + contains made, used and net +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_fluctuations(force, item_name, precision) +
+
+
+
+ +

Returns the current fluctuation from the average

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + + + + +
  • + + precision + + : + + (defines.flow_precision_index) + + the precision that you want the data given to + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + contains made, used and net +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_production_eta(force, item_name, precision[, required=1000]) +
+
+
+
+ +

Returns the amount of ticks required to produce a certain amount

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + + + + +
  • + + precision + + : + + (defines.flow_precision_index) + + the precision that you want the data given to + +
  • + + + + + +
  • + + required + + : + + (number) + + the number of items that are required to be made + + (default: 1000) +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of ticks required to produce this ammount of items +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_consumsion_eta(force, item_name, precision[, required=1000]) +
+
+
+
+ +

Returns the amount of ticks required to consume a certain amount

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + + + + +
  • + + precision + + : + + (defines.flow_precision_index) + + the precision that you want the data given to + +
  • + + + + + +
  • + + required + + : + + (number) + + the number of items that are required to be consumed + + (default: 1000) +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of ticks required to consume this ammount of items +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_net_eta(force, item_name, precision[, required=1000]) +
+
+
+
+ +

Returns the amount of ticks required to produce but not consume a certain amount

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + + + + +
  • + + precision + + : + + (defines.flow_precision_index) + + the precision that you want the data given to + +
  • + + + + + +
  • + + required + + : + + (number) + + the number of items that are required to be made but not used + + (default: 1000) +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of ticks required to produce, but not use, this ammount of items +
  • +
+ + + + + + + + + +
+
+

Formating

+
+
+
+
+ # + get_color(clamp, active_value, passive_value) +
+
+
+
+ +

Returns a color value bassed on the value that was given

+

+ + + Parameters: + +
    + + + + + +
  • + + clamp + + : + + (number) + + value which seperates the different colours + +
  • + + + + + +
  • + + active_value + + : + + (number) + + first value tested, tested against clamp + +
  • + + + + + +
  • + + passive_value + + : + + (number) + + second value tested, tested against 0 + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + contains r,g,b keys +
  • +
+ + + + + + + + + +
+
+
+
+ # + format_number(value) +
+
+
+
+ +

Returns three parts used to format a number

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + (number) + + the value to format + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the sign for the number +
  • +
  • + (string) + the surfix for any unit used +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/control/Reports.html b/docs/control/Reports.html new file mode 100644 index 00000000..4470dca7 --- /dev/null +++ b/docs/control/Reports.html @@ -0,0 +1,1118 @@ + + + + + + + + Reports control + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Reports control

+

Control Module - Reports + - Adds a way to report players and store report messages.

+

+ + + + + + +

Usage

+

+    -- import the module from the control modules
+    local Reports = require '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
+    -- seen by using Reports.get_report.
+    Reports.report_player('MrBiter','Cooldude2606','Liking biters too much') -- true
+
+    -- The other get methods can be used to get all the reports on a player or to test if a player is reported.
+    Reports.get_report('MrBiter','Cooldude2606') -- 'Liking biters too much'
+
+    -- This will remove the warning on 'MrBiter' (must be a valid player) which was made by 'Cooldude2606'.
+    Reports.remove_report('MrBiter','Cooldude2606') -- true
+
+    -- This will remove all the report that have been made against 'MrBiter'. Note that the remove event will
+    -- be triggered once per report issused.
+    Reports.remove_all('MrBiter') -- true
+
+ + + + + + + +

Dependencies

+ + + + + + + + + + +
utils.game
utils.global
+ + +

Events

+ + + + + + + + + + + + +
on_player_reportedWhen a player is reported
on_report_removedWhen a report is removed from a player
+ + +

Getters

+ + + + + + + + + + + + + + + + + + + + +
get_reports(player)Gets a list of all reports that a player has against them
get_report(player, by_player_name)Gets a single report against a player given the name of the player who made the report
is_reported(player[, by_player_name])Checks if a player is reported, option to get if reported by a certain player
count_reports(player[, custom_count])Counts the number of reports that a player has aganist them
+ + +

Setters

+ + + + + + + + + + + + + + + + +
report_player(player, by_player_name[, reason='Non given.'])Adds a report to a player, each player can only report another player once
remove_report(player, reported_by_name, removed_by_name)Removes a report from a player
remove_all(player, removed_by_name)Removes all reports from a player
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Events

+
+
+
+
+ # + on_player_reported +
+
+
+
+ +

When a player is reported

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the player index of the player who got reported + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who made the report + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason given for the report + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_report_removed +
+
+
+
+ +

When a report is removed from a player

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the player index of the player who has the report removed + +
  • + + + + + +
  • + + reported_by_name + + : + + (string) + + the name of the player who made the removed report + +
  • + + + + + +
  • + + removed_by_name + + : + + (string) + + the name of the player who removed the report + +
  • + + +
+ + + + + + + + + + + + + +
+
+

Getters

+
+
+
+
+ # + get_reports(player) +
+
+
+
+ +

Gets a list of all reports that a player has against them

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the report for + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + a list of all reports, key is by player name, value is reason +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_report(player, by_player_name) +
+
+
+
+ +

Gets a single report against a player given the name of the player who made the report

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the report for + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who made the report + +
  • + + +
+ + + + + Returns: +
    +
  • + (string or nil) + string is the reason that the player was reported, if the player is not reported +
  • +
+ + + + + + + + + +
+
+
+
+ # + is_reported(player[, by_player_name]) +
+
+
+
+ +

Checks if a player is reported, option to get if reported by a certain player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to check if reported + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + when given will check if reported by this player + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + if the player has been reported +
  • +
+ + + + + + + + + +
+
+
+
+ # + count_reports(player[, custom_count]) +
+
+
+
+ +

Counts the number of reports that a player has aganist them

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to count the reports for + +
  • + + + + + +
  • + + custom_count + + : + + (function) + + when given this function will be used to count the reports + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of reports that the user has +
  • +
+ + + + + + + + + +
+
+

Setters

+
+
+
+
+ # + report_player(player, by_player_name[, reason='Non given.']) +
+
+
+
+ +

Adds a report to a player, each player can only report another player once

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to add the report to + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player that is making the report + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player is being reported + + (default: 'Non given.') +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the report was added successfully +
  • +
+ + + + + + + + + +
+
+
+
+ # + remove_report(player, reported_by_name, removed_by_name) +
+
+
+
+ +

Removes a report from a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to remove the report from + +
  • + + + + + +
  • + + reported_by_name + + : + + (string) + + the name of the player that made the report + +
  • + + + + + +
  • + + removed_by_name + + : + + (string) + + the name of the player who removed the report + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the report was removed successfully +
  • +
+ + + + + + + + + +
+
+
+
+ # + remove_all(player, removed_by_name) +
+
+
+
+ +

Removes all reports from a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to remove the reports from + +
  • + + + + + +
  • + + removed_by_name + + : + + (string) + + the name of the player who removed the report + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the reports were removed successfully +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html new file mode 100644 index 00000000..ea2c7aae --- /dev/null +++ b/docs/control/Rockets.html @@ -0,0 +1,992 @@ + + + + + + + + Rockets control + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Rockets control

+

Control Module - Rockets + - Stores rocket stats for each force.

+

+ + + + + + +

Usage

+

+    -- import the module from the control modules
+    local Rockets = require '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
+    Rockets.get_silo_data(rocket_silo_entity)
+
+    -- Some information is also stored for each force
+    Rockets.get_stats('player')
+
+    -- You can get the rocket data for all silos for a force by using get_silos
+    Rockets.get_silos('player')
+
+    -- You can get the launch time for a rocket, meaning what game tick the 50th rocket was launched
+    Rockets.get_rocket_time('player',50)
+
+    -- The rolling average will work out the time to launch one rocket based on the last X rockets
+    Rockets.get_rolling_average('player',10)
+ + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
utils.event
utils.global
config.rockets
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
get_silo_data(silo)Gets the silo data for a given silo entity
get_silo_data_by_name(silo_name)Gets the silo data for a given silo entity
get_silo_entity(silo_name)Gets the silo entity from its silo name, reverse to get_silo_data
get_stats(force_name)Gets the rocket stats for a force
get_silos(force_name)Gets all the rocket silos that belong to a force
get_rocket_time(force_name, rocket_number)Gets the launch time of a given rocket, due to cleaning not all counts are valid
get_rocket_count(force_name)Gets the number of rockets that a force has launched
get_game_rocket_count()Gets the total number of rockets launched by all forces
get_rolling_average(force_name, count)Gets the rolling average time to launch a rocket
+ + +

Fields

+ + + + + + + + +
silo_data.launchedAdds this 1 to the launch count for this silo
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.rockets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + get_silo_data(silo) +
+
+
+
+ +

Gets the silo data for a given silo entity

+

+ + + Parameters: + +
    + + + + + +
  • + + silo + + : + + (LuaEntity) + + the rocket silo entity + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the data table for this silo, contains rockets launch, silo status, and its force +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_silo_data_by_name(silo_name) +
+
+
+
+ +

Gets the silo data for a given silo entity

+

+ + + Parameters: + +
    + + + + + +
  • + + silo_name + + : + + (string) + + the silo name that is stored in its data + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the data table for this silo, contains rockets launch, silo status, and its force +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_silo_entity(silo_name) +
+
+
+
+ +

Gets the silo entity from its silo name, reverse to get_silo_data

+

+ + + Parameters: + +
    + + + + + +
  • + + silo_name + + : + + (string) + + the silo name that is stored in its data + +
  • + + +
+ + + + + Returns: +
    +
  • + (LuaEntity) + the rocket silo entity +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_stats(force_name) +
+
+
+
+ +

Gets the rocket stats for a force

+

+ + + Parameters: + +
    + + + + + +
  • + + force_name + + : + + (string) + + the name of the force to get the stats for + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the table of stats for the force +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_silos(force_name) +
+
+
+
+ +

Gets all the rocket silos that belong to a force

+

+ + + Parameters: + +
    + + + + + +
  • + + force_name + + : + + (string) + + the name of the force to get the silos for + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + an array of silo data that all belong to this force +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_rocket_time(force_name, rocket_number) +
+
+
+
+ +

Gets the launch time of a given rocket, due to cleaning not all counts are valid

+

+ + + Parameters: + +
    + + + + + +
  • + + force_name + + : + + (string) + + the name of the force to get the count for + +
  • + + + + + +
  • + + rocket_number + + : + + (number) + + the number of the rocket to get the launch time for + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the game tick that the rocket was lanuched on +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_rocket_count(force_name) +
+
+
+
+ +

Gets the number of rockets that a force has launched

+

+ + + Parameters: + +
    + + + + + +
  • + + force_name + + : + + (string) + + the name of the force to get the count for + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of rockets that the force has launched +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_game_rocket_count() +
+
+
+
+ +

Gets the total number of rockets launched by all forces

+

+ + + + + + Returns: +
    +
  • + (number) + the total number of rockets launched this game +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_rolling_average(force_name, count) +
+
+
+
+ +

Gets the rolling average time to launch a rocket

+

+ + + Parameters: + +
    + + + + + +
  • + + force_name + + : + + (string) + + the name of the force to get the average for + +
  • + + + + + +
  • + + count + + : + + (number) + + the distance to get the rolling average over + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of ticks required to launch one rocket +
  • +
+ + + + + + + + + +
+
+

Fields

+
+
+
+
+ # + silo_data.launched +
+
+
+
+ +

Adds this 1 to the launch count for this silo

+

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html new file mode 100644 index 00000000..41068882 --- /dev/null +++ b/docs/control/Tasks.html @@ -0,0 +1,1006 @@ + + + + + + + + Tasks control + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Tasks control

+

Control Module - Tasks +- Stores tasks for each force.

+

+ + + + + + +

Usage

+
-- Making and then editing a new task
+local task_id = Tasks.add_task(game.player.force.name,nil,game.player.name)
+
+Tasks.update_task(task_id,'We need more iron!',game.player.name)
+ + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
expcore.store
utils.global
utils.token
+ + +

Getters

+ + + + + + + + + + + + + + + + +
get_task(task_id)Gets the task information that is linked with this id
get_force_task_ids(force_name)Gets all the task ids that a force has
get_editing(task_id, player_name)Gets the editing state for a player
+ + +

Setters

+ + + + + + + + + + + + + + + + + + + + + + + + +
add_task(force_name[, task_number][, player_name][, task_message])Add a new task for a force, the task can be placed into a certain position for that force
remove_task(task_id)Removes a task and any data that is linked with it
update_task(task_id, new_message[, player_name='server'])Update the message and last edited information for a task
set_editing(task_id, player_name, state)Set the editing state for a player, can be used as a warning or to display a text field
on_update(handler)Adds an update handler for when a task is added, removed, or updated
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.store +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.token +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Getters

+
+
+
+
+ # + get_task(task_id) +
+
+
+
+ +

Gets the task information that is linked with this id

+

+ + + Parameters: + +
    + + + + + +
  • + + task_id + + : + + (string) + + the uid of the task you want to get + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the task information +
  • +
+ + + + + + + + Usage: +
-- Getting task information outside of on_update
+local task = Tasks.get_task(task_id)
+ + +
+
+
+
+ # + get_force_task_ids(force_name) +
+
+
+
+ +

Gets all the task ids that a force has

+

+ + + Parameters: + +
    + + + + + +
  • + + force_name + + : + + (string) + + the name of the force that you want the task ids for + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + an array of all the task ids +
  • +
+ + + + + + + + Usage: +
-- Getting the task ids for a force
+local task_ids = Tasks.get_force_task_ids(game.player.force.name)
+ + +
+
+
+
+ # + get_editing(task_id, player_name) +
+
+
+
+ +

Gets the editing state for a player

+

+ + + Parameters: + +
    + + + + + +
  • + + task_id + + : + + (string) + + the uid of the task you want to check + +
  • + + + + + +
  • + + player_name + + : + + (string) + + the name of the player that you want to check + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + weather the player is currently editing this task +
  • +
+ + + + + + + + Usage: +
-- Check if a player is editing a task or not
+local editing = Tasks.get_editing(task_id,game.player.name)
+ + +
+
+

Setters

+
+
+
+
+ # + add_task(force_name[, task_number][, player_name][, task_message]) +
+
+
+
+ +

Add a new task for a force, the task can be placed into a certain position for that force

+

+ + + Parameters: + +
    + + + + + +
  • + + force_name + + : + + (string) + + the name of the force to add the task for + +
  • + + + + + +
  • + + task_number + + : + + (number) + + the order place to add the task to, appends to end if omited + + (optional) +
  • + + + + + +
  • + + player_name + + : + + (string) + + the player who added this task, will cause them to be listed under editing + + (optional) +
  • + + + + + +
  • + + task_message + + : + + (string) + + the message that is used for this task, if not given default is used + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the uid of the task which was created +
  • +
+ + + + + + + + Usage: +
-- Adding a new task for your force
+local task_id = Tasks.add_task(game.player.force.name,nil,game.player.name)
+ + +
+
+
+
+ # + remove_task(task_id) +
+
+
+
+ +

Removes a task and any data that is linked with it

+

+ + + Parameters: + +
    + + + + + +
  • + + task_id + + : + + (string) + + the uid of the task which you want to remove + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Removing a task
+Tasks.remove_task(task_id)
+ + +
+
+
+
+ # + update_task(task_id, new_message[, player_name='server']) +
+
+
+
+ +

Update the message and last edited information for a task

+

+ + + Parameters: + +
    + + + + + +
  • + + task_id + + : + + (string) + + the uid of the task that you want to update + +
  • + + + + + +
  • + + new_message + + : + + (string) + + the message that you want to have for the task + +
  • + + + + + +
  • + + player_name + + : + + (string) + + the name of the player who made the edit + + (default: 'server') +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Updating the message for on a task
+Task.update_task(task_id,'We need more iron!',game.player.name)
+ + +
+
+
+
+ # + set_editing(task_id, player_name, state) +
+
+
+
+ +

Set the editing state for a player, can be used as a warning or to display a text field

+

+ + + Parameters: + +
    + + + + + +
  • + + task_id + + : + + (string) + + the uid of the task that you want to effect + +
  • + + + + + +
  • + + player_name + + : + + (string) + + the name of the player you want to set the state for + +
  • + + + + + +
  • + + state + + : + + (boolean) + + the new state to set editing to + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Setting your editing state to true
+Tasks.set_editing(task_id,game.player.name,true)
+ + +
+
+
+
+ # + on_update(handler) +
+
+
+
+ +

Adds an update handler for when a task is added, removed, or updated

+

+ + + Parameters: + +
    + + + + + +
  • + + handler + + : + + (function) + + the handler which is called when a task is updated + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Add a game print when a task is updated
+Tasks.on_update(function(task)
+    game.print(task.force_name..' now has the task: '..task.message)
+end)
+ + +
+
+ + + +
+
+
+ + + + diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html new file mode 100644 index 00000000..abec17b0 --- /dev/null +++ b/docs/control/Warnings.html @@ -0,0 +1,1473 @@ + + + + + + + + Warnings control + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Warnings control

+

Control Module - Warnings + - Adds a way to give and remove warnings to players.

+

+ + + + + + +

Usage

+

+    -- import the module from the control modules
+    local Warnings = require 'modules.control.warnings' --- @dep modules.control.warnings
+
+    -- This will add a warning to the player
+    Warnings.add_warning('MrBiter','Cooldude2606','Killed too many biters')
+
+    -- This will remove a warning from a player, second name is just who is doing the action
+    Warnings.remove_warning('MrBiter','Cooldude2606')
+
+    -- Script warning as similar to normal warning but are designed to have no effect for a short amount of time
+    -- this is so it can be used for greifer protection without being too agressive
+    Warnings.add_script_warning('MrBiter','Killed too many biters')
+
+    -- Both normal and script warnings can also be cleared, this will remove all warnings
+    Warnings.clear_warnings('MrBiter','Cooldude2606')
+ + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + +
utils.event
utils.game
utils.global
config.warnings
+ + +

Events

+ + + + + + + + + + + + + + + + + + + + +
on_warning_addedWhen a warning is added to a player
on_warning_removedWhen a warning is removed from a player
on_script_warning_addedWhen a warning is added to a player, by the script
on_script_warning_removedWhen a warning is remnoved from a player, by the script
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
get_warnings(player)Gets an array of warnings that the player has, always returns a list even if emtpy
count_warnings(player)Gets the number of warnings that a player has on them
add_warning(player, by_player_name[, reason='Non given.'])Adds a warning to a player, when a warning is added a set action is done based on the number of warnings and the config file
remove_warning(player, by_player_name)Removes a warning from a player, always removes the earlyist warning, fifo
clear_warnings(player, by_player_name)Removes all warnings from a player, will trigger remove event for each warning
get_script_warnings(player)Gets an array of all the script warnings that a player has
count_script_warnings(player)Gets the number of script warnings that a player has on them
add_script_warning(player[, reason='Non given.'])Adds a script warning to a player, this may add a full warning if max script warnings is met
remove_script_warning(player)Removes a script warning from a player
clear_script_warnings(player)Removes all script warnings from a player, emits event for each warning removed
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.warnings +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Events

+
+
+
+
+ # + on_warning_added +
+
+
+
+ +

When a warning is added to a player

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who recived the warning + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who gave the warning + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player was given a warning + +
  • + + + + + +
  • + + warning_count + + : + + (number) + + the new number of warnings that the player has + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_warning_removed +
+
+
+
+ +

When a warning is removed from a player

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who is having the warning removed + +
  • + + + + + +
  • + + warning_by_name + + : + + (string) + + the name of the player who gave the warning + +
  • + + + + + +
  • + + removed_by_name + + : + + (string) + + the name of the player who is removing the warning + +
  • + + + + + +
  • + + warning_count + + : + + (number) + + the new number of warnings that the player has + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_script_warning_added +
+
+
+
+ +

When a warning is added to a player, by the script

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who recived the warning + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player was given a warning + +
  • + + + + + +
  • + + warning_count + + : + + (number) + + the new number of warnings that the player has + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_script_warning_removed +
+
+
+
+ +

When a warning is remnoved from a player, by the script

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who is having the warning removed + +
  • + + + + + +
  • + + warning_count + + : + + (number) + + the new number of warnings that the player has + +
  • + + +
+ + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + get_warnings(player) +
+
+
+
+ +

Gets an array of warnings that the player has, always returns a list even if emtpy

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the warning for + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + an array of all the warnings on this player, contains tick, by_player_name and reason +
  • +
+ + + + + + + + + +
+
+
+
+ # + count_warnings(player) +
+
+
+
+ +

Gets the number of warnings that a player has on them

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to count the warnings for + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + add_warning(player, by_player_name[, reason='Non given.']) +
+
+
+
+ +

Adds a warning to a player, when a warning is added a set action is done based on the number of warnings and the config file

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to add a warning to + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who is doing the action + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player is being warned + + (default: 'Non given.') +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + remove_warning(player, by_player_name) +
+
+
+
+ +

Removes a warning from a player, always removes the earlyist warning, fifo

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to remove a warning from + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who is doing the action + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + clear_warnings(player, by_player_name) +
+
+
+
+ +

Removes all warnings from a player, will trigger remove event for each warning

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to clear the warnings from + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who is doing the action + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true when warnings were cleared succesfully +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_script_warnings(player) +
+
+
+
+ +

Gets an array of all the script warnings that a player has

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the script warnings of + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + a table of all the script warnings a player has, contains tick and reason +
  • +
+ + + + + + + + + +
+
+
+
+ # + count_script_warnings(player) +
+
+
+
+ +

Gets the number of script warnings that a player has on them

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to count the script warnings of + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of script warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + add_script_warning(player[, reason='Non given.']) +
+
+
+
+ +

Adds a script warning to a player, this may add a full warning if max script warnings is met

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to add a script warning to + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player is being warned + + (default: 'Non given.') +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of script warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + remove_script_warning(player) +
+
+
+
+ +

Removes a script warning from a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to remove a script warning from + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of script warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + clear_script_warnings(player) +
+
+
+
+ +

Removes all script warnings from a player, emits event for each warning removed

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to clear the script warnings from + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/control/Warps.html b/docs/control/Warps.html new file mode 100644 index 00000000..ebb0dfb5 --- /dev/null +++ b/docs/control/Warps.html @@ -0,0 +1,1571 @@ + + + + + + + + Warps control + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Warps control

+

Control Module - Warps +- Stores warps for each force.

+

+ + + + + + +

Usage

+
-- Making a new spawn warp
+local player = game.player
+local force = player.force
+local spawn_id = Warps.add_warp(force.name,player.surface,player.position,player.name,'Spawn')
+
+Warps.set_spawn_warp(spawn_id, force)
+Warps.make_warp_tag(spawn_id)
+
-- Making a new warp with a warp area
+local player = game.player
+local force = player.force
+local warp_id = Warps.add_warp(force.name,player.surface,player.position,player.name)
+
+Warps.make_warp_area(warp_id)
+Warps.make_warp_tag(warp_id)
+ + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + +
expcore.store
utils.global
utils.token
config.warps
expcore.common
+ + +

Getters

+ + + + + + + + + + + + + + + + + + + + +
get_warp(warp_id)Gets the warp information that is linked with this id
get_force_warp_ids(force_name)Gets all the warp ids that a force has
get_spawn_warp_id(force_name)Get the id of the spawn warp
get_editing(warp_id, player_name)Gets the editing state for a player
+ + +

Setters

+ + + + + + + + + + + + + + + + + + + + + + + + +
add_warp(force_name, surface, position[, player_name][, warp_name])Add a new warp for a force, the warp must have a surface and a position
remove_warp(warp_id)Removes a warp and any data linked to it
update_warp(warp_id[, new_name][, new_icon][, player_name='server'])Update the name and icon for a warp
set_editing(warp_id, player_name, state)Set the editing state for a player, can be used as a warning or to display a text field
on_update(handler)Adds an update handler for when a warp is added, removed, or updated
+ + +

Map Intergration

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
make_warp_tag(warp_id)Add or update the chat tag for this warp
remove_warp_tag(warp_id)Remove the chart tag for this warp
make_warp_area(warp_id)Add a warp area for the warp, purely cosmetic
remove_warp_area(warp_id)Remove the warp area for a warp
set_spawn_warp(warp_id, force)Set a warp to be the spawn point for a force, force must own this warp
teleport_player(warp_id, player)Teleport a player to a warp point
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.store +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.token +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.warps +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Getters

+
+
+
+
+ # + get_warp(warp_id) +
+
+
+
+ +

Gets the warp information that is linked with this id

+

+ + + Parameters: + +
    + + + + + +
  • + + warp_id + + : + + (string) + + the uid of the warp you want to get + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the warp information +
  • +
+ + + + + + + + Usage: +
-- Getting warp information outside of on_update
+local warp = Warps.get_warp(warp_id)
+ + +
+
+
+
+ # + get_force_warp_ids(force_name) +
+
+
+
+ +

Gets all the warp ids that a force has

+

+ + + Parameters: + +
    + + + + + +
  • + + force_name + + : + + (string) + + the name of the force that you want the warp ids for + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + an array of all the warp ids +
  • +
+ + + + + + + + Usage: +
-- Getting the warp ids for a force
+local warp_ids = Warps.get_force_warp_ids(game.player.force.name)
+ + +
+
+
+
+ # + get_spawn_warp_id(force_name) +
+
+
+
+ +

Get the id of the spawn warp

+

+ + + Parameters: + +
    + + + + + +
  • + + force_name + + : + + (string) + + the name of the force that you want to get the spawn warp for + +
  • + + +
+ + + + + Returns: +
    +
  • + (string or nil) + the uid of the spawn warp for this force if there is one +
  • +
+ + + + + + + + Usage: +
-- Getting the spawn warp id
+local spawn_id = Warps.get_spawn_warp_id(game.player.force.name)
+ + +
+
+
+
+ # + get_editing(warp_id, player_name) +
+
+
+
+ +

Gets the editing state for a player

+

+ + + Parameters: + +
    + + + + + +
  • + + warp_id + + : + + (string) + + the uid of the warp you want to check + +
  • + + + + + +
  • + + player_name + + : + + (string) + + the name of the player that you want to check + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + weather the player is currently editing this warp +
  • +
+ + + + + + + + Usage: +
-- Check if a player is editing a warp or not
+local editing = Warps.get_editing(warp_id,game.player.name)
+ + +
+
+

Setters

+
+
+
+
+ # + add_warp(force_name, surface, position[, player_name][, warp_name]) +
+
+
+
+ +

Add a new warp for a force, the warp must have a surface and a position

+

+ + + Parameters: + +
    + + + + + +
  • + + force_name + + : + + (string) + + the name of the force to add the warp for + +
  • + + + + + +
  • + + surface + + : + + (LuaSurface) + + the surface that the warp will be on + +
  • + + + + + +
  • + + position + + : + + (Position) + + the position that the warp will be on + +
  • + + + + + +
  • + + player_name + + : + + (string) + + the name of the player that is adding the warp + + (optional) +
  • + + + + + +
  • + + warp_name + + : + + (string) + + the name of the warp that is being added, if omited default is used + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the uid of the warp which was created +
  • +
+ + + + + + + + Usage: +
-- Adding a new warp for your force at your position
+local player = game.player
+local warp_id = Warps.add_warp(player.force.name,player.surface,player.position,player.name)
+ + +
+
+
+
+ # + remove_warp(warp_id) +
+
+
+
+ +

Removes a warp and any data linked to it

+

+ + + Parameters: + +
    + + + + + +
  • + + warp_id + + : + + (string) + + the uid of the warp that you want to remove + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Removing a warp
+Warps.remove_warp(warp_id)
+ + +
+
+
+
+ # + update_warp(warp_id[, new_name][, new_icon][, player_name='server']) +
+
+
+
+ +

Update the name and icon for a warp

+

+ + + Parameters: + +
    + + + + + +
  • + + warp_id + + : + + (string) + + the uid of the warp that you want to update + +
  • + + + + + +
  • + + new_name + + : + + (string) + + the new name that you want the warp to have + + (optional) +
  • + + + + + +
  • + + new_icon + + : + + (string) + + the new icon that you want the warp to have + + (optional) +
  • + + + + + +
  • + + player_name + + : + + (string) + + the name of the player that made the edit + + (default: 'server') +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Changing the name and icon for a warp
+Warps.update_warp(warp_id,'My Warp','iron-plate',game.player.name)
+ + +
+
+
+
+ # + set_editing(warp_id, player_name, state) +
+
+
+
+ +

Set the editing state for a player, can be used as a warning or to display a text field

+

+ + + Parameters: + +
    + + + + + +
  • + + warp_id + + : + + (string) + + the uid of the warp that you want to effect + +
  • + + + + + +
  • + + player_name + + : + + (string) + + the name of the player you want to set the state for + +
  • + + + + + +
  • + + state + + : + + (boolean) + + the new state to set editing to + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Setting your editing state to true
+Warps.set_editing(warp_id,game.player.name,true)
+ + +
+
+
+
+ # + on_update(handler) +
+
+
+
+ +

Adds an update handler for when a warp is added, removed, or updated

+

+ + + Parameters: + +
    + + + + + +
  • + + handler + + : + + (function) + + the handler which is called when a warp is updated + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Add a game print when a warp is updated
+Warps.on_update(function(warp)
+    game.print(warp.force_name..' now has the warp: '..warp.name)
+end)
+ + +
+
+

Map Intergration

+
+
+
+
+ # + make_warp_tag(warp_id) +
+
+
+
+ +

Add or update the chat tag for this warp

+

+ + + Parameters: + +
    + + + + + +
  • + + warp_id + + : + + (string) + + the uid of the warp you want the chart tag for + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if a new tag was made, false if it was updated +
  • +
+ + + + + + + + Usage: +
-- Adding a chart tag for a new warp
+local tag_added = Warps.make_warp_tag(warp_id)
+ + +
+
+
+
+ # + remove_warp_tag(warp_id) +
+
+
+
+ +

Remove the chart tag for this warp

+

+ + + Parameters: + +
    + + + + + +
  • + + warp_id + + : + + (string) + + the uid for the warp that you want to remove the chart tag from + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the tag was valid and was removed, false if the tag was invalid +
  • +
+ + + + + + + + Usage: +
-- Removing the chart tag from a warp
+local removed = Warps.remove_warp_tag(warp_id)
+ + +
+
+
+
+ # + make_warp_area(warp_id) +
+
+
+
+ +

Add a warp area for the warp, purely cosmetic

+

+ + + Parameters: + +
    + + + + + +
  • + + warp_id + + : + + (string) + + the uid of the warp you want the area for + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Adding a warp area for a warp
+Warps.make_warp_area(warp_id)
+ + +
+
+
+
+ # + remove_warp_area(warp_id) +
+
+
+
+ +

Remove the warp area for a warp

+

+ + + Parameters: + +
    + + + + + +
  • + + warp_id + + : + + (string) + + the uid of the warp that you want to remove the area for + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Remove the warp area for a warp
+Warps.remove_warp_area(warp_id)
+ + +
+
+
+
+ # + set_spawn_warp(warp_id, force) +
+
+
+
+ +

Set a warp to be the spawn point for a force, force must own this warp

+

+ + + Parameters: + +
    + + + + + +
  • + + warp_id + + : + + (string) + + the uid of the warp that you want to be the spawn for the force + +
  • + + + + + +
  • + + force + + : + + (LuaForce) + + the force that you want to set the spawn for + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Set your forces spawn to a warp
+Warps.set_spawn_warp(warp_id,game.player.force)
+ + +
+
+
+
+ # + teleport_player(warp_id, player) +
+
+
+
+ +

Teleport a player to a warp point

+

+ + + Parameters: + +
    + + + + + +
  • + + warp_id + + : + + (string) + + the uid of the warp to send the player to + +
  • + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to teleport to the warp + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Teleport yourself to a warp point
+Warps.teleport_player(warp_id,game.player)
+ + +
+
+ + + +
+
+
+ + + + diff --git a/docs/core/Commands.html b/docs/core/Commands.html new file mode 100644 index 00000000..07dfce01 --- /dev/null +++ b/docs/core/Commands.html @@ -0,0 +1,1980 @@ + + + + + + + + Commands core + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Commands core

+

Core Module - Commands + - Factorio command making module that makes commands with better parse and more modularity

+

+ + + + + + +

Usage

+

+---- Example Authenticator:
+    -- The command system is most useful when you can control who can use commands; to do this would would need to
+    -- define an authenticator which is ran every time a command is run; in this example I will show a simple one
+    -- that requires some commands to require the user to be a game admin:
+
+    -- When the authenticator is called be the command handler it will be passed 4 vales:
+    -- 1) the player who used the command
+    -- 2) the name of the command that is being used
+    -- 3) any flags which have been set for this command, this is a table of values set using :set_flag(name,value)
+    -- 4) the reject function which is the preferred method to prevent execution of the command
+
+    -- For our admin only example we will set a flag to true when we want it do be admin only so when we define the
+    -- command will will use :set_flag('admin_only',true) and then inside the authenticator we will test if the flag
+    -- is present using: if flags.admin_only then
+
+    -- Although no return is required to allow the command to execute it is best practice to return true; we do this in
+    -- two cases in our authenticator:
+    -- 1) when the "admin_only" flag is not set, which we take to mean any one can use it
+    -- 2) when the "admin_only" flag is set, and the player is admin
+
+    -- Now when the user is not an admin and the command requires you to be an admin then we must reject the request:
+    -- 1) return false -- this is the most basic block and should only be used while testing
+    -- 2) return reject -- returning the reject function is only an option as a fail safe, same as returning false
+    -- 3) reject() -- this will block execution without returning to allow further code to be ran in the authenticator
+    -- 4) reject('This command is for admins only!') -- Using reject as a function allows a error message to be returned
+    -- 5) return reject() -- using return on either case above is best practice as you should execute all code before rejecting
+
+    -- Example Code:
+    Commands.add_authenticator(function(player,command,flags,reject)
+        if flags.admin_only then -- our test for the "admin_only" flag
+            if player.admin then
+                return true -- true return 2
+            else
+                return reject('This command is for admins only!') -- reject return 5 with a custom error message
+            end
+        else
+            return true -- true return 1
+        end
+    end)
+

+---- Example Parse:
+    -- Before you go making commands it is important to understand the most powerful feature of this command handler,
+    -- when you define a command you are able to type the params and have then be parsed by an handler so before your
+    -- command is ever executed you can be sure that all the params are valid. This module should be paired with a general
+    -- command parse but you may want to create your own:
+
+    -- For our example we will create a parse to accept only integer numbers in a given range:
+    -- 1) we will give it the name "number-range-int" this is the "type" that the input is expected to be
+    -- 2) when we define the type we will also define the min and max of the range so we can use the function more than once
+    -- Example parse usage:
+    :add_param('repeat_count',false,'number-range-int',5,10) -- range 5 to 10 inclusive
+
+    -- The command parse will be passed 3 params and any other you define, in our case:
+    -- 1) the input that has been given by the user for this param, the role of this function is to transform this value
+    -- nb: the input is a string but can be nil if the param is marked as optional
+    -- 2) the player who is using the command, this is always present
+    -- 3) the reject function to throw an error to the user, this is always present
+    -- 4) the range min, this is user defined and has the value given when the param is defined
+    -- 5) the range max, this is user defined and has the value given when the param is defined
+
+    -- When returning from the param parse you again have a few options with how to do this:
+    -- 1) you return the new value for the param (any non nil value) this value is then passed to the command callback
+    -- 2) not returning will cause a generic invalid error and the command callback is blocked, not recommenced
+    -- 3) return reject -- this is just a failsafe in case the function is not called, same as no return
+    -- 4) return reject() -- will give a shorter error message as you pass a nil custom error
+    -- 5) return reject('Number entered is not in range: '..range_min..', '..range_max) -- returns a custom error the the user
+    -- nb: if you do not return reject after you call it then you are still returning nil so there will be a duplicate message
+
+    -- It should be noted that if you want to expand on an existing parse you can use Commands.parse(type,input,player,reject)
+    -- and this value will either return a new value for the input or nil, if it is nil you should return nil to prevent double
+    -- messages to the user:
+    input = Commands.parse('number-int',input,player,reject)
+    if not input then return end -- nil check
+
+    -- Example Code:
+    Commands.add_parse('number-range-int',function(input,player,reject,range_min,range_max)
+        local rtn = tonumber(input) and math.floor(tonumber(input)) or nil -- converts input to number
+        if not rtn or rtn < range_min or rtn > range_max then
+            -- the input is either not a number or is outside the range
+            return reject('Number entered is not in range: '..range_min..', '..range_max)
+        else
+            -- returns the input as a number value rather than a string, thus the param is now the correct type
+            return rtn
+        end
+    end)
+

+---- Example Command:
+    -- How for the fun part making the commands, the commands can be set up with any number of params and flags that you want,
+    -- you can add aliases for the commands and set default values for optional params and of course register your command callback
+    -- in our example we will just have a command that will repeat the users name in chat X amount of times and only allow admins to use it.
+
+    -- First we create the new command, nb this will not register the command to the game this is done at the end, we will call
+    -- the command "repeat-name" and set the help message as follows:
+    Commands.new_command('repeat-name','Will repeat you name a number of times in chat.')
+
+    -- Now for our first param we will call "repeat-count" and it will be a required value between 1 and 5 inclusive:
+    :add_param('repeat-count',false,'number-range-int',1,5)
+
+    -- Our second param we need a custom parse for but we have not defined it, this is an option for when it is unlikely for
+    -- any other command to use the same input type; however in our case it will just be a boolean which should be noted as being
+    -- included in the general command parse config. As for the param its self it will be called "smiley" and will be optional with
+    -- a default value of false:
+    :add_param('smiley',true,function(input,player,reject)
+        -- since it is optional the input can be nil, in which case we just return
+        if not input then return end
+        -- if it is not nil then we check for a truthy value
+        if input:lower() == 'true' or input:lower() == 'yes' then
+            return true
+        else
+            -- note that because we did not return nil or reject then false will be passed to command callback, see example parse
+            return false
+        end
+    end)
+
+    -- Once all params are defined you can now define some default values if you have optional params, the default value will be used only
+    -- when no value is given as input, if an invalid value is given then the command will still fail and this value will not be used, the
+    -- default can also be a function which is passed the player using the command and returns a value. Here we set the default for "smiley" to false:
+    :set_defaults{smiley=false}
+
+    -- Another example of defaults if we have: item, amount[opt], player[opt]
+    :set_defaults{
+        amount = 50, -- more than one value can be set at a time
+        player = function(player)
+            return player -- default is the player using the command
+        end
+    }
+
+    -- Now the params are set up we can alter how the command works, we can set auth flags, add aliases to this command or enable "auto concat"
+    -- which is when you want all extra words to be concatenated onto the end of the last param, useful for reason or messages:
+    :set_flag('admin_only',true) -- in our case we want "admin_only" to be set to true so only admins can use the command
+    :add_alias('name','rname') -- we also add two aliases here: "name" and "rname" which point to this command
+    -- :enable_auto_concat() we do not use this in our case but this can also be used to enable the "auto concat" feature
+
+    -- And finally we want to register a callback to this command, the callback is what defines what the command does, can be as complex as you
+    -- want it to be to as simple as our example; the command receives two params plus all that you have defines:
+    -- 1) the player who used the command
+    -- 2) in our case repeat_count which will be a number
+    -- 3) in our case smiley which will be a boolean
+    -- 4) the raw input; this param is always last as is always present as a catch all
+    :register(function(player,repeat_count,smiley,raw)
+        -- this is to show the value for raw as this is an example command, the log file will also show this
+        game.print(player.name..' used a command with input: '..raw)
+        local msg = ') '..player.name
+        if smiley then
+            -- this is where that smiley param is used
+            msg = ':'..msg
+        end
+        for 1 = 1,repeat_count do
+            -- this print function will return ANY value to the user in a desync safe manor, this includes if the command was used through rcon
+            Command.print(1..msg)
+        end
+        -- see below for what else can be used here
+    end)
+
+    -- Some other useful functions that can be used are:
+    Commands.print(any,colour[opt]) -- this will return any value value to the user including if it is ran through rcon console
+    Commands.error(message[opt]) -- this returns a warning to the user, aka an error that does not prevent execution of the command
+    return Commands.error(message[opt]) -- this returns an error to the user, and will halt the command execution, ie no success message is returned
+    Commands.success(message[opt]) -- used to return a success message however don't use this method see below
+    return Commands.success(message[opt]) -- will return the success message to the user and your given message, halts execution
+    return <any> if any value is returned then it will be returned to the player via a Commands.success call
+
+    -- Example Code:
+    Commands.new_command('repeat-name','Will repeat you name a number of times in chat.')
+    :add_param('repeat-count',false,'number-range-int',1,5) -- required int in range 1 to 5 inclusive
+    :add_param('smiley',true,function(input,player,reject) -- optional boolean default false
+        if not input then return end
+        if input:lower() == 'true' or input:lower() == 'yes' then
+            return true
+        else
+            return false
+        end
+    end)
+    :set_defaults{smiley=false}
+    :set_flag('admin_only',true) -- command is admin only
+    :add_alias('name','rname') -- allow alias: name and rname
+    :register(function(player,repeat_count,smiley,raw)
+        game.print(player.name..' used a command with input: '..raw)
+        local msg = ') '..player.name
+        if smiley then
+            msg = ':'..msg
+        end
+        for 1 = 1,repeat_count do
+            Command.print(1..msg)
+        end
+    end)
+ + + + + + + +

Dependencies

+ + + + + + + + + + +
utils.game
expcore.common
+ + +

Authenication

+ + + + + + + + + + + + + + + + +
add_authenticator(callback)Adds an authorization callback, function used to check if a player if allowed to use a command
remove_authenticator(callback)Removes an authorization callback
authorize(player, command_name)Mostly used internally, calls all authorization callbacks, returns if the player is authorized
+ + +

Getters

+ + + + + + + + + + + + +
get([player])Gets all commands that a player is allowed to use, game commands not included
search(keyword[, allowed_player])Searches command names and help messages to find possible commands, game commands included
+ + +

Parse

+ + + + + + + + + + + + + + + + +
add_parse(name, callback)Adds a parse function which can be called by name rather than callback (used in add_param) + nb: this is not needed as you can use the callback directly this just allows it to be called by name
remove_parse(name)Removes a parse function, see add_parse for adding them
parse(name, input, player, reject)Intended to be used within other parse functions, runs a parse and returns success and new value
+ + +

Creation

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
new_command(name, help)Creates a new command object to added details to, note this does not register the command to the game
Commands._prototype:add_param(name[, optional=false][, parse=pass function through][, ...])Adds a new param to the command this will be displayed in the help and used to parse the input
Commands._prototype:set_defaults(defaults)Adds default values to params only matters if the param is optional, if default value is a function it is called with param player
Commands._prototype:set_flag(name, value)Adds a tag to the command which is passed via the flags param to the authenticators, can be used to assign command roles or type
Commands._prototype:add_alias(any)Adds an alias or multiple that will also be registered with the same callback, eg /teleport can be /tp with both working
Commands._prototype:enable_auto_concat()Enables auto concatenation of any params on the end so quotes are not needed for last param + nb: this will disable max param checking as they will be concatenated onto the end of that last param + this can be useful for reasons or longs text, can only have one per command
Commands._prototype:register(callback)Adds the callback to the command and registers all aliases, params and help message with the game + nb: this must be the last function ran on the command and must be done for the command to work
+ + +

Status

+ + + + + + + + + + + + + + + + + + + + +
error([error_message][, play_sound])Sends an error message to the player and returns a constant to return to command handler to exit execution + nb: this is for non fatal errors meaning there is no log of this event + nb: if reject is giving as a param to the callback use that instead
internal_error(success, command_name, error_message)Sends an error to the player and logs the error, used with pcall within command handler please avoid direct use + nb: use error(error_message) within your callback to trigger do not trigger directly as the handler may still continue
success([value])Sends a value to the player, followed by a command complete message + nb: either return a value from your callback to trigger or return the return of this to prevent two messages
run_command(command_event)Main event function that is ran for all commands, used internally please avoid direct use
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Authenication

+
+
+
+
+ # + add_authenticator(callback) +
+
+
+
+ +

Adds an authorization callback, function used to check if a player if allowed to use a command

+

+ + + Parameters: + +
    + + + + + +
  • + + callback + + : + + (function) + + the callback you want to register as an authenticator + callback param - player: LuaPlayer - the player who is trying to use the command + callback param - command: string - the name of the command which is being used + callback param - flags: table - any flags which have been set for the command + callback param - reject: function(error_message?: string) - call to fail authorize with optional error message + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the index it was inserted at use to remove the callback, if anon function used +
  • +
+ + + + + + + + + +
+
+
+
+ # + remove_authenticator(callback) +
+
+
+
+ +

Removes an authorization callback

+

+ + + Parameters: + +
    + + + + + +
  • + + callback + + : + + (function or number) + + the callback to remove, an index returned by add_authenticator can be passed + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + was the callback found and removed +
  • +
+ + + + + + + + + +
+
+
+
+ # + authorize(player, command_name) +
+
+
+
+ +

Mostly used internally, calls all authorization callbacks, returns if the player is authorized

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that is using the command, passed to callbacks + +
  • + + + + + +
  • + + command_name + + : + + (string) + + the command that is being used, passed to callbacks + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true player is authorized +
  • +
  • + (string) + commands const for success +
  • +
+
Or
+
    +
  • + (boolean) + false player is unauthorized +
  • +
  • + (string or locale_string) + the reason given by the authenticator +
  • +
+ + + + + + + + + +
+
+

Getters

+
+
+
+
+ # + get([player]) +
+
+
+
+ +

Gets all commands that a player is allowed to use, game commands not included

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that you want to get commands of, nil will return all commands + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + all commands that that player is allowed to use, or all commands +
  • +
+ + + + + + + + + +
+
+
+
+ # + search(keyword[, allowed_player]) +
+
+
+
+ +

Searches command names and help messages to find possible commands, game commands included

+

+ + + Parameters: + +
    + + + + + +
  • + + keyword + + : + + (string) + + the word which you are trying to find + +
  • + + + + + +
  • + + allowed_player + + : + + (LuaPlayer) + + the player to get allowed commands of, if nil all commands are searched + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + all commands that contain the key word, and allowed by player if player given +
  • +
+ + + + + + + + + +
+
+

Parse

+
+
+
+
+ # + add_parse(name, callback) +
+
+
+
+ +

Adds a parse function which can be called by name rather than callback (used in add_param) + nb: this is not needed as you can use the callback directly this just allows it to be called by name

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the parse, should be the type like player or player_alive, must be unique + +
  • + + + + + +
  • + + callback + + : + + (function) + + the callback that is ran to parse the input + parse param - input: string - the input given by the user for this param + parse param - player: LuaPlayer - the player who is using the command + parse param - reject: function(error_message) - use this function to send a error to the user and fail running + parse return - the value that will be passed to the command callback, must not be nil and if reject then command is not run + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + was the parse added will be false if the name is already used +
  • +
+ + + + + + + + + +
+
+
+
+ # + remove_parse(name) +
+
+
+
+ +

Removes a parse function, see add_parse for adding them

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the parse to remove + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + parse(name, input, player, reject) +
+
+
+
+ +

Intended to be used within other parse functions, runs a parse and returns success and new value

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the parse to call, must be registered and cant be a function + +
  • + + + + + +
  • + + input + + : + + (string) + + string the input to pass to the parse, will always be a but might not be the original input + +
  • + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that is calling using the command + +
  • + + + + + +
  • + + reject + + : + + (function) + + the reject function that was passed by the command hander + +
  • + + +
+ + + + + Returns: +
    +
  • + (any) + the new value for the input, may be nil, if nil then either there was an error or input was nil +
  • +
+ + + + + + + + + +
+
+

Creation

+
+
+
+
+ # + new_command(name, help) +
+
+
+
+ +

Creates a new command object to added details to, note this does not register the command to the game

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the command to be created + +
  • + + + + + +
  • + + help + + : + + (string) + + the help message for the command + +
  • + + +
+ + + + + Returns: +
    +
  • + (Commands._prototype) + this will be used with other functions to generate the command functions +
  • +
+ + + + + + + + + +
+
+
+
+ # + Commands._prototype:add_param(name[, optional=false][, parse=pass function through][, ...]) +
+
+
+
+ +

Adds a new param to the command this will be displayed in the help and used to parse the input

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the new param that is being added to the command + +
  • + + + + + +
  • + + optional + + : + + (boolean) + + is this param required for this command, these must be after all required params + + (default: false) +
  • + + + + + +
  • + + parse + + : + + (string or function) + + this function will take the input and return a new (or same) value + + (default: pass function through) +
  • + + + + + +
  • + + ... + + : + + + extra args you want to pass to the parse function; for example if the parse is general use + parse param - input: string - the input given by the user for this param + parse param - player: LuaPlayer - the player who is using the command + parse param - reject: function(error_message) - use this function to send a error to the user and fail running + parse return - the value that will be passed to the command callback, must not be nil and if reject then command is not run + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (Commands._prototype) + pass through to allow more functions to be called +
  • +
+ + + + + + + + + +
+
+
+
+ # + Commands._prototype:set_defaults(defaults) +
+
+
+
+ +

Adds default values to params only matters if the param is optional, if default value is a function it is called with param player

+

+ + + Parameters: + +
    + + + + + +
  • + + defaults + + : + + (table) + + table a keyed by the name of the param with the value as the default value {paramName=defaultValue} + callback param - player: LuaPlayer - the player using the command, default value does not need to be a function callback + +
  • + + +
+ + + + + Returns: +
    +
  • + (Commands._prototype) + pass through to allow more functions to be called +
  • +
+ + + + + + + + + +
+
+
+
+ # + Commands._prototype:set_flag(name, value) +
+
+
+
+ +

Adds a tag to the command which is passed via the flags param to the authenticators, can be used to assign command roles or type

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the tag to be added; used to keep flags separate + +
  • + + + + + +
  • + + value + + : + + (any) + + the tag that you want can be anything that the authenticators are expecting + nb: if value is nil then name will be assumed as the value and added at a numbered index + +
  • + + +
+ + + + + Returns: +
    +
  • + (Commands._prototype) + pass through to allow more functions to be called +
  • +
+ + + + + + + + + +
+
+
+
+ # + Commands._prototype:add_alias(any) +
+
+
+
+ +

Adds an alias or multiple that will also be registered with the same callback, eg /teleport can be /tp with both working

+

+ + + Parameters: + +
    + + + + + +
  • + + any + + : + + (string) + + ... amount of aliases that you want this command to be callable with + +
  • + + +
+ + + + + Returns: +
    +
  • + (Commands._prototype) + pass through to allow more functions to be called +
  • +
+ + + + + + + + Usage: +
command:add_alias('aliasOne','aliasTwo','etc')
+ + +
+
+
+
+ # + Commands._prototype:enable_auto_concat() +
+
+
+
+ +

Enables auto concatenation of any params on the end so quotes are not needed for last param + nb: this will disable max param checking as they will be concatenated onto the end of that last param + this can be useful for reasons or longs text, can only have one per command

+

+ + + + + + Returns: +
    +
  • + (Commands._prototype) + pass through to allow more functions to be called +
  • +
+ + + + + + + + + +
+
+
+
+ # + Commands._prototype:register(callback) +
+
+
+
+ +

Adds the callback to the command and registers all aliases, params and help message with the game + nb: this must be the last function ran on the command and must be done for the command to work

+

+ + + Parameters: + +
    + + + + + +
  • + + callback + + : + + (function) + + the callback for the command, will receive the player running command, and params added with add_param + callback param - player: LuaPlayer - the player who used the command + callback param - ... - any params which were registered with add_param in the order they where registered + callback param - raw: string - the raw input from the user, comes after every param added with add_param + +
  • + + +
+ + + + + + + + + + + + + +
+
+

Status

+
+
+
+
+ # + error([error_message][, play_sound]) +
+
+
+
+ +

Sends an error message to the player and returns a constant to return to command handler to exit execution + nb: this is for non fatal errors meaning there is no log of this event + nb: if reject is giving as a param to the callback use that instead

+

+ + + Parameters: + +
    + + + + + +
  • + + error_message + + : + + (string) + + an optional error message that can be sent to the user + + (optional) +
  • + + + + + +
  • + + play_sound + + : + + (string) + + the sound to play for the error + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (Commands.defines.error) + return this to command handler to exit execution +
  • +
+ + + + + + + + Usage: +
return Commands.error()
+ + +
+
+
+
+ # + internal_error(success, command_name, error_message) +
+
+
+
+ +

Sends an error to the player and logs the error, used with pcall within command handler please avoid direct use + nb: use error(error_message) within your callback to trigger do not trigger directly as the handler may still continue

+

+ + + Parameters: + +
    + + + + + +
  • + + success + + : + + (boolean) + + the success value returned from pcall, or just false to trigger error + +
  • + + + + + +
  • + + command_name + + : + + (string) + + the name of the command this is used within the log + +
  • + + + + + +
  • + + error_message + + : + + (string) + + the error returned by pcall or some other error, this is logged and not returned to player + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + the opposite of success so true means to cancel execution, used internally +
  • +
+ + + + + + + + + +
+
+
+
+ # + success([value]) +
+
+
+
+ +

Sends a value to the player, followed by a command complete message + nb: either return a value from your callback to trigger or return the return of this to prevent two messages

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + (any) + + the value to return to the player, if nil then only success message returned + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (Commands.defines.success) + return this to the command handler to prevent two success messages +
  • +
+ + + + + + + + + +
+
+
+
+ # + run_command(command_event) +
+
+
+
+ +

Main event function that is ran for all commands, used internally please avoid direct use

+

+ + + Parameters: + +
    + + + + + +
  • + + command_event + + : + + (table) + + passed directly from command event from the add_command function + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/core/Common-Library.html b/docs/core/Common-Library.html new file mode 100644 index 00000000..4206d114 --- /dev/null +++ b/docs/core/Common-Library.html @@ -0,0 +1,2754 @@ + + + + + + + + Common-Library core + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Common-Library core

+

Core Module - Common Library + - Adds some commonly used functions used in many modules

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
resources.color_presets
utils.game
util
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
type_check(value[, test_type=nil])Compare types faster for faster validation of params
type_check_error(value, test_type, error_message, level)Raises an error if the value is of the wrong type
param_check(value, test_type, param_name, param_number)Raises an error when the value is the incorrect type, uses a consistent error message format
player_return(value[, colour=defines.colour.white][, player=game.player])Will return a value of any type to the player/server console, allows colour for in-game players
write_json(path, tbl)Writes a table object to a file in json format
opt_require(path)Calls a require that will not error if the file is not found
ext_require(path, ...)Calls a require and returns only the keys given, file must return a table
format_time(ticks, options)Formats tick into a clean format, denominations from highest to lowest + long will use words rather than letters + time will use : separates + string will return a string not a locale string + when a denomination is false it will overflow into the next one
move_items(items[, surface=navies][, position={0][, radius=32][, chest_type=iron-chest])Moves items to the position and stores them in the closest entity of the type given
print_grid_value(value, surface, position, scale, offset, immutable)https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4a2/map_gen/maps/diggy/debug.lua#L31 + Prints a colored value on a location.
print_colored_grid_value(value, surface, position, offset, immutable, color_value, base_color, delta_color, under_bound, over_bound)Prints a colored value on a location.
clear_flying_text(surface)Clears all flying text entities on a surface
string_contains(s, contains)Tests if a string contains a given substring.
extract_keys(tbl, ...)Extracts certain keys from a table
enum(tbl)Converts a table to an enum
auto_complete(options, input[, use_key=false][, rtn_key=false])Returns the closest match to the input
table_values(tbl[, sorted][, as_string])Returns a copy of all of the values in the table.
table_keys(tbl[, sorted][, as_string])Returns a copy of all of the keys in the table.
table_alphanumsort(tbl)Returns the list is a sorted way that would be expected by people (this is by key)
table_keysort(tbl)Returns the list is a sorted way that would be expected by people (this is by key) (faster alternative than above)
format_chat_colour(message, color)Returns a message with valid chat tags to change its colour
format_chat_colour_localized(message, color)Returns a message with valid chat tags to change its colour, using localization
format_chat_player_name(player[, raw_string=false])Returns the players name in the players color
get_file_path([offset=0])Returns a desync safe file path for the current file
array_insert(tbl[, start_index], values)Much faster method for inserting items into an array
table_insert(tbl[, start_index], tbl2)Much faster method for inserting keys into a table
resolve_value(value)Used to resolve a value that could also be a function returning that value
+ + +
+ + +

Dependencies

+
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + util +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + type_check(value[, test_type=nil]) +
+
+
+
+ +

Compare types faster for faster validation of params

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + (any) + + the value to be tested + +
  • + + + + + +
  • + + test_type + + : + + (string) + + the type to test for if not given then it tests for nil + + (default: nil) +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + is v of type test_type +
  • +
+ + + + + + + + Usage: +
type_check('foo','string') -- return true
+
type_check('foo') -- return false
+ + +
+
+
+
+ # + type_check_error(value, test_type, error_message, level) +
+
+
+
+ +

Raises an error if the value is of the wrong type

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + (any) + + the value that you want to test the type of + +
  • + + + + + +
  • + + test_type + + : + + (string) + + the type that the value should be + +
  • + + + + + +
  • + + error_message + + : + + (string) + + the error message that is returned + +
  • + + + + + +
  • + + level + + : + + (number) + + the level to call the error on (level = 1 means the caller) + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if no error was called +
  • +
+ + + + + + + + Usage: +
type_check_error('foo','number','Value must be a number') -- will raise error "Value must be a number"
+ + +
+
+
+
+ # + param_check(value, test_type, param_name, param_number) +
+
+
+
+ +

Raises an error when the value is the incorrect type, uses a consistent error message format

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + (any) + + the value that you want to test the type of + +
  • + + + + + +
  • + + test_type + + : + + (string) + + the type that the value should be + +
  • + + + + + +
  • + + param_name + + : + + (string) + + the name of the param + +
  • + + + + + +
  • + + param_number + + : + + (number) + + the number param it is + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if no error was raised +
  • +
+ + + + + + + + Usage: +
param_check('foo','number','repeat_count',2) -- will raise error "Invalid param #02 given to <anon>; repeat_count is not of type number"
+ + +
+
+
+
+ # + player_return(value[, colour=defines.colour.white][, player=game.player]) +
+
+
+
+ +

Will return a value of any type to the player/server console, allows colour for in-game players

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + + any value of any type that will be returned to the player or console + +
  • + + + + + +
  • + + colour + + : + + (defines.color or string) + + the colour of the text for the player, ignored when printing to console + + (default: defines.colour.white) +
  • + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that return will go to, if no game.player then returns to server + + (default: game.player) +
  • + + +
+ + + + + + + + + + + + Usage: +
player_return('Hello, World!') -- returns 'Hello, World!' to game.player or server console
+
player_return('Hello, World!','green') -- returns 'Hello, World!' to game.player with colour green or server console
+
player_return('Hello, World!',nil,player) -- returns 'Hello, World!' to the given player
+ + +
+
+
+
+ # + write_json(path, tbl) +
+
+
+
+ +

Writes a table object to a file in json format

+

+ + + Parameters: + +
    + + + + + +
  • + + path + + : + + (string) + + the path of the file to write include / to use dir + +
  • + + + + + +
  • + + tbl + + : + + (table) + + the table that will be converted to a json string and wrote to file + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + opt_require(path) +
+
+
+
+ +

Calls a require that will not error if the file is not found

+

+ + + Parameters: + +
    + + + + + +
  • + + path + + : + + (string) + + the path that you want to require + +
  • + + +
+ + + + + Returns: +
    +
  • + the returns from that file or nil, error if not loaded +
  • +
+ + + + + + + + Usage: +
local file = opt_require('file.not.present') -- will not cause any error
+ + +
+
+
+
+ # + ext_require(path, ...) +
+
+
+
+ +

Calls a require and returns only the keys given, file must return a table

+

+ + + Parameters: + +
    + + + + + +
  • + + path + + : + + (string) + + the path that you want to require + +
  • + + + + + +
  • + + ... + + : + + (string) + + the name of the keys that you want returned + +
  • + + +
+ + + + + Returns: +
    +
  • + the keys in the order given +
  • +
+ + + + + + + + Usage: +
local extract, param_check = ext_require('expcore.common','extract','param_check') --- @dep expcore.common
+ + +
+
+
+
+ # + format_time(ticks, options) +
+
+
+
+ +

Formats tick into a clean format, denominations from highest to lowest + long will use words rather than letters + time will use : separates + string will return a string not a locale string + when a denomination is false it will overflow into the next one

+

+ + + Parameters: + +
    + + + + + +
  • + + ticks + + : + + (number) + + the number of ticks that represents a time + +
  • + + + + + +
  • + + options + + : + + (table) + + table a of options to use for the format + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + a locale string that can be used +
  • +
+ + + + + + + + + +
+
+
+
+ # + move_items(items[, surface=navies][, position={0][, radius=32][, chest_type=iron-chest]) +
+
+
+
+ +

Moves items to the position and stores them in the closest entity of the type given

+

+ + + Parameters: + +
    + + + + + +
  • + + items + + : + + (table) + + items which are to be added to the chests, ['name']=count + +
  • + + + + + +
  • + + surface + + : + + (LuaSurface) + + the surface that the items will be moved to + + (default: navies) +
  • + + + + + +
  • + + position + + : + + (table) + + the position that the items will be moved to {x=100,y=100} + + (default: {0) +
  • + + + + + +
  • + + radius + + : + + (number) + + the radius in which the items are allowed to be placed + + (default: 32) +
  • + + + + + +
  • + + chest_type + + : + + (string) + + the chest type that the items should be moved into + + (default: iron-chest) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + print_grid_value(value, surface, position, scale, offset, immutable) +
+
+
+
+ +

https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4a2/map_gen/maps/diggy/debug.lua#L31 + Prints a colored value on a location.

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + + between -1 and 1 + +
  • + + + + + +
  • + + surface + + : + + + LuaSurface + +
  • + + + + + +
  • + + position + + : + + + Position {x, y} + +
  • + + + + + +
  • + + scale + + : + + + float + +
  • + + + + + +
  • + + offset + + : + + + float + +
  • + + + + + +
  • + + immutable + + : + + + bool if immutable, only set, never do a surface lookup, values never change + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + print_colored_grid_value(value, surface, position, offset, immutable, color_value, base_color, delta_color, under_bound, over_bound) +
+
+
+
+ +

Prints a colored value on a location.

+

When given a color_value and a delta_color, + will change the color of the text from the base to base + value * delta. This will + make the color of the text range from 'base_color' to 'base_color + delta_color' + as the color_value ranges from 0 to 1

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + + of number to be displayed + +
  • + + + + + +
  • + + surface + + : + + + LuaSurface + +
  • + + + + + +
  • + + position + + : + + + Position {x, y} + +
  • + + + + + +
  • + + offset + + : + + + float position offset + +
  • + + + + + +
  • + + immutable + + : + + + bool if immutable, only set, never do a surface lookup, values never change + +
  • + + + + + +
  • + + color_value + + : + + + float How far along the range of values of colors the value is to be displayed + +
  • + + + + + +
  • + + base_color + + : + + + {r,g,b} The color for the text to be if color_value is 0 + +
  • + + + + + +
  • + + delta_color + + : + + + {r,g,b} The amount to correct the base_color if color_value is 1 + +
  • + + + + + +
  • + + under_bound + + : + + + {r,g,b} The color to be used if color_value < 0 + +
  • + + + + + +
  • + + over_bound + + : + + + {r,g,b} The color to be used if color_value > 1 + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + clear_flying_text(surface) +
+
+
+
+ +

Clears all flying text entities on a surface

+

+ + + Parameters: + +
    + + + + + +
  • + + surface + + : + + (LuaSurface) + + the surface to clear + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + string_contains(s, contains) +
+
+
+
+ +

Tests if a string contains a given substring.

+

+ + + Parameters: + +
    + + + + + +
  • + + s + + : + + (string) + + the string to check for the substring + +
  • + + + + + +
  • + + contains + + : + + (string) + + the substring to test for + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the substring was found in the string +
  • +
+ + + + + + + + + +
+
+
+
+ # + extract_keys(tbl, ...) +
+
+
+
+ +

Extracts certain keys from a table

+

+ + + Parameters: + +
    + + + + + +
  • + + tbl + + : + + (table) + + table the which contains the keys + +
  • + + + + + +
  • + + ... + + : + + (string) + + the names of the keys you want extracted + +
  • + + +
+ + + + + Returns: +
    +
  • + the keys in the order given +
  • +
+ + + + + + + + Usage: +
local key_three, key_one = extract({key_one='foo',key_two='bar',key_three=true},'key_three','key_one')
+ + +
+
+
+
+ # + enum(tbl) +
+
+
+
+ +

Converts a table to an enum

+

+ + + Parameters: + +
    + + + + + +
  • + + tbl + + : + + (table) + + table the that will be converted + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new table that acts like an enum +
  • +
+ + + + + + + + + +
+
+
+
+ # + auto_complete(options, input[, use_key=false][, rtn_key=false]) +
+
+
+
+ +

Returns the closest match to the input

+

+ + + Parameters: + +
    + + + + + +
  • + + options + + : + + (table) + + table a of options for the auto complete + +
  • + + + + + +
  • + + input + + : + + (string) + + string the input that will be completed + +
  • + + + + + +
  • + + use_key + + : + + (boolean) + + when true the keys of options will be used as the options + + (default: false) +
  • + + + + + +
  • + + rtn_key + + : + + (boolean) + + when true the the key will be returned rather than the value + + (default: false) +
  • + + +
+ + + + + Returns: +
    +
  • + the list item found that matches the input +
  • +
+ + + + + + + + + +
+
+
+
+ # + table_values(tbl[, sorted][, as_string]) +
+
+
+
+ +

Returns a copy of all of the values in the table.

+

+ + + Parameters: + +
    + + + + + +
  • + + tbl + + : + + (table) + + the to copy the keys from, or an empty table if tbl is nil + +
  • + + + + + +
  • + + sorted + + : + + (boolean) + + whether to sort the keys (slower) or keep the random order from pairs() + + (optional) +
  • + + + + + +
  • + + as_string + + : + + (boolean) + + whether to try and parse the values as strings, or leave them as their existing type + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (array) + an array with a copy of all the values in the table +
  • +
+ + + + + + + + + +
+
+
+
+ # + table_keys(tbl[, sorted][, as_string]) +
+
+
+
+ +

Returns a copy of all of the keys in the table.

+

+ + + Parameters: + +
    + + + + + +
  • + + tbl + + : + + (table) + + the to copy the keys from, or an empty table if tbl is nil + +
  • + + + + + +
  • + + sorted + + : + + (boolean) + + whether to sort the keys (slower) or keep the random order from pairs() + + (optional) +
  • + + + + + +
  • + + as_string + + : + + (boolean) + + whether to try and parse the keys as strings, or leave them as their existing type + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (array) + an array with a copy of all the keys in the table +
  • +
+ + + + + + + + + +
+
+
+
+ # + table_alphanumsort(tbl) +
+
+
+
+ +

Returns the list is a sorted way that would be expected by people (this is by key)

+

+ + + Parameters: + +
    + + + + + +
  • + + tbl + + : + + (table) + + the table to be sorted + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the sorted table +
  • +
+ + + + + + + + + +
+
+
+
+ # + table_keysort(tbl) +
+
+
+
+ +

Returns the list is a sorted way that would be expected by people (this is by key) (faster alternative than above)

+

+ + + Parameters: + +
    + + + + + +
  • + + tbl + + : + + (table) + + the table to be sorted + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the sorted table +
  • +
+ + + + + + + + + +
+
+
+
+ # + format_chat_colour(message, color) +
+
+
+
+ +

Returns a message with valid chat tags to change its colour

+

+ + + Parameters: + +
    + + + + + +
  • + + message + + : + + (string) + + the message that will be in the output + +
  • + + + + + +
  • + + color + + : + + (table) + + a color which contains r,g,b as its keys + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the message with the color tags included +
  • +
+ + + + + + + + + +
+
+
+
+ # + format_chat_colour_localized(message, color) +
+
+
+
+ +

Returns a message with valid chat tags to change its colour, using localization

+

+ + + Parameters: + +
    + + + + + +
  • + + message + + : + + (string or table) + + the message that will be in the output + +
  • + + + + + +
  • + + color + + : + + (table) + + a color which contains r,g,b as its keys + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the message with the color tags included +
  • +
+ + + + + + + + + +
+
+
+
+ # + format_chat_player_name(player[, raw_string=false]) +
+
+
+
+ +

Returns the players name in the players color

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to use the name and color of + +
  • + + + + + +
  • + + raw_string + + : + + (boolean) + + when true a is returned rather than a localized string + + (default: false) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the players name with tags for the players color +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_file_path([offset=0]) +
+
+
+
+ +

Returns a desync safe file path for the current file

+

+ + + Parameters: + +
    + + + + + +
  • + + offset + + : + + (number) + + the offset in the stack to get, 0 is current file + + (default: 0) +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the file path +
  • +
+ + + + + + + + + +
+
+
+
+ # + array_insert(tbl[, start_index], values) +
+
+
+
+ +

Much faster method for inserting items into an array

+

+ + + Parameters: + +
    + + + + + +
  • + + tbl + + : + + (table) + + the table that will have the values added to it + +
  • + + + + + +
  • + + start_index + + : + + (number) + + the index at which values will be added, nil means end of the array + + (optional) +
  • + + + + + +
  • + + values + + : + + (table) + + the new values that will be added to the table + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the table that was passed as the first argument +
  • +
+ + + + + + + + Usage: +
-- Adding 1000 values into the middle of the array
+local tbl = {}
+local values = {}
+for i = 1,1000 do tbl[i] = i values[i] = i end
+Common.array_insert(tbl,500,values) -- around 0.4ms
+ + +
+
+
+
+ # + table_insert(tbl[, start_index], tbl2) +
+
+
+
+ +

Much faster method for inserting keys into a table

+

+ + + Parameters: + +
    + + + + + +
  • + + tbl + + : + + (table) + + the table that will have keys added to it + +
  • + + + + + +
  • + + start_index + + : + + (number) + + the index at which values will be added, nil means end of the array, numbered indexs only + + (optional) +
  • + + + + + +
  • + + tbl2 + + : + + (table) + + the table that may contain both string and numbered keys + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the table passed as the first argument +
  • +
+ + + + + + + + Usage: +
-- Merging two tables
+local tbl = {}
+local tbl2 = {}
+for i = 1,100 do tbl[i] = i tbl['_'..i] = i tbl2[i] = i tbl2['__'..i] = i end
+Common.table_insert(tbl,50,tbl2)
+ + +
+
+
+
+ # + resolve_value(value) +
+
+
+
+ +

Used to resolve a value that could also be a function returning that value

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + (any) + + the value which you want to test is not nil and if it is a function then call the function + +
  • + + +
+ + + + + Returns: +
    +
  • + (any) + the value given or returned by value if it is a function +
  • +
+ + + + + + + + Usage: +
-- Default value handling
+-- if default value is not a function then it is returned
+-- if it is a function then it is called with the first argument being self
+local value = Common.resolve_value(self.defaut_value,self)
+ + +
+
+ + + +
+
+
+ + + + diff --git a/docs/core/ExpStyle.html b/docs/core/ExpStyle.html new file mode 100644 index 00000000..f0baf989 --- /dev/null +++ b/docs/core/ExpStyle.html @@ -0,0 +1,1366 @@ + + + + + + + + ExpStyle core + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

ExpStyle core

+

Core Module - ExpStyle

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + +
expcore.gui
gui.concept.frame
gui.concept.flow
gui.concept.table
gui.concept.scroll
expcore.common
+ + +

Elements

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
alignmentA flow which can be used to align text and other elements
containerA container frame that can be used to add a boader around your content
data_labelA label pair which has a static label and a data label which can be changed
footerA frame that acts as a footer to a section of content
headerA frame that acts as a header to a section of content
scroll_tableA table that is inside a vertical scroll area
time_labelA label that show time in a nice, user friendly way
toggle_buttonA button that will toggle its caption each time it is pressed
unit_labelA label triplet which has a static label, a data label which can be changed, and a unit label
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + +
data_label:update_data_element(element, data)Updates the caption and tooltip of the data label using the data format function
data_label:update_from_parent(parent, data)Updates the caption and tooltip of the data label using the data format function, given the parent of the data label
time_label:update_time(element, time)Updates the time that is on a label
unit_label:update_data_element(element, data)Updates the caption and tooltip and unit of the data label using the data format function
unit_label:update_from_parent(parent, data)Updates the caption and tooltip and unit of the unit label using the data format function, given the parent of the unit label
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.frame +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.flow +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.table +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.scroll +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Elements

+
+
+
+
+ # + alignment +
+
+
+
+ +

A flow which can be used to align text and other elements

+

+ + + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [alignment] - the alignment area
+Gui.new_concept('alignment')
+:set_horizontal_align('center')
+ + +
+
+
+
+ # + container +
+
+
+
+ +

A container frame that can be used to add a boader around your content

+

+ + + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [container] - the outer frame
+-->> container - the content area
+Gui.new_concept('container')
+ + +
+
+
+
+ # + data_label +
+
+
+
+ +

A label pair which has a static label and a data label which can be changed

+

+ + + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [data_label] - the static label
+--> [properties.data_name] - the data label which can be updated
+Gui.new_concept('data_label')
+:set_data_label_name('game_ticks')
+:set_data_caption('0')
+:set_data_format(function(concept,element,data,...)
+    -- This is used with update_data_element and update_from_parent
+    local caption = tostirng('data')
+    local tooltip = 'This game has beeing running for: '..caption..' ticks'
+    return caption, tooltip
+end)
+ + +
+
+
+
+ # + footer +
+
+
+
+ +

A frame that acts as a footer to a section of content

+

+ + + Properties / Events: + +
    + + + + + +
  • + + tooltip + + : + + (string) + + the tooltip to show on the title + +
  • + + +
+ + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [footer] - the footer frame
+-->> footer_caption - the lable with the title in it
+-->> footer_content - the area to contain butons
+Gui.new_concept('footer')
+:set_title('Example Footer')
+ + +
+
+
+
+ # + header +
+
+
+
+ +

A frame that acts as a header to a section of content

+

+ + + Properties / Events: + +
    + + + + + +
  • + + tooltip + + : + + (string) + + the tooltip to show on the title + +
  • + + +
+ + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [header] - the header frame
+-->> header_caption - the lable with the title in it
+-->> header_content - the area to contain butons
+Gui.new_concept('header')
+:set_title('Example Header')
+ + +
+
+
+
+ # + scroll_table +
+
+
+
+ +

A table that is inside a vertical scroll area

+

+ + + Properties / Events: + +
    + + + + + +
  • + + hight + + : + + (number) + + the max hight of the scroll area + +
  • + + +
+ + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [scroll_table] - the scroll area
+-->> table - the table area
+Gui.new_concept('scroll_table')
+:set_height(200)
+:set_column_count(2)
+ + +
+
+
+
+ # + time_label +
+
+
+
+ +

A label that show time in a nice, user friendly way

+

+ + + Properties / Events: + +
    + + + + + +
  • + + time + + : + + (number) + + the time to display in tick + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [time_label] - the label with the time
+local time_label =
+Gui.new_concept('time_label')
+:set_use_hours(true)
+:set_time(game.tick)
+
+time_label:update_time(element,game.tick)
+ + +
+
+
+
+ # + toggle_button +
+
+
+
+ +

A button that will toggle its caption each time it is pressed

+

+ + + Properties / Events: + +
    + + + + + +
  • + + alt_caption + + : + + (string) + + the caption to show on the button in its true state + +
  • + + + + + +
  • + + alt_tooltip + + : + + (string) + + the tooltip to show on the button in its true state + +
  • + + +
+ + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [toggle_button] - the header button
+Gui.new_concept('toggle_button')
+:set_caption('<')
+:set_tooltip('Press to close.')
+:set_alt_caption('>')
+:set_alt_tooltip('Press to open.')
+:on_click(function(event)
+    local state = event.state and 'close' or 'open'
+    event.player.print('Toggle button is now: '..state)
+end)
+ + +
+
+
+
+ # + unit_label +
+
+
+
+ +

A label triplet which has a static label, a data label which can be changed, and a unit label

+

+ + + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [unit_label] - the static label
+--> [properties.data_name] - the data label which can be updated
+--> [properties.data_name..'_unit'] - the data label unit which can be updated
+Gui.new_concept('unit_label')
+:set_data_label_name('game_ticks')
+:set_data_caption('0')
+:set_data_unit('ticks')
+:set_data_format(function(concept,element,data,...)
+    -- This is used with update_data_element and update_from_parent
+    local caption = tostirng(data)
+    local unit = data > 1 and 'ticks' or 'tick'
+    local tooltip = 'This game has beeing running for: '..caption..' ticks'
+    return caption, unit, tooltip
+end)
+ + +
+
+

Functions

+
+
+
+
+ # + data_label:update_data_element(element, data) +
+
+
+
+ +

Updates the caption and tooltip of the data label using the data format function

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the data label element that you want to update + +
  • + + + + + +
  • + + data + + : + + (any) + + the data that you want to pass to the format function + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Updating the data to the current game tick
+data_label:update_data_element(element,game.tick)
+ + +
+
+
+
+ # + data_label:update_from_parent(parent, data) +
+
+
+
+ +

Updates the caption and tooltip of the data label using the data format function, given the parent of the data label

+

+ + + Parameters: + +
    + + + + + +
  • + + parent + + : + + (LuaGuiElement) + + the parent element to the data label element that you want to update + +
  • + + + + + +
  • + + data + + : + + (any) + + the data that you want to pass to the format function + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Updating the data to the current game tick
+data_label:update_from_parent(parent,game.tick)
+ + +
+
+
+
+ # + time_label:update_time(element, time) +
+
+
+
+ +

Updates the time that is on a label

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the label that you want to update + +
  • + + + + + +
  • + + time + + : + + (number) + + the number of tick you want it to show + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Update the time to show game time
+time_label:update_time(element,game.time)
+ + +
+
+
+
+ # + unit_label:update_data_element(element, data) +
+
+
+
+ +

Updates the caption and tooltip and unit of the data label using the data format function

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the unit label element that you want to update + +
  • + + + + + +
  • + + data + + : + + (any) + + the data that you want to pass to the format function + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Updating the data to the current game tick
+unit_label:update_data_element(element,game.tick)
+ + +
+
+
+
+ # + unit_label:update_from_parent(parent, data) +
+
+
+
+ +

Updates the caption and tooltip and unit of the unit label using the data format function, given the parent of the unit label

+

+ + + Parameters: + +
    + + + + + +
  • + + parent + + : + + (LuaGuiElement) + + the parent element to the unit label element that you want to update + +
  • + + + + + +
  • + + data + + : + + (any) + + the data that you want to pass to the format function + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Updating the data to the current game tick
+unit_label:update_from_parent(parent,game.tick)
+ + +
+
+ + + +
+
+
+ + + + diff --git a/docs/core/Gui.html b/docs/core/Gui.html new file mode 100644 index 00000000..09dee1fe --- /dev/null +++ b/docs/core/Gui.html @@ -0,0 +1,10963 @@ + + + + + + + + Gui core + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Gui core

+

Core Module - Gui + - This file is used to require all the different elements of the gui module + - each module has an outline here but for more details see their separate files in ./gui + - please read the files for more documentation that cant be shown here + - please note there is a rework planned but not started

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.instances
expcore.gui.elements.buttons
expcore.gui.elements.checkbox
expcore.gui.elements.dropdown
expcore.gui.elements.slider
expcore.gui.elements.text
expcore.gui.elements.elem-button
expcore.gui.elements.progress-bar
expcore.gui.concepts.toolbar
expcore.gui.concepts.left
expcore.gui.concepts.center
expcore.gui.concepts.popups
+ + +

Center Guis

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
expcore.gui.concepts.toolbar
utils.game
CenterFrames.get_flow(player)Gets the center flow for a player
CenterFrames.clear_flow(player)Clears the center flow for a player
CenterFrames.draw_frame(player, name)Draws the center frame for a player, if already open then will do nothing
CenterFrames.redraw_frame(player, name)Draws the center frame for a player, if already open then will destroy it and redraw
CenterFrames.toggle_frame(player, name[, state])Toggles if the frame is currently open or not, will open if closed and close if open
CenterFrames.new_frame(permission_name)Creates a new center frame define
CenterFrames._prototype:set_auto_focus([state=true])Sets the frame to be the current active gui when opened and closes all other frames
CenterFrames._prototype:draw_frame(player)Draws this frame to the player, if already open does nothing (will call on_draw to draw to the frame)
CenterFrames._prototype:redraw_frame(player)Draws this frame to the player, if already open it will remove it and redraw it (will call on_draw to draw to the frame)
CenterFrames._prototype:toggle_frame(player)Toggles if the frame is open, if open it will close it and if closed it will open it
CenterFrames._prototype:event_handler([action=update])Creates an event handler that will trigger one of its functions, use with Event.add
+ + +

Left Guis

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
expcore.gui.concepts.toolbar
expcore.gui.elements.buttons
mod-gui
utils.game
utils.event
LeftFrames.get_flow(player)Gets the left frame flow for a player
LeftFrames.get_frame(name, player)Gets one frame from the left flow by its name
LeftFrames.get_open(player)Gets all open frames for a player, if non are open it will remove the close all button
LeftFrames.toggle_frame(name, player[, state])Toggles the visibility of a left frame, or sets its visibility state
LeftFrames.new_frame(permission_name)Creates a new left frame define
LeftFrames._prototype:set_open_by_default([state=true])Sets if the frame is visible when a player joins, can also be a function to return a boolean
LeftFrames._prototype:set_direction(direction)Sets the direction of the frame, either vertical or horizontal
LeftFrames._prototype:_internal_draw(player)Creates the gui for the first time, used internally
LeftFrames._prototype:get_frame(player)Gets the frame for this define from the left frame flow
LeftFrames._prototype:is_open(player)Returns if the player currently has this define visible
LeftFrames._prototype:toggle(player)Toggles the visibility of the left frame
LeftFrames._prototype:update(player)Updates the contents of the left frame, first tries update callback, other wise will clear and redraw
LeftFrames._prototype:update_all([update_offline=false])Updates the frame for all players, see update
LeftFrames._prototype:redraw(player)Redraws the frame by calling on_draw, will always clear the frame
LeftFrames._prototype:redraw_all([update_offline=false])Redraws the frame for all players, see redraw
LeftFrames._prototype:event_handler([action=update])Creates an event handler that will trigger one of its functions, use with Event.add
+ + +

Popups

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
utils.game
utils.event
expcore.gui.elements.progress-bar
expcore.gui.elements.buttons
mod-gui
resources.color_presets
utils.global
PopupFrames.get_flow(player)Gets the left flow that contains the popup frames
PopupFrames.open(define_name, player[, open_time], ...)Opens a popup for the player, can give the amount of time it is open as well as params for the draw function
PopupFrames.close_progressProgress bar which when depleted will close the popup frame
PopupFrames.close_buttonA button which can be used to close the gui before the timer runs out
PopupFrames.new_popup([name])Creates a new popup frame define
PopupFrames._prototype:set_default_open_time(amount)Sets the default open time for the popup, will be used if non is provided with open
PopupFrames._prototype:open(player[, open_time], ...)Opens this define for a player, can be given open time and any other params for the draw function
+ + +

Toolbar

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.elements.buttons
expcore.roles
utils.event
utils.game
mod-gui
Toolbar.new_button([name])Adds a new button to the toolbar
Toolbar.add_button(button)Adds an existing buttton to the toolbar
Toolbar.update(player)Updates the player's toolbar with an new buttons or expected change in auth return
+ + +

Core

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
utils.gui
utils.game
new_define(prototype[, debug_name])Used to create new element defines from a class prototype, please use the own given by the class
get_define(name[, internal])Gets an element define give the uid, debug name or a copy of the element define
categorize_by_player(element)A categorize function to be used with add_store, each player has their own value
categorize_by_force(element)A categorize function to be used with add_store, each force has its own value
categorize_by_surface(element)A categorize function to be used with add_store, each surface has its own value
draw(name, element)Draws a copy of the element define to the parent element, see draw_to
toggle_enabled(element)Will toggle the enabled state of an element
toggle_visible(element)Will toggle the visiblity of an element
set_padding(element[, up=0][, down=0][, left=0][, right=0])Sets the padding for a gui element
set_padding_style(style[, up=0][, down=0][, left=0][, right=0])Sets the padding for a gui style
create_alignment(element[, name][, horizontal_align='right'][, vertical_align='center'])Allows the creation of an alignment flow to place elements into
destroy_if_valid(element)Destroies an element but tests for it being present and valid first
create_scroll_table(element, table_size, maximal_height[, name='scroll'])Creates a scroll area with a table inside, table can be any size
create_header(element, caption[, tooltip][, right_align][, name='header'])Creates a header section with a label and button area
+ + +

Buttons

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
mod-gui
expcore.gui.core
expcore.gui.prototype
Button.new_button([name])Creates a new button element define
Button._prototype:set_sprites(sprite[, hovered_sprite][, clicked_sprite])Adds sprites to a button making it a sprite button
Button._prototype:set_click_filter(filter[, ...])Adds a click / mouse button filter to the button
Button._prototype:set_key_filter(filter[, ...])Adds a control key filter to the button
+ + +

Checkboxs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
expcore.store
utils.game
Checkbox.new_checkbox([name])Creates a new checkbox element define
Checkbox.new_radiobutton([name])Creates a new radiobutton element define, has all functions checkbox has
Checkbox._prototype_radiobutton:add_as_option(option_set, option_name)Adds this radiobutton to be an option in the given option set (only one can be true at a time)
Checkbox._prototype_radiobutton:get_store(category, internal)Gets the stored value of the radiobutton or the option set if present
Checkbox._prototype_radiobutton:set_store(category, value, internal)Sets the stored value of the radiobutton or the option set if present
Checkbox.new_option_set(callback, categorize)Registers a new option set that can be linked to radiobuttons (only one can be true at a time)
Checkbox.draw_option_set(name, element)Draws all radiobuttons that are part of an option set at once (Gui.draw will not work)
Checkbox.reset_radiobuttons(element[, exclude][, recursive=false])Sets all radiobutton in a element to false (unless excluded) and can act recursively
+ + +

Dropdowns

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
utils.game
Dropdown.new_dropdown([name])Creates a new dropdown element define
Dropdown.new_list_box([name])Creates a new list box element define
Dropdown._prototype:new_static_options(options[, ...], the)Adds new static options to the dropdown which will trigger the general callback
Dropdown._prototype:new_dynamic_options(callback)Adds a callback which should return a table of values to be added as options for the dropdown (appended after static options)
Dropdown._prototype:add_option_callback(option, callback)Adds a case specific callback which will only run when that option is selected (general case still triggered)
Dropdown.select_value(element, value)Selects the option from a dropdown or list box given the value rather than key
Dropdown.get_selected_value(element)Returns the currently selected value rather than index
+ + +

Elem Buttons

+ + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
utils.game
ElemButton.new_elem_button([name])Creates a new elem button element define
ElemButton._prototype.set_typeSets the type of the elem button, the type is required so this must be called at least once
ElemButton._prototype:set_default(value)Sets the default value for the elem button, this may be a function or a string
+ + +

Progress Bars

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
utils.global
utils.game
ProgressBar.set_maximum(element, amount)Sets the maximum value that represents the end value of the progress bar
ProgressBar.increment(element[, amount=1])Increases the value of the progressbar, if a define is given all of its instances have incremented
ProgressBar.decrement(element[, amount=1])Decreases the value of the progressbar, if a define is given all of its instances have decremented
ProgressBar.new_progressbar([name])Creates a new progressbar element define
ProgressBar._prototype:set_default_maximum(amount)Sets the maximum value that represents the end value of the progress bar
ProgressBar._prototype:use_count_down([state=true])Will set the progress bar to start at 1 and trigger when it hits 0
ProgressBar._prototype:increment([amount=1][, category])Increases the value of the progressbar
ProgressBar._prototype:increment_filtered([amount=1], filter)Increases the value of the progressbar, if the filter condition is met, does not work with store
ProgressBar._prototype:decrement([amount=1][, category])Decreases the value of the progressbar
ProgressBar._prototype:decrement_filtered([amount=1], filter)Decreases the value of the progressbar, if the filter condition is met, does not work with store
ProgressBar._prototype:add_element(element[, maximum])Adds an element into the list of instances that will are waiting to complete, does not work with store + note use store if you want persistent data, this only stores the elements not the values which they have
ProgressBar._prototype:reset_element(element)Resets an element, or its store, to be back at the start, either 1 or 0
ProgressBar._prototype:event_counter([filter])Event handler factory that counts up by 1 every time the event triggers, can filter which elements have incremented
ProgressBar._prototype:event_countdown([filter])Event handler factory that counts down by 1 every time the event triggers, can filter which elements have decremented
+ + +

Sliders

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
expcore.gui.instances
utils.game
Slider.new_slider([name])Creates a new slider element define
Slider._prototype:set_range([min][, max])Sets the range of a slider, if not used will use default values for a slider
Slider._prototype:draw_label(element)Draws a new label and links its value to the value of this slider, if no store then it will only show one value per player
Slider._prototype:enable_auto_draw_label([state=true])Enables auto draw of the label, the label will share the same parent element as the slider
+ + +

Text

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
utils.game
Text.new_text_field([name])Creates a new text field element define
Text.new_text_box([name])Creates a new text box element define
Text._prototype_box:set_selectable([state=true])Sets the text box to be selectable
Text._prototype_box:set_word_wrap([state=true])Sets the text box to have word wrap
Text._prototype_box:set_read_only([state=true])Sets the text box to be read only
+ + +

Instances

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
utils.global
Instances.has_categories(name)Returns if a instance group has a serializer function; must be registered
Instances.is_registered(name)Returns if the given name is a registered instance group
Instances.register(name[, serializer])Registers the name of an instance group to allow for storing element instances
Instances.add_element(name, element)Adds an element to the instance group under the correct category; must be registered
Instances.get_elements_raw(name[, category])Gets all element instances without first removing any invalid ones; used internally and must be registered
Instances.get_valid_elements(name[, category][, callback])Gets all valid element instances and has the option of running a callback on those that are valid
Instances.unregistered_add_element(name, category, element)A version of add_element that does not require the group to be registered
Instances.unregistered_get_elements(name, category[, callback])A version of get_elements that does not require the group to be registered
+ + +

Prototype

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
utils.game
expcore.store
expcore.gui.instances
Constructor.event(event_name)Creates a new function to add functions to an event handler
Constructor.extend(new_prototype)Extents a prototype with the base functions of all gui prototypes, no metatables
Constructor.store(callback)Creates a new function which adds a store to a gui define
Constructor.setter(value_type, key[, second_key])Creates a setter function that checks the type when a value is set
Prototype:uid()Gets the uid for the element define
Prototype.debug_nameSets a debug alias for the define
Prototype.set_captionSets the caption for the element define
Prototype.set_tooltipSets the tooltip for the element define
Prototype.set_pre_authenticatorSets an authenticator that blocks the draw function if check fails
Prototype.set_post_authenticatorSets an authenticator that disables the element if check fails
Prototype.on_drawRegisters a callback to the on_draw event
Prototype.on_style_updateRegisters a callback to the on_style_update event
Prototype:set_style(style[, callback])Sets the style for the element define
Prototype:set_embedded_flow(state)Sets the element to be drawn inside a nameless flow, can be given a name using a function
Prototype:raise_event(event_name, ...)Raises a custom event for this define, any number of params can be given
Prototype:draw_to(element)The main function for defines, when called will draw an instance of this define to the given element + what is drawn is based on the data in draw_data which is set using other functions
Prototype:get_store(category)Gets the value in this elements store, category needed if serializer function used
Prototype:set_store(category, value)Sets the value in this elements store, category needed if serializer function used
Prototype:clear_store([category])Sets the value in this elements store to nil, category needed if serializer function used
+ + +

Test

+ + + + + + + + + + + + + + + + + + + +
expcore.gui
expcore.common
resources.color_presets
utils.event
expcore.store
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.instances +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.elements.buttons +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.elements.checkbox +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.elements.dropdown +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.elements.slider +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.elements.text +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.elements.elem-button +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.elements.progress-bar +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.concepts.toolbar +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.concepts.left +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.concepts.center +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.concepts.popups +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Center Guis

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.concepts.toolbar +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + CenterFrames.get_flow(player) +
+
+
+
+ +

Gets the center flow for a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the flow for + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + CenterFrames.clear_flow(player) +
+
+
+
+ +

Clears the center flow for a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to clear the flow for + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + CenterFrames.draw_frame(player, name) +
+
+
+
+ +

Draws the center frame for a player, if already open then will do nothing

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will have the frame drawn + +
  • + + + + + +
  • + + name + + : + + (string) + + the name of the hui that will drawn + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + CenterFrames.redraw_frame(player, name) +
+
+
+
+ +

Draws the center frame for a player, if already open then will destroy it and redraw

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will have the frame drawn + +
  • + + + + + +
  • + + name + + : + + (string) + + the name of the hui that will drawn + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + CenterFrames.toggle_frame(player, name[, state]) +
+
+
+
+ +

Toggles if the frame is currently open or not, will open if closed and close if open

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will have the frame toggled + +
  • + + + + + +
  • + + name + + : + + (string) + + the name of the hui that will be toggled + +
  • + + + + + +
  • + + state + + : + + (boolean) + + when set will force a state for the frame + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + if the frame if no open or closed +
  • +
+ + + + + + + + + +
+
+
+
+ # + CenterFrames.new_frame(permission_name) +
+
+
+
+ +

Creates a new center frame define

+

+ + + Parameters: + +
    + + + + + +
  • + + permission_name + + : + + (string) + + the name that can be used with the permission system + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new center frame define +
  • +
+ + + + + + + + + +
+
+
+
+ # + CenterFrames._prototype:set_auto_focus([state=true]) +
+
+
+
+ +

Sets the frame to be the current active gui when opened and closes all other frames

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean) + + when true will auto close other frames and set this frame as player.opened + + (default: true) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + CenterFrames._prototype:draw_frame(player) +
+
+
+
+ +

Draws this frame to the player, if already open does nothing (will call on_draw to draw to the frame)

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to draw the frame for + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + CenterFrames._prototype:redraw_frame(player) +
+
+
+
+ +

Draws this frame to the player, if already open it will remove it and redraw it (will call on_draw to draw to the frame)

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to draw the frame for + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + CenterFrames._prototype:toggle_frame(player) +
+
+
+
+ +

Toggles if the frame is open, if open it will close it and if closed it will open it

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to draw the frame for + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + with the gui frame is now open +
  • +
+ + + + + + + + + +
+
+
+
+ # + CenterFrames._prototype:event_handler([action=update]) +
+
+
+
+ +

Creates an event handler that will trigger one of its functions, use with Event.add

+

+ + + Parameters: + +
    + + + + + +
  • + + action + + : + + (string) + + the action to take on this event + + (default: update) +
  • + + +
+ + + + + + + + + + + + + +
+
+

Left Guis

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.concepts.toolbar +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.elements.buttons +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + mod-gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + LeftFrames.get_flow(player) +
+
+
+
+ +

Gets the left frame flow for a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the flow of + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + LeftFrames.get_frame(name, player) +
+
+
+
+ +

Gets one frame from the left flow by its name

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the gui frame to get + +
  • + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the frame of + +
  • + + +
+ + + + + Returns: +
    +
  • + (LuaGuiElement) + the frame in the left frame flow with that name +
  • +
+ + + + + + + + + +
+
+
+
+ # + LeftFrames.get_open(player) +
+
+
+
+ +

Gets all open frames for a player, if non are open it will remove the close all button

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the flow of + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + contains all the open (and registered) frames for the player +
  • +
+ + + + + + + + + +
+
+
+
+ # + LeftFrames.toggle_frame(name, player[, state]) +
+
+
+
+ +

Toggles the visibility of a left frame, or sets its visibility state

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the gui frame to toggle + +
  • + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the frame of + +
  • + + + + + +
  • + + state + + : + + (boolean) + + when given will be the state that the visibility is set to + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + the new state of the visibility +
  • +
+ + + + + + + + + +
+
+
+
+ # + LeftFrames.new_frame(permission_name) +
+
+
+
+ +

Creates a new left frame define

+

+ + + Parameters: + +
    + + + + + +
  • + + permission_name + + : + + (string) + + the name that can be used with the permission system + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new left frame define +
  • +
+ + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:set_open_by_default([state=true]) +
+
+
+
+ +

Sets if the frame is visible when a player joins, can also be a function to return a boolean

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean or function) + + the default state of the visibility, can be a function + state param - player LuaPlayer - the player that has joined the game + state param - define_name string - the define name for the frame + state return - boolean - false will hide the frame + + (default: true) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:set_direction(direction) +
+
+
+
+ +

Sets the direction of the frame, either vertical or horizontal

+

+ + + Parameters: + +
    + + + + + +
  • + + direction + + : + + (string) + + the direction to have the elements be added to the frame + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:_internal_draw(player) +
+
+
+
+ +

Creates the gui for the first time, used internally

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to draw the frame to + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:get_frame(player) +
+
+
+
+ +

Gets the frame for this define from the left frame flow

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the frame of + +
  • + + +
+ + + + + Returns: +
    +
  • + (LuaGuiElement) + the frame in the left frame flow for this define +
  • +
+ + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:is_open(player) +
+
+
+
+ +

Returns if the player currently has this define visible

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the frame of + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if it is open/visible +
  • +
+ + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:toggle(player) +
+
+
+
+ +

Toggles the visibility of the left frame

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to toggle the frame of + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + the new state of the visibility +
  • +
+ + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:update(player) +
+
+
+
+ +

Updates the contents of the left frame, first tries update callback, other wise will clear and redraw

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to update the frame of + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:update_all([update_offline=false]) +
+
+
+
+ +

Updates the frame for all players, see update

+

+ + + Parameters: + +
    + + + + + +
  • + + update_offline + + : + + (boolean) + + when true will update the frame for offline players + + (default: false) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:redraw(player) +
+
+
+
+ +

Redraws the frame by calling on_draw, will always clear the frame

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to update the frame of + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:redraw_all([update_offline=false]) +
+
+
+
+ +

Redraws the frame for all players, see redraw

+

+ + + Parameters: + +
    + + + + + +
  • + + update_offline + + : + + (boolean) + + when true will update the frame for offline players + + (default: false) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:event_handler([action=update]) +
+
+
+
+ +

Creates an event handler that will trigger one of its functions, use with Event.add

+

+ + + Parameters: + +
    + + + + + +
  • + + action + + : + + (string) + + the action to take on this event + + (default: update) +
  • + + +
+ + + + + + + + + + + + + +
+
+

Popups

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.elements.progress-bar +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.elements.buttons +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + mod-gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + PopupFrames.get_flow(player) +
+
+
+
+ +

Gets the left flow that contains the popup frames

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the flow for + +
  • + + +
+ + + + + Returns: +
    +
  • + (LuaGuiElement) + the left flow that contains the popup frames +
  • +
+ + + + + + + + + +
+
+
+
+ # + PopupFrames.open(define_name, player[, open_time], ...) +
+
+
+
+ +

Opens a popup for the player, can give the amount of time it is open as well as params for the draw function

+

+ + + Parameters: + +
    + + + + + +
  • + + define_name + + : + + (string) + + the name of the define that you want to open for the player + +
  • + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to open the popup for + +
  • + + + + + +
  • + + open_time + + : + + (number) + + the minimum number of ticks you want the popup open for, 0 means no limit, nil will take default + + (optional) +
  • + + + + + +
  • + + ... + + : + + (any) + + the other params that you want to pass to your on_draw event + +
  • + + +
+ + + + + Returns: +
    +
  • + (LuaGuiElement) + the frame that was drawn, the inner gui flow which contains the content +
  • +
+ + + + + + + + + +
+
+
+
+ # + PopupFrames.close_progress +
+
+
+
+ +

Progress bar which when depleted will close the popup frame

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + PopupFrames.close_button +
+
+
+
+ +

A button which can be used to close the gui before the timer runs out

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + PopupFrames.new_popup([name]) +
+
+
+
+ +

Creates a new popup frame define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new popup frame define +
  • +
+ + + + + + + + + +
+
+
+
+ # + PopupFrames._prototype:set_default_open_time(amount) +
+
+
+
+ +

Sets the default open time for the popup, will be used if non is provided with open

+

+ + + Parameters: + +
    + + + + + +
  • + + amount + + : + + (number) + + the number of ticks, by default, the popup will be open for + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the define to allow for chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + PopupFrames._prototype:open(player[, open_time], ...) +
+
+
+
+ +

Opens this define for a player, can be given open time and any other params for the draw function

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to open the popup for + +
  • + + + + + +
  • + + open_time + + : + + (number) + + the minimum number of ticks you want the popup open for, 0 means no limit, nil will take default + + (optional) +
  • + + + + + +
  • + + ... + + : + + (any) + + the other params that you want to pass to your on_draw event + +
  • + + +
+ + + + + Returns: +
    +
  • + (LuaGuiElement) + the frame that was drawn, the inner gui flow which contains the content +
  • +
+ + + + + + + + + +
+
+

Toolbar

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.elements.buttons +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + mod-gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + Toolbar.new_button([name]) +
+
+
+
+ +

Adds a new button to the toolbar

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + when given allows an alias to the button for the permission system + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the button define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Toolbar.add_button(button) +
+
+
+
+ +

Adds an existing buttton to the toolbar

+

+ + + Parameters: + +
    + + + + + +
  • + + button + + : + + (table) + + the button define for the button to be added + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Toolbar.update(player) +
+
+
+
+ +

Updates the player's toolbar with an new buttons or expected change in auth return

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to update the toolbar for + +
  • + + +
+ + + + + + + + + + + + + +
+
+

Core

+
+
+
+
+ # + utils.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + new_define(prototype[, debug_name]) +
+
+
+
+ +

Used to create new element defines from a class prototype, please use the own given by the class

+

+ + + Parameters: + +
    + + + + + +
  • + + prototype + + : + + (table) + + the class prototype that will be used for the element define + +
  • + + + + + +
  • + + debug_name + + : + + (string) + + the name that you want to see while debuging + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new element define with all functions accessed via __index metamethod +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_define(name[, internal]) +
+
+
+
+ +

Gets an element define give the uid, debug name or a copy of the element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string or table) + + the uid, debug name or define for the element define to get + +
  • + + + + + +
  • + + internal + + : + + (boolean) + + when true the error trace is one level higher (used internally) + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the element define that was found or an error +
  • +
+ + + + + + + + + +
+
+
+
+ # + categorize_by_player(element) +
+
+
+
+ +

A categorize function to be used with add_store, each player has their own value

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element that will be converted to a string + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the player's name who owns this element +
  • +
+ + + + + + + + + +
+
+
+
+ # + categorize_by_force(element) +
+
+
+
+ +

A categorize function to be used with add_store, each force has its own value

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element that will be converted to a string + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the player's force name who owns this element +
  • +
+ + + + + + + + + +
+
+
+
+ # + categorize_by_surface(element) +
+
+
+
+ +

A categorize function to be used with add_store, each surface has its own value

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element that will be converted to a string + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the player's surface name who owns this element +
  • +
+ + + + + + + + + +
+
+
+
+ # + draw(name, element) +
+
+
+
+ +

Draws a copy of the element define to the parent element, see draw_to

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string or table) + + the uid, debug name or define for the element define to draw + +
  • + + + + + +
  • + + element + + : + + (LuaGuiEelement) + + the parent element that it the define will be drawn to + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + toggle_enabled(element) +
+
+
+
+ +

Will toggle the enabled state of an element

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the gui element to toggle + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + the new state that the element has +
  • +
+ + + + + + + + + +
+
+
+
+ # + toggle_visible(element) +
+
+
+
+ +

Will toggle the visiblity of an element

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the gui element to toggle + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + the new state that the element has +
  • +
+ + + + + + + + + +
+
+
+
+ # + set_padding(element[, up=0][, down=0][, left=0][, right=0]) +
+
+
+
+ +

Sets the padding for a gui element

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element to set the padding for + +
  • + + + + + +
  • + + up + + : + + (number) + + the amount of padding on the top + + (default: 0) +
  • + + + + + +
  • + + down + + : + + (number) + + the amount of padding on the bottom + + (default: 0) +
  • + + + + + +
  • + + left + + : + + (number) + + the amount of padding on the left + + (default: 0) +
  • + + + + + +
  • + + right + + : + + (number) + + the amount of padding on the right + + (default: 0) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + set_padding_style(style[, up=0][, down=0][, left=0][, right=0]) +
+
+
+
+ +

Sets the padding for a gui style

+

+ + + Parameters: + +
    + + + + + +
  • + + style + + : + + (LuaStyle) + + the element to set the padding for + +
  • + + + + + +
  • + + up + + : + + (number) + + the amount of padding on the top + + (default: 0) +
  • + + + + + +
  • + + down + + : + + (number) + + the amount of padding on the bottom + + (default: 0) +
  • + + + + + +
  • + + left + + : + + (number) + + the amount of padding on the left + + (default: 0) +
  • + + + + + +
  • + + right + + : + + (number) + + the amount of padding on the right + + (default: 0) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + create_alignment(element[, name][, horizontal_align='right'][, vertical_align='center']) +
+
+
+
+ +

Allows the creation of an alignment flow to place elements into

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element to add this alignment into + +
  • + + + + + +
  • + + name + + : + + (string) + + the name to use for the alignment + + (optional) +
  • + + + + + +
  • + + horizontal_align + + : + + (string) + + the horizontal alignment of the elements in this flow + + (default: 'right') +
  • + + + + + +
  • + + vertical_align + + : + + (string) + + the vertical alignment of the elements in this flow + + (default: 'center') +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + destroy_if_valid(element) +
+
+
+
+ +

Destroies an element but tests for it being present and valid first

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element to be destroied + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if it was destoried +
  • +
+ + + + + + + + + +
+
+
+
+ # + create_scroll_table(element, table_size, maximal_height[, name='scroll']) +
+
+
+
+ +

Creates a scroll area with a table inside, table can be any size

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element to add this scroll into + +
  • + + + + + +
  • + + table_size + + : + + (number) + + the number of columns in the table + +
  • + + + + + +
  • + + maximal_height + + : + + (number) + + the max hieght of the scroll + +
  • + + + + + +
  • + + name + + : + + (string) + + the name of the scoll element + + (default: 'scroll') +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + create_header(element, caption[, tooltip][, right_align][, name='header']) +
+
+
+
+ +

Creates a header section with a label and button area

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element to add this header into + +
  • + + + + + +
  • + + caption + + : + + (localeString) + + the caption that is used as the title + +
  • + + + + + +
  • + + tooltip + + : + + (localeString) + + the tooltip that is shown on the caption + + (optional) +
  • + + + + + +
  • + + right_align + + : + + (boolean) + + when true will include the right align area + + (optional) +
  • + + + + + +
  • + + name + + : + + (string) + + the name of the header area + + (default: 'header') +
  • + + +
+ + + + + Returns: +
    +
  • + (LuaGuiElement) + the header that was made, or the align area if that was created +
  • +
+ + + + + + + + + +
+
+

Buttons

+
+
+
+
+ # + mod-gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + Button.new_button([name]) +
+
+
+
+ +

Creates a new button element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new button element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Button._prototype:set_sprites(sprite[, hovered_sprite][, clicked_sprite]) +
+
+
+
+ +

Adds sprites to a button making it a sprite button

+

+ + + Parameters: + +
    + + + + + +
  • + + sprite + + : + + (SpritePath) + + the sprite path for the default sprite for the button + +
  • + + + + + +
  • + + hovered_sprite + + : + + (SpritePath) + + the sprite path for the sprite when the player hovers over the button + + (optional) +
  • + + + + + +
  • + + clicked_sprite + + : + + (SpritePath) + + the sprite path for the sprite when the player clicks the button + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + returns the button define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Button._prototype:set_click_filter(filter[, ...]) +
+
+
+
+ +

Adds a click / mouse button filter to the button

+

+ + + Parameters: + +
    + + + + + +
  • + + filter + + : + + (table) + + ?string|table either a of mouse buttons or the first mouse button to filter, with a table true means allowed + +
  • + + + + + +
  • + + ... + + : + + (table) + + when filter is not a you can add the mouse buttons one after each other + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + returns the button define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Button._prototype:set_key_filter(filter[, ...]) +
+
+
+
+ +

Adds a control key filter to the button

+

+ + + Parameters: + +
    + + + + + +
  • + + filter + + : + + (table) + + ?string|table either a of control keys or the first control keys to filter, with a table true means allowed + +
  • + + + + + +
  • + + ... + + : + + (table) + + when filter is not a you can add the control keys one after each other + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + returns the button define to allow chaining +
  • +
+ + + + + + + + + +
+
+

Checkboxs

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.store +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + Checkbox.new_checkbox([name]) +
+
+
+
+ +

Creates a new checkbox element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new checkbox element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox.new_radiobutton([name]) +
+
+
+
+ +

Creates a new radiobutton element define, has all functions checkbox has

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new button element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox._prototype_radiobutton:add_as_option(option_set, option_name) +
+
+
+
+ +

Adds this radiobutton to be an option in the given option set (only one can be true at a time)

+

+ + + Parameters: + +
    + + + + + +
  • + + option_set + + : + + (string) + + the name of the option set to add this element to + +
  • + + + + + +
  • + + option_name + + : + + (string) + + the name of this option that will be used to identify it + +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + the define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox._prototype_radiobutton:get_store(category, internal) +
+
+
+
+ +

Gets the stored value of the radiobutton or the option set if present

+

+ + + Parameters: + +
    + + + + + +
  • + + category + + : + + (string) + + [opt] the category to get such as player name or force name + +
  • + + + + + +
  • + + internal + + : + + (boolean) + + used to prevent stackover flow + +
  • + + +
+ + + + + Returns: +
    +
  • + (any) + the value that is stored for this define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox._prototype_radiobutton:set_store(category, value, internal) +
+
+
+
+ +

Sets the stored value of the radiobutton or the option set if present

+

+ + + Parameters: + +
    + + + + + +
  • + + category + + : + + (string) + + [opt] the category to get such as player name or force name + +
  • + + + + + +
  • + + value + + : + + (boolean) + + the value to set for this define, must be valid for its type ie for checkbox etc + +
  • + + + + + +
  • + + internal + + : + + (boolean) + + used to prevent stackover flow + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the value was set +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox.new_option_set(callback, categorize) +
+
+
+
+ +

Registers a new option set that can be linked to radiobuttons (only one can be true at a time)

+

+ + + Parameters: + +
    + + + + + +
  • + + callback + + : + + (function) + + the update callback when the value of the option set changes + callback param - value string - the new selected option for this option set + callback param - category string - the category that updated if categorize was used + +
  • + + + + + +
  • + + categorize + + : + + (function) + + the function used to convert an element into a string + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the name of this option set to be passed to add_as_option +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox.draw_option_set(name, element) +
+
+
+
+ +

Draws all radiobuttons that are part of an option set at once (Gui.draw will not work)

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the option set to draw the radiobuttons of + +
  • + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the parent element that the radiobuttons will be drawn to + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Checkbox.reset_radiobuttons(element[, exclude][, recursive=false]) +
+
+
+
+ +

Sets all radiobutton in a element to false (unless excluded) and can act recursively

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the root gui element to start setting radio buttons from + +
  • + + + + + +
  • + + exclude + + : + + (table) + + ?string|table the name of the radiobutton to exclude or a of radiobuttons where true will set the state true + + (optional) +
  • + + + + + +
  • + + recursive + + : + + (number or boolean) + + if true will recur as much as possible, if a will recur that number of times + + (default: false) +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if successful +
  • +
+ + + + + + + + + +
+
+

Dropdowns

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + Dropdown.new_dropdown([name]) +
+
+
+
+ +

Creates a new dropdown element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new dropdown element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Dropdown.new_list_box([name]) +
+
+
+
+ +

Creates a new list box element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new list box element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Dropdown._prototype:new_static_options(options[, ...], the) +
+
+
+
+ +

Adds new static options to the dropdown which will trigger the general callback

+

+ + + Parameters: + +
    + + + + + +
  • + + options + + : + + (table) + + ?string|table either a of option strings or the first option string, with a table values are the options + +
  • + + + + + +
  • + + ... + + : + + (table) + + when options is not a you can add the options one after each other + + (optional) +
  • + + + + + +
  • + + the + + : + + (self) + + define to allow chaining + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Dropdown._prototype:new_dynamic_options(callback) +
+
+
+
+ +

Adds a callback which should return a table of values to be added as options for the dropdown (appended after static options)

+

+ + + Parameters: + +
    + + + + + +
  • + + callback + + : + + (function) + + the function that will run to get the options for the dropdown + callback param - player LuaPlayer - the player that the element is being drawn to + callback param - element LuaGuiElement - the element that is being drawn + callback return - table - the values of this table will be appended to the static options of the dropdown + +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + the define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Dropdown._prototype:add_option_callback(option, callback) +
+
+
+
+ +

Adds a case specific callback which will only run when that option is selected (general case still triggered)

+

+ + + Parameters: + +
    + + + + + +
  • + + option + + : + + (string) + + the name of the option to trigger the callback on; if not already added then will be added as an option + +
  • + + + + + +
  • + + callback + + : + + (function) + + the function that will be called when that option is selected + callback param - player LuaPlayer - the player who owns the gui element + callback param - element LuaGuiElement - the element which is being effected + callback param - value string - the new option that has been selected + +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + the define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Dropdown.select_value(element, value) +
+
+
+
+ +

Selects the option from a dropdown or list box given the value rather than key

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element that contains the option + +
  • + + + + + +
  • + + value + + : + + (string) + + the option to select from the dropdown + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the key where the value was +
  • +
+ + + + + + + + + +
+
+
+
+ # + Dropdown.get_selected_value(element) +
+
+
+
+ +

Returns the currently selected value rather than index

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the gui element that you want to get the value of + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the value that is currently selected +
  • +
+ + + + + + + + + +
+
+

Elem Buttons

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + ElemButton.new_elem_button([name]) +
+
+
+
+ +

Creates a new elem button element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new elem button element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + ElemButton._prototype.set_type +
+
+
+
+ +

Sets the type of the elem button, the type is required so this must be called at least once

+

+ + + +
    + + + + + +
  • + + type + + : + + (string) + + the type that this elem button is see factorio api + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ElemButton._prototype:set_default(value) +
+
+
+
+ +

Sets the default value for the elem button, this may be a function or a string

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + (string or function) + + string a will be a static default and a function will be called when drawn to get the default + +
  • + + +
+ + + + + Returns: +
    +
  • + (the) + element define to allow for chaining +
  • +
+ + + + + + + + + +
+
+

Progress Bars

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar.set_maximum(element, amount) +
+
+
+
+ +

Sets the maximum value that represents the end value of the progress bar

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement or string) + + either a gui element or a registered define + +
  • + + + + + +
  • + + amount + + : + + (number) + + the amount to have set as the maximum + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar.increment(element[, amount=1]) +
+
+
+
+ +

Increases the value of the progressbar, if a define is given all of its instances have incremented

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement or string) + + either a gui element or a registered define + +
  • + + + + + +
  • + + amount + + : + + (number) + + the amount to increase the progressbar by + + (default: 1) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar.decrement(element[, amount=1]) +
+
+
+
+ +

Decreases the value of the progressbar, if a define is given all of its instances have decremented

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement or string) + + either a gui element or a registered define + +
  • + + + + + +
  • + + amount + + : + + (number) + + the amount to decrease the progressbar by + + (default: 1) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar.new_progressbar([name]) +
+
+
+
+ +

Creates a new progressbar element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new progressbar element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:set_default_maximum(amount) +
+
+
+
+ +

Sets the maximum value that represents the end value of the progress bar

+

+ + + Parameters: + +
    + + + + + +
  • + + amount + + : + + (number) + + the amount to have set as the maximum + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:use_count_down([state=true]) +
+
+
+
+ +

Will set the progress bar to start at 1 and trigger when it hits 0

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean) + + when true the bar will start filled, to be used with decrease + + (default: true) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:increment([amount=1][, category]) +
+
+
+
+ +

Increases the value of the progressbar

+

+ + + Parameters: + +
    + + + + + +
  • + + amount + + : + + (number) + + the amount to increase the progressbar by + + (default: 1) +
  • + + + + + +
  • + + category + + : + + (string) + + the category that is used with a store + + (optional) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:increment_filtered([amount=1], filter) +
+
+
+
+ +

Increases the value of the progressbar, if the filter condition is met, does not work with store

+

+ + + Parameters: + +
    + + + + + +
  • + + amount + + : + + (number) + + the amount to increase the progressbar by + + (default: 1) +
  • + + + + + +
  • + + filter + + : + + (function) + + the filter to be used + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:decrement([amount=1][, category]) +
+
+
+
+ +

Decreases the value of the progressbar

+

+ + + Parameters: + +
    + + + + + +
  • + + amount + + : + + (number) + + the amount to decrease the progressbar by + + (default: 1) +
  • + + + + + +
  • + + category + + : + + (string) + + the category that is used with a store + + (optional) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:decrement_filtered([amount=1], filter) +
+
+
+
+ +

Decreases the value of the progressbar, if the filter condition is met, does not work with store

+

+ + + Parameters: + +
    + + + + + +
  • + + amount + + : + + (number) + + the amount to decrease the progressbar by + + (default: 1) +
  • + + + + + +
  • + + filter + + : + + (function) + + the filter to be used + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:add_element(element[, maximum]) +
+
+
+
+ +

Adds an element into the list of instances that will are waiting to complete, does not work with store + note use store if you want persistent data, this only stores the elements not the values which they have

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element that you want to add into the waiting to complete list + +
  • + + + + + +
  • + + maximum + + : + + (number) + + the maximum for this element if not given the default for this define is used + + (optional) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:reset_element(element) +
+
+
+
+ +

Resets an element, or its store, to be back at the start, either 1 or 0

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element that you want to reset the progress of + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:event_counter([filter]) +
+
+
+
+ +

Event handler factory that counts up by 1 every time the event triggers, can filter which elements have incremented

+

+ + + Parameters: + +
    + + + + + +
  • + + filter + + : + + (function) + + when given will use filtered increment + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (function) + the event handler +
  • +
+ + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:event_countdown([filter]) +
+
+
+
+ +

Event handler factory that counts down by 1 every time the event triggers, can filter which elements have decremented

+

+ + + Parameters: + +
    + + + + + +
  • + + filter + + : + + (function) + + when given will use filtered decrement + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (function) + the event handler +
  • +
+ + + + + + + + + +
+
+

Sliders

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.instances +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + Slider.new_slider([name]) +
+
+
+
+ +

Creates a new slider element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new slider element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Slider._prototype:set_range([min][, max]) +
+
+
+
+ +

Sets the range of a slider, if not used will use default values for a slider

+

+ + + Parameters: + +
    + + + + + +
  • + + min + + : + + (number) + + the minimum value that the slider can take + + (optional) +
  • + + + + + +
  • + + max + + : + + (number) + + the maximum value that the slider can take + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + the define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Slider._prototype:draw_label(element) +
+
+
+
+ +

Draws a new label and links its value to the value of this slider, if no store then it will only show one value per player

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the parent element that the label will be drawn to + +
  • + + +
+ + + + + Returns: +
    +
  • + (LuaGuiElement) + the new label element so that styles can be applied +
  • +
+ + + + + + + + + +
+
+
+
+ # + Slider._prototype:enable_auto_draw_label([state=true]) +
+
+
+
+ +

Enables auto draw of the label, the label will share the same parent element as the slider

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean) + + when false will disable the auto draw of the label + + (default: true) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + the define to allow chaining +
  • +
+ + + + + + + + + +
+
+

Text

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + Text.new_text_field([name]) +
+
+
+
+ +

Creates a new text field element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new text field element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Text.new_text_box([name]) +
+
+
+
+ +

Creates a new text box element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new text box element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Text._prototype_box:set_selectable([state=true]) +
+
+
+
+ +

Sets the text box to be selectable

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean) + + when false will set the state to false + + (default: true) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + table the define to allow for chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Text._prototype_box:set_word_wrap([state=true]) +
+
+
+
+ +

Sets the text box to have word wrap

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean) + + when false will set the state to false + + (default: true) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + table the define to allow for chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Text._prototype_box:set_read_only([state=true]) +
+
+
+
+ +

Sets the text box to be read only

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean) + + when false will set the state to false + + (default: true) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + table the define to allow for chaining +
  • +
+ + + + + + + + + +
+
+

Instances

+
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + Instances.has_categories(name) +
+
+
+
+ +

Returns if a instance group has a serializer function; must be registered

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the instance group + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if there is a serializer function +
  • +
+ + + + + + + + + +
+
+
+
+ # + Instances.is_registered(name) +
+
+
+
+ +

Returns if the given name is a registered instance group

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the instance group you are testing + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the name is registered +
  • +
+ + + + + + + + + +
+
+
+
+ # + Instances.register(name[, serializer]) +
+
+
+
+ +

Registers the name of an instance group to allow for storing element instances

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the instance group; must to unique + +
  • + + + + + +
  • + + serializer + + : + + (function) + + function used to turn the element into a string + serializer param - element LuaGuiElement - the gui element to be turned into a string + serializer return - string - the category that the element will be added to like the player's name or force's name + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the name that was added so it can be used as a variable +
  • +
+ + + + + + + + + +
+
+
+
+ # + Instances.add_element(name, element) +
+
+
+
+ +

Adds an element to the instance group under the correct category; must be registered

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the instance group to add the element to + +
  • + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element to add the the instance group + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Instances.get_elements_raw(name[, category]) +
+
+
+
+ +

Gets all element instances without first removing any invalid ones; used internally and must be registered

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the instance group to get the instances of + +
  • + + + + + +
  • + + category + + : + + (string) + + the category to get the instance from, not needed when no serializer function + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the table of element instances of which some may be invalid +
  • +
+ + + + + + + + + +
+
+
+
+ # + Instances.get_valid_elements(name[, category][, callback]) +
+
+
+
+ +

Gets all valid element instances and has the option of running a callback on those that are valid

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the instance group to get the instances of + +
  • + + + + + +
  • + + category + + : + + (string) + + the category to get the instances of, not needed when no serializer function + + (optional) +
  • + + + + + +
  • + + callback + + : + + (function) + + when given the callback will be ran on all valid elements + callback param - element LuaGuiElement - the current valid element + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the table of element instances with all invalid ones removed +
  • +
+ + + + + + + + + +
+
+
+
+ # + Instances.unregistered_add_element(name, category, element) +
+
+
+
+ +

A version of add_element that does not require the group to be registered

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the instance group to add the element to + +
  • + + + + + +
  • + + category + + : + + (string or nil) + + the category to add the element to, can be nil but must still be given + +
  • + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element to add to the instance group + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Instances.unregistered_get_elements(name, category[, callback]) +
+
+
+
+ +

A version of get_elements that does not require the group to be registered

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the instance group to get the instances of + +
  • + + + + + +
  • + + category + + : + + (string or nil) + + the category to get the instances of, can be nil but must still be given + +
  • + + + + + +
  • + + callback + + : + + (function) + + when given will be called on all valid instances + callback param - element LuaGuiElement - the current valid element + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the table of element instances with all invalid ones removed +
  • +
+ + + + + + + + + +
+
+

Prototype

+
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.store +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.instances +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + Constructor.event(event_name) +
+
+
+
+ +

Creates a new function to add functions to an event handler

+

+ + + Parameters: + +
    + + + + + +
  • + + event_name + + : + + (string) + + the name of the event that callbacks will be added to + +
  • + + +
+ + + + + Returns: +
    +
  • + (function) + the function used to register handlers +
  • +
+ + + + + + + + + +
+
+
+
+ # + Constructor.extend(new_prototype) +
+
+
+
+ +

Extents a prototype with the base functions of all gui prototypes, no metatables

+

+ + + Parameters: + +
    + + + + + +
  • + + new_prototype + + : + + (table) + + the prototype that you want to add the functions to + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the same prototype but with the new functions added +
  • +
+ + + + + + + + + +
+
+
+
+ # + Constructor.store(callback) +
+
+
+
+ +

Creates a new function which adds a store to a gui define

+

+ + + Parameters: + +
    + + + + + +
  • + + callback + + : + + (function) + + the function called when needing to update the value of an element + +
  • + + +
+ + + + + Returns: +
    +
  • + (function) + the function that will add a store for this define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Constructor.setter(value_type, key[, second_key]) +
+
+
+
+ +

Creates a setter function that checks the type when a value is set

+

+ + + Parameters: + +
    + + + + + +
  • + + value_type + + : + + (string) + + the type that the value should be when it is set + +
  • + + + + + +
  • + + key + + : + + (string) + + the key of the define that will be set + +
  • + + + + + +
  • + + second_key + + : + + (string) + + allows for setting of a key in a sub table + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (function) + the function that will check the type and set the value +
  • +
+ + + + + + + + + +
+
+
+
+ # + Prototype:uid() +
+
+
+
+ +

Gets the uid for the element define

+

+ + + + + + Returns: +
    +
  • + (string) + the uid of this element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Prototype.debug_name +
+
+
+
+ +

Sets a debug alias for the define

+

+ + + +
    + + + + + +
  • + + name + + : + + (string) + + the debug name for the element define that can be used to get this element define + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Prototype.set_caption +
+
+
+
+ +

Sets the caption for the element define

+

+ + + +
    + + + + + +
  • + + caption + + : + + (string) + + the caption that will be drawn with the element + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Prototype.set_tooltip +
+
+
+
+ +

Sets the tooltip for the element define

+

+ + + +
    + + + + + +
  • + + tooltip + + : + + (string) + + the tooltip that will be displayed for this element when drawn + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Prototype.set_pre_authenticator +
+
+
+
+ +

Sets an authenticator that blocks the draw function if check fails

+

+ + + +
    + + + + + +
  • + + callback + + : + + (function) + + the function that will be ran to test if the element should be drawn or not + callback param - LuaPlayer player - the player that the element is being drawn to + callback param - string define_name - the name of the define that is being drawn + callback return - boolean - false will stop the element from being drawn + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Prototype.set_post_authenticator +
+
+
+
+ +

Sets an authenticator that disables the element if check fails

+

+ + + +
    + + + + + +
  • + + callback + + : + + (function) + + the function that will be ran to test if the element should be enabled or not + callback param - LuaPlayer player - the player that the element is being drawn to + callback param - string define_name - the name of the define that is being drawn + callback return - boolean - false will disable the element + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Prototype.on_draw +
+
+
+
+ +

Registers a callback to the on_draw event

+

+ + + +
    + + + + + +
  • + + callback + + : + + (function) + + + callback param - LuaPlayer player - the player that the element was drawn to + callback param - LuaGuiElement element - the element that was drawn + callback param - any ... - any other params passed by the draw_to function + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Prototype.on_style_update +
+
+
+
+ +

Registers a callback to the on_style_update event

+

+ + + +
    + + + + + +
  • + + callback + + : + + (function) + + + callback param - LuaStyle style - the style that was changed and/or needs changing + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Prototype:set_style(style[, callback]) +
+
+
+
+ +

Sets the style for the element define

+

+ + + Parameters: + +
    + + + + + +
  • + + style + + : + + (string) + + the style that will be used for this element when drawn + +
  • + + + + + +
  • + + callback + + : + + (function) + + function is called when element is drawn to alter its style + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + the element define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Prototype:set_embedded_flow(state) +
+
+
+
+ +

Sets the element to be drawn inside a nameless flow, can be given a name using a function

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean or function) + + when true a padless flow is created to contain the element + +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + the element define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Prototype:raise_event(event_name, ...) +
+
+
+
+ +

Raises a custom event for this define, any number of params can be given

+

+ + + Parameters: + +
    + + + + + +
  • + + event_name + + : + + (string) + + the name of the event that you want to raise + +
  • + + + + + +
  • + + ... + + : + + (any) + + any params that you want to pass to the event + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of handlers that were registered +
  • +
+ + + + + + + + + +
+
+
+
+ # + Prototype:draw_to(element) +
+
+
+
+ +

The main function for defines, when called will draw an instance of this define to the given element + what is drawn is based on the data in draw_data which is set using other functions

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element that the define will draw a instance of its self onto + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + Prototype:get_store(category) +
+
+
+
+ +

Gets the value in this elements store, category needed if serializer function used

+

+ + + Parameters: + +
    + + + + + +
  • + + category + + : + + (string) + + [opt] the category to get such as player name or force name + +
  • + + +
+ + + + + Returns: +
    +
  • + (any) + the value that is stored for this define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Prototype:set_store(category, value) +
+
+
+
+ +

Sets the value in this elements store, category needed if serializer function used

+

+ + + Parameters: + +
    + + + + + +
  • + + category + + : + + (string) + + [opt] the category to get such as player name or force name + +
  • + + + + + +
  • + + value + + : + + (any) + + the value to set for this define, must be valid for its type ie for checkbox etc + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the value was set +
  • +
+ + + + + + + + + +
+
+
+
+ # + Prototype:clear_store([category]) +
+
+
+
+ +

Sets the value in this elements store to nil, category needed if serializer function used

+

+ + + Parameters: + +
    + + + + + +
  • + + category + + : + + (string) + + the category to get such as player name or force name + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the value was set +
  • +
+ + + + + + + + + +
+
+

Test

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.store +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/core/Permissions-Groups.html b/docs/core/Permissions-Groups.html new file mode 100644 index 00000000..00b18e72 --- /dev/null +++ b/docs/core/Permissions-Groups.html @@ -0,0 +1,1440 @@ + + + + + + + + Permissions-Groups core + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Permissions-Groups core

+

Core Module - Permission Groups + - Permission group making for factorio so you never have to make one by hand again

+

+ + + + + + +

Usage

+

+---- Example Group (Allow All)
+
+    -- here we will create an admin group however we do not want them to use the map editor or mess with the permission groups
+    Permission_Groups.new_group('Admin') -- this defines a new group called "Admin"
+    :allow_all() -- this makes the default to allow any input action unless set other wise
+    :disallow{ -- here we disallow the input action we don't want them to use
+        'add_permission_group',
+        'delete_permission_group',
+        'import_permissions_string',
+        'map_editor_action',
+        'toggle_map_editor'
+    }
+

+---- Example Group (Disallow All)
+
+    -- here we will create a group that cant do anything but talk in chat
+    Permission_Groups.new_group('Restricted') -- this defines a new group called "Restricted"
+    :disallow_all() -- this makes the default to disallow any input action unless set other wise
+    :allow('write_to_console') -- here we allow them to chat, {} can be used here if we had more than one action
+
+ + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
utils.game
utils.event
expcore.sudo
+ + +

Getters

+ + + + + + + + + + + + + + + + +
new_group(name)Defines a new permission group that can have it actions set in the config
get_group_by_name(name)Returns the group with the given name, case sensitive
get_group_from_player(player)Returns the group that a player is in
+ + +

Setters

+ + + + + + + + + + + + + + + + +
reload_permissions()Reloads/creates all permission groups and sets them to they configured state
lockdown_permissions(exempt)Removes all permissions from every permission group except for "Default" and any passed as exempt
set_player_group(player, group)Sets a player's group to the one given, a player can only have one group at a time
+ + +

Actions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Permissions_Groups._prototype:set_action(action, state)Sets the allow state of an action for this group, used internally but is safe to use else where
Permissions_Groups._prototype:allow(actions)Sets an action or actions to be allowed for this group even with disallow_all triggered, Do not use in runtime
Permissions_Groups._prototype:disallow(actions)Sets an action or actions to be disallowed for this group even with allow_all triggered, Do not use in runtime
Permissions_Groups._prototype:allow_all()Sets the default state for any actions not given to be allowed, useful with :disallow
Permissions_Groups._prototype:disallow_all()Sets the default state for any action not given to be disallowed, useful with :allow
Permissions_Groups._prototype:is_allowed(action)Returns if an input action is allowed for this group
+ + +

Players

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Permissions_Groups._prototype:get_raw()Returns the LuaPermissionGroup that was created with this group object, used internally
Permissions_Groups._prototype:create()Creates or updates the permission group with the configured actions, used internally
Permissions_Groups._prototype:add_player(player)Adds a player to this group
Permissions_Groups._prototype:remove_player(player)Removes a player from this group
Permissions_Groups._prototype:get_players([online])Returns all player that are in this group with the option to filter to online/offline only
Permissions_Groups._prototype:print(message)Prints a message to every player in this group
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.sudo +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Getters

+
+
+
+
+ # + new_group(name) +
+
+
+
+ +

Defines a new permission group that can have it actions set in the config

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the new group + +
  • + + +
+ + + + + Returns: +
    +
  • + (Permissions_Groups._prototype) + the new group made with function to allow and disallow actions +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_group_by_name(name) +
+
+
+
+ +

Returns the group with the given name, case sensitive

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the group to get + +
  • + + +
+ + + + + Returns: +
    +
  • + (Permissions_Groups._prototype or nil) + the group with that name or nil if non found +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_group_from_player(player) +
+
+
+
+ +

Returns the group that a player is in

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the group of can be name index etc + +
  • + + +
+ + + + + Returns: +
    +
  • + (Permissions_Groups._prototype or nil) + the group with that player or nil if non found +
  • +
+ + + + + + + + + +
+
+

Setters

+
+
+
+
+ # + reload_permissions() +
+
+
+
+ +

Reloads/creates all permission groups and sets them to they configured state

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + lockdown_permissions(exempt) +
+
+
+
+ +

Removes all permissions from every permission group except for "Default" and any passed as exempt

+

+ + + Parameters: + +
    + + + + + +
  • + + exempt + + : + + (string or Array) + + groups that you want to be except, "Default" is always exempt + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of groups that had they permissions removed +
  • +
+ + + + + + + + + +
+
+
+
+ # + set_player_group(player, group) +
+
+
+
+ +

Sets a player's group to the one given, a player can only have one group at a time

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to effect can be name index etc + +
  • + + + + + +
  • + + group + + : + + (string) + + the name of the group to give to the player + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player was added successfully, false other wise +
  • +
+ + + + + + + + + +
+
+

Actions

+
+
+
+
+ # + Permissions_Groups._prototype:set_action(action, state) +
+
+
+
+ +

Sets the allow state of an action for this group, used internally but is safe to use else where

+

+ + + Parameters: + +
    + + + + + +
  • + + action + + : + + (string or defines.input_action) + + the action that you want to set the state of + +
  • + + + + + +
  • + + state + + : + + (boolean) + + the state that you want to set it to, true = allow, false = disallow + +
  • + + +
+ + + + + Returns: +
    +
  • + (Permissions_Groups._prototype) + returns self so function can be chained +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:allow(actions) +
+
+
+
+ +

Sets an action or actions to be allowed for this group even with disallow_all triggered, Do not use in runtime

+

+ + + Parameters: + +
    + + + + + +
  • + + actions + + : + + (string or Array) + + the action or actions that you want to allow for this group + +
  • + + +
+ + + + + Returns: +
    +
  • + (Permissions_Groups._prototype) + returns self so function can be chained +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:disallow(actions) +
+
+
+
+ +

Sets an action or actions to be disallowed for this group even with allow_all triggered, Do not use in runtime

+

+ + + Parameters: + +
    + + + + + +
  • + + actions + + : + + (string or Array) + + the action or actions that you want to disallow for this group + +
  • + + +
+ + + + + Returns: +
    +
  • + (Permissions_Groups._prototype) + returns self so function can be chained +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:allow_all() +
+
+
+
+ +

Sets the default state for any actions not given to be allowed, useful with :disallow

+

+ + + + + + Returns: +
    +
  • + (Permissions_Groups._prototype) + returns self so function can be chained +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:disallow_all() +
+
+
+
+ +

Sets the default state for any action not given to be disallowed, useful with :allow

+

+ + + + + + Returns: +
    +
  • + (Permissions_Groups._prototype) + returns self so function can be chained +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:is_allowed(action) +
+
+
+
+ +

Returns if an input action is allowed for this group

+

+ + + Parameters: + + + + + + + Returns: +
    +
  • + (boolean) + true if the group is allowed the action, false other wise +
  • +
+ + + + + + + + + +
+
+

Players

+
+
+
+
+ # + Permissions_Groups._prototype:get_raw() +
+
+
+
+ +

Returns the LuaPermissionGroup that was created with this group object, used internally

+

+ + + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:create() +
+
+
+
+ +

Creates or updates the permission group with the configured actions, used internally

+

+ + + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:add_player(player) +
+
+
+
+ +

Adds a player to this group

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + LuaPlayer the player you want to add to this group can be name or index etc + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player was added successfully, false other wise +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:remove_player(player) +
+
+
+
+ +

Removes a player from this group

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + LuaPlayer the player you want to remove from this group can be name or index etc + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player was removed successfully, false other wise +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:get_players([online]) +
+
+
+
+ +

Returns all player that are in this group with the option to filter to online/offline only

+

+ + + Parameters: + +
    + + + + + +
  • + + online + + : + + (boolean) + + if nil returns all players, if true online players only, if false returns online players only + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + a table of players that are in this group; filtered if online param is given +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:print(message) +
+
+
+
+ +

Prints a message to every player in this group

+

+ + + Parameters: + +
    + + + + + +
  • + + message + + : + + (string) + + the message that you want to send to the players + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of players that received the message +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/core/Roles.html b/docs/core/Roles.html new file mode 100644 index 00000000..3f2be0c2 --- /dev/null +++ b/docs/core/Roles.html @@ -0,0 +1,3160 @@ + + + + + + + + Roles core + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Roles core

+

Core Module - Roles + - Factorio role system to manage custom permissions.

+

+ + + + + + +

Usage

+

+---- Using Role System (Frontend):
+    When a map first starts you will want to define on mass all the players you expect to join and the roles to give them:
+    Roles.override_player_roles{
+        Cooldude2606 = {'Owner','Admin','Member'},
+        NotCooldude2606 = {'Member'}
+    }
+
+    Once the game is running you still want to be able to give role and remove them which is when you would use:
+    Roles.assign_player(player,'Admin',by_player_name) -- this will give the "Admin" role to the player
+    Roles.unassign_player(player,{'Admin','Moderator'},by_player_name) -- this will remove "Admin" and "Moderator" role in one go
+
+

+---- Using Role System (Backend):
+    To comparer two players you can comparer the index of they highest roles, can be used when you want to allow a "write" down type system:
+    Roles.get_player_highest_role(playerOne).index < Roles.get_player_highest_role(playerTwo).index -- remember that less means a higher role
+
+    Listing all of a players roles can also be useful which is when you would want to use:
+    Roles.get_player_roles(player) -- the return is an array that can be looped over however this is not in particular order
+
+    Finally you may want to test if a player has a certain role, flag or action allowed which is when you would use:
+    Roles.player_has_role(player,'Admin') -- you can provide a role name if you only want a name based system
+    Roles.player_has_flag(player,'is_donator') -- your roles can be grouped together with flags such as is_donator
+    Roles.player_allowed(player,'game modifiers') -- or you can have an action based system where each action is something the player can do
+
+

+---- Example Flag Define:
+    Flags can be used to group multiple roles and actions under one catch all, for example if you want a piece of code to only
+    be active for your donators then you would add a "is_donator" flag to all your donator roles and then in the code test if
+    a player has that tag present:
+
+    -- give you donators a speed boost when they join; these functions aren't required but can be useful
+    Roles.define_flag_trigger('is_donator',function(player,state)
+        if state then
+            player.character_running_speed_modifier = 1.5
+        else
+            player.character_running_speed_modifier = 1
+        end
+    end)
+
+    -- then on all your donator roles you would add
+    Roles.new_role('Donator')
+    :set_flag('is_donator')
+
+    -- and in your code you would test for
+    if Roles.player_has_flag(player,'is_donator') then
+        -- some donator only code
+    end
+

+---- Example Role Define:
+    You can't use a role system without any roles so first you must define your roles; each role has a minimum of a name with
+    the option for a shorthand:
+    Roles.new_role('Administrator','Admin')
+
+    Next you will want to add any extras you want to have, such as a tag, colour, permission group or any custom flags:
+    Roles.new_role('Administrator','Admin')
+    :set_custom_tag('[Admin]')
+    :set_custom_color('red') -- this can be {r=0,g=0,b=0} or a predefined value
+    :set_permission_group('Staff') -- a second argument can be added if you have not used the custom permission group config
+    :set_flag('is_admin')
+
+    You will then want to decide if you want to allow all actions, this should of course be used sparely:
+    Roles.new_role('Administrator','Admin')
+    ...extras...
+    :set_allow_all()
+
+    If you don't do this want this as i would advise you do then you will want to define what the role can do; this comes with
+    an optional inheritance system if you like those sort of things in which case disallow may also be of some use to you:
+    Roles.new_role('Administrator','Admin')
+    ...extras...
+    :set_parent('Moderator') -- the admin can do anything that a moderator can do
+    :allow{ -- these actions can be anything just try to keep them without conflicts
+        'command/kill',
+        'gui/game settings'
+    }
+
+    Here is what the finished admin role would look like:
+    Roles.new_role('Administrator','Admin')
+    :set_custom_tag('[Admin]')
+    :set_custom_color('red')
+    :set_permission_group('Staff')
+    :set_flag('is_admin')
+    :set_parent('Moderator')
+    :allow{
+        'command/kill',
+        'gui/game settings'
+    }
+

+---- Example System Define:
+    Once all roles are defined these steps must be done to ensure the system is ready to use, this includes setting a default
+    role, assigning a root (all permission) role that the server/system will use and the linear order that the roles fall into:
+
+    Roles.set_default('Guest')
+    Roles.set_root('System')
+
+    Roles.define_role_order{
+        'System',
+        'Administrator',
+        'Moderator',
+        'Donator',
+        'Guest'
+    }
+
+    Just remember that in this example all these roles have not been defined; so make sure all your roles that are used are defined
+    before hand; a config file on load is useful for this to ensure that its loaded before the first player even joins.
+ + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + + + + +
utils.game
utils.global
utils.event
expcore.permission_groups
expcore.sudo
resources.color_presets
expcore.common
+ + +

Getter

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
debug()Returns a string which contains all roles in index order displaying all data for them
print_to_roles(roles, message)Prints a message to all players in the given roles, may send duplicate message however factorio blocks spam
print_to_roles_higher(role, message)Prints a message to all players who have the given role or one which is higher (excluding default)
print_to_roles_lower(role, message)Prints a message to all players who have the given role or one which is lower (excluding default)
get_role_by_name(name)Get a role for the given name
get_role_by_order(index)Get a role with the given order index
get_role_from_any(any)Gets a role from a name,index or role object (where it is just returned) + nb: this function is used for the input for most outward facing functions
get_player_roles(player)Gets all the roles of the given player, this will always contain the default role
get_player_highest_role(player)Gets the highest role which the player has, can be used to compeer one player to another
+ + +

Assinment

+ + + + + + + + + + + + + + + + +
assign_player(player, roles[, by_player_name=][, silent=false])Gives a player the given role(s) with an option to pass a by player name used in the log
unassign_player(player, roles[, by_player_name=][, silent=false])Removes a player from the given role(s) with an option to pass a by player name used in the log
override_player_roles(roles)Overrides all player roles with the given table of roles, useful to mass set roles on game start
+ + +

Checks

+ + + + + + + + + + + + + + + + +
player_has_role(player, search_role)A test for weather a player has the given role
player_has_flag(player, flag_name)A test for weather a player has the given flag true for at least one of they roles
player_allowed(player, action)A test for weather a player has at least one role which is allowed the given action
+ + +

Definations

+ + + + + + + + + + + + + + + + + + + + + + + + +
define_role_order(order)Used to set the role order, higher in the list is better, must be called at least once in config + nb: function also re links parents due to expected position in the config file
define_flag_trigger(name, callback)Defines a new trigger for when a tag is added or removed from a player
set_default(name)Sets the default role which every player will have, this needs to be called at least once
set_root(name)Sets the root role which will always have all permissions, any server actions act from this role
new_role(name[, short_hand=name])Defines a new role and returns the prototype to allow configuration
+ + +

Role Actions

+ + + + + + + + + + + + + + + + + + + + +
Roles._prototype:set_allow_all([state=true])Sets the default allow state of the role, true will allow all actions
Roles._prototype:allow(actions)Sets the allow actions for this role, actions in this list will be allowed for this role
Roles._prototype:disallow(actions)Sets the disallow actions for this role, will prevent actions from being allowed regardless of inheritance
Roles._prototype:is_allowed(action)Test for if a role is allowed the given action, mostly internal see Roles.player_allowed
+ + +

Role Flags

+ + + + + + + + + + + + + + + + +
Roles._prototype:set_flag(name[, value=true])Sets the state of a flag for a role, flags can be used to apply effects to players
Roles._prototype:clear_flags()Clears all flags from this role, individual flags can be removed with set_flag(name,false)
Roles._prototype:has_flag(name)A test for if the role has a flag set
+ + +

Role Properties

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Roles._prototype:set_custom_tag(tag)Sets a custom player tag for the role, can be accessed by other code
Roles._prototype:set_custom_color(color)Sets a custom colour for the role, can be accessed by other code
Roles._prototype:set_permission_group(name[, use_factorio_api=false])Sets the permission group for this role, players will be moved to the group of they highest role
Roles._prototype:set_parent(role)Sets the parent for a role, any action not in allow or disallow will be looked for in its parents + nb: this is a recursive action, and changing the allows and disallows will effect all children roles
Roles._prototype:set_auto_promote_condition(callback)Sets an auto promote condition that is checked every 5 seconds, if true is returned then the player will receive the role + nb: this is one way, failing false after already gaining the role will not revoke the role
Roles._prototype:set_block_auto_promote([state=true])Sets the role to not allow players to have auto promote effect them, useful to keep people locked to a punishment
+ + +

Role Players

+ + + + + + + + + + + + + + + + + + + + +
Roles._prototype:add_player(player, skip_check, skip_event)Adds a player to this role, players can have more than one role at a time, used internally see Roles.assign
Roles._prototype:remove_player(player, skip_check, skip_event)Removes a player from this role, players can have more than one role at a time, used internally see Roles.unassign
Roles._prototype:get_players([online=nil])Returns an array of all the players who have this role, can be filtered by online status
Roles._prototype:print(message)Will print a message to all players with this role
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.permission_groups +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.sudo +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Getter

+
+
+
+
+ # + debug() +
+
+
+
+ +

Returns a string which contains all roles in index order displaying all data for them

+

+ + + + + + Returns: +
    +
  • + (string) + the debug output string +
  • +
+ + + + + + + + + +
+
+
+
+ # + print_to_roles(roles, message) +
+
+
+
+ +

Prints a message to all players in the given roles, may send duplicate message however factorio blocks spam

+

+ + + Parameters: + +
    + + + + + +
  • + + roles + + : + + (table) + + table a of roles which to send the message to + +
  • + + + + + +
  • + + message + + : + + (string) + + the message to send to the players + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + print_to_roles_higher(role, message) +
+
+
+
+ +

Prints a message to all players who have the given role or one which is higher (excluding default)

+

+ + + Parameters: + +
    + + + + + +
  • + + role + + : + + (string) + + the name of the role to send the message to + +
  • + + + + + +
  • + + message + + : + + (string) + + the message to send to the players + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + print_to_roles_lower(role, message) +
+
+
+
+ +

Prints a message to all players who have the given role or one which is lower (excluding default)

+

+ + + Parameters: + +
    + + + + + +
  • + + role + + : + + (string) + + the name of the role to send the message to + +
  • + + + + + +
  • + + message + + : + + (string) + + the message to send to the players + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + get_role_by_name(name) +
+
+
+
+ +

Get a role for the given name

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the role to get + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + the role with that name or nil +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_role_by_order(index) +
+
+
+
+ +

Get a role with the given order index

+

+ + + Parameters: + +
    + + + + + +
  • + + index + + : + + (number) + + the place in the order list of the role to get + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + the role with that index in the order list or nil +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_role_from_any(any) +
+
+
+
+ +

Gets a role from a name,index or role object (where it is just returned) + nb: this function is used for the input for most outward facing functions

+

+ + + Parameters: + +
    + + + + + +
  • + + any + + : + + (number, string or table) + + the value used to find the role + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + the role that was found or nil see above +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_player_roles(player) +
+
+
+
+ +

Gets all the roles of the given player, this will always contain the default role

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the roles of + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + a table where the values are the roles which the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_player_highest_role(player) +
+
+
+
+ +

Gets the highest role which the player has, can be used to compeer one player to another

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the highest role of + +
  • + + +
+ + + + + Returns: +
    +
  • + (the) + role with the highest order index which this player has +
  • +
+ + + + + + + + + +
+
+

Assinment

+
+
+
+
+ # + assign_player(player, roles[, by_player_name=][, silent=false]) +
+
+
+
+ +

Gives a player the given role(s) with an option to pass a by player name used in the log

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will be assigned the roles + +
  • + + + + + +
  • + + roles + + : + + (table) + + table a of roles that the player will be given, can be one role and can be role names + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player that will be shown in the log + + (default: ) +
  • + + + + + +
  • + + silent + + : + + (boolean) + + when true there will be no game message printed + + (default: false) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + unassign_player(player, roles[, by_player_name=][, silent=false]) +
+
+
+
+ +

Removes a player from the given role(s) with an option to pass a by player name used in the log

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will have the roles removed + +
  • + + + + + +
  • + + roles + + : + + (table) + + table a of roles to be removed from the player, can be one role and can be role names + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player that will be shown in the logs + + (default: ) +
  • + + + + + +
  • + + silent + + : + + (boolean) + + when true there will be no game message printed + + (default: false) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + override_player_roles(roles) +
+
+
+
+ +

Overrides all player roles with the given table of roles, useful to mass set roles on game start

+

+ + + Parameters: + +
    + + + + + +
  • + + roles + + : + + (table) + + table a which is indexed by case sensitive player names and has the value of a table of role names + +
  • + + +
+ + + + + + + + + + + + + +
+
+

Checks

+
+
+
+
+ # + player_has_role(player, search_role) +
+
+
+
+ +

A test for weather a player has the given role

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to test the roles of + +
  • + + + + + +
  • + + search_role + + : + + (string, number or table) + + a pointer to the role that is being searched for + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player has the role, false otherwise, nil for errors +
  • +
+ + + + + + + + + +
+
+
+
+ # + player_has_flag(player, flag_name) +
+
+
+
+ +

A test for weather a player has the given flag true for at least one of they roles

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to test the roles of + +
  • + + + + + +
  • + + flag_name + + : + + (string) + + the name of the flag that is being looked for + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player has at least one role which has the flag set to true, false otherwise, nil for errors +
  • +
+ + + + + + + + + +
+
+
+
+ # + player_allowed(player, action) +
+
+
+
+ +

A test for weather a player has at least one role which is allowed the given action

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to test the roles of + +
  • + + + + + +
  • + + action + + : + + (string) + + the name of the action that is being tested for + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player has at least one role which is allowed this action, false otherwise, nil for errors +
  • +
+ + + + + + + + + +
+
+

Definations

+
+
+
+
+ # + define_role_order(order) +
+
+
+
+ +

Used to set the role order, higher in the list is better, must be called at least once in config + nb: function also re links parents due to expected position in the config file

+

+ + + Parameters: + +
    + + + + + +
  • + + order + + : + + (table) + + table a which is keyed only by numbers (start 1) and values are roles in order with highest first + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + define_flag_trigger(name, callback) +
+
+
+
+ +

Defines a new trigger for when a tag is added or removed from a player

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the flag which the roles will have + +
  • + + + + + +
  • + + callback + + : + + (function) + + the function that is called when roles are assigned + flag param - player - the player that has had they roles changed + flag param - state - the state of the flag, aka if the flag is present + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + set_default(name) +
+
+
+
+ +

Sets the default role which every player will have, this needs to be called at least once

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the default role + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + set_root(name) +
+
+
+
+ +

Sets the root role which will always have all permissions, any server actions act from this role

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the root role + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + new_role(name[, short_hand=name]) +
+
+
+
+ +

Defines a new role and returns the prototype to allow configuration

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the new role, must be unique + +
  • + + + + + +
  • + + short_hand + + : + + (string) + + the shortened version of the name + + (default: name) +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + the start of the config chain for this role +
  • +
+ + + + + + + + + +
+
+

Role Actions

+
+
+
+
+ # + Roles._prototype:set_allow_all([state=true]) +
+
+
+
+ +

Sets the default allow state of the role, true will allow all actions

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean) + + true will allow all actions + + (default: true) +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:allow(actions) +
+
+
+
+ +

Sets the allow actions for this role, actions in this list will be allowed for this role

+

+ + + Parameters: + +
    + + + + + +
  • + + actions + + : + + (table) + + indexed with numbers and is an array of action names, order has no effect + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:disallow(actions) +
+
+
+
+ +

Sets the disallow actions for this role, will prevent actions from being allowed regardless of inheritance

+

+ + + Parameters: + +
    + + + + + +
  • + + actions + + : + + (table) + + indexed with numbers and is an array of action names, order has no effect + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:is_allowed(action) +
+
+
+
+ +

Test for if a role is allowed the given action, mostly internal see Roles.player_allowed

+

+ + + Parameters: + +
    + + + + + +
  • + + action + + : + + (string) + + the name of the action to test if it is allowed + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if action is allowed, false otherwise +
  • +
+ + + + + + + + + +
+
+

Role Flags

+
+
+
+
+ # + Roles._prototype:set_flag(name[, value=true]) +
+
+
+
+ +

Sets the state of a flag for a role, flags can be used to apply effects to players

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the flag to set the value of + +
  • + + + + + +
  • + + value + + : + + (boolean) + + the state to set the flag to + + (default: true) +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:clear_flags() +
+
+
+
+ +

Clears all flags from this role, individual flags can be removed with set_flag(name,false)

+

+ + + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:has_flag(name) +
+
+
+
+ +

A test for if the role has a flag set

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the flag to test for + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the flag is set, false otherwise +
  • +
+ + + + + + + + + +
+
+

Role Properties

+
+
+
+
+ # + Roles._prototype:set_custom_tag(tag) +
+
+
+
+ +

Sets a custom player tag for the role, can be accessed by other code

+

+ + + Parameters: + +
    + + + + + +
  • + + tag + + : + + (string) + + the value that the tag will be + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:set_custom_color(color) +
+
+
+
+ +

Sets a custom colour for the role, can be accessed by other code

+

+ + + Parameters: + +
    + + + + + +
  • + + color + + : + + (table) + + ?string|table can either be and rgb colour or the name of a colour defined in the presets + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:set_permission_group(name[, use_factorio_api=false]) +
+
+
+
+ +

Sets the permission group for this role, players will be moved to the group of they highest role

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the permission group to have players moved to + +
  • + + + + + +
  • + + use_factorio_api + + : + + (boolean) + + when true the custom permission group module is ignored + + (default: false) +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:set_parent(role) +
+
+
+
+ +

Sets the parent for a role, any action not in allow or disallow will be looked for in its parents + nb: this is a recursive action, and changing the allows and disallows will effect all children roles

+

+ + + Parameters: + +
    + + + + + +
  • + + role + + : + + (string) + + the name of the role that will be the parent; has imminent effect if role is already defined + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:set_auto_promote_condition(callback) +
+
+
+
+ +

Sets an auto promote condition that is checked every 5 seconds, if true is returned then the player will receive the role + nb: this is one way, failing false after already gaining the role will not revoke the role

+

+ + + Parameters: + +
    + + + + + +
  • + + callback + + : + + (function) + + receives only one param which is player to promote, return true to promote the player + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:set_block_auto_promote([state=true]) +
+
+
+
+ +

Sets the role to not allow players to have auto promote effect them, useful to keep people locked to a punishment

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean) + + when true the players with this role will not be auto promoted + + (default: true) +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+

Role Players

+
+
+
+
+ # + Roles._prototype:add_player(player, skip_check, skip_event) +
+
+
+
+ +

Adds a player to this role, players can have more than one role at a time, used internally see Roles.assign

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will be given this role + +
  • + + + + + +
  • + + skip_check + + : + + (boolean) + + when true player will be taken as the player name (use when player has not yet joined) + +
  • + + + + + +
  • + + skip_event + + : + + (boolean) + + when true the event emit will be skipped, this is used internally with Roles.assign + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player was added successfully +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:remove_player(player, skip_check, skip_event) +
+
+
+
+ +

Removes a player from this role, players can have more than one role at a time, used internally see Roles.unassign

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will lose this role + +
  • + + + + + +
  • + + skip_check + + : + + (boolean) + + when true player will be taken as the player name (use when player has not yet joined) + +
  • + + + + + +
  • + + skip_event + + : + + (boolean) + + when true the event emit will be skipped, this is used internally with Roles.unassign + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player was removed successfully +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:get_players([online=nil]) +
+
+
+
+ +

Returns an array of all the players who have this role, can be filtered by online status

+

+ + + Parameters: + +
    + + + + + +
  • + + online + + : + + (boolean) + + when given will filter by this online state, nil will return all players + + (default: nil) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + all the players who have this role, indexed order is meaningless +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:print(message) +
+
+
+
+ +

Will print a message to all players with this role

+

+ + + Parameters: + +
    + + + + + +
  • + + message + + : + + (string) + + the message that will be printed to the players + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of players who received the message +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/core/Store.html b/docs/core/Store.html new file mode 100644 index 00000000..1d8ad527 --- /dev/null +++ b/docs/core/Store.html @@ -0,0 +1,1472 @@ + + + + + + + + Store core + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Store core

+

Core Module - Store +- Used to store and watch for updates for values in the global table

+

+ + + + + + +

Usage

+
-- Require the module and add a store with no keys
+-- Store with no keys does not need a serializer
+local Store = require 'expcore.store' --- @dep expcore.store
+local scenario_diffculty = Store.register()
+
+-- When the store is changed this function will trigger
+Store.watch(scenario_diffculty,function(value)
+    game.print('The scenario diffculty has been set to '..value)
+end)
+
+Store.set(scenario_diffculty,'hard') -- Set the value stored to 'hard'
+Store.get(scenario_diffculty) -- Returns 'hard'
+Store.update(scenario_diffculty,function(value) -- Will set value to 'normal' if no value is present
+    return not value and 'normal'
+end)
+
-- Require the module and add a store with keys
+-- Store with keys does not require a serializer but it can be helpful
+local Store = require 'expcore.store' --- @dep expcore.store
+local player_scores = Store.register(function(player) -- Use player name as the key
+    return player.name
+end)
+
+-- When any key in the store is changed this function will trigger
+Store.watch(player_scores,function(value,key)
+    game.print(key..' now has a score of '..value)
+end)
+
+Store.set(player_scores,game.player,10) -- Set your score to 10
+Store.get(scenario_diffculty,game.player) -- Returns 10
+Store.update(scenario_diffculty,game.player,function(value) -- Add 1 to your score
+    return value + 1
+end)
+ + + + + + + +

Dependencies

+ + + + + + + +
utils.event
+ + +

Tables

+ + + + + + + + + + + + + + + + +
serializersAn array of the serializers that stores are using, key is store uids
watchersAn array of watchers that stores will trigger, key is store uids
file_pathsAn index used for debuging to find the file where different stores where registered
+ + +

Fields

+ + + + + + + + +
uidThe current highest uid that is being used, will not increase during runtime
+ + +

Store Setup

+ + + + + + + + + + + + + + + + +
validate(store[, key][, error_stack=1])An error checking and serializing function for checking store uids and keys, note key is not required
register([serializer])Required to create new stores and register an serializer to a store, serializer not required
watch(store, watcher)Register a watch function to a store that is called when the value in the store is changed, triggers for any key
+ + +

Store Data Management

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
get(store[, key])Used to retrive the current data that is stored, key is optional depending on if you are using them
clear(store[, key])Used to clear the data in a store, will trigger any watchers, key is optional depending on if you are using them
set(store[, key], value)Used to set the data in a store, will trigger any watchers, key is optional depending on if you are using them
update(store[, key], updater)Used to update the data in a store, use this with tables, will trigger any watchers, key is optional depending on if you are using them
map(store, updater)Used to update all values that are in a store, similar to Store.update but acts on all keys at once, will trigger watchers for every key present
trigger(store[, key])Used to trigger watcher functions, this may be used to trigger them if you did not use Store.update or Store.set
raw_trigger(store[, key][, value])Used to trigger watcher functions, the value and key are passed directly to the watchers regardless if the value is correct
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Tables

+
+
+
+
+ # + serializers +
+
+
+
+ +

An array of the serializers that stores are using, key is store uids

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + watchers +
+
+
+
+ +

An array of watchers that stores will trigger, key is store uids

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + file_paths +
+
+
+
+ +

An index used for debuging to find the file where different stores where registered

+

+ + + + + + + + + + + + + + +
+
+

Fields

+
+
+
+
+ # + uid +
+
+
+
+ +

The current highest uid that is being used, will not increase during runtime

+

+ + + +
    + + + + + +
  • + + uid + + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+

Store Setup

+
+
+
+
+ # + validate(store[, key][, error_stack=1]) +
+
+
+
+ +

An error checking and serializing function for checking store uids and keys, note key is not required

+

+ + + Parameters: + +
    + + + + + +
  • + + store + + : + + (number) + + the uid of the store that you want to check is valid + +
  • + + + + + +
  • + + key + + : + + (string or any) + + the key that you want to serialize or check is a string + + (optional) +
  • + + + + + +
  • + + error_stack + + : + + (number) + + the position in the stack relative to the current function (1) to raise this error on + + (default: 1) +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + if key is given and a serializer is registered, or key was already a string, then the key is returned +
  • +
+ + + + + + + + Usage: +
-- Registering a new store and checking that it is valid
+-- New store will use player names as the keys
+local player_scores = Store.register(function(player)
+    return player.name
+end)
+
+-- player_scores is a valid store and key will be your player name
+local key = Store.validate(player_scores,game.player)
+ + +
+
+
+
+ # + register([serializer]) +
+
+
+
+ +

Required to create new stores and register an serializer to a store, serializer not required

+

+ + + Parameters: + +
    + + + + + +
  • + + serializer + + : + + (function) + + the function used to convert non string keys into strings to be used in the store + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the uid for the new store that you have created, use this as the first param to all other functions +
  • +
+ + + + + + + + Usage: +
-- Creating a store with no serializer
+local scenario_diffculty = Store.register()
+
-- Creating a store which can take LuaPlayer
+local player_scores = Store.register(function(player)
+    return player.name
+end)
+ + +
+
+
+
+ # + watch(store, watcher) +
+
+
+
+ +

Register a watch function to a store that is called when the value in the store is changed, triggers for any key

+

+ + + Parameters: + +
    + + + + + +
  • + + store + + : + + (number) + + the uid of the store that you want to watch for changes to + +
  • + + + + + +
  • + + watcher + + : + + (function) + + the function that will be called when there is a change to the store + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Printing the changed value to all players, no keys
+-- Register the new store, we are not using keys so we dont need a serializer
+local scenario_diffculty = Store.register()
+
+-- Register the watcher so that when we change the value the message is printed
+Store.watch(scenario_diffculty,function(value)
+    game.print('The scenario diffculty has been set to '..value)
+end)
+
+-- Set a new value for the diffculty and see that it has printed to the game
+Store.set(scenario_diffculty,'hard')
+
-- Printing the changed value to all players, with keys
+-- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects
+local player_scores = Store.register(function(player)
+    return player.name
+end)
+
+-- Register the watcher so that when we change the value the message is printed
+Store.watch(player_scores,function(value,key)
+    game.print(key..' now has a score of '..value)
+end)
+
+-- Set a new value for your score and see that it has printed to the game
+Store.set(player_scores,game.player,10)
+ + +
+
+

Store Data Management

+
+
+
+
+ # + get(store[, key]) +
+
+
+
+ +

Used to retrive the current data that is stored, key is optional depending on if you are using them

+

+ + + Parameters: + +
    + + + + + +
  • + + store + + : + + (number) + + the uid of the store that you want to get the value from + +
  • + + + + + +
  • + + key + + : + + (string or any) + + the key that you want to get the value of, must be a string unless you have a serializer + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (any) + the data that is stored +
  • +
+ + + + + + + + Usage: +
-- Getting the value of a store with no keys
+-- Register the new store, we are not using keys so we dont need a serializer
+local scenario_diffculty = Store.register()
+
+-- Get the current diffculty for the scenario
+local diffculty = Store.get(scenario_diffculty)
+
-- Getting the data from a store with keys
+-- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects
+local player_scores = Store.register(function(player)
+    return player.name
+end)
+
+-- Get your current score
+local my_score = Store.get(player_scores,game.player)
+
+-- Get all scores
+lcoal scores = Store.get(player_scores)
+ + +
+
+
+
+ # + clear(store[, key]) +
+
+
+
+ +

Used to clear the data in a store, will trigger any watchers, key is optional depending on if you are using them

+

+ + + Parameters: + +
    + + + + + +
  • + + store + + : + + (number) + + the uid of the store that you want to clear + +
  • + + + + + +
  • + + key + + : + + (string or any) + + the key that you want to clear, must be a string unless you have a serializer + + (optional) +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Clear a store which does not use keys
+-- Register the new store, we are not using keys so we dont need a serializer
+local scenario_diffculty = Store.register()
+
+-- Clear the scenario diffculty
+Store.clear(scenario_diffculty)
+
-- Clear data that is in a store with keys
+-- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects
+local player_scores = Store.register(function(player)
+    return player.name
+end)
+
+-- Clear your score
+Store.clear(player_scores,game.player)
+
+-- Clear all scores
+Store.clear(player_scores)
+ + +
+
+
+
+ # + set(store[, key], value) +
+
+
+
+ +

Used to set the data in a store, will trigger any watchers, key is optional depending on if you are using them

+

+ + + Parameters: + +
    + + + + + +
  • + + store + + : + + (number) + + the uid of the store that you want to set + +
  • + + + + + +
  • + + key + + : + + (string or any) + + the key that you want to set, must be a string unless you have a serializer + + (optional) +
  • + + + + + +
  • + + value + + : + + (any) + + the value that you want to set + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Setting a store which does not use keys
+-- Register the new store, we are not using keys so we dont need a serializer
+local scenario_diffculty = Store.register()
+
+-- Set the new scenario diffculty
+Store.set(scenario_diffculty,'hard')
+
-- Set data in a store with keys
+-- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects
+local player_scores = Store.register(function(player)
+    return player.name
+end)
+
+-- Set your current score
+Store.set(player_scores,game.player,10)
+
+-- Set all scores, note this might not have much use
+Store.set(player_scores,{
+    [game.player.name] = 10,
+    ['SomeOtherPlayer'] = 0
+})
+ + +
+
+
+
+ # + update(store[, key], updater) +
+
+
+
+ +

Used to update the data in a store, use this with tables, will trigger any watchers, key is optional depending on if you are using them

+

+ + + Parameters: + +
    + + + + + +
  • + + store + + : + + (number) + + the uid of the store that you want to update + +
  • + + + + + +
  • + + key + + : + + (string or any) + + the key that you want to update, must be a string unless you have a serializer + + (optional) +
  • + + + + + +
  • + + updater + + : + + (function) + + the function which is called to make changes to the value, such as changing table keys, if a value is returned it will replace the current value in the store + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Incrementing a global score
+-- Because we are only going to have one score so we will not need keys or a serializer
+local game_score = Store.register()
+
+-- Setting a default value
+Store.set(game_score,0)
+
+-- We now will update the game score by one, we return the value so that it is set as the new value in the store
+Store.update(game_score,function(value)
+    return value + 1
+end)
+
-- Updating keys in a table of data
+-- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects
+local player_data = Store.register(function(player)
+    return player.name
+end)
+
+-- Setting a default value for your player, used to show the table structure
+Store.set(player_data,game.player,{
+    group = 'Admin',
+    role = 'Owner',
+    show_group_config = false
+})
+
+-- Updating the show_group_config key in your player data, note that it would be harder to call set every time
+-- We do not need to return anything in this case as we are not replacing all the data
+Store.update(player_data,game.player,function(data)
+    data.show_group_config = not data.show_group_config
+end)
+ + +
+
+
+
+ # + map(store, updater) +
+
+
+
+ +

Used to update all values that are in a store, similar to Store.update but acts on all keys at once, will trigger watchers for every key present

+

+ + + Parameters: + +
    + + + + + +
  • + + store + + : + + (number) + + the uid of the store that you want to map + +
  • + + + + + +
  • + + updater + + : + + (function) + + the function that is called on every key in this store + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Updating keys in a table of data
+-- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects
+local player_data = Store.register(function(player)
+    return player.name
+end)
+
+-- Setting a default value for your player, used to show the table structure
+Store.set(player_data,game.player,{
+    group = 'Admin',
+    role = 'Owner',
+    show_group_config = false
+})
+
+-- Updating the show_group_config key for all players, note that it would be harder to call set every time
+-- We do not need to return anything in this case as we are not replacing all the data
+-- We also have access to the current key being updated if needed
+Store.map(player_data,function(data,key)
+    data.show_group_config = not data.show_group_config
+end)
+ + +
+
+
+
+ # + trigger(store[, key]) +
+
+
+
+ +

Used to trigger watcher functions, this may be used to trigger them if you did not use Store.update or Store.set

+

+ + + Parameters: + +
    + + + + + +
  • + + store + + : + + (number) + + the uid of the store that you want to trigger + +
  • + + + + + +
  • + + key + + : + + (string or any) + + the key that you want to trigger, must be a string unless you have a serializer + + (optional) +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Faking the update to a store
+-- The type of store we use does not really matter for this as long as you pass it what you watchers are expecting
+local scenario_diffculty = Store.register()
+
+-- Trigger the watchers with a fake change of diffculty
+Store.trigger(scenario_diffculty)
+ + +
+
+
+
+ # + raw_trigger(store[, key][, value]) +
+
+
+
+ +

Used to trigger watcher functions, the value and key are passed directly to the watchers regardless if the value is correct

+

+ + + Parameters: + +
    + + + + + +
  • + + store + + : + + (number) + + the uid of the store that you want to trigger + +
  • + + + + + +
  • + + key + + : + + (string or any) + + the key that you want to trigger, must be a string unless you have a serializer + + (optional) +
  • + + + + + +
  • + + value + + : + + (any) + + the new value that is at this key or store, passed directly to the watcher + + (optional) +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Triggering a manule call of the watchers
+-- The type of store we use does not really matter for this as long as you pass it what you watchers are expecting
+local scenario_diffculty = Store.register()
+
+-- Trigger the watchers with a fake change of diffculty
+-- This is mostly used internally but it can be useful in other cases
+Store.raw_trigger(scenario_diffculty,nil,'normal')
+ + +
+
+ + + +
+
+
+ + + + diff --git a/docs/core/Sudo.html b/docs/core/Sudo.html new file mode 100644 index 00000000..23573d85 --- /dev/null +++ b/docs/core/Sudo.html @@ -0,0 +1,552 @@ + + + + + + + + Sudo core + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Sudo core

+

Core Module - Sudo + - An extention of task and token to allow a single require to register and run functions bypassing all permissions.

+

+ + + + + + +

Usage

+

+    -- To use sudo you must register the allowed functions when the files are loaded, often this will just be giving access to
+    -- some functions within a module if you expect that some parts may be blocked by in game permissions or a custom system you have made
+
+    -- This will be blocked if the current player (from a command or gui) is not admin
+    local function make_admin(player)
+        player.admin = true
+    end
+
+    -- Here we give sudo access to the function under the name "make-admin"
+    Sudo.register('make-admin',make_admin)
+
+    -- This will allow us to bypass this by running one tick later outside of any player scope
+    Sudo.run('make-admin',game.player)
+ + + + + + + +

Dependencies

+ + + + + + + + + + +
utils.task
utils.token
+ + +

Functions

+ + + + + + + + + + + + + + + + +
register(name, callback)Registers a new callback under the given name, used to avoid desyncs
get(name)Gets the function that is registered under the given name
run(name[, ...])Runs the function that is registered under the given name, you may supply any number of params as needed
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.task +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.token +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + register(name, callback) +
+
+
+
+ +

Registers a new callback under the given name, used to avoid desyncs

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name that will be used to call this function + +
  • + + + + + +
  • + + callback + + : + + (function) + + the function that will be called by this name + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + get(name) +
+
+
+
+ +

Gets the function that is registered under the given name

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the function you want to get + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + run(name[, ...]) +
+
+
+
+ +

Runs the function that is registered under the given name, you may supply any number of params as needed

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the function you want to run + +
  • + + + + + +
  • + + ... + + : + + (any) + + the other params that you want to pass to your function + + (optional) +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/core/Toolbar.html b/docs/core/Toolbar.html new file mode 100644 index 00000000..848922b5 --- /dev/null +++ b/docs/core/Toolbar.html @@ -0,0 +1,1669 @@ + + + + + + + + Toolbar core + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Toolbar core

+

Core Module - Toolbar

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + +
expcore.gui
expcore.roles
utils.event
utils.game
mod-gui
Gui.concept.button
+ + +

Permissions

+ + + + + + + + + + + + +
allowed(player, concept_name)Used to test if a player is allowed to use a button on the toolbar, if you are not using expcore.roles then change this function
set_permission_alias(concept_name, alias)Use to add an alias for the allowed test, alias is what is tested for rather than the concept name
+ + +

Buttons

+ + + + + + + + + + + + + + + + + + + + +
add_button_concept(concept)Adds a concept to be drawn to the button area and allows it to be toggled with the toggle toolbar button
update_buttons(player)Updates all the buttons for a player, this means hide and show buttons based on permissions
get_visible_buttons(player)Returns an array of buttons names that the given player is able to see, returns none if toolbar hidden
toolbar-buttonThe base element to be used with the toolbar, others can be used but this is recomented
+ + +

Frames

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
add_frame_concept(concept)Adds a frame concept to the toolbar frame area, this will not add a button to the toolbar
hide_frames(player)Hides all the frames for a player
get_visible_frames(player)Gets an array of the names of all the visible frames for a player
toolbar-frameThe base toolbar frame, others can be used but this is recomented
Toolbar.frame:get_content(player)Gets the content area of the frame concept for this player, each player only has one area
Toolbar.frame:toggle_visible_state(player)Toggles the visibilty of this concept for the given player
Toolbar.frame:get_visible_state(player)Gets the current visibilty state of this conept for this player
Toolbar.frame:update(player[, event])Triggers an update of the content within the concept for this player, uses on_update handlers
Toolbar.frame:update_all([event])Triggers an update of the content with in this frame for all players
+ + +

Other Elements

+ + + + + + + + + + + + + + + + +
toolbarThe main toolbar element, draws, updates, and controls the other concepts
toolbar-toggleButton which toggles the the visible state of all toolbar buttons, triggers on_button_update
toolbar-clearButton which hides all visible toolbar frames, triggers on_hide_frames
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + mod-gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + Gui.concept.button +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Permissions

+
+
+
+
+ # + allowed(player, concept_name) +
+
+
+
+ +

Used to test if a player is allowed to use a button on the toolbar, if you are not using expcore.roles then change this function

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player you want ot test is allowed to use this button + +
  • + + + + + +
  • + + concept_name + + : + + (string) + + the name of the button concept that you want to see if the player is allowed to use + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player is allowed to use it +
  • +
+ + + + + + + + Usage: +
-- Test if a player can use 'test-player-list'
+local allowed = Toolbar.allowed(game.player,'test-player-list')
+ + +
+
+
+
+ # + set_permission_alias(concept_name, alias) +
+
+
+
+ +

Use to add an alias for the allowed test, alias is what is tested for rather than the concept name

+

+ + + Parameters: + +
    + + + + + +
  • + + concept_name + + : + + (string) + + the name of the concept that will point to this alias + +
  • + + + + + +
  • + + alias + + : + + (string) + + the permission string that will be tested when this concept is used with Toolbar.allowed + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Adding an alias for the 'test-player-list' concept
+Toolbar.set_permission_alias('test-player-list','gui/player-list')
+ + +
+
+

Buttons

+
+
+
+
+ # + add_button_concept(concept) +
+
+
+
+ +

Adds a concept to be drawn to the button area and allows it to be toggled with the toggle toolbar button

+

+ + + Parameters: + +
    + + + + + +
  • + + concept + + : + + (table) + + the gui concept that you want to add to the button area + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Adding a basic button to the toolbar
+local new_button =
+Gui.new_concept('button')
+:set_caption('Click Me')
+:on_click(function(event)
+    event.player.print('You Clicked Me!!')
+end)
+
+Toolbar.add_button_concept(new_button)
+ + +
+
+
+
+ # + update_buttons(player) +
+
+
+
+ +

Updates all the buttons for a player, this means hide and show buttons based on permissions

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to update the toolbar buttons for + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Updating your toolbar
+Toolbar.update_buttons(player)
+ + +
+
+
+
+ # + get_visible_buttons(player) +
+
+
+
+ +

Returns an array of buttons names that the given player is able to see, returns none if toolbar hidden

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player you want to get the visible buttons of + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + an array of names of the visible buttons +
  • +
+ + + + + + + + Usage: +
-- Get a list of all your visible buttons
+Toolbar.get_visible_buttons(game.player)
+ + +
+
+
+
+ # + toolbar-button +
+
+
+
+ +

The base element to be used with the toolbar, others can be used but this is recomented

+

+ + + Properties / Events: + +
    + + + + + +
  • + + permission_alias + + : + + (string) + + the alias used with Toolbar.allowed + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Adding a basic button to the toolbar, note no need to call Toolbar.add_button_concept
+Gui.new_concept('toolbar-button')
+:set_caption('Click Me')
+:on_click(function(event)
+    event.player.print('You Clicked Me!!')
+end)
+ + +
+
+

Frames

+
+
+
+
+ # + add_frame_concept(concept) +
+
+
+
+ +

Adds a frame concept to the toolbar frame area, this will not add a button to the toolbar

+

+ + + Parameters: + +
    + + + + + +
  • + + concept + + : + + (table) + + the gui concept that you want to add to the toolbar frame area + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Adding a basic frame to the frame area
+local new_frame =
+Gui.new_concept('frame')
+:set_title('Test')
+
+Toolbar.add_frame_concept(new_frame)
+ + +
+
+
+
+ # + hide_frames(player) +
+
+
+
+ +

Hides all the frames for a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to hide the frames for + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Hiding all your frames
+Toolbar.hide_frames(game.player)
+ + +
+
+
+
+ # + get_visible_frames(player) +
+
+
+
+ +

Gets an array of the names of all the visible frames for a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that you want to get the visible frames of + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + an array of names of the visible frames for the given player +
  • +
+ + + + + + + + Usage: +
-- Get all your visible frames
+Toolbar.get_visible_frames(game.player)
+ + +
+
+
+
+ # + toolbar-frame +
+
+
+
+ +

The base toolbar frame, others can be used but this is recomented

+

+ + + Properties / Events: + +
    + + + + + +
  • + + on_update + + : + + + fired when the frame is to have its content updated + +
  • + + + + + +
  • + + open_by_default + + : + + (boolean) + + weather the frame should be open when a player first joins + +
  • + + + + + +
  • + + use_container + + : + + (boolean) + + true by default and will place a container inside the frame for content + +
  • + + + + + +
  • + + direction + + : + + (string) + + the direction that the items in the frame are added + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Adding a basic player list
+local player_list =
+Gui.new_concept('toolbar-frame')
+:set_permission_alias('player_list')
+:set_caption('Player List')
+:toggle_with_click()
+
+:define_draw(function(properties,parent,element)
+    local list_area =
+    element.add{
+        name = 'scroll',
+        type = 'scroll-pane',
+        direction = 'vertical',
+        horizontal_scroll_policy = 'never',
+        vertical_scroll_policy = 'auto-and-reserve-space'
+    }
+    Gui.set_padding(list_area,1,1,2,2)
+    list_area.style.horizontally_stretchable = true
+    list_area.style.maximal_height = 200
+
+    for _,player in pairs(game.connected_players) do
+        list_area.add{
+            type='label',
+            caption=player.name
+        }
+    end
+end)
+
+:on_update(function(event)
+    local list_area = event.element.scroll
+    list_area.clear()
+
+    for _,player in pairs(game.connected_players) do
+        list_area.add{
+            type='label',
+            caption=player.name
+        }
+    end
+end)
+ + +
+
+
+
+ # + Toolbar.frame:get_content(player) +
+
+
+
+ +

Gets the content area of the frame concept for this player, each player only has one area

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that you want to get the frame content for + +
  • + + +
+ + + + + Returns: +
    +
  • + (LuaGuiElement) + the content area of this concept for this player +
  • +
+ + + + + + + + Usage: +
-- Get the content area of a concept
+local frame = player_list:get_content(game.player)
+ + +
+
+
+
+ # + Toolbar.frame:toggle_visible_state(player) +
+
+
+
+ +

Toggles the visibilty of this concept for the given player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that you want to toggle the frame for + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + the new state of the visibilty of this concept for the player +
  • +
+ + + + + + + + Usage: +
-- Toggle the frame for your self
+player_list:toggle_visible_state(game.player)
+ + +
+
+
+
+ # + Toolbar.frame:get_visible_state(player) +
+
+
+
+ +

Gets the current visibilty state of this conept for this player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that you want the visibilty state for + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + the current visiblity state of this concept to the player +
  • +
+ + + + + + + + Usage: +
-- Getting the current visiblity state
+ + +
+
+
+
+ # + Toolbar.frame:update(player[, event]) +
+
+
+
+ +

Triggers an update of the content within the concept for this player, uses on_update handlers

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to update the concept content for + +
  • + + + + + +
  • + + event + + : + + (table) + + the event data that you want to pass to the update handlers + + (optional) +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Updating the frame for your player
+player_list:update(game.player)
+ + +
+
+
+
+ # + Toolbar.frame:update_all([event]) +
+
+
+
+ +

Triggers an update of the content with in this frame for all players

+

+ + + Parameters: + +
    + + + + + +
  • + + event + + : + + (table) + + the event data that you want to pass to the update handlers + + (optional) +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Update the grame for all players
+player_list:update_all()
+ + +
+
+

Other Elements

+
+
+
+
+ # + toolbar +
+
+
+
+ +

The main toolbar element, draws, updates, and controls the other concepts

+

+ + + Properties / Events: + +
    + + + + + +
  • + + on_button_update + + : + + + fired when the buttons are updated for a player + +
  • + + + + + +
  • + + on_hide_frames + + : + + + fired when the frames are hidden for a player + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + toolbar-toggle +
+
+
+
+ +

Button which toggles the the visible state of all toolbar buttons, triggers on_button_update

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + toolbar-clear +
+
+
+
+ +

Button which hides all visible toolbar frames, triggers on_hide_frames

+

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html new file mode 100644 index 00000000..da3e4e7f --- /dev/null +++ b/docs/guis/Player-List.html @@ -0,0 +1,634 @@ + + + + + + + + Player-List gui + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Player-List gui

+

Gui Module - Player List + - Adds a player list to show names and play time; also includes action buttons which can apply to players

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui
expcore.roles
expcore.store
utils.game
utils.event
expcore.common
config.action_buttons
resources.color_presets
+ + +

Elements

+ + + + + + + + + + + + + + + + + + + + +
open_action_barButton used to open the action bar
close_action_barButton used to close the action bar
reason_confirmButton used to confirm a reason
player_listRegisters the player list
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.store +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.action_buttons +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Elements

+
+
+
+
+ # + open_action_bar +
+
+
+
+ +

Button used to open the action bar

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + close_action_bar +
+
+
+
+ +

Button used to close the action bar

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + reason_confirm +
+
+
+
+ +

Button used to confirm a reason

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + player_list +
+
+
+
+ +

Registers the player list

+

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html new file mode 100644 index 00000000..cd01fbd5 --- /dev/null +++ b/docs/guis/Rocket-Info.html @@ -0,0 +1,637 @@ + + + + + + + + Rocket-Info gui + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Rocket-Info gui

+

Gui Module - Rocket Info + - Adds a rocket infomation gui which shows general stats, milestones and build progress of rockets

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui
expcore.roles
utils.event
config.rockets
expcore.common
resources.color_presets
modules.control.rockets
+ + +

Elements

+ + + + + + + + + + + + + + + + + + + + + + + + +
zoom_to_mapUsed on the name label to allow zoom to map
launch_rocketUsed to launch the rocket, when it is ready
toggle_rocketUsed to toggle the auto launch on a rocket
toggle_sectionUsed to toggle the visibility of the different sections
rocket_infoRegisters the rocket info
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.rockets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.rockets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Elements

+
+
+
+
+ # + zoom_to_map +
+
+
+
+ +

Used on the name label to allow zoom to map

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + launch_rocket +
+
+
+
+ +

Used to launch the rocket, when it is ready

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + toggle_rocket +
+
+
+
+ +

Used to toggle the auto launch on a rocket

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + toggle_section +
+
+
+
+ +

Used to toggle the visibility of the different sections

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + rocket_info +
+
+
+
+ +

Registers the rocket info

+

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html new file mode 100644 index 00000000..7a48f8dc --- /dev/null +++ b/docs/guis/Science-Info.html @@ -0,0 +1,457 @@ + + + + + + + + Science-Info gui + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Science-Info gui

+

Gui Module - Science Info + - Adds a science info gui that shows production usage and net for the different science packs as well as an eta

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + +
expcore.gui
utils.event
expcore.common
config.science
modules.control.production
+ + +

Elements

+ + + + + + + + +
science_infoRegisters the science info
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.science +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.production +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Elements

+
+
+
+
+ # + science_info +
+
+
+
+ +

Registers the science info

+

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html new file mode 100644 index 00000000..44170d3b --- /dev/null +++ b/docs/guis/Task-List.html @@ -0,0 +1,640 @@ + + + + + + + + Task-List gui + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Task-List gui

+

Gui Module - Task List + - Adds a task list to the game which players can add remove and edit items on

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + +
expcore.gui
utils.event
expcore.roles
config.tasks
expcore.common
modules.control.tasks
+ + +

Elements

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
add_new_taskButton in the header to add a new task
confirm_editUsed to save changes to a task
cancel_editUsed to cancel any changes you made to a task
discard_taskRemoves the task from the list
edit_taskOpens edit mode for the task
task_listRegisters the task list
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.tasks +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.tasks +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Elements

+
+
+
+
+ # + add_new_task +
+
+
+
+ +

Button in the header to add a new task

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + confirm_edit +
+
+
+
+ +

Used to save changes to a task

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + cancel_edit +
+
+
+
+ +

Used to cancel any changes you made to a task

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + discard_task +
+
+
+
+ +

Removes the task from the list

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + edit_task +
+
+
+
+ +

Opens edit mode for the task

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + task_list +
+
+
+
+ +

Registers the task list

+

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html new file mode 100644 index 00000000..196ec539 --- /dev/null +++ b/docs/guis/Warps-List.html @@ -0,0 +1,845 @@ + + + + + + + + Warps-List gui + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Warps-List gui

+

Gui Module - Warp List + - Adds a warp list gui which allows players to add and remove warp points

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui
expcore.store
utils.global
utils.event
utils.game
expcore.roles
resources.color_presets
config.warps
expcore.common
modules.control.warps
+ + +

Elements

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
zoom_to_mapUsed on the name label to allow zoom to map
warp_timerThis timer controls when a player is able to warp, eg every 60 seconds
goto_warpWhen the button is clicked it will teleport the player
add_new_warpWill add a new warp to the list, checks if the player is too close to an existing one
confirm_editConfirms the edit to name or icon of the warp
cancel_editCancels the editing changes of the selected warp name or icon
discard_warpRemoves a warp from the list, including the physical area and map tag
edit_warpOpens edit mode for the warp
warp_listRegisters the warp list
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.store +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.warps +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.warps +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Elements

+
+
+
+
+ # + zoom_to_map +
+
+
+
+ +

Used on the name label to allow zoom to map

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + warp_timer +
+
+
+
+ +

This timer controls when a player is able to warp, eg every 60 seconds

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + goto_warp +
+
+
+
+ +

When the button is clicked it will teleport the player

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + add_new_warp +
+
+
+
+ +

Will add a new warp to the list, checks if the player is too close to an existing one

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + confirm_edit +
+
+
+
+ +

Confirms the edit to name or icon of the warp

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + cancel_edit +
+
+
+
+ +

Cancels the editing changes of the selected warp name or icon

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + discard_warp +
+
+
+
+ +

Removes a warp from the list, including the physical area and map tag

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + edit_warp +
+
+
+
+ +

Opens edit mode for the warp

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + warp_list +
+
+
+
+ +

Registers the warp list

+

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 00000000..4601a828 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,522 @@ + + + + + + + + ExpGaming Scenario + + + + + + + +
+
+ + + + + + + +
+ + +

Core

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CommandsCore Module - Commands + - Factorio command making module that makes commands with better parse and more modularity
Common-LibraryCore Module - Common Library + - Adds some commonly used functions used in many modules
GuiCore Module - Gui + - This file is used to require all the different elements of the gui module + - each module has an outline here but for more details see their separate files in ./gui + - please read the files for more documentation that cant be shown here + - please note there is a rework planned but not started
Permissions-GroupsCore Module - Permission Groups + - Permission group making for factorio so you never have to make one by hand again
RolesCore Module - Roles + - Factorio role system to manage custom permissions.
StoreCore Module - Store +- Used to store and watch for updates for values in the global table
SudoCore Module - Sudo + - An extention of task and token to allow a single require to register and run functions bypassing all permissions.
+

Control

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
JailControl Module - Jail + - Adds a way to jail players and temp ban players.
ProductionControl Module - Production + - Common functions used to track production of items
ReportsControl Module - Reports + - Adds a way to report players and store report messages.
RocketsControl Module - Rockets + - Stores rocket stats for each force.
TasksControl Module - Tasks +- Stores tasks for each force.
WarningsControl Module - Warnings + - Adds a way to give and remove warnings to players.
WarpsControl Module - Warps +- Stores warps for each force.
+

Addons

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Advanced-StartAdds a better method of player starting items based on production levels.
Chat-PopupsCreates flying text entities when a player sends a message in chat; + also displays a ping above users who are named in the message
Chat-ReplyAdds auto replies to chat messages; aswell as chat commands
CompilatronAdds a compilatron that walks around the spawn area; adapted from redmew code
Damage-PopupsDisplays the amount of dmg that is done by players to entities; + also shows player health when a player is attacked
Death-LoggerMakes markers on the map where places have died and reclaims items if not recovered
Discord-AlertsSends alert messages to our discord server when certain events are triggered
Pollution-GradingMakes polution look much nice of the map, ie not one big red mess
Player-ColoursGives players random colours when they join, also applies preset colours to those who have them
Scorched-EarthWhen a player walks around the tiles under them will degrade over time, the same is true when entites are built
Spawn-AreaAdds a custom spawn area with chests and afk turrets
+

Guis

+ + + + + + + + + + + + + + + + + + + + + +
Player-ListGui Module - Player List + - Adds a player list to show names and play time; also includes action buttons which can apply to players
Rocket-InfoGui Module - Rocket Info + - Adds a rocket infomation gui which shows general stats, milestones and build progress of rockets
Science-InfoGui Module - Science Info + - Adds a science info gui that shows production usage and net for the different science packs as well as an eta
Task-ListGui Module - Task List + - Adds a task list to the game which players can add remove and edit items on
Warps-ListGui Module - Warp List + - Adds a warp list gui which allows players to add and remove warp points
+

Commands

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Admin-ChatCommands Module - Admin Chat + - Adds a command that allows admins to talk in a private chat
BonusCommands Module - Bonus + - Adds a command that allows players to have increased stats
Cheat-ModeCommands Module - Cheat Mode + - Adds a command that allows players to enter cheat mode
Clear-InventoryCommands Module - Clear Inventory + - Adds a command that allows admins to clear people's inventorys
DebugCommands Module - Debug + - Adds a command that opens the debug frame
FindCommands Module - Find + - Adds a command that zooms in on the given player
HelpCommands Module - Help + - Adds a better help command that allows searching of descriotions and names
HomeCommands Module - Home + - Adds a command that allows setting and teleporting to your home position
InterfaceCommands Module - Interface + - Adds a command that acts as a direct link to the the active softmod, for debug use
JailCommands Module - Jail + - Adds a commands that allow admins to jail, unjail, and temp ban players
KillCommands Module - Kill + - Adds a command that allows players to kill them selfs and others
MeCommands Module - Me + - Adds a command that adds * around your message in the chat
RainbowCommands Module - Rainbow + - Adds a command that prints your message in rainbow font
RepairCommands Module - Repair + - Adds a command that allows an admin to repair and revive a large area
ReportsCommands Module - Reports + - Adds a commands that allow players to report other players
RolesCommands Module - Roles + - Adds a commands that allow interaction with the role system
SpawnCommands Module - Spawn + - Adds a command that allows players to teleport to their spawn point
TagCommands Module - Tag + - Adds a command that allows players to have a custom tag after their name
TeleportCommands Module - Teleport + - Adds a command that allows players to teleport to other players
WarningsCommands Module - Warnings + - Adds a commands that allow admins to warn other players
+

Configs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
File-LoaderThis contains a list of all files that will be loaded and the order they are loaded in; + to stop a file from loading add "--" in front of it, remove the "--" to have the file be loaded; + config files should be loaded after all modules are loaded; + core files should be required by modules and not be present in this list;
Player-ListConfig for the different action buttons that show on the player list; + each button has the button define(s) given along side an auth function, and optional reason callback; + if a reason callback is used then Store.set(action_name_store,player.name,'BUTTON_NAME') should be called during on_click; + buttons can be removed from the gui by commenting them out of the config at the bottom of this file; + the key used for the name of the button is the permission name used by the role system;
Advanced-StartThis file is used to setup the map starting settings and the items players will start with
BonusesLists all bonuses which can be used, name followed by min max
Chat-ReplyThis file defines the different triggers for the chat bot
CompilatronConfig file for the compliatrons including where they spawn and what messages they show
Death-LoggerThis config controls what happens when a player dies mostly about map markers and item collection; + allow_teleport_to_body_command and allow_collect_bodies_command can be over ridden if command_auth_runtime_disable is present; + if not present then the commands will not be loaded into the game
Discord-AlertsConfig file used to enable and disable different push messages for discord
Commands-Auth-AdminThis is a very simple config file which adds a admin only auth functio; + not much to change here its more so it can be enabled and disabled from ./config/file_loader.lua; + either way you can change the requirements to be "admin" if you wanted to
Commands-Auth-RolesThis will make commands only work if the role has been allowed it in the role config
Commands-Auth-Runtime-DisableThis config for command auth allows commands to be globally enabled and disabled during runtime; + this config adds Commands.disable and Commands.enable to enable and disable commands for all users
Commands-ParseThis file contains some common command param parse functions; +this file is less of a config and more of a requirement but you may wish to change how some behave; +as such you need to be confident with lua but you edit this config file; +use Commands.add_parse('name',function(input,player,reject) end) to add a parse; +see ./expcore/commands.lua for more details
Commands-Parse-RolesAdds some parse functions that can be used with the role system
Permission-GroupsUse this file to add new permission groups to the game; + start with Permission_Groups.new_group('name'); + then use either :allow_all() or :disallow_all() to set the default for non specified actions; + then use :allow{} and :disallow{} to specify certain actions to allow/disallow
Pollution-GradingThis controls how pollution is viewed on the map
Popup-MessagesA combination of config settings for different popup values like chat and damage
Preset-Player-ColoursPreset colours that players get when they join the server, if not in the list then will be given a random colour (which isnt disallowed)
RepairConfig file for the repair command
RocketsThis file controls what will show in each section of the rocket info gui
RolesThis is the main config file for the role system; file includes defines for roles and role flags and default values
ScienceConfig file for the science info gui
Scorched-EarthThis file controls the placement/degrading of tiles as players build and walk
Spawn-AreaUsed to config the spawn generation settings yes there is alot here i know just ignore the long tables at the end (they were generated with a command)
TasksConfig file for the tasks gui
WarningsConfig file for the warning system, this is very similar to reports but is for the use of moderators rather than normal users.
WarpsThis file contains all the different settings for the warp system and gui
+

Modules

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
controlPlease go to ./config if you want to change settings, each file is commented with what it does + if it is not in ./config then you should not attempt to change it unless you know what you are doing + all files which are loaded (including the config files) are present in ./config/file_loader.lua + this file is the landing point for all scenarios please DO NOT edit directly, further comments are to aid development
utils.alien_evolution_progressinfo + Original (javascript) version: https://hastebin.com/udakacavap.js + Can be tested against: https://wiki.factorio.com/Enemies#Spawn_chances_by_evolution_factor
utils.coreThis file contains core utilities used by the redmew scenario.
utils.debug
utils.dump_envA small debugging tool that writes the contents of _ENV to a file when the game loads.
utils.eventThis Module allows for registering multiple handlers to the same event, overcoming the limitation of script.register.
utils.event_coreDo not use this function, use Event.add instead as it has safety checks.
utils.mathTakes two points and calculates the slope of a line
utils.recipe_lockerA module to prevent recipes from being unlocked by research.
utils.state_machineThis module provides a classical mealy/moore state machine.
utils.tableSearches a table to remove a specific element without an index
utils.taskThreading simulation module + Task.sleep()
utils.timestampsource https://github.com/daurnimator/luatz/blob/master/luatz/timetable.lua + edited down to just what is needed.
+

Topics

+ + + + + + + +
readme.md
license
+ + + + + + +
+
+
+ + + + diff --git a/docs/ldoc.css b/docs/ldoc.css new file mode 100644 index 00000000..809ab237 --- /dev/null +++ b/docs/ldoc.css @@ -0,0 +1,244 @@ +/* universal */ + +body{background-color:#0F0F0F;color:#C8C8C8;font-family:'Lucida Grande',Arial,sans-serif} +a{text-decoration:none;border-style:none;outline:none!important} +a:link{color:#FF7200;text-decoration:none} +a:visited{color:#FF7200;text-decoration:none} +a:hover{color:#C8C8C8;text-decoration:none} +a:active{color:#C8C8C8;text-decoration:none} +h1{font-size:2.5rem} +h2{font-size:2.3rem} +h3{font-size:2rem} +h4{font-size:1.8rem} +h5{font-size:1.6rem} + + +/* table */ + +table,thead{text-align:left} +table,th,td{padding:2px} + + +/* sidebar */ + +.sidebar {height: 100%} + +.sidebar-custom { + border-right: 1px solid #2C2C2C; + padding-right: 1.4rem; + bottom: 0rem; +} + +@supports (-ms-ime-align:auto) { + .sidebar-custom { + height: 99%; + } +} + +.up-to-top { + top: 1.5rem; + position: -webkit-sticky; + position: sticky; + text-align: right; + margin-right: 0.2rem; +} + +.up-to-top a{padding:20px} +.up-to-top a:link{color:#FF7200} +.up-to-top a:hover{color:#C8C8C8} +.icon-arrow-right-custom{margin-bottom:3px} +.project-infobox{text-align:right} +.project-infobox .project-desc{font-style:italic} +.nav-modules{text-align:right} +.nav-module-contents{text-align:right} + + +/* navigation */ + +.nav .nav a{color:#FF7200} +.nav .nav a:link{color:#FF7200} +.nav .nav a:visited{color:#FF7200} +.nav .nav a:hover{color:#C8C8C8;text-decoration:none} +.nav .nav-item.active>a:hover{color:#C8C8C8;text-decoration:none} +.nav .nav-item.active{margin-left:0} +.nav .nav a:active{color:#C8C8C8} + + +/* main page module list */ + +.body-module-name {font-weight: 500} + +table.module_list { + border-spacing: 0; + display: table; + border-collapse: collapse; + margin-bottom: 2.0rem; +} + +table.module_list td { + border-top: 1px solid #2C2C2C; + border-bottom: 1px solid #2C2C2C; + padding: 3px 7px 3px 7px; +} + +table.module_list td.name { + vertical-align: top; + min-width: 125px; + background-color: #0D0D0D; +} + +table.module_list td.summary {vertical-align: top} + +.module_list p {margin:0px} + +/* section */ + +.module-see-also li { + margin-top: 0.5rem; +} + +.section-title a:link{color:#C8C8C8} +.section-title a:visited{color:#C8C8C8} +.section-title a:hover{color:#FF7200} +.section-title a:active{color:#FF7200} + +.section-body-container dd { + margin: 1.0rem 0 1.5rem 0; +} + +table.section-content-list { + border-spacing: 0; + display: table; + border-collapse: collapse; + margin-bottom: 1.5rem; +} + +table.section-content-list td { + border-top: 1px solid #2C2C2C; + border-bottom: 1px solid #2C2C2C; + padding: 3px 7px 3px 7px; +} + +table.section-content-list td.name { + background-color: #0D0D0D; + vertical-align: top; + white-space: nowrap; +} + +table.section-content-list td.summary { + min-width: 200px; + vertical-align: top; +} + +.section-content-list p {margin: 0px} + +div.section-item-header .section-item-title { + font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-size: 1.5rem; + margin-left: 3px; +} + +.section-title:target { + padding-left: 7px; + border-left: 5px solid #FF7200; + text-decoration: none; +} + +.section-item-title:target { + padding: 3px 5px 3px 5px; + background-color: #FF7200; + color: #000000; + text-decoration: none; +} + +.section-item-body {margin-left: 4rem} + +/*.section-subitem-li { + padding-left: 1.28571429em; + text-indent: -1.28571429em; +}*/ + +/*.section-subitem-module-field-li { + margin-left: -1.28571429em; + padding-left: 1.28571429em; + text-indent: -1.28571429em; +}*/ + +/* example pages */ + +pre.code.example{margin:0 0 1em} +pre.code.example code h2{display:none} +pre.code.example code pre{margin:0} + + +/* usage code */ + +code{background-color:#181818;color:#C8C8C8;font-size:1.3rem} +pre.code code{background-color:#282828;color:#C8C8C8;font-size:1.3rem} +pre.code .comment{color:#998d70} +pre.code .constant{color:#a8660d} +pre.code .escape{color:#844631} +pre.code .keyword{color:#c43724;font-weight:700} +pre.code .library{color:#0e7c6b} +pre.code .marker{color:#512b1e;background:#fedc56;font-weight:700} +pre.code .string{color:#99ca3c} +pre.code .number{color:#f8660d} +pre.code .operator{color:#2239a8;font-weight:700} +pre.code .preprocessor,pre .prepro{color:#a33243} +pre.code .global{color:#5798da} +pre.code .user-keyword{color:purple} +pre.code .prompt{color:#998d70} +pre.code .url{color:#272fc2;text-decoration:underline} + + +/* footer */ + +.footer{height:65px} +.sidebar-footer{text-align:left;padding-right:33px} +.content-footer{text-align:right} + + +/* misc */ + +.types {font-weight:bold;font-style:italic} + +.divider[data-content]::after,.divider-vert[data-content]::after{background:#262626;color:#C8C8C8} +.divider-custom{border-width:1px;border-color:#585959} + + +/* fragment hashtag */ + +.fragment-hashtag{color:#3C3C3C} +a.fragment-hashtag{color:#3C3C3C} +a.fragment-hashtag:hover{color:#FF7200} + + +/* mobile */ + +@media screen and (max-width: 540px) { + .up-to-top {display: none} + .sidebar-custom { + border-right: 1px solid #2C2C2C; + padding-right: 1.4rem; + bottom: 0rem; + margin-right: 0px; + } + .sidebar-footer { + text-align: right; + padding-right: 10px; + white-space: nowrap; + } + table.function_list td.name { + background-color: #0D0D0D; + vertical-align: top; + white-space: normal; + } + .function-item-spec-body-wrap {margin-left: 1.5rem} +} + + +/* tablets */ + +@media screen and (min-width: 540px) and (max-width: 780px) { + .sidebar-footer {white-space: nowrap} +} diff --git a/docs/ldoc.ltp b/docs/ldoc.ltp new file mode 100644 index 00000000..539ab547 --- /dev/null +++ b/docs/ldoc.ltp @@ -0,0 +1,416 @@ +> local iter = ldoc.modules.iter +> local M = ldoc.markup +> local use_li = ldoc.use_li +> local no_spaces = ldoc.no_spaces +> local display_name = ldoc.display_name + +> local function remove_parent_obj(obj) +> obj = obj:gsub(">Concepts%.(.*)<", ">%1<"):gsub(">Common%.(.*)<", ">%1<") +> obj = obj:gsub(">{Concepts%.(.*)}<", ">{%1}<"):gsub(">{Common%.(.*)}<", ">{%1}<") +> return obj +> end + + + + + + +> if module then + $(module.name) $(module.type) +> else + $(ldoc.title) +> end + +> if module then + + +> else + + +> end + + + + +
+
+ + + + + + + +
+ + +> if not module then +> for kind, mods in ldoc.kinds() do +

$(kind)

+> kind = kind:lower() + +> for m in mods() do + + +> if M(ldoc.strip_header(m.summary),m) ~= "" then + +> end + +> end -- for modules +
$(m.name)$(M(ldoc.strip_header(m.summary),m))
+> end -- for kinds +> end + + + +> if module then + + + +

$(module.name) $(module.type)

+

$(M(module.summary))

+

$(M(module.description))

+ +> if ldoc.body and module.type == "example" then +
$(ldoc.body:gsub("^

(.*%.lua)

(.*)$", "%2"):gsub("
(.*)
", "%1"):gsub("^%s*(.-)%s*$", "%1"))
+> elseif ldoc.body and module.type == "topic" then + $(M(ldoc.body)) +> end + + +> if module.info then +
    +> for tag, value in module.info:iter() do +
  • $(tag): $(M(value,module))
  • +> end +
+> end + + + +> if module.see then +

See also

+ +> end +> if module.usage then +

Usage

+> for usage in iter(module.usage) do +
$(ldoc.prettify(usage))
+> end +> end + + + + + +> if module and module.type ~= "topic" then +> for kind, items in module.kinds() do + + +

$(kind)

+ $(M(module.kinds:get_section_description(kind))) + + +> for item in items() do + + +> if item.summary ~= "" then + +> end + +> end + +
$(display_name(item))$(M(item.summary,item))
+> end +> end + + +
+ + +> if module and module.type ~= "topic" then +> for kind, items in module.kinds() do +

$(kind)

+
+> for item in items() do +
+
+
+ # + $(display_name(item)) +
+
+
+
+ +> if item.summary ~= "" or item.description ~= "" then +

$(M(item.summary))

+

$(M(item.description))

+> end + + +> if not ldoc.no_return_or_parms and item.params and #item.params > 0 then +> local module_item_subnames = module.kinds:type_of(item).subnames +> if module_item_subnames then + $(module_item_subnames): +> end + +
    + +> for param in iter(item.params) do +> local param, sublist = item:subparam(param) + +> if sublist then +
  • + $(sublist) : $(M(item.params.map[sublist], item)) +
      +> end + +> for p in iter(param) do + +> local name, tp, def = item:display_name_of(p), ldoc.typename(item:type_of_param(p)), item:default_of_param(p) + +> if not module_item_subnames then +
    • +> else +
    • +> end + + $(name) + +> if tp ~= "" or item.params.map[p] ~= "" then + : +> end + +> if tp ~= "" then + ($(remove_parent_obj(tp))) +> end + + $(remove_parent_obj(M(item.params.map[p], item))) + +> if def == true then + (optional) +> elseif def then + (default: $(def)) +> end +> if item:readonly(p) then + (readonly) +> end +
    • +> end + +> if sublist then +
    +
  • +> end +> end + +
+ +> end + + + +> if item.retgroups then +> local groups = item.retgroups + Returns: +> for i, group in ldoc.ipairs(groups) do +
    +> for r in group:iter() do +> local type, ctypes = item:return_type(r) +> local rt = ldoc.typename(type) +
  • +> if rt ~= '' then + ($(remove_parent_obj(rt))) +> end +> if r.text ~= '' then + $(remove_parent_obj(M(r.text, item))) +> end +> if ctypes then +
      +> for c in ctypes:iter() do +
    • + $(c.name) + ($(ldoc.typename(c.type))) + : $(M(c.comment, item)) +
    • +> end +
    +> end +
  • +> end +
+> if i < #groups then +
Or
+> end +> end +> end + + +> if item.raise then +
Raises
$(M(item.raise, item)) +> end + + +> if item.see then + See also: + +> end + + + +> if item.usage then + Usage: +> for usage in iter(item.usage) do +
$(ldoc.prettify(usage))
+> end +> end + + +
+> end +
+> end +> else + +
+> end +> end + + + +
+
+ + + + + diff --git a/docs/modules/ExpStyle.html b/docs/modules/ExpStyle.html new file mode 100644 index 00000000..fede875a --- /dev/null +++ b/docs/modules/ExpStyle.html @@ -0,0 +1,1343 @@ + + + + + + + + ExpStyle module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

ExpStyle module

+

Core Module - ExpStyle

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui
gui.concept.frame
expcore.gui
gui.concept.frame
expcore.gui
gui.concept.table
expcore.gui
gui.concept.table
expcore.gui
gui.concept.table
gui.concept.scroll
expcore.gui
expcore.common
expcore.gui
gui.concept.table
expcore.gui
gui.concept.frame
+ + +

Elements

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
containerA container frame that can be used to add a boader around your content
data_labelA label pair which has a static label and a data label which can be changed
footerA frame that acts as a footer to a section of content
headerA frame that acts as a header to a section of content
scroll_tableA table that is inside a vertical scroll area
time_labelA label that show time in a nice, user friendly way
toggle_buttonA button that will toggle its caption each time it is pressed
unit_labelA label triplet which has a static label, a data label which can be changed, and a unit label
+ + +

Functions

+ + + + + + + + +
time_label:update_time(element, time)Updates the time that is on a label
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.frame +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.frame +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.table +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.table +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.table +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.scroll +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.table +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.frame +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Elements

+
+
+
+
+ # + container +
+
+
+
+ +

A container frame that can be used to add a boader around your content

+

+ + + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [container] - the outer frame
+-->> container - the content area
+Gui.new_concept('container')
+ + +
+
+
+
+ # + data_label +
+
+
+
+ +

A label pair which has a static label and a data label which can be changed

+

+ + + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [data_label] - the static label
+--> [properties.data_name] - the data label which can be updated
+Gui.new_concept('data_label')
+:set_data_label_name('game_ticks')
+:set_data_caption('0')
+:set_data_format(function(concept,element,data,...)
+    -- This is used with update_data_element and update_from_parent
+    local caption = tostirng('data')
+    local tooltip = 'This game has beeing running for: '..caption..' ticks'
+    return caption, tooltip
+end)
+ + +
+
+
+
+ # + footer +
+
+
+
+ +

A frame that acts as a footer to a section of content

+

+ + + Properties / Events: + +
    + + + + + +
  • + + tooltip + + : + + (string) + + the tooltip to show on the title + +
  • + + +
+ + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [footer] - the footer frame
+-->> footer_caption - the lable with the title in it
+-->> footer_content - the area to contain butons
+Gui.new_concept('footer')
+:set_title('Example Footer')
+ + +
+
+
+
+ # + header +
+
+
+
+ +

A frame that acts as a header to a section of content

+

+ + + Properties / Events: + +
    + + + + + +
  • + + tooltip + + : + + (string) + + the tooltip to show on the title + +
  • + + +
+ + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [header] - the header frame
+-->> header_caption - the lable with the title in it
+-->> header_content - the area to contain butons
+Gui.new_concept('header')
+:set_title('Example Header')
+ + +
+
+
+
+ # + scroll_table +
+
+
+
+ +

A table that is inside a vertical scroll area

+

+ + + Properties / Events: + +
    + + + + + +
  • + + hight + + : + + (number) + + the max hight of the scroll area + +
  • + + +
+ + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [scroll_table] - the scroll area
+-->> table - the table area
+Gui.new_concept('scroll_table')
+:set_height(200)
+:set_column_count(2)
+ + +
+
+
+
+ # + time_label +
+
+
+
+ +

A label that show time in a nice, user friendly way

+

+ + + Properties / Events: + +
    + + + + + +
  • + + time + + : + + (number) + + the time to display in tick + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [time_label] - the label with the time
+local time_label =
+Gui.new_concept('time_label')
+:set_use_hours(true)
+:set_time(game.tick)
+
+time_label:update_time(element,game.tick)
+ + +
+
+
+
+ # + toggle_button +
+
+
+
+ +

A button that will toggle its caption each time it is pressed

+

+ + + Properties / Events: + +
    + + + + + +
  • + + alt_caption + + : + + (string) + + the caption to show on the button in its true state + +
  • + + + + + +
  • + + alt_tooltip + + : + + (string) + + the tooltip to show on the button in its true state + +
  • + + +
+ + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [toggle_button] - the header button
+Gui.new_concept('toggle_button')
+:set_caption('<')
+:set_tooltip('Press to close.')
+:set_alt_caption('>')
+:set_alt_tooltip('Press to open.')
+:on_click(function(event)
+    local state = event.state and 'close' or 'open'
+    event.player.print('Toggle button is now: '..state)
+end)
+ + +
+
+
+
+ # + unit_label +
+
+
+
+ +

A label triplet which has a static label, a data label which can be changed, and a unit label

+

+ + + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [unit_label] - the static label
+--> [properties.data_name] - the data label which can be updated
+--> [properties.data_name..'_unit'] - the data label unit which can be updated
+Gui.new_concept('unit_label')
+:set_data_label_name('game_ticks')
+:set_data_caption('0')
+:set_data_unit('ticks')
+:set_data_format(function(concept,element,data,...)
+    -- This is used with update_data_element and update_from_parent
+    local caption = tostirng(data)
+    local unit = data > 1 and 'ticks' or 'tick'
+    local tooltip = 'This game has beeing running for: '..caption..' ticks'
+    return caption, unit, tooltip
+end)
+ + +
+
+

Functions

+
+
+
+
+ # + time_label:update_time(element, time) +
+
+
+
+ +

Updates the time that is on a label

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the label that you want to update + +
  • + + + + + +
  • + + time + + : + + (number) + + the number of tick you want it to show + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Update the time to show game time
+time_label:update_time(element,game.time)
+ + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/Gui.html b/docs/modules/Gui.html new file mode 100644 index 00000000..7f2d9a40 --- /dev/null +++ b/docs/modules/Gui.html @@ -0,0 +1,396 @@ + + + + + + + + Gui module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Gui module

+

Core Module - Gui

+

+ + + + + + + + + + + + + +

Functions

+ + + + + + + + + + + + +
on_custom_event(handler)Adds a custom event handler, replace with the name of the event
set_custom_property(value)Sets a new value for a property, triggers setter method if provided, replace with property name
+ + +
+ + +

Functions

+
+
+
+
+ # + on_custom_event(handler) +
+
+
+
+ +

Adds a custom event handler, replace with the name of the event

+

+ + + Parameters: + +
    + + + + + +
  • + + handler + + : + + (function) + + the function which will recive the event + +
  • + + +
+ + + + + Returns: +
    +
  • + (GuiConcept) + to allow chaing of functions +[[@usage +
  • +
+ + + + + + + + + +
+
+
+
+ # + set_custom_property(value) +
+
+
+
+ +

Sets a new value for a property, triggers setter method if provided, replace with property name

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + (any) + + the value that you want to set for this property + +
  • + + +
+ + + + + Returns: +
    +
  • + (GuiConcept) + to allow chaing of functions +[[@usage +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/Jail.html b/docs/modules/Jail.html new file mode 100644 index 00000000..a03abf37 --- /dev/null +++ b/docs/modules/Jail.html @@ -0,0 +1,1169 @@ + + + + + + + + Jail module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Jail module

+

Control Module - Jail + - Adds a way to jail players and temp ban players.

+

+ + + + + + +

Usage

+

+    -- import the module from the control modules
+    local Jail = require '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
+    Jail.jail_player('MrBiter','Cooldude2606','Likes biters too much')
+
+    -- This will give 'MrBiter' all his roles back and remove him from jail
+    -- again as above the player name is only used in the event for user feedback
+    Jail.unjail_player('MrBiter','Cooldude2606')
+
+    -- Temp ban works the same as jail but will store the reason and move the players items to spawn
+    -- this is meant to be used as a more permiment jail but not as strong as a ban
+    Jail.temp_ban_player('MrBiter','Cooldude2606','Likes biters too much')
+ + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + +
expcore.rolesAllows moving players into the jail role
utils.gameAllows accessing a player from any value
utils.globalAllows storing data in the global table
expcore.commonUse of move_items to clear inventroies
+ + +

Events

+ + + + + + + + + + + + + + + + + + + + +
on_player_jailedWhen a player is assigned to jail
on_player_unjailedWhen a player is unassigned from jail
on_player_temp_bannedWhen a player is temp banned
on_player_untemp_bannedWhen a temp ban is removed from a player
+ + +

Jail functions

+ + + + + + + + + + + + + + + + +
is_jailed (player)Checks if the player is currently in jail
jail_player (player, by_player_name[, reason='Non given.'])Moves a player to jail and removes all other roles
unjail_player (player, by_player_name)Moves a player out of jail and restores all roles previously removed
+ + +

Temp ban functions

+ + + + + + + + + + + + + + + + +
is_temp_banned (player)Checks if a player is temp banned
temp_ban_player (player, by_player_name[, reason='Non given.'])Temp bans a player by moving them to jail, clearing all other roles, storing the reason, and moving their items to spawn
untemp_ban_player (player, by_player_name)Rrmoves a player from temp ban by clearing the stored reason, removing them from jail, and restoring previous roles
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.roles +
+
+
+
+ +

Allows moving players into the jail role

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ +

Allows accessing a player from any value

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ +

Allows storing data in the global table

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ +

Use of move_items to clear inventroies

+

+ + + + + + + + + + + + + + +
+
+

Events

+
+
+
+
+ # + on_player_jailed +
+
+
+
+ +

When a player is assigned to jail

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who was jailed + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who jailed the other player + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player was jailed + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_player_unjailed +
+
+
+
+ +

When a player is unassigned from jail

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who was unjailed + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who unjailed the other player + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_player_temp_banned +
+
+
+
+ +

When a player is temp banned

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who was temp banned + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who temp banned the other player + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player was temp banned + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_player_untemp_banned +
+
+
+
+ +

When a temp ban is removed from a player

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who was untemp banned + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who untemp banned the other player + +
  • + + +
+ + + + + + + + + + + + + +
+
+

Jail functions

+
+
+
+
+ # + is_jailed (player) +
+
+
+
+ +

Checks if the player is currently in jail

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to check if they are in jail + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the player is currently in jail +
  • +
+ + + + + + + + + +
+
+
+
+ # + jail_player (player, by_player_name[, reason='Non given.']) +
+
+
+
+ +

Moves a player to jail and removes all other roles

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player who will be jailed + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who is doing the jailing + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player is being jailed + + (default: 'Non given.') +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + wheather the user was jailed successfully +
  • +
+ + + + + + + + + +
+
+
+
+ # + unjail_player (player, by_player_name) +
+
+
+
+ +

Moves a player out of jail and restores all roles previously removed

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will be unjailed + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player that is doing the unjail + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the player was unjailed successfully +
  • +
+ + + + + + + + + +
+
+

Temp ban functions

+
+
+
+
+ # + is_temp_banned (player) +
+
+
+
+ +

Checks if a player is temp banned

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to check if they are temp banned + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the player is temp banned +
  • +
+ + + + + + + + + +
+
+
+
+ # + temp_ban_player (player, by_player_name[, reason='Non given.']) +
+
+
+
+ +

Temp bans a player by moving them to jail, clearing all other roles, storing the reason, and moving their items to spawn

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will be temp banned + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who is doing the temp ban + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player is being temp banned + + (default: 'Non given.') +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the player was successfully temp banned +
  • +
+ + + + + + + + + +
+
+
+
+ # + untemp_ban_player (player, by_player_name) +
+
+
+
+ +

Rrmoves a player from temp ban by clearing the stored reason, removing them from jail, and restoring previous roles

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player who is being removed from temp ban + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who is doing the untemp ban + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the player was successfully removed +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/Production.html b/docs/modules/Production.html new file mode 100644 index 00000000..ca9dbceb --- /dev/null +++ b/docs/modules/Production.html @@ -0,0 +1,1281 @@ + + + + + + + + Production module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Production module

+

Control Module - Production + - Common functions used to track production of items

+

+ + + + + + +

Usage

+

+    -- import the module from the control modules
+    local Production = require '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
+    -- the other precision work like wise
+    Production.precision_up(defines.flow_precision_index.one_second)
+
+    -- The get production function is used to get production, consumion and net
+    -- it may be used for any item and with any precision level, use total for total
+    Production.get_production(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute)
+
+    -- The fluctuations works by compearing recent production with the average over time
+    -- again any precision may be used, apart from one_thousand_hours as there would be no valid average
+    Production.get_fluctuations(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute)
+
+    -- ETA is calculated based on what function you use but all share a similar method
+    -- for production eta it will take current production average given by the precision
+    -- and work out how many ticks it will require to make the required amount (1000 by default)
+    Production.get_production_eta(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute,250000)
+
+    -- Both get_color and format_number are helper functions to help format production stats
+    -- get_color will return green,orange,red,or grey based on the active_value
+    -- the passive_value is used when active_value is 0 and can only return orange,red,or grey
+    Production.get_color(clamp,active_value,passive_value)
+ + + + + + + +

Dependencies

+ + + + + + + + + + + + +
resources.color_presetsProvides colors for Production.get_color
utilProvides format_number function to add surfixs
+ + +

Precision

+ + + + + + + + + + + + + + + + +
precision_up (precision)Gets the next lesser precision index value, eg 1 second -> 1 minute
precision_down (precision)Gets the next greater precision index value, eg 1 minute -> 1 second
precision_ticks (precision)Gets the number of tick that precision is given over, eg 1 minute -> 60 ticks
+ + +

Stats

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
get_production_total (force, item_name)Returns the production data for the whole game time
get_production (force, item_name, precision)Returns the production data for the given precision game time
get_fluctuations (force, item_name, precision)Returns the current fluctuation from the average
get_production_eta (force, item_name, precision[, required=1000])Returns the amount of ticks required to produce a certain amount
get_consumsion_eta (force, item_name, precision[, required=1000])Returns the amount of ticks required to consume a certain amount
get_net_eta (force, item_name, precision[, required=1000])Returns the amount of ticks required to produce but not consume a certain amount
+ + +

Formating

+ + + + + + + + + + + + +
get_color (clamp, active_value, passive_value)Returns a color value bassed on the value that was given
format_number (value)Returns three parts used to format a number
+ + +
+ + +

Dependencies

+
+
+
+
+ # + resources.color_presets +
+
+
+
+ +

Provides colors for Production.get_color

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + util +
+
+
+
+ +

Provides format_number function to add surfixs

+

+ + + + + + + + + + + + + + +
+
+

Precision

+
+
+
+
+ # + precision_up (precision) +
+
+
+
+ +

Gets the next lesser precision index value, eg 1 second -> 1 minute

+

+ + + Parameters: + + + + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + precision_down (precision) +
+
+
+
+ +

Gets the next greater precision index value, eg 1 minute -> 1 second

+

+ + + Parameters: + + + + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + precision_ticks (precision) +
+
+
+
+ +

Gets the number of tick that precision is given over, eg 1 minute -> 60 ticks

+

+ + + Parameters: + + + + + + + Returns: +
    +
  • + (number) + the number of ticks in this time +
  • +
+ + + + + + + + + +
+
+

Stats

+
+
+
+
+ # + get_production_total (force, item_name) +
+
+
+
+ +

Returns the production data for the whole game time

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + contains total made, used and net +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_production (force, item_name, precision) +
+
+
+
+ +

Returns the production data for the given precision game time

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + + + + +
  • + + precision + + : + + (defines.flow_precision_index) + + the precision that you want the data given to + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + contains made, used and net +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_fluctuations (force, item_name, precision) +
+
+
+
+ +

Returns the current fluctuation from the average

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + + + + +
  • + + precision + + : + + (defines.flow_precision_index) + + the precision that you want the data given to + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + contains made, used and net +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_production_eta (force, item_name, precision[, required=1000]) +
+
+
+
+ +

Returns the amount of ticks required to produce a certain amount

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + + + + +
  • + + precision + + : + + (defines.flow_precision_index) + + the precision that you want the data given to + +
  • + + + + + +
  • + + required + + : + + (number) + + the number of items that are required to be made + + (default: 1000) +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of ticks required to produce this ammount of items +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_consumsion_eta (force, item_name, precision[, required=1000]) +
+
+
+
+ +

Returns the amount of ticks required to consume a certain amount

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + + + + +
  • + + precision + + : + + (defines.flow_precision_index) + + the precision that you want the data given to + +
  • + + + + + +
  • + + required + + : + + (number) + + the number of items that are required to be consumed + + (default: 1000) +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of ticks required to consume this ammount of items +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_net_eta (force, item_name, precision[, required=1000]) +
+
+
+
+ +

Returns the amount of ticks required to produce but not consume a certain amount

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + + + + +
  • + + precision + + : + + (defines.flow_precision_index) + + the precision that you want the data given to + +
  • + + + + + +
  • + + required + + : + + (number) + + the number of items that are required to be made but not used + + (default: 1000) +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of ticks required to produce, but not use, this ammount of items +
  • +
+ + + + + + + + + +
+
+

Formating

+
+
+
+
+ # + get_color (clamp, active_value, passive_value) +
+
+
+
+ +

Returns a color value bassed on the value that was given

+

+ + + Parameters: + +
    + + + + + +
  • + + clamp + + : + + (number) + + value which seperates the different colours + +
  • + + + + + +
  • + + active_value + + : + + (number) + + first value tested, tested against clamp + +
  • + + + + + +
  • + + passive_value + + : + + (number) + + second value tested, tested against 0 + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + contains r,g,b keys +
  • +
+ + + + + + + + + +
+
+
+
+ # + format_number (value) +
+
+
+
+ +

Returns three parts used to format a number

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + (number) + + the value to format + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the sign for the number +
  • +
  • + (string) + the surfix for any unit used +
  • +
  • + (string) + the number formated +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/Reports.html b/docs/modules/Reports.html new file mode 100644 index 00000000..35edb453 --- /dev/null +++ b/docs/modules/Reports.html @@ -0,0 +1,1026 @@ + + + + + + + + Reports module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Reports module

+

Control Module - Reports + - Adds a way to report players and store report messages.

+

+ + + + + + +

Usage

+

+    -- import the module from the control modules
+    local Reports = require '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
+    -- seen by using Reports.get_report.
+    Reports.report_player('MrBiter','Cooldude2606','Liking biters too much') -- true
+
+    -- The other get methods can be used to get all the reports on a player or to test if a player is reported.
+    Reports.get_report('MrBiter','Cooldude2606') -- 'Liking biters too much'
+
+    -- This will remove the warning on 'MrBiter' (must be a valid player) which was made by 'Cooldude2606'.
+    Reports.remove_report('MrBiter','Cooldude2606') -- true
+
+    -- This will remove all the report that have been made against 'MrBiter'. Note that the remove event will
+    -- be triggered once per report issused.
+    Reports.remove_all('MrBiter') -- true
+
+ + + + + + + +

Events

+ + + + + + + + + + + + +
on_player_reportedWhen a player is reported
on_report_removedWhen a report is removed from a player
+ + +

Dependencies

+ + + + + + + + + + + + +
utils.gameAllows getting player from any value
utils.globalAllows storing of data in global table
+ + +

Get functions

+ + + + + + + + + + + + + + + + + + + + +
get_reports (player)Gets a list of all reports that a player has against them
get_report (player, by_player_name)Gets a single report against a player given the name of the player who made the report
is_reported (player[, by_player_name])Checks if a player is reported, option to get if reported by a certain player
count_reports (player[, custom_count])Counts the number of reports that a player has aganist them
+ + +

Set functions

+ + + + + + + + + + + + + + + + +
report_player (player, by_player_name[, reason='Non given.'])Adds a report to a player, each player can only report another player once
remove_report (player, reported_by_name)Removes a report from a player
remove_all (player)Removes all reports from a player
+ + +
+ + +

Events

+
+
+
+
+ # + on_player_reported +
+
+
+
+ +

When a player is reported

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the player index of the player who got reported + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who made the report + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason given for the report + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_report_removed +
+
+
+
+ +

When a report is removed from a player

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the player index of the player who has the report removed + +
  • + + + + + +
  • + + reported_by_name + + : + + (string) + + the name of the player who made the removed report + +
  • + + + + + +
  • + + removed_by_name + + : + + (string) + + the name of the player who removed the report + +
  • + + +
+ + + + + + + + + + + + + +
+
+

Dependencies

+
+
+
+
+ # + utils.game +
+
+
+
+ +

Allows getting player from any value

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ +

Allows storing of data in global table

+

+ + + + + + + + + + + + + + +
+
+

Get functions

+
+
+
+
+ # + get_reports (player) +
+
+
+
+ +

Gets a list of all reports that a player has against them

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the report for + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + a list of all reports, key is by player name, value is reason +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_report (player, by_player_name) +
+
+
+
+ +

Gets a single report against a player given the name of the player who made the report

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the report for + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who made the report + +
  • + + +
+ + + + + Returns: +
    +
  • + (string or nil) + string is the reason that the player was reported, if the player is not reported +
  • +
+ + + + + + + + + +
+
+
+
+ # + is_reported (player[, by_player_name]) +
+
+
+
+ +

Checks if a player is reported, option to get if reported by a certain player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to check if reported + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + when given will check if reported by this player + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + if the player has been reported +
  • +
+ + + + + + + + + +
+
+
+
+ # + count_reports (player[, custom_count]) +
+
+
+
+ +

Counts the number of reports that a player has aganist them

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to count the reports for + +
  • + + + + + +
  • + + custom_count + + : + + (function) + + when given this function will be used to count the reports + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of reports that the user has +
  • +
+ + + + + + + + + +
+
+

Set functions

+
+
+
+
+ # + report_player (player, by_player_name[, reason='Non given.']) +
+
+
+
+ +

Adds a report to a player, each player can only report another player once

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to add the report to + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player that is making the report + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player is being reported + + (default: 'Non given.') +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the report was added successfully +
  • +
+ + + + + + + + + +
+
+
+
+ # + remove_report (player, reported_by_name) +
+
+
+
+ +

Removes a report from a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to remove the report from + +
  • + + + + + +
  • + + reported_by_name + + : + + (string) + + the name of the player that made the report + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the report was removed successfully +
  • +
+ + + + + + + + + +
+
+
+
+ # + remove_all (player) +
+
+
+
+ +

Removes all reports from a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to remove the reports from + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the reports were removed successfully +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/Warnings.html b/docs/modules/Warnings.html new file mode 100644 index 00000000..69fcc9c9 --- /dev/null +++ b/docs/modules/Warnings.html @@ -0,0 +1,1279 @@ + + + + + + + + Warnings module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Warnings module

+

Control Module - Warnings + - Adds a way to give and remove warnings to players.

+

+ + + + + + +

Usage

+

+    -- This will add a warning to the player
+    Warnings.add_warning('MrBiter','Cooldude2606','Killed too many biters')
+
+    -- This will remove a warning from a player, second name is just who is doing the action
+    Warnings.remove_warning('MrBiter','Cooldude2606')
+
+    -- Script warning as similar to normal warning but are designed to have no effect for a short amount of time
+    -- this is so it can be used for greifer protection without being too agressive
+    Warnings.add_script_warning('MrBiter','Killed too many biters')
+
+    -- Both normal and script warnings can also be cleared, this will remove all warnings
+    Warnings.clear_warnings('MrBiter','Cooldude2606')
+ + + + + + + +

Events

+ + + + + + + + + + + + + + + + + + + + +
on_warning_addedWhen a warning is added to a player
on_warning_removedWhen a warning is removed from a player
on_script_warning_addedWhen a warning is added to a player, by the script
on_script_warning_removedWhen a warning is remnoved from a player, by the script
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
get_warnings (player)Gets an array of warnings that the player has, always returns a list even if emtpy
count_warnings (player)Gets the number of warnings that a player has on them
add_warning (player, by_player_name[, reason='Non given.'])Adds a warning to a player, when a warning is added a set action is done based on the number of warnings and the config file
remove_warning (player, by_player_name)Removes a warning from a player, always removes the earlyist warning, fifo
clear_warnings (player, by_player_name)Removes all warnings from a player, will trigger remove event for each warning
get_script_warnings (player)Gets an array of all the script warnings that a player has
count_script_warnings (player)Gets the number of script warnings that a player has on them
add_script_warning (player[, reason='Non given.'])Adds a script warning to a player, this may add a full warning if max script warnings is met
remove_script_warning (player)Removes a script warning from a player
clear_script_warnings (player)Removes all script warnings from a player, emits event for each warning removed
+ + +
+ + +

Events

+
+
+
+
+ # + on_warning_added +
+
+
+
+ +

When a warning is added to a player

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who recived the warning + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who gave the warning + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player was given a warning + +
  • + + + + + +
  • + + warning_count + + : + + (number) + + the new number of warnings that the player has + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_warning_removed +
+
+
+
+ +

When a warning is removed from a player

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who is having the warning removed + +
  • + + + + + +
  • + + warning_by_name + + : + + (string) + + the name of the player who gave the warning + +
  • + + + + + +
  • + + removed_by_name + + : + + (string) + + the name of the player who is removing the warning + +
  • + + + + + +
  • + + warning_count + + : + + (number) + + the new number of warnings that the player has + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_script_warning_added +
+
+
+
+ +

When a warning is added to a player, by the script

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who recived the warning + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player was given a warning + +
  • + + + + + +
  • + + warning_count + + : + + (number) + + the new number of warnings that the player has + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_script_warning_removed +
+
+
+
+ +

When a warning is remnoved from a player, by the script

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who is having the warning removed + +
  • + + + + + +
  • + + warning_count + + : + + (number) + + the new number of warnings that the player has + +
  • + + +
+ + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + get_warnings (player) +
+
+
+
+ +

Gets an array of warnings that the player has, always returns a list even if emtpy

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the warning for + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + an array of all the warnings on this player, contains tick, by_player_name and reason +
  • +
+ + + + + + + + + +
+
+
+
+ # + count_warnings (player) +
+
+
+
+ +

Gets the number of warnings that a player has on them

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to count the warnings for + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + add_warning (player, by_player_name[, reason='Non given.']) +
+
+
+
+ +

Adds a warning to a player, when a warning is added a set action is done based on the number of warnings and the config file

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to add a warning to + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who is doing the action + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player is being warned + + (default: 'Non given.') +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + remove_warning (player, by_player_name) +
+
+
+
+ +

Removes a warning from a player, always removes the earlyist warning, fifo

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to remove a warning from + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who is doing the action + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + clear_warnings (player, by_player_name) +
+
+
+
+ +

Removes all warnings from a player, will trigger remove event for each warning

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to clear the warnings from + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who is doing the action + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true when warnings were cleared succesfully +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_script_warnings (player) +
+
+
+
+ +

Gets an array of all the script warnings that a player has

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the script warnings of + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + a table of all the script warnings a player has, contains tick and reason +
  • +
+ + + + + + + + + +
+
+
+
+ # + count_script_warnings (player) +
+
+
+
+ +

Gets the number of script warnings that a player has on them

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to count the script warnings of + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of script warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + add_script_warning (player[, reason='Non given.']) +
+
+
+
+ +

Adds a script warning to a player, this may add a full warning if max script warnings is met

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to add a script warning to + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player is being warned + + (default: 'Non given.') +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of script warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + remove_script_warning (player) +
+
+
+
+ +

Removes a script warning from a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to remove a script warning from + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of script warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + clear_script_warnings (player) +
+
+
+
+ +

Removes all script warnings from a player, emits event for each warning removed

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to clear the script warnings from + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/addons.advanced-start.html b/docs/modules/addons.advanced-start.html new file mode 100644 index 00000000..71ef2c75 --- /dev/null +++ b/docs/modules/addons.advanced-start.html @@ -0,0 +1,71 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module addons.advanced-start

+

Adds a better method of player starting items based on production levels.

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-06-21 19:36:35 +
+
+ + diff --git a/docs/modules/addons.chat-popups.html b/docs/modules/addons.chat-popups.html new file mode 100644 index 00000000..df8efb1e --- /dev/null +++ b/docs/modules/addons.chat-popups.html @@ -0,0 +1,72 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module addons.chat-popups

+

Creates flying text entities when a player sends a message in chat + also displays a ping above users who are named in the message

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-06-21 19:36:35 +
+
+ + diff --git a/docs/modules/addons.damage-popups.html b/docs/modules/addons.damage-popups.html new file mode 100644 index 00000000..89bc2255 --- /dev/null +++ b/docs/modules/addons.damage-popups.html @@ -0,0 +1,72 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module addons.damage-popups

+

Displays the amount of dmg that is done by players to entities + also shows player health when a player is attacked

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-06-21 19:36:35 +
+
+ + diff --git a/docs/modules/config._file_loader.html b/docs/modules/config._file_loader.html new file mode 100644 index 00000000..6feb3502 --- /dev/null +++ b/docs/modules/config._file_loader.html @@ -0,0 +1,235 @@ + + + + + + + + config._file_loader module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config._file_loader module

+

This contains a list of all files that will be loaded and the order they are loaded in + to stop a file from loading add "--" in front of it, remove the "--" to have the file be loaded + config files should be loaded after all modules are loaded + core files should be required by modules and not be present in this list

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/modules/config.action_buttons.html b/docs/modules/config.action_buttons.html new file mode 100644 index 00000000..0dd6dbf0 --- /dev/null +++ b/docs/modules/config.action_buttons.html @@ -0,0 +1,515 @@ + + + + + + + + config.action_buttons module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.action_buttons module

+

Config for the different action buttons that show on the player list + each button has the button define(s) given along side an auth function, and optional reason callback + if a reason callback is used then Store.set(action_name_store,player.name,'BUTTON_NAME') should be called during on_click + buttons can be removed from the gui by commenting them out of the config at the bottom of this file + the key used for the name of the button is the permission name used by the role system

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui
expcore.roles
expcore.store
utils.game
modules.control.reports
modules.control.warnings
modules.control.jail
resources.color_presets
expcore.common
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.store +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.reports +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.warnings +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.jail +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/config.advanced_start.html b/docs/modules/config.advanced_start.html new file mode 100644 index 00000000..5c01fd7d --- /dev/null +++ b/docs/modules/config.advanced_start.html @@ -0,0 +1,232 @@ + + + + + + + + config.advanced_start module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.advanced_start module

+

This file is used to setup the map starting settings and the items players will start with

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/modules/config.bonuses.html b/docs/modules/config.bonuses.html new file mode 100644 index 00000000..15f7f5a8 --- /dev/null +++ b/docs/modules/config.bonuses.html @@ -0,0 +1,232 @@ + + + + + + + + config.bonuses module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.bonuses module

+

Lists all bonuses which can be used, name followed by min max

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/modules/config.chat_reply.html b/docs/modules/config.chat_reply.html new file mode 100644 index 00000000..0f1367a1 --- /dev/null +++ b/docs/modules/config.chat_reply.html @@ -0,0 +1,287 @@ + + + + + + + + config.chat_reply module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.chat_reply module

+

This file defines the different triggers for the chat bot

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + +
expcore.common
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/config.death_logger.html b/docs/modules/config.death_logger.html new file mode 100644 index 00000000..d800df68 --- /dev/null +++ b/docs/modules/config.death_logger.html @@ -0,0 +1,234 @@ + + + + + + + + config.death_logger module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.death_logger module

+

This config controls what happens when a player dies mostly about map markers and item collection + allow_teleport_to_body_command and allow_collect_bodies_command can be over ridden if command_auth_runtime_disable is present + if not present then the commands will not be loaded into the game

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/modules/config.discord_alerts.html b/docs/modules/config.discord_alerts.html new file mode 100644 index 00000000..d90c30e2 --- /dev/null +++ b/docs/modules/config.discord_alerts.html @@ -0,0 +1,233 @@ + + + + + + + + config.discord_alerts module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.discord_alerts module

+

Config file used to enable and disable different push messages for discord

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/modules/config.expcore-commands.auth_admin.html b/docs/modules/config.expcore-commands.auth_admin.html new file mode 100644 index 00000000..7948bb6c --- /dev/null +++ b/docs/modules/config.expcore-commands.auth_admin.html @@ -0,0 +1,282 @@ + + + + + + + + config.expcore-commands.auth_admin module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.expcore-commands.auth_admin module

+

This is a very simple config file which adds a admin only auth function + not much to change here its more so it can be enabled and disabled from ./config/file_loader.lua + either way you can change the requirements to be "admin" if you wanted to

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + +
expcore.commands
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/config.expcore-commands.auth_roles.html b/docs/modules/config.expcore-commands.auth_roles.html new file mode 100644 index 00000000..d7b9bc5f --- /dev/null +++ b/docs/modules/config.expcore-commands.auth_roles.html @@ -0,0 +1,315 @@ + + + + + + + + config.expcore-commands.auth_roles module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.expcore-commands.auth_roles module

+

This will make commands only work if the role has been allowed it in the role config

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
expcore.roles
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/config.expcore-commands.auth_runtime_disable.html b/docs/modules/config.expcore-commands.auth_runtime_disable.html new file mode 100644 index 00000000..93ea32d7 --- /dev/null +++ b/docs/modules/config.expcore-commands.auth_runtime_disable.html @@ -0,0 +1,316 @@ + + + + + + + + config.expcore-commands.auth_runtime_disable module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.expcore-commands.auth_runtime_disable module

+

This config for command auth allows commands to be globally enabled and disabled during runtime + this config adds Commands.disable and Commands.enable to enable and disable commands for all users

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
utils.global
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/config.expcore-commands.parse_general.html b/docs/modules/config.expcore-commands.parse_general.html new file mode 100644 index 00000000..7fe058b7 --- /dev/null +++ b/docs/modules/config.expcore-commands.parse_general.html @@ -0,0 +1,319 @@ + + + + + + + + config.expcore-commands.parse_general module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.expcore-commands.parse_general module

+

This file contains some common command param parse functions + this file is less of a config and more of a requirement but you may wish to change how some behave + as such you need to be confident with lua but you edit this config file + use Commands.add_parse('name',function(input,player,reject) end) to add a parse + see ./expcore/commands.lua for more details

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
utils.game
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/config.expcore-commands.parse_roles.html b/docs/modules/config.expcore-commands.parse_roles.html new file mode 100644 index 00000000..2c0885f6 --- /dev/null +++ b/docs/modules/config.expcore-commands.parse_roles.html @@ -0,0 +1,343 @@ + + + + + + + + config.expcore-commands.parse_roles module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.expcore-commands.parse_roles module

+

Adds some parse functions that can be used with the role system

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
expcore.commands
expcore.roles
expcore.common
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/config.permission_groups.html b/docs/modules/config.permission_groups.html new file mode 100644 index 00000000..fc44964f --- /dev/null +++ b/docs/modules/config.permission_groups.html @@ -0,0 +1,347 @@ + + + + + + + + config.permission_groups module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.permission_groups module

+

Use this file to add new permission groups to the game + start with Permission_Groups.new_group('name') + then use either :allow_all() or :disallow_all() to set the default for non specified actions + then use :allow{} and :disallow{} to specify certain actions to allow/disallow

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
utils.event
utils.game
expcore.permission_groups
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.permission_groups +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/config.popup_messages.html b/docs/modules/config.popup_messages.html new file mode 100644 index 00000000..1fe88709 --- /dev/null +++ b/docs/modules/config.popup_messages.html @@ -0,0 +1,234 @@ + + + + + + + + config.popup_messages module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.popup_messages module

+

A combination of config settings for different popup values like chat and damage

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/modules/config.rockets.html b/docs/modules/config.rockets.html new file mode 100644 index 00000000..908b558a --- /dev/null +++ b/docs/modules/config.rockets.html @@ -0,0 +1,324 @@ + + + + + + + + config.rockets module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.rockets module

+

This file controls what will show in each section of the rocket info gui

+

+ + + + + + + + + + + + + +

Fields

+ + + + + + + + + + + + +
show_statsThe data that will show in the stats section
show_progressThe data and buttons in the build progress section
+ + +
+ + +

Fields

+
+
+
+
+ # + show_stats +
+
+
+
+ +

The data that will show in the stats section

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + show_progress +
+
+
+
+ +

The data and buttons in the build progress section

+

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/config.roles.html b/docs/modules/config.roles.html new file mode 100644 index 00000000..ce60d7ec --- /dev/null +++ b/docs/modules/config.roles.html @@ -0,0 +1,290 @@ + + + + + + + + config.roles module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.roles module

+

This is the main config file for the role system; file includes defines for roles and role flags and default values

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + +
expcore.roles
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/config.scorched_earth.html b/docs/modules/config.scorched_earth.html new file mode 100644 index 00000000..0b10a247 --- /dev/null +++ b/docs/modules/config.scorched_earth.html @@ -0,0 +1,235 @@ + + + + + + + + config.scorched_earth module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.scorched_earth module

+

This file controls the placement/degrading of tiles as players build and walk

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/modules/config.spawn_area.html b/docs/modules/config.spawn_area.html new file mode 100644 index 00000000..01013de6 --- /dev/null +++ b/docs/modules/config.spawn_area.html @@ -0,0 +1,235 @@ + + + + + + + + config.spawn_area module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.spawn_area module

+

Used to config the spawn generation settings yes there is alot here i know just ignore the long tables at the end (they were generated with a command)

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/modules/config.warnings.html b/docs/modules/config.warnings.html new file mode 100644 index 00000000..4fc67842 --- /dev/null +++ b/docs/modules/config.warnings.html @@ -0,0 +1,235 @@ + + + + + + + + config.warnings module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.warnings module

+

Config file for the warning system, this is very similar to reports but is for the use of moderators rather than normal users.

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/modules/config.warps.html b/docs/modules/config.warps.html new file mode 100644 index 00000000..e0a4c5e2 --- /dev/null +++ b/docs/modules/config.warps.html @@ -0,0 +1,235 @@ + + + + + + + + config.warps module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

config.warps module

+

This file contains all the different settings for the warp system and gui

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/modules/control.html b/docs/modules/control.html new file mode 100644 index 00000000..75103f1b --- /dev/null +++ b/docs/modules/control.html @@ -0,0 +1,359 @@ + + + + + + + + control module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

control module

+

Please go to ./config if you want to change settings, each file is commented with what it does + if it is not in ./config then you should not attempt to change it unless you know what you are doing + all files which are loaded (including the config files) are present in ./config/file_loader.lua + this file is the landing point for all scenarios please DO NOT edit directly, further comments are to aid development

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
utils.debug
expcore.common.ext_require
config._file_loader
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.debug +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common.ext_require +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config._file_loader +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/control.reports.html b/docs/modules/control.reports.html new file mode 100644 index 00000000..eee1ba64 --- /dev/null +++ b/docs/modules/control.reports.html @@ -0,0 +1,341 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module control.reports

+

Gets a list of all reports that a player has against them

+

+ + +

Get functions

+ + + + + + + + + + + + + + + + + +
Reports.get_reports (player)Gets a list of all reports that a player has against them
Reports.get_report (player[, by_player_name='server'])Gets a single report against a player given the name of the player who made the report
Reports.is_reported (player[, by_player_name])Checks if a player is reported, option to get if reported by a certain player
Reports.count (player[, custom_count])Counts the number of reports that a player has aganist them
+

Set functions

+ + + + + + + + + + + + + +
Reports.report_player (player[, by_player_name='server'[, reason='Non Given.']])Adds a report to a player, each player can only report another player once
Reports.remove_report (player[, by_player_name='server'])Removes a report from a player
Reports.remove_all (player)Removes all reports from a player
+ +
+
+ + +

Get functions

+ + + Functions used to get information from reports +
+
+ + Reports.get_reports (player) +
+
+ Gets a list of all reports that a player has against them + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to get the report for +
  • +
+ +

Returns:

+
    + + table + a list of all reports, key is by player name, value is reason +
+ + + + +
+
+ + Reports.get_report (player[, by_player_name='server']) +
+
+ Gets a single report against a player given the name of the player who made the report + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to get the report for +
  • +
  • by_player_name + string + the name of the player who made the report + (default 'server') +
  • +
+ +

Returns:

+
    + + string or nil + string is the reason that the player was reported, if the player is not reported +
+ + + + +
+
+ + Reports.is_reported (player[, by_player_name]) +
+
+ Checks if a player is reported, option to get if reported by a certain player + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to check if reported +
  • +
  • by_player_name + string + when given will check if reported by this player + (optional) +
  • +
+ +

Returns:

+
    + + boolean + if the player has been reported +
+ + + + +
+
+ + Reports.count (player[, custom_count]) +
+
+ Counts the number of reports that a player has aganist them + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to count the reports for +
  • +
  • custom_count + function + when given this function will be used to count the reports + (optional) +
  • +
+ +

Returns:

+
    + + number + the number of reports that the user has +
+ + + + +
+
+

Set functions

+ + + Functions used to get information from reports +
+
+ + Reports.report_player (player[, by_player_name='server'[, reason='Non Given.']]) +
+
+ Adds a report to a player, each player can only report another player once + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to add the report to +
  • +
  • by_player_name + string + the name of the player that is making the report + (default 'server') +
  • +
  • reason + string + the reason that the player is being reported + (default 'Non Given.') +
  • +
+ +

Returns:

+
    + + boolean + whether the report was added successfully +
+ + + + +
+
+ + Reports.remove_report (player[, by_player_name='server']) +
+
+ Removes a report from a player + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to remove the report from +
  • +
  • by_player_name + string + the name of the player that made the report + (default 'server') +
  • +
+ +

Returns:

+
    + + boolean + whether the report was removed successfully +
+ + + + +
+
+ + Reports.remove_all (player) +
+
+ Removes all reports from a player + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to remove the reports from +
  • +
+ +

Returns:

+
    + + boolean + whether the reports were removed successfully +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-06-21 18:40:35 +
+
+ + diff --git a/docs/modules/expcore.commands.html b/docs/modules/expcore.commands.html new file mode 100644 index 00000000..1ff1dfca --- /dev/null +++ b/docs/modules/expcore.commands.html @@ -0,0 +1,264 @@ + + + + + + + + expcore.commands module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.commands module

+

Factorio command making module that makes commands with better parse and more modularity

+

+[[

+ + + +
    +
  • Author: Cooldude2606
  • +
+ + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/modules/expcore.common.html b/docs/modules/expcore.common.html new file mode 100644 index 00000000..3b4cbc89 --- /dev/null +++ b/docs/modules/expcore.common.html @@ -0,0 +1,2444 @@ + + + + + + + + expcore.common module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.common module

+

Adds some commonly used functions used in many modules

+

+[[

+ + + +
    +
  • Author: cooldude2606
  • +
+ + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
resources.color_presets
utils.game
util
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Common.type_check(value[, test_type=nil])Compare types faster for faster validation of params
Common.type_check_error(value, test_type, error_message, level)Raises an error if the value is of the wrong type
Common.param_check(value, test_type, param_name, param_number)Raises an error when the value is the incorrect type, uses a consistent error message format
Common.player_return(value[, colour=defines.colour.white][, player=game.player])Will return a value of any type to the player/server console, allows colour for in-game players
Common.write_json(path, tbl)Writes a table object to a file in json format
Common.opt_require(path)Calls a require that will not error if the file is not found
Common.ext_require(path, ...)Calls a require and returns only the keys given, file must return a table
Common.format_time(ticks, options)Formats tick into a clean format, denominations from highest to lowest + long will use words rather than letters + time will use : separates + string will return a string not a locale string + when a denomination is false it will overflow into the next one
Common.move_items(items[, surface=navies][, position={0][, radius=32][, chest_type=iron-chest])Moves items to the position and stores them in the closest entity of the type given
Common.print_grid_value(value, surface, position, scale, offset, immutable)https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4a2/map_gen/maps/diggy/debug.lua#L31 + Prints a colored value on a location.
Common.print_colored_grid_value(value, surface, position, offset, immutable, color_value, base_color, delta_color, under_bound, over_bound)Prints a colored value on a location.
Common.clear_flying_text(surface)Clears all flying text entities on a surface
Common.string_contains(s, contains)Tests if a string contains a given substring.
Common.extract_keys(tbl, ...)Extracts certain keys from a table
Common.enum(tbl)Converts a table to an enum
Common.auto_complete(options, input[, use_key=false][, rtn_key=false])Returns the closest match to the input
Common.table_values(table[, sorted][, as_string])Returns a copy of all of the values in the table.
Common.table_keys(table[, sorted][, as_string])Returns a copy of all of the keys in the table.
Common.table_alphanumsort(tbl)Returns the list is a sorted way that would be expected by people (this is by key)
Common.table_keysort(tbl)Returns the list is a sorted way that would be expected by people (this is by key) (faster alternative than above)
Common.format_chat_colour(message, color)Returns a message with valid chat tags to change its colour
Common.format_chat_colour_localized(message, color)Returns a message with valid chat tags to change its colour, using localization
Common.format_chat_player_name(player[, raw_string=false])Returns the players name in the players color
+ + +
+ + +

Dependencies

+
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + util +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Common.type_check(value[, test_type=nil]) +
+
+
+
+ +

Compare types faster for faster validation of params

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + (any) + + the value to be tested + +
  • + + + + + +
  • + + test_type + + : + + (string) + + the type to test for if not given then it tests for nil + + (default: nil) +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + is v of type test_type +
  • +
+ + + + + + + + Usage: +
type_check('foo','string') -- return true
+
type_check('foo') -- return false
+ + +
+
+
+
+ # + Common.type_check_error(value, test_type, error_message, level) +
+
+
+
+ +

Raises an error if the value is of the wrong type

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + (any) + + the value that you want to test the type of + +
  • + + + + + +
  • + + test_type + + : + + (string) + + the type that the value should be + +
  • + + + + + +
  • + + error_message + + : + + (string) + + the error message that is returned + +
  • + + + + + +
  • + + level + + : + + (number) + + the level to call the error on (level = 1 means the caller) + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if no error was called +
  • +
+ + + + + + + + Usage: +
type_check_error('foo','number','Value must be a number') -- will raise error "Value must be a number"
+ + +
+
+
+
+ # + Common.param_check(value, test_type, param_name, param_number) +
+
+
+
+ +

Raises an error when the value is the incorrect type, uses a consistent error message format

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + (any) + + the value that you want to test the type of + +
  • + + + + + +
  • + + test_type + + : + + (string) + + the type that the value should be + +
  • + + + + + +
  • + + param_name + + : + + (string) + + the name of the param + +
  • + + + + + +
  • + + param_number + + : + + (number) + + the number param it is + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if no error was raised +
  • +
+ + + + + + + + Usage: +
param_check('foo','number','repeat_count',2) -- will raise error "Invalid param #02 given to <anon>; repeat_count is not of type number"
+ + +
+
+
+
+ # + Common.player_return(value[, colour=defines.colour.white][, player=game.player]) +
+
+
+
+ +

Will return a value of any type to the player/server console, allows colour for in-game players

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + + any value of any type that will be returned to the player or console + +
  • + + + + + +
  • + + colour + + : + + (defines.color or string) + + the colour of the text for the player, ignored when printing to console + + (default: defines.colour.white) +
  • + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that return will go to, if no game.player then returns to server + + (default: game.player) +
  • + + +
+ + + + + + + + + + + + Usage: +
player_return('Hello, World!') -- returns 'Hello, World!' to game.player or server console
+
player_return('Hello, World!','green') -- returns 'Hello, World!' to game.player with colour green or server console
+
player_return('Hello, World!',nil,player) -- returns 'Hello, World!' to the given player
+ + +
+
+
+
+ # + Common.write_json(path, tbl) +
+
+
+
+ +

Writes a table object to a file in json format

+

+ + + Parameters: + +
    + + + + + +
  • + + path + + : + + (string) + + the path of the file to write include / to use dir + +
  • + + + + + +
  • + + tbl + + : + + (table) + + the table that will be converted to a json string and wrote to file + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Common.opt_require(path) +
+
+
+
+ +

Calls a require that will not error if the file is not found

+

+ + + Parameters: + +
    + + + + + +
  • + + path + + : + + (string) + + the path that you want to require + +
  • + + +
+ + + + + Returns: +
    +
  • + the returns from that file or nil, error if not loaded +
  • +
+ + + + + + + + Usage: +
local file = opt_require('file.not.present') -- will not cause any error
+ + +
+
+
+
+ # + Common.ext_require(path, ...) +
+
+
+
+ +

Calls a require and returns only the keys given, file must return a table

+

+ + + Parameters: + +
    + + + + + +
  • + + path + + : + + (string) + + the path that you want to require + +
  • + + + + + +
  • + + ... + + : + + (string) + + the name of the keys that you want returned + +
  • + + +
+ + + + + Returns: +
    +
  • + the keys in the order given +
  • +
+ + + + + + + + Usage: +
local extract, param_check = ext_require('expcore.common','extract','param_check') --- @dep expcore.common
+ + +
+
+
+
+ # + Common.format_time(ticks, options) +
+
+
+
+ +

Formats tick into a clean format, denominations from highest to lowest + long will use words rather than letters + time will use : separates + string will return a string not a locale string + when a denomination is false it will overflow into the next one

+

+ + + Parameters: + +
    + + + + + +
  • + + ticks + + : + + (number) + + the number of ticks that represents a time + +
  • + + + + + +
  • + + options + + : + + (table) + + table a of options to use for the format + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + a locale string that can be used +
  • +
+ + + + + + + + + +
+
+
+
+ # + Common.move_items(items[, surface=navies][, position={0][, radius=32][, chest_type=iron-chest]) +
+
+
+
+ +

Moves items to the position and stores them in the closest entity of the type given

+

+ + + Parameters: + +
    + + + + + +
  • + + items + + : + + (table) + + items which are to be added to the chests, ['name']=count + +
  • + + + + + +
  • + + surface + + : + + (LuaSurface) + + the surface that the items will be moved to + + (default: navies) +
  • + + + + + +
  • + + position + + : + + (table) + + the position that the items will be moved to {x=100,y=100} + + (default: {0) +
  • + + + + + +
  • + + radius + + : + + (number) + + the radius in which the items are allowed to be placed + + (default: 32) +
  • + + + + + +
  • + + chest_type + + : + + (string) + + the chest type that the items should be moved into + + (default: iron-chest) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Common.print_grid_value(value, surface, position, scale, offset, immutable) +
+
+
+
+ +

https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4a2/map_gen/maps/diggy/debug.lua#L31 + Prints a colored value on a location.

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + + between -1 and 1 + +
  • + + + + + +
  • + + surface + + : + + + LuaSurface + +
  • + + + + + +
  • + + position + + : + + + Position {x, y} + +
  • + + + + + +
  • + + scale + + : + + + float + +
  • + + + + + +
  • + + offset + + : + + + float + +
  • + + + + + +
  • + + immutable + + : + + + bool if immutable, only set, never do a surface lookup, values never change + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Common.print_colored_grid_value(value, surface, position, offset, immutable, color_value, base_color, delta_color, under_bound, over_bound) +
+
+
+
+ +

Prints a colored value on a location.

+

When given a color_value and a delta_color, + will change the color of the text from the base to base + value * delta. This will + make the color of the text range from 'base_color' to 'base_color + delta_color' + as the color_value ranges from 0 to 1

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + + of number to be displayed + +
  • + + + + + +
  • + + surface + + : + + + LuaSurface + +
  • + + + + + +
  • + + position + + : + + + Position {x, y} + +
  • + + + + + +
  • + + offset + + : + + + float position offset + +
  • + + + + + +
  • + + immutable + + : + + + bool if immutable, only set, never do a surface lookup, values never change + +
  • + + + + + +
  • + + color_value + + : + + + float How far along the range of values of colors the value is to be displayed + +
  • + + + + + +
  • + + base_color + + : + + + {r,g,b} The color for the text to be if color_value is 0 + +
  • + + + + + +
  • + + delta_color + + : + + + {r,g,b} The amount to correct the base_color if color_value is 1 + +
  • + + + + + +
  • + + under_bound + + : + + + {r,g,b} The color to be used if color_value < 0 + +
  • + + + + + +
  • + + over_bound + + : + + + {r,g,b} The color to be used if color_value > 1 + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Common.clear_flying_text(surface) +
+
+
+
+ +

Clears all flying text entities on a surface

+

+ + + Parameters: + +
    + + + + + +
  • + + surface + + : + + (LuaSurface) + + the surface to clear + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Common.string_contains(s, contains) +
+
+
+
+ +

Tests if a string contains a given substring.

+

+ + + Parameters: + +
    + + + + + +
  • + + s + + : + + (string) + + the string to check for the substring + +
  • + + + + + +
  • + + contains + + : + + (string) + + the substring to test for + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the substring was found in the string +
  • +
+ + + + + + + + + +
+
+
+
+ # + Common.extract_keys(tbl, ...) +
+
+
+
+ +

Extracts certain keys from a table

+

+ + + Parameters: + +
    + + + + + +
  • + + tbl + + : + + (table) + + table the which contains the keys + +
  • + + + + + +
  • + + ... + + : + + (string) + + the names of the keys you want extracted + +
  • + + +
+ + + + + Returns: +
    +
  • + the keys in the order given +
  • +
+ + + + + + + + Usage: +
local key_three, key_one = extract({key_one='foo',key_two='bar',key_three=true},'key_three','key_one')
+ + +
+
+
+
+ # + Common.enum(tbl) +
+
+
+
+ +

Converts a table to an enum

+

+ + + Parameters: + +
    + + + + + +
  • + + tbl + + : + + (table) + + table the that will be converted + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new table that acts like an enum +
  • +
+ + + + + + + + + +
+
+
+
+ # + Common.auto_complete(options, input[, use_key=false][, rtn_key=false]) +
+
+
+
+ +

Returns the closest match to the input

+

+ + + Parameters: + +
    + + + + + +
  • + + options + + : + + (table) + + table a of options for the auto complete + +
  • + + + + + +
  • + + input + + : + + (string) + + string the input that will be completed + +
  • + + + + + +
  • + + use_key + + : + + (boolean) + + when true the keys of options will be used as the options + + (default: false) +
  • + + + + + +
  • + + rtn_key + + : + + (boolean) + + when true the the key will be returned rather than the value + + (default: false) +
  • + + +
+ + + + + Returns: +
    +
  • + the list item found that matches the input +
  • +
+ + + + + + + + + +
+
+
+
+ # + Common.table_values(table[, sorted][, as_string]) +
+
+
+
+ +

Returns a copy of all of the values in the table.

+

+ + + Parameters: + +
    + + + + + +
  • + + table + + : + + (table) + + tbl the to copy the keys from, or an empty table if tbl is nil + +
  • + + + + + +
  • + + sorted + + : + + (boolean) + + whether to sort the keys (slower) or keep the random order from pairs() + + (optional) +
  • + + + + + +
  • + + as_string + + : + + (boolean) + + whether to try and parse the values as strings, or leave them as their existing type + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (array) + an array with a copy of all the values in the table +
  • +
+ + + + + + + + + +
+
+
+
+ # + Common.table_keys(table[, sorted][, as_string]) +
+
+
+
+ +

Returns a copy of all of the keys in the table.

+

+ + + Parameters: + +
    + + + + + +
  • + + table + + : + + (table) + + tbl the to copy the keys from, or an empty table if tbl is nil + +
  • + + + + + +
  • + + sorted + + : + + (boolean) + + whether to sort the keys (slower) or keep the random order from pairs() + + (optional) +
  • + + + + + +
  • + + as_string + + : + + (boolean) + + whether to try and parse the keys as strings, or leave them as their existing type + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (array) + an array with a copy of all the keys in the table +
  • +
+ + + + + + + + + +
+
+
+
+ # + Common.table_alphanumsort(tbl) +
+
+
+
+ +

Returns the list is a sorted way that would be expected by people (this is by key)

+

+ + + Parameters: + +
    + + + + + +
  • + + tbl + + : + + (table) + + the table to be sorted + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the sorted table +
  • +
+ + + + + + + + + +
+
+
+
+ # + Common.table_keysort(tbl) +
+
+
+
+ +

Returns the list is a sorted way that would be expected by people (this is by key) (faster alternative than above)

+

+ + + Parameters: + +
    + + + + + +
  • + + tbl + + : + + (table) + + the table to be sorted + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the sorted table +
  • +
+ + + + + + + + + +
+
+
+
+ # + Common.format_chat_colour(message, color) +
+
+
+
+ +

Returns a message with valid chat tags to change its colour

+

+ + + Parameters: + +
    + + + + + +
  • + + message + + : + + (string) + + the message that will be in the output + +
  • + + + + + +
  • + + color + + : + + (table) + + a color which contains r,g,b as its keys + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the message with the color tags included +
  • +
+ + + + + + + + + +
+
+
+
+ # + Common.format_chat_colour_localized(message, color) +
+
+
+
+ +

Returns a message with valid chat tags to change its colour, using localization

+

+ + + Parameters: + +
    + + + + + +
  • + + message + + : + + (string or table) + + the message that will be in the output + +
  • + + + + + +
  • + + color + + : + + (table) + + a color which contains r,g,b as its keys + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the message with the color tags included +
  • +
+ + + + + + + + + +
+
+
+
+ # + Common.format_chat_player_name(player[, raw_string=false]) +
+
+
+
+ +

Returns the players name in the players color

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to use the name and color of + +
  • + + + + + +
  • + + raw_string + + : + + (boolean) + + when true a is returned rather than a localized string + + (default: false) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the players name with tags for the players color +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/doc/modules/expcore.gui.buttons.html b/docs/modules/expcore.gui.buttons.html similarity index 100% rename from doc/modules/expcore.gui.buttons.html rename to docs/modules/expcore.gui.buttons.html diff --git a/doc/modules/expcore.gui.center.html b/docs/modules/expcore.gui.center.html similarity index 100% rename from doc/modules/expcore.gui.center.html rename to docs/modules/expcore.gui.center.html diff --git a/doc/modules/expcore.gui.checkboxs.html b/docs/modules/expcore.gui.checkboxs.html similarity index 100% rename from doc/modules/expcore.gui.checkboxs.html rename to docs/modules/expcore.gui.checkboxs.html diff --git a/docs/modules/expcore.gui.concepts.center.html b/docs/modules/expcore.gui.concepts.center.html new file mode 100644 index 00000000..c2353ac0 --- /dev/null +++ b/docs/modules/expcore.gui.concepts.center.html @@ -0,0 +1,1126 @@ + + + + + + + + expcore.gui.concepts.center module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui.concepts.center module

+

Gui structure define for center gui frames +[[

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
expcore.gui.concepts.toolbar
utils.game
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CenterFrames.get_flow(player)Gets the center flow for a player
CenterFrames.clear_flow(player)Clears the center flow for a player
CenterFrames.draw_frame(player, name)Draws the center frame for a player, if already open then will do nothing
CenterFrames.redraw_frame(player, name)Draws the center frame for a player, if already open then will destroy it and redraw
CenterFrames.toggle_frame(player, name[, state])Toggles if the frame is currently open or not, will open if closed and close if open
CenterFrames.new_frame(permission_name)Creates a new center frame define
CenterFrames._prototype:set_auto_focus([state=true])Sets the frame to be the current active gui when opened and closes all other frames
CenterFrames._prototype:draw_frame(player)Draws this frame to the player, if already open does nothing (will call on_draw to draw to the frame)
CenterFrames._prototype:redraw_frame(player)Draws this frame to the player, if already open it will remove it and redraw it (will call on_draw to draw to the frame)
CenterFrames._prototype:toggle_frame(player)Toggles if the frame is open, if open it will close it and if closed it will open it
CenterFrames._prototype:event_handler([action=update])Creates an event handler that will trigger one of its functions, use with Event.add
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.concepts.toolbar +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + CenterFrames.get_flow(player) +
+
+
+
+ +

Gets the center flow for a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the flow for + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + CenterFrames.clear_flow(player) +
+
+
+
+ +

Clears the center flow for a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to clear the flow for + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + CenterFrames.draw_frame(player, name) +
+
+
+
+ +

Draws the center frame for a player, if already open then will do nothing

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will have the frame drawn + +
  • + + + + + +
  • + + name + + : + + (string) + + the name of the hui that will drawn + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + CenterFrames.redraw_frame(player, name) +
+
+
+
+ +

Draws the center frame for a player, if already open then will destroy it and redraw

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will have the frame drawn + +
  • + + + + + +
  • + + name + + : + + (string) + + the name of the hui that will drawn + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + CenterFrames.toggle_frame(player, name[, state]) +
+
+
+
+ +

Toggles if the frame is currently open or not, will open if closed and close if open

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will have the frame toggled + +
  • + + + + + +
  • + + name + + : + + (string) + + the name of the hui that will be toggled + +
  • + + + + + +
  • + + state + + : + + (boolean) + + when set will force a state for the frame + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + if the frame if no open or closed +
  • +
+ + + + + + + + + +
+
+
+
+ # + CenterFrames.new_frame(permission_name) +
+
+
+
+ +

Creates a new center frame define

+

+ + + Parameters: + +
    + + + + + +
  • + + permission_name + + : + + (string) + + the name that can be used with the permission system + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new center frame define +
  • +
+ + + + + + + + + +
+
+
+
+ # + CenterFrames._prototype:set_auto_focus([state=true]) +
+
+
+
+ +

Sets the frame to be the current active gui when opened and closes all other frames

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean) + + when true will auto close other frames and set this frame as player.opened + + (default: true) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + CenterFrames._prototype:draw_frame(player) +
+
+
+
+ +

Draws this frame to the player, if already open does nothing (will call on_draw to draw to the frame)

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to draw the frame for + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + CenterFrames._prototype:redraw_frame(player) +
+
+
+
+ +

Draws this frame to the player, if already open it will remove it and redraw it (will call on_draw to draw to the frame)

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to draw the frame for + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + CenterFrames._prototype:toggle_frame(player) +
+
+
+
+ +

Toggles if the frame is open, if open it will close it and if closed it will open it

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to draw the frame for + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + with the gui frame is now open +
  • +
+ + + + + + + + + +
+
+
+
+ # + CenterFrames._prototype:event_handler([action=update]) +
+
+
+
+ +

Creates an event handler that will trigger one of its functions, use with Event.add

+

+ + + Parameters: + +
    + + + + + +
  • + + action + + : + + (string) + + the action to take on this event + + (default: update) +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/expcore.gui.concepts.left.html b/docs/modules/expcore.gui.concepts.left.html new file mode 100644 index 00000000..8c7b6772 --- /dev/null +++ b/docs/modules/expcore.gui.concepts.left.html @@ -0,0 +1,1476 @@ + + + + + + + + expcore.gui.concepts.left module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui.concepts.left module

+

Gui structure define for left frames +[[

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
expcore.gui.concepts.toolbar
expcore.gui.elements.buttons
mod-gui
utils.game
utils.event
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LeftFrames.get_flow(player)Gets the left frame flow for a player
LeftFrames.get_frame(name, player)Gets one frame from the left flow by its name
LeftFrames.get_open(player)Gets all open frames for a player, if non are open it will remove the close all button
LeftFrames.toggle_frame(name, player[, state])Toggles the visibility of a left frame, or sets its visibility state
LeftFrames.new_frame(permission_name)Creates a new left frame define
LeftFrames._prototype:set_open_by_default([state=true])Sets if the frame is visible when a player joins, can also be a function to return a boolean
LeftFrames._prototype:set_direction(direction)Sets the direction of the frame, either vertical or horizontal
LeftFrames._prototype:_internal_draw(player)Creates the gui for the first time, used internally
LeftFrames._prototype:get_frame(player)Gets the frame for this define from the left frame flow
LeftFrames._prototype:is_open(player)Returns if the player currently has this define visible
LeftFrames._prototype:toggle(player)Toggles the visibility of the left frame
LeftFrames._prototype:update(player)Updates the contents of the left frame, first tries update callback, other wise will clear and redraw
LeftFrames._prototype:update_all([update_offline=false])Updates the frame for all players, see update
LeftFrames._prototype:redraw(player)Redraws the frame by calling on_draw, will always clear the frame
LeftFrames._prototype:redraw_all([update_offline=false])Redraws the frame for all players, see redraw
LeftFrames._prototype:event_handler([action=update])Creates an event handler that will trigger one of its functions, use with Event.add
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.concepts.toolbar +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.elements.buttons +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + mod-gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + LeftFrames.get_flow(player) +
+
+
+
+ +

Gets the left frame flow for a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the flow of + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + LeftFrames.get_frame(name, player) +
+
+
+
+ +

Gets one frame from the left flow by its name

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the gui frame to get + +
  • + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the frame of + +
  • + + +
+ + + + + Returns: +
    +
  • + (LuaGuiElement) + the frame in the left frame flow with that name +
  • +
+ + + + + + + + + +
+
+
+
+ # + LeftFrames.get_open(player) +
+
+
+
+ +

Gets all open frames for a player, if non are open it will remove the close all button

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the flow of + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + contains all the open (and registered) frames for the player +
  • +
+ + + + + + + + + +
+
+
+
+ # + LeftFrames.toggle_frame(name, player[, state]) +
+
+
+
+ +

Toggles the visibility of a left frame, or sets its visibility state

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the gui frame to toggle + +
  • + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the frame of + +
  • + + + + + +
  • + + state + + : + + (boolean) + + when given will be the state that the visibility is set to + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + the new state of the visibility +
  • +
+ + + + + + + + + +
+
+
+
+ # + LeftFrames.new_frame(permission_name) +
+
+
+
+ +

Creates a new left frame define

+

+ + + Parameters: + +
    + + + + + +
  • + + permission_name + + : + + (string) + + the name that can be used with the permission system + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new left frame define +
  • +
+ + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:set_open_by_default([state=true]) +
+
+
+
+ +

Sets if the frame is visible when a player joins, can also be a function to return a boolean

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean or function) + + the default state of the visibility, can be a function + state param - player LuaPlayer - the player that has joined the game + state param - define_name string - the define name for the frame + state return - boolean - false will hide the frame + + (default: true) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:set_direction(direction) +
+
+
+
+ +

Sets the direction of the frame, either vertical or horizontal

+

+ + + Parameters: + +
    + + + + + +
  • + + direction + + : + + (string) + + the direction to have the elements be added to the frame + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:_internal_draw(player) +
+
+
+
+ +

Creates the gui for the first time, used internally

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to draw the frame to + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:get_frame(player) +
+
+
+
+ +

Gets the frame for this define from the left frame flow

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the frame of + +
  • + + +
+ + + + + Returns: +
    +
  • + (LuaGuiElement) + the frame in the left frame flow for this define +
  • +
+ + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:is_open(player) +
+
+
+
+ +

Returns if the player currently has this define visible

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the frame of + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if it is open/visible +
  • +
+ + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:toggle(player) +
+
+
+
+ +

Toggles the visibility of the left frame

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to toggle the frame of + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + the new state of the visibility +
  • +
+ + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:update(player) +
+
+
+
+ +

Updates the contents of the left frame, first tries update callback, other wise will clear and redraw

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to update the frame of + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:update_all([update_offline=false]) +
+
+
+
+ +

Updates the frame for all players, see update

+

+ + + Parameters: + +
    + + + + + +
  • + + update_offline + + : + + (boolean) + + when true will update the frame for offline players + + (default: false) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:redraw(player) +
+
+
+
+ +

Redraws the frame by calling on_draw, will always clear the frame

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to update the frame of + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:redraw_all([update_offline=false]) +
+
+
+
+ +

Redraws the frame for all players, see redraw

+

+ + + Parameters: + +
    + + + + + +
  • + + update_offline + + : + + (boolean) + + when true will update the frame for offline players + + (default: false) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + LeftFrames._prototype:event_handler([action=update]) +
+
+
+
+ +

Creates an event handler that will trigger one of its functions, use with Event.add

+

+ + + Parameters: + +
    + + + + + +
  • + + action + + : + + (string) + + the action to take on this event + + (default: update) +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/expcore.gui.concepts.popups.html b/docs/modules/expcore.gui.concepts.popups.html new file mode 100644 index 00000000..ec65c5df --- /dev/null +++ b/docs/modules/expcore.gui.concepts.popups.html @@ -0,0 +1,1012 @@ + + + + + + + + expcore.gui.concepts.popups module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui.concepts.popups module

+

Gui structure define for popup gui +[[

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
utils.game
utils.event
expcore.gui.elements.progress-bar
expcore.gui.elements.buttons
mod-gui
resources.color_presets
utils.global
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + +
PopupFrames.get_flow(player)Gets the left flow that contains the popup frames
PopupFrames.open(define_name, player[, open_time], ...)Opens a popup for the player, can give the amount of time it is open as well as params for the draw function
PopupFrames.new_popup([name])Creates a new popup frame define
PopupFrames._prototype:set_default_open_time(amount)Sets the default open time for the popup, will be used if non is provided with open
PopupFrames._prototype:open(player[, open_time], ...)Opens this define for a player, can be given open time and any other params for the draw function
+ + +

Fields

+ + + + + + + + + + + + +
PopupFrames.close_progressProgress bar which when depleted will close the popup frame
PopupFrames.close_buttonA button which can be used to close the gui before the timer runs out
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.elements.progress-bar +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.elements.buttons +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + mod-gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + PopupFrames.get_flow(player) +
+
+
+
+ +

Gets the left flow that contains the popup frames

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the flow for + +
  • + + +
+ + + + + Returns: +
    +
  • + (LuaGuiElement) + the left flow that contains the popup frames +
  • +
+ + + + + + + + + +
+
+
+
+ # + PopupFrames.open(define_name, player[, open_time], ...) +
+
+
+
+ +

Opens a popup for the player, can give the amount of time it is open as well as params for the draw function

+

+ + + Parameters: + +
    + + + + + +
  • + + define_name + + : + + (string) + + the name of the define that you want to open for the player + +
  • + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to open the popup for + +
  • + + + + + +
  • + + open_time + + : + + (number) + + the minimum number of ticks you want the popup open for, 0 means no limit, nil will take default + + (optional) +
  • + + + + + +
  • + + ... + + : + + (any) + + the other params that you want to pass to your on_draw event + +
  • + + +
+ + + + + Returns: +
    +
  • + (LuaGuiElement) + the frame that was drawn, the inner gui flow which contains the content +
  • +
+ + + + + + + + + +
+
+
+
+ # + PopupFrames.new_popup([name]) +
+
+
+
+ +

Creates a new popup frame define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new popup frame define +
  • +
+ + + + + + + + + +
+
+
+
+ # + PopupFrames._prototype:set_default_open_time(amount) +
+
+
+
+ +

Sets the default open time for the popup, will be used if non is provided with open

+

+ + + Parameters: + +
    + + + + + +
  • + + amount + + : + + (number) + + the number of ticks, by default, the popup will be open for + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the define to allow for chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + PopupFrames._prototype:open(player[, open_time], ...) +
+
+
+
+ +

Opens this define for a player, can be given open time and any other params for the draw function

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to open the popup for + +
  • + + + + + +
  • + + open_time + + : + + (number) + + the minimum number of ticks you want the popup open for, 0 means no limit, nil will take default + + (optional) +
  • + + + + + +
  • + + ... + + : + + (any) + + the other params that you want to pass to your on_draw event + +
  • + + +
+ + + + + Returns: +
    +
  • + (LuaGuiElement) + the frame that was drawn, the inner gui flow which contains the content +
  • +
+ + + + + + + + + +
+
+

Fields

+
+
+
+
+ # + PopupFrames.close_progress +
+
+
+
+ +

Progress bar which when depleted will close the popup frame

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + PopupFrames.close_button +
+
+
+
+ +

A button which can be used to close the gui before the timer runs out

+

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/expcore.gui.concepts.toolbar.html b/docs/modules/expcore.gui.concepts.toolbar.html new file mode 100644 index 00000000..c7846884 --- /dev/null +++ b/docs/modules/expcore.gui.concepts.toolbar.html @@ -0,0 +1,635 @@ + + + + + + + + expcore.gui.concepts.toolbar module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui.concepts.toolbar module

+

Gui structure for the toolbar (top left) +[[

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.elements.buttons
expcore.roles
utils.event
utils.game
mod-gui
+ + +

Functions

+ + + + + + + + + + + + + + + + +
Toolbar.new_button([name])Adds a new button to the toolbar
Toolbar.add_button(button)Adds an existing buttton to the toolbar
Toolbar.update(player)Updates the player's toolbar with an new buttons or expected change in auth return
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.elements.buttons +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + mod-gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Toolbar.new_button([name]) +
+
+
+
+ +

Adds a new button to the toolbar

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + when given allows an alias to the button for the permission system + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the button define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Toolbar.add_button(button) +
+
+
+
+ +

Adds an existing buttton to the toolbar

+

+ + + Parameters: + +
    + + + + + +
  • + + button + + : + + (table) + + the button define for the button to be added + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Toolbar.update(player) +
+
+
+
+ +

Updates the player's toolbar with an new buttons or expected change in auth return

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to update the toolbar for + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/expcore.gui.core.html b/docs/modules/expcore.gui.core.html new file mode 100644 index 00000000..67781766 --- /dev/null +++ b/docs/modules/expcore.gui.core.html @@ -0,0 +1,260 @@ + + + + + + + + expcore.gui.core module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui.core module

+

Core gui file for making element defines and element classes (use require 'expcore.gui') + see utils.gui for event handlering + see expcore.gui.test for examples for element defines +[[

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/doc/modules/expcore.gui.dropdown.html b/docs/modules/expcore.gui.dropdown.html similarity index 100% rename from doc/modules/expcore.gui.dropdown.html rename to docs/modules/expcore.gui.dropdown.html diff --git a/doc/modules/expcore.gui.elem-button.html b/docs/modules/expcore.gui.elem-button.html similarity index 100% rename from doc/modules/expcore.gui.elem-button.html rename to docs/modules/expcore.gui.elem-button.html diff --git a/docs/modules/expcore.gui.elements.buttons.html b/docs/modules/expcore.gui.elements.buttons.html new file mode 100644 index 00000000..dc8adc9a --- /dev/null +++ b/docs/modules/expcore.gui.elements.buttons.html @@ -0,0 +1,694 @@ + + + + + + + + expcore.gui.elements.buttons module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui.elements.buttons module

+

Gui class define for buttons and sprite buttons +[[

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
mod-gui
expcore.gui.core
expcore.gui.prototype
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + +
Button.new_button([name])Creates a new button element define
Button._prototype:set_sprites(sprite[, hovered_sprite][, clicked_sprite])Adds sprites to a button making it a sprite button
Button._prototype:set_click_filter(filter[, ...])Adds a click / mouse button filter to the button
Button._prototype:set_key_filter(filter[, ...])Adds a control key filter to the button
+ + +
+ + +

Dependencies

+
+
+
+
+ # + mod-gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Button.new_button([name]) +
+
+
+
+ +

Creates a new button element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new button element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Button._prototype:set_sprites(sprite[, hovered_sprite][, clicked_sprite]) +
+
+
+
+ +

Adds sprites to a button making it a sprite button

+

+ + + Parameters: + +
    + + + + + +
  • + + sprite + + : + + (SpritePath) + + the sprite path for the default sprite for the button + +
  • + + + + + +
  • + + hovered_sprite + + : + + (SpritePath) + + the sprite path for the sprite when the player hovers over the button + + (optional) +
  • + + + + + +
  • + + clicked_sprite + + : + + (SpritePath) + + the sprite path for the sprite when the player clicks the button + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + returns the button define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Button._prototype:set_click_filter(filter[, ...]) +
+
+
+
+ +

Adds a click / mouse button filter to the button

+

+ + + Parameters: + +
    + + + + + +
  • + + filter + + : + + (table) + + ?string|table either a of mouse buttons or the first mouse button to filter, with a table true means allowed + +
  • + + + + + +
  • + + ... + + : + + (table) + + when filter is not a you can add the mouse buttons one after each other + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + returns the button define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Button._prototype:set_key_filter(filter[, ...]) +
+
+
+
+ +

Adds a control key filter to the button

+

+ + + Parameters: + +
    + + + + + +
  • + + filter + + : + + (table) + + ?string|table either a of control keys or the first control keys to filter, with a table true means allowed + +
  • + + + + + +
  • + + ... + + : + + (table) + + when filter is not a you can add the control keys one after each other + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + returns the button define to allow chaining +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/expcore.gui.elements.checkbox.html b/docs/modules/expcore.gui.elements.checkbox.html new file mode 100644 index 00000000..bdfbf5a6 --- /dev/null +++ b/docs/modules/expcore.gui.elements.checkbox.html @@ -0,0 +1,1040 @@ + + + + + + + + expcore.gui.elements.checkbox module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui.elements.checkbox module

+

Gui class define for checkbox and radiobuttons +[[

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
expcore.store
utils.game
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Checkbox.new_checkbox([name])Creates a new checkbox element define
Checkbox.new_radiobutton([name])Creates a new radiobutton element define, has all functions checkbox has
Checkbox._prototype_radiobutton:add_as_option(option_set, option_name)Adds this radiobutton to be an option in the given option set (only one can be true at a time)
Checkbox._prototype_radiobutton:get_store(category, internal)Gets the stored value of the radiobutton or the option set if present
Checkbox._prototype_radiobutton:set_store(category, value, internal)Sets the stored value of the radiobutton or the option set if present
Checkbox.new_option_set(name, callback, categorize)Registers a new option set that can be linked to radiobuttons (only one can be true at a time)
Checkbox.draw_option_set(name, element)Draws all radiobuttons that are part of an option set at once (Gui.draw will not work)
Checkbox.reset_radiobuttons(element[, exclude][, recursive=false])Sets all radiobutton in a element to false (unless excluded) and can act recursively
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.store +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Checkbox.new_checkbox([name]) +
+
+
+
+ +

Creates a new checkbox element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new checkbox element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox.new_radiobutton([name]) +
+
+
+
+ +

Creates a new radiobutton element define, has all functions checkbox has

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new button element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox._prototype_radiobutton:add_as_option(option_set, option_name) +
+
+
+
+ +

Adds this radiobutton to be an option in the given option set (only one can be true at a time)

+

+ + + Parameters: + +
    + + + + + +
  • + + option_set + + : + + (string) + + the name of the option set to add this element to + +
  • + + + + + +
  • + + option_name + + : + + (string) + + the name of this option that will be used to identify it + +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + the define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox._prototype_radiobutton:get_store(category, internal) +
+
+
+
+ +

Gets the stored value of the radiobutton or the option set if present

+

+ + + Parameters: + +
    + + + + + +
  • + + category + + : + + (string) + + [opt] the category to get such as player name or force name + +
  • + + + + + +
  • + + internal + + : + + (boolean) + + used to prevent stackover flow + +
  • + + +
+ + + + + Returns: +
    +
  • + (any) + the value that is stored for this define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox._prototype_radiobutton:set_store(category, value, internal) +
+
+
+
+ +

Sets the stored value of the radiobutton or the option set if present

+

+ + + Parameters: + +
    + + + + + +
  • + + category + + : + + (string) + + [opt] the category to get such as player name or force name + +
  • + + + + + +
  • + + value + + : + + (boolean) + + the value to set for this define, must be valid for its type ie for checkbox etc + +
  • + + + + + +
  • + + internal + + : + + (boolean) + + used to prevent stackover flow + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the value was set +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox.new_option_set(name, callback, categorize) +
+
+
+
+ +

Registers a new option set that can be linked to radiobuttons (only one can be true at a time)

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the option set, must be unique + +
  • + + + + + +
  • + + callback + + : + + (function) + + the update callback when the value of the option set changes + callback param - value string - the new selected option for this option set + callback param - category string - the category that updated if categorize was used + +
  • + + + + + +
  • + + categorize + + : + + (function) + + the function used to convert an element into a string + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the name of this option set to be passed to add_as_option +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox.draw_option_set(name, element) +
+
+
+
+ +

Draws all radiobuttons that are part of an option set at once (Gui.draw will not work)

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the option set to draw the radiobuttons of + +
  • + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the parent element that the radiobuttons will be drawn to + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Checkbox.reset_radiobuttons(element[, exclude][, recursive=false]) +
+
+
+
+ +

Sets all radiobutton in a element to false (unless excluded) and can act recursively

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the root gui element to start setting radio buttons from + +
  • + + + + + +
  • + + exclude + + : + + (table) + + ?string|table the name of the radiobutton to exclude or a of radiobuttons where true will set the state true + + (optional) +
  • + + + + + +
  • + + recursive + + : + + (number or boolean) + + if true will recur as much as possible, if a will recur that number of times + + (default: false) +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if successful +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/expcore.gui.elements.checkboxs.html b/docs/modules/expcore.gui.elements.checkboxs.html new file mode 100644 index 00000000..de6841e3 --- /dev/null +++ b/docs/modules/expcore.gui.elements.checkboxs.html @@ -0,0 +1,848 @@ + + + + + + + + expcore.gui.elements.checkboxs module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui.elements.checkboxs module

+

Gui class define for checkboxs and radiobuttons +[[

+

+ + + + + + + + + + + + + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Checkbox.new_checkbox([name])Creates a new checkbox element define
Checkbox.new_radiobutton([name])Creates a new radiobutton element define, has all functions checkbox has
Checkbox._prototype_radiobutton:add_as_option(option_set, option_name)Adds this radiobutton to be an option in the given option set (only one can be true at a time)
Checkbox._prototype_radiobutton:get_store(category, internal)Gets the stored value of the radiobutton or the option set if present
Checkbox._prototype_radiobutton:set_store(category, value, internal)Sets the stored value of the radiobutton or the option set if present
Checkbox.new_option_set(name, callback, categorize)Registers a new option set that can be linked to radiobutotns (only one can be true at a time)
Checkbox.draw_option_set(name, element)Draws all radiobuttons that are part of an option set at once (Gui.draw will not work)
Checkbox.reset_radiobuttons(element[, exclude][, recursive=false])Sets all radiobutotn in a element to false (unless excluded) and can act recursivly
+ + +
+ + +

Functions

+
+
+
+
+ # + Checkbox.new_checkbox([name]) +
+
+
+
+ +

Creates a new checkbox element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new checkbox element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox.new_radiobutton([name]) +
+
+
+
+ +

Creates a new radiobutton element define, has all functions checkbox has

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new button element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox._prototype_radiobutton:add_as_option(option_set, option_name) +
+
+
+
+ +

Adds this radiobutton to be an option in the given option set (only one can be true at a time)

+

+ + + Parameters: + +
    + + + + + +
  • + + option_set + + : + + (string) + + the name of the option set to add this element to + +
  • + + + + + +
  • + + option_name + + : + + (string) + + the name of this option that will be used to idenitife it + +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + the define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox._prototype_radiobutton:get_store(category, internal) +
+
+
+
+ +

Gets the stored value of the radiobutton or the option set if present

+

+ + + Parameters: + +
    + + + + + +
  • + + category + + : + + (string) + + [opt] the category to get such as player name or force name + +
  • + + + + + +
  • + + internal + + : + + (boolean) + + used to prevent stackover flow + +
  • + + +
+ + + + + Returns: +
    +
  • + (any) + the value that is stored for this define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox._prototype_radiobutton:set_store(category, value, internal) +
+
+
+
+ +

Sets the stored value of the radiobutton or the option set if present

+

+ + + Parameters: + +
    + + + + + +
  • + + category + + : + + (string) + + [opt] the category to get such as player name or force name + +
  • + + + + + +
  • + + value + + : + + (boolean) + + the value to set for this define, must be valid for its type ie for checkbox etc + +
  • + + + + + +
  • + + internal + + : + + (boolean) + + used to prevent stackover flow + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the value was set +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox.new_option_set(name, callback, categorize) +
+
+
+
+ +

Registers a new option set that can be linked to radiobutotns (only one can be true at a time)

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the option set, must be unique + +
  • + + + + + +
  • + + callback + + : + + (function) + + the update callback when the value of the option set chagnes + callback param - value string - the new selected option for this option set + callback param - category string - the category that updated if categorize was used + +
  • + + + + + +
  • + + categorize + + : + + (function) + + the function used to convert an element into a string + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the name of this option set to be passed to add_as_option +
  • +
+ + + + + + + + + +
+
+
+
+ # + Checkbox.draw_option_set(name, element) +
+
+
+
+ +

Draws all radiobuttons that are part of an option set at once (Gui.draw will not work)

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the option set to draw the radiobuttons of + +
  • + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the parent element that the radiobuttons will be drawn to + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Checkbox.reset_radiobuttons(element[, exclude][, recursive=false]) +
+
+
+
+ +

Sets all radiobutotn in a element to false (unless excluded) and can act recursivly

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the root gui element to start setting radio buttons from + +
  • + + + + + +
  • + + exclude + + : + + (table) + + ?string|table the name of the radiobutton to exclude or a of radiobuttons where true will set the state true + + (optional) +
  • + + + + + +
  • + + recursive + + : + + (number or boolean) + + if true will recur as much as possible, if a will recur that number of times + + (default: false) +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if successful +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/expcore.gui.elements.dropdown.html b/docs/modules/expcore.gui.elements.dropdown.html new file mode 100644 index 00000000..15a4a3ed --- /dev/null +++ b/docs/modules/expcore.gui.elements.dropdown.html @@ -0,0 +1,874 @@ + + + + + + + + expcore.gui.elements.dropdown module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui.elements.dropdown module

+

Gui class define for dropdowns and list box +[[

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
utils.game
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Dropdown.new_dropdown([name])Creates a new dropdown element define
Dropdown.new_list_box([name])Creates a new list box element define
Dropdown._prototype:new_static_options(options[, ...], the)Adds new static options to the dropdown which will trigger the general callback
Dropdown._prototype:new_dynamic_options(callback)Adds a callback which should return a table of values to be added as options for the dropdown (appended after static options)
Dropdown._prototype:add_option_callback(option, callback)Adds a case specific callback which will only run when that option is selected (general case still triggered)
Dropdown.select_value(element, value)Selects the option from a dropdown or list box given the value rather than key
Dropdown.get_selected_value(element)Returns the currently selected value rather than index
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Dropdown.new_dropdown([name]) +
+
+
+
+ +

Creates a new dropdown element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new dropdown element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Dropdown.new_list_box([name]) +
+
+
+
+ +

Creates a new list box element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new list box element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Dropdown._prototype:new_static_options(options[, ...], the) +
+
+
+
+ +

Adds new static options to the dropdown which will trigger the general callback

+

+ + + Parameters: + +
    + + + + + +
  • + + options + + : + + (table) + + ?string|table either a of option strings or the first option string, with a table values are the options + +
  • + + + + + +
  • + + ... + + : + + (table) + + when options is not a you can add the options one after each other + + (optional) +
  • + + + + + +
  • + + the + + : + + (self) + + define to allow chaining + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Dropdown._prototype:new_dynamic_options(callback) +
+
+
+
+ +

Adds a callback which should return a table of values to be added as options for the dropdown (appended after static options)

+

+ + + Parameters: + +
    + + + + + +
  • + + callback + + : + + (function) + + the function that will run to get the options for the dropdown + callback param - player LuaPlayer - the player that the element is being drawn to + callback param - element LuaGuiElement - the element that is being drawn + callback return - table - the values of this table will be appended to the static options of the dropdown + +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + the define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Dropdown._prototype:add_option_callback(option, callback) +
+
+
+
+ +

Adds a case specific callback which will only run when that option is selected (general case still triggered)

+

+ + + Parameters: + +
    + + + + + +
  • + + option + + : + + (string) + + the name of the option to trigger the callback on; if not already added then will be added as an option + +
  • + + + + + +
  • + + callback + + : + + (function) + + the function that will be called when that option is selected + callback param - player LuaPlayer - the player who owns the gui element + callback param - element LuaGuiElement - the element which is being effected + callback param - value string - the new option that has been selected + +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + the define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Dropdown.select_value(element, value) +
+
+
+
+ +

Selects the option from a dropdown or list box given the value rather than key

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element that contains the option + +
  • + + + + + +
  • + + value + + : + + (string) + + the option to select from the dropdown + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the key where the value was +
  • +
+ + + + + + + + + +
+
+
+
+ # + Dropdown.get_selected_value(element) +
+
+
+
+ +

Returns the currently selected value rather than index

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the gui element that you want to get the value of + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the value that is currently selected +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/expcore.gui.elements.elem-button.html b/docs/modules/expcore.gui.elements.elem-button.html new file mode 100644 index 00000000..45ce8da8 --- /dev/null +++ b/docs/modules/expcore.gui.elements.elem-button.html @@ -0,0 +1,570 @@ + + + + + + + + expcore.gui.elements.elem-button module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui.elements.elem-button module

+

Gui class defines for elem buttons +[[

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
utils.game
+ + +

Functions

+ + + + + + + + + + + + +
ElemButton.new_elem_button([name])Creates a new elem button element define
ElemButton._prototype:set_default(value)Sets the default value for the elem button, this may be a function or a string
+ + +

Fields

+ + + + + + + + +
ElemButton._prototype.set_typeSets the type of the elem button, the type is required so this must be called at least once
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + ElemButton.new_elem_button([name]) +
+
+
+
+ +

Creates a new elem button element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new elem button element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + ElemButton._prototype:set_default(value) +
+
+
+
+ +

Sets the default value for the elem button, this may be a function or a string

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + (string or function) + + string a will be a static default and a function will be called when drawn to get the default + +
  • + + +
+ + + + + Returns: +
    +
  • + (the) + element define to allow for chaining +
  • +
+ + + + + + + + + +
+
+

Fields

+
+
+
+
+ # + ElemButton._prototype.set_type +
+
+
+
+ +

Sets the type of the elem button, the type is required so this must be called at least once

+

+ + + +
    + + + + + +
  • + + type + + : + + (string) + + the type that this elem button is see factorio api + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/expcore.gui.elements.progress-bar.html b/docs/modules/expcore.gui.elements.progress-bar.html new file mode 100644 index 00000000..c1809083 --- /dev/null +++ b/docs/modules/expcore.gui.elements.progress-bar.html @@ -0,0 +1,1343 @@ + + + + + + + + expcore.gui.elements.progress-bar module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui.elements.progress-bar module

+

Gui element define for progress bars +[[

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
utils.global
utils.game
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ProgressBar.set_maximum(element, amount)Sets the maximum value that represents the end value of the progress bar
ProgressBar.increment(element[, amount=1])Increases the value of the progressbar, if a define is given all of its instances have incremented
ProgressBar.decrement(element[, amount=1])Decreases the value of the progressbar, if a define is given all of its instances have decremented
ProgressBar.new_progressbar([name])Creates a new progressbar element define
ProgressBar._prototype:set_default_maximum(amount)Sets the maximum value that represents the end value of the progress bar
ProgressBar._prototype:use_count_down([state=true])Will set the progress bar to start at 1 and trigger when it hits 0
ProgressBar._prototype:increment([amount=1][, category])Increases the value of the progressbar
ProgressBar._prototype:increment_filtered([amount=1], filter)Increases the value of the progressbar, if the filter condition is met, does not work with store
ProgressBar._prototype:decrement([amount=1][, category])Decreases the value of the progressbar
ProgressBar._prototype:decrement_filtered([amount=1], filter)Decreases the value of the progressbar, if the filter condition is met, does not work with store
ProgressBar._prototype:add_element(element[, maximum])Adds an element into the list of instances that will are waiting to complete, does not work with store + note use store if you want persistent data, this only stores the elements not the values which they have
ProgressBar._prototype:reset_element(element)Resets an element, or its store, to be back at the start, either 1 or 0
ProgressBar._prototype:event_counter([filter])Event handler factory that counts up by 1 every time the event triggers, can filter which elements have incremented
ProgressBar._prototype:event_countdown([filter])Event handler factory that counts down by 1 every time the event triggers, can filter which elements have decremented
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + ProgressBar.set_maximum(element, amount) +
+
+
+
+ +

Sets the maximum value that represents the end value of the progress bar

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement or string) + + either a gui element or a registered define + +
  • + + + + + +
  • + + amount + + : + + (number) + + the amount to have set as the maximum + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar.increment(element[, amount=1]) +
+
+
+
+ +

Increases the value of the progressbar, if a define is given all of its instances have incremented

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement or string) + + either a gui element or a registered define + +
  • + + + + + +
  • + + amount + + : + + (number) + + the amount to increase the progressbar by + + (default: 1) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar.decrement(element[, amount=1]) +
+
+
+
+ +

Decreases the value of the progressbar, if a define is given all of its instances have decremented

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement or string) + + either a gui element or a registered define + +
  • + + + + + +
  • + + amount + + : + + (number) + + the amount to decrease the progressbar by + + (default: 1) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar.new_progressbar([name]) +
+
+
+
+ +

Creates a new progressbar element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new progressbar element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:set_default_maximum(amount) +
+
+
+
+ +

Sets the maximum value that represents the end value of the progress bar

+

+ + + Parameters: + +
    + + + + + +
  • + + amount + + : + + (number) + + the amount to have set as the maximum + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:use_count_down([state=true]) +
+
+
+
+ +

Will set the progress bar to start at 1 and trigger when it hits 0

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean) + + when true the bar will start filled, to be used with decrease + + (default: true) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:increment([amount=1][, category]) +
+
+
+
+ +

Increases the value of the progressbar

+

+ + + Parameters: + +
    + + + + + +
  • + + amount + + : + + (number) + + the amount to increase the progressbar by + + (default: 1) +
  • + + + + + +
  • + + category + + : + + (string) + + the category that is used with a store + + (optional) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:increment_filtered([amount=1], filter) +
+
+
+
+ +

Increases the value of the progressbar, if the filter condition is met, does not work with store

+

+ + + Parameters: + +
    + + + + + +
  • + + amount + + : + + (number) + + the amount to increase the progressbar by + + (default: 1) +
  • + + + + + +
  • + + filter + + : + + (function) + + the filter to be used + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:decrement([amount=1][, category]) +
+
+
+
+ +

Decreases the value of the progressbar

+

+ + + Parameters: + +
    + + + + + +
  • + + amount + + : + + (number) + + the amount to decrease the progressbar by + + (default: 1) +
  • + + + + + +
  • + + category + + : + + (string) + + the category that is used with a store + + (optional) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:decrement_filtered([amount=1], filter) +
+
+
+
+ +

Decreases the value of the progressbar, if the filter condition is met, does not work with store

+

+ + + Parameters: + +
    + + + + + +
  • + + amount + + : + + (number) + + the amount to decrease the progressbar by + + (default: 1) +
  • + + + + + +
  • + + filter + + : + + (function) + + the filter to be used + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:add_element(element[, maximum]) +
+
+
+
+ +

Adds an element into the list of instances that will are waiting to complete, does not work with store + note use store if you want persistent data, this only stores the elements not the values which they have

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element that you want to add into the waiting to complete list + +
  • + + + + + +
  • + + maximum + + : + + (number) + + the maximum for this element if not given the default for this define is used + + (optional) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:reset_element(element) +
+
+
+
+ +

Resets an element, or its store, to be back at the start, either 1 or 0

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element that you want to reset the progress of + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:event_counter([filter]) +
+
+
+
+ +

Event handler factory that counts up by 1 every time the event triggers, can filter which elements have incremented

+

+ + + Parameters: + +
    + + + + + +
  • + + filter + + : + + (function) + + when given will use filtered increment + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (function) + the event handler +
  • +
+ + + + + + + + + +
+
+
+
+ # + ProgressBar._prototype:event_countdown([filter]) +
+
+
+
+ +

Event handler factory that counts down by 1 every time the event triggers, can filter which elements have decremented

+

+ + + Parameters: + +
    + + + + + +
  • + + filter + + : + + (function) + + when given will use filtered decrement + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (function) + the event handler +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/expcore.gui.elements.slider.html b/docs/modules/expcore.gui.elements.slider.html new file mode 100644 index 00000000..394a0754 --- /dev/null +++ b/docs/modules/expcore.gui.elements.slider.html @@ -0,0 +1,673 @@ + + + + + + + + expcore.gui.elements.slider module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui.elements.slider module

+

Gui class define for sliders +[[

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
expcore.gui.instances
utils.game
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + +
Slider.new_slider([name])Creates a new slider element define
Slider._prototype:set_range([min][, max])Sets the range of a slider, if not used will use default values for a slider
Slider._prototype:draw_label(element)Draws a new label and links its value to the value of this slider, if no store then it will only show one value per player
Slider._prototype:enable_auto_draw_label([state=true])Enables auto draw of the label, the label will share the same parent element as the slider
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.instances +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Slider.new_slider([name]) +
+
+
+
+ +

Creates a new slider element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new slider element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Slider._prototype:set_range([min][, max]) +
+
+
+
+ +

Sets the range of a slider, if not used will use default values for a slider

+

+ + + Parameters: + +
    + + + + + +
  • + + min + + : + + (number) + + the minimum value that the slider can take + + (optional) +
  • + + + + + +
  • + + max + + : + + (number) + + the maximum value that the slider can take + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + the define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Slider._prototype:draw_label(element) +
+
+
+
+ +

Draws a new label and links its value to the value of this slider, if no store then it will only show one value per player

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the parent element that the label will be drawn to + +
  • + + +
+ + + + + Returns: +
    +
  • + (LuaGuiElement) + the new label element so that styles can be applied +
  • +
+ + + + + + + + + +
+
+
+
+ # + Slider._prototype:enable_auto_draw_label([state=true]) +
+
+
+
+ +

Enables auto draw of the label, the label will share the same parent element as the slider

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean) + + when false will disable the auto draw of the label + + (default: true) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + the define to allow chaining +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/expcore.gui.elements.text.html b/docs/modules/expcore.gui.elements.text.html new file mode 100644 index 00000000..d9fca3e5 --- /dev/null +++ b/docs/modules/expcore.gui.elements.text.html @@ -0,0 +1,691 @@ + + + + + + + + expcore.gui.elements.text module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui.elements.text module

+

Gui class define for text fields and text boxes +[[

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
utils.game
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + +
Text.new_text_field([name])Creates a new text field element define
Text.new_text_box([name])Creates a new text box element define
Text._prototype_box:set_selectable([state=true])Sets the text box to be selectable
Text._prototype_box:set_word_wrap([state=true])Sets the text box to have word wrap
Text._prototype_box:set_read_only([state=true])Sets the text box to be read only
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui.core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Text.new_text_field([name]) +
+
+
+
+ +

Creates a new text field element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new text field element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Text.new_text_box([name]) +
+
+
+
+ +

Creates a new text box element define

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the new text box element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Text._prototype_box:set_selectable([state=true]) +
+
+
+
+ +

Sets the text box to be selectable

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean) + + when false will set the state to false + + (default: true) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + table the define to allow for chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Text._prototype_box:set_word_wrap([state=true]) +
+
+
+
+ +

Sets the text box to have word wrap

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean) + + when false will set the state to false + + (default: true) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + table the define to allow for chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Text._prototype_box:set_read_only([state=true]) +
+
+
+
+ +

Sets the text box to be read only

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean) + + when false will set the state to false + + (default: true) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + table the define to allow for chaining +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/expcore.gui.html b/docs/modules/expcore.gui.html new file mode 100644 index 00000000..78739a7f --- /dev/null +++ b/docs/modules/expcore.gui.html @@ -0,0 +1,246 @@ + + + + + + + + expcore.gui module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui module

+

This file combines all the other gui files

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/modules/expcore.gui.instances.html b/docs/modules/expcore.gui.instances.html new file mode 100644 index 00000000..baca9bef --- /dev/null +++ b/docs/modules/expcore.gui.instances.html @@ -0,0 +1,259 @@ + + + + + + + + expcore.gui.instances module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui.instances module

+

This file is a breakout from core which forcues on instance management of defines +[[

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/doc/modules/expcore.gui.left.html b/docs/modules/expcore.gui.left.html similarity index 100% rename from doc/modules/expcore.gui.left.html rename to docs/modules/expcore.gui.left.html diff --git a/doc/modules/expcore.gui.popups.html b/docs/modules/expcore.gui.popups.html similarity index 100% rename from doc/modules/expcore.gui.popups.html rename to docs/modules/expcore.gui.popups.html diff --git a/doc/modules/expcore.gui.progress-bar.html b/docs/modules/expcore.gui.progress-bar.html similarity index 100% rename from doc/modules/expcore.gui.progress-bar.html rename to docs/modules/expcore.gui.progress-bar.html diff --git a/docs/modules/expcore.gui.prototype.html b/docs/modules/expcore.gui.prototype.html new file mode 100644 index 00000000..dabb924e --- /dev/null +++ b/docs/modules/expcore.gui.prototype.html @@ -0,0 +1,1588 @@ + + + + + + + + expcore.gui.prototype module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui.prototype module

+

Used to create new gui prototypes see elements and concepts +[[

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
utils.game
expcore.store
expcore.gui.instances
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Constructor.event(event_name)Creates a new function to add functions to an event handler
Constructor.extend(new_prototype)Extents a prototype with the base functions of all gui prototypes, no metatables
Constructor.store(sync, callback)Creates a new function which adds a store to a gui define
Constructor.setter(value_type, key[, second_key])Creates a setter function that checks the type when a value is set
Prototype:uid()Gets the uid for the element define
Prototype:set_style(style[, function])Sets the style for the element define
Prototype:set_embedded_flow(boolean)Sets the element to be drawn inside a nameless flow, can be given a name using a function
Prototype:raise_event(event_name, ...)Raises a custom event for this define, any number of params can be given
Prototype:draw_to(element)The main function for defines, when called will draw an instance of this define to the given element + what is drawn is based on the data in draw_data which is set using other functions
Prototype:get_store(category)Gets the value in this elements store, category needed if categorize function used
Prototype:set_store(category, value)Sets the value in this elements store, category needed if categorize function used
Prototype:clear_store([category])Sets the value in this elements store to nil, category needed if categorize function used
+ + +

Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Prototype.debug_nameSets a debug alias for the define
Prototype.set_captionSets the caption for the element define
Prototype.set_tooltipSets the tooltip for the element define
Prototype.set_pre_authenticatorSets an authenticator that blocks the draw function if check fails
Prototype.set_post_authenticatorSets an authenticator that disables the element if check fails
Prototype.on_drawRegisters a callback to the on_draw event
Prototype.on_style_updateRegisters a callback to the on_style_update event
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.store +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.instances +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Constructor.event(event_name) +
+
+
+
+ +

Creates a new function to add functions to an event handler

+

+ + + Parameters: + +
    + + + + + +
  • + + event_name + + : + + (string) + + the name of the event that callbacks will be added to + +
  • + + +
+ + + + + Returns: +
    +
  • + (function) + the function used to register handlers +
  • +
+ + + + + + + + + +
+
+
+
+ # + Constructor.extend(new_prototype) +
+
+
+
+ +

Extents a prototype with the base functions of all gui prototypes, no metatables

+

+ + + Parameters: + +
    + + + + + +
  • + + new_prototype + + : + + (table) + + the prototype that you want to add the functions to + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + the same prototype but with the new functions added +
  • +
+ + + + + + + + + +
+
+
+
+ # + Constructor.store(sync, callback) +
+
+
+
+ +

Creates a new function which adds a store to a gui define

+

+ + + Parameters: + +
    + + + + + +
  • + + sync + + : + + (boolean) + + if the function should create a synced store + +
  • + + + + + +
  • + + callback + + : + + (function) + + the function called when needing to update the value of an element + +
  • + + +
+ + + + + Returns: +
    +
  • + (function) + the function that will add a store for this define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Constructor.setter(value_type, key[, second_key]) +
+
+
+
+ +

Creates a setter function that checks the type when a value is set

+

+ + + Parameters: + +
    + + + + + +
  • + + value_type + + : + + (string) + + the type that the value should be when it is set + +
  • + + + + + +
  • + + key + + : + + (string) + + the key of the define that will be set + +
  • + + + + + +
  • + + second_key + + : + + (string) + + allows for setting of a key in a sub table + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (function) + the function that will check the type and set the value +
  • +
+ + + + + + + + + +
+
+
+
+ # + Prototype:uid() +
+
+
+
+ +

Gets the uid for the element define

+

+ + + + + + Returns: +
    +
  • + (string) + the uid of this element define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Prototype:set_style(style[, function]) +
+
+
+
+ +

Sets the style for the element define

+

+ + + Parameters: + +
    + + + + + +
  • + + style + + : + + (string) + + the style that will be used for this element when drawn + +
  • + + + + + +
  • + + function + + : + + (callback) + + function is called when element is drawn to alter its style + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + the element define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Prototype:set_embedded_flow(boolean) +
+
+
+
+ +

Sets the element to be drawn inside a nameless flow, can be given a name using a function

+

+ + + Parameters: + +
    + + + + + +
  • + + boolean + + : + + (state) + + |function when true a padless flow is created to contain the element + +
  • + + +
+ + + + + Returns: +
    +
  • + (self) + the element define to allow chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Prototype:raise_event(event_name, ...) +
+
+
+
+ +

Raises a custom event for this define, any number of params can be given

+

+ + + Parameters: + +
    + + + + + +
  • + + event_name + + : + + (string) + + the name of the event that you want to raise + +
  • + + + + + +
  • + + ... + + : + + (any) + + any params that you want to pass to the event + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of handlers that were registered +
  • +
+ + + + + + + + + +
+
+
+
+ # + Prototype:draw_to(element) +
+
+
+
+ +

The main function for defines, when called will draw an instance of this define to the given element + what is drawn is based on the data in draw_data which is set using other functions

+

+ + + Parameters: + +
    + + + + + +
  • + + element + + : + + (LuaGuiElement) + + the element that the define will draw a instance of its self onto + +
  • + + +
+ + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + Prototype:get_store(category) +
+
+
+
+ +

Gets the value in this elements store, category needed if categorize function used

+

+ + + Parameters: + +
    + + + + + +
  • + + category + + : + + (string) + + [opt] the category to get such as player name or force name + +
  • + + +
+ + + + + Returns: +
    +
  • + (any) + the value that is stored for this define +
  • +
+ + + + + + + + + +
+
+
+
+ # + Prototype:set_store(category, value) +
+
+
+
+ +

Sets the value in this elements store, category needed if categorize function used

+

+ + + Parameters: + +
    + + + + + +
  • + + category + + : + + (string) + + [opt] the category to get such as player name or force name + +
  • + + + + + +
  • + + value + + : + + (any) + + the value to set for this define, must be valid for its type ie for checkbox etc + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the value was set +
  • +
+ + + + + + + + + +
+
+
+
+ # + Prototype:clear_store([category]) +
+
+
+
+ +

Sets the value in this elements store to nil, category needed if categorize function used

+

+ + + Parameters: + +
    + + + + + +
  • + + category + + : + + (string) + + the category to get such as player name or force name + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the value was set +
  • +
+ + + + + + + + + +
+
+

Fields

+
+
+
+
+ # + Prototype.debug_name +
+
+
+
+ +

Sets a debug alias for the define

+

+ + + +
    + + + + + +
  • + + name + + : + + (string) + + the debug name for the element define that can be used to get this element define + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Prototype.set_caption +
+
+
+
+ +

Sets the caption for the element define

+

+ + + +
    + + + + + +
  • + + caption + + : + + (string) + + the caption that will be drawn with the element + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Prototype.set_tooltip +
+
+
+
+ +

Sets the tooltip for the element define

+

+ + + +
    + + + + + +
  • + + tooltip + + : + + (string) + + the tooltip that will be displayed for this element when drawn + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Prototype.set_pre_authenticator +
+
+
+
+ +

Sets an authenticator that blocks the draw function if check fails

+

+ + + +
    + + + + + +
  • + + callback + + : + + (function) + + the function that will be ran to test if the element should be drawn or not + callback param - LuaPlayer player - the player that the element is being drawn to + callback param - string define_name - the name of the define that is being drawn + callback return - boolean - false will stop the element from being drawn + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Prototype.set_post_authenticator +
+
+
+
+ +

Sets an authenticator that disables the element if check fails

+

+ + + +
    + + + + + +
  • + + callback + + : + + (function) + + the function that will be ran to test if the element should be enabled or not + callback param - LuaPlayer player - the player that the element is being drawn to + callback param - string define_name - the name of the define that is being drawn + callback return - boolean - false will disable the element + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Prototype.on_draw +
+
+
+
+ +

Registers a callback to the on_draw event

+

+ + + +
    + + + + + +
  • + + callback + + : + + (function) + + + callback param - LuaPlayer player - the player that the element was drawn to + callback param - LuaGuiElement element - the element that was drawn + callback param - any ... - any other params passed by the draw_to function + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Prototype.on_style_update +
+
+
+
+ +

Registers a callback to the on_style_update event

+

+ + + +
    + + + + + +
  • + + callback + + : + + (function) + + + callback param - LuaStyle style - the style that was changed and/or needs changing + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/doc/modules/expcore.gui.slider.html b/docs/modules/expcore.gui.slider.html similarity index 100% rename from doc/modules/expcore.gui.slider.html rename to docs/modules/expcore.gui.slider.html diff --git a/docs/modules/expcore.gui.test.html b/docs/modules/expcore.gui.test.html new file mode 100644 index 00000000..eefdb376 --- /dev/null +++ b/docs/modules/expcore.gui.test.html @@ -0,0 +1,429 @@ + + + + + + + + expcore.gui.test module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.gui.test module

+

This file creates a test gui that is used to test every input method + note that this does not cover every permutation only features in independence + for example store in most cases is just by player name, but other store methods are tested with checkbox

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + +
expcore.gui
expcore.common
resources.color_presets
utils.event
expcore.store
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.store +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/doc/modules/expcore.gui.text.html b/docs/modules/expcore.gui.text.html similarity index 100% rename from doc/modules/expcore.gui.text.html rename to docs/modules/expcore.gui.text.html diff --git a/doc/modules/expcore.gui.toolbar.html b/docs/modules/expcore.gui.toolbar.html similarity index 100% rename from doc/modules/expcore.gui.toolbar.html rename to docs/modules/expcore.gui.toolbar.html diff --git a/docs/modules/expcore.permission_groups.html b/docs/modules/expcore.permission_groups.html new file mode 100644 index 00000000..72805bd0 --- /dev/null +++ b/docs/modules/expcore.permission_groups.html @@ -0,0 +1,1394 @@ + + + + + + + + expcore.permission_groups module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.permission_groups module

+

Permission group making for factorio so you never have to make one by hand again +[[-- Core Module - Permission Groups

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
utils.game
utils.event
expcore.sudo
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Permissions_Groups.new_group(name)Defines a new permission group that can have it actions set in the config
Permissions_Groups.get_group_by_name(name)Returns the group with the given name, case sensitive
Permissions_Groups.get_group_from_player(player)Returns the group that a player is in
Permissions_Groups.reload_permissions()Reloads/creates all permission groups and sets them to they configured state
Permissions_Groups.lockdown_permissions(exempt)Removes all permissions from every permission group except for "Default" and any passed as exempt
Permissions_Groups.set_player_group(player, group)Sets a player's group to the one given, a player can only have one group at a time
Permissions_Groups._prototype:set_action(action, state)Sets the allow state of an action for this group, used internally but is safe to use else where
Permissions_Groups._prototype:allow(actions)Sets an action or actions to be allowed for this group even with disallow_all triggered, Do not use in runtime
Permissions_Groups._prototype:disallow(actions)Sets an action or actions to be disallowed for this group even with allow_all triggered, Do not use in runtime
Permissions_Groups._prototype:allow_all()Sets the default state for any actions not given to be allowed, useful with :disallow
Permissions_Groups._prototype:disallow_all()Sets the default state for any action not given to be disallowed, useful with :allow
Permissions_Groups._prototype:is_allowed(action)Returns if an input action is allowed for this group
Permissions_Groups._prototype:get_raw()Returns the LuaPermissionGroup that was created with this group object, used internally
Permissions_Groups._prototype:create()Creates or updates the permission group with the configured actions, used internally
Permissions_Groups._prototype:add_player(player)Adds a player to this group
Permissions_Groups._prototype:remove_player(player)Removes a player from this group
Permissions_Groups._prototype:get_players([online])Returns all player that are in this group with the option to filter to online/offline only
Permissions_Groups._prototype:print(message)Prints a message to every player in this group
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.sudo +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Permissions_Groups.new_group(name) +
+
+
+
+ +

Defines a new permission group that can have it actions set in the config

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the new group + +
  • + + +
+ + + + + Returns: +
    +
  • + (Permissions_Groups._prototype) + the new group made with function to allow and disallow actions +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups.get_group_by_name(name) +
+
+
+
+ +

Returns the group with the given name, case sensitive

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the group to get + +
  • + + +
+ + + + + Returns: +
    +
  • + (Permissions_Groups._prototype or nil) + the group with that name or nil if non found +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups.get_group_from_player(player) +
+
+
+
+ +

Returns the group that a player is in

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the group of can be name index etc + +
  • + + +
+ + + + + Returns: +
    +
  • + (Permissions_Groups._prototype or nil) + the group with that player or nil if non found +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups.reload_permissions() +
+
+
+
+ +

Reloads/creates all permission groups and sets them to they configured state

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + Permissions_Groups.lockdown_permissions(exempt) +
+
+
+
+ +

Removes all permissions from every permission group except for "Default" and any passed as exempt

+

+ + + Parameters: + +
    + + + + + +
  • + + exempt + + : + + (string or Array) + + groups that you want to be except, "Default" is always exempt + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of groups that had they permissions removed +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups.set_player_group(player, group) +
+
+
+
+ +

Sets a player's group to the one given, a player can only have one group at a time

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to effect can be name index etc + +
  • + + + + + +
  • + + group + + : + + (string) + + the name of the group to give to the player + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player was added successfully, false other wise +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:set_action(action, state) +
+
+
+
+ +

Sets the allow state of an action for this group, used internally but is safe to use else where

+

+ + + Parameters: + +
    + + + + + +
  • + + action + + : + + (string or defines.input_action) + + the action that you want to set the state of + +
  • + + + + + +
  • + + state + + : + + (boolean) + + the state that you want to set it to, true = allow, false = disallow + +
  • + + +
+ + + + + Returns: +
    +
  • + (Permissions_Groups._prototype) + returns self so function can be chained +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:allow(actions) +
+
+
+
+ +

Sets an action or actions to be allowed for this group even with disallow_all triggered, Do not use in runtime

+

+ + + Parameters: + +
    + + + + + +
  • + + actions + + : + + (string or Array) + + the action or actions that you want to allow for this group + +
  • + + +
+ + + + + Returns: +
    +
  • + (Permissions_Groups._prototype) + returns self so function can be chained +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:disallow(actions) +
+
+
+
+ +

Sets an action or actions to be disallowed for this group even with allow_all triggered, Do not use in runtime

+

+ + + Parameters: + +
    + + + + + +
  • + + actions + + : + + (string or Array) + + the action or actions that you want to disallow for this group + +
  • + + +
+ + + + + Returns: +
    +
  • + (Permissions_Groups._prototype) + returns self so function can be chained +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:allow_all() +
+
+
+
+ +

Sets the default state for any actions not given to be allowed, useful with :disallow

+

+ + + + + + Returns: +
    +
  • + (Permissions_Groups._prototype) + returns self so function can be chained +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:disallow_all() +
+
+
+
+ +

Sets the default state for any action not given to be disallowed, useful with :allow

+

+ + + + + + Returns: +
    +
  • + (Permissions_Groups._prototype) + returns self so function can be chained +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:is_allowed(action) +
+
+
+
+ +

Returns if an input action is allowed for this group

+

+ + + Parameters: + + + + + + + Returns: +
    +
  • + (boolean) + true if the group is allowed the action, false other wise +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:get_raw() +
+
+
+
+ +

Returns the LuaPermissionGroup that was created with this group object, used internally

+

+ + + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:create() +
+
+
+
+ +

Creates or updates the permission group with the configured actions, used internally

+

+ + + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:add_player(player) +
+
+
+
+ +

Adds a player to this group

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + LuaPlayer the player you want to add to this group can be name or index etc + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player was added successfully, false other wise +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:remove_player(player) +
+
+
+
+ +

Removes a player from this group

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + LuaPlayer the player you want to remove from this group can be name or index etc + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player was removed successfully, false other wise +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:get_players([online]) +
+
+
+
+ +

Returns all player that are in this group with the option to filter to online/offline only

+

+ + + Parameters: + +
    + + + + + +
  • + + online + + : + + (boolean) + + if nil returns all players, if true online players only, if false returns online players only + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + a table of players that are in this group; filtered if online param is given +
  • +
+ + + + + + + + + +
+
+
+
+ # + Permissions_Groups._prototype:print(message) +
+
+
+
+ +

Prints a message to every player in this group

+

+ + + Parameters: + +
    + + + + + +
  • + + message + + : + + (string) + + the message that you want to send to the players + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of players that received the message +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/expcore.roles.html b/docs/modules/expcore.roles.html new file mode 100644 index 00000000..82ac20aa --- /dev/null +++ b/docs/modules/expcore.roles.html @@ -0,0 +1,2981 @@ + + + + + + + + expcore.roles module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.roles module

+

Factorio role system to manage custom permissions

+

+[[

+ + + +
    +
  • Author: Cooldude2606
  • +
+ + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + + + + +
utils.game
utils.global
utils.event
expcore.permission_groups
expcore.sudo
resources.color_presets
expcore.common
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Roles.debug()Returns a string which contains all roles in index order displaying all data for them
Roles.print_to_roles(roles, message)Prints a message to all players in the given roles, may send duplicate message however factorio blocks spam
Roles.print_to_roles_higher(role, message)Prints a message to all players who have the given role or one which is higher (excluding default)
Roles.print_to_roles_lower(role, message)Prints a message to all players who have the given role or one which is lower (excluding default)
Roles.get_role_by_name(name)Get a role for the given name
Roles.get_role_by_order(index)Get a role with the given order index
Roles.get_role_from_any(any)Gets a role from a name,index or role object (where it is just returned) + nb: this function is used for the input for most outward facing functions
Roles.get_player_roles(player)Gets all the roles of the given player, this will always contain the default role
Roles.get_player_highest_role(player)Gets the highest role which the player has, can be used to compeer one player to another
Roles.assign_player(player, roles[, by_player_name=][, silent=false])Gives a player the given role(s) with an option to pass a by player name used in the log
Roles.unassign_player(player, roles[, by_player_name=][, silent=false])Removes a player from the given role(s) with an option to pass a by player name used in the log
Roles.override_player_roles(roles)Overrides all player roles with the given table of roles, useful to mass set roles on game start
Roles.player_has_role(player, search_role)A test for weather a player has the given role
Roles.player_has_flag(player, flag_name)A test for weather a player has the given flag true for at least one of they roles
Roles.player_allowed(player, action)A test for weather a player has at least one role which is allowed the given action
Roles.define_role_order(order)Used to set the role order, higher in the list is better, must be called at least once in config + nb: function also re links parents due to expected position in the config file
Roles.define_flag_trigger(name, callback)Defines a new trigger for when a tag is added or removed from a player
Roles.set_default(name)Sets the default role which every player will have, this needs to be called at least once
Roles.set_root(name)Sets the root role which will always have all permissions, any server actions act from this role
Roles.new_role(name[, short_hand=name])Defines a new role and returns the prototype to allow configuration
Roles._prototype:set_allow_all([state=true])Sets the default allow state of the role, true will allow all actions
Roles._prototype:allow(actions)Sets the allow actions for this role, actions in this list will be allowed for this role
Roles._prototype:disallow(actions)Sets the disallow actions for this role, will prevent actions from being allowed regardless of inheritance
Roles._prototype:is_allowed(action)Test for if a role is allowed the given action, mostly internal see Roles.player_allowed
Roles._prototype:set_flag(name[, value=true])Sets the state of a flag for a role, flags can be used to apply effects to players
Roles._prototype:clear_flags()Clears all flags from this role, individual flags can be removed with set_flag(name,false)
Roles._prototype:has_flag(name)A test for if the role has a flag set
Roles._prototype:set_custom_tag(tag)Sets a custom player tag for the role, can be accessed by other code
Roles._prototype:set_custom_color(color)Sets a custom colour for the role, can be accessed by other code
Roles._prototype:set_permission_group(name[, use_factorio_api=false])Sets the permission group for this role, players will be moved to the group of they highest role
Roles._prototype:set_parent(role)Sets the parent for a role, any action not in allow or disallow will be looked for in its parents + nb: this is a recursive action, and changing the allows and disallows will effect all children roles
Roles._prototype:set_auto_promote_condition(callback)Sets an auto promote condition that is checked every 5 seconds, if true is returned then the player will receive the role + nb: this is one way, failing false after already gaining the role will not revoke the role
Roles._prototype:set_block_auto_promote([state=true])Sets the role to not allow players to have auto promote effect them, useful to keep people locked to a punishment
Roles._prototype:add_player(player, skip_check, skip_event)Adds a player to this role, players can have more than one role at a time, used internally see Roles.assign
Roles._prototype:remove_player(player, skip_check, skip_event)Removes a player from this role, players can have more than one role at a time, used internally see Roles.unassign
Roles._prototype:get_players([online=nil])Returns an array of all the players who have this role, can be filtered by online status
Roles._prototype:print(message)Will print a message to all players with this role
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.permission_groups +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.sudo +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Roles.debug() +
+
+
+
+ +

Returns a string which contains all roles in index order displaying all data for them

+

+ + + + + + Returns: +
    +
  • + (string) + the debug output string +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles.print_to_roles(roles, message) +
+
+
+
+ +

Prints a message to all players in the given roles, may send duplicate message however factorio blocks spam

+

+ + + Parameters: + +
    + + + + + +
  • + + roles + + : + + (table) + + table a of roles which to send the message to + +
  • + + + + + +
  • + + message + + : + + (string) + + the message to send to the players + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Roles.print_to_roles_higher(role, message) +
+
+
+
+ +

Prints a message to all players who have the given role or one which is higher (excluding default)

+

+ + + Parameters: + +
    + + + + + +
  • + + role + + : + + (string) + + the name of the role to send the message to + +
  • + + + + + +
  • + + message + + : + + (string) + + the message to send to the players + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Roles.print_to_roles_lower(role, message) +
+
+
+
+ +

Prints a message to all players who have the given role or one which is lower (excluding default)

+

+ + + Parameters: + +
    + + + + + +
  • + + role + + : + + (string) + + the name of the role to send the message to + +
  • + + + + + +
  • + + message + + : + + (string) + + the message to send to the players + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Roles.get_role_by_name(name) +
+
+
+
+ +

Get a role for the given name

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the role to get + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + the role with that name or nil +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles.get_role_by_order(index) +
+
+
+
+ +

Get a role with the given order index

+

+ + + Parameters: + +
    + + + + + +
  • + + index + + : + + (number) + + the place in the order list of the role to get + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + the role with that index in the order list or nil +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles.get_role_from_any(any) +
+
+
+
+ +

Gets a role from a name,index or role object (where it is just returned) + nb: this function is used for the input for most outward facing functions

+

+ + + Parameters: + +
    + + + + + +
  • + + any + + : + + (number, string or table) + + the value used to find the role + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + the role that was found or nil see above +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles.get_player_roles(player) +
+
+
+
+ +

Gets all the roles of the given player, this will always contain the default role

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the roles of + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + a table where the values are the roles which the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles.get_player_highest_role(player) +
+
+
+
+ +

Gets the highest role which the player has, can be used to compeer one player to another

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the highest role of + +
  • + + +
+ + + + + Returns: +
    +
  • + (the) + role with the highest order index which this player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles.assign_player(player, roles[, by_player_name=][, silent=false]) +
+
+
+
+ +

Gives a player the given role(s) with an option to pass a by player name used in the log

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will be assigned the roles + +
  • + + + + + +
  • + + roles + + : + + (table) + + table a of roles that the player will be given, can be one role and can be role names + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player that will be shown in the log + + (default: ) +
  • + + + + + +
  • + + silent + + : + + (boolean) + + when true there will be no game message printed + + (default: false) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Roles.unassign_player(player, roles[, by_player_name=][, silent=false]) +
+
+
+
+ +

Removes a player from the given role(s) with an option to pass a by player name used in the log

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will have the roles removed + +
  • + + + + + +
  • + + roles + + : + + (table) + + table a of roles to be removed from the player, can be one role and can be role names + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player that will be shown in the logs + + (default: ) +
  • + + + + + +
  • + + silent + + : + + (boolean) + + when true there will be no game message printed + + (default: false) +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Roles.override_player_roles(roles) +
+
+
+
+ +

Overrides all player roles with the given table of roles, useful to mass set roles on game start

+

+ + + Parameters: + +
    + + + + + +
  • + + roles + + : + + (table) + + table a which is indexed by case sensitive player names and has the value of a table of role names + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Roles.player_has_role(player, search_role) +
+
+
+
+ +

A test for weather a player has the given role

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to test the roles of + +
  • + + + + + +
  • + + search_role + + : + + (string, number or table) + + a pointer to the role that is being searched for + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player has the role, false otherwise, nil for errors +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles.player_has_flag(player, flag_name) +
+
+
+
+ +

A test for weather a player has the given flag true for at least one of they roles

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to test the roles of + +
  • + + + + + +
  • + + flag_name + + : + + (string) + + the name of the flag that is being looked for + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player has at least one role which has the flag set to true, false otherwise, nil for errors +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles.player_allowed(player, action) +
+
+
+
+ +

A test for weather a player has at least one role which is allowed the given action

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to test the roles of + +
  • + + + + + +
  • + + action + + : + + (string) + + the name of the action that is being tested for + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player has at least one role which is allowed this action, false otherwise, nil for errors +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles.define_role_order(order) +
+
+
+
+ +

Used to set the role order, higher in the list is better, must be called at least once in config + nb: function also re links parents due to expected position in the config file

+

+ + + Parameters: + +
    + + + + + +
  • + + order + + : + + (table) + + table a which is keyed only by numbers (start 1) and values are roles in order with highest first + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Roles.define_flag_trigger(name, callback) +
+
+
+
+ +

Defines a new trigger for when a tag is added or removed from a player

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the flag which the roles will have + +
  • + + + + + +
  • + + callback + + : + + (function) + + the function that is called when roles are assigned + flag param - player - the player that has had they roles changed + flag param - state - the state of the flag, aka if the flag is present + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Roles.set_default(name) +
+
+
+
+ +

Sets the default role which every player will have, this needs to be called at least once

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the default role + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Roles.set_root(name) +
+
+
+
+ +

Sets the root role which will always have all permissions, any server actions act from this role

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the root role + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Roles.new_role(name[, short_hand=name]) +
+
+
+
+ +

Defines a new role and returns the prototype to allow configuration

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the new role, must be unique + +
  • + + + + + +
  • + + short_hand + + : + + (string) + + the shortened version of the name + + (default: name) +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + the start of the config chain for this role +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:set_allow_all([state=true]) +
+
+
+
+ +

Sets the default allow state of the role, true will allow all actions

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean) + + true will allow all actions + + (default: true) +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:allow(actions) +
+
+
+
+ +

Sets the allow actions for this role, actions in this list will be allowed for this role

+

+ + + Parameters: + +
    + + + + + +
  • + + actions + + : + + (table) + + indexed with numbers and is an array of action names, order has no effect + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:disallow(actions) +
+
+
+
+ +

Sets the disallow actions for this role, will prevent actions from being allowed regardless of inheritance

+

+ + + Parameters: + +
    + + + + + +
  • + + actions + + : + + (table) + + indexed with numbers and is an array of action names, order has no effect + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:is_allowed(action) +
+
+
+
+ +

Test for if a role is allowed the given action, mostly internal see Roles.player_allowed

+

+ + + Parameters: + +
    + + + + + +
  • + + action + + : + + (string) + + the name of the action to test if it is allowed + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if action is allowed, false otherwise +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:set_flag(name[, value=true]) +
+
+
+
+ +

Sets the state of a flag for a role, flags can be used to apply effects to players

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the flag to set the value of + +
  • + + + + + +
  • + + value + + : + + (boolean) + + the state to set the flag to + + (default: true) +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:clear_flags() +
+
+
+
+ +

Clears all flags from this role, individual flags can be removed with set_flag(name,false)

+

+ + + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:has_flag(name) +
+
+
+
+ +

A test for if the role has a flag set

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the flag to test for + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the flag is set, false otherwise +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:set_custom_tag(tag) +
+
+
+
+ +

Sets a custom player tag for the role, can be accessed by other code

+

+ + + Parameters: + +
    + + + + + +
  • + + tag + + : + + (string) + + the value that the tag will be + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:set_custom_color(color) +
+
+
+
+ +

Sets a custom colour for the role, can be accessed by other code

+

+ + + Parameters: + +
    + + + + + +
  • + + color + + : + + (table) + + ?string|table can either be and rgb colour or the name of a colour defined in the presets + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:set_permission_group(name[, use_factorio_api=false]) +
+
+
+
+ +

Sets the permission group for this role, players will be moved to the group of they highest role

+

+ + + Parameters: + +
    + + + + + +
  • + + name + + : + + (string) + + the name of the permission group to have players moved to + +
  • + + + + + +
  • + + use_factorio_api + + : + + (boolean) + + when true the custom permission group module is ignored + + (default: false) +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:set_parent(role) +
+
+
+
+ +

Sets the parent for a role, any action not in allow or disallow will be looked for in its parents + nb: this is a recursive action, and changing the allows and disallows will effect all children roles

+

+ + + Parameters: + +
    + + + + + +
  • + + role + + : + + (string) + + the name of the role that will be the parent; has imminent effect if role is already defined + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:set_auto_promote_condition(callback) +
+
+
+
+ +

Sets an auto promote condition that is checked every 5 seconds, if true is returned then the player will receive the role + nb: this is one way, failing false after already gaining the role will not revoke the role

+

+ + + Parameters: + +
    + + + + + +
  • + + callback + + : + + (function) + + receives only one param which is player to promote, return true to promote the player + +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:set_block_auto_promote([state=true]) +
+
+
+
+ +

Sets the role to not allow players to have auto promote effect them, useful to keep people locked to a punishment

+

+ + + Parameters: + +
    + + + + + +
  • + + state + + : + + (boolean) + + when true the players with this role will not be auto promoted + + (default: true) +
  • + + +
+ + + + + Returns: +
    +
  • + (Roles._prototype) + allows chaining +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:add_player(player, skip_check, skip_event) +
+
+
+
+ +

Adds a player to this role, players can have more than one role at a time, used internally see Roles.assign

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will be given this role + +
  • + + + + + +
  • + + skip_check + + : + + (boolean) + + when true player will be taken as the player name (use when player has not yet joined) + +
  • + + + + + +
  • + + skip_event + + : + + (boolean) + + when true the event emit will be skipped, this is used internally with Roles.assign + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player was added successfully +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:remove_player(player, skip_check, skip_event) +
+
+
+
+ +

Removes a player from this role, players can have more than one role at a time, used internally see Roles.unassign

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player that will lose this role + +
  • + + + + + +
  • + + skip_check + + : + + (boolean) + + when true player will be taken as the player name (use when player has not yet joined) + +
  • + + + + + +
  • + + skip_event + + : + + (boolean) + + when true the event emit will be skipped, this is used internally with Roles.unassign + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if the player was removed successfully +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:get_players([online=nil]) +
+
+
+
+ +

Returns an array of all the players who have this role, can be filtered by online status

+

+ + + Parameters: + +
    + + + + + +
  • + + online + + : + + (boolean) + + when given will filter by this online state, nil will return all players + + (default: nil) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + all the players who have this role, indexed order is meaningless +
  • +
+ + + + + + + + + +
+
+
+
+ # + Roles._prototype:print(message) +
+
+
+
+ +

Will print a message to all players with this role

+

+ + + Parameters: + +
    + + + + + +
  • + + message + + : + + (string) + + the message that will be printed to the players + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of players who received the message +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/expcore.store.html b/docs/modules/expcore.store.html new file mode 100644 index 00000000..8275edad --- /dev/null +++ b/docs/modules/expcore.store.html @@ -0,0 +1,972 @@ + + + + + + + + expcore.store module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.store module

+

Adds an easy way to store and watch for updates to a value +[[

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + +
utils.global
utils.event
expcore.common
utils.token
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Store.is_registered(location)Check for if a location is registered
Store.uid_location()Returns a unique name that can be used for a store
Store.register([location][, synced][, callback])Registers a new location with an update callback which is triggered when the value updates
Store.get(location[, child][, allow_unregistered=false])Gets the value stored at a location, this location must be registered
Store.set(location[, child], value[, from_sync])Sets the value at a location, this location must be registered
Store.clear(location[, child][, from_sync])Sets the value at a location to nil, this location must be registered
Store.get_children(location)Gets all non nil children at a location, children can be added and removed during runtime + this is similar to Store.get but will always return a table even if it is empty
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.token +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Store.is_registered(location) +
+
+
+
+ +

Check for if a location is registered

+

+ + + Parameters: + +
    + + + + + +
  • + + location + + : + + (string) + + the location to test for + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if registered +
  • +
+ + + + + + + + + +
+
+
+
+ # + Store.uid_location() +
+
+
+
+ +

Returns a unique name that can be used for a store

+

+ + + + + + Returns: +
    +
  • + (string) + a unique name +
  • +
+ + + + + + + + + +
+
+
+
+ # + Store.register([location][, synced][, callback]) +
+
+
+
+ +

Registers a new location with an update callback which is triggered when the value updates

+

+ + + Parameters: + +
    + + + + + +
  • + + location + + : + + (string) + + string a unique that points to the data, string used rather than token to allow migration + + (optional) +
  • + + + + + +
  • + + synced + + : + + (boolean) + + when true will output changes to a file so it can be synced + + (optional) +
  • + + + + + +
  • + + callback + + : + + (function) + + when given the callback will be automatically registered to the update of the value + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the location that is being used +
  • +
+ + + + + + + + + +
+
+
+
+ # + Store.get(location[, child][, allow_unregistered=false]) +
+
+
+
+ +

Gets the value stored at a location, this location must be registered

+

+ + + Parameters: + +
    + + + + + +
  • + + location + + : + + (string) + + the location to get the data from + +
  • + + + + + +
  • + + child + + : + + (string) + + the child location if required + + (optional) +
  • + + + + + +
  • + + allow_unregistered + + : + + (boolean) + + when true no error is returned if the location is not registered + + (default: false) +
  • + + +
+ + + + + Returns: +
    +
  • + (any) + the data which was stored at the location +
  • +
+ + + + + + + + + +
+
+
+
+ # + Store.set(location[, child], value[, from_sync]) +
+
+
+
+ +

Sets the value at a location, this location must be registered

+

+ + + Parameters: + +
    + + + + + +
  • + + location + + : + + (string) + + the location to set the data to + +
  • + + + + + +
  • + + child + + : + + (string) + + the child location if required + + (optional) +
  • + + + + + +
  • + + value + + : + + (any) + + the new value to set at the location, value may be reverted if there is a watch callback, cant be nil + +
  • + + + + + +
  • + + from_sync + + : + + (boolean) + + set this true to avoid an output to the sync file + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if it was successful +
  • +
+ + + + + + + + + +
+
+
+
+ # + Store.clear(location[, child][, from_sync]) +
+
+
+
+ +

Sets the value at a location to nil, this location must be registered

+

+ + + Parameters: + +
    + + + + + +
  • + + location + + : + + (string) + + the location to set the data to + +
  • + + + + + +
  • + + child + + : + + (string) + + the child location if required + + (optional) +
  • + + + + + +
  • + + from_sync + + : + + (boolean) + + set this true to avoid an output to the sync file + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true if it was successful +
  • +
+ + + + + + + + + +
+
+
+
+ # + Store.get_children(location) +
+
+
+
+ +

Gets all non nil children at a location, children can be added and removed during runtime + this is similar to Store.get but will always return a table even if it is empty

+

+ + + Parameters: + +
    + + + + + +
  • + + location + + : + + (string) + + the location to get the children of + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + a table containing all the children names +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/expcore.sudo.html b/docs/modules/expcore.sudo.html new file mode 100644 index 00000000..a1ac274b --- /dev/null +++ b/docs/modules/expcore.sudo.html @@ -0,0 +1,254 @@ + + + + + + + + expcore.sudo module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

expcore.sudo module

+

An extention of task and token to allow a single require to register and run functions bypassing all permissions +[[

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/modules/gui.player-list.html b/docs/modules/gui.player-list.html new file mode 100644 index 00000000..496ec30a --- /dev/null +++ b/docs/modules/gui.player-list.html @@ -0,0 +1,71 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module gui.player-list

+

Gui left frame define for a player list

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-06-21 19:36:35 +
+
+ + diff --git a/docs/modules/gui.rocket-info.html b/docs/modules/gui.rocket-info.html new file mode 100644 index 00000000..70702c2a --- /dev/null +++ b/docs/modules/gui.rocket-info.html @@ -0,0 +1,100 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module gui.rocket-info

+

Adds a rocket infomation gui which shows general stats, milestones and build progress of rockets

+

+ + +

Fields

+ + + + + +
header_area.captionRight aligned button to toggle the section
+ +
+
+ + +

Fields

+ +
+
+ + header_area.caption +
+
+ Right aligned button to toggle the section + + + + + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-06-21 19:36:35 +
+
+ + diff --git a/docs/modules/gui.science-info.html b/docs/modules/gui.science-info.html new file mode 100644 index 00000000..105102cd --- /dev/null +++ b/docs/modules/gui.science-info.html @@ -0,0 +1,71 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module gui.science-info

+

Adds a science info gui that shows production usage and net for the different science packs as well as an eta

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-06-21 19:36:35 +
+
+ + diff --git a/docs/modules/gui.task-list.html b/docs/modules/gui.task-list.html new file mode 100644 index 00000000..8af36bc8 --- /dev/null +++ b/docs/modules/gui.task-list.html @@ -0,0 +1,71 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module gui.task-list

+

Adds a task list to the game which players can add remove and edit items on

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-06-21 19:36:35 +
+
+ + diff --git a/docs/modules/modules.addons.advanced-start.html b/docs/modules/modules.addons.advanced-start.html new file mode 100644 index 00000000..a17f317a --- /dev/null +++ b/docs/modules/modules.addons.advanced-start.html @@ -0,0 +1,349 @@ + + + + + + + + modules.addons.advanced-start module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

modules.addons.advanced-start module

+

Adds a better method of player starting items based on production levels.

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
utils.event
utils.game
config.advanced_start
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.advanced_start +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/modules.addons.chat-popups.html b/docs/modules/modules.addons.chat-popups.html new file mode 100644 index 00000000..9caa5cfd --- /dev/null +++ b/docs/modules/modules.addons.chat-popups.html @@ -0,0 +1,350 @@ + + + + + + + + modules.addons.chat-popups module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

modules.addons.chat-popups module

+

Creates flying text entities when a player sends a message in chat + also displays a ping above users who are named in the message

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
utils.game
utils.event
config.popup_messages
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.popup_messages +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/modules.addons.damage-popups.html b/docs/modules/modules.addons.damage-popups.html new file mode 100644 index 00000000..4a119a6f --- /dev/null +++ b/docs/modules/modules.addons.damage-popups.html @@ -0,0 +1,350 @@ + + + + + + + + modules.addons.damage-popups module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

modules.addons.damage-popups module

+

Displays the amount of dmg that is done by players to entities + also shows player health when a player is attacked

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
utils.game
utils.event
config.popup_messages
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.popup_messages +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/modules.control.production.html b/docs/modules/modules.control.production.html new file mode 100644 index 00000000..30718ab0 --- /dev/null +++ b/docs/modules/modules.control.production.html @@ -0,0 +1,1281 @@ + + + + + + + + modules.control.production module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

modules.control.production module

+

Control Module - Production + - Common functions used to track production of items

+

+ + + + + + +

Usage

+

+    -- import the module from the control modules
+    local Production = require '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
+    -- the other precision work like wise
+    Production.precision_up(defines.flow_precision_index.one_second)
+
+    -- The get production function is used to get production, consumion and net
+    -- it may be used for any item and with any precision level, use total for total
+    Production.get_production(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute)
+
+    -- The fluctuations works by compearing recent production with the average over time
+    -- again any precision may be used, apart from one_thousand_hours as there would be no valid average
+    Production.get_fluctuations(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute)
+
+    -- ETA is calculated based on what function you use but all share a similar method
+    -- for production eta it will take current production average given by the precision
+    -- and work out how many ticks it will require to make the required amount (1000 by default)
+    Production.get_production_eta(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute,250000)
+
+    -- Both get_color and format_number are helper functions to help format production stats
+    -- get_color will return green,orange,red,or grey based on the active_value
+    -- the passive_value is used when active_value is 0 and can only return orange,red,or grey
+    Production.get_color(clamp,active_value,passive_value)
+ + + + + + + +

Dependencies

+ + + + + + + + + + + + +
resources.color_presetsProvides colors for Production.get_color
utilProvides format_number function to add surfixs
+ + +

Precision

+ + + + + + + + + + + + + + + + +
precision_up (precision)Gets the next lesser precision index value, eg 1 second -> 1 minute
precision_down (precision)Gets the next greater precision index value, eg 1 minute -> 1 second
precision_ticks (precision)Gets the number of tick that precision is given over, eg 1 minute -> 60 ticks
+ + +

Statistics

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
get_production_total (force, item_name)Returns the production data for the whole game time
get_production (force, item_name, precision)Returns the production data for the given precision game time
get_fluctuations (force, item_name, precision)Returns the current fluctuation from the average
get_production_eta (force, item_name, precision[, required=1000])Returns the amount of ticks required to produce a certain amount
get_consumsion_eta (force, item_name, precision[, required=1000])Returns the amount of ticks required to consume a certain amount
get_net_eta (force, item_name, precision[, required=1000])Returns the amount of ticks required to produce but not consume a certain amount
+ + +

Formating

+ + + + + + + + + + + + +
get_color (clamp, active_value, passive_value)Returns a color value bassed on the value that was given
format_number (value)Returns three parts used to format a number
+ + +
+ + +

Dependencies

+
+
+
+
+ # + resources.color_presets +
+
+
+
+ +

Provides colors for Production.get_color

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + util +
+
+
+
+ +

Provides format_number function to add surfixs

+

+ + + + + + + + + + + + + + +
+
+

Precision

+
+
+
+
+ # + precision_up (precision) +
+
+
+
+ +

Gets the next lesser precision index value, eg 1 second -> 1 minute

+

+ + + Parameters: + + + + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + precision_down (precision) +
+
+
+
+ +

Gets the next greater precision index value, eg 1 minute -> 1 second

+

+ + + Parameters: + + + + + + + Returns: + + + + + + + + + + +
+
+
+
+ # + precision_ticks (precision) +
+
+
+
+ +

Gets the number of tick that precision is given over, eg 1 minute -> 60 ticks

+

+ + + Parameters: + + + + + + + Returns: +
    +
  • + (number) + the number of ticks in this time +
  • +
+ + + + + + + + + +
+
+

Statistics

+
+
+
+
+ # + get_production_total (force, item_name) +
+
+
+
+ +

Returns the production data for the whole game time

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + contains total made, used and net +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_production (force, item_name, precision) +
+
+
+
+ +

Returns the production data for the given precision game time

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + + + + +
  • + + precision + + : + + (defines.flow_precision_index) + + the precision that you want the data given to + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + contains made, used and net +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_fluctuations (force, item_name, precision) +
+
+
+
+ +

Returns the current fluctuation from the average

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + + + + +
  • + + precision + + : + + (defines.flow_precision_index) + + the precision that you want the data given to + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + contains made, used and net +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_production_eta (force, item_name, precision[, required=1000]) +
+
+
+
+ +

Returns the amount of ticks required to produce a certain amount

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + + + + +
  • + + precision + + : + + (defines.flow_precision_index) + + the precision that you want the data given to + +
  • + + + + + +
  • + + required + + : + + (number) + + the number of items that are required to be made + + (default: 1000) +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of ticks required to produce this ammount of items +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_consumsion_eta (force, item_name, precision[, required=1000]) +
+
+
+
+ +

Returns the amount of ticks required to consume a certain amount

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + + + + +
  • + + precision + + : + + (defines.flow_precision_index) + + the precision that you want the data given to + +
  • + + + + + +
  • + + required + + : + + (number) + + the number of items that are required to be consumed + + (default: 1000) +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of ticks required to consume this ammount of items +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_net_eta (force, item_name, precision[, required=1000]) +
+
+
+
+ +

Returns the amount of ticks required to produce but not consume a certain amount

+

+ + + Parameters: + +
    + + + + + +
  • + + force + + : + + (LuaForce) + + the force to get the data for + +
  • + + + + + +
  • + + item_name + + : + + (string) + + the name of the item that you want the data about + +
  • + + + + + +
  • + + precision + + : + + (defines.flow_precision_index) + + the precision that you want the data given to + +
  • + + + + + +
  • + + required + + : + + (number) + + the number of items that are required to be made but not used + + (default: 1000) +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of ticks required to produce, but not use, this ammount of items +
  • +
+ + + + + + + + + +
+
+

Formating

+
+
+
+
+ # + get_color (clamp, active_value, passive_value) +
+
+
+
+ +

Returns a color value bassed on the value that was given

+

+ + + Parameters: + +
    + + + + + +
  • + + clamp + + : + + (number) + + value which seperates the different colours + +
  • + + + + + +
  • + + active_value + + : + + (number) + + first value tested, tested against clamp + +
  • + + + + + +
  • + + passive_value + + : + + (number) + + second value tested, tested against 0 + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + contains r,g,b keys +
  • +
+ + + + + + + + + +
+
+
+
+ # + format_number (value) +
+
+
+
+ +

Returns three parts used to format a number

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + (number) + + the value to format + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the sign for the number +
  • +
  • + (string) + the surfix for any unit used +
  • +
  • + (string) + the number formated +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/modules.control.reports.html b/docs/modules/modules.control.reports.html new file mode 100644 index 00000000..cbfd54ef --- /dev/null +++ b/docs/modules/modules.control.reports.html @@ -0,0 +1,1026 @@ + + + + + + + + modules.control.reports module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

modules.control.reports module

+

Control Module - Reports + - Adds a way to report players and store report messages.

+

+ + + + + + +

Usage

+

+    -- import the module from the control modules
+    local Reports = require '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
+    -- seen by using Reports.get_report.
+    Reports.report_player('MrBiter','Cooldude2606','Liking biters too much') -- true
+
+    -- The other get methods can be used to get all the reports on a player or to test if a player is reported.
+    Reports.get_report('MrBiter','Cooldude2606') -- 'Liking biters too much'
+
+    -- This will remove the warning on 'MrBiter' (must be a valid player) which was made by 'Cooldude2606'.
+    Reports.remove_report('MrBiter','Cooldude2606') -- true
+
+    -- This will remove all the report that have been made against 'MrBiter'. Note that the remove event will
+    -- be triggered once per report issused.
+    Reports.remove_all('MrBiter') -- true
+
+ + + + + + + +

Events

+ + + + + + + + + + + + +
on_player_reportedWhen a player is reported
on_report_removedWhen a report is removed from a player
+ + +

Dependencies

+ + + + + + + + + + + + +
utils.gameAllows getting player from any value
utils.globalAllows storing of data in global table
+ + +

Get functions

+ + + + + + + + + + + + + + + + + + + + +
get_reports (player)Gets a list of all reports that a player has against them
get_report (player, by_player_name)Gets a single report against a player given the name of the player who made the report
is_reported (player[, by_player_name])Checks if a player is reported, option to get if reported by a certain player
count_reports (player[, custom_count])Counts the number of reports that a player has aganist them
+ + +

Set functions

+ + + + + + + + + + + + + + + + +
report_player (player, by_player_name[, reason='Non given.'])Adds a report to a player, each player can only report another player once
remove_report (player, reported_by_name)Removes a report from a player
remove_all (player)Removes all reports from a player
+ + +
+ + +

Events

+
+
+
+
+ # + on_player_reported +
+
+
+
+ +

When a player is reported

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the player index of the player who got reported + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who made the report + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason given for the report + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_report_removed +
+
+
+
+ +

When a report is removed from a player

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the player index of the player who has the report removed + +
  • + + + + + +
  • + + reported_by_name + + : + + (string) + + the name of the player who made the removed report + +
  • + + + + + +
  • + + removed_by_name + + : + + (string) + + the name of the player who removed the report + +
  • + + +
+ + + + + + + + + + + + + +
+
+

Dependencies

+
+
+
+
+ # + utils.game +
+
+
+
+ +

Allows getting player from any value

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ +

Allows storing of data in global table

+

+ + + + + + + + + + + + + + +
+
+

Get functions

+
+
+
+
+ # + get_reports (player) +
+
+
+
+ +

Gets a list of all reports that a player has against them

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the report for + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + a list of all reports, key is by player name, value is reason +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_report (player, by_player_name) +
+
+
+
+ +

Gets a single report against a player given the name of the player who made the report

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the report for + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who made the report + +
  • + + +
+ + + + + Returns: +
    +
  • + (string or nil) + string is the reason that the player was reported, if the player is not reported +
  • +
+ + + + + + + + + +
+
+
+
+ # + is_reported (player[, by_player_name]) +
+
+
+
+ +

Checks if a player is reported, option to get if reported by a certain player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to check if reported + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + when given will check if reported by this player + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + if the player has been reported +
  • +
+ + + + + + + + + +
+
+
+
+ # + count_reports (player[, custom_count]) +
+
+
+
+ +

Counts the number of reports that a player has aganist them

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to count the reports for + +
  • + + + + + +
  • + + custom_count + + : + + (function) + + when given this function will be used to count the reports + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of reports that the user has +
  • +
+ + + + + + + + + +
+
+

Set functions

+
+
+
+
+ # + report_player (player, by_player_name[, reason='Non given.']) +
+
+
+
+ +

Adds a report to a player, each player can only report another player once

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to add the report to + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player that is making the report + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player is being reported + + (default: 'Non given.') +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the report was added successfully +
  • +
+ + + + + + + + + +
+
+
+
+ # + remove_report (player, reported_by_name) +
+
+
+
+ +

Removes a report from a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to remove the report from + +
  • + + + + + +
  • + + reported_by_name + + : + + (string) + + the name of the player that made the report + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the report was removed successfully +
  • +
+ + + + + + + + + +
+
+
+
+ # + remove_all (player) +
+
+
+
+ +

Removes all reports from a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to remove the reports from + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + whether the reports were removed successfully +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/modules.control.warnings.html b/docs/modules/modules.control.warnings.html new file mode 100644 index 00000000..022c2d8a --- /dev/null +++ b/docs/modules/modules.control.warnings.html @@ -0,0 +1,1416 @@ + + + + + + + + modules.control.warnings module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

modules.control.warnings module

+

Control Module - Warnings + - Adds a way to give and remove warnings to players.

+

+ + + + + + +

Usage

+

+    -- This will add a warning to the player
+    Warnings.add_warning('MrBiter','Cooldude2606','Killed too many biters')
+
+    -- This will remove a warning from a player, second name is just who is doing the action
+    Warnings.remove_warning('MrBiter','Cooldude2606')
+
+    -- Script warning as similar to normal warning but are designed to have no effect for a short amount of time
+    -- this is so it can be used for greifer protection without being too agressive
+    Warnings.add_script_warning('MrBiter','Killed too many biters')
+
+    -- Both normal and script warnings can also be cleared, this will remove all warnings
+    Warnings.clear_warnings('MrBiter','Cooldude2606')
+ + + + + + + +

Events

+ + + + + + + + + + + + + + + + + + + + +
on_warning_addedWhen a warning is added to a player
on_warning_removedWhen a warning is removed from a player
on_script_warning_addedWhen a warning is added to a player, by the script
on_script_warning_removedWhen a warning is remnoved from a player, by the script
+ + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + +
utils.eventAllows registering of custom events
utils.gameAllows getting player from any value
utils.globalAllows storing in the global table
config.warningsConfig file for this module
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
get_warnings (player)Gets an array of warnings that the player has, always returns a list even if emtpy
count_warnings (player)Gets the number of warnings that a player has on them
add_warning (player, by_player_name[, reason='Non given.'])Adds a warning to a player, when a warning is added a set action is done based on the number of warnings and the config file
remove_warning (player, by_player_name)Removes a warning from a player, always removes the earlyist warning, fifo
clear_warnings (player, by_player_name)Removes all warnings from a player, will trigger remove event for each warning
get_script_warnings (player)Gets an array of all the script warnings that a player has
count_script_warnings (player)Gets the number of script warnings that a player has on them
add_script_warning (player[, reason='Non given.'])Adds a script warning to a player, this may add a full warning if max script warnings is met
remove_script_warning (player)Removes a script warning from a player
clear_script_warnings (player)Removes all script warnings from a player, emits event for each warning removed
+ + +
+ + +

Events

+
+
+
+
+ # + on_warning_added +
+
+
+
+ +

When a warning is added to a player

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who recived the warning + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who gave the warning + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player was given a warning + +
  • + + + + + +
  • + + warning_count + + : + + (number) + + the new number of warnings that the player has + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_warning_removed +
+
+
+
+ +

When a warning is removed from a player

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who is having the warning removed + +
  • + + + + + +
  • + + warning_by_name + + : + + (string) + + the name of the player who gave the warning + +
  • + + + + + +
  • + + removed_by_name + + : + + (string) + + the name of the player who is removing the warning + +
  • + + + + + +
  • + + warning_count + + : + + (number) + + the new number of warnings that the player has + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_script_warning_added +
+
+
+
+ +

When a warning is added to a player, by the script

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who recived the warning + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player was given a warning + +
  • + + + + + +
  • + + warning_count + + : + + (number) + + the new number of warnings that the player has + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + on_script_warning_removed +
+
+
+
+ +

When a warning is remnoved from a player, by the script

+

+ + + Event Parameters: + +
    + + + + + +
  • + + player_index + + : + + (number) + + the index of the player who is having the warning removed + +
  • + + + + + +
  • + + warning_count + + : + + (number) + + the new number of warnings that the player has + +
  • + + +
+ + + + + + + + + + + + + +
+
+

Dependencies

+
+
+
+
+ # + utils.event +
+
+
+
+ +

Allows registering of custom events

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ +

Allows getting player from any value

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ +

Allows storing in the global table

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + config.warnings +
+
+
+
+ +

Config file for this module

+

+ + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + get_warnings (player) +
+
+
+
+ +

Gets an array of warnings that the player has, always returns a list even if emtpy

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the warning for + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + an array of all the warnings on this player, contains tick, by_player_name and reason +
  • +
+ + + + + + + + + +
+
+
+
+ # + count_warnings (player) +
+
+
+
+ +

Gets the number of warnings that a player has on them

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to count the warnings for + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + add_warning (player, by_player_name[, reason='Non given.']) +
+
+
+
+ +

Adds a warning to a player, when a warning is added a set action is done based on the number of warnings and the config file

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to add a warning to + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who is doing the action + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player is being warned + + (default: 'Non given.') +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + remove_warning (player, by_player_name) +
+
+
+
+ +

Removes a warning from a player, always removes the earlyist warning, fifo

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to remove a warning from + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who is doing the action + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + clear_warnings (player, by_player_name) +
+
+
+
+ +

Removes all warnings from a player, will trigger remove event for each warning

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to clear the warnings from + +
  • + + + + + +
  • + + by_player_name + + : + + (string) + + the name of the player who is doing the action + +
  • + + +
+ + + + + Returns: +
    +
  • + (boolean) + true when warnings were cleared succesfully +
  • +
+ + + + + + + + + +
+
+
+
+ # + get_script_warnings (player) +
+
+
+
+ +

Gets an array of all the script warnings that a player has

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the script warnings of + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + a table of all the script warnings a player has, contains tick and reason +
  • +
+ + + + + + + + + +
+
+
+
+ # + count_script_warnings (player) +
+
+
+
+ +

Gets the number of script warnings that a player has on them

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to count the script warnings of + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of script warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + add_script_warning (player[, reason='Non given.']) +
+
+
+
+ +

Adds a script warning to a player, this may add a full warning if max script warnings is met

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to add a script warning to + +
  • + + + + + +
  • + + reason + + : + + (string) + + the reason that the player is being warned + + (default: 'Non given.') +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of script warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + remove_script_warning (player) +
+
+
+
+ +

Removes a script warning from a player

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to remove a script warning from + +
  • + + +
+ + + + + Returns: +
    +
  • + (number) + the number of script warnings that the player has +
  • +
+ + + + + + + + + +
+
+
+
+ # + clear_script_warnings (player) +
+
+
+
+ +

Removes all script warnings from a player, emits event for each warning removed

+

+ + + Parameters: + +
    + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to clear the script warnings from + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/modules.gui.player-list.html b/docs/modules/modules.gui.player-list.html new file mode 100644 index 00000000..6c2f2a74 --- /dev/null +++ b/docs/modules/modules.gui.player-list.html @@ -0,0 +1,449 @@ + + + + + + + + modules.gui.player-list module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

modules.gui.player-list module

+

Gui left frame define for a player list

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui
expcore.roles
expcore.store
utils.game
utils.event
expcore.common
config.action_buttons
resources.color_presets
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.store +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.action_buttons +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/modules.gui.rocket-info.html b/docs/modules/modules.gui.rocket-info.html new file mode 100644 index 00000000..a61c019d --- /dev/null +++ b/docs/modules/modules.gui.rocket-info.html @@ -0,0 +1,465 @@ + + + + + + + + modules.gui.rocket-info module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

modules.gui.rocket-info module

+

Adds a rocket infomation gui which shows general stats, milestones and build progress of rockets

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui
expcore.roles
utils.event
config.rockets
expcore.common
resources.color_presets
modules.control.rockets
+ + +

Fields

+ + + + + + + + +
header_area.captionRight aligned button to toggle the section
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.rockets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.rockets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Fields

+
+
+
+
+ # + header_area.caption +
+
+
+
+ +

Right aligned button to toggle the section

+

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/modules.gui.science-info.html b/docs/modules/modules.gui.science-info.html new file mode 100644 index 00000000..10dd9a57 --- /dev/null +++ b/docs/modules/modules.gui.science-info.html @@ -0,0 +1,365 @@ + + + + + + + + modules.gui.science-info module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

modules.gui.science-info module

+

Adds a science info gui that shows production usage and net for the different science packs as well as an eta

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + +
expcore.gui
utils.event
expcore.common
config.science
modules.control.production
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.science +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.production +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/modules.gui.task-list.html b/docs/modules/modules.gui.task-list.html new file mode 100644 index 00000000..b2d44c25 --- /dev/null +++ b/docs/modules/modules.gui.task-list.html @@ -0,0 +1,393 @@ + + + + + + + + modules.gui.task-list module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

modules.gui.task-list module

+

Adds a task list to the game which players can add remove and edit items on

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + + + + + + + +
expcore.gui
utils.event
expcore.roles
config.tasks
expcore.common
modules.control.tasks
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.roles +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.tasks +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + modules.control.tasks +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/tesrt.html b/docs/modules/tesrt.html new file mode 100644 index 00000000..52c8b244 --- /dev/null +++ b/docs/modules/tesrt.html @@ -0,0 +1,386 @@ + + + + + + + + tesrt module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

tesrt module

+

Core Module - ExpStyle

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.gui
gui.concept.flow
+ + +

Elements

+ + + + + + + + +
alignmentA flow which can be used to align text and other elements
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.gui +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + gui.concept.flow +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Elements

+
+
+
+
+ # + alignment +
+
+
+
+ +

A flow which can be used to align text and other elements

+

+ + + + + + + + + + See also: + + + + + Usage: +
-- Concept Structure
+-- Root
+--> [alignment] - the alignment area
+Gui.new_concept('alignment')
+:set_horizontal_align('center')
+ + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/utils.alien_evolution_progress.html b/docs/modules/utils.alien_evolution_progress.html new file mode 100644 index 00000000..51092a84 --- /dev/null +++ b/docs/modules/utils.alien_evolution_progress.html @@ -0,0 +1,427 @@ + + + + + + + + utils.alien_evolution_progress module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

utils.alien_evolution_progress module

+

info + Original (javascript) version: https://hastebin.com/udakacavap.js + Can be tested against: https://wiki.factorio.com/Enemies#Spawn_chances_by_evolution_factor

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
utils.global
utils.debug
utils.table
+ + +

Functions

+ + + + + + + + +
AlienEvolutionProgress.create_spawner_request(total_aliens)Creates the spawner_request structure required for AlienEvolutionProgress.get_aliens for all +available spawner's.
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.debug +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.table +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + AlienEvolutionProgress.create_spawner_request(total_aliens) +
+
+
+
+ +

Creates the spawner_request structure required for AlienEvolutionProgress.get_aliens for all +available spawner's.

+

If dividing the total spawner's by the total aliens causes a fraction, the +fraction will decide a chance to spawn. 1 alien for 2 spawner's will have 50% on both.

+ + + Parameters: + +
    + + + + + +
  • + + total_aliens + + : + + + table + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/utils.core.html b/docs/modules/utils.core.html new file mode 100644 index 00000000..31b33120 --- /dev/null +++ b/docs/modules/utils.core.html @@ -0,0 +1,1172 @@ + + + + + + + + utils.core module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

utils.core module

+

This file contains core utilities used by the redmew scenario.

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
utils.game
resources.color_presets
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Module.distance(pos1, pos2)Measures distance between pos1 and pos2
Module.print_except(msg, player, color)Takes msg and prints it to all players except provided player
Module.print_admins(msg, source)Prints a message to all online admins
Module.get_actor()Returns a valid string with the name of the actor of a command.
Module.format_time(ticks)Takes a time in ticks and returns a string with the time in format "x hour(s) x minute(s)"
Module.cant_run(name)Prints a message letting the player know they cannot run a command
Module.log_command(actor, command, parameters)Logs the use of a command and its user
Module.verify_mult_types(arg, arg_types)Asserts the argument is one of type arg_types
Module.random_RGB()Returns a random RGB color as a table
Module.set_and_return(tbl, key, value)Sets a table element to value while also returning value.
+ + +

Fields

+ + + + + + + + + + + + + + + + +
Module.move_positionMoves a position according to the parameters given + Notice: only accepts cardinal directions as direction
Module.opposite_directionTakes a direction and gives you the opposite
Module.is_module_availableTakes the string of a module and returns whether is it available or not
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + resources.color_presets +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Module.distance(pos1, pos2) +
+
+
+
+ +

Measures distance between pos1 and pos2

+

+ + + Parameters: + +
    + + + + + +
  • + + pos1 + + + + + +
  • + + + + + +
  • + + pos2 + + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Module.print_except(msg, player, color) +
+
+
+
+ +

Takes msg and prints it to all players except provided player

+

+ + + Parameters: + +
+
+ + + + diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html new file mode 100644 index 00000000..87ca10a6 --- /dev/null +++ b/docs/modules/utils.event.html @@ -0,0 +1,1300 @@ + + + + + + + + utils.event module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

utils.event module

+

This Module allows for registering multiple handlers to the same event, overcoming the limitation of script.register.

+

+

** Event.add(event_name, handler) ** +

Handlers added with Event.add must be added at the control stage or in Event.on_init or Event.on_load. + Remember that for each player, on_init or on_load is run, never both. So if you can't add the handler in the + control stage add the handler in both on_init and on_load. + Handlers added with Event.add cannot be removed. + For handlers that need to be removed or added at runtime use Event.add_removable.

+ + + + + + +

Usage

+

+ local Event = require 'utils.event' --- @dep utils.event
+ Event.add(
+     defines.events.on_built_entity,
+     function(event)
+         game.print(serpent.block(event)) -- prints the content of the event table to console.
+     end
+ )
+
+ ** Event.add_removable(event_name, token) **
+
+ For conditional event handlers. Event.add_removable can be safely called at runtime without desync risk.
+ Only use this if you need to add the handler at runtime or need to remove the handler, otherwise use Event.add
+
+ Event.add_removable can be safely used at the control stage or in Event.on_init. If used in on_init you don't
+ need to also add in on_load (unlike Event.add).
+ Event.add_removable cannot be called in on_load, doing so will crash the game on loading.
+ Token is used because it's a desync risk to store closures inside the global table.
+

+ local Token = require 'utils.token' --- @dep utils.token
+ local Event = require 'utils.event' --- @dep utils.event
+
+ Token.register must not be called inside an event handler.
+ local handler =
+     Token.register(
+     function(event)
+         game.print(serpent.block(event)) -- prints the content of the event table to console.
+     end
+ )
+
+ The below code would typically be inside another event or a custom command.
+ Event.add_removable(defines.events.on_built_entity, handler)
+
+ When you no longer need the handler.
+ Event.remove_removable(defines.events.on_built_entity, handler)
+
+ It's not an error to register the same token multiple times to the same event, however when
+ removing only the first occurrence is removed.
+
+ ** Event.add_removable_function(event_name, func) **
+
+ Only use this function if you can't use Event.add_removable. i.e you are registering the handler at the console.
+ The same restrictions that apply to Event.add_removable also apply to Event.add_removable_function.
+ func cannot be a closure in this case, as there is no safe way to store closures in the global table.
+ A closure is a function that uses a local variable not defined in the function.
+

+ local Event = require 'utils.event' --- @dep utils.event
+
+ If you want to remove the handler you will need to keep a reference to it.
+ global.handler = function(event)
+     game.print(serpent.block(event)) -- prints the content of the event table to console.
+ end
+
+ The below code would typically be used at the command console.
+ Event.add_removable_function(defines.events.on_built_entity, global.handler)
+
+ When you no longer need the handler.
+ Event.remove_removable_function(defines.events.on_built_entity, global.handler)
+
+ ** Other Events **
+
+ Use Event.on_init(handler) for script.on_init(handler)
+ Use Event.on_load(handler) for script.on_load(handler)
+
+ Use Event.on_nth_tick(tick, handler) for script.on_nth_tick(tick, handler)
+ Favour this event over Event.add(defines.events.on_tick, handler)
+ There are also Event.add_removable_nth_tick(tick, token) and Event.add_removable_nth_tick_function(tick, func)
+ That work the same as above.
+
+ ** Custom Scenario Events **
+
+ local Event = require 'utils.event' --- @dep utils.event
+
+ local event_id = script.generate_event_name()
+
+ Event.add(
+     event_id,
+     function(event)
+         game.print(serpent.block(event)) -- prints the content of the event table to console.
+     end
+ )
+
+ The table contains extra information that you want to pass to the handler.
+ script.raise_event(event_id, {extra = 'data'})
+ + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + +
utils.event_core
utils.global
utils.token
utils.debug
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Event.add(event_name, handler)Register a handler for the event_name event.
Event.on_init(handler)Register a handler for the script.on_init event.
Event.on_load(handler)Register a handler for the script.on_load event.
Event.on_nth_tick(tick, handler)Register a handler for the nth_tick event.
Event.add_removable(event_name, token)Register a token handler that can be safely added and removed at runtime.
Event.remove_removable(event_name, token)Removes a token handler for the given event_name.
Event.add_removable_function(event_name, func)Register a handler that can be safely added and removed at runtime.
Event.remove_removable_function(event_name, func)Removes a handler for the given event_name.
Event.add_removable_nth_tick(tick, token)Register a token handler for the nth tick that can be safely added and removed at runtime.
Event.remove_removable_nth_tick(tick, token)Removes a token handler for the nth tick.
Event.add_removable_nth_tick_function(tick, func)Register a handler for the nth tick that can be safely added and removed at runtime.
Event.remove_removable_nth_tick_function(tick, func)Removes a handler for the nth tick.
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.event_core +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.token +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.debug +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Event.add(event_name, handler) +
+
+
+
+ +

Register a handler for the event_name event.

+

+ This function must be called in the control stage or in Event.on_init or Event.on_load. + See documentation at top of file for details on using events.

+ + + Parameters: + +
    + + + + + +
  • + + event_name + + : + + + + +
  • + + + + + +
  • + + handler + + : + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Event.on_init(handler) +
+
+
+
+ +

Register a handler for the script.on_init event.

+

+ This function must be called in the control stage or in Event.on_init or Event.on_load + See documentation at top of file for details on using events.

+ + + Parameters: + +
    + + + + + +
  • + + handler + + : + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Event.on_load(handler) +
+
+
+
+ +

Register a handler for the script.on_load event.

+

+ This function must be called in the control stage or in Event.on_init or Event.on_load + See documentation at top of file for details on using events.

+ + + Parameters: + +
    + + + + + +
  • + + handler + + : + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Event.on_nth_tick(tick, handler) +
+
+
+
+ +

Register a handler for the nth_tick event.

+

+ This function must be called in the control stage or in Event.on_init or Event.on_load. + See documentation at top of file for details on using events.

+ + + Parameters: + +
    + + + + + +
  • + + tick + + : + + + The handler will be called every nth tick + +
  • + + + + + +
  • + + handler + + : + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Event.add_removable(event_name, token) +
+
+
+
+ +

Register a token handler that can be safely added and removed at runtime.

+

+ Do NOT call this method during on_load. + See documentation at top of file for details on using events.

+ + + Parameters: + +
    + + + + + +
  • + + event_name + + : + + + + +
  • + + + + + +
  • + + token + + : + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Event.remove_removable(event_name, token) +
+
+
+
+ +

Removes a token handler for the given event_name.

+

+ Do NOT call this method during on_load. + See documentation at top of file for details on using events.

+ + + Parameters: + +
    + + + + + +
  • + + event_name + + : + + + + +
  • + + + + + +
  • + + token + + : + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Event.add_removable_function(event_name, func) +
+
+
+
+ +

Register a handler that can be safely added and removed at runtime.

+

+ The handler must not be a closure, as that is a desync risk. + Do NOT call this method during on_load. + See documentation at top of file for details on using events.

+ + + Parameters: + +
    + + + + + +
  • + + event_name + + : + + + + +
  • + + + + + +
  • + + func + + : + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Event.remove_removable_function(event_name, func) +
+
+
+
+ +

Removes a handler for the given event_name.

+

+ Do NOT call this method during on_load. + See documentation at top of file for details on using events.

+ + + Parameters: + +
    + + + + + +
  • + + event_name + + : + + + + +
  • + + + + + +
  • + + func + + : + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Event.add_removable_nth_tick(tick, token) +
+
+
+
+ +

Register a token handler for the nth tick that can be safely added and removed at runtime.

+

+ Do NOT call this method during on_load. + See documentation at top of file for details on using events.

+ + + Parameters: + +
    + + + + + +
  • + + tick + + : + + + + +
  • + + + + + +
  • + + token + + : + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Event.remove_removable_nth_tick(tick, token) +
+
+
+
+ +

Removes a token handler for the nth tick.

+

+ Do NOT call this method during on_load. + See documentation at top of file for details on using events.

+ + + Parameters: + +
    + + + + + +
  • + + tick + + : + + + + +
  • + + + + + +
  • + + token + + : + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Event.add_removable_nth_tick_function(tick, func) +
+
+
+
+ +

Register a handler for the nth tick that can be safely added and removed at runtime.

+

+ The handler must not be a closure, as that is a desync risk. + Do NOT call this method during on_load. + See documentation at top of file for details on using events.

+ + + Parameters: + +
    + + + + + +
  • + + tick + + : + + + + +
  • + + + + + +
  • + + func + + : + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Event.remove_removable_nth_tick_function(tick, func) +
+
+
+
+ +

Removes a handler for the nth tick.

+

+ Do NOT call this method during on_load. + See documentation at top of file for details on using events.

+ + + Parameters: + +
    + + + + + +
  • + + tick + + : + + + + +
  • + + + + + +
  • + + func + + : + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html new file mode 100644 index 00000000..e9fcbde4 --- /dev/null +++ b/docs/modules/utils.event_core.html @@ -0,0 +1,442 @@ + + + + + + + + utils.event_core module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

utils.event_core module

+

Do not use this function, use Event.add instead as it has safety checks.

+

+ + + + + + + + + + + + + +

Functions

+ + + + + + + + + + + + + + + + +
Public.on_init(handler)Do not use this function, use Event.on_init instead as it has safety checks.
Public.on_load(handler)Do not use this function, use Event.on_load instead as it has safety checks.
Public.on_nth_tick(tick, handler)Do not use this function, use Event.on_nth_tick instead as it has safety checks.
+ + +
+ + +

Functions

+
+
+
+
+ # + Public.on_init(handler) +
+
+
+
+ +

Do not use this function, use Event.on_init instead as it has safety checks.

+

+ + + Parameters: + +
    + + + + + +
  • + + handler + + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Public.on_load(handler) +
+
+
+
+ +

Do not use this function, use Event.on_load instead as it has safety checks.

+

+ + + Parameters: + +
    + + + + + +
  • + + handler + + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + Public.on_nth_tick(tick, handler) +
+
+
+
+ +

Do not use this function, use Event.on_nth_tick instead as it has safety checks.

+

+ + + Parameters: + +
    + + + + + +
  • + + tick + + + + + +
  • + + + + + +
  • + + handler + + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/utils.math.html b/docs/modules/utils.math.html new file mode 100644 index 00000000..12045d90 --- /dev/null +++ b/docs/modules/utils.math.html @@ -0,0 +1,361 @@ + + + + + + + + utils.math module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

utils.math module

+

Takes two points and calculates the slope of a line

+

+ + + + + + + + + + + + + +

Functions

+ + + + + + + + +
calculate_y_intercept(x, y, slope)Calculates the y-intercept of a line
+ + +
+ + +

Functions

+
+
+
+
+ # + calculate_y_intercept(x, y, slope) +
+
+
+
+ +

Calculates the y-intercept of a line

+

+ + + Parameters: + +
    + + + + + +
  • + + x + + : + + + number - coordinates of point on line + +
  • + + + + + +
  • + + y + + : + + + number - coordinates of point on line + +
  • + + + + + +
  • + + slope + + : + + + number - the slope of a line + +
  • + + +
+ + + + + Returns: +
    +
  • + number - the y-intercept of a line +
  • +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/modules/utils.recipe_locker.html b/docs/modules/utils.recipe_locker.html new file mode 100644 index 00000000..59d49a86 --- /dev/null +++ b/docs/modules/utils.recipe_locker.html @@ -0,0 +1,449 @@ + + + + + + + + utils.recipe_locker module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

utils.recipe_locker module

+

A module to prevent recipes from being unlocked by research.

+

Accessed via the public functions.

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
utils.event
utils.global
+ + +

Functions

+ + + + + + + + + + + + +
Public.lock_recipes(tbl)Locks recipes, preventing them from being enabled by research.
Public.unlock_recipes(tbl)Unlocks recipes, allowing them to be enabled by research.
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.global +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + Public.lock_recipes(tbl) +
+
+
+
+ +

Locks recipes, preventing them from being enabled by research.

+

+ Does not check if they should be enabled/disabled by existing research.

+ + + Parameters: + +
+
+
+ + + + diff --git a/docs/modules/utils.table.html b/docs/modules/utils.table.html new file mode 100644 index 00000000..5ffe1e8b --- /dev/null +++ b/docs/modules/utils.table.html @@ -0,0 +1,1426 @@ + + + + + + + + utils.table module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

utils.table module

+

Searches a table to remove a specific element without an index

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + +
utils.inspect
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
fast_remove(tbl, index)Removes an item from an array in O(1) time.
add_all(t1, t2)Adds the contents of table t2 to table t1
index_of(t, e)Checks if a table contains an element
index_of_in_array(t, e)Checks if the arrayed portion of a table contains an element
contains(t, e)Checks if a table contains an element
array_contains(t, e)Checks if the arrayed portion of a table contains an element
set(t, index, element)Adds an element into a specific index position while shuffling the rest down
get_random_dictionary_entry(t, key)Chooses a random entry from a table + because this uses math.random, it cannot be used outside of events
get_random_weighted(weighted_table, item_index, weight_index)Chooses a random entry from a weighted table + because this uses math.random, it cannot be used outside of events
shuffle_table(t, rng)Creates a fisher-yates shuffle of a sequential number-indexed table + because this uses math.random, it cannot be used outside of events if no rng is supplied + from: http://www.sdknews.com/cross-platform/corona/tutorial-how-to-shuffle-table-items
clear_table(t, array)Clears all existing entries in a table
+ + +

Fields

+ + + + + + + + + + + + + + + + + + + + + + + + +
inspectSimilar to serpent.block, returns a string with a pretty representation of a table.
sizeTakes a table and returns the number of entries in the table.
deep_copyCreates a deepcopy of a table.
mergeMerges multiple tables.
equalsDetermines if two tables are structurally equal.
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.inspect +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Functions

+
+
+
+
+ # + fast_remove(tbl, index) +
+
+
+
+ +

Removes an item from an array in O(1) time.

+

+ The catch is that fast_remove doesn't guarantee to maintain the order of items in the array.

+ + + Parameters: + +
    + + + + + +
  • + + tbl + + : + + + arrayed table + + + + + + + +
  • + + index + + : + + + Must be >= 0. The case where index > #tbl is handled. + +
  • + + + + + + + + + + + + + + + + + +
    +
    +
    + # + add_all(t1, t2) +
    +
    +
    +
    + +

    Adds the contents of table t2 to table t1

    +

    + + + Parameters: + +
      + + + + + +
    • + + t1 + + : + + +
    to insert into + + + + + + + +
  • + + t2 + + : + + +
  • to insert from + + + + + + + + + + + + + + + + + + + +
    +
    +
    + # + index_of(t, e) +
    +
    +
    +
    + +

    Checks if a table contains an element

    +

    + + + Parameters: + +
      + + + + + +
    • + + t + + : + + +
    + + + + + + + +
  • + + e + + : + + + table element + +
  • + + + + + + + + Returns: +
      +
    • + the index of the element or nil +
    • +
    + + + + + + + + + + +
    +
    +
    + # + index_of_in_array(t, e) +
    +
    +
    +
    + +

    Checks if the arrayed portion of a table contains an element

    +

    + + + Parameters: + +
      + + + + + +
    • + + t + + : + + +
    + + + + + + + +
  • + + e + + : + + + table element + +
  • + + + + + + + + Returns: +
      +
    • + the index of the element or nil +
    • +
    + + + + + + + + + + +
    +
    +
    + # + contains(t, e) +
    +
    +
    +
    + +

    Checks if a table contains an element

    +

    + + + Parameters: + +
      + + + + + +
    • + + t + + : + + +
    + + + + + + + +
  • + + e + + : + + + table element + +
  • + + + + + + + + Returns: +
      +
    • + indicating success +
    • +
    + + + + + + + + + + +
    +
    +
    + # + array_contains(t, e) +
    +
    +
    +
    + +

    Checks if the arrayed portion of a table contains an element

    +

    + + + Parameters: + +
      + + + + + +
    • + + t + + : + + +
    + + + + + + + +
  • + + e + + : + + + table element + +
  • + + + + + + + + Returns: +
      +
    • + indicating success +
    • +
    + + + + + + + + + + +
    +
    +
    + # + set(t, index, element) +
    +
    +
    +
    + +

    Adds an element into a specific index position while shuffling the rest down

    +

    + + + Parameters: + +
      + + + + + +
    • + + t + + : + + +
    to add into + + + + + + + +
  • + + index + + : + + + the position in the table to add to + +
  • + + + + + +
  • + + element + + : + + + to add to the table + +
  • + + + + + + + + + + + + + + + + + +
    +
    +
    + # + get_random_dictionary_entry(t, key) +
    +
    +
    +
    + +

    Chooses a random entry from a table + because this uses math.random, it cannot be used outside of events

    +

    + + + Parameters: + +
      + + + + + +
    • + + t + + : + + +
    + + + + + + + +
  • + + key + + : + + + to indicate whether to return the key or value + +
  • + + + + + + + + Returns: +
      +
    • + a random element of table t +
    • +
    + + + + + + + + + + +
    +
    +
    + # + get_random_weighted(weighted_table, item_index, weight_index) +
    +
    +
    +
    + +

    Chooses a random entry from a weighted table + because this uses math.random, it cannot be used outside of events

    +

    + + + Parameters: + +
      + + + + + +
    • + + weighted_table + + : + + +
    of tables with items and their weights + + + + + + + +
  • + + item_index + + : + + + of the index of items, defaults to 1 + +
  • + + + + + +
  • + + weight_index + + : + + + of the index of the weights, defaults to 2 + +
  • + + + + + + + + Returns: +
      +
    • + table element +
    • +
    + + + + + + + + + + +
    +
    +
    + # + shuffle_table(t, rng) +
    +
    +
    +
    + +

    Creates a fisher-yates shuffle of a sequential number-indexed table + because this uses math.random, it cannot be used outside of events if no rng is supplied + from: http://www.sdknews.com/cross-platform/corona/tutorial-how-to-shuffle-table-items

    +

    + + + Parameters: + +
      + + + + + +
    • + + t + + : + + +
    to shuffle + + + + + + + +
  • + + rng + + : + + + to provide random numbers + +
  • + + + + + + + + + + + + + + + + + +
    +
    +
    + # + clear_table(t, array) +
    +
    +
    +
    + +

    Clears all existing entries in a table

    +

    + + + Parameters: + +
      + + + + + +
    • + + t + + : + + +
    to clear + + + + + + + +
  • + + array + + : + + + to indicate whether the table is an array or not + +
  • + + + + + + + + + + + + + + + + + + +

    Fields

    +
    +
    +
    +
    + # + inspect +
    +
    +
    +
    + +

    Similar to serpent.block, returns a string with a pretty representation of a table.

    +

    + Notice: This method is not appropriate for saving/restoring tables. It is meant to be used by the programmer mainly while debugging a program. + depth sets the maximum depth that will be printed out. When the max depth is reached, inspect will stop parsing tables and just return {...} + process is a function which allow altering the passed object before transforming it into a string. + A typical way to use it would be to remove certain values so that they don't appear at all. + return the prettied table

    + + + +
      + + + + + +
    • + + table + + : + + +
    the table to serialize + + + + + + + +
  • + + options + + : + + +
  • options are depth, newline, indent, process + + + + + + + + + + + + + + + + + + + +
    +
    +
    + # + size +
    +
    +
    +
    + +

    Takes a table and returns the number of entries in the table.

    +

    (Slower than #table, faster than iterating via pairs)

    + + + + + + + + + + + + + + +
    +
    +
    +
    + # + deep_copy +
    +
    +
    +
    + +

    Creates a deepcopy of a table.

    +

    Metatables and LuaObjects inside the table are shallow copies. + Shallow copies meaning it copies the reference to the object instead of the object itself.

    + + + +
      + + + + + +
    • + + object + + : + + +
    the object to copy + + + + + + + + + + + + + + + + + + + +
    +
    +
    + # + merge +
    +
    +
    +
    + +

    Merges multiple tables.

    +

    Tables later in the list will overwrite entries from tables earlier in the list. + Ex. merge({{1, 2, 3}, {[2] = 0}, {[3] = 0}}) will return {1, 0, 0}

    + + + +
      + + + + + +
    • + + tables + + : + + +
    takes a table of tables to merge + + + + + + + + + + + + + + + + + + + +
    +
    +
    + # + equals +
    +
    +
    +
    + +

    Determines if two tables are structurally equal.

    +

    + Notice: tables that are LuaObjects or contain LuaObjects won't be compared correctly, use == operator for LuaObjects

    + + + +
      + + + + + +
    • + + tbl1 + + : + + +
    + + + + + + + +
  • + + tbl2 + + : + + +
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html new file mode 100644 index 00000000..cfc96b04 --- /dev/null +++ b/docs/modules/utils.task.html @@ -0,0 +1,659 @@ + + + + + + + + utils.task module + + + + + + + +
    +
    + + + + + + + +
    + + + + + + + + +

    utils.task module

    +

    Threading simulation module + Task.sleep()

    +

    + github: https://github.com/Refactorio/RedMew + ======================================================= --

    + + + +
      +
    • Author: Valansch and Grilledham
    • +
    + + + + + + + + +
    + +

    Dependencies

    + + + + + + + + + + + + + + + + +
    utils.queue
    utils.priority_queue
    utils.event
    utils.token
    + + +

    Functions

    + + + + + + + + + + + + + + + + +
    Task.set_timeout_in_ticks(ticks, func_token, params)Allows you to set a timer (in ticks) after which the tokened function will be run with params given as an argument + Cannot be called before init
    Task.set_timeout(sec, func_token, params)Allows you to set a timer (in seconds) after which the tokened function will be run with params given as an argument + Cannot be called before init
    Task.queue_task(func_token, params, weight)Queueing allows you to split up heavy tasks which don't need to be completed in the same tick.
    + + +
    + + +

    Dependencies

    +
    +
    +
    +
    + # + utils.queue +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.priority_queue +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.event +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.token +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +

    Functions

    +
    +
    +
    +
    + # + Task.set_timeout_in_ticks(ticks, func_token, params) +
    +
    +
    +
    + +

    Allows you to set a timer (in ticks) after which the tokened function will be run with params given as an argument + Cannot be called before init

    +

    + + + Parameters: + +
      + + + + + +
    • + + ticks + + : + + + + +
    • + + + + + +
    • + + func_token + + : + + + a token for a function store via the token system + +
    • + + + + + +
    • + + params + + : + + + the argument to send to the tokened function + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + Task.set_timeout(sec, func_token, params) +
    +
    +
    +
    + +

    Allows you to set a timer (in seconds) after which the tokened function will be run with params given as an argument + Cannot be called before init

    +

    + + + Parameters: + +
      + + + + + +
    • + + sec + + : + + + + +
    • + + + + + +
    • + + func_token + + : + + + a token for a function store via the token system + +
    • + + + + + +
    • + + params + + : + + + the argument to send to the tokened function + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + Task.queue_task(func_token, params, weight) +
    +
    +
    +
    + +

    Queueing allows you to split up heavy tasks which don't need to be completed in the same tick.

    +

    + Queued tasks are generally run 1 per tick. If the queue backs up, more tasks will be processed per tick. + Ex. if the task is expected to repeat multiple times (ie. the function returns true and loops several ticks)

    + + + Parameters: + +
      + + + + + +
    • + + func_token + + : + + + a token for a function stored via the token system + If this function returns `true` it will run again the next tick, delaying other queued tasks (see weight) + +
    • + + + + + +
    • + + params + + : + + + the argument to send to the tokened function + +
    • + + + + + +
    • + + weight + + : + + + (defaults to 1) weight is the number of ticks a task is expected to take. + +
    • + + +
    + + + + + + + + + + + + + +
    +
    + + + +
+
+
+ + + + diff --git a/docs/modules/utils.timestamp.html b/docs/modules/utils.timestamp.html new file mode 100644 index 00000000..fcf4b838 --- /dev/null +++ b/docs/modules/utils.timestamp.html @@ -0,0 +1,450 @@ + + + + + + + + utils.timestamp module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

utils.timestamp module

+

source https://github.com/daurnimator/luatz/blob/master/luatz/timetable.lua + edited down to just what is needed.

+

+ + + + + + + + + + + + + +

Functions

+ + + + + + + + + + + + + + + + +
Public.to_timetable(seconds)Converts unix epoch timestamp into table {year: number, month: number, day: number, hour: number, min: number, sec: number}
Public.from_timetable(timetable)Converts timetable into unix epoch timestamp
Public.to_string(seconds)Converts unix epoch timestamp into human readable string.
+ + +
+ + +

Functions

+
+
+
+
+ # + Public.to_timetable(seconds) +
+
+
+
+ +

Converts unix epoch timestamp into table {year: number, month: number, day: number, hour: number, min: number, sec: number}

+

+ + + Parameters: + +
    + + + + + +
  • + + seconds + + : + + + unix epoch timestamp + +
  • + + +
+ + + + + Returns: +
    +
  • + {year: number, month: number, day: number, hour: number, min: number, sec: number} +
  • +
+ + + + + + + + + +
+
+
+
+ # + Public.from_timetable(timetable) +
+
+
+
+ +

Converts timetable into unix epoch timestamp

+

+ + + Parameters: + +
    + + + + + +
  • + + timetable + + : + + + {year: number, month: number, day: number, hour: number, min: number, sec: number} + + + + + + + + + + Returns: +
      +
    • + number +
    • +
    + + + + + + + + + + +
    +
    +
    + # + Public.to_string(seconds) +
    +
    +
    +
    + +

    Converts unix epoch timestamp into human readable string.

    +

    + + + Parameters: + +
      + + + + + +
    • + + seconds + + : + + + unix epoch timestamp + +
    • + + +
    + + + + + Returns: +
      +
    • + string +
    • +
    + + + + + + + + + +
    + + + + + + + + + + + diff --git a/docs/spectre-icons.min.css b/docs/spectre-icons.min.css new file mode 100644 index 00000000..b8de3161 --- /dev/null +++ b/docs/spectre-icons.min.css @@ -0,0 +1,568 @@ +/*! Spectre.css Icons | MIT License | github.com/picturepan2/spectre */.icon { + box-sizing:border-box; + display:inline-block; + font-size:inherit; + font-style:normal; + height:1em; + position:relative; + text-indent:-999rem; + vertical-align:middle; + width:1em +} +.icon::after, +.icon::before { + display:block; + left:50%; + position:absolute; + top:50%; + -webkit-transform:translate(-50%,-50%); + -ms-transform:translate(-50%,-50%); + transform:translate(-50%,-50%) +} +.icon-arrow-down::before, +.icon-arrow-left::before, +.icon-arrow-right::before, +.icon-arrow-up::before, +.icon-back::before, +.icon-downward::before, +.icon-forward::before, +.icon-upward::before { + border:.2rem solid currentColor; + border-bottom:0; + border-right:0; + content:""; + height:.65em; + -webkit-transform:translate(-25%,-50%) rotate(-45deg); + -ms-transform:translate(-25%,-50%) rotate(-45deg); + transform:translate(-25%,-50%) rotate(-45deg); + width:.65em +} +.icon-arrow-down, +.icon-downward { + -webkit-transform:rotate(-90deg); + -ms-transform:rotate(-90deg); + transform:rotate(-90deg) +} +.icon-arrow-right, +.icon-forward { + -webkit-transform:rotate(180deg); + -ms-transform:rotate(180deg); + transform:rotate(180deg) +} +.icon-arrow-up, +.icon-upward { + -webkit-transform:rotate(90deg); + -ms-transform:rotate(90deg); + transform:rotate(90deg) +} +.icon-back::before, +.icon-downward::before, +.icon-forward::before, +.icon-upward::before { + -webkit-transform:translate(-50%,-50%) rotate(-45deg); + -ms-transform:translate(-50%,-50%) rotate(-45deg); + transform:translate(-50%,-50%) rotate(-45deg) +} +.icon-back::after, +.icon-downward::after, +.icon-forward::after, +.icon-upward::after { + background:currentColor; + content:""; + height:.2rem; + left:55%; + width:.8em +} +.icon-caret::before { + border-left:.3em solid transparent; + border-right:.3em solid transparent; + border-top:.3em solid currentColor; + content:""; + height:0; + -webkit-transform:translate(-50%,-25%); + -ms-transform:translate(-50%,-25%); + transform:translate(-50%,-25%); + width:0 +} +.icon-menu::before { + background:currentColor; + box-shadow:0 -.35em,0 .35em; + content:""; + height:.2rem; + width:100% +} +.icon-apps::before { + background:currentColor; + box-shadow:-.35em -.35em,-.35em 0,-.35em .35em,0 -.35em,0 .35em,.35em -.35em,.35em 0,.35em .35em; + content:""; + height:.3rem; + width:.3rem +} +.icon-resize-horiz::after, +.icon-resize-horiz::before, +.icon-resize-vert::after, +.icon-resize-vert::before { + border:.2rem solid currentColor; + border-bottom:0; + border-right:0; + content:""; + height:.45em; + width:.45em +} +.icon-resize-horiz::before, +.icon-resize-vert::before { + -webkit-transform:translate(-50%,-90%) rotate(45deg); + -ms-transform:translate(-50%,-90%) rotate(45deg); + transform:translate(-50%,-90%) rotate(45deg) +} +.icon-resize-horiz::after, +.icon-resize-vert::after { + -webkit-transform:translate(-50%,-10%) rotate(225deg); + -ms-transform:translate(-50%,-10%) rotate(225deg); + transform:translate(-50%,-10%) rotate(225deg) +} +.icon-resize-horiz::before { + -webkit-transform:translate(-90%,-50%) rotate(-45deg); + -ms-transform:translate(-90%,-50%) rotate(-45deg); + transform:translate(-90%,-50%) rotate(-45deg) +} +.icon-resize-horiz::after { + -webkit-transform:translate(-10%,-50%) rotate(135deg); + -ms-transform:translate(-10%,-50%) rotate(135deg); + transform:translate(-10%,-50%) rotate(135deg) +} +.icon-more-horiz::before, +.icon-more-vert::before { + background:currentColor; + border-radius:50%; + box-shadow:-.4em 0,.4em 0; + content:""; + height:.3rem; + width:.3rem +} +.icon-more-vert::before { + box-shadow:0 -.4em,0 .4em +} +.icon-cross::before, +.icon-minus::before, +.icon-plus::before { + background:currentColor; + content:""; + height:.2rem; + width:100% +} +.icon-cross::after, +.icon-plus::after { + background:currentColor; + content:""; + height:100%; + width:.2rem +} +.icon-cross::before { + width:100% +} +.icon-cross::after { + height:100% +} +.icon-cross::after, +.icon-cross::before { + -webkit-transform:translate(-50%,-50%) rotate(45deg); + -ms-transform:translate(-50%,-50%) rotate(45deg); + transform:translate(-50%,-50%) rotate(45deg) +} +.icon-check::before { + border:.2rem solid currentColor; + border-right:0; + border-top:0; + content:""; + height:.5em; + -webkit-transform:translate(-50%,-75%) rotate(-45deg); + -ms-transform:translate(-50%,-75%) rotate(-45deg); + transform:translate(-50%,-75%) rotate(-45deg); + width:.9em +} +.icon-stop { + border:.2rem solid currentColor; + border-radius:50% +} +.icon-stop::before { + background:currentColor; + content:""; + height:.2rem; + -webkit-transform:translate(-50%,-50%) rotate(45deg); + -ms-transform:translate(-50%,-50%) rotate(45deg); + transform:translate(-50%,-50%) rotate(45deg); + width:1em +} +.icon-shutdown { + border:.2rem solid currentColor; + border-radius:50%; + border-top-color:transparent +} +.icon-shutdown::before { + background:currentColor; + content:""; + height:.5em; + top:.1em; + width:.2rem +} +.icon-refresh::before { + border:.2rem solid currentColor; + border-radius:50%; + border-right-color:transparent; + content:""; + height:1em; + width:1em +} +.icon-refresh::after { + border:.2em solid currentColor; + border-left-color:transparent; + border-top-color:transparent; + content:""; + height:0; + left:80%; + top:20%; + width:0 +} +.icon-search::before { + border:.2rem solid currentColor; + border-radius:50%; + content:""; + height:.75em; + left:5%; + top:5%; + -webkit-transform:translate(0,0) rotate(45deg); + -ms-transform:translate(0,0) rotate(45deg); + transform:translate(0,0) rotate(45deg); + width:.75em +} +.icon-search::after { + background:currentColor; + content:""; + height:.2rem; + left:80%; + top:80%; + -webkit-transform:translate(-50%,-50%) rotate(45deg); + -ms-transform:translate(-50%,-50%) rotate(45deg); + transform:translate(-50%,-50%) rotate(45deg); + width:.4em +} +.icon-edit::before { + border:.2rem solid currentColor; + content:""; + height:.4em; + -webkit-transform:translate(-40%,-60%) rotate(-45deg); + -ms-transform:translate(-40%,-60%) rotate(-45deg); + transform:translate(-40%,-60%) rotate(-45deg); + width:.85em +} +.icon-edit::after { + border:.15em solid currentColor; + border-right-color:transparent; + border-top-color:transparent; + content:""; + height:0; + left:5%; + top:95%; + -webkit-transform:translate(0,-100%); + -ms-transform:translate(0,-100%); + transform:translate(0,-100%); + width:0 +} +.icon-delete::before { + border:.2rem solid currentColor; + border-bottom-left-radius:.2rem; + border-bottom-right-radius:.2rem; + border-top:0; + content:""; + height:.75em; + top:60%; + width:.75em +} +.icon-delete::after { + background:currentColor; + box-shadow:-.25em .2em,.25em .2em; + content:""; + height:.2rem; + top:.1rem; + width:.5em +} +.icon-share { + border:.2rem solid currentColor; + border-radius:.2rem; + border-right:0; + border-top:0 +} +.icon-share::before { + border:.2rem solid currentColor; + border-left:0; + border-top:0; + content:""; + height:.4em; + left:100%; + top:.25em; + -webkit-transform:translate(-125%,-50%) rotate(-45deg); + -ms-transform:translate(-125%,-50%) rotate(-45deg); + transform:translate(-125%,-50%) rotate(-45deg); + width:.4em +} +.icon-share::after { + border:.2rem solid currentColor; + border-bottom:0; + border-radius:75% 0; + border-right:0; + content:""; + height:.5em; + width:.6em +} +.icon-flag::before { + background:currentColor; + content:""; + height:1em; + left:15%; + width:.2rem +} +.icon-flag::after { + border:.2rem solid currentColor; + border-bottom-right-radius:.2rem; + border-left:0; + border-top-right-radius:.2rem; + content:""; + height:.65em; + left:60%; + top:35%; + width:.8em +} +.icon-bookmark::before { + border:.2rem solid currentColor; + border-bottom:0; + border-top-left-radius:.2rem; + border-top-right-radius:.2rem; + content:""; + height:.9em; + width:.8em +} +.icon-bookmark::after { + border:.2rem solid currentColor; + border-bottom:0; + border-left:0; + border-radius:.2rem; + content:""; + height:.5em; + -webkit-transform:translate(-50%,35%) rotate(-45deg) skew(15deg,15deg); + -ms-transform:translate(-50%,35%) rotate(-45deg) skew(15deg,15deg); + transform:translate(-50%,35%) rotate(-45deg) skew(15deg,15deg); + width:.5em +} +.icon-download, +.icon-upload { + border-bottom:.2rem solid currentColor +} +.icon-download::before, +.icon-upload::before { + border:.2rem solid currentColor; + border-bottom:0; + border-right:0; + content:""; + height:.5em; + -webkit-transform:translate(-50%,-60%) rotate(-135deg); + -ms-transform:translate(-50%,-60%) rotate(-135deg); + transform:translate(-50%,-60%) rotate(-135deg); + width:.5em +} +.icon-download::after, +.icon-upload::after { + background:currentColor; + content:""; + height:.6em; + top:40%; + width:.2rem +} +.icon-upload::before { + -webkit-transform:translate(-50%,-60%) rotate(45deg); + -ms-transform:translate(-50%,-60%) rotate(45deg); + transform:translate(-50%,-60%) rotate(45deg) +} +.icon-upload::after { + top:50% +} +.icon-time { + border:.2rem solid currentColor; + border-radius:50% +} +.icon-time::before { + background:currentColor; + content:""; + height:.4em; + -webkit-transform:translate(-50%,-75%); + -ms-transform:translate(-50%,-75%); + transform:translate(-50%,-75%); + width:.2rem +} +.icon-time::after { + background:currentColor; + content:""; + height:.3em; + -webkit-transform:translate(-50%,-75%) rotate(90deg); + -ms-transform:translate(-50%,-75%) rotate(90deg); + transform:translate(-50%,-75%) rotate(90deg); + -webkit-transform-origin:50% 90%; + -ms-transform-origin:50% 90%; + transform-origin:50% 90%; + width:.2rem +} +.icon-mail::before { + border:.2rem solid currentColor; + border-radius:.2rem; + content:""; + height:.8em; + width:1em +} +.icon-mail::after { + border:.2rem solid currentColor; + border-right:0; + border-top:0; + content:""; + height:.5em; + -webkit-transform:translate(-50%,-90%) rotate(-45deg) skew(10deg,10deg); + -ms-transform:translate(-50%,-90%) rotate(-45deg) skew(10deg,10deg); + transform:translate(-50%,-90%) rotate(-45deg) skew(10deg,10deg); + width:.5em +} +.icon-people::before { + border:.2rem solid currentColor; + border-radius:50%; + content:""; + height:.45em; + top:25%; + width:.45em +} +.icon-people::after { + border:.2rem solid currentColor; + border-radius:50% 50% 0 0; + content:""; + height:.4em; + top:75%; + width:.9em +} +.icon-message { + border:.2rem solid currentColor; + border-bottom:0; + border-radius:.2rem; + border-right:0 +} +.icon-message::before { + border:.2rem solid currentColor; + border-bottom-right-radius:.2rem; + border-left:0; + border-top:0; + content:""; + height:.8em; + left:65%; + top:40%; + width:.7em +} +.icon-message::after { + background:currentColor; + border-radius:.2rem; + content:""; + height:.3em; + left:10%; + top:100%; + -webkit-transform:translate(0,-90%) rotate(45deg); + -ms-transform:translate(0,-90%) rotate(45deg); + transform:translate(0,-90%) rotate(45deg); + width:.2rem +} +.icon-photo { + border:.2rem solid currentColor; + border-radius:.2rem +} +.icon-photo::before { + border:.2rem solid currentColor; + border-radius:50%; + content:""; + height:.25em; + left:35%; + top:35%; + width:.25em +} +.icon-photo::after { + border:.2rem solid currentColor; + border-bottom:0; + border-left:0; + content:""; + height:.5em; + left:60%; + -webkit-transform:translate(-50%,25%) rotate(-45deg); + -ms-transform:translate(-50%,25%) rotate(-45deg); + transform:translate(-50%,25%) rotate(-45deg); + width:.5em +} +.icon-link::after, +.icon-link::before { + border:.2rem solid currentColor; + border-radius:5em 0 0 5em; + border-right:0; + content:""; + height:.5em; + width:.75em +} +.icon-link::before { + -webkit-transform:translate(-70%,-45%) rotate(-45deg); + -ms-transform:translate(-70%,-45%) rotate(-45deg); + transform:translate(-70%,-45%) rotate(-45deg) +} +.icon-link::after { + -webkit-transform:translate(-30%,-55%) rotate(135deg); + -ms-transform:translate(-30%,-55%) rotate(135deg); + transform:translate(-30%,-55%) rotate(135deg) +} +.icon-location::before { + border:.2rem solid currentColor; + border-radius:50% 50% 50% 0; + content:""; + height:.8em; + -webkit-transform:translate(-50%,-60%) rotate(-45deg); + -ms-transform:translate(-50%,-60%) rotate(-45deg); + transform:translate(-50%,-60%) rotate(-45deg); + width:.8em +} +.icon-location::after { + border:.2rem solid currentColor; + border-radius:50%; + content:""; + height:.2em; + -webkit-transform:translate(-50%,-80%); + -ms-transform:translate(-50%,-80%); + transform:translate(-50%,-80%); + width:.2em +} +.icon-emoji { + border:.2rem solid currentColor; + border-radius:50% +} +.icon-emoji::before { + border-radius:50%; + box-shadow:-.17em -.15em,.17em -.15em; + content:""; + height:.1em; + width:.1em +} +.icon-emoji::after { + border:.2rem solid currentColor; + border-bottom-color:transparent; + border-radius:50%; + border-right-color:transparent; + content:""; + height:.5em; + -webkit-transform:translate(-50%,-40%) rotate(-135deg); + -ms-transform:translate(-50%,-40%) rotate(-135deg); + transform:translate(-50%,-40%) rotate(-135deg); + width:.5em +} +.btn .icon, +.menu .icon, +.toast .icon { + vertical-align:-10% +} diff --git a/docs/spectre.min.css b/docs/spectre.min.css new file mode 100644 index 00000000..382612ae --- /dev/null +++ b/docs/spectre.min.css @@ -0,0 +1,2778 @@ +/*! Spectre.css | MIT License | github.com/picturepan2/spectre */html { + font-family:sans-serif; + line-height:1.15; + -webkit-text-size-adjust:100%; + -ms-text-size-adjust:100% +} +body { + margin:0 +} +article, +aside, +footer, +header, +nav, +section { + display:block +} +h1 { + font-size:2em; + margin:.67em 0 +} +figcaption, +figure, +main { + display:block +} +hr { + box-sizing:content-box; + height:0; + overflow:visible +} +a { + background-color:transparent; + -webkit-text-decoration-skip:objects +} +a:active, +a:hover { + outline-width:0 +} +b, +strong { + font-weight:inherit +} +b, +strong { + font-weight:bolder +} +code, +kbd, +pre, +samp { + font-family:monospace,monospace; + font-size:1em +} +dfn { + font-style:italic +} +small { + font-size:80% +} +sub, +sup { + font-size:75%; + line-height:0; + position:relative; + vertical-align:baseline +} +sub { + bottom:-.25em +} +sup { + top:-.5em +} +audio, +video { + display:inline-block +} +audio:not([controls]) { + display:none; + height:0 +} +img { + border-style:none +} +svg:not(:root) { + overflow:hidden +} +button, +input, +optgroup, +select, +textarea { + font-family:inherit; + font-size:inherit; + line-height:inherit; + margin:0 +} +button, +input { + overflow:visible +} +button, +select { + text-transform:none +} +[type=reset], +[type=submit], +button, +html [type=button] { + -webkit-appearance:button +} +[type=button]::-moz-focus-inner, +[type=reset]::-moz-focus-inner, +[type=submit]::-moz-focus-inner, +button::-moz-focus-inner { + border-style:none; + padding:0 +} +fieldset { + border:0; + margin:0; + padding:0 +} +legend { + box-sizing:border-box; + color:inherit; + display:table; + max-width:100%; + padding:0; + white-space:normal +} +progress { + display:inline-block; + vertical-align:baseline +} +textarea { + overflow:auto +} +[type=checkbox], +[type=radio] { + box-sizing:border-box; + padding:0 +} +[type=number]::-webkit-inner-spin-button, +[type=number]::-webkit-outer-spin-button { + height:auto +} +[type=search] { + -webkit-appearance:textfield; + outline-offset:-2px +} +[type=search]::-webkit-search-cancel-button, +[type=search]::-webkit-search-decoration { + -webkit-appearance:none +} +::-webkit-file-upload-button { + -webkit-appearance:button; + font:inherit +} +details, +menu { + display:block +} +summary { + display:list-item +} +canvas { + display:inline-block +} +template { + display:none +} +[hidden] { + display:none +} +*, +::after, +::before { + box-sizing:inherit +} +html { + box-sizing:border-box; + font-size:10px; + line-height:1.42857143; + -webkit-tap-highlight-color:transparent +} +body { + background:#fff; + color:#50596c; + font-family:-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",sans-serif; + font-size:1.4rem; + overflow-x:hidden; + text-rendering:optimizeLegibility +} +a { + color:#5764c6; + outline:0; + text-decoration:none +} +a:focus { + box-shadow:0 0 0 .2rem rgba(87,100,198,.15) +} +a.active, +a:active, +a:focus, +a:hover { + color:#3b49af; + text-decoration:underline +} +h1, +h2, +h3, +h4, +h5, +h6 { + color:inherit; + font-weight:300; + line-height:1.2; + margin-bottom:1.5rem; + margin-top:0 +} +h1 { + font-size:5rem +} +h2 { + font-size:4rem +} +h3 { + font-size:3rem +} +h4 { + font-size:2.4rem +} +h5 { + font-size:2rem +} +h6 { + font-size:1.6rem +} +p { + line-height:2.4rem; + margin:0 0 1rem +} +a, +ins, +u { + -webkit-text-decoration-skip:ink edges; + text-decoration-skip:ink edges +} +blockquote { + border-left:.2rem solid #f0f1f4; + margin-left:0; + padding:1rem 2rem +} +blockquote p:last-child { + margin-bottom:0 +} +blockquote cite { + color:#acb3c2 +} +ol, +ul { + margin:2rem 0 2rem 2rem; + padding:0 +} +ol ol, +ol ul, +ul ol, +ul ul { + margin:1.5rem 0 1.5rem 2rem +} +ol li, +ul li { + margin-top:1rem +} +ul { + list-style:disc inside +} +ul ul { + list-style-type:circle +} +ol { + list-style:decimal inside +} +ol ol { + list-style-type:lower-alpha +} +dl dt { + font-weight:700 +} +dl dd { + margin:.5rem 0 1.5rem 0 +} +mark { + background:#ffe9b3; + border-radius:.2rem; + color:#50596c; + display:inline-block; + line-height:1; + padding:.3rem .4rem; + vertical-align:baseline +} +kbd { + background:#454d5d; + border-radius:.2rem; + color:#fff; + display:inline-block; + line-height:1; + padding:.3rem .4rem; + vertical-align:baseline +} +abbr[title] { + border-bottom:.1rem dotted; + cursor:help; + text-decoration:none +} +.cjk, +:lang(ja), +:lang(ko), +:lang(zh) { + font-family:-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Hiragino Kaku Gothic Pro",Meiryo,"Malgun Gothic","Helvetica Neue",sans-serif +} +.cjk ins, +.cjk u, +:lang(ja) ins, +:lang(ja) u, +:lang(zh) ins, +:lang(zh) u { + border-bottom:.1rem solid; + text-decoration:none +} +.cjk del+del, +.cjk del+s, +.cjk ins+ins, +.cjk ins+u, +.cjk s+del, +.cjk s+s, +.cjk u+ins, +.cjk u+u, +:lang(ja) del+del, +:lang(ja) del+s, +:lang(ja) ins+ins, +:lang(ja) ins+u, +:lang(ja) s+del, +:lang(ja) s+s, +:lang(ja) u+ins, +:lang(ja) u+u, +:lang(zh) del+del, +:lang(zh) del+s, +:lang(zh) ins+ins, +:lang(zh) ins+u, +:lang(zh) s+del, +:lang(zh) s+s, +:lang(zh) u+ins, +:lang(zh) u+u { + margin-left:.125em +} +.table { + border-collapse:collapse; + border-spacing:0; + text-align:left; + width:100% +} +.table.table-striped tbody tr:nth-of-type(odd) { + background:#f8f9fa +} +.table.table-hover tbody tr:hover { + background:#f0f1f4 +} +.table tbody tr.active, +.table.table-striped tbody tr.active { + background:#f0f1f4 +} +.table td { + border-bottom:.1rem solid #f0f1f4; + padding:1.5rem 1rem +} +.table th { + border-bottom:.1rem solid #727e96; + padding:1.5rem 1rem +} +.btn { + -webkit-appearance:none; + -moz-appearance:none; + appearance:none; + background:#fff; + border:.1rem solid #5764c6; + border-radius:.2rem; + color:#5764c6; + cursor:pointer; + display:inline-block; + font-size:1.4rem; + height:3.2rem; + line-height:2rem; + outline:0; + padding:.5rem .8rem; + text-align:center; + text-decoration:none; + transition:all .2s ease; + -webkit-user-select:none; + -moz-user-select:none; + -ms-user-select:none; + user-select:none; + vertical-align:middle; + white-space:nowrap +} +.btn:focus { + background:#fbfbfe; + box-shadow:0 0 0 .2rem rgba(87,100,198,.15); + text-decoration:none +} +.btn:hover { + background:#5764c6; + border-color:#4c59c2; + color:#fff; + text-decoration:none +} +.btn.active, +.btn:active { + background:#4c59c2; + border-color:#3e4cb6; + color:#fff; + text-decoration:none +} +.btn.disabled, +.btn:disabled, +.btn[disabled] { + cursor:default; + opacity:.5; + pointer-events:none +} +.btn.btn-primary { + background:#5764c6; + border-color:#4c59c2; + color:#fff +} +.btn.btn-primary:focus, +.btn.btn-primary:hover { + background:#4452c0; + border-color:#3e4cb6; + color:#fff +} +.btn.btn-primary.active, +.btn.btn-primary:active { + background:#3f4eba; + border-color:#3b49af; + color:#fff +} +.btn.btn-primary.loading::after { + border-bottom-color:#fff; + border-left-color:#fff +} +.btn.btn-link { + background:0 0; + border-color:transparent; + color:#5764c6 +} +.btn.btn-link.active, +.btn.btn-link:active, +.btn.btn-link:focus, +.btn.btn-link:hover { + color:#3b49af +} +.btn.btn-sm { + font-size:1.2rem; + height:2.4rem; + padding:.1rem .8rem +} +.btn.btn-lg { + font-size:1.6rem; + height:4rem; + padding:.9rem .8rem +} +.btn.btn-block { + display:block; + width:100% +} +.btn.btn-action { + padding-left:0; + padding-right:0; + width:3.2rem +} +.btn.btn-action.btn-sm { + width:2.4rem +} +.btn.btn-action.btn-lg { + width:4rem +} +.btn.btn-clear { + background:0 0; + border:0; + color:currentColor; + height:1.6rem; + line-height:1.6rem; + margin-left:.4rem; + margin-right:-.2rem; + opacity:.45; + padding:0 .2rem; + text-decoration:none; + width:1.6rem +} +.btn.btn-clear:hover { + opacity:.85 +} +.btn.btn-clear::before { + content:"\2715" +} +.btn-group { + display:inline-flex; + display:-ms-inline-flexbox; + display:-webkit-inline-flex; + -webkit-flex-wrap:wrap; + -ms-flex-wrap:wrap; + flex-wrap:wrap +} +.btn-group .btn { + -webkit-flex:1 0 auto; + -ms-flex:1 0 auto; + flex:1 0 auto +} +.btn-group .btn:first-child:not(:last-child) { + border-bottom-right-radius:0; + border-top-right-radius:0 +} +.btn-group .btn:not(:first-child):not(:last-child) { + border-radius:0; + margin-left:-.1rem +} +.btn-group .btn:last-child:not(:first-child) { + border-bottom-left-radius:0; + border-top-left-radius:0; + margin-left:-.1rem +} +.btn-group .btn.active, +.btn-group .btn:active, +.btn-group .btn:focus, +.btn-group .btn:hover { + z-index:1 +} +.btn-group.btn-group-block { + display:flex; + display:-ms-flexbox; + display:-webkit-flex +} +.btn-group.btn-group-block .btn { + -webkit-flex:1 0 0; + -ms-flex:1 0 0; + flex:1 0 0 +} +.form-group:not(:last-child) { + margin-bottom:1rem +} +.form-label { + display:block; + padding:.6rem 0 +} +.form-label.label-sm { + padding:.2rem 0 +} +.form-label.label-lg { + padding:1rem 0 +} +.form-input { + -webkit-appearance:none; + -moz-appearance:none; + appearance:none; + background:#fff; + background-image:none; + border:.1rem solid #c4c9d3; + border-radius:.2rem; + color:#50596c; + display:block; + font-size:1.4rem; + height:3.2rem; + line-height:2rem; + max-width:100%; + outline:0; + padding:.5rem .8rem; + position:relative; + transition:all .2s ease; + width:100% +} +.form-input:focus { + border-color:#5764c6; + box-shadow:0 0 0 .2rem rgba(87,100,198,.15) +} +.form-input::-webkit-input-placeholder { + color:#acb3c2 +} +.form-input::-moz-placeholder { + color:#acb3c2 +} +.form-input:-ms-input-placeholder { + color:#acb3c2 +} +.form-input::placeholder { + color:#acb3c2 +} +.form-input.input-sm { + font-size:1.2rem; + height:2.4rem; + padding:.1rem .8rem +} +.form-input.input-lg { + font-size:1.6rem; + height:4rem; + padding:.9rem .8rem +} +.form-input.input-inline { + display:inline-block; + vertical-align:middle; + width:auto +} +textarea.form-input { + height:auto +} +.form-input[type=file] { + height:auto +} +.form-input-hint { + color:#acb3c2; + margin-top:.4rem +} +.has-success .form-input-hint, +.is-success+.form-input-hint { + color:#32b643 +} +.has-error .form-input-hint, +.is-error+.form-input-hint { + color:#e85600 +} +.form-select { + -webkit-appearance:none; + -moz-appearance:none; + appearance:none; + border:.1rem solid #c4c9d3; + border-radius:.2rem; + color:inherit; + font-size:1.4rem; + line-height:2rem; + outline:0; + padding:.5rem .8rem; + vertical-align:middle; + width:100% +} +.form-select[multiple] option { + padding:.2rem .4rem +} +.form-select:not([multiple]) { + background:#fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23667189' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat right .75rem center/.8rem 1rem; + height:3.2rem; + padding-right:2.4rem +} +.form-select:focus { + border-color:#5764c6; + box-shadow:0 0 0 .2rem rgba(87,100,198,.15) +} +.form-select::-ms-expand { + display:none +} +.form-select.select-sm { + font-size:1.2rem; + height:2.4rem; + padding:.1rem 2rem .1rem .6rem +} +.form-select.select-lg { + font-size:1.6rem; + height:4rem; + padding:.9rem 2.4rem .9rem .8rem +} +.form-input.is-success, +.form-select.is-success, +.has-success .form-input, +.has-success .form-select { + border-color:#32b643 +} +.form-input.is-success:focus, +.form-select.is-success:focus, +.has-success .form-input:focus, +.has-success .form-select:focus { + box-shadow:0 0 0 .2rem rgba(50,182,67,.15) +} +.form-input.is-error, +.form-select.is-error, +.has-error .form-input, +.has-error .form-select { + border-color:#e85600 +} +.form-input.is-error:focus, +.form-select.is-error:focus, +.has-error .form-input:focus, +.has-error .form-select:focus { + box-shadow:0 0 0 .2rem rgba(232,86,0,.15) +} +.form-input:not(:placeholder-shown):invalid { + border-color:#e85600 +} +.form-input:not(:placeholder-shown):invalid:focus { + box-shadow:0 0 0 .2rem rgba(232,86,0,.15) +} +.form-input:not(:placeholder-shown):invalid+.form-input-hint { + color:#e85600 +} +.has-icon-left, +.has-icon-right { + position:relative +} +.has-icon-left .form-icon, +.has-icon-right .form-icon { + margin:0 .8rem; + min-width:1.4rem; + position:absolute; + top:50%; + -webkit-transform:translateY(-50%); + -ms-transform:translateY(-50%); + transform:translateY(-50%) +} +.has-icon-left .form-icon { + left:0 +} +.has-icon-left .form-input { + padding-left:3rem +} +.has-icon-right .form-icon { + right:0 +} +.has-icon-right .form-input { + padding-right:3rem +} +.form-checkbox, +.form-radio, +.form-switch { + display:inline-block; + line-height:2rem; + position:relative +} +.form-checkbox input, +.form-radio input, +.form-switch input { + clip:rect(0,0,0,0); + height:.1rem; + margin:-.1rem; + overflow:hidden; + position:absolute; + width:.1rem +} +.form-checkbox input:focus+.form-icon, +.form-radio input:focus+.form-icon, +.form-switch input:focus+.form-icon { + border-color:#5764c6; + box-shadow:0 0 0 .2rem rgba(87,100,198,.15) +} +.form-checkbox input:checked+.form-icon, +.form-radio input:checked+.form-icon, +.form-switch input:checked+.form-icon { + background:#5764c6; + border-color:#5764c6 +} +.form-checkbox .form-icon, +.form-radio .form-icon, +.form-switch .form-icon { + border:.1rem solid #c4c9d3; + cursor:pointer; + display:inline-block; + position:absolute; + transition:all .2s ease +} +.form-checkbox, +.form-radio { + padding:.2rem 2rem +} +.form-checkbox .form-icon, +.form-radio .form-icon { + background:#fff; + height:1.4rem; + left:0; + top:.5rem; + width:1.4rem +} +.form-checkbox input:active+.form-icon, +.form-radio input:active+.form-icon { + background:#f0f1f4 +} +.form-checkbox .form-icon { + border-radius:.2rem +} +.form-checkbox input:checked+.form-icon::before { + background-clip:padding-box; + border:.2rem solid #fff; + border-left-width:0; + border-top-width:0; + content:""; + height:1rem; + left:50%; + margin-left:-.3rem; + margin-top:-.6rem; + position:absolute; + top:50%; + -webkit-transform:rotate(45deg); + -ms-transform:rotate(45deg); + transform:rotate(45deg); + width:.6rem +} +.form-checkbox input:indeterminate+.form-icon { + background:#5764c6; + border-color:#5764c6 +} +.form-checkbox input:indeterminate+.form-icon::before { + background:#fff; + content:""; + height:.2rem; + left:50%; + margin-left:-.5rem; + margin-top:-.1rem; + position:absolute; + top:50%; + width:1rem +} +.form-radio .form-icon { + border-radius:.7rem +} +.form-radio input:checked+.form-icon::before { + background:#fff; + border-radius:.2rem; + content:""; + height:.4rem; + left:50%; + margin-left:-.2rem; + margin-top:-.2rem; + position:absolute; + top:50%; + width:.4rem +} +.form-switch { + padding:.2rem 2rem .2rem 3.6rem +} +.form-switch .form-icon { + background:#e7e9ed; + background-clip:padding-box; + border-radius:.9rem; + height:1.8rem; + left:0; + top:.3rem; + width:3rem +} +.form-switch .form-icon::before { + background:#fff; + border-radius:.8rem; + content:""; + display:block; + height:1.6rem; + left:0; + position:absolute; + top:0; + transition:all .2s ease; + width:1.6rem +} +.form-switch input:checked+.form-icon::before { + left:1.2rem +} +.form-switch input:active+.form-icon::before { + background:#f8f9fa +} +.input-group { + display:flex; + display:-ms-flexbox; + display:-webkit-flex +} +.input-group .input-group-addon { + background:#f8f9fa; + border:.1rem solid #c4c9d3; + border-radius:.2rem; + line-height:2rem; + padding:.5rem .8rem +} +.input-group .input-group-addon.addon-sm { + font-size:1.2rem; + padding:.1rem .8rem +} +.input-group .input-group-addon.addon-lg { + font-size:1.6rem; + padding:.9rem .8rem +} +.input-group .input-group-addon, +.input-group .input-group-btn { + -webkit-flex:1 0 auto; + -ms-flex:1 0 auto; + flex:1 0 auto +} +.input-group .form-input:first-child:not(:last-child), +.input-group .form-select:first-child:not(:last-child), +.input-group .input-group-addon:first-child:not(:last-child), +.input-group .input-group-btn:first-child:not(:last-child) { + border-bottom-right-radius:0; + border-top-right-radius:0 +} +.input-group .form-input:not(:first-child):not(:last-child), +.input-group .form-select:not(:first-child):not(:last-child), +.input-group .input-group-addon:not(:first-child):not(:last-child), +.input-group .input-group-btn:not(:first-child):not(:last-child) { + border-radius:0; + margin-left:-.1rem +} +.input-group .form-input:last-child:not(:first-child), +.input-group .form-select:last-child:not(:first-child), +.input-group .input-group-addon:last-child:not(:first-child), +.input-group .input-group-btn:last-child:not(:first-child) { + border-bottom-left-radius:0; + border-top-left-radius:0; + margin-left:-.1rem +} +.input-group .form-input:focus, +.input-group .form-select:focus, +.input-group .input-group-addon:focus, +.input-group .input-group-btn:focus { + z-index:1 +} +.input-group .form-select { + width:auto +} +.input-group.input-inline { + display:inline-flex; + display:-ms-inline-flexbox; + display:-webkit-inline-flex +} +.form-input.disabled, +.form-input:disabled, +.form-select.disabled, +.form-select:disabled { + background-color:#f0f1f4; + cursor:not-allowed; + opacity:.5 +} +.form-input[readonly] { + background-color:#f8f9fa +} +input.disabled+.form-icon, +input:disabled+.form-icon { + background:#f0f1f4; + cursor:not-allowed; + opacity:.5 +} +.form-switch input.disabled+.form-icon::before, +.form-switch input:disabled+.form-icon::before { + background:#fff +} +.form-horizontal { + padding:1rem +} +.form-horizontal .form-group { + display:flex; + display:-ms-flexbox; + display:-webkit-flex +} +.form-horizontal .form-checkbox, +.form-horizontal .form-radio, +.form-horizontal .form-switch { + margin:.4rem 0 +} +.label { + background:#f8f9fa; + border-radius:.2rem; + color:#5b657a; + display:inline-block; + line-height:1; + padding:.3rem .4rem; + vertical-align:baseline +} +.label.label-primary { + background:#5764c6; + color:#fff +} +.label.label-success { + background:#32b643; + color:#fff +} +.label.label-warning { + background:#ffb700; + color:#fff +} +.label.label-error { + background:#e85600; + color:#fff +} +code { + background:#fdf4f4; + border-radius:.2rem; + color:#e06870; + display:inline-block; + line-height:1; + padding:.3rem .4rem; + vertical-align:baseline +} +.code { + border-radius:.2rem; + color:#50596c; + line-height:2rem; + position:relative +} +.code::before { + color:#acb3c2; + content:attr(data-lang); + font-size:1.2rem; + position:absolute; + right:1rem; + top:.2rem +} +.code code { + background:#f8f9fa; + color:inherit; + display:block; + line-height:inherit; + overflow-x:auto; + padding:2rem; + width:100% +} +.img-responsive { + display:block; + height:auto; + max-width:100% +} +.img-fit-cover { + object-fit:cover +} +.img-fit-contain { + object-fit:contain +} +.video-responsive { + display:block; + overflow:hidden; + padding:0; + position:relative; + width:100% +} +.video-responsive::before { + content:""; + display:block; + padding-bottom:56.25% +} +.video-responsive embed, +.video-responsive iframe, +.video-responsive object { + bottom:0; + height:100%; + left:0; + position:absolute; + right:0; + top:0; + width:100% +} +.video-responsive video { + height:auto; + max-width:100%; + width:100% +} +.video-responsive-4-3::before { + padding-bottom:75% +} +.video-responsive-1-1::before { + padding-bottom:100% +} +.figure { + margin:0 0 1rem 0 +} +.figure .figure-caption { + color:#727e96; + margin-top:1rem +} +.container { + margin-left:auto; + margin-right:auto; + padding-left:1rem; + padding-right:1rem; + width:100% +} +.container.grid-1280 { + max-width:130rem +} +.container.grid-960 { + max-width:98rem +} +.container.grid-480 { + max-width:50rem +} +.columns { + display:flex; + display:-ms-flexbox; + display:-webkit-flex; + -webkit-flex-wrap:wrap; + -ms-flex-wrap:wrap; + flex-wrap:wrap; + margin-left:-1rem; + margin-right:-1rem +} +.columns.col-gapless { + margin-left:0; + margin-right:0 +} +.columns.col-gapless .column { + padding-left:0; + padding-right:0 +} +.columns.col-oneline { + -webkit-flex-wrap:nowrap; + -ms-flex-wrap:nowrap; + flex-wrap:nowrap; + overflow-x:auto +} +.column { + -webkit-flex:1; + -ms-flex:1; + flex:1; + max-width:100%; + padding:1rem +} +.column.col-1, +.column.col-10, +.column.col-11, +.column.col-12, +.column.col-2, +.column.col-3, +.column.col-4, +.column.col-5, +.column.col-6, +.column.col-7, +.column.col-8, +.column.col-9 { + -webkit-flex:none; + -ms-flex:none; + flex:none +} +.col-12 { + width:100% +} +.col-11 { + width:91.66666667% +} +.col-10 { + width:83.33333333% +} +.col-9 { + width:75% +} +.col-8 { + width:66.66666667% +} +.col-7 { + width:58.33333333% +} +.col-6 { + width:50% +} +.col-5 { + width:41.66666667% +} +.col-4 { + width:33.33333333% +} +.col-3 { + width:25% +} +.col-2 { + width:16.66666667% +} +.col-1 { + width:8.33333333% +} +@media screen and (max-width:1280px) { + .col-xl-1, + .col-xl-10, + .col-xl-11, + .col-xl-12, + .col-xl-2, + .col-xl-3, + .col-xl-4, + .col-xl-5, + .col-xl-6, + .col-xl-7, + .col-xl-8, + .col-xl-9 { + -webkit-flex:none; + -ms-flex:none; + flex:none + } + .col-xl-12 { + width:100% + } + .col-xl-11 { + width:91.66666667% + } + .col-xl-10 { + width:83.33333333% + } + .col-xl-9 { + width:75% + } + .col-xl-8 { + width:66.66666667% + } + .col-xl-7 { + width:58.33333333% + } + .col-xl-6 { + width:50% + } + .col-xl-5 { + width:41.66666667% + } + .col-xl-4 { + width:33.33333333% + } + .col-xl-3 { + width:25% + } + .col-xl-2 { + width:16.66666667% + } + .col-xl-1 { + width:8.33333333% + } +} +@media screen and (max-width:960px) { + .col-lg-1, + .col-lg-10, + .col-lg-11, + .col-lg-12, + .col-lg-2, + .col-lg-3, + .col-lg-4, + .col-lg-5, + .col-lg-6, + .col-lg-7, + .col-lg-8, + .col-lg-9 { + -webkit-flex:none; + -ms-flex:none; + flex:none + } + .col-lg-12 { + width:100% + } + .col-lg-11 { + width:91.66666667% + } + .col-lg-10 { + width:83.33333333% + } + .col-lg-9 { + width:75% + } + .col-lg-8 { + width:66.66666667% + } + .col-lg-7 { + width:58.33333333% + } + .col-lg-6 { + width:50% + } + .col-lg-5 { + width:41.66666667% + } + .col-lg-4 { + width:33.33333333% + } + .col-lg-3 { + width:25% + } + .col-lg-2 { + width:16.66666667% + } + .col-lg-1 { + width:8.33333333% + } +} +@media screen and (max-width:840px) { + .col-md-1, + .col-md-10, + .col-md-11, + .col-md-12, + .col-md-2, + .col-md-3, + .col-md-4, + .col-md-5, + .col-md-6, + .col-md-7, + .col-md-8, + .col-md-9 { + -webkit-flex:none; + -ms-flex:none; + flex:none + } + .col-md-12 { + width:100% + } + .col-md-11 { + width:91.66666667% + } + .col-md-10 { + width:83.33333333% + } + .col-md-9 { + width:75% + } + .col-md-8 { + width:66.66666667% + } + .col-md-7 { + width:58.33333333% + } + .col-md-6 { + width:50% + } + .col-md-5 { + width:41.66666667% + } + .col-md-4 { + width:33.33333333% + } + .col-md-3 { + width:25% + } + .col-md-2 { + width:16.66666667% + } + .col-md-1 { + width:8.33333333% + } +} +@media screen and (max-width:600px) { + .col-sm-1, + .col-sm-10, + .col-sm-11, + .col-sm-12, + .col-sm-2, + .col-sm-3, + .col-sm-4, + .col-sm-5, + .col-sm-6, + .col-sm-7, + .col-sm-8, + .col-sm-9 { + -webkit-flex:none; + -ms-flex:none; + flex:none + } + .col-sm-12 { + width:100% + } + .col-sm-11 { + width:91.66666667% + } + .col-sm-10 { + width:83.33333333% + } + .col-sm-9 { + width:75% + } + .col-sm-8 { + width:66.66666667% + } + .col-sm-7 { + width:58.33333333% + } + .col-sm-6 { + width:50% + } + .col-sm-5 { + width:41.66666667% + } + .col-sm-4 { + width:33.33333333% + } + .col-sm-3 { + width:25% + } + .col-sm-2 { + width:16.66666667% + } + .col-sm-1 { + width:8.33333333% + } +} +@media screen and (max-width:480px) { + .col-xs-1, + .col-xs-10, + .col-xs-11, + .col-xs-12, + .col-xs-2, + .col-xs-3, + .col-xs-4, + .col-xs-5, + .col-xs-6, + .col-xs-7, + .col-xs-8, + .col-xs-9 { + -webkit-flex:none; + -ms-flex:none; + flex:none + } + .col-xs-12 { + width:100% + } + .col-xs-11 { + width:91.66666667% + } + .col-xs-10 { + width:83.33333333% + } + .col-xs-9 { + width:75% + } + .col-xs-8 { + width:66.66666667% + } + .col-xs-7 { + width:58.33333333% + } + .col-xs-6 { + width:50% + } + .col-xs-5 { + width:41.66666667% + } + .col-xs-4 { + width:33.33333333% + } + .col-xs-3 { + width:25% + } + .col-xs-2 { + width:16.66666667% + } + .col-xs-1 { + width:8.33333333% + } +} +.show-lg, +.show-md, +.show-sm, +.show-xl, +.show-xs { + display:none!important +} +@media screen and (max-width:480px) { + .hide-xs { + display:none!important + } + .show-xs { + display:block!important + } +} +@media screen and (max-width:600px) { + .hide-sm { + display:none!important + } + .show-sm { + display:block!important + } +} +@media screen and (max-width:840px) { + .hide-md { + display:none!important + } + .show-md { + display:block!important + } +} +@media screen and (max-width:960px) { + .hide-lg { + display:none!important + } + .show-lg { + display:block!important + } +} +@media screen and (max-width:1280px) { + .hide-xl { + display:none!important + } + .show-xl { + display:block!important + } +} +.navbar { + -webkit-align-items:stretch; + align-items:stretch; + display:flex; + display:-ms-flexbox; + display:-webkit-flex; + -ms-flex-align:stretch; + -ms-flex-pack:justify; + -webkit-flex-wrap:wrap; + -ms-flex-wrap:wrap; + flex-wrap:wrap; + -webkit-justify-content:space-between; + justify-content:space-between +} +.navbar .navbar-section { + -webkit-align-items:center; + align-items:center; + display:flex; + display:-ms-flexbox; + display:-webkit-flex; + -webkit-flex:1 0 0; + -ms-flex:1 0 0; + flex:1 0 0; + -ms-flex-align:center +} +.navbar .navbar-section:last-child { + -ms-flex-pack:end; + -webkit-justify-content:flex-end; + justify-content:flex-end +} +.navbar .navbar-center { + -webkit-align-items:center; + align-items:center; + display:flex; + display:-ms-flexbox; + display:-webkit-flex; + -webkit-flex:0 0 auto; + -ms-flex:0 0 auto; + flex:0 0 auto; + -ms-flex-align:center +} +.navbar .navbar-brand { + font-size:1.6rem; + font-weight:500; + text-decoration:none +} +.panel { + border:.1rem solid #f0f1f4; + border-radius:.2rem; + display:flex; + display:-ms-flexbox; + display:-webkit-flex; + -webkit-flex-direction:column; + -ms-flex-direction:column; + flex-direction:column +} +.panel .panel-footer, +.panel .panel-header { + -webkit-flex:0 0 auto; + -ms-flex:0 0 auto; + flex:0 0 auto; + padding:1.5rem +} +.panel .panel-nav { + -webkit-flex:0 0 auto; + -ms-flex:0 0 auto; + flex:0 0 auto +} +.panel .panel-body { + -webkit-flex:1 1 auto; + -ms-flex:1 1 auto; + flex:1 1 auto; + overflow-y:auto; + padding:0 1.5rem +} +.panel .panel-title { + font-size:2rem +} +.panel .panel-subtitle { + color:#bbc1cd +} +.empty { + background:#f8f9fa; + border-radius:.2rem; + color:#727e96; + padding:4rem; + text-align:center +} +.empty .empty-subtitle, +.empty .empty-title { + margin:1rem auto +} +.empty .empty-subtitle { + color:#bbc1cd +} +.empty .empty-action { + margin-top:1.5rem +} +.form-autocomplete { + position:relative +} +.form-autocomplete .form-autocomplete-input { + -webkit-align-content:flex-start; + align-content:flex-start; + display:flex; + display:-ms-flexbox; + display:-webkit-flex; + -ms-flex-line-pack:start; + -webkit-flex-wrap:wrap; + -ms-flex-wrap:wrap; + flex-wrap:wrap; + height:auto; + min-height:3.2rem; + padding:.1rem 0 0 .1rem +} +.form-autocomplete .form-autocomplete-input.is-focused { + border-color:#5764c6; + box-shadow:0 0 0 .2rem rgba(87,100,198,.15) +} +.form-autocomplete .form-autocomplete-input .form-input { + border-color:transparent; + box-shadow:none; + display:inline-block; + -webkit-flex:1 0 auto; + -ms-flex:1 0 auto; + flex:1 0 auto; + height:2.8rem; + padding:.3rem .8rem; + width:auto +} +.form-autocomplete mark { + font-size:1; + padding:.1em 0 +} +.form-autocomplete .menu { + left:0; + position:absolute; + top:100%; + width:100% +} +.avatar { + background:#5764c6; + border-radius:50%; + color:rgba(255,255,255,.85); + display:inline-block; + font-size:1.4rem; + font-weight:300; + height:3.2rem; + line-height:1; + margin:0; + position:relative; + vertical-align:middle; + width:3.2rem +} +.avatar.avatar-xs { + font-size:.8rem; + height:1.6rem; + width:1.6rem +} +.avatar.avatar-sm { + font-size:1rem; + height:2.4rem; + width:2.4rem +} +.avatar.avatar-lg { + font-size:2rem; + height:4.8rem; + width:4.8rem +} +.avatar.avatar-xl { + font-size:2.6rem; + height:6.4rem; + width:6.4rem +} +.avatar img { + border-radius:50%; + height:100%; + position:relative; + width:100%; + z-index:100 +} +.avatar .avatar-icon { + background:#fff; + bottom:14.64%; + height:50%; + padding:.2rem; + position:absolute; + right:14.64%; + -webkit-transform:translate(50%,50%); + -ms-transform:translate(50%,50%); + transform:translate(50%,50%); + width:50% +} +.avatar[data-initial]::before { + color:currentColor; + content:attr(data-initial); + left:50%; + position:absolute; + top:50%; + -webkit-transform:translate(-50%,-50%); + -ms-transform:translate(-50%,-50%); + transform:translate(-50%,-50%); + z-index:1 +} +.badge { + position:relative; + white-space:nowrap +} +.badge:not([data-badge])::after, +.badge[data-badge]::after { + background:#5764c6; + background-clip:padding-box; + border-radius:1rem; + box-shadow:0 0 0 .2rem #fff; + color:#fff; + content:attr(data-badge); + display:inline-block; + -webkit-transform:translate(-.2rem,-1rem); + -ms-transform:translate(-.2rem,-1rem); + transform:translate(-.2rem,-1rem) +} +.badge[data-badge]::after { + font-size:1.2rem; + height:1.8rem; + line-height:1; + min-width:1.8rem; + padding:.3rem .5rem; + text-align:center; + white-space:nowrap +} +.badge:not([data-badge])::after, +.badge[data-badge=""]::after { + height:.6rem; + min-width:.6rem; + padding:0; + width:.6rem +} +.badge.btn::after { + position:absolute; + right:0; + top:0; + -webkit-transform:translate(50%,-50%); + -ms-transform:translate(50%,-50%); + transform:translate(50%,-50%) +} +.badge.avatar::after { + position:absolute; + right:14.64%; + top:14.64%; + -webkit-transform:translate(50%,-50%); + -ms-transform:translate(50%,-50%); + transform:translate(50%,-50%); + z-index:100 +} +.badge.avatar-xs::after { + content:""; + height:.8rem; + min-width:.8rem; + padding:0; + width:.8rem +} +.bar { + background:#f0f1f4; + border-radius:.2rem; + display:flex; + display:-ms-flexbox; + display:-webkit-flex; + -webkit-flex-wrap:nowrap; + -ms-flex-wrap:nowrap; + flex-wrap:nowrap; + height:1.6rem; + width:100% +} +.bar.bar-sm { + height:.4rem +} +.bar .bar-item { + background:#5764c6; + color:#fff; + display:block; + -ms-flex-negative:0; + -webkit-flex-shrink:0; + flex-shrink:0; + font-size:1.2rem; + height:100%; + line-height:1; + padding:.2rem 0; + position:relative; + text-align:center; + width:0 +} +.bar .bar-item:first-child { + border-bottom-left-radius:.2rem; + border-top-left-radius:.2rem +} +.bar .bar-item:last-child { + border-bottom-right-radius:.2rem; + border-top-right-radius:.2rem; + -ms-flex-negative:1; + -webkit-flex-shrink:1; + flex-shrink:1 +} +.bar-slider { + height:.2rem; + margin:1rem 0; + position:relative +} +.bar-slider .bar-item { + left:0; + padding:0; + position:absolute +} +.bar-slider .bar-item:not(:last-child):first-child { + background:#f0f1f4; + z-index:1 +} +.bar-slider .bar-slider-btn { + background:#5764c6; + border:0; + border-radius:50%; + height:1.2rem; + padding:0; + position:absolute; + right:0; + top:50%; + -webkit-transform:translate(50%,-50%); + -ms-transform:translate(50%,-50%); + transform:translate(50%,-50%); + width:1.2rem +} +.bar-slider .bar-slider-btn:active { + box-shadow:0 0 0 .2rem #5764c6 +} +.card { + background:#fff; + border:.1rem solid #f0f1f4; + border-radius:.2rem; + display:block +} +.card .card-body, +.card .card-footer, +.card .card-header { + padding:1.5rem; + padding-bottom:0 +} +.card .card-body:last-child, +.card .card-footer:last-child, +.card .card-header:last-child { + padding-bottom:1.5rem +} +.card .card-image { + padding-top:1.5rem +} +.card .card-image:first-child { + padding-top:0 +} +.card .card-image:first-child img { + border-top-left-radius:.2rem; + border-top-right-radius:.2rem +} +.card .card-image:last-child img { + border-bottom-left-radius:.2rem; + border-bottom-right-radius:.2rem +} +.card .card-title { + font-size:2rem +} +.card .card-subtitle { + color:#bbc1cd; + font-size:1.2rem +} +.chip { + -webkit-align-items:center; + align-items:center; + background:#f0f1f4; + border-radius:.2rem; + color:#727e96; + display:-ms-inline-flexbox; + display:inline-flex; + display:-webkit-inline-flex; + -ms-flex-align:center; + height:2.8rem; + margin:0 .1rem .1rem 0; + max-width:100%; + padding:.1rem .8rem; + text-decoration:none; + vertical-align:middle +} +.chip.active { + background:#5764c6; + color:#fff +} +.chip .avatar { + margin-left:-.4rem; + margin-right:.4rem +} +.dropdown { + display:inline-block; + position:relative +} +.dropdown .menu { + -webkit-animation:slide-down .2s ease 1; + animation:slide-down .2s ease 1; + display:none; + left:0; + position:absolute; + top:100% +} +.dropdown.dropdown-right .menu { + left:auto; + right:0 +} +.dropdown .dropdown-toggle:focus+.menu, +.dropdown .menu:hover, +.dropdown.active .menu { + display:block +} +.dropdown .btn-group .dropdown-toggle:nth-last-child(2) { + border-bottom-right-radius:.2rem; + border-top-right-radius:.2rem +} +.menu { + background:#fff; + border-radius:.2rem; + box-shadow:0 .1rem .4rem rgba(69,77,93,.3); + list-style:none; + margin:0; + min-width:18rem; + padding:1rem; + -webkit-transform:translateY(.5rem); + -ms-transform:translateY(.5rem); + transform:translateY(.5rem); + z-index:100 +} +.menu .menu-item { + margin-top:0; + padding:0 .8rem; + text-decoration:none; + -webkit-user-select:none; + -moz-user-select:none; + -ms-user-select:none; + user-select:none +} +.menu .menu-item>a { + border-radius:.2rem; + color:inherit; + display:block; + margin:0 -.8rem; + padding:.6rem .8rem; + text-decoration:none +} +.menu .menu-item>a:focus, +.menu .menu-item>a:hover { + color:#5764c6 +} +.menu .menu-item>a.active, +.menu .menu-item>a:active { + background:#fbfbfe; + color:#5764c6 +} +.menu .menu-badge { + float:right; + padding:.6rem 0 +} +.menu .menu-badge .btn { + margin-top:-.2rem +} +.modal { + -webkit-align-items:center; + align-items:center; + bottom:0; + display:none; + -ms-flex-align:center; + -ms-flex-pack:center; + -webkit-justify-content:center; + justify-content:center; + left:0; + opacity:0; + overflow:hidden; + padding:1rem; + position:fixed; + right:0; + top:0 +} +.modal.active, +.modal:target { + display:flex; + display:-ms-flexbox; + display:-webkit-flex; + opacity:1; + z-index:400 +} +.modal.active .modal-overlay, +.modal:target .modal-overlay { + background:rgba(69,77,93,.5); + bottom:0; + cursor:default; + display:block; + left:0; + position:absolute; + right:0; + top:0 +} +.modal.active .modal-container, +.modal:target .modal-container { + -webkit-animation:slide-down .2s ease 1; + animation:slide-down .2s ease 1; + max-width:64rem; + z-index:1 +} +.modal.modal-sm .modal-container { + max-width:32rem +} +.modal-container { + background:#fff; + border-radius:.2rem; + box-shadow:0 .4rem 1rem rgba(69,77,93,.3); + display:block; + padding:0; + text-align:left +} +.modal-container .modal-header { + padding:1.5rem +} +.modal-container .modal-header .modal-title { + font-size:1.6rem; + margin:0 +} +.modal-container .modal-body { + max-height:50vh; + overflow-y:auto; + padding:1.5rem; + position:relative +} +.modal-container .modal-footer { + padding:1.5rem; + text-align:right +} +.breadcrumb, +.nav, +.pagination, +.tab { + list-style:none; + margin:.5rem 0 +} +.breadcrumb { + padding:1.2rem +} +.breadcrumb .breadcrumb-item { + display:inline-block; + margin:0 +} +.breadcrumb .breadcrumb-item:last-child { + color:#acb3c2 +} +.breadcrumb .breadcrumb-item:not(:first-child)::before { + color:#e7e9ed; + content:"/"; + padding:0 .4rem +} +.tab { + -webkit-align-items:center; + align-items:center; + display:flex; + display:-ms-flexbox; + display:-webkit-flex; + -ms-flex-align:center; + -webkit-flex-wrap:wrap; + -ms-flex-wrap:wrap; + flex-wrap:wrap +} +.tab .tab-item { + margin-top:0 +} +.tab .tab-item.tab-action { + -webkit-flex:1 0 auto; + -ms-flex:1 0 auto; + flex:1 0 auto; + text-align:right +} +.tab .tab-item a { + border-bottom:.2rem solid transparent; + color:inherit; + display:block; + margin-top:0; + padding:.6rem 1.2rem .4rem 1.2rem; + text-decoration:none +} +.tab .tab-item a:focus, +.tab .tab-item a:hover { + color:#5764c6 +} +.tab .tab-item a.active, +.tab .tab-item.active a { + border-bottom-color:#5764c6; + color:#5764c6 +} +.tab.tab-block .tab-item { + -webkit-flex:1 0 0; + -ms-flex:1 0 0; + flex:1 0 0; + text-align:center +} +.tab.tab-block .tab-item .badge[data-badge]::after { + position:absolute; + right:-.4rem; + top:-.4rem; + -webkit-transform:translate(0,0); + -ms-transform:translate(0,0); + transform:translate(0,0) +} +.tab:not(.tab-block) .badge { + padding-right:.2rem +} +.pagination { + display:flex; + display:-ms-flexbox; + display:-webkit-flex +} +.pagination .page-item { + margin:1rem .1rem +} +.pagination .page-item span { + display:inline-block; + padding:.6rem .4rem +} +.pagination .page-item a { + border-radius:.2rem; + color:#727e96; + display:inline-block; + padding:.6rem .8rem; + text-decoration:none +} +.pagination .page-item a:focus, +.pagination .page-item a:hover { + color:#5764c6 +} +.pagination .page-item a.disabled, +.pagination .page-item a[disabled] { + cursor:default; + opacity:.5; + pointer-events:none +} +.pagination .page-item.active a { + background:#5764c6; + color:#fff +} +.pagination .page-item.page-next, +.pagination .page-item.page-prev { + -webkit-flex:1 0 50%; + -ms-flex:1 0 50%; + flex:1 0 50% +} +.pagination .page-item.page-next { + text-align:right +} +.pagination .page-item .page-item-title { + margin:0 +} +.pagination .page-item .page-item-subtitle { + margin:0; + opacity:.5 +} +.nav { + display:flex; + display:-ms-flexbox; + display:-webkit-flex; + -webkit-flex-direction:column; + -ms-flex-direction:column; + flex-direction:column +} +.nav .nav-item a { + color:#727e96; + padding:.6rem .8rem; + text-decoration:none +} +.nav .nav-item a:focus, +.nav .nav-item a:hover { + color:#5764c6 +} +.nav .nav-item.active>a { + font-weight:700 +} +.nav .nav-item.active>a:focus, +.nav .nav-item.active>a:hover { + color:#5764c6 +} +.nav .nav { + margin-bottom:1rem; + margin-left:2rem +} +.nav .nav a { + color:#acb3c2 +} +.popover { + display:inline-block; + position:relative +} +.popover .popover-container { + content:attr(data-tooltip); + left:50%; + opacity:0; + padding:1rem; + position:absolute; + top:0; + -webkit-transform:translate(-50%,-50%) scale(0); + -ms-transform:translate(-50%,-50%) scale(0); + transform:translate(-50%,-50%) scale(0); + transition:transform .2s ease,-webkit-transform .2s ease; + transition:transform .2s ease; + transition:-webkit-transform .2s ease; + width:32rem; + z-index:400 +} +.popover .popover-container:hover, +.popover :focus+.popover-container, +.popover:hover .popover-container { + display:block; + opacity:1; + -webkit-transform:translate(-50%,-100%) scale(1); + -ms-transform:translate(-50%,-100%) scale(1); + transform:translate(-50%,-100%) scale(1) +} +.popover.popover-right .popover-container { + left:100%; + top:50% +} +.popover.popover-right .popover-container:hover, +.popover.popover-right :focus+.popover-container, +.popover.popover-right:hover .popover-container { + -webkit-transform:translate(0,-50%) scale(1); + -ms-transform:translate(0,-50%) scale(1); + transform:translate(0,-50%) scale(1) +} +.popover.popover-bottom .popover-container { + left:50%; + top:100% +} +.popover.popover-bottom .popover-container:hover, +.popover.popover-bottom :focus+.popover-container, +.popover.popover-bottom:hover .popover-container { + -webkit-transform:translate(-50%,0) scale(1); + -ms-transform:translate(-50%,0) scale(1); + transform:translate(-50%,0) scale(1) +} +.popover.popover-left .popover-container { + left:0; + top:50% +} +.popover.popover-left .popover-container:hover, +.popover.popover-left :focus+.popover-container, +.popover.popover-left:hover .popover-container { + -webkit-transform:translate(-100%,-50%) scale(1); + -ms-transform:translate(-100%,-50%) scale(1); + transform:translate(-100%,-50%) scale(1) +} +.popover .card { + border:0; + box-shadow:0 .4rem 1rem rgba(69,77,93,.3) +} +.step { + display:flex; + display:-ms-flexbox; + display:-webkit-flex; + -webkit-flex-wrap:nowrap; + -ms-flex-wrap:nowrap; + flex-wrap:nowrap; + list-style:none; + margin:.5rem 0; + width:100% +} +.step .step-item { + -webkit-flex:1 1 0; + -ms-flex:1 1 0; + flex:1 1 0; + margin-top:0; + min-height:2rem; + position:relative; + text-align:center +} +.step .step-item:not(:first-child)::before { + background:#5764c6; + content:""; + height:.2rem; + left:-50%; + position:absolute; + top:.9rem; + width:100% +} +.step .step-item a { + color:#acb3c2; + display:inline-block; + padding:2rem 1rem 0; + text-decoration:none +} +.step .step-item a::before { + background:#5764c6; + border:.2rem solid #fff; + border-radius:50%; + content:""; + display:block; + height:1.2rem; + left:50%; + position:absolute; + top:.4rem; + -webkit-transform:translateX(-50%); + -ms-transform:translateX(-50%); + transform:translateX(-50%); + width:1.2rem; + z-index:1 +} +.step .step-item.active a::before { + background:#fff; + border:.2rem solid #5764c6 +} +.step .step-item.active~.step-item::before { + background:#f0f1f4 +} +.step .step-item.active~.step-item a::before { + background:#e7e9ed +} +.tile { + -webkit-align-content:space-between; + align-content:space-between; + -webkit-align-items:flex-start; + align-items:flex-start; + display:flex; + display:-ms-flexbox; + display:-webkit-flex; + -ms-flex-align:start; + -ms-flex-line-pack:justify +} +.tile .tile-action, +.tile .tile-icon { + -webkit-flex:0 0 auto; + -ms-flex:0 0 auto; + flex:0 0 auto +} +.tile .tile-content { + -webkit-flex:1 1 auto; + -ms-flex:1 1 auto; + flex:1 1 auto +} +.tile .tile-content:not(:first-child) { + padding-left:1rem +} +.tile .tile-content:not(:last-child) { + padding-right:1rem +} +.tile .tile-title { + line-height:2rem +} +.tile .tile-subtitle { + color:#bbc1cd; + line-height:2rem +} +.tile.tile-centered { + -webkit-align-items:center; + align-items:center; + -ms-flex-align:center +} +.tile.tile-centered .tile-content { + overflow:hidden +} +.tile.tile-centered .tile-subtitle, +.tile.tile-centered .tile-title { + margin-bottom:0; + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap +} +.toast { + background:rgba(69,77,93,.9); + border:.1rem solid #454d5d; + border-color:#454d5d; + border-radius:.2rem; + color:#fff; + display:block; + padding:1rem; + width:100% +} +.toast.toast-primary { + background:rgba(87,100,198,.9); + border-color:#5764c6 +} +.toast.toast-success { + background:rgba(50,182,67,.9); + border-color:#32b643 +} +.toast.toast-warning { + background:rgba(255,183,0,.9); + border-color:#ffb700 +} +.toast.toast-error { + background:rgba(232,86,0,.9); + border-color:#e85600 +} +.toast a { + color:#fff; + text-decoration:underline +} +.toast a.active, +.toast a:active, +.toast a:focus, +.toast a:hover { + opacity:.75 +} +.tooltip { + position:relative +} +.tooltip::after { + background:rgba(69,77,93,.9); + border-radius:.2rem; + bottom:100%; + color:#fff; + content:attr(data-tooltip); + display:block; + font-size:1.2rem; + left:50%; + max-width:32rem; + opacity:0; + overflow:hidden; + padding:.4rem .8rem; + pointer-events:none; + position:absolute; + text-overflow:ellipsis; + -webkit-transform:translate(-50%,1rem); + -ms-transform:translate(-50%,1rem); + transform:translate(-50%,1rem); + transition:all .2s ease; + white-space:nowrap; + z-index:200 +} +.tooltip:focus::after, +.tooltip:hover::after { + opacity:1; + -webkit-transform:translate(-50%,-.5rem); + -ms-transform:translate(-50%,-.5rem); + transform:translate(-50%,-.5rem) +} +.tooltip.disabled, +.tooltip[disabled] { + pointer-events:auto +} +.tooltip.tooltip-right::after { + bottom:50%; + left:100%; + -webkit-transform:translate(-1rem,50%); + -ms-transform:translate(-1rem,50%); + transform:translate(-1rem,50%) +} +.tooltip.tooltip-right:focus::after, +.tooltip.tooltip-right:hover::after { + -webkit-transform:translate(.5rem,50%); + -ms-transform:translate(.5rem,50%); + transform:translate(.5rem,50%) +} +.tooltip.tooltip-bottom::after { + bottom:auto; + top:100%; + -webkit-transform:translate(-50%,-1rem); + -ms-transform:translate(-50%,-1rem); + transform:translate(-50%,-1rem) +} +.tooltip.tooltip-bottom:focus::after, +.tooltip.tooltip-bottom:hover::after { + -webkit-transform:translate(-50%,.5rem); + -ms-transform:translate(-50%,.5rem); + transform:translate(-50%,.5rem) +} +.tooltip.tooltip-left::after { + bottom:50%; + left:auto; + right:100%; + -webkit-transform:translate(1rem,50%); + -ms-transform:translate(1rem,50%); + transform:translate(1rem,50%) +} +.tooltip.tooltip-left:focus::after, +.tooltip.tooltip-left:hover::after { + -webkit-transform:translate(-.5rem,50%); + -ms-transform:translate(-.5rem,50%); + transform:translate(-.5rem,50%) +} +@-webkit-keyframes loading { + 0% { + -webkit-transform:rotate(0); + transform:rotate(0) + } + 100% { + -webkit-transform:rotate(360deg); + transform:rotate(360deg) + } +} +@keyframes loading { + 0% { + -webkit-transform:rotate(0); + transform:rotate(0) + } + 100% { + -webkit-transform:rotate(360deg); + transform:rotate(360deg) + } +} +@-webkit-keyframes slide-down { + 0% { + opacity:0; + -webkit-transform:translateY(-3rem); + transform:translateY(-3rem) + } + 100% { + opacity:1; + -webkit-transform:translateY(0); + transform:translateY(0) + } +} +@keyframes slide-down { + 0% { + opacity:0; + -webkit-transform:translateY(-3rem); + transform:translateY(-3rem) + } + 100% { + opacity:1; + -webkit-transform:translateY(0); + transform:translateY(0) + } +} +.divider, +.divider-vert { + display:block; + position:relative +} +.divider-vert[data-content]::after, +.divider[data-content]::after { + background:#fff; + color:#e7e9ed; + content:attr(data-content); + display:inline-block; + font-size:1.2rem; + padding:0 .8rem; + -webkit-transform:translateY(-1.1rem); + -ms-transform:translateY(-1.1rem); + transform:translateY(-1.1rem) +} +.divider { + border-top:.1rem solid #f0f1f4; + height:.1rem; + margin:1rem 0 +} +.divider-vert { + display:block; + padding:1rem +} +.divider-vert::before { + border-left:.1rem solid #f0f1f4; + bottom:1rem; + content:""; + display:block; + left:50%; + position:absolute; + top:1rem; + -webkit-transform:translateX(-50%); + -ms-transform:translateX(-50%); + transform:translateX(-50%) +} +.divider-vert[data-content]::after { + left:50%; + padding:.4rem 0; + position:absolute; + top:50%; + -webkit-transform:translate(-50%,-50%); + -ms-transform:translate(-50%,-50%); + transform:translate(-50%,-50%) +} +.loading { + color:transparent!important; + min-height:1.6rem; + pointer-events:none; + position:relative +} +.loading::after { + -webkit-animation:loading .5s infinite linear; + animation:loading .5s infinite linear; + border:.2rem solid #5764c6; + border-radius:.8rem; + border-right-color:transparent; + border-top-color:transparent; + content:""; + display:block; + height:1.6rem; + left:50%; + margin-left:-.8rem; + margin-top:-.8rem; + position:absolute; + top:50%; + width:1.6rem; + z-index:1 +} +.clearfix::after, +.container::after { + clear:both; + content:""; + display:table +} +.float-left { + float:left!important +} +.float-right { + float:right!important +} +.rel { + position:relative +} +.abs { + position:absolute +} +.fixed { + position:fixed +} +.centered { + display:block; + float:none; + margin-left:auto; + margin-right:auto +} +.mt-10 { + margin-top:1rem +} +.mr-10 { + margin-right:1rem +} +.mb-10 { + margin-bottom:1rem +} +.ml-10 { + margin-left:1rem +} +.mt-5 { + margin-top:.5rem +} +.mr-5 { + margin-right:.5rem +} +.mb-5 { + margin-bottom:.5rem +} +.ml-5 { + margin-left:.5rem +} +.pt-10 { + padding-top:1rem +} +.pr-10 { + padding-right:1rem +} +.pb-10 { + padding-bottom:1rem +} +.pl-10 { + padding-left:1rem +} +.pt-5 { + padding-top:.5rem +} +.pr-5 { + padding-right:.5rem +} +.pb-5 { + padding-bottom:.5rem +} +.pl-5 { + padding-left:.5rem +} +.block { + display:block +} +.inline { + display:inline +} +.inline-block { + display:inline-block +} +.flex { + display:flex; + display:-ms-flexbox; + display:-webkit-flex +} +.inline-flex { + display:inline-flex; + display:-ms-inline-flexbox; + display:-webkit-inline-flex +} +.hide { + display:none!important +} +.visible { + visibility:visible +} +.invisible { + visibility:hidden +} +.text-hide { + background:0 0; + border:0; + color:transparent; + font-size:0; + line-height:0; + text-shadow:none +} +.text-assistive { + border:0; + clip:rect(0,0,0,0); + height:.1rem; + margin:-.1rem; + overflow:hidden; + padding:0; + position:absolute; + width:.1rem +} +.text-left { + text-align:left +} +.text-right { + text-align:right +} +.text-center { + text-align:center +} +.text-justify { + text-align:justify +} +.text-lowercase { + text-transform:lowercase +} +.text-uppercase { + text-transform:uppercase +} +.text-capitalize { + text-transform:capitalize +} +.text-normal { + font-weight:400 +} +.text-bold { + font-weight:700 +} +.text-italic { + font-style:italic +} +.text-large { + font-size:1.2em +} +.text-ellipsis { + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap +} +.text-clip { + overflow:hidden; + text-overflow:clip; + white-space:nowrap +} +.text-break { + -webkit-hyphens:auto; + -ms-hyphens:auto; + hyphens:auto; + word-break:break-word; + word-wrap:break-word +} +.hand { + cursor:pointer +} +.shadow-0 { + box-shadow:0 0 .2rem rgba(69,77,93,.3) +} +.shadow-1 { + box-shadow:0 .1rem .4rem rgba(69,77,93,.3) +} +.shadow-2 { + box-shadow:0 .2rem .6rem rgba(69,77,93,.3) +} +.shadow-3 { + box-shadow:0 .3rem .8rem rgba(69,77,93,.3) +} +.shadow-4 { + box-shadow:0 .4rem 1rem rgba(69,77,93,.3) +} +.rounded { + border-radius:.2rem +} +.circle { + border-radius:50% +} diff --git a/docs/topics/license.html b/docs/topics/license.html new file mode 100644 index 00000000..1eab766f --- /dev/null +++ b/docs/topics/license.html @@ -0,0 +1,797 @@ + + + + + + + + license topic + + + + + + + +
    +
    + + + + + + + +
    + + + + + + + + +

    license topic

    +

    +

    + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 +

    Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. +

    Preamble +

    The GNU General Public License is a free, copyleft license for +software and other kinds of works. +

    The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. +

    When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. +

    To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. +

    For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. +

    Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. +

    For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. +

    Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. +

    Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. +

    The precise terms and conditions for copying, distribution and +modification follow. +

    TERMS AND CONDITIONS +

    0. Definitions. +

    "This License" refers to version 3 of the GNU General Public License. +

    "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. +

    "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. +

    To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. +

    A "covered work" means either the unmodified Program or a work based +on the Program. +

    To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. +

    To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. +

    An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. +

    1. Source Code. +

    The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. +

    A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. +

    The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. +

    The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. +

    The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. +

    The Corresponding Source for a work in source code form is that +same work. +

    2. Basic Permissions. +

    All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. +

    You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. +

    Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. +

    3. Protecting Users' Legal Rights From Anti-Circumvention Law. +

    No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. +

    When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. +

    4. Conveying Verbatim Copies. +

    You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. +

    You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. +

    5. Conveying Modified Source Versions. +

    You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: +

    a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. +

    b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". +

    c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. +

    d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. +

    A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. +

    6. Conveying Non-Source Forms. +

    You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: +

    a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. +

    b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. +

    c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. +

    d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. +

    e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. +

    A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. +

    A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. +

    "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. +

    If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). +

    The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. +

    Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. +

    7. Additional Terms. +

    "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. +

    When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. +

    Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: +

    a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or +

    b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or +

    c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or +

    d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or +

    e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or +

    f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. +

    All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. +

    If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. +

    Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. +

    8. Termination. +

    You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). +

    However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. +

    Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. +

    Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. +

    9. Acceptance Not Required for Having Copies. +

    You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. +

    10. Automatic Licensing of Downstream Recipients. +

    Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. +

    An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. +

    You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. +

    11. Patents. +

    A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". +

    A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. +

    Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. +

    In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. +

    If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. +

    If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. +

    A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. +

    Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. +

    12. No Surrender of Others' Freedom. +

    If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. +

    13. Use with the GNU Affero General Public License. +

    Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. +

    14. Revised Versions of this License. +

    The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. +

    Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. +

    If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. +

    Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. +

    15. Disclaimer of Warranty. +

    THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. +

    16. Limitation of Liability. +

    IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. +

    17. Interpretation of Sections 15 and 16. +

    If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. +

    END OF TERMS AND CONDITIONS +

    How to Apply These Terms to Your New Programs +

    If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. +

    To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. +

    Scenario for Facotorio multiplayer. + Copyright (C) 2018 badgamernl +

    This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. +

    This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +

    You should have received a copy of the GNU General Public License + along with this program. If not, see . +

    Also add information on how to contact you by electronic and paper mail. +

    If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: +

    explosivegaming.nl Copyright (C) 2018 badgamernl + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. +

    The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". +

    You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. +

    The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + + + + + + + + + + + + + +
    + + + +

    + + + +
    +
    + + + + + diff --git a/docs/topics/readme.md.html b/docs/topics/readme.md.html new file mode 100644 index 00000000..46789283 --- /dev/null +++ b/docs/topics/readme.md.html @@ -0,0 +1,341 @@ + + + + + + + + readme.md topic + + + + + + + +
    +
    + + + + + + + +
    + + + + + + + + +

    readme.md topic

    +

    +

    + +

    + logo +
    + + Release + + + Downloads + + + Star + + + Fork + + + CodeFactor + + + Discord + +

    +

    ExpGaming Scenario Repository

    +

    ## 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 with in our reset schedule. Although these server tend to the more experienced players our server are open to everyone. You can find us through our [website], [discord], [wiki], or in the public games tab in factorio (ExpGaming S1). +

    ## 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. +

    2) Extract the downloaded zip file from the branch you downloaded into factorio's scenario directory: + * Windows: `%appdata%\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. +

    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. +

    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. +

    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 don't work as expected then it may be returning an error in the log, please report these errors to [the issues page](issues). +

    ## 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]. All our docs can be found [here][docs]. Please keep in mind while making code changes: +

    * New features should have the branch names: `feature/feature-name` +* New features are merged into `dev` after it has been completed. +* After a number of features have been added a release branch is made: `release/X.Y.0`; this branch should have no new features and only bug fixes or localization. +* A release is merged into `master` on the following friday in time for the the weekly reset. +* Patches may be named `patch/X.Y.Z` and fill be merged into `master` and `dev` when appropriate. +

    ## Releases +

    | Scenario Version* | Version Name | Factorio Version** | +|---|---|---| +| [v5.9][s5.9] | Control Modules and Documentation | [v0.17.63][f0.17.63] | +| [v5.8][s5.8] | Home and Chat Bot | [v0.17.47][f0.17.49] | +| [v5.7][s5.7] | Warp System | [v0.17.47][f0.17.47] | +| [v5.6][s5.6] | Information Guis | [v0.17.44][f0.17.44] | +| [v5.5][s5.5] | Gui System | [v0.17.43][f0.17.43] | +| [v5.4][s5.4] | Admin Controls | [v0.17.32][f0.17.32] | +| [v5.3][s5.3] | Custom Roles | [v0.17.28][f0.17.28] | +| [v5.2][s5.2] | Quality of life | [v0.17.22][f0.17.22] | +| [v5.1][s5.1] | Permission Groups | [v0.17.13][f0.17.13] | +| [v5.0][s5.0] | 0.17 Overhaul| [v0.17][f0.17.9] | +| [v4.0][s4.0] | Softmod Manager | [v0.16.51][f0.16.51] | +| [v3.0][s3.0] | 0.16 Overhaul | [v0.16][f0.16] | +| [v2.0][s2.0] | Localization and clean up | [v0.15][f0.15] | +| [v1.0][s1.0] | Modulation | [v0.15][f0.15] | +| [v0.1][s0.1] | First Tracked Version | [v0.14][f0.14] | +

    \* Scenario patch versions have been omitted. +

    \*\* Factorio versions show the version they were made for, often the minimum requirement. +

    [s5.9]: https://github.com/explosivegaming/scenario/releases/tag/5.9.0 +[s5.8]: https://github.com/explosivegaming/scenario/releases/tag/5.8.0 +[s5.7]: https://github.com/explosivegaming/scenario/releases/tag/5.7.0 +[s5.6]: https://github.com/explosivegaming/scenario/releases/tag/5.6.0 +[s5.5]: https://github.com/explosivegaming/scenario/releases/tag/5.5.0 +[s5.4]: https://github.com/explosivegaming/scenario/releases/tag/5.4.0 +[s5.3]: https://github.com/explosivegaming/scenario/releases/tag/5.3.0 +[s5.2]: https://github.com/explosivegaming/scenario/releases/tag/5.2.0 +[s5.1]: https://github.com/explosivegaming/scenario/releases/tag/5.1.0 +[s5.0]: https://github.com/explosivegaming/scenario/releases/tag/5.0.0 +[s4.0]: https://github.com/explosivegaming/scenario/releases/tag/v4.0 +[s3.0]: https://github.com/explosivegaming/scenario/releases/tag/v3.0 +[s2.0]: https://github.com/explosivegaming/scenario/releases/tag/v2.0 +[s1.0]: https://github.com/explosivegaming/scenario/releases/tag/v1.0 +[s0.1]: https://github.com/explosivegaming/scenario/releases/tag/v0.1 +

    [f0.17.63]: https://wiki.factorio.com/Version_history/0.17.0#0.17.63 +[f0.17.49]: https://wiki.factorio.com/Version_history/0.17.0#0.17.49 +[f0.17.47]: https://wiki.factorio.com/Version_history/0.17.0#0.17.47 +[f0.17.44]: https://wiki.factorio.com/Version_history/0.17.0#0.17.44 +[f0.17.43]: https://wiki.factorio.com/Version_history/0.17.0#0.17.43 +[f0.17.32]: https://wiki.factorio.com/Version_history/0.17.0#0.17.32 +[f0.17.28]: https://wiki.factorio.com/Version_history/0.17.0#0.17.28 +[f0.17.22]: https://wiki.factorio.com/Version_history/0.17.0#0.17.22 +[f0.17.13]: https://wiki.factorio.com/Version_history/0.17.0#0.17.13 +[f0.17.9]: https://wiki.factorio.com/Version_history/0.17.0#0.17.9 +[f0.16.51]: https://wiki.factorio.com/Version_history/0.16.0#0.16.51 +[f0.16]: https://wiki.factorio.com/Version_history/0.16.0 +[f0.15]: https://wiki.factorio.com/Version_history/0.15.0 +[f0.14]: https://wiki.factorio.com/Version_history/0.14.0 +

    ## License +

    The Explosive Gaming codebase is licensed under the [GNU General Public License v3.0](LICENSE) +

    [docs]: https://explosivegaming.github.io/scenario/ +[issues]: https://github.com/explosivegaming/scenario/issues/new/choose +[website]: https://explosivegaming.nl +[discord]: https://discord.explosivegaming.nl +[wiki]: https://wiki.explosivegaming.nl + + + + + + + + + + + + + +
    + + + +

    + + + +
    +
    + + + + + diff --git a/expcore/async.lua b/expcore/async.lua new file mode 100644 index 00000000..21ae7080 --- /dev/null +++ b/expcore/async.lua @@ -0,0 +1,71 @@ +--[[-- 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 files are loaded, often this will just be giving access to + -- some functions within a module if you expect that some parts 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 delayed call, such as waiting 2 seconds before printing a message + + -- This player.admin is called (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 + local promote_player = + Async.register(function(player) + player.admin = true + end) + + -- This will allow us to bypass this 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) + func(unpack(params.params)) +end) + +--- Register a new async function, must called when the file is loaded +-- @tparam function callback the function that will become an async function +Async.register = Token.register + +--- Runs the async function linked to this token, you may supply any number of params as needed +-- @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 +function Async.run(token,...) + Task.queue_task(internal_run, { + token = token, + params = {...} + }) +end + +--- Runs the async function linked to this token after the given number of ticks, you may supply any number of params as needed +-- @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 +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 +}) \ No newline at end of file diff --git a/expcore/commands.lua b/expcore/commands.lua index 097c51d6..a0b05475 100644 --- a/expcore/commands.lua +++ b/expcore/commands.lua @@ -1,34 +1,37 @@ ---- Factorio command making module that makes commands with better parse and more modularity --- @author Cooldude2606 ---[[ ->>>>Example Authenticator: - The command system is most useful when you can control who can use commands; to do this would would need to - define an authenticator which is ran every time a command is run; in this example I will show a simple one - that requires some commands to require the user to be a game admin: +--[[-- Core Module - Commands + - Factorio command making module that makes commands with better parse and more modularity + @core Commands + @alias Commands - When the authenticator is called be the command handler it will be passed 4 vales: - 1) the player who used the command - 2) the name of the command that is being used - 3) any flags which have been set for this command, this is a table of values set using :set_flag(name,value) - 4) the reject function which is the preferred method to prevent execution of the command + @usage +---- Example Authenticator: + -- The command system is most useful when you can control who can use commands; to do this would would need to + -- define an authenticator which is ran every time a command is run; in this example I will show a simple one + -- that requires some commands to require the user to be a game admin: - For our admin only example we will set a flag to true when we want it do be admin only so when we define the - command will will use :set_flag('admin_only',true) and then inside the authenticator we will test if the flag - is present using: if flags.admin_only then + -- When the authenticator is called be the command handler it will be passed 4 vales: + -- 1) the player who used the command + -- 2) the name of the command that is being used + -- 3) any flags which have been set for this command, this is a table of values set using :set_flag(name,value) + -- 4) the reject function which is the preferred method to prevent execution of the command - Although no return is required to allow the command to execute it is best practice to return true; we do this in - two cases in our authenticator: - 1) when the "admin_only" flag is not set, which we take to mean any one can use it - 2) when the "admin_only" flag is set, and the player is admin + -- For our admin only example we will set a flag to true when we want it do be admin only so when we define the + -- command will will use :set_flag('admin_only',true) and then inside the authenticator we will test if the flag + -- is present using: if flags.admin_only then - Now when the user is not an admin and the command requires you to be an admin then we must reject the request: - 1) return false -- this is the most basic block and should only be used while testing - 2) return reject -- returning the reject function is only an option as a fail safe, same as returning false - 3) reject() -- this will block execution without returning to allow further code to be ran in the authenticator - 4) reject('This command is for admins only!') -- Using reject as a function allows a error message to be returned - 5) return reject() -- using return on either case above is best practice as you should execute all code before rejecting + -- Although no return is required to allow the command to execute it is best practice to return true; we do this in + -- two cases in our authenticator: + -- 1) when the "admin_only" flag is not set, which we take to mean any one can use it + -- 2) when the "admin_only" flag is set, and the player is admin - Example Code: + -- Now when the user is not an admin and the command requires you to be an admin then we must reject the request: + -- 1) return false -- this is the most basic block and should only be used while testing + -- 2) return reject -- returning the reject function is only an option as a fail safe, same as returning false + -- 3) reject() -- this will block execution without returning to allow further code to be ran in the authenticator + -- 4) reject('This command is for admins only!') -- Using reject as a function allows a error message to be returned + -- 5) return reject() -- using return on either case above is best practice as you should execute all code before rejecting + + -- Example Code: Commands.add_authenticator(function(player,command,flags,reject) if flags.admin_only then -- our test for the "admin_only" flag if player.admin then @@ -41,41 +44,42 @@ end end) ->>>>Example Parse: - Before you go making commands it is important to understand the most powerful feature of this command handler, - when you define a command you are able to type the params and have then be parsed by an handler so before your - command is ever executed you can be sure that all the params are valid. This module should be paired with a general - command parse but you may want to create your own: + @usage +---- Example Parse: + -- Before you go making commands it is important to understand the most powerful feature of this command handler, + -- when you define a command you are able to type the params and have then be parsed by an handler so before your + -- command is ever executed you can be sure that all the params are valid. This module should be paired with a general + -- command parse but you may want to create your own: - For our example we will create a parse to accept only integer numbers in a given range: - 1) we will give it the name "number-range-int" this is the "type" that the input is expected to be - 2) when we define the type we will also define the min and max of the range so we can use the function more than once - Example parse usage: + -- For our example we will create a parse to accept only integer numbers in a given range: + -- 1) we will give it the name "number-range-int" this is the "type" that the input is expected to be + -- 2) when we define the type we will also define the min and max of the range so we can use the function more than once + -- Example parse usage: :add_param('repeat_count',false,'number-range-int',5,10) -- range 5 to 10 inclusive - The command parse will be passed 3 params and any other you define, in our case: - 1) the input that has been given by the user for this param, the role of this function is to transform this value - nb: the input is a string but can be nil if the param is marked as optional - 2) the player who is using the command, this is always present - 3) the reject function to throw an error to the user, this is always present - 4) the range min, this is user defined and has the value given when the param is defined - 5) the range max, this is user defined and has the value given when the param is defined + -- The command parse will be passed 3 params and any other you define, in our case: + -- 1) the input that has been given by the user for this param, the role of this function is to transform this value + -- nb: the input is a string but can be nil if the param is marked as optional + -- 2) the player who is using the command, this is always present + -- 3) the reject function to throw an error to the user, this is always present + -- 4) the range min, this is user defined and has the value given when the param is defined + -- 5) the range max, this is user defined and has the value given when the param is defined - When returning from the param parse you again have a few options with how to do this: - 1) you return the new value for the param (any non nil value) this value is then passed to the command callback - 2) not returning will cause a generic invalid error and the command callback is blocked, not recommenced - 3) return reject -- this is just a failsafe in case the function is not called, same as no return - 4) return reject() -- will give a shorter error message as you pass a nil custom error - 5) return reject('Number entered is not in range: '..range_min..', '..range_max) -- returns a custom error the the user - nb: if you do not return reject after you call it then you are still returning nil so there will be a duplicate message + -- When returning from the param parse you again have a few options with how to do this: + -- 1) you return the new value for the param (any non nil value) this value is then passed to the command callback + -- 2) not returning will cause a generic invalid error and the command callback is blocked, not recommenced + -- 3) return reject -- this is just a failsafe in case the function is not called, same as no return + -- 4) return reject() -- will give a shorter error message as you pass a nil custom error + -- 5) return reject('Number entered is not in range: '..range_min..', '..range_max) -- returns a custom error the the user + -- nb: if you do not return reject after you call it then you are still returning nil so there will be a duplicate message - It should be noted that if you want to expand on an existing parse you can use Commands.parse(type,input,player,reject) - and this value will either return a new value for the input or nil, if it is nil you should return nil to prevent dobble - messages to the user: + -- It should be noted that if you want to expand on an existing parse you can use Commands.parse(type,input,player,reject) + -- and this value will either return a new value for the input or nil, if it is nil you should return nil to prevent double + -- messages to the user: input = Commands.parse('number-int',input,player,reject) if not input then return end -- nil check - Example Code: + -- Example Code: Commands.add_parse('number-range-int',function(input,player,reject,range_min,range_max) local rtn = tonumber(input) and math.floor(tonumber(input)) or nil -- converts input to number if not rtn or rtn < range_min or rtn > range_max then @@ -87,22 +91,23 @@ end end) ->>>>Example Command: - How for the fun part making the commands, the commands can be set up with any number of params and flags that you want, - you can add aliases for the commands and set default values for optional params and of course register your command callback - in our example we will just have a command that will repeat the users name in chat X amount of times and only allow admins to use it. + @usage +---- Example Command: + -- How for the fun part making the commands, the commands can be set up with any number of params and flags that you want, + -- you can add aliases for the commands and set default values for optional params and of course register your command callback + -- in our example we will just have a command that will repeat the users name in chat X amount of times and only allow admins to use it. - First we create the new command, nb this will not register the command to the game this is done at the end, we will call - the command "repeat-name" and set the help message as follows: + -- First we create the new command, nb this will not register the command to the game this is done at the end, we will call + -- the command "repeat-name" and set the help message as follows: Commands.new_command('repeat-name','Will repeat you name a number of times in chat.') - Now for our first param we will call "repeat-count" and it will be a required value between 1 and 5 inclusive: + -- Now for our first param we will call "repeat-count" and it will be a required value between 1 and 5 inclusive: :add_param('repeat-count',false,'number-range-int',1,5) - Our second param we need a custom parse for but we have not defined it, this is an option for when it is unlikely for - any other command to use the same input type; however in our case it will just be a boolean which should be noted as being - included in the general command parse config. As for the param its self it will be called "smiley" and will be optional with - a default value of false: + -- Our second param we need a custom parse for but we have not defined it, this is an option for when it is unlikely for + -- any other command to use the same input type; however in our case it will just be a boolean which should be noted as being + -- included in the general command parse config. As for the param its self it will be called "smiley" and will be optional with + -- a default value of false: :add_param('smiley',true,function(input,player,reject) -- since it is optional the input can be nil, in which case we just return if not input then return end @@ -115,12 +120,12 @@ end end) - Once all params are defined you can now define some default values if you have optional params, the default value will be used only - when no value is given as input, if an invalid value is given then the command will still fail and this value will not be used, the - default can also be a function which is passed the player using the command and returns a value. Here we set the default for "smiley" to false: + -- Once all params are defined you can now define some default values if you have optional params, the default value will be used only + -- when no value is given as input, if an invalid value is given then the command will still fail and this value will not be used, the + -- default can also be a function which is passed the player using the command and returns a value. Here we set the default for "smiley" to false: :set_defaults{smiley=false} - Another example of defaults if we have: item, amount[opt], player[opt] + -- Another example of defaults if we have: item, amount[opt], player[opt] :set_defaults{ amount = 50, -- more than one value can be set at a time player = function(player) @@ -128,18 +133,18 @@ end } - Now the params are set up we can alter how the command works, we can set auth flags, add aliases to this command or enable "auto concat" - which is when you want all extra words to be concatenated onto the end of the last param, useful for reason or messages: + -- Now the params are set up we can alter how the command works, we can set auth flags, add aliases to this command or enable "auto concat" + -- which is when you want all extra words to be concatenated onto the end of the last param, useful for reason or messages: :set_flag('admin_only',true) -- in our case we want "admin_only" to be set to true so only admins can use the command :add_alias('name','rname') -- we also add two aliases here: "name" and "rname" which point to this command -- :enable_auto_concat() we do not use this in our case but this can also be used to enable the "auto concat" feature - And finally we want to register a callback to this command, the callback is what defines what the command does, can be as complex as you - want it to be to as simple as our example; the command receives two params plus all that you have defines: - 1) the player who used the command - 2) in our case repeat_count which will be a number - 3) in our case smiley which will be a boolean - 4) the raw input; this param is always last as is always present as a catch all + -- And finally we want to register a callback to this command, the callback is what defines what the command does, can be as complex as you + -- want it to be to as simple as our example; the command receives two params plus all that you have defines: + -- 1) the player who used the command + -- 2) in our case repeat_count which will be a number + -- 3) in our case smiley which will be a boolean + -- 4) the raw input; this param is always last as is always present as a catch all :register(function(player,repeat_count,smiley,raw) -- this is to show the value for raw as this is an example command, the log file will also show this game.print(player.name..' used a command with input: '..raw) @@ -155,15 +160,15 @@ -- see below for what else can be used here end) - Some other useful functions that can be used are: + -- Some other useful functions that can be used are: Commands.print(any,colour[opt]) -- this will return any value value to the user including if it is ran through rcon console Commands.error(message[opt]) -- this returns a warning to the user, aka an error that does not prevent execution of the command return Commands.error(message[opt]) -- this returns an error to the user, and will halt the command execution, ie no success message is returned - Commands.success(message[opt]) -- used to return a success message however dont use this method see below + Commands.success(message[opt]) -- used to return a success message however don't use this method see below return Commands.success(message[opt]) -- will return the success message to the user and your given message, halts execution return if any value is returned then it will be returned to the player via a Commands.success call - Example Code: + -- Example Code: Commands.new_command('repeat-name','Will repeat you name a number of times in chat.') :add_param('repeat-count',false,'number-range-int',1,5) -- required int in range 1 to 5 inclusive :add_param('smiley',true,function(input,player,reject) -- optional boolean default false @@ -188,36 +193,10 @@ end end) ->>>>Functions List (see function for more detail): - Commands.add_authenticator(callback) --- Adds an authorization callback, function used to check if a player if allowed to use a command - Commands.remove_authenticator(callback) --- Removes an authorization callback, see add_authenticator for adding them - Commands.authorize(player,command_name) --- Mostly used internally, calls all authorization callbacks, returns if the player is authorized - - Commands.get(player) --- Gets all commands that a player is allowed to use, game commands not included - Commands.search(keyword,allowed_player) --- Searches command names and help messages to find possible commands, game commands included - - Commands.add_parse(name,callback) --- Adds a parse function which can be called by name rather than callback (used in add_param) - Commands.remove_parse(name) --- Removes a parse function, see add_parse for adding them - Commands.parse(name,input,player,reject,...) --- Intended to be used within other parse functions, runs a parse and returns success and new value - - Commands.new_command(name,help) --- Creates a new command object to added details to, note this does not register the command to the game - Commands._prototype:add_param(name,optional,parse,...) --- Adds a new param to the command this will be displayed in the help and used to parse the input - Commands._prototype:set_defaults(defaults) --- Adds default values to params only matters if the param is optional - Commands._prototype:set_flag(name,value) --- Adds a tag to the command which is passed via the flags param to the authenticators, can be used to assign command roles or type - Commands._prototype:add_alias(...) --- Adds an alias or multiple that will also be registered with the same callback, eg /teleport can be /tp with both working - Commands._prototype:enable_auto_concat() --- Enables auto concatenation of any params on the end so quotes are not needed for last param - Commands._prototype:register(callback) --- Adds the callback to the command and registers all aliases, params and help message with the game - - Commands.error(error_message,play_sound) --- Sends an error message to the player and returns a constant to return to command handler to exit execution - Commands.internal_error(success,command_name,error_message) --- Sends an error to the player and logs the error, used with pcall within command handler please avoid direct use - Commands.success(value) --- Sends a value to the player, followed by a command complete message - Commands.print(value) --- Short cut for player_return, will return any value given to it (not just strings) in a string format to the player/server - - Commands.run_command(command_event) --- Main event function that is ran for all commands, used internally please avoid direct use ]] -local Game = require 'utils.game' -local player_return,write_json = ext_require('expcore.common','player_return','write_json') +local Game = require 'utils.game' --- @dep utils.game +local player_return,write_json = ext_require('expcore.common','player_return','write_json') --- @dep expcore.common local Commands = { defines={ -- common values are stored error like signals @@ -233,6 +212,10 @@ local Commands = { _prototype={}, -- used to store functions which gets added to new custom commands } +--- Authenication. +-- Functions that control who can use commands +-- @section auth + --- Adds an authorization callback, function used to check if a player if allowed to use a command -- @tparam function callback the callback you want to register as an authenticator -- callback param - player: LuaPlayer - the player who is trying to use the command @@ -317,6 +300,9 @@ function Commands.authorize(player,command_name) return true, Commands.defines.success end end +--- Getters. +-- Functions that get commands +-- @section getters --- Gets all commands that a player is allowed to use, game commands not included -- @tparam[opt] LuaPlayer player the player that you want to get commands of, nil will return all commands @@ -364,6 +350,10 @@ function Commands.search(keyword,allowed_player) return matches end +--- Parse. +-- Functions that help with parsing +-- @section parse + --- Adds a parse function which can be called by name rather than callback (used in add_param) -- nb: this is not needed as you can use the callback directly this just allows it to be called by name -- @tparam string name the name of the parse, should be the type like player or player_alive, must be unique @@ -390,7 +380,7 @@ end --- Intended to be used within other parse functions, runs a parse and returns success and new value -- @tparam string name the name of the parse to call, must be registered and cant be a function --- @tparam string input string the input to pass to the parse, will always be a but might not be the orginal input +-- @tparam string input string the input to pass to the parse, will always be a but might not be the original input -- @tparam LuaPlayer player the player that is calling using the command -- @tparam function reject the reject function that was passed by the command hander -- @treturn any the new value for the input, may be nil, if nil then either there was an error or input was nil @@ -403,6 +393,10 @@ function Commands.parse(name,input,player,reject,...) return rtn end +--- Creation. +-- Functions that create a new command +-- @section creation + --- Creates a new command object to added details to, note this does not register the command to the game -- @tparam string name the name of the command to be created -- @tparam string help the help message for the command @@ -497,7 +491,7 @@ function Commands._prototype:add_alias(...) end --- Enables auto concatenation of any params on the end so quotes are not needed for last param --- nb: this will disable max param checking as they will be concated onto the end of that last param +-- nb: this will disable max param checking as they will be concatenated onto the end of that last param -- this can be useful for reasons or longs text, can only have one per command -- @treturn Commands._prototype pass through to allow more functions to be called function Commands._prototype:enable_auto_concat() @@ -540,6 +534,10 @@ function Commands._prototype:register(callback) end end +--- Status. +-- Functions that indicate status +-- @section status + --- Sends an error message to the player and returns a constant to return to command handler to exit execution -- nb: this is for non fatal errors meaning there is no log of this event -- nb: if reject is giving as a param to the callback use that instead @@ -628,7 +626,7 @@ function Commands.run_command(command_event) local no_quotes = w:sub(2,-2) quote_params[no_spaces]=no_quotes if command_data.auto_concat then - -- if auto concat then dont remove quotes as it should be included later + -- if auto concat then don't remove quotes as it should be included later quote_params[no_spaces]=w end return no_spaces diff --git a/expcore/common.lua b/expcore/common.lua index ee149dbe..1d9ebef0 100644 --- a/expcore/common.lua +++ b/expcore/common.lua @@ -1,44 +1,12 @@ ---- Adds some commonly used functions used in many modules --- @author cooldude2606 ---[[ ->>>>Functions List (see function for more detail): - Common.type_check(value,test_type) --- Compare types faster for faster validation of prams - Common.type_check_error(value,test_type,error_message,level) --- Raises an error if the value is of the incorrect type - Common.param_check(value,test_type,param_name,param_number) --- Raises an error when the value is the incorrect type, uses a consistent error message format - - Common.player_return(value,colour,player) --- Will return a value of any type to the player/server console, allows colour for in-game players - Common.write_json(path,tbl) --- Writes a table object to a file in json format - - Common.opt_require(path) --- Calls a require that will not error if the file is not found - Common.ext_require(path,...) --- Calls a require and returns only the keys given, file must return a table - - Common.format_time(ticks,options) --- Formats tick into a clean format, denominations from highest to lowest - - Common.move_items(items,surface,position,radius,chest_type) --- Moves items to the position and stores them in the closest entity of the type given - - Common.print_grid_value(value, surface, position, scale, offset, immutable) --- Prints a colored value on a location. - Common.print_colored_grid_value(value, surface, position, offset, immutable, - color_value, base_color, delta_color, under_bound, over_bound) --- Prints a colored value on a location. with extra settings. - Common.clear_flying_text(surface) --- Clears all flying text entites on a surface - - Common.string_contains(s, contains) --- Tests if a string contains a given substring. - - Common.extract_keys(tbl,...) --- Extracts certain keys from a table - Common.enum(tbl) --- Converts a table to an enum - Common.auto_complete(options,input,use_key,rtn_key) --- Returns the closest match to the input - Common.table_keys(tbl) --- Returns all the keys of a table - Common.table_values(tbl) --- Returns all the values of a table - Common.table_alphanumsort(tbl) --- Returns the list is a sorted way that would be expected by people (this is by key) - Common.table_keysort(tbl) --- Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above) - - Common.format_chat_colour(message,color) --- Returns a message with valid chat tags to change its colour - Common.format_chat_colour_localized(message,color) --- Returns a message with valid chat tags to change its colour, using localization - Common.format_chat_player_name(player,raw_string) --- Returns the players name in the players color +--[[-- Core Module - Common Library + - Adds some commonly used functions used in many modules + @core Common-Library + @alias Common ]] -local Colours = require 'resources.color_presets' -local Game = require 'utils.game' -local Util = require 'util' +local Colours = require 'resources.color_presets' --- @dep resources.color_presets +local Game = require 'utils.game' --- @dep utils.game +local Util = require 'util' --- @dep util require 'utils.table' require 'utils.math' @@ -141,7 +109,7 @@ function Common.opt_require(path) end --- Calls a require and returns only the keys given, file must return a table --- @usage local extract, param_check = ext_require('expcore.common','extract','param_check') +-- @usage local extract, param_check = ext_require('expcore.common','extract','param_check') --- @dep expcore.common -- @tparam string path the path that you want to require -- @tparam string ... the name of the keys that you want returned -- @return the keys in the order given @@ -262,7 +230,7 @@ function Common.move_items(items,surface,position,radius,chest_type) local entities = surface.find_entities_filtered{area={{p.x-r,p.y-r},{p.x+r,p.y+r}},name=chest_type} or {} local count = #entities local current = 1 - -- Makes a new emtpy chest when it is needed + -- Makes a new empty chest when it is needed local function make_new_chest() local pos = surface.find_non_colliding_position(chest_type,position,32,1) local chest = surface.create_entity{name=chest_type,position=pos,force='neutral'} @@ -437,7 +405,7 @@ function Common.print_colored_grid_value(value, surface, position, offset, immut }.active = false end ---- Clears all flying text entites on a surface +--- Clears all flying text entities on a surface -- @tparam LuaSurface surface the surface to clear function Common.clear_flying_text(surface) local entities = surface.find_entities_filtered{name ='flying-text'} @@ -532,7 +500,7 @@ local function sortFunc(x, y) --sorts tables with mixed index types. end --- Returns a copy of all of the values in the table. --- @tparam table table tbl the to copy the keys from, or an empty table if tbl is nil +-- @tparam table tbl the to copy the keys from, or an empty table if tbl is nil -- @tparam[opt] boolean sorted whether to sort the keys (slower) or keep the random order from pairs() -- @tparam[opt] boolean as_string whether to try and parse the values as strings, or leave them as their existing type -- @treturn array an array with a copy of all the values in the table @@ -558,7 +526,7 @@ function Common.table_values(tbl, sorted, as_string) end --- Returns a copy of all of the keys in the table. --- @tparam table table tbl the to copy the keys from, or an empty table if tbl is nil +-- @tparam table tbl the to copy the keys from, or an empty table if tbl is nil -- @tparam[opt] boolean sorted whether to sort the keys (slower) or keep the random order from pairs() -- @tparam[opt] boolean as_string whether to try and parse the keys as strings, or leave them as their existing type -- @treturn array an array with a copy of all the keys in the table @@ -598,7 +566,7 @@ function Common.table_alphanumsort(tbl) return _tbl end ---- Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above) +--- Returns the list is a sorted way that would be expected by people (this is by key) (faster alternative than above) -- @tparam table tbl the table to be sorted -- @treturn table the sorted table function Common.table_keysort(tbl) @@ -643,4 +611,93 @@ function Common.format_chat_player_name(player,raw_string) end end +--- Returns a desync safe file path for the current file +-- @tparam[opt=0] number offset the offset in the stack to get, 0 is current file +-- @treturn string the 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) +end + +--[[-- Much faster method for inserting items into an array +@tparam table tbl the table that will have the values added to it +@tparam[opt] number start_index the index at which values will be added, nil means end of the array +@tparam table values the new values that will be added to the table +@treturn table the table that was passed as the first argument +@usage-- Adding 1000 values into the middle of the array +local tbl = {} +local values = {} +for i = 1,1000 do tbl[i] = i values[i] = i end +Common.array_insert(tbl,500,values) -- around 0.4ms +]] +function Common.array_insert(tbl,start_index,values) + if not values then + values = start_index + start_index = nil + end + + if start_index then + local starting_length = #tbl + local adding_length = #values + local move_to = start_index+adding_length+1 + for offset = starting_length-start_index, 0, -1 do + tbl[move_to+offset] = tbl[starting_length+offset] + end + start_index = start_index-1 + else + start_index = #tbl + end + + for offset, item in ipairs(values) do + tbl[start_index+offset] = item + end + + return tbl +end + +--[[-- Much faster method for inserting keys into a table +@tparam table tbl the table that will have keys added to it +@tparam[opt] number start_index the index at which values will be added, nil means end of the array, numbered indexs only +@tparam table tbl2 the table that may contain both string and numbered keys +@treturn table the table passed as the first argument +@usage-- Merging two tables +local tbl = {} +local tbl2 = {} +for i = 1,100 do tbl[i] = i tbl['_'..i] = i tbl2[i] = i tbl2['__'..i] = i end +Common.table_insert(tbl,50,tbl2) +]] +function Common.table_insert(tbl,start_index,tbl2) + if not tbl2 then + tbl2 = start_index + start_index = nil + end + + Common.array_insert(tbl,start_index,tbl2) + for key, value in pairs(tbl2) do + if not tonumber(key) then + tbl[key] = value + end + end + + return tbl +end + +--[[-- Used to resolve a value that could also be a function returning that value +@tparam any value the value which you want to test is not nil and if it is a function then call the function +@treturn any the value given or returned by value if it is a function +@usage-- Default value handling +-- if default value is not a function then it is returned +-- if it is a function then it is called with the first argument being self +local value = Common.resolve_value(self.defaut_value,self) +]] +function Common.resolve_value(value,...) + if value then + if type(value) == 'function' then + return value(...) + else + return value + end + end +end + return Common \ No newline at end of file diff --git a/expcore/gui.lua b/expcore/gui.lua index 6da96bbb..82257d43 100644 --- a/expcore/gui.lua +++ b/expcore/gui.lua @@ -1,7 +1,14 @@ ---- This file is used to require all the different elements of the gui module --- each module has an outline here but for more details see their seperate files in ./gui +--[[-- Core Module - Gui + - This file is used to require all the different elements of the gui module + - each module has an outline here but for more details see their separate files in ./gui + - please read the files for more documentation that cant be shown here + - please note there is a rework planned but not started + @core Gui + @alias Gui +]] + +local Gui = require 'expcore.gui.core' --- @dep expcore.gui.core -local Gui = require 'expcore.gui.core' --[[ Core @@ -13,11 +20,11 @@ local Gui = require 'expcore.gui.core' Gui.categorize_by_surface(element) --- A categorize function to be used with add_store, each surface has its own value Gui.toggle_enabled(element) --- Will toggle the enabled state of an element - Gui.toggle_visible(element) --- Will toggle the visiblity of an element + Gui.toggle_visible(element) --- Will toggle the visibility of an element Gui.set_padding(element,up,down,left,right) --- Sets the padding for a gui element Gui.set_padding_style(style,up,down,left,right) --- Sets the padding for a gui style Gui.create_alignment(element,flow_name) --- Allows the creation of a right align flow to place elements into - Gui.destory_if_valid(element) --- Destroies an element but tests for it being present and valid first + Gui.destroy_if_valid(element) --- Destroys an element but tests for it being present and valid first Gui.create_scroll_table(element,table_size,maximal_height,name) --- Creates a scroll area with a table inside, table can be any size Gui.create_header(element,caption,tooltip,right_align,name) --- Creates a header section with a label and button area @@ -35,7 +42,7 @@ local Gui = require 'expcore.gui.core' Prototype:set_caption(value) --- Sets the caption for the element define Prototype:set_tooltip(value) --- Sets the tooltip for the element define Prototype:set_style(style,callback) --- Sets the style for the element define - Prototype:set_embeded_flow(state) --- Sets the element to be drawn inside a nameless flow, can be given a name using a function + Prototype:set_embedded_flow(state) --- Sets the element to be drawn inside a nameless flow, can be given a name using a function Prototype:set_pre_authenticator --- Sets an authenticator that blocks the draw function if check fails Prototype:set_post_authenticator --- Sets an authenticator that disables the element if check fails @@ -48,14 +55,14 @@ local Gui = require 'expcore.gui.core' Prototype:clear_store(category) --- Sets the value in this elements store to nil, category needed if categorize function used ]] -local Instances = require 'expcore.gui.instances' +local Instances = require 'expcore.gui.instances' --- @dep expcore.gui.instances Gui.new_instance_group = Instances.registers Gui.get_instances = Instances.get_elements Gui.add_instance = Instances.get_elements Gui.update_instances = Instances.apply_to_elements Gui.classes.instances = Instances --[[ - Instances.has_categories(name) --- Returns if a instnace group has a categorise function; must be registerd + Instances.has_categories(name) --- Returns if a instance group has a categorise function; must be registered Instances.is_registered(name) --- Returns if the given name is a registered instance group Instances.register(name,categorise) --- Registers the name of an instance group to allow for storing element instances @@ -67,7 +74,7 @@ Gui.classes.instances = Instances Instances.unregistered_get_elements(name,category,callback) --- A version of get_elements that does not require the group to be registered ]] -local Button = require 'expcore.gui.elements.buttons' +local Button = require 'expcore.gui.elements.buttons' --- @dep expcore.gui.elements.buttons Gui.new_button = Button.new_button Gui.classes.button = Button --[[ @@ -77,12 +84,12 @@ Gui.classes.button = Button Button._prototype:on_left_click(player,element) --- Registers a handler for when the button is clicked with the left mouse button Button._prototype:on_right_click(player,element) --- Registers a handler for when the button is clicked with the right mouse button - Button._prototype:set_sprites(sprite,hovered_sprite,clicked_sprite) --- Adds sprites to a button making it a spirte button + Button._prototype:set_sprites(sprite,hovered_sprite,clicked_sprite) --- Adds sprites to a button making it a sprite button Button._prototype:set_click_filter(filter,...) --- Adds a click / mouse button filter to the button Button._prototype:set_key_filter(filter,...) --- Adds a control key filter to the button ]] -local Checkbox = require 'expcore.gui.elements.checkboxs' +local Checkbox = require 'expcore.gui.elements.checkbox' --- @dep expcore.gui.elements.checkbox Gui.new_checkbox = Checkbox.new_checkbox Gui.new_radiobutton = Checkbox.new_radiobutton Gui.new_radiobutton_option_set = Checkbox.new_option_set @@ -98,13 +105,13 @@ Gui.classes.checkbox = Checkbox Checkbox._prototype_radiobutton:on_store_update(callback) --- Registers a handler for when the stored value updates Checkbox._prototype_radiobutton:add_as_option(option_set,option_name) --- Adds this radiobutton to be an option in the given option set (only one can be true at a time) - Checkbox.new_option_set(name,callback,categorize) --- Registers a new option set that can be linked to radiobutotns (only one can be true at a time) + Checkbox.new_option_set(callback,categorize) --- Registers a new option set that can be linked to radiobuttons (only one can be true at a time) Checkbox.draw_option_set(name,element) --- Draws all radiobuttons that are part of an option set at once (Gui.draw will not work) - Checkbox.reset_radiobutton(element,exclude,recursive) --- Sets all radiobutotn in a element to false (unless excluded) and can act recursivly + Checkbox.reset_radiobutton(element,exclude,recursive) --- Sets all radiobuttons in a element to false (unless excluded) and can act recursively ]] -local Dropdown = require 'expcore.gui.elements.dropdown' +local Dropdown = require 'expcore.gui.elements.dropdown' --- @dep expcore.gui.elements.dropdown Gui.new_dropdown = Dropdown.new_dropdown Gui.new_list_box = Dropdown.new_list_box Gui.classes.dropdown = Dropdown @@ -123,7 +130,7 @@ Gui.classes.dropdown = Dropdown Dropdown.get_selected_value(element) --- Returns the currently selected value rather than index ]] -local Slider = require 'expcore.gui.elements.slider' +local Slider = require 'expcore.gui.elements.slider' --- @dep expcore.gui.elements.slider Gui.new_slider = Slider.new_slider Gui.classes.slider = Slider --[[ @@ -137,7 +144,7 @@ Gui.classes.slider = Slider Slider._prototype:enable_auto_draw_label(state) --- Enables auto draw of the label, the label will share the same parent element as the slider ]] -local Text = require 'expcore.gui.elements.text' +local Text = require 'expcore.gui.elements.text' --- @dep expcore.gui.elements.text Gui.new_text_filed = Text.new_text_field Gui.new_text_box = Text.new_text_box Gui.classes.text = Text @@ -154,7 +161,7 @@ Gui.classes.text = Text Text._prototype_box:set_read_only(state) --- Sets the text box to be read only ]] -local ElemButton = require 'expcore.gui.elements.elem-button' +local ElemButton = require 'expcore.gui.elements.elem-button' --- @dep expcore.gui.elements.elem-button Gui.new_elem_button = ElemButton.new_elem_button Gui.classes.elem_button = ElemButton --[[ @@ -167,7 +174,7 @@ Gui.classes.elem_button = ElemButton ElemButton._prototype:set_default(value) --- Sets the default value for the elem button, this may be a function or a string ]] -local ProgressBar = require 'expcore.gui.elements.progress-bar' +local ProgressBar = require 'expcore.gui.elements.progress-bar' --- @dep expcore.gui.elements.progress-bar Gui.new_progressbar = ProgressBar.new_progressbar Gui.set_progressbar_maximum = ProgressBar.set_maximum Gui.increment_progressbar = ProgressBar.increment @@ -176,7 +183,7 @@ Gui.classes.progressbar = ProgressBar --[[ ProgressBar.set_maximum(element,amount,count_down) --- Sets the maximum value that represents the end value of the progress bar ProgressBar.increment(element,amount) --- Increases the value of the progressbar, if a define is given all of its instances are incremented - ProgressBar.decrement(element,amount) --- Decreases the value of the progressbar, if a define is given all of its instances are decresed + ProgressBar.decrement(element,amount) --- Decreases the value of the progressbar, if a define is given all of its instances are decreased ProgressBar.new_progressbar(name) --- Creates a new progressbar element define ProgressBar._prototype:set_maximum(amount,count_down) --- Sets the maximum value that represents the end value of the progress bar @@ -188,13 +195,13 @@ Gui.classes.progressbar = ProgressBar ProgressBar._prototype:add_element(element,maximum) --- Adds an element into the list of instances that will are waiting to complete, does not work with store ProgressBar._prototype:reset_element(element) --- Resets an element, or its store, to be back at the start, either 1 or 0 - ProgressBar._prototype:on_complete(callback) --- Triggers when a progress bar element compeltes (hits 0 or 1) + ProgressBar._prototype:on_complete(callback) --- Triggers when a progress bar element completes (hits 0 or 1) ProgressBar._prototype:on_complete(callback) --- Triggers when a store value completes (hits 0 or 1) - ProgressBar._prototype:event_counter(filter) --- Event handler factory that counts up by 1 every time the event triggeres, can filter which elements are incremented - ProgressBar._prototype:event_countdown(filter) --- Event handler factory that counts down by 1 every time the event triggeres, can filter which elements are decremented + ProgressBar._prototype:event_counter(filter) --- Event handler factory that counts up by 1 every time the event triggers, can filter which elements are incremented + ProgressBar._prototype:event_countdown(filter) --- Event handler factory that counts down by 1 every time the event triggers, can filter which elements are decremented ]] -local Toolbar = require 'expcore.gui.concepts.toolbar' +local Toolbar = require 'expcore.gui.concepts.toolbar' --- @dep expcore.gui.concepts.toolbar Gui.new_toolbar_button = Toolbar.new_button Gui.add_button_to_toolbar = Toolbar.add_button Gui.update_toolbar = Toolbar.update @@ -205,7 +212,7 @@ Gui.classes.toolbar = Toolbar Toolbar.update(player) --- Updates the player's toolbar with an new buttons or expected change in auth return ]] -local LeftFrames = require 'expcore.gui.concepts.left' +local LeftFrames = require 'expcore.gui.concepts.left' --- @dep expcore.gui.concepts.left Gui.get_left_frame_flow = LeftFrames.get_flow Gui.toggle_left_frame = LeftFrames.toggle_frame Gui.new_left_frame = LeftFrames.new_frame @@ -214,16 +221,16 @@ Gui.classes.left_frames = LeftFrames LeftFrames.get_flow(player) --- Gets the left frame flow for a player LeftFrames.get_frame(name,player) --- Gets one frame from the left flow by its name LeftFrames.get_open(player) --- Gets all open frames for a player, if non are open it will remove the close all button - LeftFrames.toggle_frame(name,player,state) --- Toggles the visiblty of a left frame, or sets its visiblty state + LeftFrames.toggle_frame(name,player,state) --- Toggles the visibility of a left frame, or sets its visibility state - LeftFrames.new_frame(permision_name) --- Creates a new left frame define + LeftFrames.new_frame(permission_name) --- Creates a new left frame define LeftFrames._prototype:set_open_by_default(state) --- Sets if the frame is visible when a player joins, can also be a function to return a boolean LeftFrames._prototype:set_direction(direction) --- Sets the direction of the frame, either vertical or horizontal LeftFrames._prototype:get_frame(player) --- Gets the frame for this define from the left frame flow LeftFrames._prototype:is_open(player) --- Returns if the player currently has this define visible - LeftFrames._prototype:toggle(player) --- Toggles the visiblty of the left frame + LeftFrames._prototype:toggle(player) --- Toggles the visibility of the left frame - LeftFrames._prototype:update(player) --- Updates the contents of the left frame, first tries update callback, oter wise will clear and redraw + LeftFrames._prototype:update(player) --- Updates the contents of the left frame, first tries update callback, other wise will clear and redraw LeftFrames._prototype:update_all(update_offline) --- Updates the frame for all players, see update LeftFrames._prototype:redraw(player) --- Redraws the frame by calling on_draw, will always clear the frame LeftFrames._prototype:redraw_all(update_offline) --- Redraws the frame for all players, see redraw @@ -234,7 +241,7 @@ Gui.classes.left_frames = LeftFrames LeftFrames._prototype:event_handler(action) --- Creates an event handler that will trigger one of its functions, use with Event.add ]] -local CenterFrames = require 'expcore.gui.concepts.center' +local CenterFrames = require 'expcore.gui.concepts.center' --- @dep expcore.gui.concepts.center Gui.get_center_flow = CenterFrames.get_flow Gui.toggle_center_frame = CenterFrames.toggle_frame Gui.draw_center_frame = CenterFrames.draw_frame @@ -245,10 +252,10 @@ Gui.classes.center_frames = CenterFrames CenterFrames.get_flow(player) --- Gets the center flow for a player CenterFrames.clear_flow(player) --- Clears the center flow for a player CenterFrames.draw_frame(player,name) --- Draws the center frame for a player, if already open then will do nothing - CenterFrames.redraw_frame(player,name) --- Draws the center frame for a player, if already open then will destory it and redraw + CenterFrames.redraw_frame(player,name) --- Draws the center frame for a player, if already open then will destroy it and redraw CenterFrames.toggle_frame(player,name,state) --- Toggles if the frame is currently open or not, will open if closed and close if open - CenterFrames.new_frame(permision_name) --- Sets the frame to be the current active gui when opened and closes all other frames + CenterFrames.new_frame(permission_name) --- Sets the frame to be the current active gui when opened and closes all other frames CenterFrames._prototype:on_draw(player,frame) --- Use to draw your elements onto the new frame CenterFrames._prototype:set_auto_focus(state) --- Sets the frame to be the current active gui when opened and closes all other frames CenterFrames._prototype:draw_frame(player) --- Draws this frame to the player, if already open does nothing (will call on_draw to draw to the frame) @@ -257,7 +264,7 @@ Gui.classes.center_frames = CenterFrames CenterFrames._prototype:event_handler(action) --- Creates an event handler that will trigger one of its functions, use with Event.add ]] -local PopupFrames = require 'expcore.gui.concepts.popups' +local PopupFrames = require 'expcore.gui.concepts.popups' --- @dep expcore.gui.concepts.popups Gui.get_popup_flow = PopupFrames.get_flow Gui.open_popup = PopupFrames.open Gui.new_popup = PopupFrames.new_popup @@ -266,7 +273,7 @@ Gui.classes.popup_frames = PopupFrames PopupFrames.get_flow(player) --- Gets the left flow that contains the popup frames PopupFrames.open(define_name,player,open_time,...) --- Opens a popup for the player, can give the amount of time it is open as well as params for the draw function - PopupFrames.close_progress --- Progress bar which when depleaded will close the popup frame + PopupFrames.close_progress --- Progress bar which when depleted will close the popup frame PopupFrames.close_button --- A button which can be used to close the gui before the timer runs out PopupFrames.new_popup(name) --- Creates a new popup frame define diff --git a/expcore/gui/concepts/center.lua b/expcore/gui/concepts/center.lua index c7eb5e34..ffbc3f9f 100644 --- a/expcore/gui/concepts/center.lua +++ b/expcore/gui/concepts/center.lua @@ -1,4 +1,12 @@ ---- Gui structure define for center gui frames +--[[-- Core Module - Gui + @module Gui + @alias Prototype +]] + +--- Center Guis. +-- Gui structure define for center gui frames +-- @section center + --[[ >>>> Functions CenterFrames.get_flow(player) --- Gets the center flow for a player @@ -7,7 +15,7 @@ CenterFrames.redraw_frame(player,name) --- Draws the center frame for a player, if already open then will destroy it and redraw CenterFrames.toggle_frame(player,name,state) --- Toggles if the frame is currently open or not, will open if closed and close if open - CenterFrames.new_frame(permision_name) --- Sets the frame to be the current active gui when opened and closes all other frames + CenterFrames.new_frame(permission_name) --- Sets the frame to be the current active gui when opened and closes all other frames CenterFrames._prototype:on_draw(player,frame) --- Use to draw your elements onto the new frame CenterFrames._prototype:set_auto_focus(state) --- Sets the frame to be the current active gui when opened and closes all other frames CenterFrames._prototype:draw_frame(player) --- Draws this frame to the player, if already open does nothing (will call on_draw to draw to the frame) @@ -15,10 +23,10 @@ CenterFrames._prototype:toggle_frame(player) --- Toggles if the frame is open, if open it will close it and if closed it will open it CenterFrames._prototype:event_handler(action) --- Creates an event handler that will trigger one of its functions, use with Event.add ]] -local Gui = require 'expcore.gui.core' -local Prototype = require 'expcore.gui.prototype' -local Toolbar = require 'expcore.gui.concepts.toolbar' -local Game = require 'utils.game' +local Gui = require 'expcore.gui.core' --- @dep expcore.gui.core +local Prototype = require 'expcore.gui.prototype' --- @dep expcore.gui.prototype +local Toolbar = require 'expcore.gui.concepts.toolbar' --- @dep expcore.gui.concepts.toolbar +local Game = require 'utils.game' --- @dep utils.game local CenterFrames = { _prototype = Prototype.extend{ @@ -87,10 +95,10 @@ function CenterFrames.toggle_frame(player,name,state) end --- Creates a new center frame define --- @tparam string permision_name the name that can be used with the permision system +-- @tparam string permission_name the name that can be used with the permission system -- @treturn table the new center frame define -function CenterFrames.new_frame(permision_name) - local self = Toolbar.new_button(permision_name) +function CenterFrames.new_frame(permission_name) + local self = Toolbar.new_button(permission_name) self:on_click(function(player,element) self:toggle_frame(player) diff --git a/expcore/gui/concepts/left.lua b/expcore/gui/concepts/left.lua index d7c25263..e827f36a 100644 --- a/expcore/gui/concepts/left.lua +++ b/expcore/gui/concepts/left.lua @@ -1,4 +1,12 @@ ---- Gui structure define for left frames +--[[-- Core Module - Gui + @module Gui + @alias Prototype +]] + +--- Left Guis. +-- Gui structure define for left frames +-- @section left + --[[ >>>> Example formating @@ -29,16 +37,16 @@ LeftFrames.get_flow(player) --- Gets the left frame flow for a player LeftFrames.get_frame(name,player) --- Gets one frame from the left flow by its name LeftFrames.get_open(player) --- Gets all open frames for a player, if non are open it will remove the close all button - LeftFrames.toggle_frame(name,player,state) --- Toggles the visiblty of a left frame, or sets its visiblty state + LeftFrames.toggle_frame(name,player,state) --- Toggles the visibility of a left frame, or sets its visibility state - LeftFrames.new_frame(permision_name) --- Creates a new left frame define + LeftFrames.new_frame(permission_name) --- Creates a new left frame define LeftFrames._prototype:set_open_by_default(state) --- Sets if the frame is visible when a player joins, can also be a function to return a boolean LeftFrames._prototype:set_direction(direction) --- Sets the direction of the frame, either vertical or horizontal LeftFrames._prototype:get_frame(player) --- Gets the frame for this define from the left frame flow LeftFrames._prototype:is_open(player) --- Returns if the player currently has this define visible - LeftFrames._prototype:toggle(player) --- Toggles the visiblty of the left frame + LeftFrames._prototype:toggle(player) --- Toggles the visibility of the left frame - LeftFrames._prototype:update(player) --- Updates the contents of the left frame, first tries update callback, oter wise will clear and redraw + LeftFrames._prototype:update(player) --- Updates the contents of the left frame, first tries update callback, other wise will clear and redraw LeftFrames._prototype:update_all(update_offline) --- Updates the frame for all players, see update LeftFrames._prototype:redraw(player) --- Redraws the frame by calling on_draw, will always clear the frame LeftFrames._prototype:redraw_all(update_offline) --- Redraws the frame for all players, see redraw @@ -48,13 +56,13 @@ LeftFrames._prototype:on_player_toggle(player,frame) --- Is triggered when the player presses the toggle button LeftFrames._prototype:event_handler(action) --- Creates an event handler that will trigger one of its functions, use with Event.add ]] -local Gui = require 'expcore.gui.core' -local Prototype = require 'expcore.gui.prototype' -local Toolbar = require 'expcore.gui.concepts.toolbar' -local Buttons = require 'expcore.gui.elements.buttons' -local mod_gui = require 'mod-gui' -local Game = require 'utils.game' -local Event = require 'utils.event' +local Gui = require 'expcore.gui.core' --- @dep expcore.gui.core +local Prototype = require 'expcore.gui.prototype' --- @dep expcore.gui.prototype +local Toolbar = require 'expcore.gui.concepts.toolbar' --- @dep expcore.gui.concepts.toolbar +local Buttons = require 'expcore.gui.elements.buttons' --- @dep expcore.gui.elements.buttons +local mod_gui = require 'mod-gui' --- @dep mod-gui +local Game = require 'utils.game' --- @dep utils.game +local Event = require 'utils.event' --- @dep utils.event local LeftFrames = { frames={}, @@ -106,11 +114,11 @@ function LeftFrames.get_open(player) return open end ---- Toggles the visiblty of a left frame, or sets its visiblty state +--- Toggles the visibility of a left frame, or sets its visibility state -- @tparam string name the name of the gui frame to toggle -- @tparam LuaPlayer player the player to get the frame of --- @tparam[opt] boolean state when given will be the state that the visiblty is set to --- @treturn boolean the new state of the visiblity +-- @tparam[opt] boolean state when given will be the state that the visibility is set to +-- @treturn boolean the new state of the visibility function LeftFrames.toggle_frame(name,player,state) local define = LeftFrames.frames[name] if not define then @@ -130,10 +138,10 @@ function LeftFrames.toggle_frame(name,player,state) end --- Creates a new left frame define --- @tparam string permision_name the name that can be used with the permision system +-- @tparam string permission_name the name that can be used with the permission system -- @treturn table the new left frame define -function LeftFrames.new_frame(permision_name) - local self = Toolbar.new_button(permision_name) +function LeftFrames.new_frame(permission_name) + local self = Toolbar.new_button(permission_name) local mt = getmetatable(self) mt.__index = LeftFrames._prototype @@ -151,7 +159,7 @@ function LeftFrames.new_frame(permision_name) end --- Sets if the frame is visible when a player joins, can also be a function to return a boolean --- @tparam[opt=true] ?boolean|function state the default state of the visiblty, can be a function +-- @tparam[opt=true] ?boolean|function state the default state of the visibility, can be a function -- state param - player LuaPlayer - the player that has joined the game -- state param - define_name string - the define name for the frame -- state return - boolean - false will hide the frame @@ -167,7 +175,7 @@ function LeftFrames._prototype:set_open_by_default(state) end --- Sets the direction of the frame, either vertical or horizontal --- @tparam string direction the direction to have the elements be added to thef frame +-- @tparam string direction the direction to have the elements be added to the frame function LeftFrames._prototype:set_direction(direction) self.direction = direction return self @@ -221,9 +229,9 @@ function LeftFrames._prototype:is_open(player) return frame and frame.visible or false end ---- Toggles the visiblty of the left frame +--- Toggles the visibility of the left frame -- @tparam LuaPlayer player the player to toggle the frame of --- @treturn boolean the new state of the visiblity +-- @treturn boolean the new state of the visibility function LeftFrames._prototype:toggle(player) local frame = self:get_frame(player) Gui.toggle_visible(frame) @@ -231,7 +239,7 @@ function LeftFrames._prototype:toggle(player) return frame.visible end ---- Updates the contents of the left frame, first tries update callback, oter wise will clear and redraw +--- Updates the contents of the left frame, first tries update callback, other wise will clear and redraw -- @tparam LuaPlayer player the player to update the frame of function LeftFrames._prototype:update(player) local frame = self:get_frame(player) diff --git a/expcore/gui/concepts/popups.lua b/expcore/gui/concepts/popups.lua index 91da73ed..bda932b3 100644 --- a/expcore/gui/concepts/popups.lua +++ b/expcore/gui/concepts/popups.lua @@ -1,25 +1,33 @@ ---- Gui structure define for popup gui +--[[-- Core Module - Gui + @module Gui + @alias Prototype +]] + +--- Popups. +-- Gui structure define for popup gui +-- @section popups + --[[ >>>> Functions PopupFrames.get_flow(player) --- Gets the left flow that contains the popup frames PopupFrames.open(define_name,player,open_time,...) --- Opens a popup for the player, can give the amount of time it is open as well as params for the draw function - PopupFrames.close_progress --- Progress bar which when depleaded will close the popup frame + PopupFrames.close_progress --- Progress bar which when depleted will close the popup frame PopupFrames.close_button --- A button which can be used to close the gui before the timer runs out PopupFrames.new_popup(name) --- Creates a new popup frame define PopupFrames._prototype:set_default_open_time(amount) --- Sets the default open time for the popup, will be used if non is provided with open PopupFrames._prototype:open(player,open_time,...) --- Opens this define for a player, can be given open time and any other params for the draw function ]] -local Gui = require 'expcore.gui.core' -local Prototype = require 'expcore.gui.prototype' -local Game = require 'utils.game' -local Event = require 'utils.event' -local ProgressBar = require 'expcore.gui.elements.progress-bar' -local Button = require 'expcore.gui.elements.buttons' -local mod_gui = require 'mod-gui' -local Color = require 'resources.color_presets' -local Global = require 'utils.global' +local Gui = require 'expcore.gui.core' --- @dep expcore.gui.core +local Prototype = require 'expcore.gui.prototype' --- @dep expcore.gui.prototype +local Game = require 'utils.game' --- @dep utils.game +local Event = require 'utils.event' --- @dep utils.event +local ProgressBar = require 'expcore.gui.elements.progress-bar' --- @dep expcore.gui.elements.progress-bar +local Button = require 'expcore.gui.elements.buttons' --- @dep expcore.gui.elements.buttons +local mod_gui = require 'mod-gui' --- @dep mod-gui +local Color = require 'resources.color_presets' --- @dep resources.color_presets +local Global = require 'utils.global' --- @dep utils.global local PopupFrames = { paused_popups={}, @@ -34,17 +42,17 @@ Global.register(PopupFrames.paused_popups,function(tbl) PopupFrames.paused_popups = tbl end) ---- Sets the state of the element in the pasued list, nil or true +--- Sets the state of the element in the paused list, nil or true -- @tparam LuaGuiElement element the element to set the state of -- @tparam[opt] boolean state the state to set it to, true will pause the the progress bar -local function set_pasued_state(element,state) +local function set_paused_state(element,state) local name = element.player_index..':'..element.index PopupFrames.paused_popups[name] = state end ---- Gets the state of the element in the pasued list, nil or true +--- Gets the state of the element in the paused list, nil or true -- @tparam LuaGuiElement element the element to get the state of -local function get_pasued_state(element) +local function get_paused_state(element) local name = element.player_index..':'..element.index return PopupFrames.paused_popups[name] end @@ -75,11 +83,11 @@ end local function close_popup(element) local frame = element.parent.parent.parent if not frame or not frame.valid then return end - set_pasued_state(element.parent[PopupFrames.close_progress:uid()]) + set_paused_state(element.parent[PopupFrames.close_progress:uid()]) frame.destroy() end ---- Progress bar which when depleaded will close the popup frame +--- Progress bar which when depleted will close the popup frame PopupFrames.close_progress = ProgressBar.new_progressbar() :use_count_down() @@ -100,20 +108,20 @@ end) --- When the progress bar is clicked it will pause its progress, or resume if previously paused Gui.on_click(PopupFrames.close_progress:uid(),function(event) local element = event.element - if get_pasued_state(element) then - set_pasued_state(element) + if get_paused_state(element) then + set_paused_state(element) else - set_pasued_state(element,true) + set_paused_state(element,true) end end) --- When the parent flow of the progress bar is clicked it will pause its progress, or resume if previously paused Gui.on_click(PopupFrames.close_frame_name,function(event) local element = event.element[PopupFrames.close_progress:uid()] - if get_pasued_state(element) then - set_pasued_state(element) + if get_paused_state(element) then + set_paused_state(element) else - set_pasued_state(element,true) + set_paused_state(element,true) end end) @@ -214,9 +222,9 @@ Event.add(defines.events.on_player_created,function(event) } end) ---- Every tick any, not pasued, progress bars will go down by one tick +--- Every tick any, not paused, progress bars will go down by one tick Event.add(defines.events.on_tick,PopupFrames.close_progress:event_countdown(function(element) - return not get_pasued_state(element) + return not get_paused_state(element) end)) return PopupFrames \ No newline at end of file diff --git a/expcore/gui/concepts/toolbar.lua b/expcore/gui/concepts/toolbar.lua index ff1e0f06..10a8d971 100644 --- a/expcore/gui/concepts/toolbar.lua +++ b/expcore/gui/concepts/toolbar.lua @@ -1,4 +1,12 @@ ---- Gui structure for the toolbar (top left) +--[[-- Core Module - Gui + @module Gui + @alias Prototype +]] + +--- Toolbar. +-- Gui structure for the toolbar (top left) +-- @section toolbar + --[[ >>>> Example format -- this is the same as any other button define, this just automatically draws it @@ -14,25 +22,25 @@ Toolbar.add_button(button) --- Adds an existing buttton to the toolbar Toolbar.update(player) --- Updates the player's toolbar with an new buttons or expected change in auth return ]] -local Gui = require 'expcore.gui.core' -local Buttons = require 'expcore.gui.elements.buttons' -local Roles = require 'expcore.roles' -local Event = require 'utils.event' -local Game = require 'utils.game' -local mod_gui = require 'mod-gui' +local Gui = require 'expcore.gui.core' --- @dep expcore.gui.core +local Buttons = require 'expcore.gui.elements.buttons' --- @dep expcore.gui.elements.buttons +local Roles = require 'expcore.roles' --- @dep expcore.roles +local Event = require 'utils.event' --- @dep utils.event +local Game = require 'utils.game' --- @dep utils.game +local mod_gui = require 'mod-gui' --- @dep mod-gui local Toolbar = { - permisison_names = {}, + permission_names = {}, buttons = {} } function Toolbar.allowed(player,define_name) - local permisison_name = Toolbar.permisison_names[define_name] or define_name - return Roles.player_allowed(player,permisison_name) + local permission_name = Toolbar.permission_names[define_name] or define_name + return Roles.player_allowed(player,permission_name) end -function Toolbar.permission_alias(define_name,permisison_name) - Toolbar.permisison_names[define_name] = permisison_name +function Toolbar.permission_alias(define_name,permission_name) + Toolbar.permission_names[define_name] = permission_name end --- Adds a new button to the toolbar diff --git a/expcore/gui/core.lua b/expcore/gui/core.lua index 97719e96..1fd93480 100644 --- a/expcore/gui/core.lua +++ b/expcore/gui/core.lua @@ -1,6 +1,14 @@ ---- Core gui file for making element defines and element classes (use require 'expcore.gui') +--[[-- Core Module - Gui + @module Gui + @alias Prototype +]] + +--- Core. +-- Core gui file for making element defines and element classes (use require 'expcore.gui') -- see utils.gui for event handlering -- see expcore.gui.test for examples for element defines +-- @section core + --[[ >>>> Basic useage with no defines This module can be igroned if you are only wanting only event handlers as utils.gui adds the following: @@ -125,12 +133,12 @@ Gui.set_padding(element,up,down,left,right) --- Sets the padding for a gui element Gui.set_padding_style(style,up,down,left,right) --- Sets the padding for a gui style Gui.create_alignment(element,flow_name) --- Allows the creation of a right align flow to place elements into - Gui.destory_if_valid(element) --- Destroies an element but tests for it being present and valid first + Gui.destroy_if_valid(element) --- Destroies an element but tests for it being present and valid first Gui.create_scroll_table(element,table_size,maximal_height,name) --- Creates a scroll area with a table inside, table can be any size Gui.create_header(element,caption,tooltip,right_align,name) --- Creates a header section with a label and button area ]] -local Gui = require 'utils.gui' -local Game = require 'utils.game' +local Gui = require 'utils.gui' --- @dep utils.gui +local Game = require 'utils.game' --- @dep utils.game Gui.classes = {} -- Stores the class definations used to create element defines Gui.defines = {} -- Stores the indivdual element definations @@ -138,6 +146,7 @@ Gui.names = {} -- Stores debug names to link to gui uids --- Used to create new element defines from a class prototype, please use the own given by the class -- @tparam table prototype the class prototype that will be used for the element define +-- @tparam[opt] string debug_name the name that you want to see while debuging -- @treturn table the new element define with all functions accessed via __index metamethod function Gui.new_define(prototype,debug_name) local name = Gui.uid_name() @@ -159,7 +168,7 @@ function Gui.new_define(prototype,debug_name) end --- Gets an element define give the uid, debug name or a copy of the element define --- @tparam name ?string|table the uid, debug name or define for the element define to get +-- @tparam ?string|table name the uid, debug name or define for the element define to get -- @tparam[opt] boolean internal when true the error trace is one level higher (used internally) -- @treturn table the element define that was found or an error function Gui.get_define(name,internal) @@ -207,8 +216,8 @@ function Gui.categorize_by_surface(element) end --- Draws a copy of the element define to the parent element, see draw_to --- @tparam name ?string|table the uid, debug name or define for the element define to draw --- @tparam element LuaGuiEelement the parent element that it the define will be drawn to +-- @tparam ?string|table name the uid, debug name or define for the element define to draw +-- @tparam LuaGuiEelement element the parent element that it the define will be drawn to -- @treturn LuaGuiElement the new element that was created function Gui.draw(name,element,...) local define = Gui.get_define(name,true) @@ -256,7 +265,7 @@ function Gui.set_padding(element,up,down,left,right) end --- Sets the padding for a gui style --- @tparam element LuaStyle the element to set the padding for +-- @tparam LuaStyle style the element to set the padding for -- @tparam[opt=0] number up the amount of padding on the top -- @tparam[opt=0] number down the amount of padding on the bottom -- @tparam[opt=0] number left the amount of padding on the left @@ -288,7 +297,7 @@ end --- Destroies an element but tests for it being present and valid first -- @tparam LuaGuiElement element the element to be destroied -- @treturn boolean true if it was destoried -function Gui.destory_if_valid(element) +function Gui.destroy_if_valid(element) if element and element.valid then element.destroy() return true diff --git a/expcore/gui/elements/buttons.lua b/expcore/gui/elements/buttons.lua index 66aa957e..aa06f58b 100644 --- a/expcore/gui/elements/buttons.lua +++ b/expcore/gui/elements/buttons.lua @@ -1,4 +1,12 @@ ---- Gui class define for buttons and sprite buttons +--[[-- Core Module - Gui + @module Gui + @alias Prototype +]] + +--- Buttons. +-- Gui class define for buttons and sprite buttons +-- @section Buttons + --[[ >>>> Functions Button.new_button(name) --- Creates a new button element define @@ -7,15 +15,15 @@ Button._prototype:on_left_click(player,element) --- Registers a handler for when the button is clicked with the left mouse button Button._prototype:on_right_click(player,element) --- Registers a handler for when the button is clicked with the right mouse button - Button._prototype:set_sprites(sprite,hovered_sprite,clicked_sprite) --- Adds sprites to a button making it a spirte button + Button._prototype:set_sprites(sprite,hovered_sprite,clicked_sprite) --- Adds sprites to a button making it a sprite button Button._prototype:set_click_filter(filter,...) --- Adds a click / mouse button filter to the button Button._prototype:set_key_filter(filter,...) --- Adds a control key filter to the button Other functions present from expcore.gui.core ]] -local mod_gui = require 'mod-gui' -local Gui = require 'expcore.gui.core' -local Prototype = require 'expcore.gui.prototype' +local mod_gui = require 'mod-gui' --- @dep mod-gui +local Gui = require 'expcore.gui.core' --- @dep expcore.gui.core +local Prototype = require 'expcore.gui.prototype' --- @dep expcore.gui.prototype local Button = { _prototype=Prototype.extend{ @@ -66,7 +74,7 @@ function Button.new_button(name) return self end ---- Adds sprites to a button making it a spirte button +--- Adds sprites to a button making it a sprite button -- @tparam SpritePath sprite the sprite path for the default sprite for the button -- @tparam[opt] SpritePath hovered_sprite the sprite path for the sprite when the player hovers over the button -- @tparam[opt] SpritePath clicked_sprite the sprite path for the sprite when the player clicks the button @@ -103,7 +111,7 @@ end --- Adds a control key filter to the button -- @tparam table filter ?string|table either a of control keys or the first control keys to filter, with a table true means allowed --- @tparam[opt] table ... when filter is not a you can add the control keyss one after each other +-- @tparam[opt] table ... when filter is not a you can add the control keys one after each other -- @treturn self returns the button define to allow chaining function Button._prototype:set_key_filter(filter,...) if type(filter) == 'string' then diff --git a/expcore/gui/elements/checkboxs.lua b/expcore/gui/elements/checkbox.lua similarity index 86% rename from expcore/gui/elements/checkboxs.lua rename to expcore/gui/elements/checkbox.lua index 0b68952a..ce9b2a8a 100644 --- a/expcore/gui/elements/checkboxs.lua +++ b/expcore/gui/elements/checkbox.lua @@ -1,4 +1,12 @@ ---- Gui class define for checkboxs and radiobuttons +--[[-- Core Module - Gui + @module Gui + @alias Prototype +]] + +--- Checkboxs. +-- Gui class define for checkbox and radiobuttons +-- @section checkboxs + --[[ >>>> Using an option set An option set is a set of radio buttons where only one of them can be active at a time, this means that when one @@ -26,7 +34,7 @@ Note that these radiobuttons can still have on_element_update events but this may result in a double trigger of events as the option set update is always triggered; also add_store cant be used as the option set acts as the store however get - and set store will still work but will effect the option set rather than the indivual radiobuttons. + and set store will still work but will effect the option set rather than the individual radiobuttons. >>>> Functions Checkbox.new_checkbox(name) --- Creates a new checkbox element define @@ -38,17 +46,17 @@ Checkbox._prototype_radiobutton:on_store_update(callback) --- Registers a handler for when the stored value updates Checkbox._prototype_radiobutton:add_as_option(option_set,option_name) --- Adds this radiobutton to be an option in the given option set (only one can be true at a time) - Checkbox.new_option_set(name,callback,categorize) --- Registers a new option set that can be linked to radiobutotns (only one can be true at a time) + Checkbox.new_option_set(name,callback,categorize) --- Registers a new option set that can be linked to radiobutton (only one can be true at a time) Checkbox.draw_option_set(name,element) --- Draws all radiobuttons that are part of an option set at once (Gui.draw will not work) - Checkbox.reset_radiobutton(element,exclude,recursive) --- Sets all radiobutotn in a element to false (unless excluded) and can act recursivly + Checkbox.reset_radiobutton(element,exclude,recursive) --- Sets all radiobutton in a element to false (unless excluded) and can act recursively Other functions present from expcore.gui.core ]] -local Gui = require 'expcore.gui.core' -local Prototype = require 'expcore.gui.prototype' -local Store = require 'expcore.store' -local Game = require 'utils.game' +local Gui = require 'expcore.gui.core' --- @dep expcore.gui.core +local Prototype = require 'expcore.gui.prototype' --- @dep expcore.gui.prototype +local Store = require 'expcore.store' --- @dep expcore.store +local Game = require 'utils.game' --- @dep utils.game --- Store call for store update -- @tparam table define the define that this is acting on @@ -66,14 +74,12 @@ local Checkbox = { _prototype_checkbox=Prototype.extend{ on_element_update = Prototype.event, on_store_update = Prototype.event, - add_store = Prototype.store(false,store_update), - add_sync_store = Prototype.store(true,store_update) + add_store = Prototype.store(store_update) }, _prototype_radiobutton=Prototype.extend{ on_element_update = Prototype.event, on_store_update = Prototype.event, - add_store = Prototype.store(false,store_update), - add_sync_store = Prototype.store(true,store_update) + add_store = Prototype.store(store_update) } } @@ -88,8 +94,7 @@ function Checkbox.new_checkbox(name) self:on_draw(function(player,element) if self.store then - local category = self.categorize and self.categorize(element) or nil - local state = self:get_store(category,true) + local state = self:get_store(element,true) if state then element.state = true end end end) @@ -99,13 +104,11 @@ function Checkbox.new_checkbox(name) if self.option_set then local value = Checkbox.option_sets[self.option_set][element.name] - local category = self.categorize and self.categorize(element) - self:set_store(category,value) + self:set_store(element,value) elseif self.store then local value = element.state - local category = self.categorize and self.categorize(element) - self:set_store(category,value) + self:set_store(element,value) else self:raise_event('on_element_update',event.player,element,element.state) @@ -131,7 +134,7 @@ end --- Adds this radiobutton to be an option in the given option set (only one can be true at a time) -- @tparam string option_set the name of the option set to add this element to --- @tparam string option_name the name of this option that will be used to idenitife it +-- @tparam string option_name the name of this option that will be used to identify it -- @treturn self the define to allow chaining function Checkbox._prototype_radiobutton:add_as_option(option_set,option_name) self.option_set = option_set @@ -166,16 +169,16 @@ function Checkbox._prototype_radiobutton:set_store(category,value,internal) return Store.set(location,category,value) end ---- Registers a new option set that can be linked to radiobutotns (only one can be true at a time) --- @tparam string name the name of the option set, must be unique --- @tparam function callback the update callback when the value of the option set chagnes +--- Registers a new option set that can be linked to radiobuttons (only one can be true at a time) +-- @tparam function callback the update callback when the value of the option set changes -- callback param - value string - the new selected option for this option set -- callback param - category string - the category that updated if categorize was used -- @tparam function categorize the function used to convert an element into a string -- @treturn string the name of this option set to be passed to add_as_option -function Checkbox.new_option_set(name,callback,categorize) +function Checkbox.new_option_set(callback,categorize) + local name = Store.register(categorize) - Store.register(name,function(value,category) + Store.watch(name,function(value,category) local options = Checkbox.option_sets[name] for opt_name,define_name in pairs(options) do if Gui.defines[define_name] then @@ -208,7 +211,7 @@ function Checkbox.draw_option_set(name,element) end ---- Sets all radiobutotn in a element to false (unless excluded) and can act recursivly +--- Sets all radiobutton in a element to false (unless excluded) and can act recursively -- @tparam LuaGuiElement element the root gui element to start setting radio buttons from -- @tparam[opt] table exclude ?string|table the name of the radiobutton to exclude or a of radiobuttons where true will set the state true -- @tparam[opt=false] ?number|boolean recursive if true will recur as much as possible, if a will recur that number of times diff --git a/expcore/gui/elements/dropdown.lua b/expcore/gui/elements/dropdown.lua index 847492f5..ae6857c0 100644 --- a/expcore/gui/elements/dropdown.lua +++ b/expcore/gui/elements/dropdown.lua @@ -1,4 +1,12 @@ ---- Gui class define for dropdowns and list boxs +--[[-- Core Module - Gui + @module Gui + @alias Prototype +]] + +--- Dropdowns. +-- Gui class define for dropdowns and list box +-- @section dropdowns + --[[ >>>> Functions Dropdown.new_dropdown(name) --- Creates a new dropdown element define @@ -16,9 +24,9 @@ Other functions present from expcore.gui.core ]] -local Gui = require 'expcore.gui.core' -local Prototype = require 'expcore.gui.prototype' -local Game = require 'utils.game' +local Gui = require 'expcore.gui.core' --- @dep expcore.gui.core +local Prototype = require 'expcore.gui.prototype' --- @dep expcore.gui.prototype +local Game = require 'utils.game' --- @dep utils.game local select_value --- Store call for store update @@ -39,8 +47,7 @@ local Dropdown = { _prototype=Prototype.extend{ on_element_update = Prototype.event, on_store_update = Prototype.event, - add_store = Prototype.store(false,store_update), - add_sync_store = Prototype.store(true,store_update) + add_store = Prototype.store(store_update) } } @@ -63,8 +70,7 @@ function Dropdown.new_dropdown(name) end if self.store then - local category = self.categorize and self.categorize(element) or nil - local value = self:get_store(category) + local value = self:get_store(element) if value then Dropdown.select_value(element,value) end end end) @@ -74,8 +80,7 @@ function Dropdown.new_dropdown(name) local value = Dropdown.get_selected_value(element) if self.store then - local category = self.categorize and self.categorize(element) or value - self:set_store(category,value) + self:set_store(element,value) else local player = event.player diff --git a/expcore/gui/elements/elem-button.lua b/expcore/gui/elements/elem-button.lua index c70c1aa6..8b2b2b3c 100644 --- a/expcore/gui/elements/elem-button.lua +++ b/expcore/gui/elements/elem-button.lua @@ -1,4 +1,12 @@ ---- Gui class defines for elem buttons +--[[-- Core Module - Gui + @module Gui + @alias Prototype +]] + +--- Elem Buttons. +-- Gui class defines for elem buttons +-- @section elem-buttons + --[[ >>>> Functions ElemButton.new_elem_button(name) --- Creates a new elem button element define @@ -11,9 +19,9 @@ Other functions present from expcore.gui.core ]] -local Gui = require 'expcore.gui.core' -local Prototype = require 'expcore.gui.prototype' -local Game = require 'utils.game' +local Gui = require 'expcore.gui.core' --- @dep expcore.gui.core +local Prototype = require 'expcore.gui.prototype' --- @dep expcore.gui.prototype +local Game = require 'utils.game' --- @dep utils.game --- Store call for store update -- @tparam table define the define that this is acting on @@ -29,8 +37,7 @@ local ElemButton = { _prototype=Prototype.extend{ on_element_update = Prototype.event, on_store_update = Prototype.event, - add_store = Prototype.store(false,store_update), - add_sync_store = Prototype.store(true,store_update) + add_store = Prototype.store(store_update) } } @@ -48,8 +55,7 @@ function ElemButton.new_elem_button(name) end if self.store then - local category = self.categorize and self.categorize(element) or nil - local value = self:get_store(category) + local value = self:get_store(element) if value then element.elem_value = value end end end) @@ -59,8 +65,7 @@ function ElemButton.new_elem_button(name) local value = element.elem_value if self.store then - local category = self.categorize and self.categorize(element) or value - self:set_store(category,value) + self:set_store(element,value) else self:raise_event('on_element_update',event.player,element,value) diff --git a/expcore/gui/elements/progress-bar.lua b/expcore/gui/elements/progress-bar.lua index 020ab2a3..0e096d42 100644 --- a/expcore/gui/elements/progress-bar.lua +++ b/expcore/gui/elements/progress-bar.lua @@ -1,9 +1,17 @@ ---- Gui element define for progess bars +--[[-- Core Module - Gui + @module Gui + @alias Prototype +]] + +--- Progress Bars. +-- Gui element define for progress bars +-- @section progress-bars + --[[ >>>> Functions ProgressBar.set_maximum(element,amount,count_down) --- Sets the maximum value that represents the end value of the progress bar - ProgressBar.increment(element,amount) --- Increases the value of the progressbar, if a define is given all of its instances are incremented - ProgressBar.decrement(element,amount) --- Decreases the value of the progressbar, if a define is given all of its instances are decresed + ProgressBar.increment(element,amount) --- Increases the value of the progressbar, if a define is given all of its instances have incremented + ProgressBar.decrement(element,amount) --- Decreases the value of the progressbar, if a define is given all of its instances have decremented ProgressBar.new_progressbar(name) --- Creates a new progressbar element define ProgressBar._prototype:set_maximum(amount,count_down) --- Sets the maximum value that represents the end value of the progress bar @@ -15,15 +23,15 @@ ProgressBar._prototype:add_element(element,maximum) --- Adds an element into the list of instances that will are waiting to complete, does not work with store ProgressBar._prototype:reset_element(element) --- Resets an element, or its store, to be back at the start, either 1 or 0 - ProgressBar._prototype:on_complete(callback) --- Triggers when a progress bar element compeltes (hits 0 or 1) + ProgressBar._prototype:on_complete(callback) --- Triggers when a progress bar element completes (hits 0 or 1) ProgressBar._prototype:on_complete(callback) --- Triggers when a store value completes (hits 0 or 1) - ProgressBar._prototype:event_counter(filter) --- Event handler factory that counts up by 1 every time the event triggeres, can filter which elements are incremented - ProgressBar._prototype:event_countdown(filter) --- Event handler factory that counts down by 1 every time the event triggeres, can filter which elements are decremented + ProgressBar._prototype:event_counter(filter) --- Event handler factory that counts up by 1 every time the event triggers, can filter which elements have incremented + ProgressBar._prototype:event_countdown(filter) --- Event handler factory that counts down by 1 every time the event triggers, can filter which elements have decremented ]] -local Gui = require 'expcore.gui.core' -local Prototype = require 'expcore.gui.prototype' -local Global = require 'utils.global' -local Game = require 'utils.game' +local Gui = require 'expcore.gui.core' --- @dep expcore.gui.core +local Prototype = require 'expcore.gui.prototype' --- @dep expcore.gui.prototype +local Global = require 'utils.global' --- @dep utils.global +local Game = require 'utils.game' --- @dep utils.game --- Event call for when the value is outside the range 0-1 -- @tparam table define the define that this is acting on @@ -52,12 +60,11 @@ end local ProgressBar = { unregistered={}, -- elements with no callbacks - independent={}, -- elements with a link to a deinfe + independent={}, -- elements with a link to a define _prototype=Prototype.extend{ on_complete = Prototype.event, on_store_complete = Prototype.event, - add_store = Prototype.store(false,store_update), - add_sync_store = Prototype.store(true,store_update) + add_store = Prototype.store(store_update) } } @@ -84,7 +91,7 @@ end --- Gets the element data, used when there is no define -- @tparam LuaGuiElement element the element to get the data of --- @treturn table the element data simialr to define +-- @treturn table the element data similar to define local function get_element(element) if not element.valid then return end local name = element.player_index..':'..element.index @@ -102,7 +109,7 @@ function ProgressBar.set_maximum(element,amount) local define = get_define(element) if define then - define:set_deafult_maximum(amount) + define:set_default_maximum(amount) else local element_data = get_element(element) @@ -122,7 +129,7 @@ function ProgressBar.set_maximum(element,amount) end end ---- Increases the value of the progressbar, if a define is given all of its instances are incremented +--- Increases the value of the progressbar, if a define is given all of its instances have incremented -- @tparam ?LuaGuiElement|string element either a gui element or a registered define -- @tparam[opt=1] number amount the amount to increase the progressbar by function ProgressBar.increment(element,amount) @@ -149,7 +156,7 @@ function ProgressBar.increment(element,amount) end end ---- Decreases the value of the progressbar, if a define is given all of its instances are decresed +--- Decreases the value of the progressbar, if a define is given all of its instances have decremented -- @tparam ?LuaGuiElement|string element either a gui element or a registered define -- @tparam[opt=1] number amount the amount to decrease the progressbar by function ProgressBar.decrement(element,amount) @@ -178,7 +185,7 @@ end --- Creates a new progressbar element define -- @tparam[opt] string name the optional debug name that can be added --- @treturn table the new progressbar elemente define +-- @treturn table the new progressbar element define function ProgressBar.new_progressbar(name) local self = Gui.new_define(ProgressBar._prototype,name) @@ -186,11 +193,10 @@ function ProgressBar.new_progressbar(name) self:on_draw(function(player,element,maximum) if self.store then - local category = self.categorize and self.categorize(element) or nil - local value = self:get_store(category) + local value = self:get_store(element) if not value then value = self.count_down and 1 or 0 - self:set_store(category,value) + self:set_store(element,value) end element.value = value @@ -342,15 +348,14 @@ function ProgressBar._prototype:reset_element(element) if not element or not element.valid then return end local value = self.count_down and 1 or 0 if self.store then - local category = self.categorize and self.categorize(element) or value - self:set_store(category,value) + self:set_store(element,value) else element.value = value end end ---- Event handler factory that counts up by 1 every time the event triggeres, can filter which elements are incremented --- @tparam[opt] function filter when given will use filtered incerement +--- Event handler factory that counts up by 1 every time the event triggers, can filter which elements have incremented +-- @tparam[opt] function filter when given will use filtered increment -- @treturn function the event handler function ProgressBar._prototype:event_counter(filter) if type(filter) == 'function' then @@ -364,8 +369,8 @@ function ProgressBar._prototype:event_counter(filter) end end ---- Event handler factory that counts down by 1 every time the event triggeres, can filter which elements are decremented --- @tparam[opt] function filter when given will use filtered decerement +--- Event handler factory that counts down by 1 every time the event triggers, can filter which elements have decremented +-- @tparam[opt] function filter when given will use filtered decrement -- @treturn function the event handler function ProgressBar._prototype:event_countdown(filter) if type(filter) == 'function' then diff --git a/expcore/gui/elements/slider.lua b/expcore/gui/elements/slider.lua index abd34f29..e8099b06 100644 --- a/expcore/gui/elements/slider.lua +++ b/expcore/gui/elements/slider.lua @@ -1,4 +1,12 @@ ---- Gui class define for silders +--[[-- Core Module - Gui + @module Gui + @alias Prototype +]] + +--- Sliders. +-- Gui class define for sliders +-- @section sliders + --[[ >>>> Functions Slider.new_slider(name) --- Creates a new slider element define @@ -12,10 +20,10 @@ Other functions present from expcore.gui.core ]] -local Gui = require 'expcore.gui.core' -local Prototype = require 'expcore.gui.prototype' -local Instances = require 'expcore.gui.instances' -local Game = require 'utils.game' +local Gui = require 'expcore.gui.core' --- @dep expcore.gui.core +local Prototype = require 'expcore.gui.prototype' --- @dep expcore.gui.prototype +local Instances = require 'expcore.gui.instances' --- @dep expcore.gui.instances +local Game = require 'utils.game' --- @dep utils.game --- Event call for on_value_changed and store update -- @tparam table define the define that this is acting on @@ -53,8 +61,7 @@ local Slider = { _prototype=Prototype.extend{ on_element_update = Prototype.event, on_store_update = Prototype.event, - add_store = Prototype.store(false,store_update), - add_sync_store = Prototype.store(true,store_update) + add_store = Prototype.store(store_update) } } @@ -80,8 +87,7 @@ function Slider.new_slider(name) element.set_slider_minimum_maximum(min,max) if self.store then - local category = self.categorize and self.categorize(element) or nil - local value = self:get_store(category) + local value = self:get_store(element) if value then element.slider_value = value end end @@ -95,8 +101,7 @@ function Slider.new_slider(name) local value = element.slider_value if self.store then - local category = self.categorize and self.categorize(element) or value - self:set_store(category,value) + self:set_store(element,value) else event_call(self,element,value) @@ -128,7 +133,7 @@ function Slider._prototype:set_range(min,max) end --- Draws a new label and links its value to the value of this slider, if no store then it will only show one value per player --- @tparam LuaGuiElement element the parent element that the lable will be drawn to +-- @tparam LuaGuiElement element the parent element that the label will be drawn to -- @treturn LuaGuiElement the new label element so that styles can be applied function Slider._prototype:draw_label(element) local name = self.name..'-label' @@ -136,8 +141,7 @@ function Slider._prototype:draw_label(element) local value = 0 if self.store then - local category = self.categorize and self.categorize(element) or value - value = self:get_store(category) or 0 + value = self:get_store(element) or 0 end local new_element = element.add{ diff --git a/expcore/gui/elements/text.lua b/expcore/gui/elements/text.lua index 0c38895a..56709ede 100644 --- a/expcore/gui/elements/text.lua +++ b/expcore/gui/elements/text.lua @@ -1,4 +1,12 @@ ---- Gui class define for text fields and text boxs +--[[-- Core Module - Gui + @module Gui + @alias Prototype +]] + +--- Text. +-- Gui class define for text fields and text boxes +-- @section text + --[[ >>>> Functions Text.new_text_field(name) --- Creates a new text field element define @@ -14,9 +22,9 @@ Other functions present from expcore.gui.core ]] -local Gui = require 'expcore.gui.core' -local Prototype = require 'expcore.gui.prototype' -local Game = require 'utils.game' +local Gui = require 'expcore.gui.core' --- @dep expcore.gui.core +local Prototype = require 'expcore.gui.prototype' --- @dep expcore.gui.prototype +local Game = require 'utils.game' --- @dep utils.game --- Store call for store update -- @tparam table define the define that this is acting on @@ -32,14 +40,12 @@ local Text = { _prototype_field=Prototype.extend{ on_element_update = Prototype.event, on_store_update = Prototype.event, - add_store = Prototype.store(false,store_update), - add_sync_store = Prototype.store(true,store_update) + add_store = Prototype.store(store_update) }, _prototype_box=Prototype.extend{ on_element_update = Prototype.event, on_store_update = Prototype.event, - add_store = Prototype.store(false,store_update), - add_sync_store = Prototype.store(true,store_update) + add_store = Prototype.store(store_update) } } @@ -65,8 +71,7 @@ function Text.new_text_field(name) end if self.store then - local category = self.categorize and self.categorize(element) or nil - local value = self:get_store(category) + local value = self:get_store(element) if value then element.text = value end end end) @@ -76,8 +81,7 @@ function Text.new_text_field(name) local value = element.text if self.store then - local category = self.categorize and self.categorize(element) or value - self:set_store(category,value) + self:set_store(element,value) else self:raise_event('on_element_update',event.player,element,value) diff --git a/expcore/gui/instances.lua b/expcore/gui/instances.lua index cd3616d8..2db7273e 100644 --- a/expcore/gui/instances.lua +++ b/expcore/gui/instances.lua @@ -1,17 +1,25 @@ ---- This file is a breakout from core which forcues on instance management of defines +--[[-- Core Module - Gui + @module Gui + @alias Prototype +]] + +--- Instances. +-- This file is a breakout from core which forcues on instance management of defines +-- @section instances + --[[ >>>> Using registered instance groups - The main use of this module is to register a group of elements refered here as "instances of an element define" in which + The main use of this module is to register a group of elements referred here as "instances of an element define" in which is meant that you define the name of a group of drawn elements that are really just multiple versions of a single element. For example this might be that you have one label in multiple places (either for one player or many) and you want to update the caption of all of them at once; this is where this module comes it. - First you must register the way that the intances are stored and under what name, using Instances.register you will give the - name of the collective group of instances followed by an optional categorise function which allows varients to be stored under one + First you must register the way that the instances are stored and under what name, using Instances.register you will give the + name of the collective group of instances followed by an optional serializer function which allows variants to be stored under one name (like one for each force or player) - -- categorise works in the same way as store categorise - -- so the function will worl here but no value is stored only gui elements + -- serializer works in the same way as store serializer + -- so the function will world here but no value is stored only gui elements Instances.register('score',Gui.categorize_by_force) Then when you draw the new element to a gui you will want to add the element to the group: @@ -26,13 +34,13 @@ element.caption = 0 end) - Note that if you dont give a categorise function then you dont need to give a category when getting the elements. + Note that if you don't give a serializer function then you don't need to give a category when getting the elements. >>>> Using unregistered instance groups When using a registered group and the functions that go with them it is much simpler to use and more importantly includes error checking - for valid instance group names; the down side is that the group must be registered which can only be done during startup and not during runtime. - To counter this there are two functions simlair to those above in order to add and get instances but may lead to errors not being noticed due to - the error interal error checking being skiped to allow it to work. + for valid instance group names; the down side is that the group must be registered which can only be done during start-up and not during runtime. + To counter this there are two functions similar to those above in order to add and get instances but may lead to errors not being noticed due to + the error internal error checking being skipped to allow it to work. The main difference between the two groups of functions is that the category must always be present even if is nil; example below shows how a instance group would work when registered vs unregistered: @@ -50,7 +58,7 @@ element.caption = '0' end) -- gets all instances from the player force and sets the caption to 0 - -- Registered without category; note that category can just be igroned + -- Registered without category; note that category can just be ignored Instances.register('score') -- all instances will be under one group with no categories Instances.add_element('score',new_element) -- adds the new element to the instance list Instances.apply_to_elements('score',function(element) @@ -64,9 +72,9 @@ end) -- gets all instances and sets the element caption to 0 >>>> Functions - Instances.has_categories(name) --- Returns if a instnace group has a categorise function; must be registerd + Instances.has_categories(name) --- Returns if a instance group has a serializer function; must be registered Instances.is_registered(name) --- Returns if the given name is a registered instance group - Instances.register(name,categorise) --- Registers the name of an instance group to allow for storing element instances + Instances.register(name,serializer) --- Registers the name of an instance group to allow for storing element instances Instances.add_element(name,element) --- Adds an element to the instance group under the correct category; must be registered Instances.get_elements_raw(name,category) --- Gets all element instances without first removing any invalid ones; used internally and must be registered @@ -75,49 +83,49 @@ Instances.unregistered_add_element(name,category,element) --- A version of add_element that does not require the group to be registered Instances.unregistered_get_elements(name,category,callback) --- A version of get_elements that does not require the group to be registered ]] -local Global = require 'utils.global' +local Global = require 'utils.global' --- @dep utils.global local Instances = { - categorise={}, + serializer={}, data={} } Global.register(Instances.data,function(tbl) Instances.data = tbl end) ---- Returns if a instnace group has a categorise function; must be registerd +--- Returns if a instance group has a serializer function; must be registered -- @tparam string name the name of the instance group --- @treturn boolean true if there is a categorise function +-- @treturn boolean true if there is a serializer function function Instances.has_categories(name) - return type(Instances.categorise[name]) == 'function' + return type(Instances.serializer[name]) == 'function' end --- Returns if the given name is a registered instance group -- @tparam string name the name of the instance group you are testing -- @treturn boolean true if the name is registered function Instances.is_registered(name) - return Instances.categorise[name] ~= nil + return Instances.serializer[name] ~= nil end --- Registers the name of an instance group to allow for storing element instances -- @tparam string name the name of the instance group; must to unique --- @tparam[opt] function categorise function used to turn the element into a string --- categorise param - element LuaGuiElement - the gui element to be turned into a string --- categorise return - string - the category that the element will be added to like the player's name or force's name --- @treturn string the name that was added so it can be used as a varible -function Instances.register(name,categorise) +-- @tparam[opt] function serializer function used to turn the element into a string +-- serializer param - element LuaGuiElement - the gui element to be turned into a string +-- serializer return - string - the category that the element will be added to like the player's name or force's name +-- @treturn string the name that was added so it can be used as a variable +function Instances.register(name,serializer) if _LIFECYCLE ~= _STAGE.control then return error('Can only be called during the control stage', 2) end - if Instances.categorise[name] then + if Instances.serializer[name] then return error('Instances for '..name..' already exist.',2) end - categorise = type(categorise) == 'function' and categorise or true + serializer = type(serializer) == 'function' and serializer or true Instances.data[name] = {} - Instances.categorise[name] = categorise + Instances.serializer[name] = serializer return name end @@ -126,12 +134,12 @@ end -- @tparam string name the name of the instance group to add the element to -- @tparam LuaGuiElement element the element to add the the instance group function Instances.add_element(name,element) - if not Instances.categorise[name] then - return error('Inavlid name for instance group: '..name,2) + if not Instances.serializer[name] then + return error('Invalid name for instance group: '..name,2) end if Instances.has_categories(name) then - local category = Instances.categorise[name](element) + local category = Instances.serializer[name](element) if not Instances.data[name][category] then Instances.data[name][category] = {} end table.insert(Instances.data[name][category],element) else @@ -141,11 +149,11 @@ end --- Gets all element instances without first removing any invalid ones; used internally and must be registered -- @tparam string name the name of the instance group to get the instances of --- @tparam[opt] string category the category to get the instance from, not needed when no categorise function +-- @tparam[opt] string category the category to get the instance from, not needed when no serializer function -- @treturn table the table of element instances of which some may be invalid function Instances.get_elements_raw(name,category) - if not Instances.categorise[name] then - return error('Inavlid name for instance group: '..name,2) + if not Instances.serializer[name] then + return error('Invalid name for instance group: '..name,2) end if Instances.has_categories(name) then @@ -157,24 +165,24 @@ end --- Gets all valid element instances and has the option of running a callback on those that are valid -- @tparam string name the name of the instance group to get the instances of --- @tparam[opt] string category the category to get the instances of, not needed when no categorise function --- @tparan[opt] callback function when given the callback will be ran on all valid elements +-- @tparam[opt] string category the category to get the instances of, not needed when no serializer function +-- @tparam[opt] function callback when given the callback will be ran on all valid elements -- callback param - element LuaGuiElement - the current valid element -- @treturn table the table of element instances with all invalid ones removed function Instances.get_valid_elements(name,category,callback) - if not Instances.categorise[name] then - return error('Inavlid name for instance group: '..name,2) + if not Instances.serializer[name] then + return error('Invalid name for instance group: '..name,2) end category = category or callback local elements = Instances.get_elements_raw(name,category) - local categorise = Instances.has_categories(name) + local serializer = Instances.has_categories(name) for key,element in pairs(elements) do if not element or not element.valid then elements[key] = nil else - if categorise and callback then callback(element) + if serializer and callback then callback(element) elseif category then category(element) end end end @@ -186,7 +194,7 @@ Instances.apply_to_elements = Instances.get_valid_elements --- A version of add_element that does not require the group to be registered -- @tparam string name the name of the instance group to add the element to --- @tparam category ?string|nil the category to add the element to, can be nil but must still be given +-- @tparam ?string|nil category the category to add the element to, can be nil but must still be given -- @tparam LuaGuiElement element the element to add to the instance group function Instances.unregistered_add_element(name,category,element) if not Instances.data[name] then Instances.data[name] = {} end @@ -200,7 +208,7 @@ end --- A version of get_elements that does not require the group to be registered -- @tparam string name the name of the instance group to get the instances of --- @tparam category ?string|nil the category to get the instances of, can be nil but must still be given +-- @tparam ?string|nil category the category to get the instances of, can be nil but must still be given -- @tparam[opt] function callback when given will be called on all valid instances -- callback param - element LuaGuiElement - the current valid element -- @treturn table the table of element instances with all invalid ones removed diff --git a/expcore/gui/prototype.lua b/expcore/gui/prototype.lua index bec61e8d..790375aa 100644 --- a/expcore/gui/prototype.lua +++ b/expcore/gui/prototype.lua @@ -1,4 +1,12 @@ ---- Used to create new gui prototypes see elements and concepts +--[[-- Core Module - Gui + @module Gui + @alias Prototype +]] + +--- Prototype. +-- Used to create new gui prototypes see elements and concepts +-- @section prototype + --[[ >>>> Functions Constructor.event(event_name) --- Creates a new function to add functions to an event handler @@ -11,7 +19,7 @@ Prototype:set_caption(value) --- Sets the caption for the element define Prototype:set_tooltip(value) --- Sets the tooltip for the element define Prototype:set_style(style,callback) --- Sets the style for the element define - Prototype:set_embeded_flow(state) --- Sets the element to be drawn inside a nameless flow, can be given a name using a function + Prototype:set_embedded_flow(state) --- Sets the element to be drawn inside a nameless flow, can be given a name using a function Prototype:set_pre_authenticator --- Sets an authenticator that blocks the draw function if check fails Prototype:set_post_authenticator --- Sets an authenticator that disables the element if check fails @@ -19,13 +27,13 @@ Prototype:raise_event(event_name,...) --- Raises a custom event for this define, any number of params can be given Prototype:draw_to(element,...) --- The main function for defines, when called will draw an instance of this define to the given element - Prototype:get_store(category) --- Gets the value in this elements store, category needed if categorize function used - Prototype:set_store(category,value) --- Sets the value in this elements store, category needed if categorize function used - Prototype:clear_store(category) --- Sets the value in this elements store to nil, category needed if categorize function used + Prototype:get_store(category) --- Gets the value in this elements store, category needed if serializer function used + Prototype:set_store(category,value) --- Sets the value in this elements store, category needed if serializer function used + Prototype:clear_store(category) --- Sets the value in this elements store to nil, category needed if serializer function used ]] -local Game = require 'utils.game' -local Store = require 'expcore.store' -local Instances = require 'expcore.gui.instances' +local Game = require 'utils.game' --- @dep utils.game +local Store = require 'expcore.store' --- @dep expcore.store +local Instances = require 'expcore.gui.instances' --- @dep expcore.gui.instances local Constructor = {} local Prototype = {} @@ -74,35 +82,24 @@ function Constructor.extend(new_prototype) end --- Creates a new function which adds a store to a gui define --- @tparam boolean sync if the function should create a synced store -- @tparam function callback the function called when needing to update the value of an element -- @treturn function the function that will add a store for this define -function Constructor.store(sync,callback) - --- Adds a store for the define that is shared between all instances of the define in the same category, categorize is a function that returns a string +function Constructor.store(callback) + --- Adds a store for the define that is shared between all instances of the define in the same category, serializer is a function that returns a string -- @tparam self table the gui define being acted on - -- @tparam[opt] string location a unique location identifier, when omited a uid location will be used, use when sync is set to true - -- @tparam[opt] function categorize function used to determine the category of a LuaGuiElement, when omited all share one single category - -- categorize param - LuaGuiElement element - the element that needs to be converted - -- categorize return - string - a determistic string that referses to a category such as player name or force name + -- @tparam[opt] function serializer function used to determine the category of a LuaGuiElement, when omitted all share one single category + -- serializer param - LuaGuiElement element - the element that needs to be converted + -- serializer return - string - a deterministic string that references to a category such as player name or force name -- @treturn self the element define to allow chaining - return function(self,location,categorize) + return function(self,serializer) if self.store then return end + serializer = serializer or function() return '' end - if not sync then - categorize = location - location = Store.uid_location() - end + self.store = Store.register(serializer) - if Store.is_registered(location) then - return error('Location for store is already registered: '..location,2) - end + Instances.register(self.name,serializer) - self.store = location - self.categorize = categorize - - Instances.register(self.name,self.categorize) - - Store.register(self.store,sync,function(value,category) + Store.watch(self.store,function(value,category) self:raise_event('on_store_update',value,category) if Instances.is_registered(self.name) then @@ -134,8 +131,8 @@ function Constructor.setter(value_type,key,second_key) end return function(self,value) - local vtype = type(value) - if vtype ~= value_type and (not locale or vtype ~= 'string') then + local v_type = type(value) + if v_type ~= value_type and (not locale or v_type ~= 'string') then error(display_message,2) end @@ -200,7 +197,7 @@ Prototype.on_style_update = Constructor.event('on_style_update') --- Sets the style for the element define -- @tparam string style the style that will be used for this element when drawn --- @tparam[opt] callback function function is called when element is drawn to alter its style +-- @tparam[opt] function callback function is called when element is drawn to alter its style -- @treturn self the element define to allow chaining function Prototype:set_style(style,callback) self.draw_data.style = style @@ -211,13 +208,13 @@ function Prototype:set_style(style,callback) end --- Sets the element to be drawn inside a nameless flow, can be given a name using a function --- @tparam state ?boolean|function when true a padless flow is created to contain the element +-- @tparam ?boolean|function state when true a padless flow is created to contain the element -- @treturn self the element define to allow chaining -function Prototype:set_embeded_flow(state) +function Prototype:set_embedded_flow(state) if state == false or type(state) == 'function' then - self.embeded_flow = state + self.embedded_flow = state else - self.embeded_flow = true + self.embedded_flow = true end return self end @@ -249,12 +246,12 @@ function Prototype:draw_to(element,...) if not self.pre_authenticator(player,self.name) then return end end - if self.embeded_flow then - local embeded_name - if type(self.embeded_flow) == 'function' then - embeded_name = self.embeded_flow(element,...) + if self.embedded_flow then + local embedded_name + if type(self.embedded_flow) == 'function' then + embedded_name = self.embedded_flow(element,...) end - element = element.add{type='flow',name=embeded_name} + element = element.add{type='flow',name=embedded_name} element.style.padding = 0 end @@ -270,12 +267,12 @@ function Prototype:draw_to(element,...) Instances.add_element(self.name,new_element) end - self:raise_event('on_draw',player,new_element) + self:raise_event('on_draw',player,new_element,...) return new_element end ---- Gets the value in this elements store, category needed if categorize function used +--- Gets the value in this elements store, category needed if serializer function used -- @tparam string category[opt] the category to get such as player name or force name -- @treturn any the value that is stored for this define function Prototype:get_store(category) @@ -283,7 +280,7 @@ function Prototype:get_store(category) return Store.get(self.store,category) end ---- Sets the value in this elements store, category needed if categorize function used +--- Sets the value in this elements store, category needed if serializer function used -- @tparam string category[opt] the category to get such as player name or force name -- @tparam any value the value to set for this define, must be valid for its type ie for checkbox etc -- @treturn boolean true if the value was set @@ -292,7 +289,7 @@ function Prototype:set_store(category,value) return Store.set(self.store,category,value) end ---- Sets the value in this elements store to nil, category needed if categorize function used +--- Sets the value in this elements store to nil, category needed if serializer function used -- @tparam[opt] string category the category to get such as player name or force name -- @treturn boolean true if the value was set function Prototype:clear_store(category) diff --git a/expcore/gui/test.lua b/expcore/gui/test.lua index ed6545dd..37cc54f8 100644 --- a/expcore/gui/test.lua +++ b/expcore/gui/test.lua @@ -1,11 +1,19 @@ ---- This file creates a teste gui that is used to test every input method --- note that this does not cover every permutation only features in indepentance +--[[-- Core Module - Gui + @module Gui + @alias tests +]] + +--- Test. +-- This file creates a test gui that is used to test every input method +-- note that this does not cover every permutation only features in independence -- for example store in most cases is just by player name, but other store methods are tested with checkbox -local Gui = require 'expcore.gui' -local format_chat_colour,table_keys = ext_require('expcore.common','format_chat_colour','table_keys') -local Colors = require 'resources.color_presets' -local Event = require 'utils.event' -local Store = require 'expcore.store' +-- @section test + +local Gui = require 'expcore.gui' --- @dep expcore.gui +local format_chat_colour,table_keys = ext_require('expcore.common','format_chat_colour','table_keys') --- @dep expcore.common +local Colors = require 'resources.color_presets' --- @dep resources.color_presets +local Event = require 'utils.event' --- @dep utils.event +local Store = require 'expcore.store' --- @dep expcore.store local tests = {} @@ -223,7 +231,7 @@ end) local checkbox_force = Gui.new_checkbox('test-checkbox-store-force') -:set_tooltip('Checkboc store force') +:set_tooltip('Checkbox store force') :set_caption('Checkbox Store Force') :add_store(Gui.categorize_by_force) :on_element_update(function(player,element,state) @@ -239,7 +247,7 @@ Gui.new_checkbox('test-checkbox-store-player') player.print('Checkbox store player: '..tostring(state)) end) -tests.Checkboxs = { +tests.Checkboxes = { ['Local']=checkbox_local, ['Game store']=checkbox_game, ['Force store']=checkbox_force, @@ -271,7 +279,7 @@ Gui.new_radiobutton('test-radiobutton-store') end) local radiobutton_option_set = -Gui.new_radiobutton_option_set('gui.test.share',function(value,category) +Gui.new_radiobutton_option_set(function(value,category) game.print('Radiobutton option set for: '..category..' is now: '..tostring(value)) end,Gui.categorize_by_player) @@ -425,7 +433,7 @@ Gui.new_list_box('test-list-box-store') player.print('Dropdown store: '..tostring(value)) end) -tests["List Boxs"] = { +tests["List Boxes"] = { ['Local']=list_box_local, ['Player']=list_box_player } @@ -442,7 +450,7 @@ tests["List Boxs"] = { local slider_local_default = Gui.new_slider('test-slider-local-default') -:set_tooltip('Silder local default') +:set_tooltip('Slider local default') :on_element_update(function(player,element,value,percent) player.print('Slider local default: '..tostring(math.round(value))..' '..tostring(math.round(percent,1))) end) @@ -450,7 +458,7 @@ end) local slider_player_default = Gui.new_slider('test-slider-store-default') -:set_tooltip('Silder store default') +:set_tooltip('Slider store default') :add_store(Gui.categorize_by_player) :on_element_update(function(player,element,value,percent) player.print('Slider store default: '..tostring(math.round(value))..' '..tostring(math.round(percent,1))) @@ -458,7 +466,7 @@ end) local slider_static = Gui.new_slider('test-slider-static-range') -:set_tooltip('Silder static range') +:set_tooltip('Slider static range') :set_range(5,50) :on_element_update(function(player,element,value,percent) player.print('Slider static range: '..tostring(math.round(value))..' '..tostring(math.round(percent,1))) @@ -466,7 +474,7 @@ end) local slider_dynamic = Gui.new_slider('test-slider-dynamic-range') -:set_tooltip('Silder dynamic range') +:set_tooltip('Slider dynamic range') :set_range(function(player,element) return player.index - 5 end,function(player,element) @@ -478,7 +486,7 @@ end) local label_slider_local = Gui.new_slider('test-slider-local-label') -:set_tooltip('Silder local label') +:set_tooltip('Slider local label') :enable_auto_draw_label() :on_element_update(function(player,element,value,percent) player.print('Slider local label: '..tostring(math.round(value))..' '..tostring(math.round(percent,1))) @@ -486,7 +494,7 @@ end) local label_slider_player = Gui.new_slider('test-slider-store-label') -:set_tooltip('Silder store label') +:set_tooltip('Slider store label') :enable_auto_draw_label() :add_store(Gui.categorize_by_player) :on_element_update(function(player,element,value,percent) @@ -610,7 +618,7 @@ tests["Elem Buttons"] = { Progress bar tests > Simple -- Progress bar that fills every 2 seconds > Store -- Progress bar that fills every 5 seconds with synced value - > Reverce -- Progress bar that decreases every 2 seconds + > Reverse -- Progress bar that decreases every 2 seconds ]] local progressbar_one = @@ -642,8 +650,8 @@ end) Event.add(defines.events.on_tick,function() progressbar_one:increment() progressbar_three:decrement() - local categories = Store.get_children(progressbar_two.store) - for _,category in pairs(categories) do + local categories = Store.get(progressbar_two.store) or {} + for category,_ in pairs(categories) do progressbar_two:increment(1,category) end end) @@ -651,5 +659,5 @@ end) tests["Progress Bars"] = { ['Simple']=progressbar_one, ['Store']=progressbar_two, - ['Reverce']=progressbar_three + ['Reverse']=progressbar_three } \ No newline at end of file diff --git a/expcore/permission_groups.lua b/expcore/permission_groups.lua index 657ae2ad..136717e0 100644 --- a/expcore/permission_groups.lua +++ b/expcore/permission_groups.lua @@ -1,12 +1,15 @@ ---- Permission group making for factorio so you never have to make one by hand again --- @author Cooldude2606 ---[[ ->>>>Example Group (Allow All) +--[[-- Core Module - Permission Groups + - Permission group making for factorio so you never have to make one by hand again + @core Permissions-Groups + @alias Permissions_Groups + + @usage +---- Example Group (Allow All) -- here we will create an admin group however we do not want them to use the map editor or mess with the permission groups Permission_Groups.new_group('Admin') -- this defines a new group called "Admin" :allow_all() -- this makes the default to allow any input action unless set other wise - :disallow{ -- here we disallow the input action we dont want them to use + :disallow{ -- here we disallow the input action we don't want them to use 'add_permission_group', 'delete_permission_group', 'import_permissions_string', @@ -14,50 +17,44 @@ 'toggle_map_editor' } ->>>>Example Group (Disallow All) + @usage +---- Example Group (Disallow All) -- here we will create a group that cant do anything but talk in chat Permission_Groups.new_group('Restricted') -- this defines a new group called "Restricted" :disallow_all() -- this makes the default to disallow any input action unless set other wise :allow('write_to_console') -- here we allow them to chat, {} can be used here if we had more than one action ->>>>Functions List (see function for more detail): - Permissions_Groups.new_group(name) --- Defines a new permission group that can have it actions set in the config - Permissions_Groups.get_group_by_name(name) --- Returns the group with the given name, case sensitive - Permissions_Groups.get_group_from_player(player) --- Returns the group that a player is in - - Permissions_Groups.reload_permissions() --- Reloads/creates all permission groups and sets them to they configured state - Permissions_Groups.lockdown_permissions(exempt) --- Removes all permissions from every permission group except for "Default" and any passed as exempt - - Permissions_Groups.set_player_group(player,group) --- Sets a player's group to the one given, a player can only have one group at a time - - Permissions_Groups._prototype:set_action(action,state) --- Sets the allow state of an action for this group, used internally but is safe to use else where - Permissions_Groups._prototype:allow(actions) --- Sets an action or actions to be allowed for this group even with disallow_all triggered, Do not use in runtime - Permissions_Groups._prototype:disallow(actions) --- Sets an action or actions to be disallowed for this group even with allow_all triggered, Do not use in runtime - Permissions_Groups._prototype:allow_all() --- Sets the default state for any actions not given to be allowed, useful with :disallow - Permissions_Groups._prototype:disallow_all() --- Sets the default state for any action not given to be disallowed, useful with :allow - Permissions_Groups._prototype:is_allowed(action) --- Returns if an input action is allowed for this group - - Permissions_Groups._prototype:get_raw() --- Returns the LuaPermissionGroup that was created with this group object, used internally - Permissions_Groups._prototype:create() --- Creates or updates the permission group with the configured actions, used internally - - Permissions_Groups._prototype:add_player(player) --- Adds a player to this group - Permissions_Groups._prototype:remove_player(player) --- Removes a player from this group - Permissions_Groups._prototype:get_players(online) --- Returns all player that are in this group with the option to filter to online/offline only - - Permissions_Groups._prototype:print(message) --- Prints a message to every player in this group ]] -local Game = require 'utils.game' -local Event = require 'utils.event' -local Sudo = require 'expcore.sudo' +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 Permissions_Groups = { groups={}, -- store for the different groups that are created _prototype={} -- stores functions that are used on group instances } +-- Async function to add players to permission groups +local add_to_permission_group = +Async.register(function(permission_group,player) + permission_group.add_player(player) +end) +Permissions_Groups.async_token_add_to_permission_group = add_to_permission_group + +-- Async function to remove players from permission groups +local remove_from_permission_group = +Async.register(function(permission_group,player) + permission_group.remove_player(player) +end) +Permissions_Groups.async_token_remove_from_permission_group = remove_from_permission_group + +--- Getters. +-- Functions that get permission groups +-- @section getters + --- Defines a new permission group that can have it actions set in the config -- @tparam string name the name of the new group -- @treturn Permissions_Groups._prototype the new group made with function to allow and disallow actions @@ -92,6 +89,10 @@ function Permissions_Groups.get_group_from_player(player) end end +--- Setters. +-- Functions that control all groups +-- @section players + --- Reloads/creates all permission groups and sets them to they configured state function Permissions_Groups.reload_permissions() for _,group in pairs(Permissions_Groups.groups) do @@ -137,6 +138,10 @@ function Permissions_Groups.set_player_group(player,group) return true end +--- Actions. +-- Functions that control group actions +-- @section actions + --- Sets the allow state of an action for this group, used internally but is safe to use else where -- @tparam ?string|defines.input_action action the action that you want to set the state of -- @tparam boolean state the state that you want to set it to, true = allow, false = disallow @@ -203,6 +208,10 @@ function Permissions_Groups._prototype:is_allowed(action) return state end +--- Players. +-- Functions that control group players +-- @section players + --- Returns the LuaPermissionGroup that was created with this group object, used internally -- @treturn LuaPermissionGroup the raw lua permission group function Permissions_Groups._prototype:get_raw() @@ -229,7 +238,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 - Sudo('add-player-to-permission-group',group,player) + Async(add_to_permission_group, group, player) return true end @@ -240,7 +249,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 - Sudo('remove-player-from-permission-group',group,player) + Async(remove_from_permission_group, group, player) return true end @@ -280,11 +289,4 @@ Event.on_init(function() Permissions_Groups.reload_permissions() end) -Sudo.register('add-player-to-permission-group',function(permission_group,player) - permission_group.add_player(player) -end) -Sudo.register('remove-player-from-permission-group',function(permission_group,player) - permission_group.remove_player(player) -end) - return Permissions_Groups \ No newline at end of file diff --git a/expcore/roles.lua b/expcore/roles.lua index c5edd15f..a9d68404 100644 --- a/expcore/roles.lua +++ b/expcore/roles.lua @@ -1,7 +1,10 @@ ---- Factorio role system to manage custom permissions --- @author Cooldude2606 ---[[ ->>>>Using Role System (Frontend): +--[[-- Core Module - Roles + - Factorio role system to manage custom permissions. + @core Roles + @alias Roles + + @usage +---- Using Role System (Frontend): When a map first starts you will want to define on mass all the players you expect to join and the roles to give them: Roles.override_player_roles{ Cooldude2606 = {'Owner','Admin','Member'}, @@ -12,7 +15,8 @@ Roles.assign_player(player,'Admin',by_player_name) -- this will give the "Admin" role to the player Roles.unassign_player(player,{'Admin','Moderator'},by_player_name) -- this will remove "Admin" and "Moderator" role in one go ->>>>Using Role System (Backend): + @usage +---- Using Role System (Backend): To comparer two players you can comparer the index of they highest roles, can be used when you want to allow a "write" down type system: Roles.get_player_highest_role(playerOne).index < Roles.get_player_highest_role(playerTwo).index -- remember that less means a higher role @@ -24,7 +28,8 @@ Roles.player_has_flag(player,'is_donator') -- your roles can be grouped together with flags such as is_donator Roles.player_allowed(player,'game modifiers') -- or you can have an action based system where each action is something the player can do ->>>>Example Flag Define: + @usage +---- Example Flag Define: Flags can be used to group multiple roles and actions under one catch all, for example if you want a piece of code to only be active for your donators then you would add a "is_donator" flag to all your donator roles and then in the code test if a player has that tag present: @@ -47,7 +52,8 @@ -- some donator only code end ->>>>Example Role Define: + @usage +---- Example Role Define: You can't use a role system without any roles so first you must define your roles; each role has a minimum of a name with the option for a shorthand: Roles.new_role('Administrator','Admin') @@ -64,7 +70,7 @@ ...extras... :set_allow_all() - If you dont do this want this as i would advise you do then you will want to define what the role can do; this comes with + If you don't do this want this as i would advise you do then you will want to define what the role can do; this comes with an optional inheritance system if you like those sort of things in which case disallow may also be of some use to you: Roles.new_role('Administrator','Admin') ...extras... @@ -86,9 +92,10 @@ 'gui/game settings' } ->>>>Example System Define: + @usage +---- Example System Define: Once all roles are defined these steps must be done to ensure the system is ready to use, this includes setting a default - role, assigning a root (all permission) role that the server/system will use and the linier order that the roles fall into: + role, assigning a root (all permission) role that the server/system will use and the linear order that the roles fall into: Roles.set_default('Guest') Roles.set_root('System') @@ -103,64 +110,15 @@ Just remember that in this example all these roles have not been defined; so make sure all your roles that are used are defined before hand; a config file on load is useful for this to ensure that its loaded before the first player even joins. - ->>>>Functions List (see function for more detail): - Roles.debug() --- Returns a string which contains all roles in index order displaying all data for them - - Roles.print_to_roles(roles,message) --- Prints a message to all players in the given roles, may send duplicate message however factorio blocks spam - Roles.print_to_roles_higher(role,message) --- Prints a message to all players who have the given role or one which is higher (excluding default) - Roles.print_to_roles_lower(role,message) --- Prints a message to all players who have the given role or one which is lower (excluding default) - - Roles.get_role_by_name(name) --- Get a role for the given name - Roles.get_role_by_order(index) --- Get a role with the given order index - Roles.get_role_from_any(any) --- Gets a role from a name,index or role object (where it is just returned) - Roles.get_player_roles(player) --- Gets all the roles of the given player, this will always contain the default role - Roles.get_player_highest_role(player) --- Gets the highest role which the player has, can be used to compeer one player to another - - Roles.assign_player(player,roles,by_player_name,silent) --- Gives a player the given role(s) with an option to pass a by player name used in the log - Roles.unassign_player(player,roles,by_player_name,silent) --- Removes a player from the given role(s) with an option to pass a by player name used in the log - Roles.override_player_roles(roles) --- Overrides all player roles with the given table of roles, useful to mass set roles on game start - - Roles.player_has_role(player,search_role) --- A test for weather a player has the given role - Roles.player_has_flag(player,flag_name) --- A test for weather a player has the given flag true for at least one of they roles - Roles.player_allowed(player,action) --- A test for weather a player has at least one role which is allowed the given action - - Roles.define_role_order(order) --- Used to set the role order, higher in the list is better, must be called at least once in config - Roles.define_flag_trigger(name,callback) --- Defines a new trigger for when a tag is added or removed from a player - Roles.set_default(name) --- Sets the default role which every player will have, this needs to be called at least once - Roles.set_root(name) --- Sets the root role which will always have all permissions, any server actions act from this role - - Roles.new_role(name,short_hand) --- Defines a new role and returns the prototype to allow configuration - - Roles._prototype:set_allow_all(state) --- Sets the default allow state of the role, true will allow all actions - Roles._prototype:allow(actions) --- Sets the allow actions for this role, actions in this list will be allowed for this role - Roles._prototype:disallow(actions) --- Sets the disallow actions for this role, will prevent actions from being allowed regardless of inheritance - Roles._prototype:is_allowed(action) --- Test for if a role is allowed the given action, mostly internal see Roles.player_allowed - - Roles._prototype:set_flag(name,value) --- Sets the state of a flag for a role, flags can be used to apply effects to players - Roles._prototype:clear_flags() --- Clears all flags from this role, individual flags can be removed with set_flag(name,false) - Roles._prototype:has_flag(name) --- A test for if the role has a flag set - - Roles._prototype:set_custom_tag(tag) --- Sets a custom player tag for the role, can be accessed by other code - Roles._prototype:set_custom_color(color) --- Sets a custom colour for the role, can be accessed by other code - Roles._prototype:set_permission_group(name,use_factorio_api) --- Sets the permission group for this role, players will be moved to the group of they highest role - Roles._prototype:set_parent(role) --- Sets the parent for a role, any action not in allow or disallow will be looked for in its parents - Roles._prototype:set_auto_promote_condition(callback) --- Sets an auto promote condition that is checked every 5 seconds, if true is returned then the player will recive the role - Roles._prototype:set_block_auto_promote(state) --- Sets the role to not allow players to have auto promote effect them, useful to keep people locked to a punishment - - Roles._prototype:add_player(player,skip_check,skip_event) --- Adds a player to this role, players can have more than one role at a time, used internally see Roles.assign - Roles._prototype:remove_player(player,skip_check,skip_event) --- Removes a player from this role, players can have more than one role at a time, used internally see Roles.unassign - Roles._prototype:get_players(online) --- Returns an array of all the players who have this role, can be filtered by online status - Roles._prototype:print(message) --- Will print a message to all players with this role ]] -local Game = require 'utils.game' -local Global = require 'utils.global' -local Event = require 'utils.event' -local Groups = require 'expcore.permission_groups' -local Sudo = require 'expcore.sudo' -local Colours = require 'resources.color_presets' -local write_json = ext_require('expcore.common','write_json') +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 'resources.color_presets' --- @dep resources.color_presets +local write_json = ext_require('expcore.common','write_json') --- @dep expcore.common local Roles = { _prototype={}, @@ -189,6 +147,10 @@ Global.register(Roles.config,function(tbl) end end) +--- Getter. +-- Functions which get roles +-- @section get + --- Internal function used to trigger a few different things when roles are changed -- this is the raw internal trigger as the other function is called at other times -- there is a second half called role_update which triggers after the event call, it also is called when a player joins @@ -295,7 +257,7 @@ function Roles.get_role_by_name(name) end --- Get a role with the given order index --- @tparam number index the place in the oder list of the role to get +-- @tparam number index the place in the order list of the role to get -- @treturn Roles._prototype the role with that index in the order list or nil function Roles.get_role_by_order(index) local name = Roles.config.order[index] @@ -307,13 +269,13 @@ end -- @tparam ?number|string|table any the value used to find the role -- @treturn Roles._prototype the role that was found or nil see above function Roles.get_role_from_any(any) - local tany = type(any) - if tany == 'number' or tonumber(any) then + local t_any = type(any) + if t_any == 'number' or tonumber(any) then any = tonumber(any) return Roles.get_role_by_order(any) - elseif tany == 'string' then + elseif t_any == 'string' then return Roles.get_role_by_name(any) - elseif tany == 'table' then + elseif t_any == 'table' then return Roles.get_role_by_name(any.name) end end @@ -348,6 +310,10 @@ function Roles.get_player_highest_role(player) return highest end +--- Assinment. +-- Functions for changing player's roles +-- @section assinment + --- Gives a player the given role(s) with an option to pass a by player name used in the log -- @tparam LuaPlayer player the player that will be assigned the roles -- @tparam table roles table a of roles that the player will be given, can be one role and can be role names @@ -394,6 +360,10 @@ function Roles.override_player_roles(roles) Roles.config.players = roles end +--- Checks. +-- Functions for checking player's roles +-- @section checks + --- A test for weather a player has the given role -- @tparam LuaPlayer player the player to test the roles of -- @tparam ?string|number|table search_role a pointer to the role that is being searched for @@ -439,6 +409,10 @@ function Roles.player_allowed(player,action) return false end +--- Definations. +-- Functions which are used to define roles +-- @section checks + --- Used to set the role order, higher in the list is better, must be called at least once in config -- nb: function also re links parents due to expected position in the config file -- @tparam table order table a which is keyed only by numbers (start 1) and values are roles in order with highest first @@ -469,9 +443,7 @@ end -- flag param - player - the player that has had they roles changed -- flag param - state - the state of the flag, aka if the flag is present function Roles.define_flag_trigger(name,callback) - local sudo_name = 'role-flag-'..name - Roles.config.flags[name] = sudo_name - Sudo.register(sudo_name,callback) + Roles.config.flags[name] = Async.register(callback) end --- Sets the default role which every player will have, this needs to be called at least once @@ -508,6 +480,10 @@ function Roles.new_role(name,short_hand) return role end +--- Role Actions. +-- Functions for using the role action system +-- @section actions + --- Sets the default allow state of the role, true will allow all actions -- @tparam[opt=true] boolean state true will allow all actions -- @treturn Roles._prototype allows chaining @@ -551,6 +527,10 @@ function Roles._prototype:is_allowed(action) return self.allowed_actions[action] or self.allow_all_actions or is_root end +--- Role Flags. +-- Functions for using the role flag system +-- @section flags + --- Sets the state of a flag for a role, flags can be used to apply effects to players -- @tparam string name the name of the flag to set the value of -- @tparam[opt=true] boolean value the state to set the flag to @@ -575,6 +555,10 @@ function Roles._prototype:has_flag(name) return self.flags[name] or false end +--- Role Properties. +-- Functions for chaning other proerties +-- @section properties + --- Sets a custom player tag for the role, can be accessed by other code -- @tparam string tag the value that the tag will be -- @treturn Roles._prototype allows chaining @@ -621,7 +605,7 @@ function Roles._prototype:set_parent(role) return self end ---- Sets an auto promote condition that is checked every 5 seconds, if true is returned then the player will recive the role +--- Sets an auto promote condition that is checked every 5 seconds, if true is returned then the player will receive the role -- nb: this is one way, failing false after already gaining the role will not revoke the role -- @tparam function callback receives only one param which is player to promote, return true to promote the player -- @treturn Roles._prototype allows chaining @@ -639,6 +623,10 @@ function Roles._prototype:set_block_auto_promote(state) return self end +--- Role Players. +-- Functions that control players in a role +-- @section players + --- Adds a player to this role, players can have more than one role at a time, used internally see Roles.assign -- @tparam LuaPlayer player the player that will be given this role -- @tparam boolean skip_check when true player will be taken as the player name (use when player has not yet joined) @@ -758,9 +746,9 @@ end local function role_update(event) local player = Game.get_player_by_index(event.player_index) -- Updates flags given to the player - for flag,sudo_name in pairs(Roles.config.flags) do + for flag, async_token in pairs(Roles.config.flags) do local state = Roles.player_has_flag(player,flag) - Sudo(sudo_name,player,state) + Async(async_token, player, state) end -- Updates the players permission group local highest = Roles.get_player_highest_role(player) @@ -768,10 +756,10 @@ local function role_update(event) if highest.permission_group[1] then local group = game.permissions.get_group(highest.permission_group[2]) if group then - Sudo('add-player-to-permission-group',group,player) + Async(Groups.async_token_add_to_permission_group, group, player) end else - Groups.set_player_group(player,highest.permission_group) + Groups.set_player_group(player, highest.permission_group) end end end diff --git a/expcore/store.lua b/expcore/store.lua index 459ccaf3..f58e41b9 100644 --- a/expcore/store.lua +++ b/expcore/store.lua @@ -1,256 +1,513 @@ ---- Adds an easy way to store and watch for updates to a value ---[[ ->>>> Basic Use - At the most basic level this allows for the naming of locations to store in the global table, the second feature is that you are - able to listen for updates of this value, which means that when ever the set function is called it will trigger the update callback. +--[[-- Core Module - Store +- Used to store and watch for updates for values in the global table +@core Store +@alias Store - This may be useful when storing config values and when they get set you want to make sure it is taken care of, or maybe you want - to have a value that you can trigger an update of from different places. +@usage-- Require the module and add a store with no keys +-- Store with no keys does not need a serializer +local Store = require 'expcore.store' --- @dep expcore.store +local scenario_diffculty = Store.register() - -- this will register a new location called 'scenario.dificutly' - -- note that setting a start value is optional and we could take nil to mean normal - Store.register('scenario.dificutly',function(value) - game.print('The scenario dificulty has be set to: '..value) - end) +-- When the store is changed this function will trigger +Store.watch(scenario_diffculty,function(value) + game.print('The scenario diffculty has been set to '..value) +end) - -- this will set the value in the store to 'hard' and will trigger the update callback which will print a message to the game - Store.set('scenario.dificutly','hard') +Store.set(scenario_diffculty,'hard') -- Set the value stored to 'hard' +Store.get(scenario_diffculty) -- Returns 'hard' +Store.update(scenario_diffculty,function(value) -- Will set value to 'normal' if no value is present + return not value and 'normal' +end) - -- this will return 'hard' - Store.get('scenario.dificutly') +@usage-- Require the module and add a store with keys +-- Store with keys does not require a serializer but it can be helpful +local Store = require 'expcore.store' --- @dep expcore.store +local player_scores = Store.register(function(player) -- Use player name as the key + return player.name +end) ->>>> Using Children - One limitation of store is that all lcoations must be registered to avoid desyncs, to get round this issue "children" can be used. - When you set the value of a child it does not have its own update callback so rather the "parent" location which has been registerd - will have its update value called with a second param of the name of that child. +-- When any key in the store is changed this function will trigger +Store.watch(player_scores,function(value,key) + game.print(key..' now has a score of '..value) +end) - This may be useful when you want a value of each player or force and since you cant regisier every player at the start you must use - the players name as the child name. - - -- this will register the lcoation 'scenario.score' where we plan to use force names as the child - Store.register('scenario.score',function(value,child) - game.print(child..' now has a score of '..value) - end) - - -- this will return nil, but will not error as children dont need to be registerd - Store.get('scenario.score','player') - - -- this will set 'player' to have a value of 10 for 'scenario.score' and trigger the game message print - Store.set('scenario.score','player',10) - - -- this would be the silliar to Store.get however this will return the names of all the children - Store.get_children('scenario.score') - ->>>> Using Sync - There is the option to use synced values which is the same as a normal value however you can combine this with an external script - which can read the output from 'script-output/log/store.log' and have it send rcon commands back to the game allowing for cross instance - syncing of values. - - This may be useful when you want to have a value change effect multiple instances or even if you just want a database to store values so - you can sync data between map resets. - - -- this example will register the location 'stastics.total-play-time' where we plan to use plan names as the child - -- note that the location must be the same across instances - Store.register('stastics.total-play-time',true,function(value,child) - game.print(child..' now has now played for '..value) - end) - - -- use of set and are all the same as non synced but you should include from_sync as true - ->>>> Alternative method - Some people may prefer to use a varible rather than a string for formating reasons here is an example. Also for any times when - there will be little external input Store.uid_location() can be used to generate non conflicting locations, uid_location will also - be used if you give a nil location. - - local store_game_speed = - Store.register(function(value) - game.print('The game speed has been set to: '..value) - end) +Store.set(player_scores,game.player,10) -- Set your score to 10 +Store.get(scenario_diffculty,game.player) -- Returns 10 +Store.update(scenario_diffculty,game.player,function(value) -- Add 1 to your score + return value + 1 +end) ]] -local Global = require 'utils.global' -local Event = require 'utils.event' -local table_keys,write_json = ext_require('expcore.common','table_keys','write_json') -local Token = require 'utils.token' +local Event = require 'utils.event' --- @dep utils.event local Store = { - data={}, - registered={}, - synced={}, - callbacks={}, - events = { - on_value_update=script.generate_event_name() - } + --- The current highest uid that is being used, will not increase during runtime + -- @field uid + uid = 0, + --- An array of the serializers that stores are using, key is store uids + -- @table serializers + serializers = {}, + --- An array of watchers that stores will trigger, key is store uids + -- @table watchers + watchers = {}, + --- An index used for debuging to find the file where different stores where registered + -- @table file_paths + file_paths = {} } -Global.register(Store.data,function(tbl) - Store.data = tbl +-- All data is stored in global.data_store and is accessed here with data_store +local data_store = {} +global.data_store = data_store +Event.on_load(function() + data_store = global.data_store end) -local function error_not_table(value) - if type(value) ~= 'table' then - error('Location is not a table can not use child locations',3) +--- Store Setup. +-- @section setup + +--[[-- An error checking and serializing function for checking store uids and keys, note key is not required +@tparam number store the uid of the store that you want to check is valid +@tparam[opt] ?string|any key the key that you want to serialize or check is a string +@tparam[opt=1] number error_stack the position in the stack relative to the current function (1) to raise this error on +@treturn string if key is given and a serializer is registered, or key was already a string, then the key is returned + +@usage-- Registering a new store and checking that it is valid +-- New store will use player names as the keys +local player_scores = Store.register(function(player) + return player.name +end) + +-- player_scores is a valid store and key will be your player name +local key = Store.validate(player_scores,game.player) + +]] +function Store.validate(store,key,error_stack) + error_stack = error_stack or 1 + + if type(store) ~= 'number' then + -- Store is not a number and so if not valid + error('Store uid given is not a number; recived type '..type(store),error_stack+1) + elseif store > Store.uid then + -- Store is a number but it is out of range, ie larger than the current highest uid + error('Store uid is out of range; recived '..tostring(store),error_stack+1) + elseif key ~= nil and type(key) ~= 'string' and Store.serializers[store] == nil then + -- Key is present but is not a string and there is no serializer registered + error('Store key is not a string and no serializer has been registered; recived '..type(key),error_stack+1) + elseif key ~= nil then + -- Key is present and so it is serialized and returned + local serializer = Store.serializers[store] + if type(key) ~= 'string' then + local success, serialized_key = pcall(serializer,key) + + if not success then + -- Serializer casued an error while serializing the key + error('Store watcher casued an error:\n\t'..key,error_stack+1) + elseif type(serialized_key) ~= 'string' then + -- Serializer was successful but failed to return a string value + error('Store key serializer did not return a string; recived type '..type(key),error_stack+1) + end + + return serialized_key + end + + return key end + end ---- Check for if a lcoation is registered --- @tparam string location the location to test for --- @treturn boolean true if registered -function Store.is_registered(location) - return Store.registered[location] -end +--[[-- Required to create new stores and register an serializer to a store, serializer not required +@tparam[opt] function serializer the function used to convert non string keys into strings to be used in the store +@treturn number the uid for the new store that you have created, use this as the first param to all other functions ---- Returns a unqiue name that can be used for a store --- @treturn string a unqiue name -function Store.uid_location() - return tostring(Token.uid()) -end +@usage-- Creating a store with no serializer +local scenario_diffculty = Store.register() ---- Registers a new location with an update callback which is triggered when the value updates --- @tparam[opt] string location string a unique that points to the data, string used rather than token to allow migration --- @tparam[opt] boolean synced when true will output changes to a file so it can be synced --- @tparam[opt] function callback when given the callback will be automatically registered to the update of the value --- @treturn string the lcoation that is being used -function Store.register(location,synced,callback) +@usage-- Creating a store which can take LuaPlayer +local player_scores = Store.register(function(player) + return player.name +end) + +]] +function Store.register(serializer) if _LIFECYCLE ~= _STAGE.control then - return error('Can only be called during the control stage', 2) + -- Only allow this function to be called during the control stage + error('Store can not be registered durring runtime', 2) end - if type(location) ~= 'string' then - callback = synced - synced = location + -- Increment the uid counter + local uid = Store.uid + 1 + Store.uid = uid + + -- Register the serializer if given + if serializer then + Store.serializers[uid] = serializer end - if type(synced) ~= 'boolean' then - callback = synced - end + -- Add entry in the debug table + local file_path = debug.getinfo(2, 'S').source:match('^.+/currently%-playing/(.+)$'):sub(1, -5) + Store.file_paths[uid] = file_path - location = type(location) == 'string' and location or Store.uid_location() - - if Store.registered[location] then - return error('Location is already registered', 2) - end - - Store.registered[location] = true - Store.synced[location] = synced and true or nil - Store.callbacks[location] = callback or nil - - return location + -- Return the new uid + return uid end ---- Gets the value stored at a location, this location must be registered --- @tparam string location the location to get the data from --- @tparam[opt] string child the child location if required --- @tparam[opt=false] boolean allow_unregistered when true no error is returned if the location is not registered --- @treturn any the data which was stored at the location -function Store.get(location,child,allow_unregistered) - if not Store.callbacks[location] and not allow_unregistered then - return error('Location is not registered', 2) +--[[-- Register a watch function to a store that is called when the value in the store is changed, triggers for any key +@tparam number store the uid of the store that you want to watch for changes to +@tparam function watcher the function that will be called when there is a change to the store + +@usage-- Printing the changed value to all players, no keys +-- Register the new store, we are not using keys so we dont need a serializer +local scenario_diffculty = Store.register() + +-- Register the watcher so that when we change the value the message is printed +Store.watch(scenario_diffculty,function(value) + game.print('The scenario diffculty has been set to '..value) +end) + +-- Set a new value for the diffculty and see that it has printed to the game +Store.set(scenario_diffculty,'hard') + +@usage-- Printing the changed value to all players, with keys +-- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects +local player_scores = Store.register(function(player) + return player.name +end) + +-- Register the watcher so that when we change the value the message is printed +Store.watch(player_scores,function(value,key) + game.print(key..' now has a score of '..value) +end) + +-- Set a new value for your score and see that it has printed to the game +Store.set(player_scores,game.player,10) + +]] +function Store.watch(store,watcher) + if _LIFECYCLE ~= _STAGE.control then + -- Only allow this function to be called during the control stage + error('Store watcher can not be registered durring runtime', 2) end - local data = Store.data[location] - if child and data then - error_not_table(data) - return data[child] + Store.validate(store,nil,2) + + -- Add the watchers table if it does not exist + local watchers = Store.watchers[store] + if not watchers then + watchers = {} + Store.watchers[store] = watchers end + -- Append the new watcher function + watchers[#watchers+1] = watcher +end + +--- Store Data Management. +-- @section data + +--[[-- Used to retrive the current data that is stored, key is optional depending on if you are using them +@tparam number store the uid of the store that you want to get the value from +@tparam[opt] ?string|any key the key that you want to get the value of, must be a string unless you have a serializer +@treturn any the data that is stored + +@usage-- Getting the value of a store with no keys +-- Register the new store, we are not using keys so we dont need a serializer +local scenario_diffculty = Store.register() + +-- Get the current diffculty for the scenario +local diffculty = Store.get(scenario_diffculty) + +@usage-- Getting the data from a store with keys +-- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects +local player_scores = Store.register(function(player) + return player.name +end) + +-- Get your current score +local my_score = Store.get(player_scores,game.player) + +-- Get all scores +lcoal scores = Store.get(player_scores) + +]] +function Store.get(store,key) + key = Store.validate(store,key,2) + + -- Get the data from the data store + local data = data_store[store] + if key then + if type(data) ~= 'table' then + data_store[store] = {_value = data_store[store]} + return nil + else + return data[key] + end + end + + -- Return all data if there is no key return data end ---- Sets the value at a location, this location must be registered --- @tparam string location the location to set the data to --- @tparam[opt] string child the child location if required --- @tparam any value the new value to set at the location, value may be reverted if there is a watch callback, cant be nil --- @tparam[opt] boolean from_sync set this true to avoid an output to the sync file --- @treturn boolean true if it was successful -function Store.set(location,child,value,from_sync) - if not Store.callbacks[location] then - return error('Location is not registered', 2) - end +--[[-- Used to clear the data in a store, will trigger any watchers, key is optional depending on if you are using them +@tparam number store the uid of the store that you want to clear +@tparam[opt] ?string|any key the key that you want to clear, must be a string unless you have a serializer - if child == nil or value == nil then - value = child or value - child = nil - end +@usage-- Clear a store which does not use keys +-- Register the new store, we are not using keys so we dont need a serializer +local scenario_diffculty = Store.register() - local data = Store.data - if child then - data = data[location] - if not data then - data = {} - Store.data[location] = data - end - error_not_table(data) - data[child] = value - else - data[location] = value - end +-- Clear the scenario diffculty +Store.clear(scenario_diffculty) - script.raise_event(Store.events.on_value_update,{ - tick=game.tick, - location=location, - child=child, - value=value, - from_sync=from_sync - }) - - return true -end - ---- Sets the value at a location to nil, this location must be registered --- @tparam string location the location to set the data to --- @tparam[opt] string child the child location if required --- @tparam[opt] boolean from_sync set this true to avoid an output to the sync file --- @treturn boolean true if it was successful -function Store.clear(location,child,from_sync) - if not Store.callbacks[location] then - return error('Location is not registered', 2) - end - - local data = Store.data - if child then - data = data[location] - if not data then return end - error_not_table(data) - data[child] = nil - else - data[location] = nil - end - - script.raise_event(Store.events.on_value_update,{ - tick=game.tick, - location=location, - child=child, - from_sync=from_sync - }) - - return true -end - ---- Gets all non nil children at a location, children can be added and removed during runtime --- this is similar to Store.get but will always return a table even if it is empty --- @tparam string location the location to get the children of --- @treturn table a table containg all the children names -function Store.get_children(location) - local data = Store.get(location) - return type(data) == 'table' and table_keys(data) or {} -end - --- Handels syncing -Event.add(Store.events.on_value_update,function(event) - if Store.callbacks[event.location] then - Store.callbacks[event.location](event.value,event.child) - end - - if not event.from_sync and Store.synced[event.location] then - write_json('log/store.log',{ - tick=event.tick, - location=event.location, - child=event.child, - value=event.value, - }) - end +@usage-- Clear data that is in a store with keys +-- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects +local player_scores = Store.register(function(player) + return player.name end) +-- Clear your score +Store.clear(player_scores,game.player) + +-- Clear all scores +Store.clear(player_scores) + +]] +function Store.clear(store,key) + key = Store.validate(store,key,2) + + -- Check if there is a key being used + if key then + if type(data_store[store]) == 'table' then + data_store[store][key] = nil + end + else + data_store[store] = nil + end + + -- Trigger any watch functions + Store.raw_trigger(store,key,nil) +end + +--[[-- Used to set the data in a store, will trigger any watchers, key is optional depending on if you are using them +@tparam number store the uid of the store that you want to set +@tparam[opt] ?string|any key the key that you want to set, must be a string unless you have a serializer +@tparam any value the value that you want to set + +@usage-- Setting a store which does not use keys +-- Register the new store, we are not using keys so we dont need a serializer +local scenario_diffculty = Store.register() + +-- Set the new scenario diffculty +Store.set(scenario_diffculty,'hard') + +@usage-- Set data in a store with keys +-- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects +local player_scores = Store.register(function(player) + return player.name +end) + +-- Set your current score +Store.set(player_scores,game.player,10) + +-- Set all scores, note this might not have much use +Store.set(player_scores,{ + [game.player.name] = 10, + ['SomeOtherPlayer'] = 0 +}) + +]] +function Store.set(store,key,value) + -- Allow for key to be optional + if value == nil then + value = key + key = nil + end + + -- Check the store is valid + key = Store.validate(store,key,2) + + -- If there is a key being used then the store must be a able + if key then + if type(data_store[store]) ~= 'table' then + data_store[store] = {_value = data_store[store]} + end + data_store[store][key] = value + else + data_store[store] = value + end + + -- Trigger any watchers + Store.raw_trigger(store,key,value) +end + +--[[-- Used to update the data in a store, use this with tables, will trigger any watchers, key is optional depending on if you are using them +@tparam number store the uid of the store that you want to update +@tparam[opt] ?string|any key the key that you want to update, must be a string unless you have a serializer +@tparam function updater the function which is called to make changes to the value, such as changing table keys, if a value is returned it will replace the current value in the store + +@usage-- Incrementing a global score +-- Because we are only going to have one score so we will not need keys or a serializer +local game_score = Store.register() + +-- Setting a default value +Store.set(game_score,0) + +-- We now will update the game score by one, we return the value so that it is set as the new value in the store +Store.update(game_score,function(value) + return value + 1 +end) + +@usage-- Updating keys in a table of data +-- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects +local player_data = Store.register(function(player) + return player.name +end) + +-- Setting a default value for your player, used to show the table structure +Store.set(player_data,game.player,{ + group = 'Admin', + role = 'Owner', + show_group_config = false +}) + +-- Updating the show_group_config key in your player data, note that it would be harder to call set every time +-- We do not need to return anything in this case as we are not replacing all the data +Store.update(player_data,game.player,function(data) + data.show_group_config = not data.show_group_config +end) + +]] +function Store.update(store,key,updater) + -- Allow for key to be nil + if updater == nil then + updater = key + key = nil + end + + -- Check the store is valid + key = Store.validate(store,key,2) + local value + + -- If a key is used then the store must be a table + if key then + if type(data_store[store]) ~= 'table' then + data_store[store] = {_value = data_store[store]} + end + + -- Call the updater and if it returns a value then set this value + local rtn = updater(data_store[store][key]) + if rtn then + data_store[store][key] = rtn + end + value = data_store[store][key] + + else + -- Call the updater and if it returns a value then set this value + local rtn = updater(data_store[store]) + if rtn then + data_store[store] = rtn + end + value = data_store[store] + + end + + -- Trigger any watchers + Store.raw_trigger(store,key,value) +end + +--[[-- Used to update all values that are in a store, similar to Store.update but acts on all keys at once, will trigger watchers for every key present +@tparam number store the uid of the store that you want to map +@tparam function updater the function that is called on every key in this store + +@usage-- Updating keys in a table of data +-- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects +local player_data = Store.register(function(player) + return player.name +end) + +-- Setting a default value for your player, used to show the table structure +Store.set(player_data,game.player,{ + group = 'Admin', + role = 'Owner', + show_group_config = false +}) + +-- Updating the show_group_config key for all players, note that it would be harder to call set every time +-- We do not need to return anything in this case as we are not replacing all the data +-- We also have access to the current key being updated if needed +Store.map(player_data,function(data,key) + data.show_group_config = not data.show_group_config +end) + +]] +function Store.map(store,updater) + Store.validate(store,nil,2) + + -- Get all that data in the store and check its a table + local data = data_store[store] + if not type(data) == 'table' then + return + end + + -- Loop over all the keys and call the updater, setting value if returned, and calling watcher functions + for key,value in pairs(data) do + local rtn = updater(value,key) + if rtn then + data[key] = rtn + end + Store.raw_trigger(store,key,data[key]) + end +end + +--[[-- Used to trigger watcher functions, this may be used to trigger them if you did not use Store.update or Store.set +@tparam number store the uid of the store that you want to trigger +@tparam[opt] ?string|any key the key that you want to trigger, must be a string unless you have a serializer +@usage-- Faking the update to a store +-- The type of store we use does not really matter for this as long as you pass it what you watchers are expecting +local scenario_diffculty = Store.register() + +-- Trigger the watchers with a fake change of diffculty +Store.trigger(scenario_diffculty) + +]] +function Store.trigger(store,key) + key = Store.validate(store,key,2) + + -- Get the data from the data store + local data = data_store[store] + if key then + Store.raw_trigger(store,key,data[key]) + else + Store.raw_trigger(store,key,data) + end +end + +--[[-- Used to trigger watcher functions, the value and key are passed directly to the watchers regardless if the value is correct +@tparam number store the uid of the store that you want to trigger +@tparam[opt] ?string|any key the key that you want to trigger, must be a string unless you have a serializer +@tparam[opt] any value the new value that is at this key or store, passed directly to the watcher + +@usage-- Triggering a manule call of the watchers +-- The type of store we use does not really matter for this as long as you pass it what you watchers are expecting +local scenario_diffculty = Store.register() + +-- Trigger the watchers with a fake change of diffculty +-- This is mostly used internally but it can be useful in other cases +Store.raw_trigger(scenario_diffculty,nil,'normal') + +]] +function Store.raw_trigger(store,key,value) + key = Store.validate(store,key,2) + + -- Get the watchers and then loop over them + local watchers = Store.watchers[store] or {} + for _,watcher in pairs(watchers) do + local success, err = pcall(watcher,value,key) + if not success then + error('Store watcher casued an error:\n\t'..err) + end + end +end + +-- Module return return Store \ No newline at end of file diff --git a/expcore/sudo.lua b/expcore/sudo.lua deleted file mode 100644 index 2b49f6da..00000000 --- a/expcore/sudo.lua +++ /dev/null @@ -1,78 +0,0 @@ ---- An extention of task and token to allow a single require to register and run functions bypassing all permissions ---[[ ->>>> Usage - To use sudo you must register the allowed functions when the files are loaded, often this will just be giving access to - some functions within a module if you expect that some parts may be blocked by in game permissions or a custom system you have made - - -- this will be blocked if the current player (from a command or gui) is not admin - local function make_admin(player) - player.admin = true - end - - -- here we give sudo access to the function under the name "make-admin" - Sudo.register('make-admin',make_admin) - - -- this will allow us to bypass this by runing one tick later outside of any player scope - Sudo.run('make-admin',game.player) - ->>>> Functions - Sudo.register(name,callback) --- Registers a new callback under the given name, used to avoid desynces - Sudo.get(name) --- Gets the function that is registered under the given name - Sudo.run(name,...) --- Runs the function that is registered under the given name, you may supply any number of params as needed -]] -local Task = require 'utils.task' -local Token = require 'utils.token' - -local Sudo = { - tokens={} -} - -local internal_run = -Token.register(function(params) - local func = Token.get(params.token) - func(unpack(params.params)) -end) - ---- Registers a new callback under the given name, used to avoid desynces --- @tparam string name the name that will be used to call this function --- @tparam function callback the function that will be called by this name -function Sudo.register(name,callback) - if _LIFECYCLE == 8 then - error('Calling Sudo.register after on_init() or on_load() has run is a desync risk.', 2) - end - - if Sudo.tokens[name] then - error(name..' is already registered',2) - end - - Sudo.tokens[name] = Token.register(callback) -end - ---- Gets the function that is registered under the given name --- @tparam string name the name of the function you want to get -function Sudo.get(name) - local token = Sudo.tokens[name] - return token and Token.get(token) -end - ---- Runs the function that is registered under the given name, you may supply any number of params as needed --- @tparam name string the name of the function you want to run --- @tparam[opt] any ... the other params that you want to pass to your function -function Sudo.run(name,...) - local token = Sudo.tokens[name] - - if not token then - error('Sudo does not have access to run "'..tostring(name)..'" please make sure it is registered to sudo',2) - end - - Task.set_timeout_in_ticks(1, internal_run, { - token = token, - params = {...} - }) -end - -return setmetatable(Sudo,{ - __call = function(self,...) - self.run(...) - end -}) \ No newline at end of file diff --git a/locale/en/addons.cfg b/locale/en/addons.cfg index 56cd4428..22f8c32d 100644 --- a/locale/en/addons.cfg +++ b/locale/en/addons.cfg @@ -17,17 +17,17 @@ github=https://github.com/explosivegaming/scenario [info] players-online=There are __1__ players online total-map-time=This map has been on for __1__ -discord=Join use on our discord at: https://discord.explosivegaming.nl -website=Please vist our website at: https://www.explosivegaming.nl +discord=Join us on our discord at: https://discord.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/ feedback=Do you have feedback? leave it at https://exp.fider.io/ -status=Want to check if out servers are down, vist: 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 custom-commands=We use custom commands, such as /tag and /me, use /chelp for more info. read-readme=Make sure you have read the Readme (It can be found through the question mark on the top left) -softmod=We run a softmod on our servers. A softmod is a custom scenario that runs on this server, example is the player list. -redmew=We dont talk about redmew here; they beat us to 1000 members ;-; -lhd=All trains must be LHD! This is a long standing rule on our servers, please resepect this. +softmod=We run a softmod on our servers. A softmod is a custom scenario that runs on this server, an example is the player list. +redmew=We don't talk about redmew here; they beat us to 1000 members ;-; +lhd=All trains must be LHD! This is a long standing rule on our servers, please respect this. [warnings] received=You received a warning from __1__. You have __2__ warnings. __3__ @@ -42,14 +42,14 @@ script-warning-limit=__1__ has received a permanent warning from the script. [chat-bot] reply=[Chat Bot] __1__ -disallow=You cant use global chat commands +disallow=You can't use global chat commands players-online=There are __1__ players online players=There have been __1__ players on this map map-time=This map has been on for __1__ -not-real-dev=Cooldude2606 is a dev for this server and makes the softmod (look top left) and is not a factorio dev. -softmod=A softmod is a custom scenario that runs on this server, example is the player list. -blame=Blame __1__ for what just happend! -afk=Your afk? Look at __1__, that player has been afk for: __2__ +not-real-dev=Cooldude2606 is a dev for this server and makes the softmod and is not a factorio dev. +softmod=A softmod is a custom scenario that runs on this server,an example is the player list. +blame=Blame __1__ for what just happened! +afk=You're afk? Look at __1__, that player has been afk for: __2__ current-evolution=Current evolution factor is __1__ magic=Fear the admin magic (ノ゚∀゚)ノ⌒・*:.。. .。.:*・゜゚・*☆ aids=≖ ‿ ≖ Fear the aids of a public server ≖ ‿ ≖ @@ -57,3 +57,25 @@ riot=(admins) ┬┴┬┴┤ᵒ_ᵒ)├┬┴┬┴ ‹ ‹\(´ω` )/››‹ loops=NO LOOPS; LOOPS ARE BAD; JUST NO LOOPS!!!!!; IF YOU MAKE A LOOP.... IT WILL NOT END WELL!!!!!!! lenny=( ͡° ͜ʖ ͡°) hodor=Hodor +get-popcorn-1=Heating the oil and waiting for the popping sound... +get-popcorn-2=__1__ your popcorn is finished. Lean backwards and watch the drama unfold. +get-snaps-1=Pouring the glasses and finding the correct song book... +get-snaps-2=Singing a song...🎤🎶 +get-snaps-3=schkål, my friends! +get-cocktail-1= 🍸 Inintiating mind reading unit... 🍸 +get-cocktail-2= 🍸 Mixing favourite ingredients of __1__ 🍸 +get-cocktail-3=🍸 __1__ your cocktail is done.🍸 +make-coffee-1= ☕ Boiling the water and grinding the coffee beans... ☕ +make-coffee-2= ☕ __1__ we ran out of coffe beans! Have some tea instead. ☕ +order-pizza-1= 🍕 Finding nearest pizza supplier... 🍕 +order-pizza-2= 🍕 Figuring out the favourite pizza of __1__ 🍕 +order-pizza-3= 🍕 __1__ your pizza is here! 🍕 +make-tea-1= ☕ Boiling the water... ☕ +make-tea-2= ☕ __1__ your tea is done! ☕ +get-mead-1= Filling the drinking horn +get-mead-2= Skål! +get-beer-1= 🍺 Pouring A Glass 🍺 +get-beer-2= 🍻 Chears Mate 🍻 + +[greetings] +greet=[color=0,1,0] Welcome to explosive gaming community server! If you like the server join our discord: __1__ [/color] \ No newline at end of file diff --git a/locale/en/commands.cfg b/locale/en/commands.cfg index bd4725c9..ab475d4b 100644 --- a/locale/en/commands.cfg +++ b/locale/en/commands.cfg @@ -38,12 +38,12 @@ admin=__1__ was reported by __2__ for __3__. already-reported=You can only report a player once, you can ask a moderator to clear this report. not-reported=The player had no reports on them. player-count-title=The following players have reports against them: -player-report-title=__1__ has the following reports agasinst them: +player-report-title=__1__ has the following reports against them: list=__1__: __2__ removed=__1__ has one or more reports removed by __2__. [expcom-warnings] -received=__1__ recived a warning from __2__ for __3__. +received=__1__ received a warning from __2__ for __3__. player=__1__ has __2__ warnings and __3__/__4__ script warnings. list-tilte=The following player have this many warnings (and this many script warnings): list=__1__: __2__ (__3__/__4__) @@ -57,11 +57,20 @@ result=__1__ entites were revived and __2__ were healed to max health. [expcom-bonus] set=Your bonus has been set to __1__. -wip=This command is tempary 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] +notSelecting=Please select an entetiy with a recpie. +item-in=You need __1__ per seconds of [item=__2__]. +fluid-in=You need __1__ per seconds of [fluid=__2__]. +item-out=This will result in: __1__ [item=__2__] per second. +fluid-out=This will result in: __1__ [fluid=__2__] per second. +machines=And you will need __1__ machines (with the same speed as this one) for this. [expcom-home] no-home=You have no home set. -no-return=You cant return when home has not yet been used. +no-return=You can't return when home has not yet been used. home-set=Your home point has been set to x: __1__ y: __2__ return-set=Your return point has been set to x: __1__ y: __2__ -home-get=Your home point is at x: __1__ y: __2__ \ No newline at end of file +home-get=Your home point is at x: __1__ y: __2__ + diff --git a/locale/en/expcore.cfg b/locale/en/expcore.cfg index ddde52d4..ce4d3d45 100644 --- a/locale/en/expcore.cfg +++ b/locale/en/expcore.cfg @@ -11,11 +11,11 @@ reject-string-options=Invalid Option, Must be one of: __1__ reject-string-max-length=Invalid Length, Max: __1__ reject-number=Invalid Number. reject-number-range=Invalid Range, Min (inclusive): __1__, Max (inclusive): __2__ -reject-player=Invaild Player Name, __1__ ,try using tab key to auto-complete the name +reject-player=Invalid Player Name, __1__ ,try using tab key to auto-complete the name reject-player-online=Player is offline. reject-player-alive=Player is dead. -reject-force=Invaild Force Name. -reject-surface=Invaild Surface Name. +reject-force=Invalid Force Name. +reject-surface=Invalid Surface Name. invalid-inputs=Invalid Input, /__1__ __2__ invalid-param=Invalid Param "__1__"; __2__ command-help=__1__ - __2__ @@ -35,4 +35,4 @@ reject-player-role=Player has a higher role. button_tooltip=Shows/hides the toolbar. [expcore-gui] -left-button-tooltip=Hide all open windows. \ No newline at end of file +left-button-tooltip=Hide all open windows. diff --git a/locale/en/gui.cfg b/locale/en/gui.cfg index 6f59cf4c..91d1faf2 100644 --- a/locale/en/gui.cfg +++ b/locale/en/gui.cfg @@ -40,9 +40,9 @@ data-tooltip-fastest-launch=The time taken for the fastest launch data-caption-total-rockets=Total Launched data-tooltip-total-rockets=Total number of rockets launched by your force value-tooltip-total-rockets=__1__% of all rockets on this map -data-caption-avg-launch=Avg Time +data-caption-avg-launch=Average Time data-tooltip-avg-launch=The average amount of time taken to launch a rocket -data-caption-avg-launch-n=Avg Time __1__ +data-caption-avg-launch-n=Average Time __1__ data-tooltip-avg-launch-n=The average amount of time taken to launch the last __1__ rockets data-caption-milestone-n=Milestone __1__ data-tooltip-milestone-n=Time taken to each __1__ rockets @@ -83,7 +83,7 @@ discard-tooltip=Remove task main-caption=Warp List main-tooltip=Warp list, must be within __1__ tiles to use sub-tooltip=Warps can only be used every __1__ seconds and when within __2__ tiles -too-close=Cant make warp; too close to warp: __1__ +too-close=Can't make warp; too close to warp: __1__ last-edit=Last edited by __1__ at __2__\nClick to view on map add-tooltip=Add new warp confirm-tooltip=Save changes @@ -94,4 +94,4 @@ discard-tooltip=Remove warp timer-tooltip=Warp charge, charge time __1__ seconds goto-tooltip=Go to x __1__ y __2__ goto-disabled=You must be on a warp point and have a full charge to warp -goto-edit=Edit warp icon \ No newline at end of file +goto-edit=Edit warp icon diff --git a/modules/addons/advanced-start.lua b/modules/addons/advanced-start.lua index 5379705b..3e93c853 100644 --- a/modules/addons/advanced-start.lua +++ b/modules/addons/advanced-start.lua @@ -1,7 +1,9 @@ --- Adds a better method of player starting items based on production levels. -local Event = require 'utils.event' -local Game = require 'utils.game' -local config = require 'config.advanced_start' +-- @addon Advanced-Start + +local Event = require 'utils.event' --- @dep utils.event +local Game = require 'utils.game' --- @dep utils.game +local config = require 'config.advanced_start' --- @dep config.advanced_start local items = config.items Event.add(defines.events.on_player_created, function(event) @@ -20,6 +22,7 @@ Event.add(defines.events.on_player_created, function(event) local stats = player.force.item_production_statistics local made = stats.get_input_count(item) local success,count = pcall(callback,made,stats.get_input_count,player) + count = math.floor(count) if success and count > 0 then player.insert{name=item,count=count} end diff --git a/modules/addons/chat-popups.lua b/modules/addons/chat-popups.lua index 7c75dbf7..1ff2b107 100644 --- a/modules/addons/chat-popups.lua +++ b/modules/addons/chat-popups.lua @@ -1,8 +1,10 @@ ---- Creates flying text entities when a player sends a message in chat +--- Creates flying text entities when a player sends a message in chat; -- also displays a ping above users who are named in the message -local Game = require 'utils.game' -local Event = require 'utils.event' -local config = require 'config.popup_messages' +-- @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 send_text = Game.print_player_floating_text -- (player_index, text, color) @@ -26,7 +28,7 @@ Event.add(defines.events.on_console_chat,function(event) -- Loops over online players to see if they name is included for _,mentioned_player in pairs(game.connected_players) do if mentioned_player.index ~= player.index then - if search_string:match(mentioned_player.name:lower()) then + if search_string:match(mentioned_player.name:lower(), 1, true) then send_text(mentioned_player.index,{'chat-popup.ping',player.name},player.chat_color) end end diff --git a/modules/addons/chat-reply.lua b/modules/addons/chat-reply.lua index 4dc40662..4a17d70c 100644 --- a/modules/addons/chat-reply.lua +++ b/modules/addons/chat-reply.lua @@ -1,7 +1,10 @@ -local Event = require 'utils.event' -local Game = require 'utils.game' -local Roles = require 'expcore.roles' -local config = require 'config.chat_reply' +--- Adds auto replies to chat messages; aswell as chat commands +-- @addon Chat-Reply + +local Event = require 'utils.event' --- @dep utils.event +local Game = require 'utils.game' --- @dep utils.game +local Roles = require 'expcore.roles' --- @dep expcore.roles +local config = require 'config.chat_reply' --- @dep config.chat_reply Event.add(defines.events.on_console_chat,function(event) local player_index = event.player_index diff --git a/modules/addons/compilatron.lua b/modules/addons/compilatron.lua index e8511ff0..0fe347b9 100644 --- a/modules/addons/compilatron.lua +++ b/modules/addons/compilatron.lua @@ -1,9 +1,12 @@ -local Event = require 'utils.event' -local Global = require 'utils.global' -local Game = require 'utils.game' -local Task = require 'utils.task' -local Token = require 'utils.token' -local config = require 'config.compilatron' +--- 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 Game = require 'utils.game' --- @dep utils.game +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 messages = config.messages local locations = config.locations @@ -62,7 +65,7 @@ end Event.on_nth_tick(config.message_cycle, circle_messages) --- This will add a compilatron to the global and start his message cycle --- @tparam entity LuaEntity the compilatron entity that moves around +-- @tparam LuaEntity entity the compilatron entity that moves around -- @tparam string name the name of the location that the complitron is at function Public.add_compilatron(entity, name) if not entity and not entity.valid then diff --git a/modules/addons/damage-popups.lua b/modules/addons/damage-popups.lua index 1b879f85..17016977 100644 --- a/modules/addons/damage-popups.lua +++ b/modules/addons/damage-popups.lua @@ -1,8 +1,10 @@ ---- Displays the amount of dmg that is done by players to entities +--- Displays the amount of dmg that is done by players to entities; -- also shows player health when a player is attacked -local Game = require 'utils.game' -local Event = require 'utils.event' -local config = require 'config.popup_messages' +-- @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 Event.add(defines.events.on_entity_damaged, function(event) local entity = event.entity diff --git a/modules/addons/death-logger.lua b/modules/addons/death-logger.lua index 2d8be85c..fb188f82 100644 --- a/modules/addons/death-logger.lua +++ b/modules/addons/death-logger.lua @@ -1,8 +1,11 @@ -local Event = require 'utils.event' -local Game = require 'utils.game' -local Global = require 'utils.global' -local config = require 'config.death_logger' -local format_time,move_items = ext_require('expcore.common','format_time','move_items') +--- 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 Game = require 'utils.game' --- @dep utils.game +local Global = require 'utils.global' --- @dep utils.global +local config = require 'config.death_logger' --- @dep config.death_logger +local format_time,move_items = ext_require('expcore.common','format_time','move_items') --- @dep expcore.common local deaths = { archive={} -- deaths moved here after body is gone diff --git a/modules/addons/discord-alerts.lua b/modules/addons/discord-alerts.lua index 720e0251..5aabc77e 100644 --- a/modules/addons/discord-alerts.lua +++ b/modules/addons/discord-alerts.lua @@ -1,8 +1,11 @@ -local Event = require 'utils.event' -local Game = require 'utils.game' -local Colors = require 'resources.color_presets' -local write_json,format_time = ext_require('expcore.common','write_json','format_time') -local config = require 'config.discord_alerts' +--- Sends alert messages to our discord server when certain events are triggered +-- @addon Discord-Alerts + +local Event = require 'utils.event' --- @dep utils.event +local Game = require 'utils.game' --- @dep utils.game +local Colors = require 'resources.color_presets' --- @dep resources.color_presets +local write_json,format_time = ext_require('expcore.common','write_json','format_time') --- @dep expcore.common +local config = require 'config.discord_alerts' --- @dep config.discord_alerts local function get_player_name(event) local player = Game.get_player_by_index(event.player_index) @@ -76,7 +79,7 @@ end --- Reports added and removed if config.player_reports then - local Reports = require 'modules.addons.reports-control' + local Reports = require '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{ @@ -88,32 +91,33 @@ if config.player_reports then ['Reason:']=event.reason } end) - Event.add(Reports.events.on_player_report_removed,function(event) - local player_name,by_player_name = get_player_name(event) + Event.add(Reports.events.on_report_removed,function(event) + local player_name = get_player_name(event) emit_event{ title='Report Removed', description='A player has a report removed', color=Colors.green, ['Player:']=''..player_name, - ['By:']=''..by_player_name + ['By:']=''..event.removed_by_name } end) end --- Warnings added and removed if config.player_warnings then - local Warnings = require 'modules.addons.warnings-control' - Event.add(Warnings.events.on_player_warned,function(event) + local Warnings = require '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) emit_event{ title='Warning', description='A player has been given a warning', color=Colors.yellow, ['Player:']=''..player_name, - ['By:']=''..by_player_name + ['By:']=''..by_player_name, + ['Reason:']=event.reason } end) - Event.add(Warnings.events.on_player_warning_removed,function(event) + Event.add(Warnings.events.on_warning_removed,function(event) local player_name,by_player_name = get_player_name(event) emit_event{ title='Warning Removed', diff --git a/modules/addons/greetings.lua b/modules/addons/greetings.lua new file mode 100644 index 00000000..28c3766a --- /dev/null +++ b/modules/addons/greetings.lua @@ -0,0 +1,14 @@ +--greets players on join + +local Event = require 'utils.event' --- @dep utils.event +local greet = +function(event) + local message = {'greetings.greet',{'links.discord'}} + game.players[event.player_index].print(message) + + +end + + + +Event.add(defines.events.on_player_joined_game ,greet) \ No newline at end of file diff --git a/modules/addons/jail-control.lua b/modules/addons/jail-control.lua deleted file mode 100644 index 41d5c910..00000000 --- a/modules/addons/jail-control.lua +++ /dev/null @@ -1,99 +0,0 @@ -local Roles = require 'expcore.roles' -local Game = require 'utils.game' -local Global = require 'utils.global' -local move_items = ext_require('expcore.common','move_items') - -local Jail = { - old_roles = {}, - temp_bans = {}, - events = { - on_player_jailed=script.generate_event_name(), - on_player_unjailed=script.generate_event_name(), - on_player_temp_banned=script.generate_event_name(), - on_player_temp_ban_cleared=script.generate_event_name() - } -} - -Global.register({ - old_roles = Jail.old_roles, - temp_bans = Jail.temp_bans -},function(tbl) - Jail.old_roles = tbl.old_roles - Jail.temp_bans = tbl.temp_bans -end) - -local function event_emit(event,player,by_player_name,reason) - script.raise_event(event,{ - name=event, - tick=game.tick, - player_index=player.index, - by_player_name=by_player_name, - reason=reason - }) -end - ---- Jails a player, this is only the logic there is no output to players --- @tparam LuaPlayer player the player that will be jailed, must not be in jail --- @tparam[opt=''] string by_player_name the name of the player doing the action used in logs --- @treturn the number of roles that were removed, nil if there was an error -function Jail.jail_player(player,by_player_name) - player = Game.get_player_from_any(player) - if not player then return end - if Roles.player_has_role(player,'Jail') then return end - local old_roles = Roles.get_player_roles(player) - Jail.old_roles[player.name] = old_roles - Roles.unassign_player(player,old_roles,by_player_name,true) - Roles.assign_player(player,'Jail',by_player_name,true) - event_emit(Jail.events.on_player_jailed,player,by_player_name) - return #old_roles -end - ---- Unjails a player, this is only the logic there is no output to players --- @tparam LuaPlayer player the player that will be unjailed, must be in jail --- @tparam[opt=''] string string by_player_name the name of the player who is doing the action --- @treturn the number of roles that were added, nil if there was an error -function Jail.unjail_player(player,by_player_name) - player = Game.get_player_from_any(player) - if not player then return end - if not Roles.player_has_role(player,'Jail') then return end - local old_roles = Jail.old_roles[player.name] - Roles.unassign_player(player,'Jail',by_player_name,true) - Roles.assign_player(player,old_roles,by_player_name,true) - event_emit(Jail.events.on_player_unjailed,player,by_player_name) - return #old_roles -end - ---- Temp bans a player which is similar to jail but will store the reason for the action and clears items --- @tparam LuaPlayer player the player that will be temp baned, must not be temp banned --- @tparam[opt=''] string by_player_name the name of the player that is doing the action --- @tparam[opt='None string Given.'] reason the reason that will be stored for this temp ban --- @treturn boolean true if successful else will return nil -function Jail.temp_ban_player(player,by_player_name,reason) - player = Game.get_player_from_any(player) - reason = reason or 'None Given.' - if not player then return end - if Jail.temp_bans[player.name] then return end - Jail.jail_player(player,by_player_name) - Jail.temp_bans[player.name] = {reason,by_player_name} - local inv = player.get_main_inventory() - move_items(inv.get_contents()) - inv.clear() - event_emit(Jail.events.on_player_temp_banned,player,by_player_name,reason) - return true -end - ---- Removes temp ban from a player, note this does not restore the items --- @tparam LuaPlayer player the player that will be cleared from temp baned, must be temp banned --- @tparam[opt=''] string by_player_name the name of the player that is doing the action --- @treturn boolean true if successful else will return nil -function Jail.clear_temp_ban_player(player,by_player_name) - player = Game.get_player_from_any(player) - if not player then return end - if not Jail.temp_bans[player.name] then return end - Jail.unjail_player(player,by_player_name) - Jail.temp_bans[player.name] = nil - event_emit(Jail.events.on_player_temp_ban_cleared,player,by_player_name) - return true -end - -return Jail \ No newline at end of file diff --git a/modules/addons/pollution-grading.lua b/modules/addons/pollution-grading.lua index 8166cebd..dd4b0914 100644 --- a/modules/addons/pollution-grading.lua +++ b/modules/addons/pollution-grading.lua @@ -1,5 +1,8 @@ -local Event = require 'utils.event' -local config = require 'config.pollution_grading' +--- 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 delay = config.update_delay * 3600 -- convert from minutes to ticks Event.on_nth_tick(delay,function() diff --git a/modules/addons/random-player-colours.lua b/modules/addons/random-player-colours.lua index 9c47f8be..0677faa1 100644 --- a/modules/addons/random-player-colours.lua +++ b/modules/addons/random-player-colours.lua @@ -1,8 +1,11 @@ -local Colours = require 'resources.color_presets' -local Game = require 'utils.game' -local Event = require 'utils.event' -local config = require 'config.preset_player_colours' -local Global = require 'utils.global' +--- Gives players random colours when they join, also applies preset colours to those who have them +-- @addon Player-Colours + +local Colours = require 'resources.color_presets' --- @dep resources.color_presets +local Game = require 'utils.game' --- @dep utils.game +local Event = require 'utils.event' --- @dep utils.event +local config = require 'config.preset_player_colours' --- @dep config.preset_player_colours +local Global = require 'utils.global' --- @dep utils.global require 'utils.table' Global.register(config,function(tbl) diff --git a/modules/addons/reports-control.lua b/modules/addons/reports-control.lua deleted file mode 100644 index 5de027ce..00000000 --- a/modules/addons/reports-control.lua +++ /dev/null @@ -1,141 +0,0 @@ -local Game = require 'utils.game' -local Global = require 'utils.global' - -local Reports = { - user_reports={}, - events = { - on_player_reported = script.generate_event_name(), - on_player_report_removed = script.generate_event_name() - } -} - -Global.register(Reports.user_reports,function(tbl) - Reports.user_reports = tbl -end) - -local function event_emit(event,player,by_player_name) - local reports = Reports.user_reports[player.name] - local reason = reports and reports[by_player_name] - script.raise_event(event,{ - name=event, - tick=game.tick, - player_index=player.index, - by_player_name=by_player_name, - reason=reason - }) -end - ---- Adds a report to a player, reports are stored in global table and can be accessed later --- @tparam LuaPlayer player the player that will be reported --- @tparam[opt='Non string Given.'] reason the reason that the player is being reported --- @tparam[opt=''] string by_player_name the name of the player doing the action --- @treturn boolean true if the report was added, nil if there is an error -function Reports.report_player(player,reason,by_player_name) - player = Game.get_player_from_any(player) - if not player then return end - reason = reason or 'Non Given.' - by_player_name = by_player_name or '' - local reports = Reports.user_reports[player.name] - if not reports then - Reports.user_reports[player.name] = { - [by_player_name] = reason - } - elseif not reports[by_player_name] then - reports[by_player_name] = reason - else return false end - event_emit(Reports.events.on_player_reported,player,by_player_name) - return true -end - ---- Removes a report from a player by the given player, see clear_player_reports to remove all --- @tparam LuaPlayer player the player that will have the report removed --- @tparam[opt=''] string by_player_name the name of the player doing the action --- @treturn boolean true if the report was removed, nil if there was an error -function Reports.remove_player_report(player,by_player_name) - player = Game.get_player_from_any(player) - if not player then return end - by_player_name = by_player_name or '' - local reports = Reports.user_reports[player.name] - if reports and reports[by_player_name] then - event_emit(Reports.events.on_player_report_removed,player,by_player_name) - reports[by_player_name] = nil - if Reports.count_player_reports(player) == 0 then - Reports.user_reports[player.name] = nil - end - return true - end - return false -end - ---- Clears all reports from a player, will emit an event for each individual report as if remove_player_report was used --- @tparam LuaPlayer player the player to clear the reports of --- @treturn boolean true if the reports were cleared, nil if error -function Reports.clear_player_reports(player) - player = Game.get_player_from_any(player) - if not player then return end - local reports = Reports.user_reports[player.name] - if reports then - for by_player_name,reason in pairs(reports) do - event_emit(Reports.events.on_player_report_removed,player,by_player_name) - end - Reports.user_reports[player.name] = nil - return true - end - return false -end - ---- Test for if a player has been reported by another player, can also return the reason from that player --- @tparam LuaPlayer player the player to check the reports of --- @tparam string by_player_name the player that made if the report if present (note server is not default here) --- @tparam[opt=false] boolean rtn_reason true will return the reason for the report rather than a boolean --- @treturn boolean true if a report from the player is present unless rtn_reason is true when a string is returned (or false) -function Reports.player_is_reported_by(player,by_player_name,rtn_reason) - player = Game.get_player_from_any(player) - if not player then return end - local reports = Reports.user_reports[player.name] - if reports and reports[by_player_name] then - return rtn_reason and reports[by_player_name] or true - end - return false -end - ---- Gets all the reports that are on a player --- @tparam LuaPlayer player the player to get the reports of --- @treturn table a table of all the reports for this player, empty table if no reports -function Reports.get_player_reports(player) - player = Game.get_player_from_any(player) - if not player then return end - return Reports.user_reports[player.name] or {} -end - ---- Counts all reports on a player returning a number, a custom count function can be given which should return a number --- @tparam LuaPlayer player the player to count the reports of --- @tparam[opt] number function count_callback should return a or true (for 1) this will be passed every report on the player --- count_callback param - player_name string - the name of the player who made the report --- count_callback param - reason string - the reason the reason was made --- count_callback return - number or boolean - if number then this will be added to the count, if boolean then false = 0 and true = 1 --- @treturn number the number of reports on the player -function Reports.count_player_reports(player,count_callback) - player = Game.get_player_from_any(player) - if not player then return end - local reports = Reports.user_reports[player.name] or {} - if not count_callback then - local ctn = 0 - for _ in pairs(reports) do - ctn=ctn+1 - end - return ctn - else - local ctn = 0 - for player_name,reason in pairs(reports) do - local success,err = pcall(count_callback,player_name,reason) - if success and err then - if err == true then err = 1 end - ctn = ctn+err - end - end - return ctn - end -end - -return Reports \ No newline at end of file diff --git a/modules/addons/scorched-earth.lua b/modules/addons/scorched-earth.lua index 15660669..82c361de 100644 --- a/modules/addons/scorched-earth.lua +++ b/modules/addons/scorched-earth.lua @@ -1,8 +1,11 @@ -local Event = require 'utils.event' -local Game = require 'utils.game' -local Global = require 'utils.global' -local print_grid_value, clear_flying_text = ext_require('expcore.common','print_grid_value','clear_flying_text') -local config = require 'config.scorched_earth' +--- 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 Game = require 'utils.game' --- @dep utils.game +local Global = require 'utils.global' --- @dep utils.global +local print_grid_value, clear_flying_text = ext_require('expcore.common','print_grid_value','clear_flying_text') --- @dep expcore.common +local config = require '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 diff --git a/modules/addons/spawn-area.lua b/modules/addons/spawn-area.lua index 673f3a45..dcdbb5f0 100644 --- a/modules/addons/spawn-area.lua +++ b/modules/addons/spawn-area.lua @@ -1,7 +1,10 @@ -local Global = require 'utils.global' -local Event = require 'utils.event' -local Game = require 'utils.game' -local config = require 'config.spawn_area' +--- 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 Game = require 'utils.game' --- @dep utils.game +local config = require 'config.spawn_area' --- @dep config.spawn_area local tiles = config.tiles local entities = config.entities local belts = config.afk_belts.locations diff --git a/modules/addons/station-auto-name.lua b/modules/addons/station-auto-name.lua new file mode 100644 index 00000000..feb8cd19 --- /dev/null +++ b/modules/addons/station-auto-name.lua @@ -0,0 +1,66 @@ +---LuaPlayerBuiltEntityEventFilters +---Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name = "fast-inserter"}}) +local Event = require 'utils.event' --- @dep utils.event +local station_name_changer = +function(event) + local enetety = event.created_entity + local name = enetety.name + + if name == "train-stop" then --only do the event if its a trainstop + local boundingbox = enetety.bounding_box + -- expanded box for recourse search: + local bounding2 = { {boundingbox.left_top.x -100 ,boundingbox.left_top.y -100} , {boundingbox.right_bottom.x +100,boundingbox.right_bottom.y +100 } } + --gets all resources in bounding_box2: + local recoursec = game.surfaces[1].find_entities_filtered{area = bounding2, type = "resource"} + + if #recoursec > 0 then -- save cpu time if their are no recourses in bounding_box2 + local closest_distance + local px,py = boundingbox.left_top.x,boundingbox.left_top.y + local recourse_closed + + --Check which recource is closest + for i, item in ipairs(recoursec) do + local dx, dy = px - item.bounding_box.left_top.x, py - item.bounding_box.left_top.y + local distance = (dx*dx)+(dy*dy) + if not closest_distance or distance < closest_distance then + recourse_closed = item + closest_distance = distance + end + + end + + + local item_name = recourse_closed.name + if item_name then -- prevent errors if something went wrong + local item_name2 = item_name:gsub("^%l", string.upper):gsub('-',' ') -- removing the - and making first letter capital + --Final string: + enetety.backer_name = string.format("[L] [img=item.%s] %s %s (%s)",item_name,item_name2,enetety.backer_name,Angle( enetety )) + end + end + end +end +--add func to robot and player build entities +Event.add(defines.events.on_built_entity,station_name_changer) +Event.add(defines.events.on_robot_built_entity,station_name_changer) + + +--Credit to Cooldude2606 for using his lua magic to make this function. +local directions = { + ['W'] = -0.875, + ['NW'] = -0.625, + ['N'] = -0.375, + ['NE'] = -0.125, + ['E'] = 0.125, + ['SE'] = 0.375, + ['S'] = 0.625, + ['SW'] = 0.875 +} +function Angle( enetety ) + local angle = math.atan2(enetety.position.y,enetety.position.x)/math.pi + for direction, requiredAngle in pairs(directions) do + if angle < requiredAngle then + return direction + end + end +end + \ No newline at end of file diff --git a/modules/addons/warnings-control.lua b/modules/addons/warnings-control.lua deleted file mode 100644 index 44b07cfd..00000000 --- a/modules/addons/warnings-control.lua +++ /dev/null @@ -1,221 +0,0 @@ -local Game = require 'utils.game' -local Global = require 'utils.global' -local Event = require 'utils.event' -local config = require 'config.warnings' -local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') -require 'utils.table' - -local Warnings = { - user_warnings={}, - user_temp_warnings={}, - events = { - on_player_warned = script.generate_event_name(), - on_player_warning_removed = script.generate_event_name(), - on_temp_warning_added = script.generate_event_name(), - on_temp_warning_removed = script.generate_event_name(), - } -} - -Global.register({ - user_warnings = Warnings.user_warnings, - user_temp_warnings = Warnings.user_temp_warnings -},function(tbl) - Warnings.user_warnings = tbl.user_warnings - Warnings.user_temp_warnings = tbl.user_temp_warnings -end) - -local function event_emit(event,player,by_player_name) - local warnings = Warnings.user_warnings[player.name] or {} - local temp_warnings = Warnings.user_temp_warnings[player.name] or {} - script.raise_event(event,{ - name=event, - tick=game.tick, - player_index=player.index, - by_player_name=by_player_name, - warning_count=#warnings, - temp_warning_count=#temp_warnings - }) -end - ---- Adds X number (default 1) of warnings to a player from the given player --- @tparam LuaPlayer player the player to add the warning to --- @tparam[opt=''] string by_player_name the name of the player doing the action --- @tparam[opt=1] number count the number of warnings to add --- @treturn number the new number of warnings -function Warnings.add_warnings(player,by_player_name,count) - player = Game.get_player_from_any(player) - if not player then return end - count = count or 1 - by_player_name = by_player_name or '' - local warnings = Warnings.user_warnings[player.name] - if not warnings then - Warnings.user_warnings[player.name] = {} - warnings = Warnings.user_warnings[player.name] - end - for _=1,count do - table.insert(warnings,by_player_name) - event_emit(Warnings.events.on_player_warned,player,by_player_name) - end - return #warnings -end - ---- Removes X number (default 1) of warnings from a player, removes in order fifo --- @tparam LuaPlayer player the player to remove the warnings from --- @tparam[opt=''] string by_playey_name the name of the player doing the action --- @tparam[opt=1] number count the number of warnings to remove (if greater than current warning count then all are removed) --- @treturn number the new number of warnings -function Warnings.remove_warnings(player,by_player_name,count) - player = Game.get_player_from_any(player) - if not player then return end - count = count or 1 - by_player_name = by_player_name or '' - local warnings = Warnings.user_warnings[player.name] - if not warnings then return end - for _=1,count do - if #warnings == 0 then break end - table.remove(warnings,1) - event_emit(Warnings.events.on_player_warning_removed,player,by_player_name) - end - if #warnings == 0 then - Warnings.user_warnings[player.name] = nil - return 0 - end - return #warnings -end - ---- Clears all warnings from a player, emits event multiple times as if remove_warnings was used --- @tparam LuaPlayer player the player to clear the warnings of --- @tparam[oot=''] string by_player_name the name of the player who is doing the action --- @treturn boolean true if the warnings were cleared, nil if error -function Warnings.clear_warnings(player,by_player_name) - player = Game.get_player_from_any(player) - if not player then return end - local warnings = Warnings.user_warnings[player.name] - if not warnings then return end - by_player_name = by_player_name or '' - for _=1,#warnings do - event_emit(Warnings.events.on_player_warning_removed,player,by_player_name) - end - Warnings.user_warnings[player.name] = {} - return true -end - ---- Gets the number of warnings that a player has, raw table will contain the names of who gave warnings --- @tparam LuaPlayer player the player to get the warnings of --- @tparam[opt=false] table table raw_table when true will return a which contains who gave warnings (the stored in global) --- @treturn number the number of warnings a player has, a table if raw_table is true -function Warnings.get_warnings(player,raw_table) - player = Game.get_player_from_any(player) - if not player then return end - local warnings = Warnings.user_warnings[player.name] or {} - if raw_table then - return warnings - else - return #warnings - end -end - ---- Adds a temp warning to a player that will timeout after some time, used for script given warnings (ie silent to outside players as a buffer) --- @tparam LuaPlayer player the player to give the warnings to --- @tparam[opt=1] number count the number of warnings to give to the player --- @treturn number the new number of warnings -function Warnings.add_temp_warnings(player,count) - player = Game.get_player_from_any(player) - if not player then return end - count = count or 1 - local warnings = Warnings.user_temp_warnings[player.name] - if not warnings then - Warnings.user_temp_warnings[player.name] = {} - warnings = Warnings.user_temp_warnings[player.name] - end - for _=1,count do - table.insert(warnings,game.tick) - event_emit(Warnings.events.on_temp_warning_added,player,'') - end - return #warnings -end - --- temp warnings cant be removed on demand only after X amount of time -local temp_warning_cool_down = config.temp_warning_cool_down*3600 -Event.on_nth_tick(temp_warning_cool_down/4,function() - local check_time = game.tick-temp_warning_cool_down - for player_name,temp_warnings in pairs(Warnings.user_temp_warnings) do - local player = Game.get_player_from_any(player) - for index,time in pairs(temp_warnings) do - if time <= check_time then - table.remove(temp_warnings,index) - player.print{'warnings.script-warning-removed',#temp_warnings,config.temp_warning_limit} - event_emit(Warnings.events.on_temp_warning_removed,player,'') - end - end - if #temp_warnings == 0 then - Warnings.user_temp_warnings[player_name] = nil - end - end -end) - ---- Clears all temp warnings from a player, emits events as if the warnings had been removed due to time --- @tparam LuaPlayer player the player to clear the warnings of --- @tparam[opt=''] string by_player_name the name of the player doing the action --- @treturn boolean true if the warnings were cleared, nil for error -function Warnings.clear_temp_warnings(player,by_player_name) - player = Game.get_player_from_any(player) - if not player then return end - local warnings = Warnings.user_temp_warnings[player.name] - if not warnings then return end - by_player_name = by_player_name or '' - for _=1,#warnings do - event_emit(Warnings.events.on_temp_warning_removed,player,by_player_name) - end - Warnings.user_temp_warnings[player.name] = {} - return true -end - ---- Gets the number of temp warnings, raw table is a table of when temp warnings were given --- @tparam LuaPlayer player the player to get the warnings of --- @tparam[opt=false] table raw_table if true will return a of ticks when warnings were added (the global table) --- @treturn number the number of warnings which the player has, a table if raw_table is true -function Warnings.get_temp_warnings(player,raw_table) - player = Game.get_player_from_any(player) - if not player then return end - local warnings = Warnings.user_temp_warnings[player.name] or {} - if raw_table then - return warnings - else - return #warnings - end -end - --- when a player gets a warning the actions in config are ran -Event.add(Warnings.events.on_player_warned,function(event) - local action = config.actions[event.warning_count] - if not action then return end - local player = Game.get_player_by_index(event.player_index) - if type(action) == 'function' then - -- player: player who got the warnings,by_player_name: player who gave the last warning,number_of_warnings: the current number of warnings - local success,err = pcall(action,player,event.by_player_name,event.warning_count) - if not success then error(err) end - elseif type(action) == 'table' then - -- {locale,by_player_name,number_of_warning,...} - local current_action = table.deep_copy(action) - table.insert(current_action,2,event.by_player_name) - table.insert(current_action,3,event.warning_count) - player.print(current_action) - elseif type(action) == 'string' then - player.print(action) - end -end) - --- when a player gets a tempo warnings it is checked that it is not above the max -Event.add(Warnings.events.on_temp_warning_added,function(event) - local player = Game.get_player_by_index(event.player_index) - if event.temp_warning_count > config.temp_warning_limit then - Warnings.add_warnings(event.player_index,event.by_player_name) - local player_name_color = format_chat_player_name(player) - game.print{'warnings.script-warning-limit',player_name_color} - else - player.print{'warnings.script-warning',event.temp_warning_count,config.temp_warning_limit} - end -end) - -return Warnings \ No newline at end of file diff --git a/modules/commands/admin-chat.lua b/modules/commands/admin-chat.lua index f3038941..63a5447d 100644 --- a/modules/commands/admin-chat.lua +++ b/modules/commands/admin-chat.lua @@ -1,9 +1,17 @@ -local Commands = require 'expcore.commands' -local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') +--[[-- Commands Module - Admin Chat + - Adds a command that allows admins to talk in a private chat + @commands Admin-Chat +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') --- @dep expcore.common require 'config.expcore-commands.parse_general' +--- Sends a message in chat that only admins can see +-- @command admin-chat +-- @tparam string message the message to send in the admin chat Commands.new_command('admin-chat','Sends a message in chat that only admins can see.') -:add_param('message',false) -- the message to send in the admin chat +:add_param('message',false) :enable_auto_concat() :set_flag('admin_only',true) :add_alias('ac') diff --git a/modules/commands/bonus.lua b/modules/commands/bonus.lua index 8b3e6517..2a63c6d5 100644 --- a/modules/commands/bonus.lua +++ b/modules/commands/bonus.lua @@ -1,60 +1,72 @@ -local Commands = require 'expcore.commands' -local Roles = require 'expcore.roles' -local Event = require 'utils.event' -local Game = require 'utils.game' -local Store = require 'expcore.store' -local config = require 'config.bonuses' +--[[-- Commands Module - Bonus + - Adds a command that allows players to have increased stats + @commands Bonus +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local Roles = require 'expcore.roles' --- @dep expcore.roles +local Event = require 'utils.event' --- @dep utils.event +local Game = require 'utils.game' --- @dep utils.game +local Store = require 'expcore.store' --- @dep expcore.store +local config = require 'config.bonuses' --- @dep config.bonuses require 'config.expcore-commands.parse_general' -local bonus_store = -Store.register(function(value,category) - local player = Game.get_player_from_any(category) - for bonus,min_max in pairs(config) do - local increase = min_max[2]*value - player[bonus] = min_max[1]+increase - end +-- Store bonus percentages keyed by player name +local bonus_store = Store.register(function(player) + return player.name end) +-- Apply a bonus amount to a player +local function apply_bonus(player,amount) + if not amount then return end + for bonus,min_max in pairs(config) do + local increase = min_max[2]*amount + player[bonus] = min_max[1]+increase + end +end + +--- Changes the amount of bonus you receive +-- @command bonus +-- @tparam number amount range 0-50 the percent increase for your bonus Commands.new_command('bonus','Changes the amount of bonus you receive') :add_param('amount','integer-range',0,50) :register(function(player,amount) local percent = amount/100 - Store.set(bonus_store,player.name,percent) + Store.set(bonus_store,player,percent) Commands.print{'expcom-bonus.set',amount} Commands.print({'expcom-bonus.wip'},'orange') end) -Event.add(defines.events.on_player_respawned,function(event) - local player = Game.get_player_by_index(event.player_index) - local value = Store.get(bonus_store,player.name) - if value then - for bonus,min_max in pairs(config) do - local increase = min_max[2]*value - player[bonus] = min_max[1]+increase - end - end +-- When store is updated apply new bonus to the player +Store.watch(bonus_store,function(value,category) + local player = Game.get_player_from_any(category) + apply_bonus(player,value) end) -Event.add(defines.events.on_pre_player_died,function(event) +-- When a player respawns re-apply bonus +Event.add(defines.events.on_player_respawned,function(event) + local player = Game.get_player_by_index(event.player_index) + local value = Store.get(bonus_store,player) + apply_bonus(player,value) +end) + +-- When a player dies allow them to have instant respawn +Event.add(defines.events.on_player_died,function(event) local player = Game.get_player_by_index(event.player_index) if Roles.player_has_flag(player,'instance-respawn') then player.ticks_to_respawn = 120 - -- manually dispatch death event because it is not fired when ticks_to_respawn is set pre death - Event.dispatch{ - name=defines.events.on_player_died, - tick=event.tick, - player_index=event.player_index, - cause = event.cause - } end end) +-- Remove bonus if a player no longer has access to the command local function role_update(event) local player = Game.get_player_by_index(event.player_index) if not Roles.player_allowed(player,'command/bonus') then - Store.clear(bonus_store,player.name) + Store.clear(bonus_store,player) end end Event.add(Roles.events.on_role_assigned,role_update) -Event.add(Roles.events.on_role_unassigned,role_update) \ No newline at end of file +Event.add(Roles.events.on_role_unassigned,role_update) + +return bonus_store \ No newline at end of file diff --git a/modules/commands/cheat-mode.lua b/modules/commands/cheat-mode.lua index ab40cb30..caef97c9 100644 --- a/modules/commands/cheat-mode.lua +++ b/modules/commands/cheat-mode.lua @@ -1,8 +1,16 @@ -local Commands = require 'expcore.commands' +--[[-- Commands Module - Cheat Mode + - Adds a command that allows players to enter cheat mode + @commands Cheat-Mode +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands require 'config.expcore-commands.parse_general' +--- Toggles cheat mode for your player, or another player. +-- @command toggle-cheat-mode +-- @tparam[opt=self] LuaPlayer player player to toggle chest mode of, can be nil for self Commands.new_command('toggle-cheat-mode','Toggles cheat mode for your player, or another player.') -:add_param('player',true,'player') -- player to toggle chest mode of, can be nil for self +:add_param('player',true,'player') :set_defaults{player=function(player) return player -- default is the user using the command end} diff --git a/modules/commands/clear-inventory.lua b/modules/commands/clear-inventory.lua index b33c3029..587e8ce2 100644 --- a/modules/commands/clear-inventory.lua +++ b/modules/commands/clear-inventory.lua @@ -1,7 +1,15 @@ -local Commands = require 'expcore.commands' -local move_items = ext_require('expcore.common','move_items') +--[[-- Commands Module - Clear Inventory + - Adds a command that allows admins to clear people's inventorys + @commands Clear-Inventory +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local move_items = ext_require('expcore.common','move_items') --- @dep expcore.common require 'config.expcore-commands.parse_roles' +--- Clears a players inventory +-- @command clear-inventory +-- @tparam LuaPlayer player the player to clear the inventory of Commands.new_command('clear-inventory','Clears a players inventory') :add_param('player',false,'player-role-alive') :add_alias('clear-inv','move-inventory','move-inv') diff --git a/modules/commands/debug.lua b/modules/commands/debug.lua index 5e9b1496..f0be73ba 100644 --- a/modules/commands/debug.lua +++ b/modules/commands/debug.lua @@ -1,6 +1,13 @@ -local DebugView = require 'modules.gui.debug.main_view' -local Commands = require 'expcore.commands' +--[[-- Commands Module - Debug + - Adds a command that opens the debug frame + @commands Debug +]] +local DebugView = require 'modules.gui.debug.main_view' --- @dep modules.gui.debug.main_view +local Commands = require 'expcore.commands' --- @dep expcore.commands + +--- Opens the debug pannel for viewing tables. +-- @command debug Commands.new_command('debug','Opens the debug pannel for viewing tables.') :register(function(player,raw) DebugView.open_dubug(player) diff --git a/modules/commands/find.lua b/modules/commands/find.lua index 1f06f475..f2770ab6 100644 --- a/modules/commands/find.lua +++ b/modules/commands/find.lua @@ -1,8 +1,16 @@ -local Commands = require 'expcore.commands' +--[[-- Commands Module - Find + - Adds a command that zooms in on the given player + @commands Find +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands require 'config.expcore-commands.parse_general' +--- Find a player on your map. +-- @command find-on-map +-- @tparam LuaPlayer the player to find on the map Commands.new_command('find-on-map','Find a player on your map.') -:add_param('player',false,'player-online') -- the player to find on the map +:add_param('player',false,'player-online') :add_alias('find','zoom-to') :register(function(player,action_player,raw) local position = action_player.position diff --git a/modules/commands/help.lua b/modules/commands/help.lua index 11d2c647..92904650 100644 --- a/modules/commands/help.lua +++ b/modules/commands/help.lua @@ -1,5 +1,10 @@ -local Commands = require 'expcore.commands' -local Global = require 'utils.global' +--[[-- Commands Module - Help + - Adds a better help command that allows searching of descriotions and names + @commands Help +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local Global = require 'utils.global' --- @dep utils.global require 'config.expcore-commands.parse_general' local results_per_page = 5 @@ -9,9 +14,13 @@ Global.register(search_cache,function(tbl) search_cache = tbl end) +--- Searches for a keyword in all commands you are allowed to use. +-- @command chelp +-- @tparam string keyword the keyword that will be looked for +-- @tparam number page the page of help to view, must be in range of pages Commands.new_command('chelp','Searches for a keyword in all commands you are allowed to use.') -:add_param('keyword',true) -- the keyword that will be looked for -:add_param('page',true,'integer') -- the keyword that will be looked for +:add_param('keyword',true) +:add_param('page',true,'integer') :set_defaults{keyword='',page=1} :register(function(player,keyword,page,raw) local player_index = player and player.index or 0 diff --git a/modules/commands/home.lua b/modules/commands/home.lua index be733517..0d0dd92a 100644 --- a/modules/commands/home.lua +++ b/modules/commands/home.lua @@ -1,5 +1,10 @@ -local Commands = require 'expcore.commands' -local Global = require 'utils.global' +--[[-- Commands Module - Home + - Adds a command that allows setting and teleporting to your home position + @commands Home +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local Global = require 'utils.global' --- @dep utils.global require 'config.expcore-commands.parse_general' local homes = {} @@ -23,6 +28,8 @@ local function floor_pos(position) } end +--- Teleports you to your home location +-- @command home Commands.new_command('home','Teleports you to your home location') :register(function(player,raw) local home = homes[player.index] @@ -35,6 +42,8 @@ Commands.new_command('home','Teleports you to your home location') Commands.print{'expcom-home.return-set',rtn.x,rtn.y} end) +--- Sets your home location to your current position +-- @command home-set Commands.new_command('home-set','Sets your home location to your current position') :register(function(player,raw) local home = homes[player.index] @@ -47,6 +56,8 @@ Commands.new_command('home-set','Sets your home location to your current positio Commands.print{'expcom-home.home-set',pos.x,pos.y} end) +--- Returns your current home location +-- @command home-get Commands.new_command('home-get','Returns your current home location') :register(function(player,raw) local home = homes[player.index] @@ -57,6 +68,8 @@ Commands.new_command('home-get','Returns your current home location') Commands.print{'expcom-home.home-get',pos.x,pos.y} end) +--- Teleports you to previous location +-- @command return Commands.new_command('return','Teleports you to previous location') :register(function(player,raw) local home = homes[player.index] diff --git a/modules/commands/interface.lua b/modules/commands/interface.lua index 1f0eae0a..67dbd035 100644 --- a/modules/commands/interface.lua +++ b/modules/commands/interface.lua @@ -1,6 +1,11 @@ -local Commands = require 'expcore.commands' -local Global = require 'utils.global' -local Common = require 'expcore.common' +--[[-- Commands Module - Interface + - Adds a command that acts as a direct link to the the active softmod, for debug use + @commands Interface +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local Global = require 'utils.global' --- @dep utils.global +local Common = require 'expcore.common' --- @dep expcore.common -- modules that are loaded into the interface env to be accessed local interface_modules = { @@ -12,7 +17,7 @@ local interface_modules = { ['Roles']='expcore.roles', ['Store']='expcore.store', ['Gui']='expcore.gui', - ['Sudo']='expcore.sudo' + ['Async']='expcore.async' } -- loads all the modules given in the above table @@ -52,8 +57,11 @@ local function get_index(self,key) end end +--- Sends an innovation to be ran and returns the result. +-- @command interface +-- @tparam string innovation the command that will be run Commands.new_command('interface','Sends an innovation to be ran and returns the result.') -:add_param('innovation',false) -- the message to send in the admin chat +:add_param('innovation',false) :enable_auto_concat() :set_flag('admin_only',true) :register(function(player,innovation,raw) diff --git a/modules/commands/jail.lua b/modules/commands/jail.lua index a5d7ae37..c6c92954 100644 --- a/modules/commands/jail.lua +++ b/modules/commands/jail.lua @@ -1,8 +1,17 @@ -local Commands = require 'expcore.commands' -local JailControl = require 'modules.addons.jail-control' -local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') +--[[-- Commands Module - Jail + - Adds a commands that allow admins to jail, unjail, and temp ban players + @commands Jail +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local Jail = require 'modules.control.jail' --- @dep modules.control.jail +local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') --- @dep expcore.common require 'config.expcore-commands.parse_roles' +--- Puts a player into jail and removes all other roles. +-- @command jail +-- @tparam LuaPlayer player the player that will be jailed +-- @tparam[opt] string reason the reason why the player is being jailed Commands.new_command('jail','Puts a player into jail and removes all other roles.') :add_param('player',false,'player-role') :add_param('reason',true) @@ -11,27 +20,34 @@ Commands.new_command('jail','Puts a player into jail and removes all other roles reason = reason or 'Non Given.' local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) - if JailControl.jail_player(action_player,player.name) then + if Jail.jail_player(action_player,player.name,reason) then game.print{'expcom-jail.give',action_player_name_color,by_player_name_color,reason} else return Commands.error{'expcom-jail.already-jailed',action_player_name_color} end end) -Commands.new_command('unjail','Puts a player into jail and removes all other roles.') +--- Removes a player from jail. +-- @command unjail +-- @tparam LuaPlayer the player that will be unjailed +Commands.new_command('unjail','Removes a player from jail.') :add_param('player',false,'player-role') :add_alias('clear-jail','remove-jail') :enable_auto_concat() :register(function(player,action_player,raw) local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) - if JailControl.unjail_player(action_player,player.name) then + if Jail.unjail_player(action_player,player.name) then game.print{'expcom-jail.remove',action_player_name_color,by_player_name_color} else return Commands.error{'expcom-jail.not-jailed',action_player_name_color} end end) +--- Temp bans a player until the next reset; this requires a reason; this will clear the players inventory. +-- @command temp-ban +-- @tparam LuaPlayer player the player that will be temp banned +-- @tparam string reason the reason that the player is being temp banned Commands.new_command('temp-ban','Temp bans a player until the next reset; this requires a reason; this will clear the players inventory.') :add_param('player',false,'player-role') :add_param('reason',false) @@ -39,23 +55,26 @@ Commands.new_command('temp-ban','Temp bans a player until the next reset; this r :register(function(player,action_player,reason,raw) local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) - if JailControl.temp_ban_player(action_player,player.name,reason) then + if Jail.temp_ban_player(action_player,player.name,reason) then game.print{'expcom-jail.temp-ban',action_player_name_color,by_player_name_color,reason} else return Commands.error{'expcom-jail.already-banned',action_player_name_color} end end) -Commands.new_command('clear-temp-ban','Removes temp ban from a player; this will not restore they items.') +--- Removes temp ban from a player; this will not restore their items. +-- @command clear-temp-ban +-- @tparam LuaPlayer player the player to revoke the temp ban from +Commands.new_command('clear-temp-ban','Removes temp ban from a player; this will not restore their items.') :add_param('player',false,'player-role') :add_alias('untemp-ban','remove-temp-ban') :enable_auto_concat() :register(function(player,action_player,raw) local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) - if JailControl.clear_temp_ban_player(action_player,player.name) then + if Jail.untemp_ban_player(action_player,player.name) then game.print{'expcom-jail.temp-ban-clear',action_player_name_color,by_player_name_color} else return Commands.error{'expcom-jail.not-temp-banned',action_player_name_color} end -end) \ No newline at end of file +end) diff --git a/modules/commands/kill.lua b/modules/commands/kill.lua index e0076165..2396be52 100644 --- a/modules/commands/kill.lua +++ b/modules/commands/kill.lua @@ -1,10 +1,18 @@ -local Commands = require 'expcore.commands' -local Roles = require 'expcore.roles' +--[[-- Commands Module - Kill + - Adds a command that allows players to kill them selfs and others + @commands Kill +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local Roles = require 'expcore.roles' --- @dep expcore.roles require 'config.expcore-commands.parse_general' require 'config.expcore-commands.parse_roles' +--- Kills yourself or another player. +-- @command kill +-- @tparam[opt=self] LuaPlayer player the player to kill, must be alive to be valid Commands.new_command('kill','Kills yourself or another player.') -:add_param('player',true,'player-role-alive') -- the player to kill, must be alive to be valid +:add_param('player',true,'player-role-alive') :set_defaults{player=function(player) -- default is the player unless they are dead if player.character and player.character.health > 0 then diff --git a/modules/commands/me.lua b/modules/commands/me.lua index 87b3d5c8..9e6364e8 100644 --- a/modules/commands/me.lua +++ b/modules/commands/me.lua @@ -1,7 +1,15 @@ -local Commands = require 'expcore.commands' +--[[-- Commands Module - Me + - Adds a command that adds * around your message in the chat + @commands Me +]] +local Commands = require 'expcore.commands' --- @dep expcore.commands + +--- Sends an action message in the chat +-- @command me +-- @tparam string action the action that follows your name in chat Commands.new_command('me','Sends an action message in the chat') -:add_param('action',false) -- action that is done by the player, just text its meaningless +:add_param('action',false) :enable_auto_concat() :register(function(player,action,raw) local player_name = player and player.name or '' diff --git a/modules/commands/rainbow.lua b/modules/commands/rainbow.lua index f2d03cda..a5c03e53 100644 --- a/modules/commands/rainbow.lua +++ b/modules/commands/rainbow.lua @@ -1,5 +1,10 @@ -local Commands = require 'expcore.commands' -local format_chat_colour = ext_require('expcore.common','format_chat_colour') +--[[-- Commands Module - Rainbow + - Adds a command that prints your message in rainbow font + @commands Rainbow +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local format_chat_colour = ext_require('expcore.common','format_chat_colour') --- @dep expcore.common local function step_component(c1,c2) if c1 < 0 then @@ -35,8 +40,11 @@ local function next_color(color,step) return step_color(new_color) end +--- Sends an rainbow message in the chat +-- @command rainbow +-- @tparam string message the message that will be printed in chat Commands.new_command('rainbow','Sends an rainbow message in the chat') -:add_param('message',false) -- action that is done by the player, just text its meaningless +:add_param('message',false) :enable_auto_concat() :register(function(player,message,raw) local player_name = player and player.name or '' diff --git a/modules/commands/ratio.lua b/modules/commands/ratio.lua new file mode 100644 index 00000000..dcdcb116 --- /dev/null +++ b/modules/commands/ratio.lua @@ -0,0 +1,85 @@ + + +local Commands = require 'expcore.commands' + + +Commands.new_command('ratio','This command will give the input and ouput ratios of the selected machine. Use the parameter for calcualting the machines needed for that amount of items per second.') + :add_param('itemsPerSecond',true,'number') + :register(function(player,itemsPerSecond,raw) + + local machine = player.selected -- selected machine + if not machine then --nil check + return Commands.error{'expcom-ratio.notSelecting'} + end + + if machine.type ~= "assembling-machine" and machine.type ~= "furnace" then + return Commands.error{'expcom-ratio.notSelecting'} + end + local recpie = machine.get_recipe() -- recpie + + if not recpie then --nil check + return Commands.error{'expcom-ratio.notSelecting'} + end + + local items = recpie.ingredients -- items in that recpie + local product = recpie.products -- output items + local amountOfMachines + local moduleInvetory = machine.get_module_inventory()--the module Invetory of the machine + local mult = Modules(moduleInvetory) --function for the productivety moduals + + if itemsPerSecond then + amountOfMachines = math.ceil( AmountOfMachines(itemsPerSecond,1/recpie.energy*machine.crafting_speed*product[1].amount*mult)) -- amount of machines + end + if not amountOfMachines then + amountOfMachines = 1 --set to 1 to make it not nil + end + ----------------------------items---------------------------- + for i, item in ipairs(items) do + local sprite -- string to make the icon work either fluid ore item + + if item.type == "item" then + sprite = 'expcom-ratio.item-in' + else + sprite = 'expcom-ratio.fluid-in' + end + + + local ips = item.amount/recpie.energy*machine.crafting_speed*amountOfMachines --math on the items/fluids per second + Commands.print {sprite,math.round(ips,3),item.name}-- full string + end + ----------------------------products---------------------------- + + for i, product in ipairs(product) do + local sprite -- string to make the icon work either fluid ore item + + if product.type == "item" then + sprite = 'expcom-ratio.item-out' + else + sprite = 'expcom-ratio.fluid-out' + end + + local output = 1/recpie.energy*machine.crafting_speed*product.amount*mult --math on the outputs per second + Commands.print {sprite,math.round(output*amountOfMachines,3),product.name} -- full string + + end + + if amountOfMachines ~= 1 then + Commands.print{'expcom-ratio.machines',amountOfMachines} + end + + end) +function Modules(moduleInvetory) -- returns the multeplier of the modules + local effect1 = moduleInvetory.get_item_count("productivity-module") -- type 1 + local effect2 = moduleInvetory.get_item_count("productivity-module-2")-- type 2 + local effect3 = moduleInvetory.get_item_count("productivity-module-3") -- type 3 + + local mult = effect1*4+effect2*6+effect3*10 + return mult/100+1 +end + +function AmountOfMachines(itemsPerSecond,output) + if(itemsPerSecond) then + return itemsPerSecond/output + + end +end diff --git a/modules/commands/repair.lua b/modules/commands/repair.lua index e1644fb8..cd7d67d6 100644 --- a/modules/commands/repair.lua +++ b/modules/commands/repair.lua @@ -1,8 +1,16 @@ -local Commands = require 'expcore.commands' -local config = require 'config.repair' +--[[-- Commands Module - Repair + - Adds a command that allows an admin to repair and revive a large area + @commands Repair +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local config = require 'config.repair' --- @dep config.repair require 'config.expcore-commands.parse_general' local max_time_to_live = 4294967295 -- unit32 max +--- Repairs entities on your force around you +-- @command repair +-- @tparam number range the range to repair stuff in, there is a max limit to this Commands.new_command('repair','Repairs entities on your force around you') :add_param('range',false,'integer-range',1,config.max_range) :register(function(player,range,raw) diff --git a/modules/commands/reports.lua b/modules/commands/reports.lua index 98fec56d..8baaf5f3 100644 --- a/modules/commands/reports.lua +++ b/modules/commands/reports.lua @@ -1,9 +1,18 @@ -local Roles = require 'expcore.roles' -local Commands = require 'expcore.commands' -local ReportsControl = require 'modules.addons.reports-control' -local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') +--[[-- Commands Module - Reports + - Adds a commands that allow players to report other players + @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 format_chat_player_name = ext_require('expcore.common','format_chat_player_name') --- @dep expcore.common require 'config.expcore-commands.parse_general' +--- Reports a player and notifies moderators +-- @command report +-- @tparam LuaPlayer player the player to report, some players are immune +-- @tparam string reason the reason the player is being reported Commands.new_command('report','Reports a player and notifies moderators') :add_param('player',false,function(input,player,reject) input = Commands.parse('player',input,player,reject) @@ -20,7 +29,7 @@ end) :register(function(player,action_player,reason,raw) local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) - if ReportsControl.report_player(action_player,reason,player.name) then + if Reports.report_player(action_player,player.name,reason) then game.print{'expcom-report.non-admin',action_player_name_color,reason} Roles.print_to_roles_higher('Trainee',{'expcom-report.admin',action_player_name_color,by_player_name_color,reason}) else @@ -28,12 +37,15 @@ end) end end) +--- Gets a list of all reports that a player has on them. If no player then lists all players and the number of reports on them. +-- @command get-reports +-- @tparam LuaPlayer player the player to get the report for Commands.new_command('get-reports','Gets a list of all reports that a player has on them. If no player then lists all players and the number of reports on them.') :add_param('player',true,'player') :add_alias('reports','list-reports') :register(function(player,action_player,raw) if action_player then - local reports = ReportsControl.get_player_reports(action_player) + local reports = Reports.get_reports(action_player) local action_player_name_color = format_chat_player_name(action_player) Commands.print{'expcom-report.player-report-title',action_player_name_color} for player_name,reason in pairs(reports) do @@ -41,26 +53,30 @@ Commands.new_command('get-reports','Gets a list of all reports that a player has Commands.print{'expcom-report.list',by_player_name_color,reason} end else - local user_reports = ReportsControl.user_reports + local user_reports = Reports.user_reports Commands.print{'expcom-report.player-count-title'} for player_name,reports in pairs(user_reports) do local player_name_color = format_chat_player_name(player_name) - local report_count = ReportsControl.count_player_reports(player_name) + local report_count = Reports.count_reports(player_name) Commands.print{'expcom-report.list',player_name_color,report_count} end end end) +--- Clears all reports from a player or just the report from one player. +-- @command clear-reports +-- @tparam LuaPlayer player the player to clear the report(s) from +-- @tparam[opt=all] LuaPlayer from-player remove only the report made by this player Commands.new_command('clear-reports','Clears all reports from a player or just the report from one player.') :add_param('player',false,'player') :add_param('from-player',true,'player') :register(function(player,action_player,from_player,raw) if from_player then - if not ReportsControl.remove_player_report(action_player,from_player.name) then + if not Reports.remove_report(action_player,from_player.name,player.name) then return Commands.error{'expcom-report.not-reported'} end else - if not ReportsControl.clear_player_reports(action_player) then + if not Reports.remove_all(action_player,player.name) then return Commands.error{'expcom-report.not-reported'} end end diff --git a/modules/commands/roles.lua b/modules/commands/roles.lua index d9d3b6d4..63575732 100644 --- a/modules/commands/roles.lua +++ b/modules/commands/roles.lua @@ -1,11 +1,20 @@ -local Commands = require 'expcore.commands' -local Roles = require 'expcore.roles' -local Colours = require 'resources.color_presets' +--[[-- Commands Module - Roles + - Adds a commands that allow interaction with the role system + @commands Roles +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local Roles = require 'expcore.roles' --- @dep expcore.roles +local Colours = require 'resources.color_presets' --- @dep resources.color_presets local format_chat_player_name, format_chat_colour_localized = ext_require('expcore.common', 'format_chat_player_name', 'format_chat_colour_localized' ) +--- Assigns a role to a player +-- @command assign-role +-- @tparam LuaPlayer player the player to assign the role to +-- @tparam string role the name of the role to assign to the player, supports auto complete after enter Commands.new_command('assign-role','Assigns a role to a player') :add_param('player',false,'player-role') :add_param('role',false,'role') @@ -20,6 +29,10 @@ Commands.new_command('assign-role','Assigns a role to a player') end end) +--- Unassigns a role from a player +-- @command unassign-role +-- @tparam LuaPlayer player the player to unassign the role from +-- @tparam string role the name of the role to unassign from the player, supports auto complete after enter Commands.new_command('unassign-role','Unassigns a role from a player') :add_param('player',false,'player-role') :add_param('role',false,'role') @@ -34,6 +47,9 @@ Commands.new_command('unassign-role','Unassigns a role from a player') end end) +--- Lists all roles in they correct order +-- @command list-roles +-- @tparam[opt=all] LuaPlayer player list only the roles which this player has Commands.new_command('list-roles','Lists all roles in they correct order') :add_param('player',true,'player') :add_alias('lsroles','roles') diff --git a/modules/commands/spawn.lua b/modules/commands/spawn.lua index cc1fe512..0e8e7df7 100644 --- a/modules/commands/spawn.lua +++ b/modules/commands/spawn.lua @@ -1,5 +1,10 @@ -local Commands = require 'expcore.commands' -local Roles = require 'expcore.roles' +--[[-- Commands Module - Spawn + - Adds a command that allows players to teleport to their spawn point + @commands Spawn +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local Roles = require 'expcore.roles' --- @dep expcore.roles local function teleport(player) local surface = player.surface @@ -11,6 +16,9 @@ local function teleport(player) return true end +--- Teleport to spawn +-- @command go-to-spawn +-- @tparam[opt=self] LuaPlayer player the player to teleport to their spawn point Commands.new_command('go-to-spawn','Teleport to spawn') :add_param('player',true,'player-role-alive') :set_defaults{ diff --git a/modules/commands/tag.lua b/modules/commands/tag.lua index 0c5e5cf4..e8c51e9b 100644 --- a/modules/commands/tag.lua +++ b/modules/commands/tag.lua @@ -1,17 +1,28 @@ -local Commands = require 'expcore.commands' -local Roles = require 'expcore.roles' +--[[-- Commands Module - Tag + - Adds a command that allows players to have a custom tag after their name + @commands Tag +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local Roles = require 'expcore.roles' --- @dep expcore.roles require 'config.expcore-commands.parse_general' require 'config.expcore-commands.parse_roles' +--- Sets your player tag. +-- @command tag +-- @tparam string tag the tag that will be after the name, there is a max length Commands.new_command('tag','Sets your player tag.') -:add_param('tag',false,'string-max-length',20) -- new tag for your player max 20 char +:add_param('tag',false,'string-max-length',20) :enable_auto_concat() :register(function(player,tag,raw) player.tag = '- '..tag end) +--- Clears your tag. Or another player if you are admin. +-- @command tag-clear +-- @tparam[opt=self] LuaPlayer player the player to remove the tag from, nil will apply to self Commands.new_command('tag-clear','Clears your tag. Or another player if you are admin.') -:add_param('player',true,'player-role') -- player to remove the tag of, nil to apply to self +:add_param('player',true,'player-role') :set_defaults{player=function(player) return player -- default is the user using the command end} diff --git a/modules/commands/teleport.lua b/modules/commands/teleport.lua index 0f456c9e..2117f18d 100644 --- a/modules/commands/teleport.lua +++ b/modules/commands/teleport.lua @@ -1,4 +1,9 @@ -local Commands = require 'expcore.commands' +--[[-- Commands Module - Teleport + - Adds a command that allows players to teleport to other players + @commands Teleport +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands require 'config.expcore-commands.parse_general' local function teleport(from_player,to_player) @@ -10,9 +15,13 @@ local function teleport(from_player,to_player) return true end +--- Teleports a player to another player. +-- @command teleport +-- @tparam LuaPlayer from_player the player that will be teleported, must be alive +-- @tparam LuaPlayer to_player the player to teleport to, must be online (if dead goes to where they died) Commands.new_command('teleport','Teleports a player to another player.') -:add_param('from_player',false,'player-alive') -- player that will be teleported, must be alive -:add_param('to_player',false,'player-online') -- player to teleport to, must be online (if dead goes to where they died) +:add_param('from_player',false,'player-alive') +:add_param('to_player',false,'player-online') :add_alias('tp') :set_flag('admin_only',true) :register(function(player,from_player,to_player,raw) @@ -26,8 +35,11 @@ Commands.new_command('teleport','Teleports a player to another player.') end end) +--- Teleports a player to you. +-- @command bring +-- @tparam LuaPlayer player the player that will be teleported, must be alive Commands.new_command('bring','Teleports a player to you.') -:add_param('player',false,'player-alive') -- player that will be teleported, must be alive +:add_param('player',false,'player-alive') :set_flag('admin_only',true) :register(function(player,from_player,raw) if from_player.index == player.index then @@ -40,8 +52,11 @@ Commands.new_command('bring','Teleports a player to you.') end end) +--- Teleports you to a player. +-- @command goto +-- @tparam LuaPlayer player the player to teleport to, must be online (if dead goes to where they died) Commands.new_command('goto','Teleports you to a player.') -:add_param('player',false,'player-online') -- player to teleport to, must be online (if dead goes to where they died) +:add_param('player',false,'player-online') :add_alias('tp-me','tpme') :set_flag('admin_only',true) :register(function(player,to_player,raw) diff --git a/modules/commands/warnings.lua b/modules/commands/warnings.lua index 1a86e4bd..2cd5509c 100644 --- a/modules/commands/warnings.lua +++ b/modules/commands/warnings.lua @@ -1,38 +1,50 @@ -local Commands = require 'expcore.commands' -local WarningsControl = require 'modules.addons.warnings-control' -local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') -local config = require 'config.warnings' +--[[-- Commands Module - Warnings + - Adds a commands that allow admins to warn other players + @commands Warnings +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local Warnings = require 'modules.control.warnings' --- @dep modules.control.warnings +local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') --- @dep expcore.common +local config = require 'config.warnings' --- @dep config.warnings require 'config.expcore-commands.parse_roles' +--- Gives a warning to a player; may lead to automatic script action. +-- @command give-warning +-- @tparam LuaPlayer player the player the will recive a warning +-- @tparam string reason the reason the player is being given a warning Commands.new_command('give-warning','Gives a warning to a player; may lead to automatic script action.') :add_param('player',false,'player-role') :add_param('reason',false) :add_alias('warn') :enable_auto_concat() :register(function(player,action_player,reason,raw) - WarningsControl.add_warnings(action_player,player.name) + Warnings.add_warning(action_player,player.name,reason) local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) game.print{'expcom-warnings.received',action_player_name_color,by_player_name_color,reason} end) +--- Gets the number of warnings a player has. If no player then lists all players and the number of warnings they have. +-- @command get-warnings +-- @tparam[opt=list] LuaPlayer player the player to get the warning for, if nil all players are listed Commands.new_command('get-warnings','Gets the number of warnings a player has. If no player then lists all players and the number of warnings they have.') :add_param('player',true,'player') :add_alias('warnings','list-warnings') :register(function(player,action_player,raw) if action_player then - local warnings = WarningsControl.get_warnings(action_player) - local script_warnings = WarningsControl.get_temp_warnings(action_player) + local warnings = Warnings.get_warnings(action_player) + local script_warnings = Warnings.get_script_warnings(action_player) local action_player_name_color = format_chat_player_name(action_player) Commands.print{'expcom-warnings.player',action_player_name_color,warnings,script_warnings,config.temp_warning_limit} else local rtn = {} - local user_warnings = WarningsControl.user_warnings - local user_temp_warnings = WarningsControl.user_temp_warnings + local user_warnings = Warnings.user_warnings + local user_script_warnings = Warnings.user_script_warnings for player_name,warnings in pairs(user_warnings) do rtn[player_name] = {#warnings,0} end - for player_name,warnings in pairs(user_temp_warnings) do + for player_name,warnings in pairs(user_script_warnings) do if not rtn[player_name] then rtn[player_name] = {0,0} end @@ -46,11 +58,14 @@ Commands.new_command('get-warnings','Gets the number of warnings a player has. I end end) +--- Clears all warnings (and script warnings) from a player +-- @command clear-warnings +-- @tparam LuaPlayer player the player to clear the warnings from Commands.new_command('clear-warnings','Clears all warnings (and script warnings) from a player') :add_param('player',false,'player') :register(function(player,action_player,raw) - WarningsControl.clear_warnings(action_player,player.name) - WarningsControl.clear_temp_warnings(action_player,player.name) + Warnings.clear_warnings(action_player,player.name) + Warnings.clear_script_warnings(action_player,player.name) local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) game.print{'expcom-warnings.cleared',action_player_name_color,by_player_name_color} diff --git a/modules/control/jail.lua b/modules/control/jail.lua new file mode 100644 index 00000000..89c9043c --- /dev/null +++ b/modules/control/jail.lua @@ -0,0 +1,214 @@ +--[[-- Control Module - Jail + - Adds a way to jail players and temp ban players. + @control Jail + @alias Jail + + @usage + -- import the module from the control modules + local Jail = require '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 + Jail.jail_player('MrBiter','Cooldude2606','Likes biters too much') + + -- This will give 'MrBiter' all his roles back and remove him from jail + -- again as above the player name is only used in the event for user feedback + Jail.unjail_player('MrBiter','Cooldude2606') + + -- Temp ban works the same as jail but will store the reason and move the players items to spawn + -- this is meant to be used as a more permiment jail but not as strong as a ban + Jail.temp_ban_player('MrBiter','Cooldude2606','Likes biters too much') +]] + +local Roles = require 'expcore.roles' --- @dep expcore.roles +local Game = require 'utils.game' --- @dep utils.game +local Global = require 'utils.global' --- @dep utils.global +local move_items = ext_require('expcore.common','move_items') --- @dep expcore.common + +local valid_player = Game.get_player_from_any +local assign_roles = Roles.assign_player +local unassign_roles = Roles.unassign_player +local has_role = Roles.player_has_role +local get_roles = Roles.get_player_roles + +local Jail = { + old_roles = {}, + temp_bans = {}, + events = { + --- When a player is assigned to jail + -- @event on_player_jailed + -- @tparam number player_index the index of the player who was jailed + -- @tparam string by_player_name the name of the player who jailed the other player + -- @tparam string reason the reason that the player was jailed + on_player_jailed=script.generate_event_name(), + --- When a player is unassigned from jail + -- @event on_player_unjailed + -- @tparam number player_index the index of the player who was unjailed + -- @tparam string by_player_name the name of the player who unjailed the other player + on_player_unjailed=script.generate_event_name(), + --- When a player is temp banned + -- @event on_player_temp_banned + -- @tparam number player_index the index of the player who was temp banned + -- @tparam string by_player_name the name of the player who temp banned the other player + -- @tparam string reason the reason that the player was temp banned + on_player_temp_banned=script.generate_event_name(), + --- When a temp ban is removed from a player + -- @event on_player_untemp_banned + -- @tparam number player_index the index of the player who was untemp banned + -- @tparam string by_player_name the name of the player who untemp banned the other player + on_player_untemp_banned=script.generate_event_name() + } +} + +local old_roles = Jail.old_roles +local temp_bans = Jail.temp_bans +Global.register({ + old_roles = old_roles, + temp_bans = temp_bans +},function(tbl) + Jail.old_roles = tbl.old_roles + Jail.temp_bans = tbl.temp_bans + old_roles = Jail.old_roles + temp_bans = Jail.temp_bans +end) + +--- Used to emit the jail related events +-- @tparam number event the name of the event that will be emited +-- @tparam LuaPlayer player the player who is being acted on +-- @tparam string by_player_name the player who is doing the action +-- @tparam string reason the reason for the action (jail and tempban only) +local function event_emit(event,player,by_player_name,reason) + script.raise_event(event,{ + name=event, + tick=game.tick, + player_index=player.index, + by_player_name=by_player_name, + reason=reason + }) +end + +--- Jail. +-- Functions related to jail +-- @section jail-functions + +--- Checks if the player is currently in jail +-- @tparam LuaPlayer player the player to check if they are in jail +-- @treturn boolean whether the player is currently in jail +function Jail.is_jailed(player) + return has_role(player,'Jail') +end + +--- Moves a player to jail and removes all other roles +-- @tparam LuaPlayer player the player who will be jailed +-- @tparam string by_player_name the name of the player who is doing the jailing +-- @tparam[opt='Non given.'] string reason the reason that the player is being jailed +-- @treturn boolean wheather the user was jailed successfully +function Jail.jail_player(player,by_player_name,reason) + player = valid_player(player) + if not player then return end + if not by_player_name then return end + + reason = reason or 'Non given.' + + if has_role(player,'Jail') then return end + local roles = get_roles(player) + old_roles[player.name] = roles + + assign_roles(player,'Jail',by_player_name,true) + unassign_roles(player,old_roles,by_player_name,true) + + event_emit(Jail.events.on_player_jailed,player,by_player_name,reason) + + return true +end + +--- Moves a player out of jail and restores all roles previously removed +-- @tparam LuaPlayer player the player that will be unjailed +-- @tparam string by_player_name the name of the player that is doing the unjail +-- @treturn boolean whether the player was unjailed successfully +function Jail.unjail_player(player,by_player_name) + player = valid_player(player) + if not player then return end + if not by_player_name then return end + + if not has_role(player,'Jail') then return end + local roles = old_roles[player.name] or {} + + assign_roles(player,roles,by_player_name,true) + unassign_roles(player,'Jail',by_player_name,true) + + event_emit(Jail.events.on_player_unjailed,player,by_player_name) + + return true +end + +--- Temp ban. +-- Functions related to temp ban +-- @section temp-ban-functions + +--- Checks if a player is temp banned +-- @tparam LuaPlayer player the player to check if they are temp banned +-- @treturn boolean whether the player is temp banned +function Jail.is_temp_banned(player) + player = valid_player(player) + if not player then return end + return temp_bans[player.name] ~= nil +end + +--- Temp bans a player by moving them to jail, clearing all other roles, storing the reason, and moving their items to spawn +-- @tparam LuaPlayer player the player that will be temp banned +-- @tparam string by_player_name the name of the player who is doing the temp ban +-- @tparam[opt='Non given.'] string reason the reason that the player is being temp banned +-- @treturn boolean whether the player was successfully temp banned +function Jail.temp_ban_player(player,by_player_name,reason) + player = valid_player(player) + if not player then return end + if not by_player_name then return end + + reason = reason or 'Non given.' + + if temp_bans[player.name] then return end + temp_bans[player.name] = {reason,by_player_name} + + if not has_role(player,'Jail') then + local roles = get_roles(player) + old_roles[player.name] = roles + + assign_roles(player,'Jail',by_player_name,true) + unassign_roles(player,roles,by_player_name,true) + end + + local inv = player.get_main_inventory() + move_items(inv.get_contents()) + inv.clear() + + event_emit(Jail.events.on_player_temp_banned,player,by_player_name,reason) + + return true +end + +--- Rrmoves a player from temp ban by clearing the stored reason, removing them from jail, and restoring previous roles +-- @tparam LuaPlayer player the player who is being removed from temp ban +-- @tparam string by_player_name the name of the player who is doing the untemp ban +-- @treturn boolean whether the player was successfully removed +function Jail.untemp_ban_player(player,by_player_name) + player = valid_player(player) + if not player then return end + if not by_player_name then return end + + if not temp_bans[player.name] then return end + temp_bans[player.name] = nil + + if has_role(player,'Jail') then + local roles = old_roles[player.name] + + assign_roles(player,roles,by_player_name,true) + unassign_roles(player,'Jail',by_player_name,true) + end + + event_emit(Jail.events.on_player_untemp_banned,player,by_player_name) + + return true +end + +return Jail \ No newline at end of file diff --git a/modules/control/production.lua b/modules/control/production.lua new file mode 100644 index 00000000..d12c8477 --- /dev/null +++ b/modules/control/production.lua @@ -0,0 +1,233 @@ +--[[-- Control Module - Production + - Common functions used to track production of items + @control Production + @alias Production + + @usage + -- import the module from the control modules + local Production = require '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 + -- the other precision work like wise + Production.precision_up(defines.flow_precision_index.one_second) + + -- The get production function is used to get production, consumion and net + -- it may be used for any item and with any precision level, use total for total + Production.get_production(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute) + + -- The fluctuations works by compearing recent production with the average over time + -- again any precision may be used, apart from one_thousand_hours as there would be no valid average + Production.get_fluctuations(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute) + + -- ETA is calculated based on what function you use but all share a similar method + -- for production eta it will take current production average given by the precision + -- and work out how many ticks it will require to make the required amount (1000 by default) + Production.get_production_eta(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute,250000) + + -- Both get_color and format_number are helper functions to help format production stats + -- get_color will return green,orange,red,or grey based on the active_value + -- the passive_value is used when active_value is 0 and can only return orange,red,or grey + Production.get_color(clamp,active_value,passive_value) + +]] + +local Colors = require 'resources.color_presets' --- @dep resources.color_presets +local format_number = ext_require('util','format_number') --- @dep util + +local precision_index = defines.flow_precision_index +local Production = {} + +--- Precision. +-- Functions which are used to do basic things +-- @section precision + +--- Gets the next lesser precision index value, eg 1 second -> 1 minute +-- @tparam defines.flow_precision_index precision +-- @treturn[1] defines.flow_precision_index the next precision value +-- @treturn[1] number the multiplicive difference between the values +function Production.precision_up(precision) + if precision == precision_index.one_second then return precision_index.one_minute,60 + elseif precision == precision_index.one_minute then return precision_index.ten_minutes,10 + elseif precision == precision_index.ten_minutes then return precision_index.one_hour,6 + elseif precision == precision_index.one_hour then return precision_index.ten_hours,10 + elseif precision == precision_index.ten_hours then return precision_index.fifty_hours,5 + elseif precision == precision_index.fifty_hours then return precision_index.two_hundred_fifty_hours,5 + elseif precision == precision_index.two_hundred_fifty_hours then return precision_index.one_thousand_hours,4 + end +end + +--- Gets the next greater precision index value, eg 1 minute -> 1 second +-- @tparam defines.flow_precision_index precision +-- @treturn[1] defines.flow_precision_index the next precision value +-- @treturn[1] number the multiplicive difference between the values +function Production.precision_down(precision) + if precision == precision_index.one_minute then return precision_index.one_second,60 + elseif precision == precision_index.ten_minutes then return precision_index.one_minute,10 + elseif precision == precision_index.one_hour then return precision_index.ten_minutes,6 + elseif precision == precision_index.ten_hours then return precision_index.one_hour,10 + elseif precision == precision_index.fifty_hours then return precision_index.ten_hours,5 + elseif precision == precision_index.two_hundred_fifty_hours then return precision_index.fifty_hours,5 + elseif precision == precision_index.one_thousand_hours then return precision_index.two_hundred_fifty_hours,4 + end +end + +--- Gets the number of tick that precision is given over, eg 1 minute -> 60 ticks +-- @tparam defines.flow_precision_index precision +-- @treturn number the number of ticks in this time +function Production.precision_ticks(precision) + if precision == precision_index.one_second then return 60 + elseif precision == precision_index.one_minute then return 3600 + elseif precision == precision_index.ten_minutes then return 36000 + elseif precision == precision_index.one_hour then return 216000 + elseif precision == precision_index.ten_hours then return 2160000 + elseif precision == precision_index.fifty_hours then return 10800000 + elseif precision == precision_index.two_hundred_fifty_hours then return 54000000 + elseif precision == precision_index.one_thousand_hours then return 216000000 + end +end + +--- Statistics. +-- Functions used to get information about production +-- @section stats + +--- Returns the production data for the whole game time +-- @tparam LuaForce force the force to get the data for +-- @tparam string item_name the name of the item that you want the data about +-- @treturn table contains total made, used and net +function Production.get_production_total(force,item_name) + local stats = force.item_production_statistics + local made = stats.get_input_count(item_name) or 0 + local used = stats.get_output_count(item_name) or 0 + + return { + made=made, + used=used, + net=made-used + } + +end + +--- Returns the production data for the given precision game time +-- @tparam LuaForce force the force to get the data for +-- @tparam string item_name the name of the item that you want the data about +-- @tparam defines.flow_precision_index precision the precision that you want the data given to +-- @treturn table contains made, used and net +function Production.get_production(force,item_name,precision) + local stats = force.item_production_statistics.get_flow_count + local made = stats{name=item_name,input=true,precision_index=precision} or 0 + local used = stats{name=item_name,input=false,precision_index=precision} or 0 + + return { + made=made, + used=used, + net=made-used + } + +end + +--- Returns the current fluctuation from the average +-- @tparam LuaForce force the force to get the data for +-- @tparam string item_name the name of the item that you want the data about +-- @tparam defines.flow_precision_index precision the precision that you want the data given to +-- @treturn table contains made, used and net +function Production.get_fluctuations(force,item_name,precision) + local percision_up = Production.precision_up(precision) + local current = Production.get_production(force,item_name,precision) + local previous = Production.get_production(force,item_name,percision_up) + + return { + made=(current.made/previous.made)-1, + used=(current.used/previous.used)-1, + net=(current.net/previous.net)-1, + } + +end + +--- Returns the amount of ticks required to produce a certain amount +-- @tparam LuaForce force the force to get the data for +-- @tparam string item_name the name of the item that you want the data about +-- @tparam defines.flow_precision_index precision the precision that you want the data given to +-- @tparam[opt=1000] number required the number of items that are required to be made +-- @treturn number the number of ticks required to produce this ammount of items +function Production.get_production_eta(force,item_name,precision,required) + required = required or 1000 + local ticks = Production.precision_ticks(precision) + local production = Production.get_production(force,item_name,precision) + return production.made == 0 and -1 or ticks*required/production.made +end + +--- Returns the amount of ticks required to consume a certain amount +-- @tparam LuaForce force the force to get the data for +-- @tparam string item_name the name of the item that you want the data about +-- @tparam defines.flow_precision_index precision the precision that you want the data given to +-- @tparam[opt=1000] number required the number of items that are required to be consumed +-- @treturn number the number of ticks required to consume this ammount of items +function Production.get_consumsion_eta(force,item_name,precision,required) + required = required or 1000 + local ticks = Production.precision_ticks(precision) + local production = Production.get_production(force,item_name,precision) + return production.used == 0 and -1 or ticks*required/production.used +end + +--- Returns the amount of ticks required to produce but not consume a certain amount +-- @tparam LuaForce force the force to get the data for +-- @tparam string item_name the name of the item that you want the data about +-- @tparam defines.flow_precision_index precision the precision that you want the data given to +-- @tparam[opt=1000] number required the number of items that are required to be made but not used +-- @treturn number the number of ticks required to produce, but not use, this ammount of items +function Production.get_net_eta(force,item_name,precision,required) + required = required or 1000 + local ticks = Production.precision_ticks(precision) + local production = Production.get_production(force,item_name,precision) + return production.net == 0 and -1 or ticks*required/production.net +end + +--- Formating. +-- Functions used to format production values +-- @section formating + +--- Returns a color value bassed on the value that was given +-- @tparam number clamp value which seperates the different colours +-- @tparam number active_value first value tested, tested against clamp +-- @tparam number passive_value second value tested, tested against 0 +-- @treturn table contains r,g,b keys +function Production.get_color(clamp,active_value,passive_value) + if active_value > clamp then + return Colors.light_green + elseif active_value < -clamp then + return Colors.indian_red + elseif active_value ~= 0 then + return Colors.orange + elseif passive_value and passive_value > 0 then + return Colors.orange + elseif passive_value and passive_value ~= 0 then + return Colors.indian_red + else + return Colors.grey + end +end + +--- Returns three parts used to format a number +-- @tparam number value the value to format +-- @treturn[1] string the sign for the number +-- @treturn[1] string the surfix for any unit used +function Production.format_number(value) + local rtn = format_number(math.round(value,1),true) + local surfix = rtn:sub(-1) + + if value > 0 then + rtn = '+'..rtn + elseif value == 0 and rtn:sub(1,1) == '-' then + rtn = rtn:sub(2) + end + + if not tonumber(surfix) then + return surfix,rtn:sub(1,-2) + else + return '',rtn + end + +end + +return Production \ No newline at end of file diff --git a/modules/control/reports.lua b/modules/control/reports.lua new file mode 100644 index 00000000..d5d5cf1b --- /dev/null +++ b/modules/control/reports.lua @@ -0,0 +1,218 @@ +--[[-- Control Module - Reports + - Adds a way to report players and store report messages. + @control Reports + @alias Reports + + @usage + -- import the module from the control modules + local Reports = require '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 + -- seen by using Reports.get_report. + Reports.report_player('MrBiter','Cooldude2606','Liking biters too much') -- true + + -- The other get methods can be used to get all the reports on a player or to test if a player is reported. + Reports.get_report('MrBiter','Cooldude2606') -- 'Liking biters too much' + + -- This will remove the warning on 'MrBiter' (must be a valid player) which was made by 'Cooldude2606'. + Reports.remove_report('MrBiter','Cooldude2606') -- true + + -- This will remove all the report that have been made against 'MrBiter'. Note that the remove event will + -- be triggered once per report issused. + Reports.remove_all('MrBiter') -- true + +]] + +local Game = require 'utils.game' --- @dep utils.game +local Global = require 'utils.global' --- @dep utils.global + +local valid_player = Game.get_player_from_any + +local Reports = { + user_reports={}, -- stores all user reports, global table + events = { + --- When a player is reported + -- @event on_player_reported + -- @tparam number player_index the player index of the player who got reported + -- @tparam string by_player_name the name of the player who made the report + -- @tparam string reason the reason given for the report + on_player_reported = script.generate_event_name(), + --- When a report is removed from a player + -- @event on_report_removed + -- @tparam number player_index the player index of the player who has the report removed + -- @tparam string reported_by_name the name of the player who made the removed report + -- @tparam string removed_by_name the name of the player who removed the report + on_report_removed = script.generate_event_name() + } +} + +local user_reports = Reports.user_reports +Global.register(user_reports,function(tbl) + Reports.user_reports = tbl + user_reports = Reports.user_reports +end) + +--- Getters. +-- Functions used to get information from reports +-- @section get-functions + +--- Gets a list of all reports that a player has against them +-- @tparam LuaPlayer player the player to get the report for +-- @treturn table a list of all reports, key is by player name, value is reason +function Reports.get_reports(player) + player = valid_player(player) + if not player then return end + + return user_reports[player.name] or {} +end + +--- Gets a single report against a player given the name of the player who made the report +-- @tparam LuaPlayer player the player to get the report for +-- @tparam string by_player_name the name of the player who made the report +-- @treturn ?string|nil string is the reason that the player was reported, if the player is not reported +function Reports.get_report(player,by_player_name) + player = valid_player(player) + if not player then return end + if not by_player_name then return end + + local reports = user_reports[player.name] + return reports and reports[by_player_name] +end + +--- Checks if a player is reported, option to get if reported by a certain player +-- @tparam LuaPlayer player the player to check if reported +-- @tparam[opt] string by_player_name when given will check if reported by this player +-- @treturn boolean if the player has been reported +function Reports.is_reported(player,by_player_name) + player = valid_player(player) + if not player then return end + + local reports = user_reports[player.name] or {} + if by_player_name then + return reports[by_player_name] ~= nil + else + return table_size(reports) > 0 + end +end + +--- Counts the number of reports that a player has aganist them +-- @tparam LuaPlayer player the player to count the reports for +-- @tparam[opt] function custom_count when given this function will be used to count the reports +-- @treturn number the number of reports that the user has +function Reports.count_reports(player,custom_count) + player = valid_player(player) + if not player then return end + + local reports = user_reports[player.name] or {} + if custom_count then + local ctn = 0 + for by_player_name,reason in pairs(reports) do + ctn = ctn + custom_count(player,by_player_name,reason) + end + return ctn + else + return table_size(reports) + end +end + +--- Setters. +-- Functions used to get information from reports +-- @section set-functions + +--- Adds a report to a player, each player can only report another player once +-- @tparam LuaPlayer player the player to add the report to +-- @tparam string by_player_name the name of the player that is making the report +-- @tparam[opt='Non given.'] string reason the reason that the player is being reported +-- @treturn boolean whether the report was added successfully +function Reports.report_player(player,by_player_name,reason) + player = valid_player(player) + if not player then return end + local player_name = player.name + + reason = reason or 'Non given.' + + local reports = user_reports[player_name] + if not reports then + reports = {} + user_reports[player_name] = reports + end + + if reports[by_player_name] then + return false + else + reports[by_player_name] = reason + end + + script.raise_event(Reports.events.on_player_reported,{ + name = Reports.events.on_player_reported, + tick = game.tick, + player_index = player.index, + by_player_name = by_player_name, + reason = reason + }) + + return true +end + +--- Used to emit the report removed event, own function due to repeated use in Report.remove_all +-- @tparam LuaPlayer player the player who is having the report removed from them +-- @tparam string reported_by_name the player who had the report +-- @tparam string removed_by_name the player who is clearing the report +local function report_removed_event(player,reported_by_name,removed_by_name) + script.raise_event(Reports.events.on_report_removed,{ + name = Reports.events.on_report_removed, + tick = game.tick, + player_index = player.index, + reported_by_name = reported_by_name, + removed_by_name = removed_by_name + }) +end + +--- Removes a report from a player +-- @tparam LuaPlayer player the player to remove the report from +-- @tparam string reported_by_name the name of the player that made the report +-- @tparam string removed_by_name the name of the player who removed the report +-- @treturn boolean whether the report was removed successfully +function Reports.remove_report(player,reported_by_name,removed_by_name) + player = valid_player(player) + if not player then return end + + local reports = user_reports[player.name] + if not reports then + return false + end + + local reason = reports[reported_by_name] + if not reason then + return false + end + + report_removed_event(player,reported_by_name,removed_by_name) + + reports[reported_by_name] = nil + return true +end + +--- Removes all reports from a player +-- @tparam LuaPlayer player the player to remove the reports from +-- @tparam string removed_by_name the name of the player who removed the report +-- @treturn boolean whether the reports were removed successfully +function Reports.remove_all(player,removed_by_name) + player = valid_player(player) + if not player then return end + + local reports = user_reports[player.name] + if not reports then + return false + end + + for reported_by_name,_ in pairs(reports) do + report_removed_event(player,reported_by_name,removed_by_name) + end + + user_reports[player.name] = nil + return true +end + +return Reports \ No newline at end of file diff --git a/modules/control/rockets.lua b/modules/control/rockets.lua new file mode 100644 index 00000000..63e4928e --- /dev/null +++ b/modules/control/rockets.lua @@ -0,0 +1,216 @@ +--[[-- Control Module - Rockets + - Stores rocket stats for each force. + @control Rockets + @alias Rockets + + @usage + -- import the module from the control modules + local Rockets = require '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 + Rockets.get_silo_data(rocket_silo_entity) + + -- Some information is also stored for each force + Rockets.get_stats('player') + + -- You can get the rocket data for all silos for a force by using get_silos + Rockets.get_silos('player') + + -- You can get the launch time for a rocket, meaning what game tick the 50th rocket was launched + Rockets.get_rocket_time('player',50) + + -- The rolling average will work out the time to launch one rocket based on the last X rockets + Rockets.get_rolling_average('player',10) + +]] + +local Event = require 'utils.event' --- @dep utils.event +local Global = require 'utils.global' --- @dep utils.global +local config = require 'config.rockets' --- @dep config.rockets + +local largest_rolling_avg = 0 +for _,avg_over in pairs(config.stats.rolling_avg) do + if avg_over > largest_rolling_avg then + largest_rolling_avg = avg_over + end +end + +local Rockets = { + times = {}, + stats = {}, + silos = {} +} + +local rocket_times = Rockets.times +local rocket_stats = Rockets.stats +local rocket_silos = Rockets.silos +Global.register({ + rocket_times = rocket_times, + rocket_stats = rocket_stats, + rocket_silos = rocket_silos +},function(tbl) + Rockets.times = tbl.rocket_times + Rockets.stats = tbl.rocket_stats + Rockets.silos = tbl.rocket_silos + rocket_times = Rockets.times + rocket_stats = Rockets.stats + rocket_silos = Rockets.silos +end) + +--- Gets the silo data for a given silo entity +-- @tparam LuaEntity silo the rocket silo entity +-- @treturn table the data table for this silo, contains rockets launch, silo status, and its force +function Rockets.get_silo_data(silo) + local position = silo.position + local silo_name = math.floor(position.x)..':'..math.floor(position.y) + return rocket_silos[silo_name] +end + +--- Gets the silo data for a given silo entity +-- @tparam string silo_name the silo name that is stored in its data +-- @treturn table the data table for this silo, contains rockets launch, silo status, and its force +function Rockets.get_silo_data_by_name(silo_name) + return rocket_silos[silo_name] +end + +--- Gets the silo entity from its silo name, reverse to get_silo_data +-- @tparam string silo_name the silo name that is stored in its data +-- @treturn LuaEntity the rocket silo entity +function Rockets.get_silo_entity(silo_name) + local data = rocket_silos[silo_name] + return data.entity +end + +--- Gets the rocket stats for a force +-- @tparam string force_name the name of the force to get the stats for +-- @treturn table the table of stats for the force +function Rockets.get_stats(force_name) + return rocket_stats[force_name] or {} +end + +--- Gets all the rocket silos that belong to a force +-- @tparam string force_name the name of the force to get the silos for +-- @treturn table an array of silo data that all belong to this force +function Rockets.get_silos(force_name) + local rtn = {} + for _,silo_data in pairs(rocket_silos) do + if silo_data.force == force_name then + table.insert(rtn,silo_data) + end + end + return rtn +end + +--- Gets the launch time of a given rocket, due to cleaning not all counts are valid +-- @tparam string force_name the name of the force to get the count for +-- @tparam number rocket_number the number of the rocket to get the launch time for +-- @treturn number the game tick that the rocket was lanuched on +function Rockets.get_rocket_time(force_name,rocket_number) + return rocket_times[force_name] and rocket_times[force_name][rocket_number] or nil +end + +--- Gets the number of rockets that a force has launched +-- @tparam string force_name the name of the force to get the count for +-- @treturn number the number of rockets that the force has launched +function Rockets.get_rocket_count(force_name) + local force = game.forces[force_name] + return force.rockets_launched +end + +--- Gets the total number of rockets launched by all forces +-- @treturn number the total number of rockets launched this game +function Rockets.get_game_rocket_count() + local rtn = 0 + for _,force in pairs(game.forces) do + rtn = rtn + force.rockets_launched + end + return rtn +end + +--- Gets the rolling average time to launch a rocket +-- @tparam string force_name the name of the force to get the average for +-- @tparam number count the distance to get the rolling average over +-- @treturn number the number of ticks required to launch one rocket +function Rockets.get_rolling_average(force_name,count) + local force = game.forces[force_name] + local rocket_count = force.rockets_launched + local start_rocket_time = 0 + if count < rocket_count then + start_rocket_time = rocket_times[force_name][rocket_count-count+1] + rocket_count = count + end + return rocket_count > 0 and math.floor((game.tick-start_rocket_time)/rocket_count) or 0 +end + +--- Event used to update the stats and the hui when a rocket is launched +Event.add(defines.events.on_rocket_launched,function(event) + local entity = event.rocket_silo + local silo_data = Rockets.get_silo_data(entity) + local force = event.rocket_silo.force + local force_name = force.name + local rockets_launched = force.rockets_launched + + --- Handles updates to the rocket stats + local stats = rocket_stats[force_name] + if not stats then + rocket_stats[force_name] = {} + stats = rocket_stats[force_name] + end + + if rockets_launched == 1 then + stats.first_launch = event.tick + stats.fastest_launch = event.tick + elseif event.tick-stats.last_launch < stats.fastest_launch then + stats.fastest_launch = event.tick-stats.last_launch + end + + stats.last_launch = event.tick + + --- Appends the new rocket into the array + if not rocket_times[force_name] then + rocket_times[force_name] = {} + end + + rocket_times[force_name][rockets_launched] = event.tick + + local remove_rocket = rockets_launched-largest_rolling_avg + if remove_rocket > 0 and not table.contains(config.milestones,remove_rocket) then + rocket_times[force_name][remove_rocket] = nil + end + + --- Adds this 1 to the launch count for this silo + silo_data.launched = silo_data.launched+1 +end) + +--- When a launch is reiggered it will await reset +Event.add(defines.events.on_rocket_launch_ordered,function(event) + local entity = event.rocket_silo + local silo_data = Rockets.get_silo_data(entity) + silo_data.awaiting_reset = true +end) + +--- Adds a silo to the list when it is built +local function on_built(event) + local entity = event.created_entity + if entity.valid and entity.name == 'rocket-silo' then + local force = entity.force + local force_name = force.name + local position = entity.position + local silo_name = math.floor(position.x)..':'..math.floor(position.y) + + rocket_silos[silo_name] = { + name=silo_name, + force=force_name, + entity=entity, + launched=0, + awaiting_reset=false, + built=game.tick + } + end +end + +Event.add(defines.events.on_built_entity,on_built) +Event.add(defines.events.on_robot_built_entity,on_built) + +return Rockets \ No newline at end of file diff --git a/modules/control/tasks.lua b/modules/control/tasks.lua new file mode 100644 index 00000000..6b2d9630 --- /dev/null +++ b/modules/control/tasks.lua @@ -0,0 +1,184 @@ +--[[-- Control Module - Tasks +- Stores tasks for each force. +@control Tasks +@alias Tasks + +@usage-- Making and then editing a new task +local task_id = Tasks.add_task(game.player.force.name,nil,game.player.name) + +Tasks.update_task(task_id,'We need more iron!',game.player.name) + +]] + +local Store = require 'expcore.store' --- @dep expcore.store +local Global = require 'utils.global' --- @dep utils.global +local Token = require 'utils.token' --- @dep utils.token + +local Tasks = {} + +-- Global lookup table for force name to task ids +local force_tasks = {} +Global.register(force_tasks,function(tbl) + force_tasks = tbl +end) + +-- Task store is keyed by task id, value is a table +local task_store = Store.register() +Tasks.store = task_store + +--- Setters. +-- functions used to created and alter tasks +-- @section setters + +--[[-- Add a new task for a force, the task can be placed into a certain position for that force +@tparam string force_name the name of the force to add the task for +@tparam[opt] number task_number the order place to add the task to, appends to end if omited +@tparam[opt] string player_name the player who added this task, will cause them to be listed under editing +@tparam[opt] string task_message the message that is used for this task, if not given default is used +@treturn string the uid of the task which was created + +@usage-- Adding a new task for your force +local task_id = Tasks.add_task(game.player.force.name,nil,game.player.name) + +]] +function Tasks.add_task(force_name,task_number,player_name,task_message) + -- Get a new task id + local task_id = tostring(Token.uid()) + task_message = task_message or 'New Task' + + -- Get the existing tasks for this force + local tasks = force_tasks[force_name] + if not tasks then + force_tasks[force_name] = {} + tasks = force_tasks[force_name] + end + + -- Insert the task id into the forces tasks + if task_number then + table.insert(tasks,task_number,task_id) + else + table.insert(tasks,task_id) + end + + -- Create the editing table + local editing = {} + if player_name then + editing[player_name] = true + end + + -- Add the new task to the store + Store.set(task_store,task_id,{ + task_id = task_id, + force_name = force_name, + message = task_message, + last_edit_name = player_name or '', + last_edit_time = game.tick, + curently_editing = editing + }) + + return task_id +end + +--[[-- Removes a task and any data that is linked with it +@tparam string task_id the uid of the task which you want to remove + +@usage-- Removing a task +Tasks.remove_task(task_id) + +]] +function Tasks.remove_task(task_id) + local task = Store.get(task_store,task_id) + local force_name = task.force_name + Store.clear(task_store,task_id) + table.remove_element(force_tasks[force_name],task_id) +end + +--[[-- Update the message and last edited information for a task +@tparam string task_id the uid of the task that you want to update +@tparam string new_message the message that you want to have for the task +@tparam[opt='server'] string player_name the name of the player who made the edit + +@usage-- Updating the message for on a task +Task.update_task(task_id,'We need more iron!',game.player.name) + +]] +function Tasks.update_task(task_id,new_message,player_name) + Store.update(task_store,task_id,function(task) + task.last_edit_name = player_name or '' + task.last_edit_time = game.tick + task.message = new_message + end) +end + +--[[-- Set the editing state for a player, can be used as a warning or to display a text field +@tparam string task_id the uid of the task that you want to effect +@tparam string player_name the name of the player you want to set the state for +@tparam boolean state the new state to set editing to + +@usage-- Setting your editing state to true +Tasks.set_editing(task_id,game.player.name,true) + +]] +function Tasks.set_editing(task_id,player_name,state) + Store.update(task_store,task_id,function(task) + task.curently_editing[player_name] = state + end) +end + +--[[-- Adds an update handler for when a task is added, removed, or updated +@tparam function handler the handler which is called when a task is updated + +@usage-- Add a game print when a task is updated +Tasks.on_update(function(task) + game.print(task.force_name..' now has the task: '..task.message) +end) + +]] +function Tasks.on_update(handler) + Store.watch(task_store,handler) +end + +--- Getters. +-- function used to get information about tasks +-- @section getters + +--[[-- Gets the task information that is linked with this id +@tparam string task_id the uid of the task you want to get +@treturn table the task information + +@usage-- Getting task information outside of on_update +local task = Tasks.get_task(task_id) + +]] +function Tasks.get_task(task_id) + return Store.get(task_store,task_id) +end + +--[[-- Gets all the task ids that a force has +@tparam string force_name the name of the force that you want the task ids for +@treturn table an array of all the task ids + +@usage-- Getting the task ids for a force +local task_ids = Tasks.get_force_task_ids(game.player.force.name) + +]] +function Tasks.get_force_task_ids(force_name) + return force_tasks[force_name] or {} +end + +--[[-- Gets the editing state for a player +@tparam string task_id the uid of the task you want to check +@tparam string player_name the name of the player that you want to check +@treturn boolean weather the player is currently editing this task + +@usage-- Check if a player is editing a task or not +local editing = Tasks.get_editing(task_id,game.player.name) + +]] +function Tasks.get_editing(task_id,player_name) + local task = Store.get(task_store,task_id) + return task.curently_editing[player_name] +end + +-- Module Return +return Tasks \ No newline at end of file diff --git a/modules/control/warnings.lua b/modules/control/warnings.lua new file mode 100644 index 00000000..ebd3612d --- /dev/null +++ b/modules/control/warnings.lua @@ -0,0 +1,314 @@ +--[[-- Control Module - Warnings + - Adds a way to give and remove warnings to players. + @control Warnings + @alias Warnings + + @usage + -- import the module from the control modules + local Warnings = require 'modules.control.warnings' --- @dep modules.control.warnings + + -- This will add a warning to the player + Warnings.add_warning('MrBiter','Cooldude2606','Killed too many biters') + + -- This will remove a warning from a player, second name is just who is doing the action + Warnings.remove_warning('MrBiter','Cooldude2606') + + -- Script warning as similar to normal warning but are designed to have no effect for a short amount of time + -- this is so it can be used for greifer protection without being too agressive + Warnings.add_script_warning('MrBiter','Killed too many biters') + + -- Both normal and script warnings can also be cleared, this will remove all warnings + 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 valid_player = Game.get_player_from_any + +local Warnings = { + user_warnings={}, + user_script_warnings={}, + events = { + --- When a warning is added to a player + -- @event on_warning_added + -- @tparam number player_index the index of the player who recived the warning + -- @tparam string by_player_name the name of the player who gave the warning + -- @tparam string reason the reason that the player was given a warning + -- @tparam number warning_count the new number of warnings that the player has + on_warning_added = script.generate_event_name(), + --- When a warning is removed from a player + -- @event on_warning_removed + -- @tparam number player_index the index of the player who is having the warning removed + -- @tparam string warning_by_name the name of the player who gave the warning + -- @tparam string removed_by_name the name of the player who is removing the warning + -- @tparam number warning_count the new number of warnings that the player has + on_warning_removed = script.generate_event_name(), + --- When a warning is added to a player, by the script + -- @event on_script_warning_added + -- @tparam number player_index the index of the player who recived the warning + -- @tparam string reason the reason that the player was given a warning + -- @tparam number warning_count the new number of warnings that the player has + on_script_warning_added = script.generate_event_name(), + --- When a warning is remnoved from a player, by the script + -- @event on_script_warning_removed + -- @tparam number player_index the index of the player who is having the warning removed + -- @tparam number warning_count the new number of warnings that the player has + on_script_warning_removed = script.generate_event_name(), + } +} + +local user_warnings = Warnings.user_warnings +local user_script_warnings = Warnings.user_script_warnings +Global.register({ + user_warnings = user_warnings, + user_script_warnings = user_script_warnings +},function(tbl) + Warnings.user_warnings = tbl.user_warnings + Warnings.user_script_warnings = tbl.user_script_warnings + user_warnings = Warnings.user_warnings + user_script_warnings = Warnings.user_script_warnings +end) + +--- Gets an array of warnings that the player has, always returns a list even if emtpy +-- @tparam LuaPlayer player the player to get the warning for +-- @treturn table an array of all the warnings on this player, contains tick, by_player_name and reason +function Warnings.get_warnings(player) + return user_warnings[player.name] or {} +end + +--- Gets the number of warnings that a player has on them +-- @tparam LuaPlayer player the player to count the warnings for +-- @treturn number the number of warnings that the player has +function Warnings.count_warnings(player) + local warnings = user_warnings[player.name] or {} + return #warnings +end + +--- Adds a warning to a player, when a warning is added a set action is done based on the number of warnings and the config file +-- @tparam LuaPlayer player the player to add a warning to +-- @tparam string by_player_name the name of the player who is doing the action +-- @tparam[opt='Non given.'] string reason the reason that the player is being warned +-- @treturn number the number of warnings that the player has +function Warnings.add_warning(player,by_player_name,reason) + player = valid_player(player) + if not player then return end + if not by_player_name then return end + + reason = reason or 'Non given.' + + local warnings = user_warnings[player.name] + if not warnings then + warnings = {} + user_warnings[player.name] = warnings + end + + table.insert(warnings,{ + tick = game.tick, + by_player_name = by_player_name, + reason = reason + }) + + local warning_count = #warnings + + script.raise_event(Warnings.on_warning_added,{ + name = Warnings.on_warning_added, + tick = game.tick, + player_index = player.index, + warning_count = warning_count, + by_player_name = by_player_name, + reason = reason + }) + + local action = config.actions[#warnings] + if action then + local _type = type(action) + if _type == 'function' then + action(player,by_player_name,warning_count) + elseif _type == 'table' then + local current = table.deepcopy(action) + table.insert(current,2,by_player_name) + table.insert(current,3,warning_count) + player.print(current) + elseif type(action) == 'string' then + player.print(action) + end + end + + return warning_count +end + +--- Event trigger for removing a waring due to it being looped in clear warnings +-- @tparam LuaPlayer player the player who is having a warning removed +-- @tparam string warning_by_name the name of the player who made the warning +-- @tparam string removed_by_name the name of the player who is doing the action +-- @tparam number warning_count the number of warnings that the player how has +local function warning_removed_event(player,warning_by_name,removed_by_name,warning_count) + script.raise_event(Warnings.on_warning_removed,{ + name = Warnings.on_warning_removed, + tick = game.tick, + player_index = player.index, + warning_count = warning_count, + warning_by_name = warning_by_name, + removed_by_name = removed_by_name + }) +end + +--- Removes a warning from a player, always removes the earlyist warning, fifo +-- @tparam LuaPlayer player the player to remove a warning from +-- @tparam string by_player_name the name of the player who is doing the action +-- @treturn number the number of warnings that the player has +function Warnings.remove_warning(player,by_player_name) + player = valid_player(player) + if not player then return end + if not by_player_name then return end + + local warnings = user_warnings[player.name] + if not warnings then return end + + local warning = table.remove(warnings,1) + + warning_removed_event(player,warning.by_player_name,by_player_name,#warnings) + + return #warnings +end + +--- Removes all warnings from a player, will trigger remove event for each warning +-- @tparam LuaPlayer player the player to clear the warnings from +-- @tparam string by_player_name the name of the player who is doing the action +-- @treturn boolean true when warnings were cleared succesfully +function Warnings.clear_warnings(player,by_player_name) + player = valid_player(player) + if not player then return end + if not by_player_name then return end + + local warnings = user_warnings[player.name] + if not warnings then return end + + local warning_count = #warnings + for n,warning in pairs(warnings) do + warning_removed_event(player,warning.by_player_name,by_player_name,warning_count-n) + end + + user_warnings[player.name] = nil + return true +end + +--- Gets an array of all the script warnings that a player has +-- @tparam LuaPlayer player the player to get the script warnings of +-- @treturn table a table of all the script warnings a player has, contains tick and reason +function Warnings.get_script_warnings(player) + return user_script_warnings[player.name] or {} +end + +--- Gets the number of script warnings that a player has on them +-- @tparam LuaPlayer player the player to count the script warnings of +-- @treturn number the number of script warnings that the player has +function Warnings.count_script_warnings(player) + local warnings = user_script_warnings[player.name] or {} + return #warnings +end + +--- Adds a script warning to a player, this may add a full warning if max script warnings is met +-- @tparam LuaPlayer player the player to add a script warning to +-- @tparam[opt='Non given.'] string reason the reason that the player is being warned +-- @treturn number the number of script warnings that the player has +function Warnings.add_script_warning(player,reason) + player = valid_player(player) + if not player then return end + + reason = reason or 'Non given.' + + local warnings = user_script_warnings[player.name] + if not warnings then + warnings = {} + user_script_warnings[player.name] = warnings + end + + table.insert(warnings,{ + tick = game.tick, + reason = reason + }) + + local warning_count = #warnings + + script.raise_event(Warnings.on_script_warning_added,{ + name = Warnings.on_script_warning_added, + tick = game.tick, + player_index = player.index, + warning_count = warning_count, + reason = reason + }) + + if warning_count > config.script_warning_limit then + Warnings.add_warning(player,'',reason) + end + + return warning_count +end + +--- Script warning removed event tigger due to it being looped in clear script warnings +-- @tparam LuaPlayer player the player who is having a script warning removed +-- @tparam number warning_count the number of warning that the player has +local function script_warning_removed_event(player,warning_count) + script.raise_event(Warnings.on_script_warning_removed,{ + name = Warnings.on_script_warning_removed, + tick = game.tick, + player_index = player.index, + warning_count = warning_count + }) +end + +--- Removes a script warning from a player +-- @tparam LuaPlayer player the player to remove a script warning from +-- @treturn number the number of script warnings that the player has +function Warnings.remove_script_warning(player) + player = valid_player(player) + if not player then return end + + local warnings = user_script_warnings[player.name] + if not warnings then return end + + table.remove(warnings,1) + + script_warning_removed_event(player) + + return #warnings +end + +--- Removes all script warnings from a player, emits event for each warning removed +-- @tparam LuaPlayer player the player to clear the script warnings from +function Warnings.clear_script_warnings(player) + player = valid_player(player) + if not player then return end + + local warnings = user_script_warnings[player.name] + if not warnings then return end + + local warning_count = #warnings + for n,_ in pairs(warnings) do + script_warning_removed_event(player,warning_count-n) + end + + user_script_warnings[player.name] = nil + return true +end + +-- script warnings are removed after a certain amount of time to make them even more lienient +local script_warning_cool_down = config.script_warning_cool_down*3600 +Event.on_nth_tick(script_warning_cool_down/4,function() + local cutoff = game.tick - script_warning_cool_down + for player_name,script_warnings in pairs(user_script_warnings) do + if #script_warnings > 0 then + for _,warning in pairs(script_warnings) do + if warning.tick < cutoff then + Warnings.remove_script_warning(player_name) + end + end + end + end +end) + +return Warnings \ No newline at end of file diff --git a/modules/control/warps.lua b/modules/control/warps.lua new file mode 100644 index 00000000..ad503c3a --- /dev/null +++ b/modules/control/warps.lua @@ -0,0 +1,461 @@ +--[[-- Control Module - Warps +- Stores warps for each force. +@control Warps +@alias Warps + +@usage-- Making a new spawn warp +local player = game.player +local force = player.force +local spawn_id = Warps.add_warp(force.name,player.surface,player.position,player.name,'Spawn') + +Warps.set_spawn_warp(spawn_id, force) +Warps.make_warp_tag(spawn_id) + +@usage-- Making a new warp with a warp area +local player = game.player +local force = player.force +local warp_id = Warps.add_warp(force.name,player.surface,player.position,player.name) + +Warps.make_warp_area(warp_id) +Warps.make_warp_tag(warp_id) + +]] + +local Store = require 'expcore.store' --- @dep expcore.store +local Global = require 'utils.global' --- @dep utils.global +local Token = require 'utils.token' --- @dep utils.token +local config = require 'config.warps' --- @dep config.warps +local table_values,table_keysort = ext_require('expcore.common','table_values','table_keysort') --- @dep expcore.common + +local Warps = {} + +-- Global lookup table for force name to task ids +local force_warps = {} +Global.register(force_warps,function(tbl) + force_warps = tbl +end) + +-- Warp store is keyed by warp id, value is a table +local warp_store = Store.register() +Warps.store = warp_store + +-- When a warp is updated change its chat tag and resort the warp order +Store.watch(warp_store,function(warp,warp_id) + if warp then + -- Update the map chart tag if there is one + if warp.tag then + Warps.make_warp_tag(warp_id) + end + + -- Check that the name of the warp has been changed + if warp.name == warp.old_name then return end + + -- Get the names of all the warp points for this force + local force_name = warp.force_name + local warp_ids = force_warps[force_name] + local spawn_id = warp_ids.spawn + + local warp_names = {} + for _,next_warp_id in pairs(warp_ids) do + local next_warp = Store.get(warp_store,next_warp_id) + if next_warp_id ~= spawn_id then + warp_names[next_warp.name..next_warp_id] = next_warp_id + end + end + + -- Sort the warp names in alphabetical order + local new_warp_ids = table_values(table_keysort(warp_names)) + table.insert(new_warp_ids,1,spawn_id) + new_warp_ids.spawn = spawn_id + force_warps[force_name] = new_warp_ids + end +end) + +--- Map Intergration. +-- functions used to create and alter warps with in the map +-- @section mapIntergration + +--[[-- Add or update the chat tag for this warp +@tparam string warp_id the uid of the warp you want the chart tag for +@treturn boolean true if a new tag was made, false if it was updated + +@usage-- Adding a chart tag for a new warp +local tag_added = Warps.make_warp_tag(warp_id) + +]] +function Warps.make_warp_tag(warp_id) + local warp = Store.get(warp_store,warp_id) + local name = warp.name + local icon = warp.icon + + -- Edit the existing tag if it is present + local tag = warp.tag + if tag and tag.valid then + tag.text = 'Warp: '..name + tag.icon = {type='item',name=icon} + return false + end + + -- Make a new tag if one did not exist + local force = game.forces[warp.force_name] + local surface = warp.surface + local position = warp.position + + tag = force.add_chart_tag(surface,{ + position = {position.x+0.5,position.y+0.5}, + text = 'Warp: '..name, + icon = {type='item',name=icon} + }) + + -- Add the tag to this warp, store.update not needed as we dont want it to trigger + warp.tag = tag + return true +end + +--[[-- Remove the chart tag for this warp +@tparam string warp_id the uid for the warp that you want to remove the chart tag from +@treturn boolean true if the tag was valid and was removed, false if the tag was invalid + +@usage-- Removing the chart tag from a warp +local removed = Warps.remove_warp_tag(warp_id) + +]] +function Warps.remove_warp_tag(warp_id) + local warp = Store.get(warp_store,warp_id) + + -- Check there is a tag to remove + local tag = warp.tag + if not tag or not tag.valid then + warp.tag = nil + return false + end + + -- Remove the warp chart tag if it is valid + tag.destroy() + warp.tag = nil + + return true +end + +--[[-- Add a warp area for the warp, purely cosmetic +@tparam string warp_id the uid of the warp you want the area for + +@usage-- Adding a warp area for a warp +Warps.make_warp_area(warp_id) + +]] +function Warps.make_warp_area(warp_id) + local warp = Store.get(warp_store,warp_id) + local surface = warp.surface + local position = warp.position + local posx = position.x + local posy = position.y + local radius = config.activation_range + local radius2 = radius^2 + + -- Get the tile that is being replaced, store.update not needed as we dont want it to trigger + local old_tile = surface.get_tile(position).name + warp.old_tile = old_tile + + -- Make a circle that acts as a base for the warp structure + local base_tile = config.base_tile + local base_tiles = {} + for x = -radius, radius do + local x2 = x^2 + for y = -radius, radius do + local y2 = y^2 + if x2+y2 < radius2 then + table.insert(base_tiles,{name=base_tile,position={x+posx,y+posy}}) + end + end + end + surface.set_tiles(base_tiles) + + -- Add a tile patern ontop of the base + local tiles = {} + for _,pos in pairs(config.tiles) do + table.insert(tiles,{name=base_tile,position={pos[1]+posx,pos[2]+posy}}) + end + surface.set_tiles(tiles) + + -- Add entities to the warp structure + for _,entity in pairs(config.entities) do + entity = surface.create_entity{ + name=entity[1], + position={entity[2]+posx,entity[3]+posy}, + force='neutral' + } + entity.destructible = false + entity.health = 0 + entity.minable = false + entity.rotatable = false + end +end + +--[[-- Remove the warp area for a warp +@tparam string warp_id the uid of the warp that you want to remove the area for + +@usage-- Remove the warp area for a warp +Warps.remove_warp_area(warp_id) + +]] +function Warps.remove_warp_area(warp_id) + local warp = Store.get(warp_store,warp_id) + local position = warp.position + local surface = warp.surface + local radius = config.activation_range + local radius2 = radius^2 + + -- Check that a warp area was created previously + local base_tile = warp.old_tile + if not base_tile then return end + + -- Reset all the tiles that were replaced + local tiles = {} + for x = -radius, radius do + local x2 = x^2 + for y = -radius, radius do + local y2 = y^2 + if x2+y2 < radius2 then + table.insert(tiles,{name=base_tile,position={x+position.x,y+position.y}}) + end + end + end + surface.set_tiles(tiles) + + -- Remove all the entites that are in the area + local entities = surface.find_entities_filtered{ + force='neutral', + area={ + {position.x-radius,position.y-radius}, + {position.x+radius,position.y+radius} + } + } + for _,entity in pairs(entities) do if entity.name ~= 'player' then entity.destroy() end end +end + +--[[-- Set a warp to be the spawn point for a force, force must own this warp +@tparam string warp_id the uid of the warp that you want to be the spawn for the force +@tparam LuaForce force the force that you want to set the spawn for + +@usage-- Set your forces spawn to a warp +Warps.set_spawn_warp(warp_id,game.player.force) + +]] +function Warps.set_spawn_warp(warp_id,force) + -- Check the force owns this warp + local warp = Store.get(warp_store,warp_id) + if warp.force_name ~= force.name then return end + + -- Set this warp as the spawn + local warp_ids = force_warps[warp.force_name] + if not warp_ids then + warp_ids = {} + force_warps[warp.force_name] = warp_ids + end + warp_ids.spawn = warp_id + + -- Set the forces spawn to this warp + force.set_spawn_position(warp.position, warp.surface) +end + +--[[-- Teleport a player to a warp point +@tparam string warp_id the uid of the warp to send the player to +@tparam LuaPlayer player the player to teleport to the warp + +@usage-- Teleport yourself to a warp point +Warps.teleport_player(warp_id,game.player) + +]] +function Warps.teleport_player(warp_id,player) + local warp = Store.get(warp_store,warp_id) + local surface = warp.surface + local position = { + x=warp.position.x+0.5, + y=warp.position.y+0.5 + } + + -- Teleport the player + local goto_position = surface.find_non_colliding_position('character',position,32,1) + if player.driving then player.driving = false end + player.teleport(goto_position,surface) +end + +--- Setters. +-- functions used to created and alter warps +-- @section setters + +--[[-- Add a new warp for a force, the warp must have a surface and a position +@tparam string force_name the name of the force to add the warp for +@tparam LuaSurface surface the surface that the warp will be on +@tparam Concepts.Position position the position that the warp will be on +@tparam[opt] string player_name the name of the player that is adding the warp +@tparam[opt] string warp_name the name of the warp that is being added, if omited default is used +@treturn string the uid of the warp which was created + +@usage-- Adding a new warp for your force at your position +local player = game.player +local warp_id = Warps.add_warp(player.force.name,player.surface,player.position,player.name) + +]] +function Warps.add_warp(force_name,surface,position,player_name,warp_name) + -- Get new warp id + local warp_id = tostring(Token.uid()) + warp_name = warp_name or 'New warp' + + -- Get the existing warps for this force + local warp_ids = force_warps[force_name] + if not warp_ids then + warp_ids = {} + force_warps[force_name] = warp_ids + end + + -- Insert the warp id into the force warps + table.insert(warp_ids,warp_id) + + -- Create the editing table + local editing = {} + if player_name then + editing[player_name] = true + end + + -- Add the new warp to the store + Store.set(warp_store,warp_id,{ + warp_id = warp_id, + force_name = force_name, + name = warp_name, + icon = config.default_icon, + surface = surface, + position = { + x = math.floor(position.x), + y = math.floor(position.y) + }, + last_edit_name = player_name or '', + last_edit_time = game.tick, + currently_editing = editing + }) + + return warp_id +end + +--[[-- Removes a warp and any data linked to it +@tparam string warp_id the uid of the warp that you want to remove + +@usage-- Removing a warp +Warps.remove_warp(warp_id) + +]] +function Warps.remove_warp(warp_id) + local warp = Store.get(warp_store,warp_id) + local force_name = warp.force_name + Warps.remove_warp_tag(warp_id) + Warps.remove_warp_area(warp_id) + Store.clear(warp_store,warp_id) + table.remove_element(force_warps[force_name],warp_id) +end + +--[[-- Update the name and icon for a warp +@tparam string warp_id the uid of the warp that you want to update +@tparam[opt] string new_name the new name that you want the warp to have +@tparam[opt] string new_icon the new icon that you want the warp to have +@tparam[opt='server'] string player_name the name of the player that made the edit + +@usage-- Changing the name and icon for a warp +Warps.update_warp(warp_id,'My Warp','iron-plate',game.player.name) + +]] +function Warps.update_warp(warp_id,new_name,new_icon,player_name) + Store.update(warp_store,warp_id,function(warp) + warp.last_edit_name = player_name or '' + warp.last_edit_time = game.tick + warp.old_name = warp.name + warp.name = new_name or warp.name + warp.icon = new_icon or warp.icon + end) +end + +--[[-- Set the editing state for a player, can be used as a warning or to display a text field +@tparam string warp_id the uid of the warp that you want to effect +@tparam string player_name the name of the player you want to set the state for +@tparam boolean state the new state to set editing to + +@usage-- Setting your editing state to true +Warps.set_editing(warp_id,game.player.name,true) + +]] +function Warps.set_editing(warp_id,player_name,state) + Store.update(warp_store,warp_id,function(warp) + warp.currently_editing[player_name] = state + end) +end + +--[[-- Adds an update handler for when a warp is added, removed, or updated +@tparam function handler the handler which is called when a warp is updated + +@usage-- Add a game print when a warp is updated +Warps.on_update(function(warp) + game.print(warp.force_name..' now has the warp: '..warp.name) +end) + +]] +function Warps.on_update(handler) + Store.watch(warp_store,handler) +end + +--- Getters. +-- function used to get information about warps +-- @section getters + +--[[-- Gets the warp information that is linked with this id +@tparam string warp_id the uid of the warp you want to get +@treturn table the warp information + +@usage-- Getting warp information outside of on_update +local warp = Warps.get_warp(warp_id) + +]] +function Warps.get_warp(warp_id) + return Store.get(warp_store,warp_id) +end + +--[[-- Gets all the warp ids that a force has +@tparam string force_name the name of the force that you want the warp ids for +@treturn table an array of all the warp ids + +@usage-- Getting the warp ids for a force +local warp_ids = Warps.get_force_warp_ids(game.player.force.name) + +]] +function Warps.get_force_warp_ids(force_name) + return force_warps[force_name] or {} +end + +--[[-- Get the id of the spawn warp +@tparam string force_name the name of the force that you want to get the spawn warp for +@treturn ?string|nil the uid of the spawn warp for this force if there is one + +@usage-- Getting the spawn warp id +local spawn_id = Warps.get_spawn_warp_id(game.player.force.name) + +]] +function Warps.get_spawn_warp_id(force_name) + local warp_ids = force_warps[force_name] or {} + return warp_ids.spawn +end + +--[[-- Gets the editing state for a player +@tparam string warp_id the uid of the warp you want to check +@tparam string player_name the name of the player that you want to check +@treturn boolean weather the player is currently editing this warp + +@usage-- Check if a player is editing a warp or not +local editing = Warps.get_editing(warp_id,game.player.name) + +]] +function Warps.get_editing(warp_id,player_name) + local warp = Store.get(warp_store,warp_id) + return warp.currently_editing[player_name] +end + +-- Module return +return Warps \ No newline at end of file diff --git a/modules/factorio-control.lua b/modules/factorio-control.lua index 20394547..500d1c0a 100644 --- a/modules/factorio-control.lua +++ b/modules/factorio-control.lua @@ -1,6 +1,6 @@ -local Event = require 'utils.event' -local Global = require 'utils.global' -local config = require 'config.advanced_start' +local Event = require 'utils.event' --- @dep utils.event +local Global = require 'utils.global' --- @dep utils.global +local config = require 'config.advanced_start' --- @dep config.advanced_start local use_silo_script = not config.disable_base_game_silo_script local util = require("util") diff --git a/modules/gui/debug/_g_view.lua b/modules/gui/debug/_g_view.lua index 2e484eb8..33005bd2 100644 --- a/modules/gui/debug/_g_view.lua +++ b/modules/gui/debug/_g_view.lua @@ -1,7 +1,6 @@ ---non-luadoc=true -local Gui = require 'utils.gui' -local Model = require 'modules.gui.debug.model' -local Color = require 'resources.color_presets' +local Gui = require 'utils.gui' --- @dep utils.gui +local Model = require 'modules.gui.debug.model' --- @dep modules.gui.debug.model +local Color = require 'resources.color_presets' --- @dep resources.color_presets local dump = Model.dump @@ -31,7 +30,7 @@ local ignore = { type = true, xpcall = true, _VERSION = true, - module = true, + ['module'] = true, require = true, package = true, unpack = true, diff --git a/modules/gui/debug/event_view.lua b/modules/gui/debug/event_view.lua index 27f5ac82..bc372007 100644 --- a/modules/gui/debug/event_view.lua +++ b/modules/gui/debug/event_view.lua @@ -1,7 +1,7 @@ -local Event = require 'utils.event' -local table = require 'utils.table' -local Gui = require 'utils.gui' -local Model = require 'modules.gui.debug.model' +local Event = require 'utils.event' --- @dep utils.event +local table = require 'utils.table' --- @dep utils.table +local Gui = require 'utils.gui' --- @dep utils.gui +local Model = require 'modules.gui.debug.model' --- @dep modules.gui.debug.model local format = string.format local insert = table.insert diff --git a/modules/gui/debug/expcore_store_view.lua b/modules/gui/debug/expcore_store_view.lua new file mode 100644 index 00000000..2d115992 --- /dev/null +++ b/modules/gui/debug/expcore_store_view.lua @@ -0,0 +1,128 @@ +local Gui = require 'utils.gui' --- @dep utils.gui +local Store = require 'expcore.store' --- @dep utils.global +local Color = require 'resources.color_presets' --- @dep resources.color_presets +local Model = require 'modules.gui.debug.model' --- @dep modules.gui.debug.model + +local dump = Model.dump +local dump_text = Model.dump_text +local concat = table.concat + +local Public = {} + +local header_name = Gui.uid_name() +local left_panel_name = Gui.uid_name() +local right_panel_name = Gui.uid_name() +local input_text_box_name = Gui.uid_name() +local refresh_name = Gui.uid_name() + +Public.name = 'Store' + +function Public.show(container) + local main_flow = container.add {type = 'flow', direction = 'horizontal'} + + local left_panel = main_flow.add {type = 'scroll-pane', name = left_panel_name} + local left_panel_style = left_panel.style + left_panel_style.width = 300 + + for store_id, token_name in pairs(Store.file_paths) do + local header = left_panel.add({type = 'flow'}).add {type = 'label', name = header_name, caption = store_id..' - '..token_name} + Gui.set_data(header, store_id) + end + + local right_flow = main_flow.add {type = 'flow', direction = 'vertical'} + + local right_top_flow = right_flow.add {type = 'flow', direction = 'horizontal'} + + local input_text_box = right_top_flow.add {type = 'text-box', name = input_text_box_name} + local input_text_box_style = input_text_box.style + input_text_box_style.horizontally_stretchable = true + input_text_box_style.height = 32 + input_text_box_style.maximal_width = 1000 + + local refresh_button = + right_top_flow.add {type = 'sprite-button', name = refresh_name, sprite = 'utility/reset', tooltip = 'refresh'} + local refresh_button_style = refresh_button.style + refresh_button_style.width = 32 + refresh_button_style.height = 32 + + local right_panel = right_flow.add {type = 'text-box', name = right_panel_name} + right_panel.read_only = true + right_panel.selectable = true + + local right_panel_style = right_panel.style + right_panel_style.vertically_stretchable = true + right_panel_style.horizontally_stretchable = true + right_panel_style.maximal_width = 1000 + right_panel_style.maximal_height = 1000 + + local data = { + right_panel = right_panel, + input_text_box = input_text_box, + selected_header = nil + } + + Gui.set_data(input_text_box, data) + Gui.set_data(left_panel, data) + Gui.set_data(refresh_button, data) +end + +Gui.on_click( + header_name, + function(event) + local element = event.element + local store_id = Gui.get_data(element) + + local left_panel = element.parent.parent + local data = Gui.get_data(left_panel) + local right_panel = data.right_panel + local selected_header = data.selected_header + local input_text_box = data.input_text_box + + if selected_header then + selected_header.style.font_color = Color.white + end + + element.style.font_color = Color.orange + data.selected_header = element + + input_text_box.text = concat {'global.data_store[', store_id, ']'} + input_text_box.style.font_color = Color.black + + local content = dump(Store.get(store_id)) or 'nil' + right_panel.text = content + end +) + +local function update_dump(text_input, data, player) + local suc, ouput = dump_text(text_input.text, player) + if not suc then + text_input.style.font_color = Color.red + else + text_input.style.font_color = Color.black + data.right_panel.text = ouput + end +end + +Gui.on_text_changed( + input_text_box_name, + function(event) + local element = event.element + local data = Gui.get_data(element) + + update_dump(element, data, event.player) + end +) + +Gui.on_click( + refresh_name, + function(event) + local element = event.element + local data = Gui.get_data(element) + + local input_text_box = data.input_text_box + + update_dump(input_text_box, data, event.player) + end +) + +return Public diff --git a/modules/gui/debug/global_view.lua b/modules/gui/debug/global_view.lua index 6a888377..df057c47 100644 --- a/modules/gui/debug/global_view.lua +++ b/modules/gui/debug/global_view.lua @@ -1,6 +1,6 @@ -local Gui = require 'utils.gui' -local Model = require 'modules.gui.debug.model' -local Color = require 'resources.color_presets' +local Gui = require 'utils.gui' --- @dep utils.gui +local Model = require 'modules.gui.debug.model' --- @dep modules.gui.debug.model +local Color = require 'resources.color_presets' --- @dep resources.color_presets local dump = Model.dump local dump_text = Model.dump_text @@ -8,7 +8,7 @@ local concat = table.concat local Public = {} -local ignore = {tokens = true} +local ignore = {tokens = true, data_store = true} local header_name = Gui.uid_name() local left_panel_name = Gui.uid_name() diff --git a/modules/gui/debug/main_view.lua b/modules/gui/debug/main_view.lua index bac9ffb5..3c286a46 100644 --- a/modules/gui/debug/main_view.lua +++ b/modules/gui/debug/main_view.lua @@ -1,10 +1,11 @@ -local Gui = require 'utils.gui' -local Color = require 'resources.color_presets' +local Gui = require 'utils.gui' --- @dep utils.gui +local Color = require 'resources.color_presets' --- @dep resources.color_presets local Public = {} local pages = { require 'modules.gui.debug.redmew_global_view', + require 'modules.gui.debug.expcore_store_view', require 'modules.gui.debug.global_view', require 'modules.gui.debug.package_view', require 'modules.gui.debug._g_view', diff --git a/modules/gui/debug/model.lua b/modules/gui/debug/model.lua index bf04eac9..ff120941 100644 --- a/modules/gui/debug/model.lua +++ b/modules/gui/debug/model.lua @@ -1,5 +1,5 @@ -local Gui = require 'utils.gui' -local table = require 'utils.table' +local Gui = require 'utils.gui' --- @dep utils.gui +local table = require 'utils.table' --- @dep utils.table local gui_names = Gui.names local type = type diff --git a/modules/gui/debug/package_view.lua b/modules/gui/debug/package_view.lua index 479fb369..f29aafbb 100644 --- a/modules/gui/debug/package_view.lua +++ b/modules/gui/debug/package_view.lua @@ -1,6 +1,6 @@ -local Gui = require 'utils.gui' -local Color = require 'resources.color_presets' -local Model = require 'modules.gui.debug.model' +local Gui = require 'utils.gui' --- @dep utils.gui +local Color = require 'resources.color_presets' --- @dep resources.color_presets +local Model = require 'modules.gui.debug.model' --- @dep modules.gui.debug.model local dump_function = Model.dump_function local loaded = _G.package.loaded diff --git a/modules/gui/debug/redmew_global_view.lua b/modules/gui/debug/redmew_global_view.lua index 51204150..a62a6151 100644 --- a/modules/gui/debug/redmew_global_view.lua +++ b/modules/gui/debug/redmew_global_view.lua @@ -1,8 +1,8 @@ -local Gui = require 'utils.gui' -local Global = require 'utils.global' -local Token = require 'utils.token' -local Color = require 'resources.color_presets' -local Model = require 'modules.gui.debug.model' +local Gui = require 'utils.gui' --- @dep utils.gui +local Global = require 'utils.global' --- @dep utils.global +local Token = require 'utils.token' --- @dep utils.token +local Color = require 'resources.color_presets' --- @dep resources.color_presets +local Model = require 'modules.gui.debug.model' --- @dep modules.gui.debug.model local dump = Model.dump local dump_text = Model.dump_text diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index ad320bd6..80e81c13 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -1,44 +1,60 @@ ---- Gui left frame define for a player list -local Gui = require 'expcore.gui' -local Roles = require 'expcore.roles' -local Store = require 'expcore.store' -local Game = require 'utils.game' -local Event = require 'utils.event' -local format_time = ext_require('expcore.common','format_time') -local config = require 'config.action_buttons' -local Colors = require 'resources.color_presets' +--[[-- Gui Module - Player List + - Adds a player list to show names and play time; also includes action buttons which can apply to players + @gui Player-List + @alias player_list +]] -local action_player_store = 'gui.left.player-list.action-player' -local action_name_store = 'gui.left.player-list.action-name' +local Gui = require 'expcore.gui' --- @dep expcore.gui +local Roles = require 'expcore.roles' --- @dep expcore.roles +local Store = require 'expcore.store' --- @dep expcore.store +local Game = require 'utils.game' --- @dep utils.game +local Event = require 'utils.event' --- @dep utils.event +local format_time = ext_require('expcore.common','format_time') --- @dep expcore.common +local config = require 'config.action_buttons' --- @dep config.action_buttons +local Colors = require 'resources.color_presets' --- @dep resources.color_presets ---- used on player name label to allow zoom to map +-- Stores the name of the player a player has selected +local selected_player_store = Store.register(function(player) + return player.name +end) + +-- Stores the current action that a player wants to do +local selected_action_store = Store.register(function(player) + return player.name +end) + +-- Set the config to use these stores +config.set_store_uids(selected_player_store,selected_action_store) + +--- Used to open the map on a player or toggle the settings local zoom_to_map_name = Gui.uid_name() Gui.on_click(zoom_to_map_name,function(event) - local action_player_name = event.element.caption - local action_player = Game.get_player_from_any(action_player_name) + local selected_player_name = event.element.caption + local selected_player = Game.get_player_from_any(selected_player_name) if event.button == defines.mouse_button_type.left then - -- lmb will zoom to map - local position = action_player.position + -- LMB will open the map to the selected player + local position = selected_player.position event.player.zoom_to_world(position,1.75) else - -- rmb will open settings - local player_name = event.player.name - local old_action_player_name = Store.get(action_player_store,player_name) - if action_player_name == old_action_player_name then - Store.clear(action_player_store,player_name) -- will close if already open + -- RMB will toggle the settings + local player = event.player + local old_selected_player_name = Store.get(selected_player_store,player) + if selected_player_name == old_selected_player_name then + Store.clear(selected_player_store,player) else - Store.set(action_player_store,player_name,action_player_name) + Store.set(selected_player_store,player,selected_player_name) end end end) --- Button used to open the action bar +-- @element open_action_bar local open_action_bar = Gui.new_button() :set_sprites('utility/expand_dots_white') :set_tooltip{'player-list.open-action-bar'} -:set_embeded_flow(function(element,action_player_name) - return action_player_name +:set_embedded_flow(function(element,selected_player_name) + return selected_player_name end) :set_style('frame_button',function(style) Gui.set_padding_style(style,-2,-2,-2,-2) @@ -46,16 +62,17 @@ end) style.height = 14 end) :on_click(function(player,element) - local new_action_player_name = element.parent.name - local action_player_name = Store.get(action_player_store,player.name) - if action_player_name == new_action_player_name then - Store.clear(action_player_store,player.name) -- will close if already open + local selected_player_name = element.parent.name + local old_selected_player_name = Store.get(selected_player_store,player) + if selected_player_name == old_selected_player_name then + Store.clear(selected_player_store,player) else - Store.set(action_player_store,player.name,new_action_player_name) + Store.set(selected_player_store,player,selected_player_name) end end) --- Button used to close the action bar +-- @element close_action_bar local close_action_bar = Gui.new_button() :set_sprites('utility/close_black','utility/close_white') @@ -66,11 +83,12 @@ Gui.new_button() style.width = 28 end) :on_click(function(player,element) - Store.clear(action_player_store,player.name) - Store.clear(action_name_store,player.name) + Store.clear(selected_player_store,player) + Store.clear(selected_action_store,player) end) --- Button used to confirm a reason +-- @element reason_confirm local reason_confirm = Gui.new_button() :set_sprites('utility/confirm_slot') @@ -82,11 +100,11 @@ Gui.new_button() end) :on_click(function(player,element) local reason = element.parent.entry.text or 'Non Given' - local action_name = Store.get(action_name_store,player.name) - local reason_callback = config[action_name].reason_callback + local action_name = Store.get(selected_action_store,player) + local reason_callback = config.buttons[action_name].reason_callback reason_callback(player,reason) - Store.clear(action_player_store,player.name) - Store.clear(action_name_store,player.name) + Store.clear(selected_player_store,player) + Store.clear(selected_action_store,player) element.parent.entry.text = '' end) @@ -135,7 +153,7 @@ local function generate_container(player,element) Gui.set_padding(reason_bar,-1,-1,3,3) reason_bar.style.horizontally_stretchable = true reason_bar.style.height = 35 - local action_name = Store.get(action_name_store,player.name) + local action_name = Store.get(selected_action_store,player) reason_bar.visible = action_name ~= nil -- text entry for the reason bar @@ -158,9 +176,9 @@ end --- Adds buttons and permission flows to the action bar local function generate_action_bar(player,element) close_action_bar(element) - local action_player = Store.get(action_player_store,player.name) + local selected_player_name = Store.get(selected_player_store,player) - for action_name,buttons in pairs(config) do + for action_name,buttons in pairs(config.buttons) do local permission_flow = element.add{ type='flow', @@ -175,12 +193,12 @@ local function generate_action_bar(player,element) permission_flow.visible = false end - if buttons.auth and action_player and not buttons.auth(player,action_player) then + if buttons.auth and selected_player_name and not buttons.auth(player,selected_player_name) then permission_flow.visible = false end end - if not action_player then + if not selected_player_name then element.visible = false end end @@ -190,25 +208,30 @@ local player_list_name local function update_action_bar(player) local frame = Gui.classes.left_frames.get_frame(player_list_name,player) local element = frame.container.action_bar - local action_player_name = Store.get(action_player_store,player.name) + local selected_player_name = Store.get(selected_player_store,player) - if not action_player_name then + if not selected_player_name then element.visible = false + else - local action_player = Game.get_player_from_any(action_player_name) - if not action_player.connected then + local selected_player = Game.get_player_from_any(selected_player_name) + if not selected_player.connected then + -- If the player is offline then reest stores element.visible = false - Store.clear(action_player_store,player.name) -- clears store if player is offline - Store.clear(action_name_store,player.name) + Store.clear(selected_player_store,player) + Store.clear(selected_action_store,player) + else + -- Otherwise check what actions the player is allowed to use element.visible = true - for action_name,buttons in pairs(config) do - if buttons.auth and not buttons.auth(player,action_player) then + for action_name,buttons in pairs(config.buttons) do + if buttons.auth and not buttons.auth(player,selected_player) then element[action_name].visible = false elseif Roles.player_allowed(player,action_name) then element[action_name].visible = true end end + end end end @@ -267,6 +290,7 @@ local function add_fake_players(list_table,count) end --- Registers the player list +-- @element player_list local player_list = Gui.new_left_frame('gui/player-list') :set_sprites('entity/character') @@ -314,10 +338,11 @@ end) player_list_name = player_list:uid() --- When the action player is changed the action bar will update -Store.register(action_player_store,function(value,category) - local player = Game.get_player_from_any(category) +Store.watch(selected_player_store,function(value,player_name) + local player = Game.get_player_from_any(player_name) update_action_bar(player) + -- Change the style of the option buttons local frame = player_list:get_frame(player) local data_table = frame.container.scroll.table for _,next_player in pairs(game.connected_players) do @@ -334,21 +359,25 @@ Store.register(action_player_store,function(value,category) end) --- When the action name is changed the reason input will update -Store.register(action_name_store,function(value,category) - local player = Game.get_player_from_any(category) +Store.watch(selected_action_store,function(value,player_name) + local player = Game.get_player_from_any(player_name) local frame = Gui.classes.left_frames.get_frame(player_list_name,player) local element = frame.container.reason_bar if value then - local action_player_name = Store.get(action_player_store,category) - local action_player = Game.get_player_from_any(action_player_name) - if action_player.connected then + -- if there is a new value then check the player is still online + local selected_player_name = Store.get(selected_player_store,player_name) + local selected_player = Game.get_player_from_any(selected_player_name) + if selected_player.connected then element.visible = true else - Store.clear(action_player_store,category) -- clears store if player is offline - Store.clear(action_name_store,category) + -- Clear if the player is offline + Store.clear(selected_player_store,player_name) + Store.clear(selected_action_store,player_name) end + else element.visible = false + end end) diff --git a/modules/gui/rocket-info.lua b/modules/gui/rocket-info.lua index fc286ed3..fd384627 100644 --- a/modules/gui/rocket-info.lua +++ b/modules/gui/rocket-info.lua @@ -1,38 +1,16 @@ ---- Adds a rocket infomation gui which shows general stats, milestones and build progress of rockets -local Gui = require 'expcore.gui' -local Roles = require 'expcore.roles' -local Event = require 'utils.event' -local config = require 'config.rockets' -local Global = require 'utils.global' -local format_time = ext_require('expcore.common','format_time') -local Colors = require 'resources.color_presets' +--[[-- Gui Module - Rocket Info + - Adds a rocket infomation gui which shows general stats, milestones and build progress of rockets + @gui Rocket-Info + @alias rocket_info +]] -local largest_rolling_avg = 0 -for _,avg_over in pairs(config.stats.rolling_avg) do - if avg_over > largest_rolling_avg then - largest_rolling_avg = avg_over - end -end - -local rocket_times = {} -local rocket_stats = {} -local rocket_silos = {} - -Global.register({ - rocket_times = rocket_times, - rocket_stats = rocket_stats, - rocket_silos = rocket_silos -},function(tbl) - rocket_times = tbl.rocket_times - rocket_stats = tbl.rocket_stats - rocket_silos = tbl.rocket_silos -end) - ---- Gets the name used to refrence the the rocket silo -local function get_silo_name(entity) - local position = entity.position - return math.floor(position.x)..':'..math.floor(position.y) -end +local Gui = require 'expcore.gui' --- @dep expcore.gui +local Roles = require 'expcore.roles' --- @dep expcore.roles +local Event = require 'utils.event' --- @dep utils.event +local config = require 'config.rockets' --- @dep config.rockets +local format_time = ext_require('expcore.common','format_time') --- @dep expcore.common +local Colors = require 'resources.color_presets' --- @dep resources.color_presets +local Rockets = require 'modules.control.rockets' --- @dep modules.control.rockets --- Gets if a player is allowed to use the action buttons local function player_allowed(player,action) @@ -44,7 +22,7 @@ local function player_allowed(player,action) return false end - if config.progress[action..'_role_permision'] and not Roles.player_allowed(player,config.progress[action..'_role_permision']) then + if config.progress[action..'_role_permission'] and not Roles.player_allowed(player,config.progress[action..'_role_permission']) then return false end @@ -52,21 +30,21 @@ local function player_allowed(player,action) end --- Used on the name label to allow zoom to map +-- @element zoom_to_map local zoom_to_map_name = Gui.uid_name() Gui.on_click(zoom_to_map_name,function(event) - local force = event.player.force local rocket_silo_name = event.element.parent.caption - local rocket_silo_data = rocket_silos[force.name][rocket_silo_name] - local position = rocket_silo_data.entity.position - event.player.zoom_to_world(position,2) + local rocket_silo = Rockets.get_silo_entity(rocket_silo_name) + event.player.zoom_to_world(rocket_silo.position,2) end) --- Used to launch the rocket, when it is ready +-- @element launch_rocket local launch_rocket = Gui.new_button() :set_sprites('utility/center') :set_tooltip{'rocket-info.launch-tooltip'} -:set_embeded_flow(function(element,rocket_silo_name) +:set_embedded_flow(function(element,rocket_silo_name) return 'launch-'..rocket_silo_name end) :set_style('tool_button',function(style) @@ -75,11 +53,10 @@ end) style.height = 16 end) :on_click(function(player,element) - local force = player.force local rocket_silo_name = element.parent.name:sub(8) - local rocket_silo_data = rocket_silos[force.name][rocket_silo_name] - if rocket_silo_data.entity.launch_rocket() then - rocket_silo_data.awaiting_reset = true + local silo_data = Rockets.get_silo_data_by_name(rocket_silo_name) + if silo_data.entity.launch_rocket() then + silo_data.awaiting_reset = true element.enabled = false local progress_label = element.parent.parent[rocket_silo_name].label progress_label.caption = {'rocket-info.progress-launched'} @@ -90,11 +67,12 @@ end) end) --- Used to toggle the auto launch on a rocket +-- @element toggle_rocket local toggle_rocket = Gui.new_button() :set_sprites('utility/play') :set_tooltip{'rocket-info.toggle-rocket-tooltip'} -:set_embeded_flow(function(element,rocket_silo_name) +:set_embedded_flow(function(element,rocket_silo_name) return 'toggle-'..rocket_silo_name end) :set_style('tool_button',function(style) @@ -103,22 +81,21 @@ end) style.height = 16 end) :on_click(function(player,element) - local force = player.force local rocket_silo_name = element.parent.name:sub(8) - local rocket_silo_data = rocket_silos[force.name][rocket_silo_name] - local active = rocket_silo_data.entity.auto_launch -- need to test for auto launch - if active then + local rocket_silo = Rockets.get_silo_entity(rocket_silo_name) + if rocket_silo.auto_launch then element.sprite = 'utility/play' element.tooltip = {'rocket-info.toggle-rocket-tooltip'} - rocket_silo_data.entity.auto_launch = false + rocket_silo.auto_launch = false else element.sprite = 'utility/stop' element.tooltip = {'rocket-info.toggle-rocket-tooltip-disabled'} - rocket_silo_data.entity.auto_launch = true + rocket_silo.auto_launch = true end end) ---- Used to toggle the visiblty of the different sections +--- Used to toggle the visibility of the different sections +-- @element toggle_section local toggle_section = Gui.new_button() :set_sprites('utility/expand_dark','utility/expand') @@ -144,7 +121,7 @@ end) --- Used to create the three different sections local function create_section(container,section_name,table_size) - --- Header for the section + -- Header for the section local header_area = Gui.create_header( container, {'rocket-info.section-caption-'..section_name}, @@ -153,11 +130,11 @@ local function create_section(container,section_name,table_size) section_name..'-header' ) - --- Right aligned button to toggle the section + -- Right aligned button to toggle the section header_area.caption = section_name toggle_section(header_area) - --- Table used to store the data + -- Table used to store the data local flow_table = Gui.create_scroll_table(container,table_size,215,section_name) flow_table.parent.visible = false @@ -263,28 +240,25 @@ end local function generate_stats(player,frame) if not config.stats.show_stats then return end local element = frame.container.stats.table - local force_rockets = player.force.rockets_launched + local force_name = player.force.name + local force_rockets = Rockets.get_rocket_count(force_name) + local stats = Rockets.get_stats(force_name) if config.stats.show_first_rocket then - create_label_value_pair_time(element,'first-launch',rocket_stats.first_launch or 0) + create_label_value_pair_time(element,'first-launch',stats.first_launch or 0) end if config.stats.show_last_rocket then - create_label_value_pair_time(element,'last-launch',rocket_stats.last_launch or 0) + create_label_value_pair_time(element,'last-launch',stats.last_launch or 0) end if config.stats.show_fastest_rocket then - create_label_value_pair_time(element,'fastest-launch',rocket_stats.fastest_launch or 0,true) + create_label_value_pair_time(element,'fastest-launch',stats.fastest_launch or 0,true) end if config.stats.show_total_rockets then - local total_rockets = 1 - if force_rockets > 0 then - total_rockets = 0 - for _,force in pairs(game.forces) do - total_rockets = total_rockets + force.rockets_launched - end - end + local total_rockets = Rockets.get_game_rocket_count() + total_rockets = total_rockets == 0 and 1 or total_rockets local percentage = math.round(force_rockets/total_rockets,3)*100 create_label_value_pair(element,'total-rockets',force_rockets,{'rocket-info.value-tooltip-total-rockets',percentage}) end @@ -295,14 +269,7 @@ local function generate_stats(player,frame) end for _,avg_over in pairs(config.stats.rolling_avg) do - local rocket_count = avg_over - local first_rocket = 0 - if avg_over < force_rockets then - first_rocket = rocket_times[player.force.name][force_rockets-avg_over+1] - else - rocket_count = force_rockets - end - local avg = rocket_count > 0 and math.floor((game.tick-first_rocket)/rocket_count) or 0 + local avg = Rockets.get_rolling_average(force_name,avg_over) create_label_value_pair_time(element,'avg-launch-n',avg,true,avg_over) end @@ -312,11 +279,12 @@ end local function generate_milestones(player,frame) if not config.milestones.show_milestones then return end local element = frame.container.milestones.table - local force_rockets = player.force.rockets_launched + local force_name = player.force.name + local force_rockets = Rockets.get_rocket_count(force_name) for _,milestone in ipairs(config.milestones) do if milestone <= force_rockets then - local time = rocket_times[player.force.name][milestone] + local time = Rockets.get_rocket_time(force_name,milestone) create_label_value_pair_time(element,'milestone-n',time,false,milestone) else create_label_value_pair_time(element,'milestone-n',0,false,milestone) @@ -326,10 +294,11 @@ local function generate_milestones(player,frame) end --- Creats the different buttons used with the rocket silos -local function generate_progress_buttons(player,element,rocket_silo_data) - local silo_name = rocket_silo_data.name - local status = rocket_silo_data.entity.status == defines.entity_status.waiting_to_launch_rocket - local active = rocket_silo_data.entity.auto_launch +local function generate_progress_buttons(player,element,silo_data) + local silo_name = silo_data.name + local rocket_silo = silo_data.entity + local status = rocket_silo.status == defines.entity_status.waiting_to_launch_rocket + local active = rocket_silo.auto_launch if player_allowed(player,'toggle_active') then local button_element = element['toggle-'..silo_name] @@ -358,7 +327,7 @@ local function generate_progress_buttons(player,element,rocket_silo_data) button_element = launch_rocket(element,silo_name) end - if rocket_silo_data.awaiting_reset then + if silo_data.awaiting_reset then button_element.enabled = false else button_element.enabled = status @@ -383,34 +352,35 @@ local function generate_progress(player,frame) local element = frame.container.progress.table local force = player.force local force_name = force.name - local force_silo_data = rocket_silos[force_name] + local force_silos = Rockets.get_silos(force_name) - if not force_silo_data or table.size(force_silo_data) == 0 then + if not force_silos or table.size(force_silos) == 0 then element.parent.no_silos.visible = true else element.parent.no_silos.visible = false - for silo_name,rocket_silo_data in pairs(force_silo_data) do - if not rocket_silo_data.entity or not rocket_silo_data.entity.valid then - force_silo_data[silo_name] = nil - Gui.destory_if_valid(element['toggle-'..silo_name]) - Gui.destory_if_valid(element['launch-'..silo_name]) - Gui.destory_if_valid(element['label-x-'..silo_name]) - Gui.destory_if_valid(element['label-y-'..silo_name]) - Gui.destory_if_valid(element[silo_name]) + for _,silo_data in pairs(force_silos) do + local silo_name = silo_data.name + if not silo_data.entity or not silo_data.entity.valid then + force_silos[silo_name] = nil + Gui.destroy_if_valid(element['toggle-'..silo_name]) + Gui.destroy_if_valid(element['launch-'..silo_name]) + Gui.destroy_if_valid(element['label-x-'..silo_name]) + Gui.destroy_if_valid(element['label-y-'..silo_name]) + Gui.destroy_if_valid(element[silo_name]) elseif not element[silo_name] then - local entity = rocket_silo_data.entity + local entity = silo_data.entity local progress = entity.rocket_parts local pos = { x=entity.position.x, y=entity.position.y } - generate_progress_buttons(player,element,rocket_silo_data) + generate_progress_buttons(player,element,silo_data) - --- Creats two flows and two labels for the X and Y position + --- Creates two flows and two labels for the X and Y position local name = config.progress.allow_zoom_to_map and zoom_to_map_name or nil local tooltip = config.progress.allow_zoom_to_map and {'rocket-info.progress-label-tooltip'} or nil local flow_x = element.add{ @@ -445,30 +415,30 @@ local function generate_progress(player,frame) type='label', name='label', caption={'rocket-info.progress-caption',progress}, - tooltip={'rocket-info.progress-tooltip',rocket_silo_data.launched or 0} + tooltip={'rocket-info.progress-tooltip',silo_data.launched or 0} } else - local entity = rocket_silo_data.entity + local entity = silo_data.entity local progress = entity.rocket_parts local status = entity.status == 21 local label = element[silo_name].label label.caption = {'rocket-info.progress-caption',progress} - label.tooltip = {'rocket-info.progress-tooltip',rocket_silo_data.launched or 0} + label.tooltip = {'rocket-info.progress-tooltip',silo_data.launched or 0} - if status and rocket_silo_data.awaiting_reset then + if status and silo_data.awaiting_reset then label.caption = {'rocket-info.progress-launched'} label.style.font_color = Colors.green elseif status then label.caption = {'rocket-info.progress-caption',100} label.style.font_color = Colors.cyan else - rocket_silo_data.awaiting_reset = false + silo_data.awaiting_reset = false label.style.font_color = Colors.white end - generate_progress_buttons(player,element,rocket_silo_data) + generate_progress_buttons(player,element,silo_data) end end @@ -476,7 +446,8 @@ local function generate_progress(player,frame) end end ---- Registers the new left gui +--- Registers the rocket info +-- @element rocket_info local rocket_info = Gui.new_left_frame('gui/rocket-info') :set_sprites('entity/rocket-silo') @@ -501,43 +472,10 @@ end) --- Event used to update the stats and the hui when a rocket is launched Event.add(defines.events.on_rocket_launched,function(event) - local entity = event.rocket_silo - local silo_name = get_silo_name(entity) local force = event.rocket_silo.force - local force_name = force.name - local force_silo_data = rocket_silos[force_name] local rockets_launched = force.rockets_launched local first_rocket = rockets_launched == 1 - --- Handles updates to the rocket stats - if not rocket_stats[force_name] then - rocket_stats[force_name] = {} - end - - if first_rocket then - rocket_stats.first_launch = event.tick - rocket_stats.fastest_launch = event.tick - elseif event.tick-rocket_stats.last_launch < rocket_stats.fastest_launch then - rocket_stats.fastest_launch = event.tick-rocket_stats.last_launch - end - - rocket_stats.last_launch = event.tick - - --- Appends the new rocket into the array - if not rocket_times[force_name] then - rocket_times[force_name] = {} - end - - rocket_times[force_name][rockets_launched] = event.tick - - local remove_rocket = rockets_launched-largest_rolling_avg - if remove_rocket > 0 and not table.contains(config.milestones,remove_rocket) then - rocket_times[force_name][remove_rocket] = nil - end - - --- Adds this 1 to the launch count for this silo - force_silo_data[silo_name].launched = force_silo_data[silo_name].launched+1 - --- Updates all the guis (and toolbar since the button may now be visible) for _,player in pairs(force.players) do rocket_info:update(player) @@ -548,34 +486,11 @@ Event.add(defines.events.on_rocket_launched,function(event) end end) ---- When a launch is reiggered it will await reset -Event.add(defines.events.on_rocket_launch_ordered,function(event) - local entity = event.rocket_silo - local silo_name = get_silo_name(entity) - local force = event.rocket_silo.force - local force_name = force.name - local force_silo_data = rocket_silos[force_name] - force_silo_data[silo_name].awaiting_reset = true -end) - --- Adds a silo to the list when it is built local function on_built(event) local entity = event.created_entity if entity.valid and entity.name == 'rocket-silo' then local force = entity.force - local force_name = force.name - local silo_name = get_silo_name(entity) - - if not rocket_silos[force_name] then - rocket_silos[force_name] = {} - end - - rocket_silos[force_name][silo_name] = { - name=silo_name, - entity=entity, - launched=0, - awaiting_reset=false - } for _,player in pairs(force.players) do local frame = rocket_info:get_frame(player) @@ -590,8 +505,8 @@ Event.add(defines.events.on_robot_built_entity,on_built) --- Optimised update for only the build progress Event.on_nth_tick(150,function() for _,force in pairs(game.forces) do - local silos = rocket_silos[force.name] - if silos then + local silos = Rockets.get_silos(force.name) + if #silos > 0 then for _,player in pairs(force.connected_players) do local frame = rocket_info:get_frame(player) generate_progress(player,frame) diff --git a/modules/gui/science-info.lua b/modules/gui/science-info.lua index 6fd522d2..9ecce6e2 100644 --- a/modules/gui/science-info.lua +++ b/modules/gui/science-info.lua @@ -1,53 +1,18 @@ ---- Adds a science info gui that shows production usage and net for the different science packs as well as an eta -local Gui = require 'expcore.gui' -local Event = require 'utils.event' -local Colors = require 'resources.color_presets' -local format_time = ext_require('expcore.common','format_time') -local format_number = ext_require('util','format_number') -local config = require 'config.science' +--[[-- Gui Module - Science Info + - Adds a science info gui that shows production usage and net for the different science packs as well as an eta + @gui Science-Info + @alias science_info +]] + +local Gui = require 'expcore.gui' --- @dep expcore.gui +local Event = require 'utils.event' --- @dep utils.event +local format_time = ext_require('expcore.common','format_time') --- @dep expcore.common +local config = require 'config.science' --- @dep config.science +local Production = require 'modules.control.production' --- @dep modules.control.production local null_time_short = {'science-info.eta-time',format_time(0,{hours=true,minutes=true,seconds=true,time=true,null=true})} local null_time_long = format_time(0,{hours=true,minutes=true,seconds=true,long=true,null=true}) ---- Gets the production stats for a certain science pack -local function get_production_stats(player,science_pack) - local force = player.force - local stats = force.item_production_statistics - local total_made = stats.get_input_count(science_pack) - local total_used = stats.get_output_count(science_pack) - local minute_made = stats.get_flow_count{ - name=science_pack, - input=true, - precision_index=defines.flow_precision_index.one_minute, - } - local minute_used = stats.get_flow_count{ - name=science_pack, - input=false, - precision_index=defines.flow_precision_index.one_minute, - } - return { - total_made=total_made, - total_used=total_used, - total_net=total_made-total_used, - minute_made=minute_made, - minute_used=minute_used, - minute_net=minute_made-minute_used - } -end - ---- Gets the font colour for a certain level of production -local function get_font_colour(value,secondary) - if value > config.required_for_green then - return Colors.light_green - elseif value < config.required_for_red then - return Colors.indian_red - elseif secondary and secondary > 0 or not secondary and value ~= 0 then - return Colors.orange - else - return Colors.grey - end -end - --[[ Generates the main structure for the gui element > container @@ -60,7 +25,7 @@ end >>> eta >>>> label ]] -local function generate_container(player,element) +local function generate_container(element) Gui.set_padding(element,1,2,2,2) element.style.minimal_width = 200 @@ -137,21 +102,8 @@ end > spm-"name" ]] local function add_data_label(element,name,value,secondary,tooltip) - local data_colour = get_font_colour(value,secondary) - local caption = format_number(math.round(value,1),true) - - local surfix = caption:sub(-1) - if not tonumber(surfix) then - caption = caption:sub(1,-2) - else - surfix = '' - end - - if value > 0 then - caption = '+'..caption - elseif value == 0 and caption:sub(1,1) == '-' then - caption = caption:sub(2) - end + local data_colour = Production.get_color(config.color_clamp, value, secondary) + local surfix,caption = Production.format_number(value) if element[name] then local data = element[name].label @@ -197,16 +149,18 @@ end > net-"science_pack" (add_data_label) ]] local function generate_science_pack(player,element,science_pack) - local stats = get_production_stats(player,science_pack) - if stats.total_made > 0 then + local total = Production.get_production_total(player.force, science_pack) + local minute = Production.get_production(player.force, science_pack, defines.flow_precision_index.one_minute) + if total.made > 0 then element.parent.non_made.visible = false local icon_style = 'quick_bar_slot_button' - if stats.minute_net > config.required_for_green then + local flux = Production.get_fluctuations(player.force, science_pack, defines.flow_precision_index.one_minute) + if flux.net > -config.color_flux/2 then icon_style = 'green_slot_button' - elseif stats.minute_net < config.required_for_red then + elseif flux.net < -config.color_flux then icon_style = 'red_slot_button' - elseif stats.minute_made > 0 then + elseif minute.made > 0 then icon_style = 'selected_slot_button' end @@ -257,9 +211,9 @@ local function generate_science_pack(player,element,science_pack) Gui.set_padding(delta_table) end - add_data_label(delta.table,'pos-'..science_pack,stats.minute_made,nil,{'science-info.pos-tooltip',stats.total_made}) - add_data_label(delta.table,'neg-'..science_pack,-stats.minute_used,nil,{'science-info.neg-tooltip',stats.total_used}) - add_data_label(element,'net-'..science_pack,stats.minute_net,stats.minute_made+stats.minute_used,{'science-info.net-tooltip',stats.total_net}) + add_data_label(delta.table,'pos-'..science_pack,minute.made,nil,{'science-info.pos-tooltip',total.made}) + add_data_label(delta.table,'neg-'..science_pack,-minute.used,nil,{'science-info.neg-tooltip',total.used}) + add_data_label(element,'net-'..science_pack,minute.net,minute.made+minute.used,{'science-info.net-tooltip',total.net}) end end @@ -281,18 +235,9 @@ local function update_eta(player,element) for _,ingredient in pairs(research.research_unit_ingredients) do local pack_name = ingredient.name local required = ingredient.amount * remaining - local consumed = stats.get_flow_count{ - name=pack_name, - input=false, - precision_index=defines.flow_precision_index.one_minute, - } - if consumed == 0 then - limit = -1 - break - end - local minutes = required / consumed - if not limit or limit < minutes then - limit = minutes + local time = Production.get_consumsion_eta(force, pack_name, defines.flow_precision_index.one_minute, required) + if not limit or limit < time then + limit = time end end @@ -301,22 +246,22 @@ local function update_eta(player,element) element.tooltip = null_time_long else - local ticks = limit*3600 - element.caption = {'science-info.eta-time',format_time(ticks,{hours=true,minutes=true,seconds=true,time=true})} - element.tooltip = format_time(ticks,{hours=true,minutes=true,seconds=true,long=true}) + element.caption = {'science-info.eta-time',format_time(limit,{hours=true,minutes=true,seconds=true,time=true})} + element.tooltip = format_time(limit,{hours=true,minutes=true,seconds=true,long=true}) end end end ---- Registerse the new science info gui +--- Registers the science info +-- @element science_info local science_info = Gui.new_left_frame('gui/science-info') :set_sprites('entity/lab') :set_direction('vertical') :set_tooltip{'science-info.main-tooltip'} :on_creation(function(player,element) - local table, eta = generate_container(player,element) + local table, eta = generate_container(element) for _,science_pack in ipairs(config) do generate_science_pack(player,table,science_pack) diff --git a/modules/gui/task-list.lua b/modules/gui/task-list.lua index 2a4a4374..d82a3a77 100644 --- a/modules/gui/task-list.lua +++ b/modules/gui/task-list.lua @@ -1,62 +1,20 @@ ---- Adds a task list to the game which players can add remove and edit items on -local Gui = require 'expcore.gui' -local Store = require 'expcore.store' -local Global = require 'utils.global' -local Event = require 'utils.event' -local Roles = require 'expcore.roles' -local Token = require 'utils.token' -local config = require 'config.tasks' -local format_time,table_keys = ext_require('expcore.common','format_time','table_keys') +--[[-- Gui Module - Task List + - Adds a task list to the game which players can add remove and edit items on + @gui Task-List + @alias task_list +]] -local task_store = 'gui.left.task-list.tasks' - -local task_details = {} -local force_tasks = {} -Global.register({ - task_details=task_details, - force_tasks=force_tasks -},function(tbl) - task_details = tbl.task_details - force_tasks = tbl.force_tasks -end) - ---- Adds a new task for this force with this players name attached -local function add_task(player,task_number) - local task_id = tostring(Token.uid()) - - if not force_tasks[player.force.name] then - force_tasks[player.force.name] = {} - end - if task_number then - table.insert(force_tasks[player.force.name],task_number,task_id) - else - table.insert(force_tasks[player.force.name],task_id) - end - - task_details[task_id] = { - task_id=task_id, - force=player.force.name, - last_edit_player=player.name, - last_edit_time=game.tick, - editing={[player.name]=true} - } - - Store.set(task_store,task_id,'New task') -end - ---- Removes all refrences to a task -local function remove_task(task_id) - local force_name = task_details[task_id].force - Store.clear(task_store,task_id) - task_details[task_id] = nil - table.remove_element(force_tasks[force_name],task_id) -end +local Gui = require 'expcore.gui' --- @dep expcore.gui +local Event = require 'utils.event' --- @dep utils.event +local Roles = require 'expcore.roles' --- @dep expcore.roles +local config = require 'config.tasks' --- @dep config.tasks +local format_time,table_keys = ext_require('expcore.common','format_time','table_keys') --- @dep expcore.common +local Tasks = require 'modules.control.tasks' --- @dep modules.control.tasks --- If a player is allowed to use the edit buttons -local function player_allowed_edit(player,task_id) - if task_id then - local details = task_details[task_id] - if config.user_can_edit_own_tasks and details.last_edit_player == player.name then +local function player_allowed_edit(player,task) + if task then + if config.user_can_edit_own_tasks and task.last_edit_name == player.name then return true end else @@ -69,7 +27,7 @@ local function player_allowed_edit(player,task_id) return false end - if config.edit_tasks_role_permision and not Roles.player_allowed(player,config.edit_tasks_role_permision) then + if config.edit_tasks_role_permission and not Roles.player_allowed(player,config.edit_tasks_role_permission) then return false end @@ -77,7 +35,7 @@ local function player_allowed_edit(player,task_id) end --- Button in the header to add a new task -local update_all +-- @element add_new_task local add_new_task = Gui.new_button() :set_sprites('utility/add') @@ -88,10 +46,11 @@ Gui.new_button() style.width = 20 end) :on_click(function(player,element) - add_task(player) + Tasks.add_task(player.force.name,nil,player.name) end) --- Used to save changes to a task +-- @element confirm_edit local confirm_edit = Gui.new_button() :set_sprites('utility/downloaded') @@ -103,16 +62,13 @@ Gui.new_button() end) :on_click(function(player,element) local task_id = element.parent.name - local task = element.parent.task.text - local details = task_details[task_id] - details.editing[player.name] = nil - details.last_edit_player = player.name - details.last_edit_time = game.tick - Store.set(task_store,task_id,task) + local new_message = element.parent.task.text + Tasks.set_editing(task_id,player.name) + Tasks.update_task(task_id,new_message,player.name) end) --- Used to cancel any changes you made to a task -local generate_task +-- @element cancel_edit local cancel_edit = Gui.new_button() :set_sprites('utility/close_black') @@ -124,12 +80,11 @@ Gui.new_button() end) :on_click(function(player,element) local task_id = element.parent.name - local details = task_details[task_id] - details.editing[player.name] = nil - generate_task(player,element.parent.parent,task_id) + Tasks.set_editing(task_id,player.name) end) --- Removes the task from the list +-- @element discard_task local discard_task = Gui.new_button() :set_sprites('utility/trash') @@ -141,11 +96,11 @@ Gui.new_button() end) :on_click(function(player,element) local task_id = element.parent.name - remove_task(task_id) - update_all() + Tasks.remove_task(task_id) end) --- Opens edit mode for the task +-- @element edit_task local edit_task = Gui.new_button() :set_sprites('utility/rename_icon_normal') @@ -157,9 +112,7 @@ Gui.new_button() end) :on_click(function(player,element) local task_id = element.parent.name - local details = task_details[task_id] - details.editing[player.name] = true - generate_task(player,element.parent.parent.parent,task_id) + Tasks.set_editing(task_id,player.name,true) end) --[[ Generates each task, handles both view and edit mode @@ -174,23 +127,24 @@ end) >> edit_task >> discard_task ]] -function generate_task(player,element,task_id) - local task = Store.get(task_store,task_id) - local details = task_details[task_id] - local editing = details.editing[player.name] - local last_edit_player = details.last_edit_player - local last_edit_time = details.last_edit_time - local tasks = force_tasks[player.force.name] - local task_number = table.index_of(tasks, task_id) +local function generate_task(player,element,task_id) + local task = Tasks.get_task(task_id) + local task_ids = Tasks.get_force_task_ids(player.force.name) + local task_number = table.index_of(task_ids, task_id) if not task then -- task is nil so remove it from the list - element.parent.no_tasks.visible = #tasks == 01 - Gui.destory_if_valid(element['count-'..task_id]) - Gui.destory_if_valid(element['edit-'..task_id]) - Gui.destory_if_valid(element[task_id]) + element.parent.no_tasks.visible = #task_ids == 1 + Gui.destroy_if_valid(element['count-'..task_id]) + Gui.destroy_if_valid(element['edit-'..task_id]) + Gui.destroy_if_valid(element[task_id]) else + local message = task.message + local editing = task.curently_editing[player.name] + local last_edit_name = task.last_edit_name + local last_edit_time = task.last_edit_time + element.parent.no_tasks.visible = false -- if it is not already present then add it now local task_area = element[task_id] @@ -223,8 +177,8 @@ function generate_task(player,element,task_id) element['count-'..task_id].caption = task_number..')' local edit_area = element['edit-'..task_id][task_id] - local players = table_keys(details.editing) - local allowed = player_allowed_edit(player,task_id) + local players = table_keys(task.editing) + local allowed = player_allowed_edit(player,task) edit_area.visible = allowed @@ -238,8 +192,8 @@ function generate_task(player,element,task_id) local element_type = task_area.task and task_area.task.type or nil if not editing and element_type == 'label' then -- update the label already present - task_area.task.caption = task - task_area.task.tooltip = {'task-list.last-edit',last_edit_player,format_time(last_edit_time)} + task_area.task.caption = message + task_area.task.tooltip = {'task-list.last-edit',last_edit_name,format_time(last_edit_time)} elseif not editing then -- create the label, view mode @@ -253,14 +207,14 @@ function generate_task(player,element,task_id) task_area.add{ name='task', type='label', - caption=task, - tooltip={'task-list.last-edit',last_edit_player,format_time(last_edit_time)} + caption=message, + tooltip={'task-list.last-edit',last_edit_name,format_time(last_edit_time)} } label.style.single_line = false label.style.maximal_width = 150 elseif editing and element_type ~= 'textfield' then - -- create the text field, edit mode, update it omited as value is being edited + -- create the text field, edit mode, update it omitted as value is being edited if edit_area then edit_area[edit_task.name].enabled = false end @@ -271,7 +225,7 @@ function generate_task(player,element,task_id) task_area.add{ name='task', type='textfield', - text=task + text=message } entry.style.maximal_width = 150 entry.style.height = 20 @@ -342,7 +296,8 @@ local function generate_container(player,element) return flow_table end ---- Registeres the task list +--- Registers the task list +-- @element task_list local task_list = Gui.new_left_frame('gui/task-list') :set_sprites('utility/not_enough_repair_packs_icon') @@ -351,38 +306,42 @@ Gui.new_left_frame('gui/task-list') :set_open_by_default() :on_creation(function(player,element) local data_table = generate_container(player,element) - local force_name = player.force.name + local task_ids = Tasks.get_force_task_ids(player.force.name) - local tasks = force_tasks[force_name] or {} - for _,task_id in pairs(tasks) do + for _,task_id in pairs(task_ids) do generate_task(player,data_table,task_id) end end) :on_update(function(player,element) local data_table = element.container.scroll.table - local force_name = player.force.name + local task_ids = Tasks.get_force_task_ids(player.force.name) - local tasks = force_tasks[force_name] or {} - for _,task_id in pairs(tasks) do + for _,task_id in pairs(task_ids) do generate_task(player,data_table,task_id) end end) -update_all = task_list 'update_all' - --- When a new task is added it will udpate the task list for everyone on that force -Store.register(task_store,function(value,task_id) - local details = task_details[task_id] - local force = game.forces[details.force] +Tasks.on_update(function(task,task_id) + local players + if task then + local force = game.forces[task.force_name] + players = force.connected_players + else + players = game.connected_players + end - for _,player in pairs(force.players) do + for _,player in pairs(players) do local frame = task_list:get_frame(player) local element = frame.container.scroll.table generate_task(player,element,task_id) end end) ---- Makess sure the right buttons are present when roles change +--- Update the tasks when the player joins +Event.add(defines.events.on_player_joined_game,task_list 'redraw') + +--- Makes sure the right buttons are present when roles change Event.add(Roles.events.on_role_assigned,task_list 'redraw') Event.add(Roles.events.on_role_unassigned,task_list 'redraw') diff --git a/modules/gui/warp-list.lua b/modules/gui/warp-list.lua index eb9688b6..d5d12a4f 100644 --- a/modules/gui/warp-list.lua +++ b/modules/gui/warp-list.lua @@ -1,40 +1,39 @@ -local Gui = require 'expcore.gui' -local Store = require 'expcore.store' -local Global = require 'utils.global' -local Event = require 'utils.event' -local Game = require 'utils.game' -local Roles = require 'expcore.roles' -local Token = require 'utils.token' -local Colors = require 'resources.color_presets' -local config = require 'config.warps' -local format_time,table_keys,table_values,table_keysort = ext_require('expcore.common','format_time','table_keys','table_values','table_keysort') +--[[-- Gui Module - Warp List + - Adds a warp list gui which allows players to add and remove warp points + @gui Warps-List + @alias warp_list +]] -local warp_list -local warp_name_store = 'gui.left.warps.names' -local warp_icon_store = 'gui.left.warps.tags' -local warp_player_in_range_store = 'gui.left.warps.in_range' +local Gui = require 'expcore.gui' --- @dep expcore.gui +local Store = require 'expcore.store' --- @dep expcore.store +local Global = require 'utils.global' --- @dep utils.global +local Event = require 'utils.event' --- @dep utils.event +local Game = require 'utils.game' --- @dep utils.game +local Roles = require 'expcore.roles' --- @dep expcore.roles +local Colors = require 'resources.color_presets' --- @dep resources.color_presets +local config = require 'config.warps' --- @dep config.warps +local format_time,table_keys = ext_require('expcore.common','format_time','table_keys') --- @dep expcore.common +local Warps = require 'modules.control.warps' --- @dep modules.control.warps -local warp_details = {} -local force_warps = {} -local keep_open = {} -Global.register({ - warp_details=warp_details, - force_warps=force_warps, - keep_open=keep_open -},function(tbl) - force_warps = tbl.force_warps - warp_details = tbl.warp_details - keep_open = tbl.keep_open +-- Stores a boolean value indexed by player name +local player_in_range_store = Store.register(function(player) + return player.name +end) + +-- Table that stores a boolean value of weather to keep the warp gui open +local keep_gui_open = {} +Global.register(keep_gui_open,function(tbl) + keep_gui_open = tbl end) --- Returns if a player is allowed to edit the given warp -local function player_allowed_edit(player,warp_id) - if warp_id then - local details = warp_details[warp_id] - if not details.editing then +local function player_allowed_edit(player,warp) + if warp then + local spawn_id = Warps.get_spawn_warp_id(player.force.name) + if spawn_id == warp.warp_id then return false end - if config.user_can_edit_own_warps and details.last_edit_player == player.name then + if config.user_can_edit_own_warps and warp.last_edit_name == player.name then return true end else @@ -47,225 +46,41 @@ local function player_allowed_edit(player,warp_id) return false end - if config.edit_warps_role_permision and not Roles.player_allowed(player,config.edit_warps_role_permision) then + if config.edit_warps_role_permission and not Roles.player_allowed(player,config.edit_warps_role_permission) then return false end return true end ---- Makes a map marker for this warp; updates it if already present -local function make_warp_tag(warp_id) - local warp = warp_details[warp_id] - if not warp then return end - - local icon = Store.get(warp_icon_store,warp_id) - local name = Store.get(warp_name_store,warp_id) - - if warp.tag and warp.tag.valid then - warp.tag.text = 'Warp: '..name - warp.tag.icon = {type='item',name=icon} - return - end - - local force = game.forces[warp.force] - local surface = warp.surface - local position = warp.position - - local tag = force.add_chart_tag(surface,{ - position={position.x+0.5,position.y+0.5}, - text='Warp: '..name, - icon={type='item',name=icon} - }) - - warp.tag = tag -end - --- This creates the area for the warp; this is not required but helps players know where the warps are -local function make_warp_area(warp_id) - local warp = warp_details[warp_id] - if not warp then return end - - local position = warp.position - local posx = position.x - local posy = position.y - local surface = warp.surface - local radius = config.activation_range - local radius2 = radius^2 - - local old_tile = surface.get_tile(position).name - warp.old_tile = old_tile - - local base_tile = config.base_tile - local base_tiles = {} - -- this makes a base plate to make the warp point - for x = -radius, radius do - local x2 = x^2 - for y = -radius, radius do - local y2 = y^2 - if x2+y2 < radius2 then - table.insert(base_tiles,{name=base_tile,position={x+posx,y+posy}}) - end - end - end - surface.set_tiles(base_tiles) - - -- this adds the tile pattern - local tiles = {} - for _,pos in pairs(config.tiles) do - table.insert(tiles,{name=base_tile,position={pos[1]+posx,pos[2]+posy}}) - end - surface.set_tiles(tiles) - - -- this adds the enitites - for _,entity in pairs(config.entities) do - entity = surface.create_entity{ - name=entity[1], - position={entity[2]+posx,entity[3]+posy}, - force='neutral' - } - entity.destructible = false - entity.health = 0 - entity.minable = false - entity.rotatable = false - end -end - ---- This removes the warp area, also restores the old tile -local function clear_warp_area(warp_id) - local warp = warp_details[warp_id] - if not warp then return end - - local position = warp.position - local surface = warp.surface - local radius = config.activation_range - local radius2 = radius^2 - - local base_tile = warp.old_tile - local tiles = {} - -- clears the area where the warp was - for x = -radius, radius do - local x2 = x^2 - for y = -radius, radius do - local y2 = y^2 - if x2+y2 < radius2 then - table.insert(tiles,{name=base_tile,position={x+position.x,y+position.y}}) - end - end - end - surface.set_tiles(tiles) - - -- removes all entites (in the area) on the neutral force - local entities = surface.find_entities_filtered{ - force='neutral', - area={ - {position.x-radius,position.y-radius}, - {position.x+radius,position.y+radius} - } - } - for _,entity in pairs(entities) do if entity.name ~= 'player' then entity.destroy() end end - - if warp.tag and warp.tag.valid then warp.tag.destroy() end -end - ---- Speaial case for the warps; adds the spawn warp which cant be removed -local function add_spawn(player) - local warp_id = tostring(Token.uid()) - local force = player.force - local force_name = force.name - local surface = player.surface - local spawn = force.get_spawn_position(surface) - - if not force_warps[force_name] then - force_warps[force_name] = {} - end - table.insert(force_warps[force_name],warp_id) - - warp_details[warp_id] = { - warp_id = warp_id, - force = force.name, - position = { - x=math.floor(spawn.x), - y=math.floor(spawn.y) - }, - surface = surface, - last_edit_player='System', - last_edit_time=game.tick, - editing=false - } - - Store.set(warp_name_store,warp_id,'Spawn') - Store.set(warp_icon_store,warp_id,config.default_icon) -end - ---- General case for the warps; will make a new warp and set the player to be editing it -local function add_warp(player) - local warp_id = tostring(Token.uid()) - local force_name = player.force.name - - if not force_warps[force_name] then - add_spawn(player) - end - table.insert(force_warps[force_name],warp_id) - - local position = player.position - - warp_details[warp_id] = { - warp_id = warp_id, - force = force_name, - position = { - x=math.floor(position.x), - y=math.floor(position.y) - }, - surface = player.surface, - last_edit_player=player.name, - last_edit_time=game.tick, - editing={[player.name]=true} - } - - Store.set(warp_name_store,warp_id,'New warp') - Store.set(warp_icon_store,warp_id,config.default_icon) - - make_warp_area(warp_id) -end - ---- Removes all refrences to a warp -local function remove_warp(warp_id) - local force_name = warp_details[warp_id].force - local key = table.index_of(force_warps[force_name],warp_id) - force_warps[force_name][key] = nil - Store.clear(warp_name_store,warp_id) - Store.clear(warp_icon_store,warp_id) - warp_details[warp_id] = nil -end - --- Used on the name label to allow zoom to map +-- @element zoom_to_map local zoom_to_map_name = Gui.uid_name() Gui.on_click(zoom_to_map_name,function(event) local warp_id = event.element.parent.name - local warp = warp_details[warp_id] + local warp = Warps.get_warp(warp_id) local position = warp.position event.player.zoom_to_world(position,1.5) end) --- This timer controls when a player is able to warp, eg every 60 seconds +-- @element warp_timer local warp_timer = Gui.new_progressbar() :set_tooltip{'warp-list.timer-tooltip',config.recharge_time} -:set_default_maximum(math.floor(config.recharge_time*config.update_smothing)) +:set_default_maximum(math.floor(config.recharge_time*config.update_smoothing)) :add_store(Gui.categorize_by_player) :set_style(nil,function(style) style.horizontally_stretchable = true style.color = Colors.light_blue end) :on_store_complete(function(player_name,reset) - -- this is to force an update of the button - local in_range = Store.get(warp_player_in_range_store,player_name) - Store.set(warp_player_in_range_store,player_name,in_range) + Store.trigger(player_in_range_store,player_name) end) --- When the button is clicked it will teleport the player +-- @element goto_warp local goto_warp = Gui.new_button() :set_sprites('item/'..config.default_icon) @@ -276,26 +91,17 @@ Gui.new_button() end) :on_click(function(player,element) local warp_id = element.parent.caption - local warp = warp_details[warp_id] - local surface = warp.surface - local position = { - x=warp.position.x+0.5, - y=warp.position.y+0.5 - } + Warps.teleport_player(warp_id,player) - local goto_position = surface.find_non_colliding_position('character',position,32,1) - if player.driving then player.driving = false end - player.teleport(goto_position,surface) - - if config.bypass_warp_limits_permision and not Roles.player_allowed(player,config.bypass_warp_limits_permision) then + -- Reset the warp cooldown if the player does not have unlimited warps + if config.bypass_warp_limits_permission and not Roles.player_allowed(player,config.bypass_warp_limits_permission) then warp_timer:set_store(player.name,0) - -- this is to force an update of the buttons - local in_range = Store.get(warp_player_in_range_store,player.name) - Store.set(warp_player_in_range_store,player.name,in_range) + Store.trigger(player_in_range_store,player) end end) --- Will add a new warp to the list, checks if the player is too close to an existing one +-- @element add_new_warp local add_new_warp = Gui.new_button() :set_sprites('utility/add') @@ -306,26 +112,32 @@ Gui.new_button() style.width = 20 end) :on_click(function(player,element) + local force_name = player.force.name + local surface = player.surface local position = player.position - local posx = position.x - local posy = position.y + local px = position.x + local py = position.y local dist2 = config.minimum_distance^2 - local warps = Store.get_children(warp_name_store) - for _,warp_id in pairs(warps) do - local warp = warp_details[warp_id] + -- Check the distance to all existing warps + local warp_ids = Warps.get_force_warp_ids(force_name) + for _,warp_id in pairs(warp_ids) do + local warp = Warps.get_warp(warp_id) local pos = warp.position - if (posx-pos.x)^2+(posy-pos.y)^2 < dist2 then - local warp_name = Store.get(warp_name_store,warp_id) - player.print{'warp-list.too-close',warp_name} + if surface == warp.surface and (px-pos.x)^2+(py-pos.y)^2 < dist2 then + player.print{'warp-list.too-close',warp.name} return end end - add_warp(player) + -- Add the new warp + local warp_id = Warps.add_warp(force_name,surface,position,player.name) + Warps.make_warp_tag(warp_id) + Warps.make_warp_area(warp_id) end) --- Confirms the edit to name or icon of the warp +-- @element confirm_edit local confirm_edit = Gui.new_button() :set_sprites('utility/downloaded') @@ -339,16 +151,12 @@ end) local warp_id = element.parent.name local warp_name = element.parent.warp.text local warp_icon = element.parent.parent['icon-'..warp_id].icon.elem_value - local warp = warp_details[warp_id] - warp.editing[player.name] = nil - warp.last_edit_player = player.name - warp.last_edit_time = game.tick - Store.set(warp_name_store,warp_id,warp_name) - Store.set(warp_icon_store,warp_id,warp_icon) + Warps.set_editing(warp_id,player.name) + Warps.update_warp(warp_id,warp_name,warp_icon,player.name) end) --- Cancels the editing changes of the selected warp name or icon -local generate_warp +-- @element cancel_edit local cancel_edit = Gui.new_button() :set_sprites('utility/close_black') @@ -360,12 +168,11 @@ Gui.new_button() end) :on_click(function(player,element) local warp_id = element.parent.name - local details = warp_details[warp_id] - details.editing[player.name] = nil - generate_warp(player,element.parent.parent,warp_id) + Warps.set_editing(warp_id,player.name) end) --- Removes a warp from the list, including the physical area and map tag +-- @element discard_warp local discard_warp = Gui.new_button() :set_sprites('utility/trash') @@ -377,10 +184,11 @@ Gui.new_button() end) :on_click(function(player,element) local warp_id = element.parent.name - remove_warp(warp_id) + Warps.remove_warp(warp_id) end) --- Opens edit mode for the warp +-- @element edit_warp local edit_warp = Gui.new_button() :set_sprites('utility/rename_icon_normal') @@ -392,12 +200,10 @@ Gui.new_button() end) :on_click(function(player,element) local warp_id = element.parent.name - local details = warp_details[warp_id] - details.editing[player.name] = true - generate_warp(player,element.parent.parent.parent,warp_id) + Warps.set_editing(warp_id,player.name,true) end) ---[[ Generates each task, handles both view and edit mode +--[[ Generates each warp, handles both view and edit mode element > icon-"warp_id" >> goto_warp or icon @@ -410,23 +216,22 @@ end) >>> edit_warp >>> discard_warp ]] -function generate_warp(player,element,warp_id) - local warp_name = Store.get(warp_name_store,warp_id) - local warp_icon = Store.get(warp_icon_store,warp_id) or config.default_icon - local warp = warp_details[warp_id] - - local editing = warp.editing and warp.editing[player.name] - local last_edit_player = warp.last_edit_player - local last_edit_time = warp.last_edit_time - local position = warp.position - - if not warp_name then - -- task is nil so remove it from the list - Gui.destory_if_valid(element['icon-'..warp_id]) - Gui.destory_if_valid(element['edit-'..warp_id]) - Gui.destory_if_valid(element[warp_id]) +local function generate_warp(player,element,warp_id) + local warp = Warps.get_warp(warp_id) + if not warp then + -- warp is nil so remove it from the list + Gui.destroy_if_valid(element['icon-'..warp_id]) + Gui.destroy_if_valid(element['edit-'..warp_id]) + Gui.destroy_if_valid(element[warp_id]) else + local warp_name = warp.name + local warp_icon = warp.icon + local editing = warp.currently_editing[player.name] + local last_edit_name = warp.last_edit_name + local last_edit_time = warp.last_edit_time + local position = warp.position + -- if it is not already present then add it now local warp_area = element[warp_id] local icon_area = element['icon-'..warp_id] @@ -440,7 +245,7 @@ function generate_warp(player,element,warp_id) } Gui.set_padding(icon_area) - -- area which stores the task and buttons + -- area which stores the warp and buttons warp_area = element.add{ name=warp_id, @@ -458,15 +263,15 @@ function generate_warp(player,element,warp_id) end local edit_area = element['edit-'..warp_id][warp_id] - local players = warp.editing and table_keys(warp.editing) or {} - local allowed = player_allowed_edit(player,warp_id) + local players = warp.currently_editing and table_keys(warp.currently_editing) or {} + local allowed = player_allowed_edit(player,warp) edit_area.visible = allowed if #players > 0 then - edit_area[edit_warp.name].tooltip = {'task-list.edit-tooltip',table.concat(players,', ')} + edit_area[edit_warp.name].tooltip = {'warp-list.edit-tooltip',table.concat(players,', ')} else - edit_area[edit_warp.name].tooltip = {'task-list.edit-tooltip-none'} + edit_area[edit_warp.name].tooltip = {'warp-list.edit-tooltip-none'} end -- draws/updates the warp area @@ -475,7 +280,7 @@ function generate_warp(player,element,warp_id) if not editing and element_type == 'label' then -- update the label already present label_element.caption = warp_name - label_element.tooltip = {'warp-list.last-edit',last_edit_player,format_time(last_edit_time)} + label_element.tooltip = {'warp-list.last-edit',last_edit_name,format_time(last_edit_time)} icon_area[goto_warp.name].sprite = 'item/'..warp_icon elseif not editing then @@ -492,8 +297,8 @@ function generate_warp(player,element,warp_id) btn.tooltip = {'warp-list.goto-tooltip',position.x,position.y} local timer = warp_timer:get_store(player.name) - local enabled = not timer and Store.get(warp_player_in_range_store,player.name) - or Roles.player_allowed(player,config.bypass_warp_limits_permision) + local enabled = not timer and Store.get(player_in_range_store,player) + or Roles.player_allowed(player,config.bypass_warp_limits_permission) if not enabled then btn.enabled = false btn.tooltip = {'warp-list.goto-disabled'} @@ -507,13 +312,13 @@ function generate_warp(player,element,warp_id) name=zoom_to_map_name, type='label', caption=warp_name, - tooltip={'warp-list.last-edit',last_edit_player,format_time(last_edit_time)} + tooltip={'warp-list.last-edit',last_edit_name,format_time(last_edit_time)} } label.style.single_line = false label.style.maximal_width = 150 elseif editing and element_type ~= 'textfield' then - -- create the text field, edit mode, update it omited as value is being edited + -- create the text field, edit mode, update it omitted as value is being edited if edit_area then edit_area[edit_warp.name].enabled = false end @@ -557,7 +362,7 @@ end element > container >> header - >>> right aligned add_new_task + >>> right aligned add_new_warp >> scroll >>> table >> warp_timer @@ -601,79 +406,74 @@ local function generate_container(player,element) end --- Registers the warp list -warp_list = +-- @element warp_list +local warp_list = Gui.new_left_frame('gui/warp-list') :set_sprites('item/'..config.default_icon) :set_tooltip{'warp-list.main-tooltip',config.activation_range} :set_direction('vertical') :on_creation(function(player,element) local data_table = generate_container(player,element) - local force_name = player.force.name + local warp_ids = Warps.get_force_warp_ids(player.force.name) - local warps = force_warps[force_name] or {} - for _,warp_id in pairs(warps) do + for _,warp_id in ipairs(warp_ids) do generate_warp(player,data_table,warp_id) end end) :on_update(function(player,element) local data_table = element.container.scroll.table - local force_name = player.force.name + local warp_ids = Warps.get_force_warp_ids(player.force.name) data_table.clear() - - local warps = force_warps[force_name] or {} - for _,warp_id in pairs(warps) do + for _,warp_id in ipairs(warp_ids) do generate_warp(player,data_table,warp_id) end end) :on_player_toggle(function(player,element,visible) - keep_open[player.name] = visible + keep_gui_open[player.name] = visible end) --- When the name of a warp is updated this is triggered -Store.register(warp_name_store,function(value,warp_id) - local warp = warp_details[warp_id] - local force = game.forces[warp.force] - - local names = {} - local spawn_id - for _,_warp_id in pairs(force_warps[force.name]) do - local name = Store.get(warp_name_store,_warp_id) - if not warp_details[_warp_id].editing then - spawn_id = _warp_id - else - names[name.._warp_id] = _warp_id - end +Warps.on_update(function(warp) + local players + local force_name + if warp then + local force = game.forces[warp.force_name] + players = force.connected_players + force_name = warp.force_name + else + players = game.connected_players end - force_warps[force.name] = table_values(table_keysort(names)) - table.insert(force_warps[force.name],1,spawn_id) - - for _,player in pairs(force.players) do - warp_list:update(player) - end -end) - ---- When the icon is updated this is called -Store.register(warp_icon_store,function(value,warp_id) - local warp = warp_details[warp_id] - local force = game.forces[warp.force] - - for _,player in pairs(force.players) do + -- Update the gui for selected players + local force_warps = {} + for _,player in pairs(players) do local frame = warp_list:get_frame(player) local element = frame.container.scroll.table - generate_warp(player,element,warp_id) - end - if value then - make_warp_tag(warp_id) - else - clear_warp_area(warp_id) + -- Get the warp ids for the players force + force_name = force_name or player.force.name + local warp_ids = force_warps[force_name] + if not warp_ids then + warp_ids = Warps.get_force_warp_ids(force_name) + force_warps[force_name] = warp_ids + end + + -- Update the gui + element.clear() + for _,warp_id in ipairs(warp_ids) do + generate_warp(player,element,warp_id) + end end end) +--- Update the warps when the player joins +Event.add(defines.events.on_player_joined_game,warp_list 'redraw') +Event.add(Roles.events.on_role_assigned,warp_list 'redraw') +Event.add(Roles.events.on_role_unassigned,warp_list 'redraw') + --- When the player leaves or enters range of a warp this is triggered -Store.register(warp_player_in_range_store,function(value,player_name) +Store.watch(player_in_range_store,function(value,player_name) local player = game.players[player_name] local force = player.force local frame = warp_list:get_frame(player_name) @@ -681,25 +481,24 @@ Store.register(warp_player_in_range_store,function(value,player_name) local timer = warp_timer:get_store(player_name) local state = not timer and value - if not keep_open[player.name] then + if not keep_gui_open[player.name] then Gui.toggle_left_frame(warp_list.name,player,value) end - if Roles.player_allowed(player,config.bypass_warp_limits_permision) then + if Roles.player_allowed(player,config.bypass_warp_limits_permission) then return end - if force_warps[force.name] then - for _,warp_id in pairs(force_warps[force.name]) do - local element = table_area['icon-'..warp_id][goto_warp.name] - if element and element.valid then - element.enabled = state - if state then - local position = warp_details[warp_id].position - element.tooltip = {'warp-list.goto-tooltip',position.x,position.y} - else - element.tooltip = {'warp-list.goto-disabled'} - end + local warp_ids = Warps.get_force_warp_ids(force.name) + for _,warp_id in pairs(warp_ids) do + local element = table_area['icon-'..warp_id][goto_warp.name] + if element and element.valid then + element.enabled = state + if state then + local position = Warps.get_warp(warp_id).position + element.tooltip = {'warp-list.goto-tooltip',position.x,position.y} + else + element.tooltip = {'warp-list.goto-disabled'} end end end @@ -708,39 +507,61 @@ end) --- Handles updating the timer and checking distance from a warp local r2 = config.activation_range^2 local rs2 = config.spawn_activation_range^2 -Event.on_nth_tick(math.floor(60/config.update_smothing),function() - local categories = Store.get_children(warp_timer.store) - for _,category in pairs(categories) do +Event.on_nth_tick(math.floor(60/config.update_smoothing),function() + local categories = Store.get(warp_timer.store) or {} + for category,_ in pairs(categories) do warp_timer:increment(1,category) end + local force_warps = {} + local warps = {} for _,player in pairs(game.connected_players) do - local was_in_range = Store.get(warp_player_in_range_store,player.name) - local force = player.force - local warps = force_warps[force.name] + local was_in_range = Store.get(player_in_range_store,player) - if warps then - local surface = player.surface.index + -- Get the ids of all the warps on the players force + local force_name = player.force.name + local warp_ids = force_warps[force_name] + if not warp_ids then + warp_ids = Warps.get_force_warp_ids(force_name) + force_warps[force_name] = warp_ids + end + + -- Check if the force has any warps + if #warp_ids > 0 then + local surface = player.surface local pos = player.position local px,py = pos.x,pos.y - for _,warp_id in pairs(warps) do - local warp = warp_details[warp_id] - local wpos = warp.position - if warp.surface.index == surface then - local dx,dy = px-wpos.x,py-wpos.y - if not warp.editing and (dx*dx)+(dy*dy) < rs2 or (dx*dx)+(dy*dy) < r2 then + + -- Loop over each warp + for _,warp_id in ipairs(warp_ids) do + -- Check if warp id is chached + local warp = warps[warp_id] + if not warp then + warp = Warps.get_warp(warp_id) + warps[warp_id] = warp + end + + -- Check if the player is within range + local warp_pos = warp.position + if warp.surface == surface then + local dx, dy = px-warp_pos.x, py-warp_pos.y + if (warp_id == warp_ids.spawn and (dx*dx)+(dy*dy) < rs2) or (dx*dx)+(dy*dy) < r2 then + -- Set in range to true if the player was preiovusly out of range if not was_in_range then - Store.set(warp_player_in_range_store,player.name,true) + Store.set(player_in_range_store,player,true) end - return + was_in_range = false -- stops setting back to false below + break end end end - if was_in_range then - Store.set(warp_player_in_range_store,player.name,false) - end - end + -- Set in range to false if the player was preiovusly in range + if was_in_range then + Store.set(player_in_range_store,player,false) + end + + end end @@ -749,32 +570,39 @@ end) --- When a player is created it will set them being in range to false to stop warping on join Event.add(defines.events.on_player_created,function(event) local player = Game.get_player_by_index(event.player_index) - local force_name = player.force.name - local allowed = config.bypass_warp_limits_permision and Roles.player_allowed(player,config.bypass_warp_limits_permision) or false - Store.set(warp_player_in_range_store,player.name,allowed) + -- Check if a player is allowed unlimited warps + local allowed = config.bypass_warp_limits_permission and Roles.player_allowed(player,config.bypass_warp_limits_permission) or false + Store.set(player_in_range_store,player,allowed) if allowed then warp_timer:set_store(player.name,1) end - if not force_warps[force_name] then - add_spawn(player) + -- If the force has no spawn then make a spawn warp + local force = player.force + local spawn_id = Warps.get_spawn_warp_id(force.name) + if not spawn_id then + local spawn_position = force.get_spawn_position(player.surface) + spawn_id = Warps.add_warp(force.name,player.surface,spawn_position,nil,'Spawn') + Warps.set_spawn_warp(spawn_id,force) + Store.trigger(Warps.store,spawn_id) + Warps.make_warp_tag(spawn_id) end end) local function maintain_tag(event) + if not event.player_index then return end local tag = event.tag - local force = event.force - local warps = force_warps[force.name] - if warps then - for _,warp_id in pairs(warps) do - local warp = warp_details[warp_id] - if not warp.tag or not warp.tag.valid or warp.tag == tag then - if event.name == defines.events.on_chart_tag_removed then - warp.tag = nil - end - make_warp_tag(warp_id) + local force_name = event.force.name + local warp_ids = Warps.get_force_warp_ids(force_name) + for _,warp_id in pairs(warp_ids) do + local warp = Warps.get_warp(warp_id) + local wtag = warp.tag + if not wtag or not wtag.valid or wtag == tag then + if event.name == defines.events.on_chart_tag_removed then + warp.tag = nil end + Warps.make_warp_tag(warp_id) end end end diff --git a/old/locale/en/DeconControl.cfg b/old/locale/en/DeconControl.cfg deleted file mode 100644 index 556c1f3a..00000000 --- a/old/locale/en/DeconControl.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[DeconControl] -player-print=You do not have permission to do this right now. You require the Regular rank which can be obtained through 3 hours of in-game playtime on a server. -rank-print=__1__ tried to deconstruct something. diff --git a/old/locale/en/ExpGamingAdmin.AdminLib.cfg b/old/locale/en/ExpGamingAdmin.AdminLib.cfg deleted file mode 100644 index f240bac1..00000000 --- a/old/locale/en/ExpGamingAdmin.AdminLib.cfg +++ /dev/null @@ -1,21 +0,0 @@ -[ExpGamingAdmin] -name=Admin Commands -tooltip=Admin commands make their home here -no-info-file=No info file was found -message=Please select a player and an action to take. Make sure to choose the correct one! -warning=Warning: This player outranks you. Therefore, you cannot edit their rank. -short-reason=Warning: The reason is too short. -rank-high=Warning: This player outranks you. Therefore, you cannot edit their rank. -invalid=The player or the action is invalid. Please try again! -take-action=Take Action -tooltip-ban=Ban Player -tooltip-kick=Kick Player -tooltip-jail=Jail Player -tooltip-go-to=Go To Player -tooltip-bring=Bring Player -temp-ban=__1__ was temporary banned by __2__ and will remain in jail until next reset -report=Report Player -cant-report-ban=Invalid player as player is banned; Either unban or use /clear-all -low-print=__1__ has been reported by a user for: __2__ -high-print=__1__ has been reported by __2__ for: __3__ -cant-report=This player can't be reported. \ No newline at end of file diff --git a/old/locale/en/ExpGamingAdmin.Warnings.cfg b/old/locale/en/ExpGamingAdmin.Warnings.cfg deleted file mode 100644 index 01715fc7..00000000 --- a/old/locale/en/ExpGamingAdmin.Warnings.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[ExpGamingAdmin-Warnings] -warning-given-by=This warning was given by: __1__ -player-warning=__1__ was given a warning by __2__ for: __3__ -remove-warn=One of your warnings expired. You have __1__ warnings left, next warning will be removed in __2__ -message=You are currently being warned by the system. These will continue until you cease and desist. -reported=You have been reported to the admins by the system. Further action may be taken if you do not cease and desist. -kick-warn=This is your last warning before you get kicked. The system will automatically kick you if you do not cease and desist. -temp-warn=This is your last warning before you get temporary banned. The system will automatically ban you if you do not cease and desist. -ban-warn=WARNING: This is your last warning before you get BANNED. The system will automatically BAN you if you do not cease and desist. -last-warn=WARNING: This is your last warning before you get PERMANENTLY BANNED. The system will automatically PERMANENTLY BAN you if you do not cease and desist. diff --git a/old/locale/en/ExpGamingAdmin.cfg b/old/locale/en/ExpGamingAdmin.cfg deleted file mode 100644 index f240bac1..00000000 --- a/old/locale/en/ExpGamingAdmin.cfg +++ /dev/null @@ -1,21 +0,0 @@ -[ExpGamingAdmin] -name=Admin Commands -tooltip=Admin commands make their home here -no-info-file=No info file was found -message=Please select a player and an action to take. Make sure to choose the correct one! -warning=Warning: This player outranks you. Therefore, you cannot edit their rank. -short-reason=Warning: The reason is too short. -rank-high=Warning: This player outranks you. Therefore, you cannot edit their rank. -invalid=The player or the action is invalid. Please try again! -take-action=Take Action -tooltip-ban=Ban Player -tooltip-kick=Kick Player -tooltip-jail=Jail Player -tooltip-go-to=Go To Player -tooltip-bring=Bring Player -temp-ban=__1__ was temporary banned by __2__ and will remain in jail until next reset -report=Report Player -cant-report-ban=Invalid player as player is banned; Either unban or use /clear-all -low-print=__1__ has been reported by a user for: __2__ -high-print=__1__ has been reported by __2__ for: __3__ -cant-report=This player can't be reported. \ No newline at end of file diff --git a/old/locale/en/ExpGamingBot.autoChat.cfg b/old/locale/en/ExpGamingBot.autoChat.cfg deleted file mode 100644 index 4afb021d..00000000 --- a/old/locale/en/ExpGamingBot.autoChat.cfg +++ /dev/null @@ -1,48 +0,0 @@ -[ExpGamingBot-autoChat] -message=[Chat Bot]: __1__ -rank-error=You can't use global chat commands -players-online=There are __1__ players online -players=There have been __1__ players on this map -map-time=This map has been on for __1__ -line-8=Type /help for more info -join-us=Please join us on: -discord=Discord: https://discord.explosivegaming.nl -website=Website: https://www.explosivegaming.nl -custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info. -read-readme=Make sure you have read the Readme (It can be found through the question mark on the top left) -not-real-dev=Cooldude2606 is a dev for this server and makes the softmod (look top left) and is not a factorio dev. -softmod=A softmod is a custom scenario that runs on this server, example is the player list. -redmew=We dont talk about redmew here; they beat us to 1000 members; F -blame=Blame __1__ for what just happend! -afk=Your afk? Look at __1__, that player has been afk for: __2__ -links=To see links open the readme and click links. -current-evolution=Current evolution factor is __1__ -magic=Fear the admin magic (ノ゚∀゚)ノ⌒・*:.。. .。.:*・゜゚・*☆ -aids=≖ ‿ ≖ Fear the aids of a public server ≖ ‿ ≖ -riot=(admins) ┬┴┬┴┤ᵒ_ᵒ)├┬┴┬┴ ‹ ‹\(´ω` )/››‹‹\ (  ´)/››‹‹\ ( ´ω`)/›› (rest of server) -loops=NO LOOPS; LOOPS ARE BAD; JUST NO LOOPS!!!!!; IF YOU MAKE A LOOP.... IT WILL NOT END WELL!!!!!!! -lenny=( ͡° ͜ʖ ͡°) -make-tea-1= ☕ Boiling the water... ☕ -make-tea-2= ☕ __1__ your tea is done! ☕ -order-pizza-1= 🍕 Finding nearest pizza supplier... 🍕 -order-pizza-2= 🍕 Figuring out the favourite pizza of __1__ 🍕 -order-pizza-3= 🍕 __1__ your pizza is here! 🍕 -make-coffee-1= ☕ Boiling the water and grinding the coffee beans... ☕ -make-coffee-2= ☕ __1__ we ran out of coffe beans! Have some tea instead. ☕ -get-beer-1= 🍺 Pouring A Glass 🍺 -get-beer-2= 🍻 Chears Mate 🍻 -get-mead-1= Filling the drinking horn -get-mead-2= Skål! -get-snaps-1=Pouring the glasses and finding the correct song book... -get-snaps-2=Singing a song...🎤🎶 -get-snaps-3=skål, my friends! -get-cocktail-1= 🍸 Inintiating mind reading unit... 🍸 -get-cocktail-2= 🍸 Mixing favourite ingredients of __1__ 🍸 -get-cocktail-3=🍸 __1__ your cocktail is done.🍸 -lhd=All trains must be LHD! -food=Don't know what to make for dinner? Use a random recipe from the random dinner suggestion generator at http://www.whatthefuckshouldimakefordinner.com/ -get-popcorn-1=Heating the oil and waiting for the popping sound... -get-popcorn-2=__1__ your popcorn is finished. Lean backwards and watch the drama unfold. -wiki=You can get more information about us and the custom scenario from our wiki: https://wiki.explosivegaming.nl/ -feedback=Do you have feedback? leave it at https://exp.fider.io/ -hodor=Hodor \ No newline at end of file diff --git a/old/locale/en/ExpGamingBot.autoMessage.cfg b/old/locale/en/ExpGamingBot.autoMessage.cfg deleted file mode 100644 index c67078a9..00000000 --- a/old/locale/en/ExpGamingBot.autoMessage.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[ExpGamingBot-autoMessage] -message=[Chat Bot]: __1__ -players-online=There are __1__ players online -map-time=This map has been on for __1__ -join-us=Please join us on: -discord=Discord: https://discord.explosivegaming.nl -website=Website: https://www.explosivegaming.nl -custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info. -read-readme=Make sure you have read the Readme (It can be found through the question mark on the top left) \ No newline at end of file diff --git a/old/locale/en/ExpGamingCommands.home.cfg b/old/locale/en/ExpGamingCommands.home.cfg deleted file mode 100644 index e70a2161..00000000 --- a/old/locale/en/ExpGamingCommands.home.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[ExpGamingCommands-home] -too-many-homes=You have too many homes, to add more you must remove one. Your max is __1__. -homes=Your Homes: (__1__/__2__) -home=__1__) __2__: __3__ , __4__ -set=Your home "__1__" as been set to __2__ , __3__ -remove=Your home "__1__" as been removed -goto=You are now at "__1__" -return=You are now at your previous location: __1__ , __2__ -invalid=Invalid name, __1__ \ No newline at end of file diff --git a/old/locale/en/ExpGamingCore.Command.cfg b/old/locale/en/ExpGamingCore.Command.cfg deleted file mode 100644 index 66af8ae2..00000000 --- a/old/locale/en/ExpGamingCore.Command.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[expcore-commands] -unauthorized=Unauthorized, Access is denied due to invalid credentials -error-string-list=Invalid Option, Must be one of: __1__ -error-string-len=Invalid Length, Max: __1__ -error-number=Invalid Number -error-number-range=Invalid Range, Min (exclusive): __1__, Max (inclusive): __2__ -error-player=Invaild Player Name, __1__ ,try using tab key to auto-complete the name -error-player-online=Player is offline. -error-player-alive=Player is dead. -error-player-rank=Player is of Higher Rank. -invalid-inputs=Invalid Input, /__1__ __2__ -invalid-parse=Invalid Input, There was a problem prasing the paramaters -command-ran=Command Complete -command-fail=Command failed to run: __1__ \ No newline at end of file diff --git a/old/locale/en/ExpGamingCore.Gui.cfg b/old/locale/en/ExpGamingCore.Gui.cfg deleted file mode 100644 index f7eb1a6a..00000000 --- a/old/locale/en/ExpGamingCore.Gui.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingCore_Gui] -unauthorized=401 - Unauthorized: Access is denied due to invalid credentials -cant-open=You can't open this panel right now, reason: __1__ -cant-open-no-reason=You can't open this panel right now \ No newline at end of file diff --git a/old/locale/en/ExpGamingCore.Ranking.cfg b/old/locale/en/ExpGamingCore.Ranking.cfg deleted file mode 100644 index dc641783..00000000 --- a/old/locale/en/ExpGamingCore.Ranking.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[ranking] -all-rank-print=[Everyone]: __1__ -rank-print=[__1__]: __2__ -rank-up=__1__ was promoted to __2__ by __3__ -rank-down=__1__ was demoted to __2__ by __3__ -rank-given=You have been given the __1__ Rank! -tag-reset=Your Tag was reset due to a Rank change \ No newline at end of file diff --git a/old/locale/en/ExpGamingCore.Role.cfg b/old/locale/en/ExpGamingCore.Role.cfg deleted file mode 100644 index 4cb41594..00000000 --- a/old/locale/en/ExpGamingCore.Role.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[ExpGamingCore-Role] -default-print=[Everyone]: __1__ -print=[__1__]: __2__ -assign=__1__ was assigned to __2__ by __3__ -unassign=__1__ was unassigned from __2__ by __3__ -tag-reset=Your Tag was reset due to a role change \ No newline at end of file diff --git a/old/locale/en/ExpGamingCore.Server.cfg b/old/locale/en/ExpGamingCore.Server.cfg deleted file mode 100644 index e70ede54..00000000 --- a/old/locale/en/ExpGamingCore.Server.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[ExpGamingCore_Server] -interface-description=Runs the given input from the script \ No newline at end of file diff --git a/old/locale/en/ExpGamingInfo.Readme.cfg b/old/locale/en/ExpGamingInfo.Readme.cfg deleted file mode 100644 index 086261eb..00000000 --- a/old/locale/en/ExpGamingInfo.Readme.cfg +++ /dev/null @@ -1,69 +0,0 @@ -[ExpGamingInfo-Readme] -tooltip=Open the ReadMe if this is your first time joining. -guildlines-name=Guidelines -guildlines-tooltip=These are the guidelines everyone should follow -guildlines-line1=Welcome to the Explosive Gaming Community! -guildlines-line2=Here are some guidelines that everyone is obligated to follow. -guildlines-line3=!!!No rights can be derived from these guidelines as the full list of rules (another tab in this window) is valid / operative!!! -guildlines-line4=- Hacking / cheating / abusing bugs will not be tolerated. -guildlines-line5=- Be polite and use common sense. -guildlines-line6=- Spamming (in the form of chat, bots, unlimited chests and concrete) is not allowed. -guildlines-line7=- Do not remove stuff without asking your fellow players. -guildlines-line8=- Trains are only allowed in LHD (Left Hand Drive). No train loops! -guildlines-line9= -guildlines-line10=If you have any questions about our rules, the server or Factorio in general, feel free to ask your fellow players or our helpful team. Have fun! -chat-name=How To Chat -chat-tooltip=How to chat in Factorio with default key config -chat-singleline=Chatting can be difficult for new players because it’s different than other games! It’s very simple, the button you need to press is the “GRAVE/TILDE” key (which is located under the “ESC key”) - If you would like to change the key, go to your Controls tab in options. The key you need to change is “Toggle LUA console” -commands-name=Commands -commands-tooltip=Commands that you can use in ExplosiveGaming -commands-singleline=Custom commands that you can use. Base commands are not shown here. -commands-col1=Command Name -commands-col2=Command Help -links-name=Links -links-tooltip=Helpful links for ways to get in touch with us -links-cap1=Discord voice and chat server: -links-cap2=Our website: -links-cap3=Steam: -links-cap4=Patreon: -links-cap5=Our wiki: -servers-name=Servers -servers-tooltip=Info on our other servers -servers-singleline=Welcome to the Explosive Gaming Community! S1-S3 are staggered resets. -servers-format=S__1__: __2__ -servers-cap1=Public -servers-des1=A place for all players, this map resets every 144H At 16:00 UTC. -servers-cap2=Public -servers-des2=A place for all players, this map resets every 144H At 16:00 UTC. -servers-cap3=Public -servers-des3=A place for all players, this map resets every 144H At 16:00 UTC. -servers-cap4=Modded -servers-des4=A Modded server for all players. Link on Discord for members. -servers-cap5=Events -servers-des5=Server for events (everyone can join) - May require a password. Join Discord for more info -servers-cap6=Donator -servers-des6=For players who support us financially. Changes can be made per request. -rules-name=Rules -rules-tooltip=The full list of ExplosiveGaming rules. -rules-singleline=Although the guidelines cover most of our rules, the full list always have more priority and override any guideline. It is advised to be familiar with all rules to prevent warnings or bans. -rules-format=__1__) __2__ -rules-rule1=Hacking / cheating / abusing bugs will not be tolerated. -rules-rule2=Any bugs or exploits found should be reported to our team members. (excluding creative items) -rules-rule3=Do not disrespect any player in the server. -rules-rule4=Taking all items from a belt or logistics request is forbidden: sharing resources is mandatory. -rules-rule5=Spamming (in the form of chat, bots, unlimited chests and concrete) is not allowed. -rules-rule6=Do not lay down/remove concrete or stone with bots without permission. -rules-rule7=Do not use active provider chests without permission. -rules-rule8=Do not use speakers on global or with alerts without permission. -rules-rule9=Do not remove/move major parts of the factory without permission. -rules-rule10=Do not walk in random directions for no reason (to save map size and server resources). -rules-rule11=Do not remove stuff without asking your fellow players. -rules-rule12=Do not rotate belts, deactivate belts with wires, or cause production to stop. -rules-rule13=Do not make train roundabouts. Or any loops of any kind. -rules-rule14=When using trains, use the same size other players have used. -rules-rule15=Trains are Left Hand Drive (LHD) only. -rules-rule16=Do not complain about lag, low fps and low ups etc. -rules-rule17=Do not ask for ranks. Our ranks are synchronized with Discord, make sure to join us there. -rules-rule18=Do not advertise other servers unless you are a trusted server owner. -rules-rule19=Report players who break the rules. -rules-rule20=Use common sense and what an Admin says goes. diff --git a/old/locale/en/ExpGamingInfo.Rockets.cfg b/old/locale/en/ExpGamingInfo.Rockets.cfg deleted file mode 100644 index 263d9b2c..00000000 --- a/old/locale/en/ExpGamingInfo.Rockets.cfg +++ /dev/null @@ -1,12 +0,0 @@ -[ExpGamingInfo-Rockets] -name=Rocket Info -tooltip=List of details about the rockets sent. -none=No rockets have been sent yet. -nan=Not available -sent=Rockets Sent: __1__ -first=First Lanuched At: __1__ -last=Last Launch Took: __1__ -time=Average Launch Time: __1__ -fastest=Fastest Launch: __1__ -milestones=Milestones: -format=__1__: __2__ \ No newline at end of file diff --git a/old/locale/en/ExpGamingInfo.Science.cfg b/old/locale/en/ExpGamingInfo.Science.cfg deleted file mode 100644 index a9bc1526..00000000 --- a/old/locale/en/ExpGamingInfo.Science.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[ExpGamingInfo-Science] -name=Science Info -tooltip=List of details about science packs. -total=Packs Made: -time=Packs Per Minute: -format=__1__: __2__ -science-pack-1=Red -science-pack-2=Green -science-pack-3=Blue -military-science-pack=Military -production-science-pack=Production -high-tech-science-pack=High Tech -space-science-pack=Space -none=No science packs have been made yet. \ No newline at end of file diff --git a/old/locale/en/ExpGamingInfo.Tasklist.cfg b/old/locale/en/ExpGamingInfo.Tasklist.cfg deleted file mode 100644 index 7e698acf..00000000 --- a/old/locale/en/ExpGamingInfo.Tasklist.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingInfo-Tasklist] -name=Task List -tooltip=Jobs that needs to be completed all around the factory. -none=There are currently no tasks. Ask a Member in-game or through Discord to add tasks. \ No newline at end of file diff --git a/old/locale/en/ExpGamingPlayer.inventorySearch.cfg b/old/locale/en/ExpGamingPlayer.inventorySearch.cfg deleted file mode 100644 index 0c45c5b1..00000000 --- a/old/locale/en/ExpGamingPlayer.inventorySearch.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingPlayer-inventorySearch] -low=Your inventory was searched and __1__ was removed. -med=Your inventory was searched and __1__ was removed, you have been given a warning as a result. -high=Your inventory was searched and __1__ was removed: this is NOT allowed. You have been temp-banned as a result. \ No newline at end of file diff --git a/old/locale/en/ExpGamingPlayer.playerInfo.cfg b/old/locale/en/ExpGamingPlayer.playerInfo.cfg deleted file mode 100644 index 4bbc1f12..00000000 --- a/old/locale/en/ExpGamingPlayer.playerInfo.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[ExpGamingPlayer-playerInfo] -yes=Yes -no=No -name=[__1__] __2__ -online=Is Online: __1__ (__2__) -admin=Has Admin: __1__ -group=In User Group: __1__ -role=Highest Role: __1__ -roles=Other Roles: __1__ \ No newline at end of file diff --git a/old/locale/en/ExpGamingPlayer.playerList.cfg b/old/locale/en/ExpGamingPlayer.playerList.cfg deleted file mode 100644 index d2c2e345..00000000 --- a/old/locale/en/ExpGamingPlayer.playerList.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[ExpGamingPlayer-playerList] -tooltip=Toggle player list, right click player for more info -format-nil=__1__ - __2__ -format=__1__ - __2__ - __3__ -no-info-file=No info file was found \ No newline at end of file diff --git a/old/locale/en/ExpGamingPlayer.polls.cfg b/old/locale/en/ExpGamingPlayer.polls.cfg deleted file mode 100644 index afd15bf3..00000000 --- a/old/locale/en/ExpGamingPlayer.polls.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[ExpGamingPlayer-polls] -name=Polls -tooltip=View Old Polls -no-poll=No Old Polls -end=Poll Just Ended: __1__ -winner=__1__ had the most votes. -time-left=You will have __1__s to pick. \ No newline at end of file diff --git a/old/locale/en/GameSettingsGui.cfg b/old/locale/en/GameSettingsGui.cfg deleted file mode 100644 index 54825990..00000000 --- a/old/locale/en/GameSettingsGui.cfg +++ /dev/null @@ -1,32 +0,0 @@ -[GameSettingsGui] -name=Game Settings -tooltip=Edits Game Settings. Please use responsibly. -basic-name=Basic Settings -basic-tooltip=These settings are safe to edit and have no big impact. -basic-message=Basic Settings can be used to improve game play for players. -advanced-name=Advanced Settings -advanced-tooltip=These settings should be left alone unless you know what you are doing. -advanced-message=Please do not touch the Advanced Settings unless you are 100% sure what you are doing: changes made to these settings might have a bigger impact than you realise. -personal-name=Personal Settings -personal-tooltip=Personal Settings only affect you. -personal-message=Personal Settings only affect your character. If you are spotted as a result of these settings, you are on your own! -sure=Are you sure? -effect-mining-speed=Mining Speed -effect-craft-speed=Crafting Speed -effect-running-speed=Running Speed -effect-build-distance=Build Distance -effect-reach-distance=Reach Distance -effect-bot-speed=Bot Speed -effect-lab-speed=Lab Speed -effect-stack-bonus=Stack Bonus -effect-quickbar-count=Quickbar Count -effect-inventory-size=Inventory Size -effect-mining-prod=Mining Productivity -effect-game-speed=Game Speed -effect-save=Save Game -effect-reload-effects=Reload Effects -effect-reload-map=Reload Minimap -effect-kill-biters=Kill Biters -effect-crc=Force CRC Check -effect-reset-force=Reset Force -effect-clear-pollution=Clear Pollution \ No newline at end of file diff --git a/old/locale/en/GuiAnnouncements.cfg b/old/locale/en/GuiAnnouncements.cfg deleted file mode 100644 index be1e94da..00000000 --- a/old/locale/en/GuiAnnouncements.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[GuiAnnouncements] -name=Announcements -tooltip=Sends an announcement to all players -sent-to=This announcement is sent to __1__ -sent-by=This announcement was sent by __1__ ( __2__ ) -select-rank=This announcement will be sent to: \ No newline at end of file diff --git a/old/locale/en/WarpPoints.cfg b/old/locale/en/WarpPoints.cfg deleted file mode 100644 index 0f517e6e..00000000 --- a/old/locale/en/WarpPoints.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[WarpPoints] -name=Warp List -tooltip=A list of warp points. -remove-tooltip=Remove Warp point -go-to-tooltip=Go To -cooldown=You must wait for the cooldown. Time left: __1__ -cooldown-zero=Your cooldown has expired, You can use warp points again. -name-used=That name is already taken. -too-close=You are too close to an existing warp point to make a new one. -not-on-warp=You are not on a warp point right now, you must be on a warp point to go to one. \ No newline at end of file diff --git a/old/locale/fr/DeconControl.cfg b/old/locale/fr/DeconControl.cfg deleted file mode 100644 index 8eca4e13..00000000 --- a/old/locale/fr/DeconControl.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[DeconControl] -player-print=You are not allowed to do this yet, You require the Regular rank, you must play for at least 3 hours -rank-print=__1__ tried to deconstruct something. \ No newline at end of file diff --git a/old/locale/fr/ExpGamingAdmin.AdminLib.cfg b/old/locale/fr/ExpGamingAdmin.AdminLib.cfg deleted file mode 100644 index f882fc1c..00000000 --- a/old/locale/fr/ExpGamingAdmin.AdminLib.cfg +++ /dev/null @@ -1,15 +0,0 @@ -[ExpGamingAdmin] -name=Commandes Admin -tooltip=Des commandes très puissantes résident ici. -no-info-file=Aucun fichier info trouvé -message=Veuillez sélectionner un joueur et une action, faites en sorte que ce soit la bonne ! -warning=Attention, ce joueur est de rang supérieur au vôtre, vous ne pouvez le modifier. -short-reason=Attention, la raison indiquée est trop courte. Soyez concis mais aussi précis. (Warning: The reason is too short. UPDATE) -rank-high=Ce joueur est de rang supérieur, veuillez utiliser une commande dont vous maîtriser l'utilisation ! -invalid=Le Joueur ou l'action est invalide, ré-essayez ! -take-action=Agir -tooltip-ban=Bannir un Joueur -tooltip-kick=Exclure un Joueur -tooltip-jail=Emprisonner un Joueur -tooltip-go-to=Aller à la position d'un Joueur -tooltip-bring=Amener le Joueur à soi diff --git a/old/locale/fr/ExpGamingAdmin.Warnings.cfg b/old/locale/fr/ExpGamingAdmin.Warnings.cfg deleted file mode 100644 index c48f518a..00000000 --- a/old/locale/fr/ExpGamingAdmin.Warnings.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[ExpGamingAdmin-Warnings] -warning-given-by=This Warnings Was Given By: __1__ -player-warning=__1__ was given a warning by __2__ reason: __3__ -temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset -remove-warn=You are had a warning Removed, you have __1__ warnings, next removed in __2__ -message=You Are Currently Reciving Warnings From The Script, This Will Continue Unless You Cease And Desist -reported=You Have Been Reported To The Admins By The Script, Further Acction May Be Taken If You Do Not Cease And Desist. -kick-warn=You Are On A Warning To Be KICKED, The Script Will Auto Kick If You Do Not Cease And Desist. -temp-warn=You Are On A Warning To Be TEMP BANNED, The Script Will Auto Ban If You Do Not Cease And Desist. -ban-warn=You Are On A Warning To Be BANNED, The Script Will Auto Ban If You Do Not Cease And Desist. -last-warn=YOU ARE ON A LAST WARNING TO BE BANNED, THE SCRIPT WILL AUTO BAN IF YOU DO NOT CEASE AND DESIST. \ No newline at end of file diff --git a/old/locale/fr/ExpGamingAdmin.cfg b/old/locale/fr/ExpGamingAdmin.cfg deleted file mode 100644 index f882fc1c..00000000 --- a/old/locale/fr/ExpGamingAdmin.cfg +++ /dev/null @@ -1,15 +0,0 @@ -[ExpGamingAdmin] -name=Commandes Admin -tooltip=Des commandes très puissantes résident ici. -no-info-file=Aucun fichier info trouvé -message=Veuillez sélectionner un joueur et une action, faites en sorte que ce soit la bonne ! -warning=Attention, ce joueur est de rang supérieur au vôtre, vous ne pouvez le modifier. -short-reason=Attention, la raison indiquée est trop courte. Soyez concis mais aussi précis. (Warning: The reason is too short. UPDATE) -rank-high=Ce joueur est de rang supérieur, veuillez utiliser une commande dont vous maîtriser l'utilisation ! -invalid=Le Joueur ou l'action est invalide, ré-essayez ! -take-action=Agir -tooltip-ban=Bannir un Joueur -tooltip-kick=Exclure un Joueur -tooltip-jail=Emprisonner un Joueur -tooltip-go-to=Aller à la position d'un Joueur -tooltip-bring=Amener le Joueur à soi diff --git a/old/locale/fr/ExpGamingBot.autoChat.cfg b/old/locale/fr/ExpGamingBot.autoChat.cfg deleted file mode 100644 index 32fea59f..00000000 --- a/old/locale/fr/ExpGamingBot.autoChat.cfg +++ /dev/null @@ -1,20 +0,0 @@ -[ExpGamingBot-autoChat] -message=[Chat Bot]: __1__ -rank-error=You cant use global chat commands -players-online=There are __1__ players online -players=There have been __1__ players on this map -map-time=This map has been on for __1__ -line-8=Type /help for more info -join-us=Please join us on: -discord=Discord: https://discord.explosivegaming.nl -website=Website: explosivegaming.nl -custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info. -read-readme=Make sure you have read the Readme (can be found through the question mark on the top left) -not-real-dev=Cooldude2606 is a dev for this server and makes the softmod (look top left) and is not a factorio dev. -softmod=A softmod is a custom scenario that runs on this server, example is the player list. -blame=Blame __1__ for what just happend! -afk=Your afk? Look at __1__ they have been afk for: __2__ -links=To see links open the readme and click links. -magic=Fear the admin magic (ノ゚∀゚)ノ⌒・*:.。. .。.:*・゜゚・*☆ -aids=≖ ‿ ≖ Fear the aids of a public server ≖ ‿ ≖ -riot=(admins) ┬┴┬┴┤ᵒ_ᵒ)├┬┴┬┴ ‹ ‹\(´ω` )/››‹‹\ (  ´)/››‹‹\ ( ´ω`)/›› (rest of server) \ No newline at end of file diff --git a/old/locale/fr/ExpGamingBot.autoMessage.cfg b/old/locale/fr/ExpGamingBot.autoMessage.cfg deleted file mode 100644 index 49d19ede..00000000 --- a/old/locale/fr/ExpGamingBot.autoMessage.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[ExpGamingBot-autoMessage] -message=[Chat Bot]: __1__ -players-online=There are __1__ players online -map-time=This map has been on for __1__ -join-us=Please join us on: -discord=Discord: https://discord.explosivegaming.nl -website=Website: explosivegaming.nl -custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info. -read-readme=Make sure you have read the Readme (can be found through the question mark on the top left) \ No newline at end of file diff --git a/old/locale/fr/ExpGamingCore.Command.cfg b/old/locale/fr/ExpGamingCore.Command.cfg deleted file mode 100644 index 2fbd4aee..00000000 --- a/old/locale/fr/ExpGamingCore.Command.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[expcore-commands] -unauthorized=401 - Unauthorized: Access is denied due to invalid credentials -invalid-inputs=Invalid Input, /__1__ __2__ -invalid-range=Invalid Range, Min: __1__, Max: __2__ -invalid-length=Invalid Length, Max: __1__ -invalid-player=Invaild Player Name, __1__ ,try using tab key to auto-complete the name -offline-player=Player is offline, Command Failed To Run -dead-player=Player is dead, Command Failed To Run -command-ran=Command Complete \ No newline at end of file diff --git a/old/locale/fr/ExpGamingCore.Commands.cfg b/old/locale/fr/ExpGamingCore.Commands.cfg deleted file mode 100644 index 2fbd4aee..00000000 --- a/old/locale/fr/ExpGamingCore.Commands.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[expcore-commands] -unauthorized=401 - Unauthorized: Access is denied due to invalid credentials -invalid-inputs=Invalid Input, /__1__ __2__ -invalid-range=Invalid Range, Min: __1__, Max: __2__ -invalid-length=Invalid Length, Max: __1__ -invalid-player=Invaild Player Name, __1__ ,try using tab key to auto-complete the name -offline-player=Player is offline, Command Failed To Run -dead-player=Player is dead, Command Failed To Run -command-ran=Command Complete \ No newline at end of file diff --git a/old/locale/fr/ExpGamingCore.Gui.cfg b/old/locale/fr/ExpGamingCore.Gui.cfg deleted file mode 100644 index a8976a4e..00000000 --- a/old/locale/fr/ExpGamingCore.Gui.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingCore_Gui] -unauthorized=401 - Unauthorized: Access is denied due to invalid credentials -cant-open=You can not open this panel right now, reason: __1__ -cant-open-no-reason=You can not open this panel right now \ No newline at end of file diff --git a/old/locale/fr/ExpGamingCore.Ranking.cfg b/old/locale/fr/ExpGamingCore.Ranking.cfg deleted file mode 100644 index dc641783..00000000 --- a/old/locale/fr/ExpGamingCore.Ranking.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[ranking] -all-rank-print=[Everyone]: __1__ -rank-print=[__1__]: __2__ -rank-up=__1__ was promoted to __2__ by __3__ -rank-down=__1__ was demoted to __2__ by __3__ -rank-given=You have been given the __1__ Rank! -tag-reset=Your Tag was reset due to a Rank change \ No newline at end of file diff --git a/old/locale/fr/ExpGamingInfo.Readme.cfg b/old/locale/fr/ExpGamingInfo.Readme.cfg deleted file mode 100644 index 45c6f9d0..00000000 --- a/old/locale/fr/ExpGamingInfo.Readme.cfg +++ /dev/null @@ -1,68 +0,0 @@ -[ExpGamingInfo-Readme] -tooltip=Open the readme gui that opens when you first join. -guildlines-name=Guild Lines -guildlines-tooltip=These are the guildlines you should follow -guildlines-line1=Welcome to the Explosive Gaming Community! -guildlines-line2= -guildlines-line3=Here are some guidelines to keep this Server fun for everyone: -guildlines-line4=- Hacking / cheating / abusing bugs will not be tolerated. -guildlines-line5=- Be polite and use common sense. -guildlines-line6=- Nobody likes spam. That includes: Chat, Bots, unlimited Chests and Concrete. -guildlines-line7=- Do not remove stuff without even trying to talk / ask about it. -guildlines-line8=- Trains: LHD (Left hand drive), no Loops and use them for long distances. (- Trains are only allowed in LHD (Left Hand Drive). Train loops. UPDATE) -guildlines-line9= -guildlines-line10=If you have any questions about the rules, the server or the game in general, feel free to ask. Have Fun! -chat-name=How To Chat -chat-tooltip=How to chat in factorio with default key config -chat-singleline=Chatting can be difficult for new players because it’s different than other games! It’s very simple, the button you need to press is the “GRAVE/TILDE” key it’s located under the “ESC key”. If you would like to change the key go to your controls tab in options. The key you need to change is “Toggle Lua console” it’s located in the second column 2nd from bottom. -commands-name=Commands -commands-tooltip=These are the commands you can use -commands-singleline=These are the many diffrent custom commands you are able to use, the base game commands are not shown -commands-col1=Command Name -commands-col2=Command Help -links-name=Links -links-tooltip=Helpful links for ways to get in touch -links-cap1=Discord voice and chat server: -links-cap2=Our website: -links-cap3=Steam: -links-cap4=Patreon: -servers-name=Servers -servers-tooltip=Info on our other servers -servers-singleline=Welcome to the Explosive Gaming Community! -servers-format=S__1__: __2__ -servers-cap1=Public -servers-des1=A place for all players, this map reset every 24h. -servers-cap2=Standard -servers-des2=Before you play make sure you understand the game, reset every 48h. -servers-cap3=Pro -servers-des3=A pure mega base server, reset every 7 days and a password is needed to join. -servers-cap4=Modded -servers-des4=A modded server not much to say, just download the mods to play. Link on Discord for members. -servers-cap5=Events -servers-des5=Sometimes we hold events, may require a password, join discord for more info. -servers-cap6=Donator -servers-des6=For those people who have two much money and give us some. Anything goes per request. -rules-name=All Rules -rules-tooltip=A full list of rules for the server -rules-singleline=This is a full list of rules what must be followed, the guildlines will cover most points in here but for those who like to follow the rules word to word then here is the full list. -rules-format=__1__) __2__ -rules-rule1=Hacking/cheating, exploiting and abusing bugs is not allowed. -rules-rule2=Any bugs or exploits found should be reported. (no creative items) -rules-rule3=Do not disrespect any player in the server. -rules-rule4=Do not take every item frmo a belt or via logics request, share resources. -rules-rule5=Do not spam, this includes stuff such as chat spam, item spam, chest spam etc. -rules-rule6=Do not laydown or remove concrete or stone with bots without permission. -rules-rule7=Do not use active provider chests without permission. -rules-rule8=Do not use speakers on global or with alearts without permission. -rules-rule9=Do not remove/move major parts of the factory without permission. -rules-rule10=Do not walk in player random direction for no reason(to save map size). -rules-rule11=Do not remove stuff just because you dont like it, tell people first. -rules-rule12=Do not rotate belts, deactive belts with wires, or cause production to stop. -rules-rule13=Do not make train roundabouts. Or any loops of any kind. -rules-rule14=When using trains use the same size that others have used. -rules-rule15=Trains are Left Hand Drive (LHD) only. -rules-rule16=Do not complain about lag, low fps and low ups or other things like that. -rules-rule17=Do not ask for rank, our ranks are synced with discord, admins cant give ranks. -rules-rule18=Do not advertise other servers unless you are a trusted server owner. -rules-rule19=Report any one who breaks the rules. -rules-rule20=Use common sense and what an admin says goes. \ No newline at end of file diff --git a/old/locale/fr/ExpGamingInfo.Rockets.cfg b/old/locale/fr/ExpGamingInfo.Rockets.cfg deleted file mode 100644 index 344c368d..00000000 --- a/old/locale/fr/ExpGamingInfo.Rockets.cfg +++ /dev/null @@ -1,12 +0,0 @@ -[ExpGamingInfo-Rockets] -name=Rocket Info -tooltip=List of details about the rockets sent. -none=No rockets have been sent yet. -nan=NaN -sent=Rockets Sent: __1__ -first=First Lanuched At: __1__ -last=Last Launch Took: __1__ -time=Average Launch Time: __1__ -fastest=Fastest Launch: __1__ -milestones=Milestones: -format=__1__: __2__ \ No newline at end of file diff --git a/old/locale/fr/ExpGamingInfo.Science.cfg b/old/locale/fr/ExpGamingInfo.Science.cfg deleted file mode 100644 index a9bc1526..00000000 --- a/old/locale/fr/ExpGamingInfo.Science.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[ExpGamingInfo-Science] -name=Science Info -tooltip=List of details about science packs. -total=Packs Made: -time=Packs Per Minute: -format=__1__: __2__ -science-pack-1=Red -science-pack-2=Green -science-pack-3=Blue -military-science-pack=Military -production-science-pack=Production -high-tech-science-pack=High Tech -space-science-pack=Space -none=No science packs have been made yet. \ No newline at end of file diff --git a/old/locale/fr/ExpGamingInfo.Tasklist.cfg b/old/locale/fr/ExpGamingInfo.Tasklist.cfg deleted file mode 100644 index e739ac38..00000000 --- a/old/locale/fr/ExpGamingInfo.Tasklist.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingInfo-Tasklist] -name=Task List -tooltip=What jobs need to be done round the factory. -none=There are no tasks to do right now, ask a member to add some. \ No newline at end of file diff --git a/old/locale/fr/ExpGamingPlayer.inventorySearch.cfg b/old/locale/fr/ExpGamingPlayer.inventorySearch.cfg deleted file mode 100644 index 4d3eb1e4..00000000 --- a/old/locale/fr/ExpGamingPlayer.inventorySearch.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingPlayer-inventorySearch] -low=Your Inventory Was Search And __1__ was removed. -med=Your Inventory Was Search And __1__ was removed, you have been given a warning. -high=Your Inventory Was Search And __1__ was found, this is not allowed AT ALL, your inventory has been moved to spawn. \ No newline at end of file diff --git a/old/locale/fr/ExpGamingPlayer.playerInfo.cfg b/old/locale/fr/ExpGamingPlayer.playerInfo.cfg deleted file mode 100644 index 257168f7..00000000 --- a/old/locale/fr/ExpGamingPlayer.playerInfo.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[ExpGamingPlayer-playerInfo] -yes=Yes -no=No -name=[__1__] __2__ -online=Is Online: __1__ (__2__) -admin=Has Admin: __1__ -group=In User Group: __1__ -role=Has Rank: __1__ \ No newline at end of file diff --git a/old/locale/fr/ExpGamingPlayer.playerList.cfg b/old/locale/fr/ExpGamingPlayer.playerList.cfg deleted file mode 100644 index 83d2dd03..00000000 --- a/old/locale/fr/ExpGamingPlayer.playerList.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[ExpGamingPlayer-playerList] -tooltip=Toogle player list, right click player for info -format-nil=__1__ - __2__ -format=__1__ - __2__ - __3__ -no-info-file=No info file was found \ No newline at end of file diff --git a/old/locale/fr/ExpGamingPlayer.polls.cfg b/old/locale/fr/ExpGamingPlayer.polls.cfg deleted file mode 100644 index afd15bf3..00000000 --- a/old/locale/fr/ExpGamingPlayer.polls.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[ExpGamingPlayer-polls] -name=Polls -tooltip=View Old Polls -no-poll=No Old Polls -end=Poll Just Ended: __1__ -winner=__1__ had the most votes. -time-left=You will have __1__s to pick. \ No newline at end of file diff --git a/old/locale/fr/GameSettingsGui.cfg b/old/locale/fr/GameSettingsGui.cfg deleted file mode 100644 index f13485d0..00000000 --- a/old/locale/fr/GameSettingsGui.cfg +++ /dev/null @@ -1,31 +0,0 @@ -[GameSettingsGui] -name=Game Settings -tooltip=Allows for editing of the game settings, please use resposibliy. -basic-name=Basic Settings -basic-tooltip=These settings are safe to change with no large effects. -basic-message=These settings are force wide settings which can be used to inprove gameplay and make it more enjoyible for players. -advanced-name=Advanced Settings -advanced-tooltip=These settings should be left alone unless you know what you are doing. -advanced-message=Please do not touch these settings at all unless you know 100% what they do and the effect of using them, leave game.speed alone it has a bigger effect then you think. -personal-name=Personal Settings -personal-tooltip=These will only effect you, if you are spoted you are on your own. -personal-message=These settings will only effect your player any changes you make are to be resposible ones and dont over do it or you may be caught using them. -sure=Are You Sure! -effect-mining-speed=Mining Speed -effect-craft-speed=Crafting Speed -effect-running-speed=Running Speed -effect-build-distance=Build Distance -effect-reach-distance=Reach Distance -effect-bot-speed=Bot Speed -effect-lab-speed=Lab Speed -effect-stack-bonus=Stack Bonus -effect-quickbar-count=Quickbar Count -effect-inventory-size=Inventory Size -effect-mining-prod=Mining Productivity -effect-game-speed=Game Speed -effect-save=Save Game -effect-reload-effects=Reload Effects -effect-reload-map=Reload Minimap -effect-kill-biters=Kill Biters -effect-crc=Force CRC Check -effect-reset-force=Reset Force \ No newline at end of file diff --git a/old/locale/fr/GuiAnnouncements.cfg b/old/locale/fr/GuiAnnouncements.cfg deleted file mode 100644 index 11041b57..00000000 --- a/old/locale/fr/GuiAnnouncements.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[GuiAnnouncements] -name=Announcement -tooltip=Sent an announcement to players -sent-to=This is sent to __1__ -sent-by=This was sent by __1__ of rank __2__ -select-rank=This message will be sent to: \ No newline at end of file diff --git a/old/locale/fr/WarpPoints.cfg b/old/locale/fr/WarpPoints.cfg deleted file mode 100644 index b15a3345..00000000 --- a/old/locale/fr/WarpPoints.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[WarpPoints] -name=Warp List -tooltip=A list of warp points. -remove-tooltip=Remove Warp Point -go-to-tooltip=Go To -cooldown=You Must Wait For The Cooldown, Time Left: __1__ -cooldown-zero=You Cooldown Has Expired, YOu Can Use Warp Points Again. -name-used=That Name Is Already Taken -not-on-warp=You Are Not On A Warp Point Right Now, You Must Be On A Warp Point To Go To One. \ No newline at end of file diff --git a/old/locale/nl/DeconControl.cfg b/old/locale/nl/DeconControl.cfg deleted file mode 100644 index bc857511..00000000 --- a/old/locale/nl/DeconControl.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[DeconControl] -player-print=Je moet minstens 3 uur gespeeld hebben om dit uit te voeren. -rank-print=__1__ heeft geprobeerd iets te deconstrueren. diff --git a/old/locale/nl/ExpGamingAdmin.AdminLib.cfg b/old/locale/nl/ExpGamingAdmin.AdminLib.cfg deleted file mode 100644 index ff47947a..00000000 --- a/old/locale/nl/ExpGamingAdmin.AdminLib.cfg +++ /dev/null @@ -1,15 +0,0 @@ -[ExpGamingAdmin] -name=Admin Commands -tooltip=Admin Commands kan je hier vinden. -no-info-file=Infobestand niet gevonden. -message=Selecteer een speler en de bijbehorende actie. Wees er zeker van dat je de correcte actie kiest. -warning=Fout: Je kan de rank van deze speler niet aanpassen omdat het jouw rank overtreft. -short-reason=Fout: De reden is te kort. (Warning: The reason is too short. UPDATE) -rank-high=Fout: Deze speler overtreft jouw rank. -invalid=Fout: De speler kan niet gevonden worden en/of de actie is onjuist. Probeer opnieuw! -take-action=Actie ondernemen -tooltip-ban=Ban speler -tooltip-kick=Kick speler -tooltip-jail=Jail speler -tooltip-go-to=Ga naar speler -tooltip-bring=Breng speler diff --git a/old/locale/nl/ExpGamingAdmin.Warnings.cfg b/old/locale/nl/ExpGamingAdmin.Warnings.cfg deleted file mode 100644 index 104ef981..00000000 --- a/old/locale/nl/ExpGamingAdmin.Warnings.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[ExpGamingAdmin-Warnings] -warning-given-by=Deze waarschuwing is gegeven door: __1__ -player-warning=__1__ is gewaarschuwd door __2__ met de reden: __3__ -temp-ban=__1__ is verbannen door __2__ en is gejailed tot de volgende reset. -remove-warn=Een waarschuwing is verlopen. Je hebt nu nog maar __1__ waarschuwing, volgende waarschuwing verloopt in __2__ -message=Je ontvangt waarschuwingen door het systeem. Deze waarschuwingen stoppen niet tot je stopt met wat je verkeerd doet. -reported=Je bent gerapporteerd aan de administrators door het systeem. Je zal bestraft worden als je niet stopt met wat je verkeerd doet. -kick-warn=WAARSCHUWING: Dit is je laatste waarschuwing voordat je gekickt wordt. -temp-warn=WAARSCHUWING: Dit is je laatste waarschuwing voordat je tijdelijk verbannen wordt. -ban-warn=WAARSCHUWING: Dit is je laatste waarschuwing voordat je permanent verbannen wordt. -last-warn=DIT IS JE LAATSTE WAARSCHUWING. Het systeem zal je automatisch VERBANNEN als je niet stopt met wat je verkeerd doet. diff --git a/old/locale/nl/ExpGamingAdmin.cfg b/old/locale/nl/ExpGamingAdmin.cfg deleted file mode 100644 index ff47947a..00000000 --- a/old/locale/nl/ExpGamingAdmin.cfg +++ /dev/null @@ -1,15 +0,0 @@ -[ExpGamingAdmin] -name=Admin Commands -tooltip=Admin Commands kan je hier vinden. -no-info-file=Infobestand niet gevonden. -message=Selecteer een speler en de bijbehorende actie. Wees er zeker van dat je de correcte actie kiest. -warning=Fout: Je kan de rank van deze speler niet aanpassen omdat het jouw rank overtreft. -short-reason=Fout: De reden is te kort. (Warning: The reason is too short. UPDATE) -rank-high=Fout: Deze speler overtreft jouw rank. -invalid=Fout: De speler kan niet gevonden worden en/of de actie is onjuist. Probeer opnieuw! -take-action=Actie ondernemen -tooltip-ban=Ban speler -tooltip-kick=Kick speler -tooltip-jail=Jail speler -tooltip-go-to=Ga naar speler -tooltip-bring=Breng speler diff --git a/old/locale/nl/ExpGamingBot.autoChat.cfg b/old/locale/nl/ExpGamingBot.autoChat.cfg deleted file mode 100644 index 32fea59f..00000000 --- a/old/locale/nl/ExpGamingBot.autoChat.cfg +++ /dev/null @@ -1,20 +0,0 @@ -[ExpGamingBot-autoChat] -message=[Chat Bot]: __1__ -rank-error=You cant use global chat commands -players-online=There are __1__ players online -players=There have been __1__ players on this map -map-time=This map has been on for __1__ -line-8=Type /help for more info -join-us=Please join us on: -discord=Discord: https://discord.explosivegaming.nl -website=Website: explosivegaming.nl -custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info. -read-readme=Make sure you have read the Readme (can be found through the question mark on the top left) -not-real-dev=Cooldude2606 is a dev for this server and makes the softmod (look top left) and is not a factorio dev. -softmod=A softmod is a custom scenario that runs on this server, example is the player list. -blame=Blame __1__ for what just happend! -afk=Your afk? Look at __1__ they have been afk for: __2__ -links=To see links open the readme and click links. -magic=Fear the admin magic (ノ゚∀゚)ノ⌒・*:.。. .。.:*・゜゚・*☆ -aids=≖ ‿ ≖ Fear the aids of a public server ≖ ‿ ≖ -riot=(admins) ┬┴┬┴┤ᵒ_ᵒ)├┬┴┬┴ ‹ ‹\(´ω` )/››‹‹\ (  ´)/››‹‹\ ( ´ω`)/›› (rest of server) \ No newline at end of file diff --git a/old/locale/nl/ExpGamingBot.autoMessage.cfg b/old/locale/nl/ExpGamingBot.autoMessage.cfg deleted file mode 100644 index 49d19ede..00000000 --- a/old/locale/nl/ExpGamingBot.autoMessage.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[ExpGamingBot-autoMessage] -message=[Chat Bot]: __1__ -players-online=There are __1__ players online -map-time=This map has been on for __1__ -join-us=Please join us on: -discord=Discord: https://discord.explosivegaming.nl -website=Website: explosivegaming.nl -custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info. -read-readme=Make sure you have read the Readme (can be found through the question mark on the top left) \ No newline at end of file diff --git a/old/locale/nl/ExpGamingCore.Command.cfg b/old/locale/nl/ExpGamingCore.Command.cfg deleted file mode 100644 index 77ad98b9..00000000 --- a/old/locale/nl/ExpGamingCore.Command.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[expcore-commands] -unauthorized=401 - Onbevoegd: toegang wordt geweigerd vanwege ongeldige inloggegevens -invalid-inputs=Onjuiste invoer, /__1__ __2__ -invalid-range=Onjuiste radius, Min: __1__, Max: __2__ -invalid-length=Onjuiste lengte, Max: __1__ -invalid-player=Onjuiste naam, __1__ , probeer tab te gebruiken om de naam automatisch in te vullen -offline-player=Speler is offline. -dead-player=Speler is dood. -command-ran=Commando uitgevoerd. diff --git a/old/locale/nl/ExpGamingCore.Commands.cfg b/old/locale/nl/ExpGamingCore.Commands.cfg deleted file mode 100644 index 77ad98b9..00000000 --- a/old/locale/nl/ExpGamingCore.Commands.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[expcore-commands] -unauthorized=401 - Onbevoegd: toegang wordt geweigerd vanwege ongeldige inloggegevens -invalid-inputs=Onjuiste invoer, /__1__ __2__ -invalid-range=Onjuiste radius, Min: __1__, Max: __2__ -invalid-length=Onjuiste lengte, Max: __1__ -invalid-player=Onjuiste naam, __1__ , probeer tab te gebruiken om de naam automatisch in te vullen -offline-player=Speler is offline. -dead-player=Speler is dood. -command-ran=Commando uitgevoerd. diff --git a/old/locale/nl/ExpGamingCore.Gui.cfg b/old/locale/nl/ExpGamingCore.Gui.cfg deleted file mode 100644 index d53dc64c..00000000 --- a/old/locale/nl/ExpGamingCore.Gui.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingCore_Gui] -unauthorized=401 - Onbevoegd: toegang wordt geweigerd vanwege ongeldige inloggegevens -cant-open=Je kan dit momenteel niet openen. Reden: __1__ -cant-open-no-reason=Je kan dit momenteel niet openen. \ No newline at end of file diff --git a/old/locale/nl/ExpGamingCore.Ranking.cfg b/old/locale/nl/ExpGamingCore.Ranking.cfg deleted file mode 100644 index 16e5c4f1..00000000 --- a/old/locale/nl/ExpGamingCore.Ranking.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[ranking] -all-rank-print=[Everyone]: __1__ -rank-print=[__1__]: __2__ -rank-up=__1__ is gepromoot naar __2__ door __3__ -rank-down=__1__ is gedegradeerd naar __2__ door __3__ -rank-given=Je rank is veranderd naar __1__ -tag-reset=Je tag is gereset door een wijziging in je rank. \ No newline at end of file diff --git a/old/locale/nl/ExpGamingInfo.Readme.cfg b/old/locale/nl/ExpGamingInfo.Readme.cfg deleted file mode 100644 index cc54dbd3..00000000 --- a/old/locale/nl/ExpGamingInfo.Readme.cfg +++ /dev/null @@ -1,68 +0,0 @@ -[ExpGamingInfo-Readme] -tooltip=Open de ReadMe wanneer je voor het eerst speelt. -guildlines-name=Richtlijnen -guildlines-tooltip=Dit zijn de richtlijnen die je moet volgen. -guildlines-line1=Welkom op de ExplosiveGaming community! -guildlines-line2= -guildlines-line3=Hier zijn een aantal richtlijnen die ieder speler moet volgen. -guildlines-line4=- Hacken / cheaten en bugs misbruiken is niet toegestaan. -guildlines-line5=- Wees aardig en gebruik je gezonde verstand. -guildlines-line6=- Spammen (in de zin van chat, kisten en beton) is niet toegestaan. -guildlines-line7=- Geen spullen verwijderen zonder toestemming van andere spelers. -guildlines-line8=- Treinen (LHD - Left Hand Drive) geen loops. (- Trains are only allowed in LHD (Left Hand Drive). Train loops. UPDATE) -guildlines-line9= -guildlines-line10=Als je vragen hebt over deze regels of over de server in algemeen, aarzel dan niet om contact op te nemen met onze staff. -chat-name=Chatten -chat-tooltip=Chatten in Factorio met standaard instellingen -chat-singleline=Chatten kan moeilijk zijn voor nieuwe spelers omdat de chatmechanisme in Factorio anders is dan andere spellen. Het is simpel: druk op de "GRAVE/TILDE" knop (locatie is onder de ESC knop). Als je deze knop wilt aanpassen, ga naar de Controls tab in Opties. De knop die je moet aanpassen is "Toggle LUA Console" -commands-name=Commands -commands-tooltip=Dit zijn de commands die je kunt gebruiken. -commands-singleline=Er zijn veel verschillende custom commands die je kunt gebruiken. Let er wel op dat basis commands hier niet zichtbaar zijn. -commands-col1=Commando naam -commands-col2=Commando hulp -links-name=Links -links-tooltip=Nuttige links om in contact te komen met de community -links-cap1=Discord server: -links-cap2=Onze website: -links-cap3=Steam: -links-cap4=Patreon: -servers-name=Servers -servers-tooltip=Info over onze andere servers -servers-singleline=Welkom op de ExplosiveGaming community! S1 tot en met S3 heeft geplande resets. -servers-format=S__1__: __2__ -servers-cap1=Openbaar -servers-des1=Server voor alle spelers, deze map reset elke 144 uur om 16:00 UTC. -servers-cap2=Openbaar -servers-des2=A place for all players, deze map reset elke 144 uur om 16:00 UTC. -servers-cap3=Openbaar -servers-des3=A place for all players, deze map reset elke 144 uur om 16:00 UTC. -servers-cap4=Modded -servers-des4=Een modded server voor alle spelers. Links zijn te vinden in de Discord server. -servers-cap5=Events -servers-des5=Server voor events. Links en wachtwoorden zijn te vinden in de Discord server. -servers-cap6=Donator -servers-des6=Voor de spelers die ons financieel ondersteunen. -rules-name=Alle regels -rules-tooltip=Een lijst met regels die van toepassing zijn op alle ExplosiveGaming servers. -rules-singleline=Dit is een lijst met alle regels. De richtlijnen behandelt de meeste punten, maar de volledige lijst is ook van toepassing. -rules-format=__1__) __2__ -rules-rule1=Hacken / cheaten en bugs misbruiken is niet toegestaan. -rules-rule2=Bugs of fouten horen gerapporteerd te worden aan de staff. -rules-rule3=Respecteer iedereen in de server. -rules-rule4=Pak niet alles uit een belt of via logistiekaanvragen: deel je middelen. -rules-rule5=Spammen (in de zin van chat, kisten en beton) is niet toegestaan. -rules-rule6=Bouw geen beton of steen met bots zonder toestemming. -rules-rule7=Gebruik geen actieve providerkist zonder toestemming. -rules-rule8=Gebruik geen speakers (globaal of met alerts) zonder toestemming. -rules-rule9=Verwijder geen grote delen van het fabriek zonder toestemming. -rules-rule10=Loop niet in willekeurige plekken zonder een reden (bespaart mapgrootte en server resources) -rules-rule11=Geen spullen verwijderen zonder toestemming van andere spelers. -rules-rule12=Draai de belts niet, deactiveer belts niet met draden en laat de productie niet stoppen. -rules-rule13=Maak geen treinrotondes of lussen. -rules-rule14=Gebruik de zelfde grootte treinen als andere spelers. -rules-rule15=Treinen zijn alleen LHD (Left Hand Drive) -rules-rule16=Klaag niet over de lag, lage FPS of lage UPS. -rules-rule17=Vraag niet om ranks: ranks zijn synchroon met onze Discord server. -rules-rule18=Maak geen reclame voor andere servers, tenzij je daarvoor bevoegd bent. -rules-rule19=Rapporteer spelers die de regels breken. -rules-rule20=Gebruik gezond verstand. diff --git a/old/locale/nl/ExpGamingInfo.Rockets.cfg b/old/locale/nl/ExpGamingInfo.Rockets.cfg deleted file mode 100644 index 2fee0a06..00000000 --- a/old/locale/nl/ExpGamingInfo.Rockets.cfg +++ /dev/null @@ -1,12 +0,0 @@ -[ExpGamingInfo-Rockets] -name=Raket Info -tooltip=Lijst met details over de verstuurde raketten. -none=Er zijn nog geen raketten verstuurd. -nan=Niet beschikbaar -sent=Raketten verstuurd: __1__ -first=Eerste raket gelanceerd op: __1__ -last=Meest recente lancering: __1__ -time=Gemiddelde lanceertijd: __1__ -fastest=Snelste lancering: __1__ -milestones=Mijlpalen: -format=__1__: __2__ diff --git a/old/locale/nl/ExpGamingInfo.Science.cfg b/old/locale/nl/ExpGamingInfo.Science.cfg deleted file mode 100644 index 2ac8d7c0..00000000 --- a/old/locale/nl/ExpGamingInfo.Science.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[ExpGamingInfo-Science] -name=Wetenschap info -tooltip=Lijst met details over de wetenschaps pakketten. -total=Pakketten gemaakt: -time=Pakketten per minuut: -format=__1__: __2__ -science-pack-1=Rood -science-pack-2=Groen -science-pack-3=Blauw -military-science-pack=Militair -production-science-pack=Productie -high-tech-science-pack=High Tech -space-science-pack=Ruimte -none=Er zijn nog geen wetenschaps pakketten gemaakt. diff --git a/old/locale/nl/ExpGamingInfo.Tasklist.cfg b/old/locale/nl/ExpGamingInfo.Tasklist.cfg deleted file mode 100644 index 6ab37662..00000000 --- a/old/locale/nl/ExpGamingInfo.Tasklist.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingInfo-Tasklist] -name=Taaklijst -tooltip=Wat voor werk er rondom de fabriek gedaan moet worden -none=Er zijn momenteel geen taken. Vraag een Member om taken toe te voegen. diff --git a/old/locale/nl/ExpGamingPlayer.inventorySearch.cfg b/old/locale/nl/ExpGamingPlayer.inventorySearch.cfg deleted file mode 100644 index 2c6b6a60..00000000 --- a/old/locale/nl/ExpGamingPlayer.inventorySearch.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingPlayer-inventorySearch] -low=Je inventaris is doorzocht en __1__ is verwijderd. -med=Je inventaris is doorzocht en __1__ is verwijderd, je bent gewaarschuwd. -high=Je inventaris is doorzocht en __1__ is gevonden, dit is ten strengste verboden! Je inventaris is verwijderd. diff --git a/old/locale/nl/ExpGamingPlayer.playerInfo.cfg b/old/locale/nl/ExpGamingPlayer.playerInfo.cfg deleted file mode 100644 index 931736ee..00000000 --- a/old/locale/nl/ExpGamingPlayer.playerInfo.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[ExpGamingPlayer-playerInfo] -yes=Ja -no=Nee -name=[__1__] __2__ -online=Is Online: __1__ (__2__) -admin=Heeft Admin: __1__ -group=In Groep: __1__ -role=Heeft Rank: __1__ diff --git a/old/locale/nl/ExpGamingPlayer.playerList.cfg b/old/locale/nl/ExpGamingPlayer.playerList.cfg deleted file mode 100644 index 6a58e08a..00000000 --- a/old/locale/nl/ExpGamingPlayer.playerList.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[ExpGamingPlayer-playerList] -tooltip=Toggle speler lijst. Rechtermuisklik op een speler voor meer info -format-nil=__1__ - __2__ -format=__1__ - __2__ - __3__ -no-info-file=Geen infobestand gevonden. diff --git a/old/locale/nl/ExpGamingPlayer.polls.cfg b/old/locale/nl/ExpGamingPlayer.polls.cfg deleted file mode 100644 index 928ddefb..00000000 --- a/old/locale/nl/ExpGamingPlayer.polls.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[ExpGamingPlayer-polls] -name=Polls -tooltip=Laat oude polls zien -no-poll=Geen oude polls -end=Poll is zojuist beëindigd: __1__ -winner=__1__ had de meeste stemmen. -time-left=Je hebt __1__s om te kiezen. diff --git a/old/locale/nl/GameSettingsGui.cfg b/old/locale/nl/GameSettingsGui.cfg deleted file mode 100644 index 19017a6b..00000000 --- a/old/locale/nl/GameSettingsGui.cfg +++ /dev/null @@ -1,31 +0,0 @@ -[GameSettingsGui] -name=Game instellingen -tooltip=Maakt het mogelijk om gameinstellingen te wijzigen. Gebruik het verantwoord! -basic-name=Basis instellingen -basic-tooltip=Deze instellingen kunnen veilig worden gewijzigd. -basic-message=Deze instellingen kunnen worden gebruikt om het spelervaring voor de spelers te verbeteren. -advanced-name=Geavanceerde instellingen -advanced-tooltip=Het is ten zeerste aangeraden om niet aan deze instellingen te zitten, tenzij je weet wat je doet. -advanced-message=Waarschuwing: Niet aan deze instellingen zitten tenzij je honderd procent zeker weet wat je aan het doen bent. Het wijzigen van deze instellingen kunnen een groter effect hebben dan je denkt. -personal-name=Persoonlijke instellingen -personal-tooltip=Deze instellingen hebben alleen effect op jouw speler. -personal-message=Deze instellingen hebben alleen effect op jouw speler: gebruik het verantwoord, aangezien het overmatig gebruik van deze instellingen niet zijn toegestaan. -sure=Weet je het zeker? -effect-mining-speed=Mining Snelheid -effect-craft-speed=Crafting Snelheid -effect-running-speed=Ren Snelheid -effect-build-distance=Bouwafstand -effect-reach-distance=Bereik -effect-bot-speed=Bot Snelheid -effect-lab-speed=Lab Snelheid -effect-stack-bonus=Stack Bonus -effect-quickbar-count=Quickbar Count -effect-inventory-size=Inventory grootte -effect-mining-prod=Mining Productiviteit -effect-game-speed=Gamesnelheid -effect-save=Opslaan -effect-reload-effects=Effecten herladen -effect-reload-map=Minimap herladen -effect-kill-biters=Biters vermoorden -effect-crc=Forceer CRC check -effect-reset-force=Forceren resetten diff --git a/old/locale/nl/GuiAnnouncements.cfg b/old/locale/nl/GuiAnnouncements.cfg deleted file mode 100644 index 5c92cc68..00000000 --- a/old/locale/nl/GuiAnnouncements.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[GuiAnnouncements] -name=Mededelingen -tooltip=Verstuurt een mededeling naar iedereen -sent-to=Deze mededeling is gestuurd naar __1__ -sent-by=Deze mededeling is gestuurd door __1__ ( __2__ ) -select-rank=Deze mededeling wordt gestuurd naar: diff --git a/old/locale/nl/WarpPoints.cfg b/old/locale/nl/WarpPoints.cfg deleted file mode 100644 index b15a3345..00000000 --- a/old/locale/nl/WarpPoints.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[WarpPoints] -name=Warp List -tooltip=A list of warp points. -remove-tooltip=Remove Warp Point -go-to-tooltip=Go To -cooldown=You Must Wait For The Cooldown, Time Left: __1__ -cooldown-zero=You Cooldown Has Expired, YOu Can Use Warp Points Again. -name-used=That Name Is Already Taken -not-on-warp=You Are Not On A Warp Point Right Now, You Must Be On A Warp Point To Go To One. \ No newline at end of file diff --git a/old/locale/sv-SE/DeconControl.cfg b/old/locale/sv-SE/DeconControl.cfg deleted file mode 100644 index c8ad5cb7..00000000 --- a/old/locale/sv-SE/DeconControl.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[DeconControl] -player-print=Du har inte tillåtelse med det här just nu. Du behöver ha rang "Regular" vilket kan uppnås genom 3 timmar inne i spelet (den här kartan) hos Explosive Gaming. -rank-print=__1__ försökte dekonstruera något. diff --git a/old/locale/sv-SE/ExpGamingAdmin.AdminLib.cfg b/old/locale/sv-SE/ExpGamingAdmin.AdminLib.cfg deleted file mode 100644 index 679188c2..00000000 --- a/old/locale/sv-SE/ExpGamingAdmin.AdminLib.cfg +++ /dev/null @@ -1,19 +0,0 @@ -[ExpGamingAdmin] -name=Adminkommandon -tooltip=Adminkommando gör dit hem här -no-info-file=Ingen informationsfil kunde hittas -message=Var snäll och välj en spelare och en åtgärd att utfärda, se till att du väljer den rätta! -warning=Warning: Den här spelaren har högre rang än dig. Därför kan du inte redigera dess rang. -short-reason=Warning: Skälet är för kort. -rank-high=Warning: Den här spelaren har högre rang än dig. Därför kan du inte redigera dess rang. -invalid=Spelaren eller åtgärden är ogiltig. Var vänlig och försök igen! -take-action=Utför åtgärd. -tooltip-ban=Bannlys Spelare -tooltip-kick=Sparka Spelare -tooltip-jail=Fängsla Spelare -tooltip-go-to=Gå till Spelare -tooltip-bring=Hämta spelare -report=Rapportera Spelare -low-print=__1__ har blivit rapporterad av __2__ för: __3__ -high-print=__1__ har blivit rapporterad av __2__ för: __3__ -cant-report=Den här spelaren kan inte bli rapporterad. diff --git a/old/locale/sv-SE/ExpGamingAdmin.Warnings.cfg b/old/locale/sv-SE/ExpGamingAdmin.Warnings.cfg deleted file mode 100644 index 9358b9cf..00000000 --- a/old/locale/sv-SE/ExpGamingAdmin.Warnings.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[ExpGamingAdmin-Warnings] -warning-given-by=Den här varningen gavs av: __1__ -player-warning=__1__ var tillfälligt bannlyst av __2__ och kommer att förbli i fängelset tills nästa återställning (reset) -remove-warn=En av dina varningar har gått ut. Du har __1__ varning kvar, nästa varning kommer at tas bort om __2__ -message=Du får för nuvarande varningar av systemet. De kommer fortsätta tills du upphör med överträdelsen. -reported= Du har blivit rapporterad till administrationen av systemet. Mer påföljd kan komma att tas om du inte upphör med överträdelsen. -kick-warn=Det här är din sista varning innan du blir sparkad. Systemet kommer att automatisk sparka dig om du inte upphör med överträdelsen -temp-warn=Det här är din sista varning innan du blir tillfälligt bannlyst. Systemet kommer att automatiskt bannlysa dig om du inte upphör överträdelsen -ban-warn=VARNING: Det här är din sista varning innan du blir bannlyst. Systemet kommer att automatisk bannlysa dig om du inte upphör med överträdelsen. -last-warn=VARNING: Det här är din sista varning innan du blir permanent bannlyst. Systemet kommer att automatiskt permanent bannlysa dig om du inte upphör med överträdelsen. diff --git a/old/locale/sv-SE/ExpGamingAdmin.cfg b/old/locale/sv-SE/ExpGamingAdmin.cfg deleted file mode 100644 index 679188c2..00000000 --- a/old/locale/sv-SE/ExpGamingAdmin.cfg +++ /dev/null @@ -1,19 +0,0 @@ -[ExpGamingAdmin] -name=Adminkommandon -tooltip=Adminkommando gör dit hem här -no-info-file=Ingen informationsfil kunde hittas -message=Var snäll och välj en spelare och en åtgärd att utfärda, se till att du väljer den rätta! -warning=Warning: Den här spelaren har högre rang än dig. Därför kan du inte redigera dess rang. -short-reason=Warning: Skälet är för kort. -rank-high=Warning: Den här spelaren har högre rang än dig. Därför kan du inte redigera dess rang. -invalid=Spelaren eller åtgärden är ogiltig. Var vänlig och försök igen! -take-action=Utför åtgärd. -tooltip-ban=Bannlys Spelare -tooltip-kick=Sparka Spelare -tooltip-jail=Fängsla Spelare -tooltip-go-to=Gå till Spelare -tooltip-bring=Hämta spelare -report=Rapportera Spelare -low-print=__1__ har blivit rapporterad av __2__ för: __3__ -high-print=__1__ har blivit rapporterad av __2__ för: __3__ -cant-report=Den här spelaren kan inte bli rapporterad. diff --git a/old/locale/sv-SE/ExpGamingBot.autoChat.cfg b/old/locale/sv-SE/ExpGamingBot.autoChat.cfg deleted file mode 100644 index 98f81ad7..00000000 --- a/old/locale/sv-SE/ExpGamingBot.autoChat.cfg +++ /dev/null @@ -1,25 +0,0 @@ - -[ExpGamingBot-autoChat] -message=[Chat Bot]: __1__ -rank-error=Du kan inte utföra globala chat-kommandon. -players-online=Det är __1__ spelare online -players=Det har varit __1__ spelare på den här kartan -map-time=Den här kartan har varit igång under __1__ -line-8=Type /help för mer information -join-us=Var snäll och förena dig med oss: -discord=Discord: https://discord.explosivegaming.nl -website=Website: explosivegaming.nl -custom-commands=Vi använder oss av specialiserade kommandon, som till exempel /tag och /report, se kommandotabben i readme för mer information. -read-readme=Se till att du har läst "Readme" (Finn den genom att klicka på frågetecknet högst upp i vänstra hörnet) -not-real-dev=Cooldude2606 är dev för den här servern och gör mjukmodden ("the softmod") och är inte en factorio dev. -ssoftmod=En mjukmod ("softmod") är ett specialscenario som används på den här servern, exempelvis listan över spelare. -blame=Skyll på __1__ för vad som just hände! -afk=Är du afk (borta från tangentbordet)? Titta på __1__, den spelaren har varit afk under: __2__ -links=För att se länkar, öppna readme och klicka "länkar". -magic=Frukta admin-magin (ノ゚∀゚)ノ⌒・*:.。. .。.:*・゜゚・*☆ -aids=≖ ‿ ≖Fear the aids of a public server ≖ ‿ ≖ -riot=(admins) ┬┴┬┴┤ᵒ_ᵒ)├┬┴┬┴ ‹ ‹\(´ω` )/››‹‹\ (  ´)/››‹‹\ ( ´ω`)/›› (rest of server) -loops=INGA LOOPAR; LOOPAR ÄR DÅLIGT; JUST INGA LOOPAR!!!!!; OM DU GJÖR EN LOOP.... DET KOMMER INTE ATT SLUTA VÄL!!!!!!! -lhd=Alla tåg skall köras med vänstertrafik! -current-evolution=Nuvarande evolutionsfaktor är __1__ -wiki=Du kan få mer information om oss och scenariot på vår wiki: https://wiki.explosivegaming.nl/ \ No newline at end of file diff --git a/old/locale/sv-SE/ExpGamingBot.autoMessage.cfg b/old/locale/sv-SE/ExpGamingBot.autoMessage.cfg deleted file mode 100644 index f037d9df..00000000 --- a/old/locale/sv-SE/ExpGamingBot.autoMessage.cfg +++ /dev/null @@ -1,10 +0,0 @@ - -[ExpGamingBot-autoMessage] -message=[Chat Bot]: __1__ -players-online=Det är __1__ spelare online -map-time=Den här kartan har varit igång under __1__ -join-us=Var snäll och förena dig med oss: -discord=Discord: https://discord.explosivegaming.nl -website=Website: explosivegaming.nl -custom-commands=Vi använder oss av specialiserade kommandon, som till exempel /tag och /report, se kommandotabben i readme för mer information. -read-readme=Se till att du har läst "Readme" (Finn den genom att klicka på frågetecknet högst upp i vänstra hörnet) \ No newline at end of file diff --git a/old/locale/sv-SE/ExpGamingCore.Command.cfg b/old/locale/sv-SE/ExpGamingCore.Command.cfg deleted file mode 100644 index 99b1c6f4..00000000 --- a/old/locale/sv-SE/ExpGamingCore.Command.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[expcore-commands] -unauthorized=401 - Otillåten: Tillgång nekas på grund av otillräcklig säkerhetsprövning. -invalid-inputs=Igiltig inmatning, /__1__ __2__ -invalid-range=Invalid räckvid, Min: __1__, Max: __2__ -invalid-length=ogiltig längd, Max: __1__ -invalid-player=Ogiltigt spelarnamn, __1__ , försök använda tab-tangenten för att auto-slutföra namn. -offline-player=Spelare är offline. Kommando misslyckades med att köras. -dead-player=Spelare är död. Kommando misslyckades med att köras. -command-ran=Kommandot slutfört diff --git a/old/locale/sv-SE/ExpGamingCore.Commands.cfg b/old/locale/sv-SE/ExpGamingCore.Commands.cfg deleted file mode 100644 index 99b1c6f4..00000000 --- a/old/locale/sv-SE/ExpGamingCore.Commands.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[expcore-commands] -unauthorized=401 - Otillåten: Tillgång nekas på grund av otillräcklig säkerhetsprövning. -invalid-inputs=Igiltig inmatning, /__1__ __2__ -invalid-range=Invalid räckvid, Min: __1__, Max: __2__ -invalid-length=ogiltig längd, Max: __1__ -invalid-player=Ogiltigt spelarnamn, __1__ , försök använda tab-tangenten för att auto-slutföra namn. -offline-player=Spelare är offline. Kommando misslyckades med att köras. -dead-player=Spelare är död. Kommando misslyckades med att köras. -command-ran=Kommandot slutfört diff --git a/old/locale/sv-SE/ExpGamingCore.Gui.cfg b/old/locale/sv-SE/ExpGamingCore.Gui.cfg deleted file mode 100644 index 279ba842..00000000 --- a/old/locale/sv-SE/ExpGamingCore.Gui.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingCore_Gui] -unauthorized=401 -Otillåten: Tillgång nekas på grund av otillräcklig säkerhetsprövning. -cant-open=Du kan inte öppna den här panelen just nu, orsak: __1__ -cant-open-no-reason=Du kan inte öppna den här panelen just nu \ No newline at end of file diff --git a/old/locale/sv-SE/ExpGamingCore.Ranking.cfg b/old/locale/sv-SE/ExpGamingCore.Ranking.cfg deleted file mode 100644 index 8ee4d10a..00000000 --- a/old/locale/sv-SE/ExpGamingCore.Ranking.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[ranking] -all-rank-print=[Everyone]: __1__ -rank-print=[__1__]: __2__ -rank-up=__1__ blev befordrad till __2__ av __3__ -rank-down=__1__ blev degraderad till __2__ av __3__ -rank-given=Du har fått __1__ Rang! -tag-reset=Din tag blev återställd på grund av rangförändrning. \ No newline at end of file diff --git a/old/locale/sv-SE/ExpGamingInfo.Readme.cfg b/old/locale/sv-SE/ExpGamingInfo.Readme.cfg deleted file mode 100644 index 5299c304..00000000 --- a/old/locale/sv-SE/ExpGamingInfo.Readme.cfg +++ /dev/null @@ -1,69 +0,0 @@ -[ExpGamingInfo-Readme] -tooltip=Öppna ReadMe om det här är första gången du ansluter dig. -guildlines-name=Riktlinjer -guildlines-tooltip=Det här är riktlinjerna som alla bör följa -guildlines-line1=Välkommen till gemenskapen ExplosiveGaming! -guildlines-line2=Här är riktlinjerna som alla är tvingade att följa. -guildlines-line3=!!!No rights can be derived from these guidelines as the full list of rules (another tab in this window) is valid / operative!!! -guildlines-line4=- Dataintrång / fusk / missbruk av buggar kommer inte att tolereras. -guildlines-line5=- Var artig och använd sunt förnuft. -guildlines-line6=- Spam (genom chat, bottar, obegränsade kistor och betong) är inte tillåtet. -guildlines-line7=- Ta inte bort saker utan att fråga dina medspelare. -guildlines-line8=- Tåg är bara tillåtna med vänstertrafik. Inga tågloopar! -guildlines-line9= -guildlines-line10= Om du har frågor om reglerna, servern eller generelt om Factorio, känn dig fri att fråga dina medspelare eller vårat hjälpsamma team. Ha kul! -chat-name=Hur du chattar -chat-tooltip=Hur du chattar i Factorio med standardinställningar -chat-singleline=Att chatta kan vara svårt för nya spelare efterson det är annurlunda från andra spel. Det är väldigt enkelt, tangenten som du behöver trycka på är "ö".Om du vill byta det, gå in till "kontroller" och ändra tangent för "lua konsol". -commands-name=Kommandon -commands-tooltip=Kommandon som du kan använda i ExplosiveGaming -commands-singleline=Anpassade kommandon som du kan använda. Baskommandon visas inte här. -commands-col1=Kommandonamn -commands-col2=kommandohjälp -links-name=Länkar -links-tooltip=Hjälpfulla länkar som visar vägar att komma i kontakt med oss. -links-cap1=Discord röst- och chatserver: -links-cap2=Våran Webbadress : -links-cap3=Steam: -links-cap4=Patreon: -links-cap5=Vår wiki: -servers-name=Servrar -servers-tooltip=Information om våra servrar -servers-singleline=Välkommen till ExplosiveGamings gemenskap! S1-S3 har förskjutna återställningar (resets). -servers-format=S__1__: __2__ -servers-cap1=Offentlig -servers-des1=En plats för alla spelare, then här kartan återställs varje 144H, 16:00 UTC. -servers-cap2=Offentlig -servers-des2=En plats för alla spelare, then här kartan återställs varje 144H, 16:00 UTC. -servers-cap3=Offentlig -servers-des3=En plats för alla spelare, then här kartan återställs varje 144H, 16:00 UTC. -servers-cap4=Modifierad -servers-des4=En modifierad server för alla spelare. Länk i Discord för medlemmar. -servers-cap5=Evenemang -servers-des5=Server för evenemang (alla kan ansluta sig) - Kan kräva lösenord. Anslut dig till Discord för mer info. -servers-cap6=Donator -servers-des6=För spelare som stöder oss finansiellt. Ändringar kan göras på begäran. -rules-name=Regler -rules-tooltip=Den fullla listan över ExplosiveGamings regler. -rules-singleline=Även om riktlinjerna täcker de flesta av reglerna så har den fulla listan alltid prioritet och går alltid före riktlinjerna. Det är välbetänkt att vara bekant med alla reglerna för att förhindra varningar och bannlystningar. -rules-format=__1__) __2__ -rules-rule1=Dataintrång / fusk / missbruk av buggar kommer inte att tolereras. -rules-rule2=Buggar och utnyttjingssätt ska rapporteras till team-medlemmar (exkludera kreativa saker) -rules-rule3=Var inte respektlös mot någon annan spelare i servern. -rules-rule4=Att ta alla saker från ett bälte eller logistikbegäran är förbjudet: att dela med sig av resurserna är obligatoriskt. -rules-rule5=Spam (genom chat, bottar, obegränsade kistor eller betong) är inte tillåtet. -rules-rule6=Gör inga placeringar/borttagningar av betong eller sten med hjälp av bottar utan tillåtelse. -rules-rule7=Använd inte aktiva tillgångskistor utan tillåtelse. -rules-rule8=Använd inte globala högtalare eller varningar utan tillåtelse. -rules-rule9=Ta inte bort eller flytta huvuddelar av fabriken utan tillåtelse. -rules-rule10=Gå inte omkring i slumpvisa riktningar utan anledning (för att spara kartstorlek och serverresurser) -rules-rule11=Ta inte bort saker utan att fråga dina medspelare. -rules-rule12=Rotera inte bälten, deaktivera inte bälten med kabel och orsaka inte produktionsstop. -rules-rule13=Gör inte tågrondeller. Eller någon loop av något slag. -rules-rule14=Vid användning av tåg, använd samma storlek som andra spelare använt sig av. -rules-rule15=Tåg körs endast med vänstertrafik. -rules-rule16=Klaga inte om lag, låg fps, låg ups etc. -rules-rule17=Be inte om högre rang. Våra ranger är synkroniserade med Discord, se till att du ansluter dig till oss där. -rules-rule18=Gör inte reklam för andra servrar om du inte är en betrodd serverägare. -rules-rule19=Rapportera spelare som bryter mot reglerna. -rules-rule20=Använd sunt förnuft och vad en admin säger gäller. diff --git a/old/locale/sv-SE/ExpGamingInfo.Rockets.cfg b/old/locale/sv-SE/ExpGamingInfo.Rockets.cfg deleted file mode 100644 index eb4d93bd..00000000 --- a/old/locale/sv-SE/ExpGamingInfo.Rockets.cfg +++ /dev/null @@ -1,13 +0,0 @@ - -[ExpGamingInfo-Rockets] -name=Raketinformation -tooltip=Lista över detaljerna kring skickade raketer. -none=Inga raketer har blivit skickade ännu. -nan=Inte tillgängligt -sent=Skickade raketer: __1__ -first=Första uppskjutningen skedde: __1__ -last=Senaste uppskjutningen tog: __1__ -time=Genomsnittlig uppskjutningstid: __1__ -fastest=Snabbaste uppskjutning: __1__ -milestones=Milstolpar: -format=__1__: __2__ diff --git a/old/locale/sv-SE/ExpGamingInfo.Science.cfg b/old/locale/sv-SE/ExpGamingInfo.Science.cfg deleted file mode 100644 index db40737c..00000000 --- a/old/locale/sv-SE/ExpGamingInfo.Science.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[ExpGamingInfo-Science] -name=Vetenskapsinformation -tooltip=Detaljerad lista över vetenskapspaket. -total=Paket gjorda: -time=Paket per minut: -format=__1__: __2__ -science-pack-1=Röda -science-pack-2=Gröna -science-pack-3=Blåa -military-science-pack=Militära -production-science-pack=Produktion -high-tech-science-pack=Högteknologiska -space-science-pack=Rymd -none=Inga vetenskapspaket har blivit gjorda ännu. diff --git a/old/locale/sv-SE/ExpGamingInfo.Tasklist.cfg b/old/locale/sv-SE/ExpGamingInfo.Tasklist.cfg deleted file mode 100644 index 5b0009bf..00000000 --- a/old/locale/sv-SE/ExpGamingInfo.Tasklist.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingInfo-Tasklist] -name=Uppgiftslista -tooltip=Jobb som behövs slutföras överallt i fabriken -none=Det finns för närvarande inga uppgifter. Fråga en medlem i spelet eller via Discord för att lägga till nya uppgifter. \ No newline at end of file diff --git a/old/locale/sv-SE/ExpGamingPlayer.inventorySearch.cfg b/old/locale/sv-SE/ExpGamingPlayer.inventorySearch.cfg deleted file mode 100644 index ff5995b3..00000000 --- a/old/locale/sv-SE/ExpGamingPlayer.inventorySearch.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingPlayer-inventorySearch] -low=Ditt inventarie blev genomsökt och __1__ togs bort. -med=Ditt inventarie blev genomsökt och __1__ togs bort, du har fått en varning på grund av detta. -high=Ditt inventarie blev genomsökt och __1__ togs bort: Det här är inte tillåtet. Som ett resultat av det har du blivit tillfälligt bannlyst. diff --git a/old/locale/sv-SE/ExpGamingPlayer.playerInfo.cfg b/old/locale/sv-SE/ExpGamingPlayer.playerInfo.cfg deleted file mode 100644 index 5a4406ae..00000000 --- a/old/locale/sv-SE/ExpGamingPlayer.playerInfo.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[ExpGamingPlayer-playerInfo] -yes=Ja -no=Nej -name=[__1__] __2__ -online=Är Online: __1__ (__2__) -admin=Har Admin: __1__ -group=I användargrupp: __1__ -role=Har rang: __1__ diff --git a/old/locale/sv-SE/ExpGamingPlayer.playerList.cfg b/old/locale/sv-SE/ExpGamingPlayer.playerList.cfg deleted file mode 100644 index b871c389..00000000 --- a/old/locale/sv-SE/ExpGamingPlayer.playerList.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[ExpGamingPlayer-playerList] -tooltip=Växla spelarlista, högerklicka på spelare för mer information. -format-nil=__1__ - __2__ -format=__1__ - __2__ - __3__ -no-info-file=Ingen informationsfil kunde hittas diff --git a/old/locale/sv-SE/ExpGamingPlayer.polls.cfg b/old/locale/sv-SE/ExpGamingPlayer.polls.cfg deleted file mode 100644 index e9050a52..00000000 --- a/old/locale/sv-SE/ExpGamingPlayer.polls.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[ExpGamingPlayer-polls] -name=Undersökningar -tooltip=Se gamla undersökningar -no-poll=Inga gamla undersökningar -end=Röstning slutade nyss: __1__ -winner=__1__ hade flest röster. -time-left=Du kommer att få __1__s på dig att välja. \ No newline at end of file diff --git a/old/locale/sv-SE/GameSettingsGui.cfg b/old/locale/sv-SE/GameSettingsGui.cfg deleted file mode 100644 index 88185c07..00000000 --- a/old/locale/sv-SE/GameSettingsGui.cfg +++ /dev/null @@ -1,31 +0,0 @@ -[GameSettingsGui] -name=Game Settings -tooltip=Edits Game Settings. Please use responsibly. -basic-name=Basic Settings -basic-tooltip=These settings are safe to edit and have no big impact. -basic-message=Basic Settings can be used to improve game play for players. -advanced-name=Advanced Settings -advanced-tooltip=These settings should be left alone unless you know what you are doing. -advanced-message=Please do not touch the Advanced Settings unless you are 100% sure what you are doing: changes made to these settings might have a bigger impact than you realize. -personal-name=Personal Settings -personal-tooltip=Personal Settings only affects you. -personal-message=Personal Settings only affects your character. If you are spotted as a result of these settings, you are on your own! -sure=Are you sure? -effect-mining-speed=Mining Speed -effect-craft-speed=Crafting Speed -effect-running-speed=Running Speed -effect-build-distance=Build Distance -effect-reach-distance=Reach Distance -effect-bot-speed=Bot Speed -effect-lab-speed=Lab Speed -effect-stack-bonus=Stack Bonus -effect-quickbar-count=Quickbar Count -effect-inventory-size=Inventory Size -effect-mining-prod=Mining Productivity -effect-game-speed=Game Speed -effect-save=Save Game -effect-reload-effects=Reload Effects -effect-reload-map=Reload Minimap -effect-kill-biters=Kill Biters -effect-crc=Force CRC Check -effect-reset-force=Reset Force diff --git a/old/locale/sv-SE/GuiAnnouncements.cfg b/old/locale/sv-SE/GuiAnnouncements.cfg deleted file mode 100644 index 2b3a8317..00000000 --- a/old/locale/sv-SE/GuiAnnouncements.cfg +++ /dev/null @@ -1,7 +0,0 @@ - -[GuiAnnouncements] -name=Meddelanden -tooltip=Sänder ett meddelande till alla spelare -sent-to=Det här meddelandet är skickat till __1__ -sent-by=Det här meddelandet är skickat av __1__ ( __2__ ) -select-rank=Det här meddelandet kommer att skickas till: diff --git a/old/locale/sv-SE/WarpPoints.cfg b/old/locale/sv-SE/WarpPoints.cfg deleted file mode 100644 index afbdb799..00000000 --- a/old/locale/sv-SE/WarpPoints.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[WarpPoints] -name=Warp-lista -tooltip=En lista över Warp-punkter. -remove-tooltip=Ta bort Warp-punkt -go-to-tooltip=Gå till -cooldown=Du måste vänta på nedräkningen. Tid kvar: __1__ -cooldown-zero=Din nedräkningstimer har gått ut, så nu kan du använda Warp-punkter igen. -name-used=Det namnet är redan taget. -not-on-warp=Du är inte på en Warp-punkt just nu, för att gå till en Warp-punkt måste du befinna dig på en. diff --git a/old/modules/DONE/AdvancedStartingItems/control.lua b/old/modules/DONE/AdvancedStartingItems/control.lua deleted file mode 100644 index c97ebec2..00000000 --- a/old/modules/DONE/AdvancedStartingItems/control.lua +++ /dev/null @@ -1,45 +0,0 @@ ---- Adds a better method of player starting items based on production levels. --- @module AdvancedStartingItems@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Local Variables -local items = { - ['iron-plate']=function(player,made) if tick_to_min(game.tick) < 5 then return 8 else return (made*10)/math.pow(tick_to_min(game.tick),2) end end, - ['copper-plate']=function(player,made) if tick_to_min(game.tick) < 5 then return 0 else return (made*8)/math.pow(tick_to_min(game.tick),2) end end, - ['electronic-circuit']=function(player,made) if tick_to_min(game.tick) < 5 then return 0 else return (made*6)/math.pow(tick_to_min(game.tick),2) end end, - ['iron-gear-wheel']=function(player,made) if tick_to_min(game.tick) < 5 then return 0 else return (made*6)/math.pow(tick_to_min(game.tick),2) end end, - ['steel-plate']=function(player,made) if tick_to_min(game.tick) < 5 then return 0 else return(made*4)/math.pow(tick_to_min(game.tick),2) end end, - ['pistol']=function(player,made) if player.force.item_production_statistics.get_input_count('submachine-gun') > 5 then return 0 else return 1 end end, - ['submachine-gun']=function(player,made) if made > 5 then return 1 else return 0 end end, - ['firearm-magazine']=function(player,made) if player.force.item_production_statistics.get_input_count('piercing-rounds-magazine') > 100 then return 0 else return 10 end end, - ['piercing-rounds-magazine']=function(player,made) if made > 100 then return 10 else return 0 end end, - ['light-armor']=function(player,made) if made > 5 and player.force.item_production_statistics.get_input_count('heavy-armor') <= 5 then return 1 else return 0 end end, - ['heavy-armor']=function(player,made) if made > 5 then return 1 else return 0 end end, - ['burner-mining-drill']=function(player,made) if tick_to_min(game.tick) < 5 then return 4 else return 0 end end, - ['stone-furnace']=function(player,made) if tick_to_min(game.tick) < 5 then return 4 else return 0 end end, - ['iron-axe']=function(player,made) if made > 5 and player.force.item_production_statistics.get_input_count('steel-axe') <= 5 then return 1 else return 0 end end, - ['steel-axe']=function(player,made) if made > 5 then return 1 else return 0 end end -} - --- Module Define -local module_verbose = false -local ThisModule = {} - --- Event Handlers Define -Event.add(defines.events.on_player_created, function(event) - local player = game.players[event.player_index] - if event.player_index == 1 then - player.force.friendly_fire = false - game.map_settings.enemy_expansion.enabled = false - player.force.chart(player.surface, {{player.position.x - 400, player.position.y - 400}, {player.position.x + 400, player.position.y + 400}}) - end - for item,count in pairs(items) do - if type(count) == 'function' then count = math.floor(count(player,player.force.item_production_statistics.get_input_count(item))) end - if count > 0 then player.insert{name=item, count=count} end - end -end) - --- Module Return -return ThisModule \ No newline at end of file diff --git a/old/modules/DONE/AdvancedStartingItems/softmod.json b/old/modules/DONE/AdvancedStartingItems/softmod.json deleted file mode 100644 index dc9653e1..00000000 --- a/old/modules/DONE/AdvancedStartingItems/softmod.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "AdvancedStartingItems", - "version": "4.0.0", - "description": "Adds a better method of player starting items based on production levels.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Inventory", - "Start", - "Items", - "Player", - "Advanced", - "Useful", - "Balaced" - ], - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "dependencies": {}, - "submodules": {} -} diff --git a/old/modules/DONE/Bot/autoChat/control.lua b/old/modules/DONE/Bot/autoChat/control.lua deleted file mode 100644 index ed4aa492..00000000 --- a/old/modules/DONE/Bot/autoChat/control.lua +++ /dev/null @@ -1,166 +0,0 @@ ---- Sends messages in chat in response to other messages --- @module ExpGamingBot.autoChat --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Game = require('FactorioStdLib.Game') -local Server = require('ExpGamingCore.Server') -local Role -- ExpGamingCore.Role@^4.0.0 - --- Local Variables --- lots of these are jokes, but some have uses - --- white spaces removed and made into lower --- these messages are sent only to the player -local messages = { - ['discord']={'ExpGamingBot-autoChat.discord'}, - ['expgaming']={'ExpGamingBot-autoChat.website'}, - ['website']={'ExpGamingBot-autoChat.website'}, - ['command']={'ExpGamingBot-autoChat.custom-commands'}, - ['commands']={'ExpGamingBot-autoChat.custom-commands'}, - ['softmod']={'ExpGamingBot-autoChat.softmod'}, - ['script']={'ExpGamingBot-autoChat.softmod'}, - ['link']={'ExpGamingBot-autoChat.links'}, - ['links']={'ExpGamingBot-autoChat.links'}, - ['loop']={'ExpGamingBot-autoChat.loops'}, - ['loops']={'ExpGamingBot-autoChat.loops'}, - ['rhd']={'ExpGamingBot-autoChat.lhd'}, - ['roundabout']={'ExpGamingBot-autoChat.loops'}, - ['roundabouts']={'ExpGamingBot-autoChat.loops'}, - ['redmew']={'ExpGamingBot-autoChat.redmew'}, - ['afk']=function(_player) local max=_player for _,player in pairs(game.connected_players) do if max.afk_time < player.afk_time then max=player end end return {'ExpGamingBot-autoChat.afk',max.name,tick_to_display_format(max.afk_time)} end -} --- white spaces removed and made into lower --- these are global chat commands that can be used --- commands start with ! (all messages are also commands) -local command_syntax = '!' -local commands = { - ['online']=function() return {'ExpGamingBot-autoChat.players-online',#game.connected_players} end, - ['playtime']=function() return {'ExpGamingBot-autoChat.map-time',tick_to_display_format(game.tick)} end, - ['players']=function() return {'ExpGamingBot-autoChat.players',#game.players} end, - ['dev']={'ExpGamingBot-autoChat.not-real-dev'}, - ['blame']=function(player) local names = {'Cooldude2606','arty714','badgamernl',player.name} return {'ExpGamingBot-autoChat.blame',names[math.random(#names)]} end, - ['readme']={'ExpGamingBot-autoChat.read-readme'}, - ['magic']={'ExpGamingBot-autoChat.magic'}, - ['aids']={'ExpGamingBot-autoChat.aids'}, - ['riot']={'ExpGamingBot-autoChat.riot'}, - ['lenny']={'ExpGamingBot-autoChat.lenny'}, - ['feedback']={'ExpGamingBot-autoChat.feedback'}, - ['wiki']={'ExpGamingBot-autoChat.wiki'}, - ['hodor']=function() local options = {'?','.','!','!!!'} return {'ExpGamingBot-autoChat.hodor',options[math.random(#options)]} end, - ['evolution']=function() return {'ExpGamingBot-autoChat.current-evolution',string.format('%.2f',game.forces['enemy'].evolution_factor)} end, - --Jokes about food and drink - ['whattoeat']={'ExpGamingBot-autoChat.food'}, - - ['makepopcorn']=function(player) Server.new_thread{ - timeout=math.floor(180*(math.random()+0.5)),data=player.name - }:on_event('timeout',function(self) - if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-popcorn-2',self.data}} end - end):open() return {'ExpGamingBot-autoChat.get-popcorn-1'} end, - - ['orderpizza']=function(player) Server.new_thread{ - timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true - }:on_event('timeout',function(self) - if self.data[2]==0 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.order-pizza-2',self.data[1]}} - elseif self.data[2]==1 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.order-pizza-3',self.data[1]}} self.reopen = false - end - self.data[2]=self.data[2]+1 - end):open() return {'ExpGamingBot-autoChat.order-pizza-1'} end, - - ['passsomesnaps']=function(player) Server.new_thread{ - timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true - }:on_event('timeout',function(self) - if self.data[2]==0 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-snaps-2',self.data[1]}} - elseif self.data[2]==1 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-snaps-3',self.data[1]}} self.reopen = false - end - self.data[2]=self.data[2]+1 - end):open() return {'ExpGamingBot-autoChat.get-snaps-1'} end, - - ['makecocktail']=function(player) Server.new_thread{ - timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true - }:on_event('timeout',function(self) - if self.data[2]==0 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-cocktail-2',self.data[1]}} - elseif self.data[2]==1 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-cocktail-3',self.data[1]}} self.reopen = false - end - self.data[2]=self.data[2]+1 - end):open() return {'ExpGamingBot-autoChat.get-cocktail-1'} end, - - ['makecoffee']=function(player) Server.new_thread{ - timeout=math.floor(180*(math.random()+0.5)),data=player.name - }:on_event('timeout',function(self) - if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.make-coffee-2',self.data}} end - end):open() return {'ExpGamingBot-autoChat.make-coffee-1'} end, - - ['orderpizza']=function(player) Server.new_thread{ - timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true - }:on_event('timeout',function(self) - if self.data[2]==0 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.order-pizza-2',self.data[1]}} - elseif self.data[2]==1 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.order-pizza-3',self.data[1]}} self.reopen = false - end - self.data[2]=self.data[2] + 1 - end):open() return {'ExpGamingBot-autoChat.order-pizza-1'} end, - - ['maketea']=function(player) Server.new_thread{ - timeout=math.floor(180*(math.random()+0.5)),data=player.name - }:on_event('timeout',function(self) - if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.make-tea-2',self.data}} end - end):open() return {'ExpGamingBot-autoChat.make-tea-1'} end, - - ['popcorn']=function(player) Server.new_thread{ - timeout=math.floor(180*(math.random()+0.5)),data=player.name - }:on_event('timeout',function(self) - if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-popcorn-2',self.data}} end - end):open() return {'ExpGamingBot-autoChat.get-popcorn-1'} end, - - ['meadplease']=function(player) Server.new_thread{ - timeout=math.floor(180*(math.random()+0.5)),data=player.name - }:on_event('timeout',function(self) - if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-mead-2',self.data}} end - end):open() return {'ExpGamingBot-autoChat.get-mead-1'} end, - - ['passabeer']=function(player) Server.new_thread{ - timeout=math.floor(180*(math.random()+0.5)),data=player.name - }:on_event('timeout',function(self) - if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-beer-2',self.data}} end - end):open() return {'ExpGamingBot-autoChat.get-beer-1'} end -} - --- Module Define -local module_verbose = false -local ThisModule = { - on_init=function() - if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end - end -} - --- Event Handlers Define -Event.add(defines.events.on_console_chat,function(event) - local player = Game.get_player(event) - if not player then return end - local player_message = event.message:lower():gsub("%s+", "") - local allowed = Role and Role.allowed(player,'global-chat') or player.admin - for to_find,message in pairs(messages) do - if player_message:match(command_syntax..to_find) then - if allowed then - if is_type(message,'function') then message=message(player) end - game.print{'ExpGamingBot-autoChat.message',message} - else player_return({'ExpGamingBot-autoChat.rank-error'},nil,player) end - elseif player_message:match(to_find) then - if is_type(message,'function') then message=message(player) end - if not allowed then player_return({'ExpGamingBot-autoChat.message',message},nil,player) end - end - end - for to_find,message in pairs(commands) do - if player_message:match(command_syntax..to_find) then - if allowed then - if is_type(message,'function') then message=message(player) end - game.print{'ExpGamingBot-autoChat.message',message} - else player_return({'ExpGamingBot-autoChat.rank-error'},nil,player) end - end - end -end) - --- Module Return -return ThisModule \ No newline at end of file diff --git a/old/modules/DONE/Bot/autoChat/locale/de.cfg b/old/modules/DONE/Bot/autoChat/locale/de.cfg deleted file mode 100644 index 32fea59f..00000000 --- a/old/modules/DONE/Bot/autoChat/locale/de.cfg +++ /dev/null @@ -1,20 +0,0 @@ -[ExpGamingBot-autoChat] -message=[Chat Bot]: __1__ -rank-error=You cant use global chat commands -players-online=There are __1__ players online -players=There have been __1__ players on this map -map-time=This map has been on for __1__ -line-8=Type /help for more info -join-us=Please join us on: -discord=Discord: https://discord.explosivegaming.nl -website=Website: explosivegaming.nl -custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info. -read-readme=Make sure you have read the Readme (can be found through the question mark on the top left) -not-real-dev=Cooldude2606 is a dev for this server and makes the softmod (look top left) and is not a factorio dev. -softmod=A softmod is a custom scenario that runs on this server, example is the player list. -blame=Blame __1__ for what just happend! -afk=Your afk? Look at __1__ they have been afk for: __2__ -links=To see links open the readme and click links. -magic=Fear the admin magic (ノ゚∀゚)ノ⌒・*:.。. .。.:*・゜゚・*☆ -aids=≖ ‿ ≖ Fear the aids of a public server ≖ ‿ ≖ -riot=(admins) ┬┴┬┴┤ᵒ_ᵒ)├┬┴┬┴ ‹ ‹\(´ω` )/››‹‹\ (  ´)/››‹‹\ ( ´ω`)/›› (rest of server) \ No newline at end of file diff --git a/old/modules/DONE/Bot/autoChat/locale/en.cfg b/old/modules/DONE/Bot/autoChat/locale/en.cfg deleted file mode 100644 index 4afb021d..00000000 --- a/old/modules/DONE/Bot/autoChat/locale/en.cfg +++ /dev/null @@ -1,48 +0,0 @@ -[ExpGamingBot-autoChat] -message=[Chat Bot]: __1__ -rank-error=You can't use global chat commands -players-online=There are __1__ players online -players=There have been __1__ players on this map -map-time=This map has been on for __1__ -line-8=Type /help for more info -join-us=Please join us on: -discord=Discord: https://discord.explosivegaming.nl -website=Website: https://www.explosivegaming.nl -custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info. -read-readme=Make sure you have read the Readme (It can be found through the question mark on the top left) -not-real-dev=Cooldude2606 is a dev for this server and makes the softmod (look top left) and is not a factorio dev. -softmod=A softmod is a custom scenario that runs on this server, example is the player list. -redmew=We dont talk about redmew here; they beat us to 1000 members; F -blame=Blame __1__ for what just happend! -afk=Your afk? Look at __1__, that player has been afk for: __2__ -links=To see links open the readme and click links. -current-evolution=Current evolution factor is __1__ -magic=Fear the admin magic (ノ゚∀゚)ノ⌒・*:.。. .。.:*・゜゚・*☆ -aids=≖ ‿ ≖ Fear the aids of a public server ≖ ‿ ≖ -riot=(admins) ┬┴┬┴┤ᵒ_ᵒ)├┬┴┬┴ ‹ ‹\(´ω` )/››‹‹\ (  ´)/››‹‹\ ( ´ω`)/›› (rest of server) -loops=NO LOOPS; LOOPS ARE BAD; JUST NO LOOPS!!!!!; IF YOU MAKE A LOOP.... IT WILL NOT END WELL!!!!!!! -lenny=( ͡° ͜ʖ ͡°) -make-tea-1= ☕ Boiling the water... ☕ -make-tea-2= ☕ __1__ your tea is done! ☕ -order-pizza-1= 🍕 Finding nearest pizza supplier... 🍕 -order-pizza-2= 🍕 Figuring out the favourite pizza of __1__ 🍕 -order-pizza-3= 🍕 __1__ your pizza is here! 🍕 -make-coffee-1= ☕ Boiling the water and grinding the coffee beans... ☕ -make-coffee-2= ☕ __1__ we ran out of coffe beans! Have some tea instead. ☕ -get-beer-1= 🍺 Pouring A Glass 🍺 -get-beer-2= 🍻 Chears Mate 🍻 -get-mead-1= Filling the drinking horn -get-mead-2= Skål! -get-snaps-1=Pouring the glasses and finding the correct song book... -get-snaps-2=Singing a song...🎤🎶 -get-snaps-3=skål, my friends! -get-cocktail-1= 🍸 Inintiating mind reading unit... 🍸 -get-cocktail-2= 🍸 Mixing favourite ingredients of __1__ 🍸 -get-cocktail-3=🍸 __1__ your cocktail is done.🍸 -lhd=All trains must be LHD! -food=Don't know what to make for dinner? Use a random recipe from the random dinner suggestion generator at http://www.whatthefuckshouldimakefordinner.com/ -get-popcorn-1=Heating the oil and waiting for the popping sound... -get-popcorn-2=__1__ your popcorn is finished. Lean backwards and watch the drama unfold. -wiki=You can get more information about us and the custom scenario from our wiki: https://wiki.explosivegaming.nl/ -feedback=Do you have feedback? leave it at https://exp.fider.io/ -hodor=Hodor \ No newline at end of file diff --git a/old/modules/DONE/Bot/autoChat/locale/fr.cfg b/old/modules/DONE/Bot/autoChat/locale/fr.cfg deleted file mode 100644 index 32fea59f..00000000 --- a/old/modules/DONE/Bot/autoChat/locale/fr.cfg +++ /dev/null @@ -1,20 +0,0 @@ -[ExpGamingBot-autoChat] -message=[Chat Bot]: __1__ -rank-error=You cant use global chat commands -players-online=There are __1__ players online -players=There have been __1__ players on this map -map-time=This map has been on for __1__ -line-8=Type /help for more info -join-us=Please join us on: -discord=Discord: https://discord.explosivegaming.nl -website=Website: explosivegaming.nl -custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info. -read-readme=Make sure you have read the Readme (can be found through the question mark on the top left) -not-real-dev=Cooldude2606 is a dev for this server and makes the softmod (look top left) and is not a factorio dev. -softmod=A softmod is a custom scenario that runs on this server, example is the player list. -blame=Blame __1__ for what just happend! -afk=Your afk? Look at __1__ they have been afk for: __2__ -links=To see links open the readme and click links. -magic=Fear the admin magic (ノ゚∀゚)ノ⌒・*:.。. .。.:*・゜゚・*☆ -aids=≖ ‿ ≖ Fear the aids of a public server ≖ ‿ ≖ -riot=(admins) ┬┴┬┴┤ᵒ_ᵒ)├┬┴┬┴ ‹ ‹\(´ω` )/››‹‹\ (  ´)/››‹‹\ ( ´ω`)/›› (rest of server) \ No newline at end of file diff --git a/old/modules/DONE/Bot/autoChat/locale/nl.cfg b/old/modules/DONE/Bot/autoChat/locale/nl.cfg deleted file mode 100644 index 32fea59f..00000000 --- a/old/modules/DONE/Bot/autoChat/locale/nl.cfg +++ /dev/null @@ -1,20 +0,0 @@ -[ExpGamingBot-autoChat] -message=[Chat Bot]: __1__ -rank-error=You cant use global chat commands -players-online=There are __1__ players online -players=There have been __1__ players on this map -map-time=This map has been on for __1__ -line-8=Type /help for more info -join-us=Please join us on: -discord=Discord: https://discord.explosivegaming.nl -website=Website: explosivegaming.nl -custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info. -read-readme=Make sure you have read the Readme (can be found through the question mark on the top left) -not-real-dev=Cooldude2606 is a dev for this server and makes the softmod (look top left) and is not a factorio dev. -softmod=A softmod is a custom scenario that runs on this server, example is the player list. -blame=Blame __1__ for what just happend! -afk=Your afk? Look at __1__ they have been afk for: __2__ -links=To see links open the readme and click links. -magic=Fear the admin magic (ノ゚∀゚)ノ⌒・*:.。. .。.:*・゜゚・*☆ -aids=≖ ‿ ≖ Fear the aids of a public server ≖ ‿ ≖ -riot=(admins) ┬┴┬┴┤ᵒ_ᵒ)├┬┴┬┴ ‹ ‹\(´ω` )/››‹‹\ (  ´)/››‹‹\ ( ´ω`)/›› (rest of server) \ No newline at end of file diff --git a/old/modules/DONE/Bot/autoChat/locale/sv-SE.cfg b/old/modules/DONE/Bot/autoChat/locale/sv-SE.cfg deleted file mode 100644 index 98f81ad7..00000000 --- a/old/modules/DONE/Bot/autoChat/locale/sv-SE.cfg +++ /dev/null @@ -1,25 +0,0 @@ - -[ExpGamingBot-autoChat] -message=[Chat Bot]: __1__ -rank-error=Du kan inte utföra globala chat-kommandon. -players-online=Det är __1__ spelare online -players=Det har varit __1__ spelare på den här kartan -map-time=Den här kartan har varit igång under __1__ -line-8=Type /help för mer information -join-us=Var snäll och förena dig med oss: -discord=Discord: https://discord.explosivegaming.nl -website=Website: explosivegaming.nl -custom-commands=Vi använder oss av specialiserade kommandon, som till exempel /tag och /report, se kommandotabben i readme för mer information. -read-readme=Se till att du har läst "Readme" (Finn den genom att klicka på frågetecknet högst upp i vänstra hörnet) -not-real-dev=Cooldude2606 är dev för den här servern och gör mjukmodden ("the softmod") och är inte en factorio dev. -ssoftmod=En mjukmod ("softmod") är ett specialscenario som används på den här servern, exempelvis listan över spelare. -blame=Skyll på __1__ för vad som just hände! -afk=Är du afk (borta från tangentbordet)? Titta på __1__, den spelaren har varit afk under: __2__ -links=För att se länkar, öppna readme och klicka "länkar". -magic=Frukta admin-magin (ノ゚∀゚)ノ⌒・*:.。. .。.:*・゜゚・*☆ -aids=≖ ‿ ≖Fear the aids of a public server ≖ ‿ ≖ -riot=(admins) ┬┴┬┴┤ᵒ_ᵒ)├┬┴┬┴ ‹ ‹\(´ω` )/››‹‹\ (  ´)/››‹‹\ ( ´ω`)/›› (rest of server) -loops=INGA LOOPAR; LOOPAR ÄR DÅLIGT; JUST INGA LOOPAR!!!!!; OM DU GJÖR EN LOOP.... DET KOMMER INTE ATT SLUTA VÄL!!!!!!! -lhd=Alla tåg skall köras med vänstertrafik! -current-evolution=Nuvarande evolutionsfaktor är __1__ -wiki=Du kan få mer information om oss och scenariot på vår wiki: https://wiki.explosivegaming.nl/ \ No newline at end of file diff --git a/old/modules/DONE/Bot/autoChat/softmod.json b/old/modules/DONE/Bot/autoChat/softmod.json deleted file mode 100644 index 7c790178..00000000 --- a/old/modules/DONE/Bot/autoChat/softmod.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "ExpGamingBot.autoChat", - "version": "4.0.0", - "description": "Sends messages in chat based on what has been said by other players", - "location": "FSM_ARCHIVE", - "keywords": [ - "Chat", - "Bot", - "Jokes", - "Fun" - ], - "dependencies": { - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Server": "^4.0.0", - "ExpGamingCore.Role": "?^4.0.0" - }, - "collection": "ExpGamingBot@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/Bot/autoMessage/control.lua b/old/modules/DONE/Bot/autoMessage/control.lua deleted file mode 100644 index b21a0f7c..00000000 --- a/old/modules/DONE/Bot/autoMessage/control.lua +++ /dev/null @@ -1,74 +0,0 @@ ---- Prints a message every 15 minutes to chat. --- @module ExpGamingBot.autoMessage --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Server = require('ExpGamingCore.Server') -local Game = require('FactorioStdLib.Game') -local Role -- ExpGamingCore.Role@4.0.0 -local Sync -- ExpGamingCore.Sync@4.0.0 - --- Local Variables - --- Module Define -local module_verbose = false -local ThisModule = { - on_init=function() - if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end - if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end - end, - on_post=function() - --code - end -} - --- Event Handlers Define -script.on_init(function() - Server.new_thread{ - name='auto-message', - timeout=54000, -- 3240000 = 15 hours dont make the mistake i did, 54000 is 15 minutes - reopen=true, - data={ - high_role= 'Owner', - low_role= 'Regular', - low={ - {'ExpGamingBot-autoMessage.join-us'}, - {'ExpGamingBot-autoMessage.discord'}, - {'ExpGamingBot-autoMessage.website'}, - {'ExpGamingBot-autoMessage.custom-commands'}, - {'ExpGamingBot-autoMessage.read-readme'} - } - } - }:on_event('timeout',function(self) - local data = self.data - if not data.high_role or not data.low_role - or not data.low then self.reopen = false return end - game.print{'ExpGamingBot-autoMessage.message',{'ExpGamingBot-autoMessage.players-online',#game.connected_players}} - game.print{'ExpGamingBot-autoMessage.message',{'ExpGamingBot-autoMessage.map-time',tick_to_display_format(game.tick)}} - self.reopen = true - end):on_event(defines.events.on_player_joined_game,function(self,event) - local player = Game.get_player(event) - if not player then return end - local data = self.data - if not data.high_role or not data.low_role - or not data.low then self.reopen = false return end - if Role and Role.get_highest(player).index <= Role.get(data.low_role).index or player.admin then return end - for _,message in pairs(data.low) do - player_return({'ExpGamingBot-autoMessage.message',message},nil,player) - end - end):on_event('error',function(self,err) - if Sync then Sync.emit_embedded{ - title='Auto Message Error', - color=Color.to_hex(defines.textcolor.bg), - description='Auto Message Error - Closed Thread', - Error=err - } end - self.reopen = false - self:close() - end):open() -end) - --- Module Return -return ThisModule \ No newline at end of file diff --git a/old/modules/DONE/Bot/autoMessage/locale/de.cfg b/old/modules/DONE/Bot/autoMessage/locale/de.cfg deleted file mode 100644 index 49d19ede..00000000 --- a/old/modules/DONE/Bot/autoMessage/locale/de.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[ExpGamingBot-autoMessage] -message=[Chat Bot]: __1__ -players-online=There are __1__ players online -map-time=This map has been on for __1__ -join-us=Please join us on: -discord=Discord: https://discord.explosivegaming.nl -website=Website: explosivegaming.nl -custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info. -read-readme=Make sure you have read the Readme (can be found through the question mark on the top left) \ No newline at end of file diff --git a/old/modules/DONE/Bot/autoMessage/locale/en.cfg b/old/modules/DONE/Bot/autoMessage/locale/en.cfg deleted file mode 100644 index c67078a9..00000000 --- a/old/modules/DONE/Bot/autoMessage/locale/en.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[ExpGamingBot-autoMessage] -message=[Chat Bot]: __1__ -players-online=There are __1__ players online -map-time=This map has been on for __1__ -join-us=Please join us on: -discord=Discord: https://discord.explosivegaming.nl -website=Website: https://www.explosivegaming.nl -custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info. -read-readme=Make sure you have read the Readme (It can be found through the question mark on the top left) \ No newline at end of file diff --git a/old/modules/DONE/Bot/autoMessage/locale/fr.cfg b/old/modules/DONE/Bot/autoMessage/locale/fr.cfg deleted file mode 100644 index 49d19ede..00000000 --- a/old/modules/DONE/Bot/autoMessage/locale/fr.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[ExpGamingBot-autoMessage] -message=[Chat Bot]: __1__ -players-online=There are __1__ players online -map-time=This map has been on for __1__ -join-us=Please join us on: -discord=Discord: https://discord.explosivegaming.nl -website=Website: explosivegaming.nl -custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info. -read-readme=Make sure you have read the Readme (can be found through the question mark on the top left) \ No newline at end of file diff --git a/old/modules/DONE/Bot/autoMessage/locale/nl.cfg b/old/modules/DONE/Bot/autoMessage/locale/nl.cfg deleted file mode 100644 index 49d19ede..00000000 --- a/old/modules/DONE/Bot/autoMessage/locale/nl.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[ExpGamingBot-autoMessage] -message=[Chat Bot]: __1__ -players-online=There are __1__ players online -map-time=This map has been on for __1__ -join-us=Please join us on: -discord=Discord: https://discord.explosivegaming.nl -website=Website: explosivegaming.nl -custom-commands=We use custom commands, such as /tag and /report, see the commands tab in readme for more info. -read-readme=Make sure you have read the Readme (can be found through the question mark on the top left) \ No newline at end of file diff --git a/old/modules/DONE/Bot/autoMessage/locale/sv-SE.cfg b/old/modules/DONE/Bot/autoMessage/locale/sv-SE.cfg deleted file mode 100644 index f037d9df..00000000 --- a/old/modules/DONE/Bot/autoMessage/locale/sv-SE.cfg +++ /dev/null @@ -1,10 +0,0 @@ - -[ExpGamingBot-autoMessage] -message=[Chat Bot]: __1__ -players-online=Det är __1__ spelare online -map-time=Den här kartan har varit igång under __1__ -join-us=Var snäll och förena dig med oss: -discord=Discord: https://discord.explosivegaming.nl -website=Website: explosivegaming.nl -custom-commands=Vi använder oss av specialiserade kommandon, som till exempel /tag och /report, se kommandotabben i readme för mer information. -read-readme=Se till att du har läst "Readme" (Finn den genom att klicka på frågetecknet högst upp i vänstra hörnet) \ No newline at end of file diff --git a/old/modules/DONE/Bot/autoMessage/softmod.json b/old/modules/DONE/Bot/autoMessage/softmod.json deleted file mode 100644 index 769ab362..00000000 --- a/old/modules/DONE/Bot/autoMessage/softmod.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "ExpGamingBot.autoMessage", - "version": "4.0.0", - "description": "Prints a message every 15 minutes to chat.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Bot", - "Chat", - "Auto Message", - "Message" - ], - "dependencies": { - "ExpGamingCore.Server": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Role": "?^4.0.0", - "ExpGamingCore.Sync": "?^4.0.0" - }, - "collection": "ExpGamingBot@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/Bot/discordAlerts/control.lua b/old/modules/DONE/Bot/discordAlerts/control.lua deleted file mode 100644 index f3ba31f9..00000000 --- a/old/modules/DONE/Bot/discordAlerts/control.lua +++ /dev/null @@ -1,63 +0,0 @@ ---- Sends alerts to discord once there is a bot set up to read the alerts. --- @module ExpGamingBot.discordAlerts@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Sync = require('ExpGamingCore.Sync') -local Color = require('FactorioStdLib.Color') -local Game = require('FactorioStdLib.Game') - --- Module Define -local module_verbose = false -local ThisModule = {} - --- Event Handlers Define -Event.add(defines.events.on_console_command,function(event) - local command = event.command - local args = {} - if event.parameters then for word in event.parameters:gmatch('%S+') do table.insert(args,word) end end - local data = {} - data.title = string.gsub(command,'^%l',string.upper) - data.by = event.player_index and game.players[event.player_index].name or '' - if data.by == '' then return end - if command == 'config' or command == 'banlist' then - Sync.emit_embedded{ - title='Edit To '..data.title, - color=Color.to_hex(defines.textcolor.bg), - description='A player edited the '..command..'.', - ['By:']=data.by, - ['Edit:']=table.concat(args,' ',1) - } - else - if command == 'ban' then - data.colour = Color.to_hex(defines.textcolor.crit) - data.reason = table.concat(args,' ',2) - elseif command == 'kick' then - data.colour = Color.to_hex(defines.textcolor.high) - data.reason = table.concat(args,' ',2) - elseif command == 'unban' then data.colour = Color.to_hex(defines.textcolor.low) - elseif command == 'mute' then data.colour = Color.to_hex(defines.textcolor.med) - elseif command == 'unmute' then data.colour = Color.to_hex(defines.textcolor.low) - elseif command == 'promote' then data.colour = Color.to_hex(defines.textcolor.info) - elseif command == 'demote' then data.colour = Color.to_hex(defines.textcolor.info) - elseif command == 'purge' then data.colour = Color.to_hex(defines.textcolor.med) - else return end - data.username = args[1] - if not Game.get_player(data.username) then return end - if string.sub(command,-1) == 'e' then data.command = command..'d' else data.command = command..'ed' end - data.reason = data.reason and data.reason ~= '' and data.reason or 'No Reason Required' - Sync.emit_embedded{ - title='Player '..data.title, - color=data.colour, - description='There was a player '..data.command..'.', - ['Player:']='<>'..data.username, - ['By:']='<>'..data.by, - ['Reason:']=data.reason - } - end -end) - --- Module Return -return ThisModule \ No newline at end of file diff --git a/old/modules/DONE/Bot/discordAlerts/softmod.json b/old/modules/DONE/Bot/discordAlerts/softmod.json deleted file mode 100644 index 1bcd1602..00000000 --- a/old/modules/DONE/Bot/discordAlerts/softmod.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "ExpGamingBot.discordAlerts", - "version": "4.0.0", - "description": "Sends alerts to discord once there is a bot set up to read the alerts.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Bot", - "Discord", - "Alerts", - "Messages", - "Acctions" - ], - "dependencies": { - "ExpGamingCore.Sync": "^4.0.0", - "FactorioStdLib.Color": "^0.8.0", - "FactorioStdLib.Game": "^0.8.0" - }, - "collection": "ExpGamingBot@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/ChatPopup/control.lua b/old/modules/DONE/ChatPopup/control.lua deleted file mode 100644 index 992fcda8..00000000 --- a/old/modules/DONE/ChatPopup/control.lua +++ /dev/null @@ -1,57 +0,0 @@ ---- Creates flying text above player when they send a message. --- @module ChatPopup@4.0.0 --- @author badgamernl --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ChatPopup - --- Module Require -local Game = require('FactorioStdLib.Game') -local Color = require('FactorioStdLib.Color') - -local ChatPopup = {} - -function ChatPopup.sendFlyingText(player, text) - local _player = Game.get_player(player) - if not _player then return end - -- Split long text in chunks - local chunkSize = 40 - local chunks = {} - for i=1, #text, chunkSize do - chunks[#chunks+1] = text:sub(i,i+chunkSize - 1) - end - -- Iterate over text chunks and create them as floating text centered above the player - -- Disabled false centering because of not being able to disable scaling: (1 / 7.9 * #value) - for i,value in ipairs(chunks) do - _player.surface.create_entity{ - name="flying-text", - color=_player.chat_color, - text=value, - position={_player.position.x, _player.position.y-(2 - (1 * i))} - } - end -end - -Event.add(defines.events.on_console_chat, function(event) - if not event.player_index then return end - local player = game.players[event.player_index] - if not player then return end - if not event.message then return end - - -- Send message player send to player itself - local message = player.name .. ': ' .. event.message - ChatPopup.sendFlyingText(player, message) - - -- parse message for players and if it includes player, send him a notification that he has been mentioned in the chat - local player_message = event.message:lower():gsub("%s+", "") - - for i,_player in ipairs(game.connected_players) do - if _player.index ~= player.index then - if player_message:match(_player.name:lower()) then - ChatPopup.sendFlyingText(_player, 'You\'ve been mentioned by: ' ..player.name .. ' in chat!') - end - end - end - -end) - -return ChatPopup \ No newline at end of file diff --git a/old/modules/DONE/ChatPopup/softmod.json b/old/modules/DONE/ChatPopup/softmod.json deleted file mode 100644 index 273ab7d9..00000000 --- a/old/modules/DONE/ChatPopup/softmod.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "ChatPopup", - "version": "4.0.0", - "description": "Creates flying text above player when they send a message.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Chat", - "Popup", - "Mention", - "Floating", - "Text" - ], - "author": "badgamernl", - "contact": "badgamernl@gmail.com", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "dependencies": { - "FactorioStdLib.Game": "^0.8.0", - "FactorioStdLib.Color": "^0.8.0" - }, - "submodules": {} -} diff --git a/old/modules/DONE/Commands/ExpGamingCommands/softmod.json b/old/modules/DONE/Commands/ExpGamingCommands/softmod.json deleted file mode 100644 index 6cfb5d37..00000000 --- a/old/modules/DONE/Commands/ExpGamingCommands/softmod.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "ExpGamingCommands", - "version": "4.0.0", - "description": "A Collection of all of the custom commands used on ExpGaming servers.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Commands", - "ExpGaming", - "Admin", - "Tools" - ], - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "submodules": { - "ExpGamingCommands.bonus": "4.0.0", - "ExpGamingCommands.cheatMode": "4.0.0", - "ExpGamingCommands.home": "4.0.0", - "ExpGamingCommands.kill": "4.0.0", - "ExpGamingCommands.repair": "4.0.0", - "ExpGamingCommands.tags": "4.0.0", - "ExpGamingCommands.teleport": "4.0.0" - }, - "dependencies": {} -} diff --git a/old/modules/DONE/Commands/cheatMode/control.lua b/old/modules/DONE/Commands/cheatMode/control.lua deleted file mode 100644 index 19d05276..00000000 --- a/old/modules/DONE/Commands/cheatMode/control.lua +++ /dev/null @@ -1,14 +0,0 @@ ---- A full ranking system for factorio. --- @module ExpGamingCommands.cheatMode@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - ---- Toggles cheat mode for a player --- @command cheat-mode --- @param[opt] player the player to toggle if nil then the player using the command -commands.add_command('cheat-mode', 'Toggles cheat mode for a player', { - ['player']={false,'player'} -}, function(event,args) - local player = args.player or game.player - if player.cheat_mode == true then player.cheat_mode = false else player.cheat_mode = true end -end).default_admin_only = true diff --git a/old/modules/DONE/Commands/cheatMode/softmod.json b/old/modules/DONE/Commands/cheatMode/softmod.json deleted file mode 100644 index cc2843f6..00000000 --- a/old/modules/DONE/Commands/cheatMode/softmod.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "ExpGamingCommands.cheatMode", - "version": "4.0.0", - "description": "Adds a command which allow you to toggle cheatmode", - "location": "FSM_ARCHIVE", - "keywords": [ - "Cheat", - "Commands", - "Admin", - "ExpGaming", - "Cheat Mode", - "Hacks" - ], - "dependencies": { - "ExpGamingCore.Command": "^4.0.0" - }, - "collection": "ExpGamingCommands@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/Commands/home/control.lua b/old/modules/DONE/Commands/home/control.lua deleted file mode 100644 index a30f9087..00000000 --- a/old/modules/DONE/Commands/home/control.lua +++ /dev/null @@ -1,48 +0,0 @@ ---- A full ranking system for factorio. --- @module ExpGamingCommands.home@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - -local Game = require('FactorioStdLib.Game') -local global = {} -Global.register(global,function(tbl) global = tbl end) - ---- Sets the home for a player --- @command set-home -commands.add_command('home', 'Allows you to set, remove and goto your homes', { - ['command'] = {false,'string-list',{'set','remove','goto','list','return'}}, - ['name'] = {false,'string-len',10} -}, function(event,args) - local player = Game.get_player(event) - if not global[player.index] then local spawn_pos = player.force.get_spawn_position(player.surface) global[player.index] = {Spawn={spawn_pos.x,spawn_pos.y},_m=3,_n=1,_r={spawn_pos.x,spawn_pos.y}} end - local homes = global[player.index] - local command = args.command - local name = args.name - if command == 'set' then - local pos = {math.floor(player.position.x),math.floor(player.position.y)} - if homes._n+1 > homes._m then player_return{'ExpGamingCommands-home.too-many-homes',homes._m} return commands.error end - if not homes[name] then homes._n=homes._n+1 end - homes[name] = pos - player_return{'ExpGamingCommands-home.set',name,pos[1],pos[2]} - elseif command == 'remove' then - if not homes[name] then player_return{'ExpGamingCommands-home.invalid',name} return commands.error end - homes[name] = nil - homes._n=homes._n-1 - player_return{'ExpGamingCommands-home.remove',name} - elseif command == 'goto' then - if not homes[name] then player_return{'ExpGamingCommands-home.invalid',name} return commands.error end - local pos = {math.floor(player.position.x),math.floor(player.position.y)} - player.teleport(player.surface.find_non_colliding_position('player',homes[name],32,1),player.surface) - homes._r = pos - player_return{'ExpGamingCommands-home.goto',name} - elseif command == 'return' then - local pos = {math.floor(player.position.x),math.floor(player.position.y)} - player.teleport(player.surface.find_non_colliding_position('player',homes._r,32,1),player.surface) - homes._r = pos - player_return{'ExpGamingCommands-home.return',pos[1],pos[2]} - else - player_return{'ExpGamingCommands-home.homes',homes._n,homes._m} - local index = 1 - for home_name,pos in pairs(homes) do if home_name ~= '_n' and home_name ~= '_r' and home_name ~= '_m' then player_return{'ExpGamingCommands-home.home',index,home_name,pos[1],pos[2]} index=index+1 end end - end -end) diff --git a/old/modules/DONE/Commands/home/locale/en.cfg b/old/modules/DONE/Commands/home/locale/en.cfg deleted file mode 100644 index e2993070..00000000 --- a/old/modules/DONE/Commands/home/locale/en.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[ExpGamingCommands-home] -too-many-homes=You have too many homes, to add more you must remove one. Your max is __1__. -homes=Your Homes: (__1__/__2__) -home=__1__) __2__: __3__ , __4__ -set=Your home "__1__" has been set to __2__ , __3__ -remove=Your home "__1__" has been removed -goto=You are now at "__1__" -return=You are now at your previous location: __1__ , __2__ -invalid=Invalid name, __1__ \ No newline at end of file diff --git a/old/modules/DONE/Commands/home/softmod.json b/old/modules/DONE/Commands/home/softmod.json deleted file mode 100644 index 72d2c368..00000000 --- a/old/modules/DONE/Commands/home/softmod.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "ExpGamingCommands.home", - "version": "4.0.0", - "description": "Allows players to set homes and then return to them later.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Teleport", - "ExpGaming", - "Home", - "Return", - "Set Home", - "Commands" - ], - "dependencies": { - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Command": "^4.0.0" - }, - "collection": "ExpGamingCommands@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/Commands/kill/control.lua b/old/modules/DONE/Commands/kill/control.lua deleted file mode 100644 index b04ef3d8..00000000 --- a/old/modules/DONE/Commands/kill/control.lua +++ /dev/null @@ -1,18 +0,0 @@ ---- A full ranking system for factorio. --- @module ExpGamingCommands.kill@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - -local Game = require('FactorioStdLib.Game') - ---- Kills a player of a lower rank --- @command kill --- @param player the player to be killed -commands.add_command('kill', 'Kills a player. No player name kills yourself.', { - ['player']={false,'player-rank-alive'} -}, function(event,args) - local _player = Game.get_player(event) - local player = args.player - if player then player.character.die() - else _player.character.die() end -end).default_admin_only = true diff --git a/old/modules/DONE/Commands/kill/softmod.json b/old/modules/DONE/Commands/kill/softmod.json deleted file mode 100644 index 989c03ee..00000000 --- a/old/modules/DONE/Commands/kill/softmod.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "ExpGamingCommands.kill", - "version": "4.0.0", - "description": "Adds a command which can be used to kill a player or yourself.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Command", - "ExpGaming", - "Kill", - "Death", - "Admin", - "Tool" - ], - "dependencies": { - "ExpGamingCore.Command": "^4.0.0", - "ExpGamingCore.Role": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0" - }, - "collection": "ExpGamingCommands@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/Commands/repair/control.lua b/old/modules/DONE/Commands/repair/control.lua deleted file mode 100644 index be84b7f0..00000000 --- a/old/modules/DONE/Commands/repair/control.lua +++ /dev/null @@ -1,68 +0,0 @@ ---- A full ranking system for factorio. --- @module ExpGamingCommands.repair@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - - -local Game = require('FactorioStdLib.Game') -local Role = require('ExpGamingCore.Role') - --- Set an item to true to disallow it from being repaired -local disallow = { - ['loader']=true, - ['fast-loader']=true, - ['express-loader']=true, - ['electric-energy-interface']=true, - ['infinity-chest']=true -} - --- Given const = 100: admin+ has unlimited, admin has const (100), mod has const / 2 (50), member has const / 5 (20) -local const = 100 -local repairDisallow - --- Module Define -local module_verbose = false -local ThisModule = { - on_init = function(self) - if loaded_modules['ExpGamingAdmin.TempBan'] then verbose('ExpGamingAdmin.TempBan is installed; Loading tempban src') repairDisallow = require(module_path..'/src/tempban') end - end -} - ---- Used so that the value can be overridden if tempban is present --- @local --- @function repairDisallow --- @param player the player who called the command --- @param entity the entity which was repaired -repairDisallow = function(player,entity) - player_return('You have repaired: '..entity.name..' this item is not allowed.',defines.textcolor.crit,player) - entity.destroy() -end - ---- Used to repair and heal items in an area, different ranks get different size areas --- @command repair --- @param range the range that items are repaired in -commands.add_command('repair', 'Repairs all destroyed and damaged entities in an area.', { - ['range']={true,'number-int'} -}, function(event,args) - local range = args.range - local player = Game.get_player(event) - local role = Role.get_highest(player) - local highest_admin_power = Role.meta.groups.Admin.highest-1 - local max_range = role.index-highest_admin_power > 0 and const/(role.index-highest_admin_power) or nil - local center = player and player.position or {x=0,y=0} - if not range or max_range and range > max_range then player_return({'ExpGamingCore_Command.invalid-range',0,math.floor(max_range)}) return commands.error end - local area = {{center.x-range,center.y-range},{center.x+range,center.y+range}} - local max_time_to_live = 2^32 - 1 - local sq_range = range^2 - for key, entity in pairs(player.surface.find_entities_filtered({area=area,type='entity-ghost'})) do - if entity.force == player.force and (entity.position.x-center.x)^2+(entity.position.y-center.y)^2 < sq_range then - if disallow[entity.ghost_prototype.name] then repairDisallow(player,entity) - elseif entity.time_to_live ~= max_time_to_live then entity.revive() end - end - end - for key, entity in pairs(player.surface.find_entities(area)) do - if entity.force == player.force and (entity.position.x-center.x)^2+(entity.position.y-center.y)^2 < sq_range and entity.health then entity.health = 10000 end - end -end).default_admin_only = true - -return ThisModule diff --git a/old/modules/DONE/Commands/repair/softmod.json b/old/modules/DONE/Commands/repair/softmod.json deleted file mode 100644 index db6cbfab..00000000 --- a/old/modules/DONE/Commands/repair/softmod.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "ExpGamingCommands.repair", - "version": "4.0.0", - "description": "Allows items to be healed and repaired with a command", - "location": "FSM_ARCHIVE", - "keywords": [ - "ExpGaming", - "Command", - "Heal", - "Repair", - "Ghosts", - "Revive" - ], - "dependencies": { - "ExpGamingLib": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Role": "^4.0.0", - "ExpGamingAdmin.TempBan": "?^4.0.0" - }, - "collection": "ExpGamingCommands@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/Commands/repair/src/tempban.lua b/old/modules/DONE/Commands/repair/src/tempban.lua deleted file mode 100644 index 31c029c2..00000000 --- a/old/modules/DONE/Commands/repair/src/tempban.lua +++ /dev/null @@ -1,7 +0,0 @@ --- not_luadoc=true -local temp_ban = require('ExpGamingAdmin').temp_ban -return function(player,entity) - player_return('You have repaired: '..entity.name..' this item is not allowed.',defines.textcolor.crit,player) - temp_ban(player,'','Attempt To Repair A Banned Item') - entity.destroy() -end \ No newline at end of file diff --git a/old/modules/DONE/Commands/tags/control.lua b/old/modules/DONE/Commands/tags/control.lua deleted file mode 100644 index f320144b..00000000 --- a/old/modules/DONE/Commands/tags/control.lua +++ /dev/null @@ -1,45 +0,0 @@ ---- A full ranking system for factorio. --- @module ExpGamingCommands@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - -local Game = require('FactorioStdLib.Game') -local Role -- ExpGamingCore.Role@^4.0.0 - --- Module Define -local module_verbose = false -local ThisModule = { - on_init=function() - if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end - end -} - ---- Gives you a tag --- @command tag --- @param tag the tag you want to have -commands.add_command('tag', 'Give yourself a custom tag. Use "" to have more than one word.', { - ['tag'] = {true,'string-len',20} -}, function(event,args) - local player = Game.get_player(event) - if Role then - local role = Role.get_highest(player) - player.tag = role.tag..' - '..args.tag - else player.tag = args.tag end - player_return('Your tag has been set. Use /tag-clear to remove your tag') -end) - ---- Gives you a tag --- @command tag --- @param tag the tag you want to have -commands.add_command('tag-clear', 'Removes a custom tag.', { - ['player'] = {false,'player-rank'} -}, function(event,args) - local player = args.player or game.player - if Role then - local role = Role.get_highest(player) - player.tag = role.tag - else player.tag = '' end - player_return('Your tag has been removed.') -end) - -return ThisModule \ No newline at end of file diff --git a/old/modules/DONE/Commands/tags/softmod.json b/old/modules/DONE/Commands/tags/softmod.json deleted file mode 100644 index ae4843ee..00000000 --- a/old/modules/DONE/Commands/tags/softmod.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "ExpGamingCommands.tags", - "version": "4.0.0", - "description": "Allows tags to be used by users.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Tags", - "Custom Tags", - "Commands", - "ExpGaming" - ], - "dependencies": { - "ExpGamingLib": "^4.0.0", - "ExpGamingCore.Role": "?^4.0.0", - "ExpGamingCore.Command": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0" - }, - "collection": "ExpGamingCommands@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/Commands/teleport/control.lua b/old/modules/DONE/Commands/teleport/control.lua deleted file mode 100644 index d66f7e1b..00000000 --- a/old/modules/DONE/Commands/teleport/control.lua +++ /dev/null @@ -1,35 +0,0 @@ ---- A full ranking system for factorio. --- @module ExpGamingCommands.teleport@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - -local Admin = require('ExpGamingAdmin') - ---- Teleports the user to the player given --- @command go-to --- @param player player to go to -commands.add_command('go-to', 'Go to a player\'s location', { - ['player']={true,'player-online'} -}, function(event,args) - Admin.go_to(args.player,event) -end) - ---- Teleports a player to the user --- @command bring --- @param player player to go to -commands.add_command('bring', 'Bring a player to your location', { - ['player']={true,'player-online'} -}, function(event,args) - Admin.bring(args.player,event) -end) - ---- Teleports one player to another --- @command tp --- @param player_one the player that is teleported --- @param player_two the player who is the destination -commands.add_command('tp', 'Teleport a player to another player\'s location', { - ['player_one']={true,'player-online'}, - ['player_two']={true,'player-online'} -}, function(event,args) - Admin.tp(args.player_one,args.player_two) -end) diff --git a/old/modules/DONE/Commands/teleport/softmod.json b/old/modules/DONE/Commands/teleport/softmod.json deleted file mode 100644 index 4420b19c..00000000 --- a/old/modules/DONE/Commands/teleport/softmod.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "ExpGamingCommands.teleport", - "version": "4.0.0", - "description": "Adds a few commands used to teleport players.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Teleport", - "Tp", - "Bring", - "GoTo", - "ExpGaming", - "Command", - "Admin", - "Tools" - ], - "dependencies": { - "ExpGamingCore.Command": "^4.0.0", - "ExpGamingAdmin.Teleport": "^4.0.0", - "ExpGamingAdmin": "^4.0.0" - }, - "collection": "ExpGamingCommands@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/Core/Command/control.lua b/old/modules/DONE/Core/Command/control.lua deleted file mode 100644 index ffe85e73..00000000 --- a/old/modules/DONE/Core/Command/control.lua +++ /dev/null @@ -1,298 +0,0 @@ ---- Command system that allows middle ware and auto validation of command arguments. --- @module ExpGamingCore.Command@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias commands - -local Game = require('FactorioStdLib.Game') -local Color = require('FactorioStdLib.Color') - ---- Used as an error constant for validation --- @field commands.error --- @usage return commands.error, 'err message' --- @usage return commands.error('err message') -commands.error = setmetatable({},{__call=function(...) return ... end}) -commands._add_command = commands.add_command -local commandDataStore = {} -local middleware = {} - ---- Used to add middle ware to the command handler, functions should return true or false --- @tparam function callback function(player,commandName,event) should return true to allow next middle ware to run -function commands.add_middleware(callback) if not is_type(callback,'function') then error('Callback is not a function',2) return end table.insert(middleware,callback) end - ---- Index of all command data --- @field commands.data --- @usage commands.command_name -- returns command data --- @usage commands.data -- returns all data --- @tparam string table ?string|table|event key the command that will be returned: is the name, is the command data, event is event from add_command --- @treturn table the command data -setmetatable(commands,{ - __index=function(tbl,key) return is_type(key,'table') and (key.command and rawget(commandDataStore,key.name) or key) or key == 'data' and commandDataStore or rawget(commandDataStore,key) end -}) - ---- Collection of functions that can be used to validate inputs --- @table commands.validate --- @usage commands.validate[type](value,event,...) --- @tparam string type the type that the value should be --- @param value the value that will be tested --- @param ... any other data that can be passed to the function --- @return[1] the validated value --- @return[2] error constant --- @return[2] the err message --- @field __comment replace _ with - the ldoc did not like me using - in the names --- @field string basically does nothing but a type filed is required --- @field string_inf same as string but is infinite in length, must be last arg --- @field string_len same as string but can define a max length --- @field number converts the input into a number --- @field number_int converts the input to a number and floors it --- @field number_range allows a number in a range min < X <= max --- @field number_range allows a number in a range after it has been floored min < math.floor(X) <= max --- @field player converts the input into a valid player --- @field player_online converts the input to a player if the player is online --- @field player_alive converts the input to a player if the player is online and alive --- @field player_role converts the input to a player if the player is a lower rank than the user or if the person is not admin and the user is --- @field player_role-online converts the input to a player if the player is a lower rank than the user and online --- @field player_role_alive converts the input to a player if the player is a lower rank than the user and online and alive -commands.validate = { - ['boolean']=function(value) value = value.lower() if value == 'true' or value == 'yes' or value == 'y' or value == '1' then return true else return false end end, - ['string']=function(value) return tostring(value) end, - ['string-inf']=function(value) return tostring(value) end, - ['string-list']=function(value,event,list) - local rtn = tostring(value) and table.includes(list,tostring(value)) and tostring(value) or nil - if not rtn then return commands.error{'expcore-commands.error-string-list',table.concat(list,', ')} end return rtn end, - ['string-len']=function(value,event,max) - local rtn = tostring(value) and tostring(value):len() <= max and tostring(value) or nil - if not rtn then return commands.error{'expcore-commands.error-string-len',max} end return rtn end, - ['number']=function(value) - local rtn = tonumber(value) or nil - if not rtn then return commands.error{'expcore-commands.error-number'} end return rtn end, - ['number-int']=function(value) - local rtn = tonumber(value) and math.floor(tonumber(value)) or nil - if not rtn then return commands.error{'expcore-commands.error-number'} end return rtn end, - ['number-range']=function(value,event,min,max) - local rtn = tonumber(value) and tonumber(value) > min and tonumber(value) <= max and tonumber(value) or nil - if not rtn then return commands.error{'expcore-commands.error-number-range',min,max} end return rtn end, - ['number-range-int']=function(value,event,min,max) - local rtn = tonumber(value) and math.floor(tonumber(value)) > min and math.floor(tonumber(value)) <= max and math.floor(tonumber(value)) or nil - if not rtn then return commands.error{'expcore-commands.error-number-range',min,max} end return rtn end, - ['player']=function(value) - local rtn = Game.get_player(value) or nil - if not rtn then return commands.error{'expcore-commands.error-player',value} end return rtn end, - ['player-online']=function(value) - local player,err = commands.validate['player'](value) - if err then return commands.error(err) end - local rtn = player.connected and player or nil - if not rtn then return commands.error{'expcore-commands.error-player-online'} end return rtn end, - ['player-alive']=function(value) - local player,err = commands.validate['player-online'](value) - if err then return commands.error(err) end - local rtn = player.character and player.character.health > 0 and player or nil - if not rtn then return commands.error{'expcore-commands.error-player-alive'} end return rtn end, - ['player-rank']=function(value,event) - local player,err = commands.validate['player'](value) - if err then return commands.error(err) end - local rtn = player.admin and Game.get_player(event).admin and player or nil - if not rtn then return commands.error{'expcore-commands.error-player-rank'} end return rtn end, - ['player-rank-online']=function(value) - local player,err = commands.validate['player-online'](value) - if err then return commands.error(err) end - local player,err = commands.validate['player-rank'](player) - if err then return commands.error(err) end return player end, - ['player-rank-alive']=function(value) - local player,err = commands.validate['player-alive'](value) - if err then return commands.error(err) end - local player,err = commands.validate['player-rank'](player) - if err then return commands.error(err) end return player end, -} ---- Adds a function to the validation list --- @tparam string name the name of the validation --- @tparam function callback function(value,event) which returns either the value to be used or commands.error{'error-message'} -function commands.add_validation(name,callback) if not is_type(callback,'function') then error('Callback is not a function',2) return end commands.validate[name]=callback end - ---- Returns the inputs of this command as a formated string --- @usage commands.format_inputs('interface') -- returns (if you have ExpGamingCore.Server) --- @tparam ?string|table|event command the command to get the inputs of --- @treturn string the formated string for the inputs -function commands.format_inputs(command) - command = commands[command] - if not is_type(command,'table') then error('Command is not valid',2) end - local rtn = '' - for name,data in pairs(command.inputs) do - if data[1] == false then rtn=rtn..string.format('[%s] ',name) - else rtn=rtn..string.format('<%s> ',name) end - end - return rtn -end - ---- Used to validate the arguments of a command, will understand strings with "" as a single param else spaces divede the params --- @usage commands.validate_args(event) -- returns args table --- @tparam table event this is the event created by add_command not on_console_command --- @treturn[1] table the args for this command --- @return[2] command.error --- @treturn string the error that happend while parsing the args -function commands.validate_args(event) - local command = commands[event.name] - if not is_type(command,'table') then error('Command not valid',2) end - local rtn = {} - local count = 0 - local count_opt = 0 - for _,data in pairs(command.inputs) do count = count + 1 if data[1] == false then count_opt = count_opt + 1 end end - -- checks that there is some args given if there is meant to be - if not event.parameter then - if count == count_opt then return rtn - else return commands.error('invalid-inputs') end - end - -- splits the args into words so that it can be used to assign values - local words = string.split(event.parameter,' ') - local index = 0 - for _,word in pairs(words) do - index = index+1 - if not word then break end - local pos, _pos = word:find('"') - local hasSecond = pos and word:find('"',pos+1) or nil - while not hasSecond and pos and pos == _pos do - local next = table.remove(words,index+1) - if not next then return commands.error('invalid-parse') end - words[index] = words[index]..' '..next - _pos = words[index]:find('"',pos+1) - end - end - -- assigns the values from the words to the args - index = 0 - for name,data in pairs(command.inputs) do - index = index+1 - local arg = words[index] - if not arg and data[1] then return commands.error('invalid-inputs') end - if data[2] == 'string-inf' then rtn[name] = table.concat(words,' ',index) break end - local valid = is_type(data[2],'function') and data[2] or commands.validate[data[2]] or error('Invalid validation ("'..tostring(data[2])..'") for command: "'..command.name..'/'..name..'"') - local temp_tbl = table.deepcopy(data) table.remove(temp_tbl,1) table.remove(temp_tbl,1) - local value, err = valid(arg,event,unpack(temp_tbl)) - if value == commands.error then return value, err end - rtn[name] = is_type(value,'string') and value:gsub('"','') or value - end - return rtn -end - ---- Used to return all the commands a player can use --- @usage get_commands(1) -- return table of command data for each command that the player can use --- @tparam ?index|name|player| player the player to test as --- @treturn table a table containg all the commands the player can use -function commands.get_commands(player) - player = Game.get_player(player) - local commands = {} - if not player then return error('Invalid player',2) end - for name,data in pairs(commandDataStore) do - if #middleware > 0 then for _,callback in pairs(middleware) do - local success, err = pcall(callback,player,name,data) - if not success then error(err) - elseif err then table.insert(commands,data) end - end elseif data.default_admin_only == true and player.admin then table.insert(commands,data) end - end - return commands -end - -local function logMessage(player_name,command,message,args) - game.write_file('commands.log', - game.tick - ..' Player: "'..player_name..'"' - ..' '..message..': "'..command.name..'"' - ..' With args of: '..table.tostring(args) - ..'\n' - , true, 0) -end - ---- Used to call the custom commands --- @usage You dont its an internal command --- @tparam table command the event rasied by the command -local function run_custom_command(command) - local data = commands.data[command.name] - local player = Game.get_player(command) or SERVER - -- runs all middle ware if any, if there is no middle where then it relies on .default_admin_only - if #middleware > 0 then for _,callback in pairs(middleware) do - local success, err = pcall(callback,player,command.name,command) - if not success then error(err) - elseif not err then - player_return({'expcore-commands.command-fail',{'expcore-commands.unauthorized'}},defines.textcolor.crit) - logMessage(player.name,command,'Failed to use command (Unauthorized)',commands.validate_args(command)) - game.player.play_sound{path='utility/cannot_build'} - return - end - end elseif data.default_admin_only == true and player and not player.admin then - player_return({'expcore-commands.command-fail',{'expcore-commands.unauthorized'}},defines.textcolor.crit) - logMessage(player.name,command,'Failed to use command (Unauthorized)',commands.validate_args(command)) - game.player.play_sound{path='utility/cannot_build'} - return - end - -- gets the args for the command - local args, err = commands.validate_args(command) - if args == commands.error then - if is_type(err,'table') then table.insert(err,command.name) table.insert(err,commands.format_inputs(data)) - player_return({'expcore-commands.command-fail',err},defines.textcolor.high) else player_return({'expcore-commands.command-fail',{'expcore-commands.invalid-inputs',command.name,commands.format_inputs(data)}},defines.textcolor.high) end - logMessage(player.name,command,'Failed to use command (Invalid Args)',args) - player.play_sound{path='utility/deconstruct_big'} - return - end - -- runs the command - local success, err = pcall(data.callback,command,args) - if not success then error(err) end - if err ~= commands.error then player_return({'expcore-commands.command-ran'},defines.textcolor.info) end - logMessage(player.name,command,'Used command',args) -end - ---- Used to define commands --- @usage --see examples in file --- @tparam string name the name of the command --- @tparam[opt='No string Description'] description the description of the command --- @tparam[opt=an table table infinite string] inputs a of the inputs to be used, last index being true makes the last parameter open ended (longer than one word) --- @tparam function function callback the to call on the event -commands.add_command = function(name, description, inputs, callback) - if commands[name] then error('That command is already registered',2) end - if not is_type(name,'string') then error('Command name has not been given') end - if not is_type(callback,'function') or not is_type(inputs,'table') then - if is_type(inputs,'function') then commands._add_command(name,description,inputs) - else error('Invalid args given to add_command') end - end - verbose('Created Command: '..name) - -- test for string and then test for locale string - description = is_type(description,'string') and description - or is_type(description,'table') and is_type(description[1],'string') and string.find(description[1],'.+[.].+') and {description,''} - or 'No Description' - inputs = is_type(inputs,'table') and inputs or {['param']={false,'string-inf'}} - commandDataStore[name] = { - name=name, - description=description, - inputs=inputs, - callback=callback, - admin_only=false - } - local help = is_type(description,'string') and commands.format_inputs(name)..'- '..description - or is_type(description,'table') and is_type(description[1],'string') and string.find(description[1],'.+[.].+') and {description,commands.format_inputs(name)..'- '} - or commands.format_inputs(name) - commandDataStore[name].help = help - commands._add_command(name,help,function(...) - local success, err = Manager.sandbox(run_custom_command,{},...) - if not success then error(err) end - end) - return commandDataStore[name] -end - -return commands - ---[[ - command example - - **locale file** - [foo] - description=__1__ this is a command - - **control.lua** - commands.add_command('foo',{'foo.description'},{ - ['player']={true,'player'}, -- a required arg that must be a valid player - ['number']={true,'number-range',0,10}, -- a required arg that must be a number 0 0 then - local update = 4 - if global.cam_index >= #global.cams then global.cam_index = 1 end - if update > #global.cams then update = #global.cams end - for cam_offset = 0,update do - local _cam = global.cams[global.cam_index+cam_offset] - if not _cam then break end - if not _cam.cam.valid then table.remove(global.cams,global.cam_index) - elseif not _cam.entity.valid then table.remove(global.cams,global.cam_index) - else _cam.cam.position = _cam.entity.position if not _cam.surface then _cam.cam.surface_index = _cam.entity.surface.index end global.cam_index = global.cam_index+1 - end - end - global.cam_index = global.cam_index+update - end -end) - -Event.add('on_player_respawned',function(event) - if loaded_modules['ExpGamingCore.Server'] then return end - if global.players and is_type(global.players,'table') and #global.players > 0 and global.players[event.player_index] then - local remove = {} - local player = Game.get_player(event) - for index,cam in pairs(global.players[event.player_index]) do - if cam.valid then table.insert(global.cams,{cam=cam,entity=player.character,surface=player.surface}) - else table.insert(remove,index) end - end - for n,index in pairs(remove) do - table.remove(global.players[event.player_index],index-n+1) - end - end -end) - -function Gui:on_init() - if loaded_modules['ExpGamingCore.Server'] then - Server = require('ExpGamingCore.Server') - verbose('ExpGamingCore.Server is installed; Loading server src') - script.on_init(require(module_path..'/src/server',{Gui=self})) - end -end - -function Gui.on_post() - Gui.test = require(module_path..'/src/test',{Gui=Gui}) -end - - -return Gui \ No newline at end of file diff --git a/old/modules/DONE/Core/Gui/inputs/control.lua b/old/modules/DONE/Core/Gui/inputs/control.lua deleted file mode 100644 index 1da9afee..00000000 --- a/old/modules/DONE/Core/Gui/inputs/control.lua +++ /dev/null @@ -1,375 +0,0 @@ ---- Adds a clean way of making new inputs for a gui allowing for sliders and text inputs to be hanndleded with custom events --- @module ExpGamingCore.Gui.Inputs --- @alias inputs --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - ---- This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module --- @function _comment - -local Game = require('FactorioStdLib.Game') -local Color = require('FactorioStdLib.Color') -local mod_gui = require('mod-gui') -local Gui = require('ExpGamingCore.Gui') - -local inputs = {} -inputs._prototype = {} --- these are just so you can have short cuts to this -inputs.events = { - --error={}, -- this is added after event calls are added as it is not a script event - state=defines.events.on_gui_checked_state_changed, - click=defines.events.on_gui_click, - elem=defines.events.on_gui_elem_changed, - selection=defines.events.on_gui_selection_state_changed, - text=defines.events.on_gui_text_changed, - slider=defines.events.on_gui_value_changed -} - ---- Sets the input to trigger on an certain event --- @usage button:on_event(defines.events.on_gui_click,player_return) --- @param event the event to raise callback on | can be number of the event | can be a key of inputs.events --- @tparam function function callback the you want to run on the event --- @treturn table returns self so you can chain together -function inputs._prototype:on_event(event,callback) - if not is_type(callback,'function') then return self end - if inputs.events[event] then event = inputs.events[event] end - if event == inputs.events.error then self._error = callback return self end - self.events[event] = callback - return self -end - ---- Draw the input into the root element --- @usage button:draw(frame) --- @param root the element you want to add the input to --- @return returns the element that was added -function inputs._prototype:draw(root) - local player = Game.get_player(root.player_index) - if is_type(self.draw_data.caption,'string') and player.gui.is_valid_sprite_path(self.draw_data.caption) then - local data = table.deepcopy(self.draw_data) - data.type = 'sprite-button' - data.sprite = data.caption - data.caption = nil - return root.add(data) - elseif is_type(self.draw_data.sprite,'string') and player.gui.is_valid_sprite_path(self.draw_data.sprite) then - local data = table.deepcopy(self.draw_data) - data.type = 'sprite-button' - return root.add(data) - elseif is_type(self.data._state,'function') then - local data = table.deepcopy(self.draw_data) - local success, err = pcall(self.data._state,player,root) - if success then data.state = err else error(err) end - return root.add(data) - elseif is_type(self.data._start,'function') then - local data = table.deepcopy(self.draw_data) - local success, err = pcall(self.data._start,player,root) - if success then data.value = err else error(err) end - return root.add(data) - elseif is_type(self.data._index,'function') then - local data = table.deepcopy(self.draw_data) - local success, err = pcall(self.data._index,player,root) - if success then data.selected_index = err else error(err) end - if is_type(self.data._items,'function') then - local success, err = pcall(self.data._items,player,root) - if success then data.items = err else error(err) end - end - return root.add(data) - elseif is_type(self.data._items,'function') then - local data = table.deepcopy(self.draw_data) - local success, err = pcall(self.data._items,player,root) - if success then data.items = err else error(err) end - if is_type(self.data._index,'function') then - local _success, _err = pcall(self.data._index,player,root) - if _success then data.selected_index = _err else error(_err) end - end - return root.add(data) - else - return root.add(self.draw_data) - end -end - ---- Add a new input, this is the same as doing frame.add{} but returns a different object --- @usage Gui.inputs.add{type='button',name='test',caption='Test'} --- @usage return_value(frame) -- draws the button onto that frame --- @tparam table obj the new element to add if caption is a sprite path then sprite is used --- @treturn table the custom input object, calling the returned value will draw the button -function inputs.add(obj) - if not is_type(obj,'table') then return end - if not is_type(obj.type,'string') then return end - local type = obj.type - if type ~= 'button' - and type ~= 'sprite-button' - and type ~= 'choose-elem-button' - and type ~= 'checkbox' - and type ~= 'radiobutton' - and type ~= 'textfield' - and type ~= 'text-box' - and type ~= 'slider' - and type ~= 'drop-down' - then return end - verbose('Created Input: '..obj.name..' ('..obj.type..')') - if obj.type == 'button' or obj.type == 'sprite-button' then obj.style = mod_gui.button_style end - obj.draw_data = table.deepcopy(obj) - obj.data = {} - obj.events = {} - setmetatable(obj,{__index=inputs._prototype,__call=function(self,...) return self:draw(...) end}) - Gui.data('inputs_'..type,obj.name,obj) - return obj -end - --- this just runs the events given to inputs -function inputs._event_handler(event) - if not event.element then return end - local elements = Gui.data['inputs_'..event.element.type] or {} - local element = elements[event.element.name] - if not element and event.element.type == 'sprite-button' then - elements = Gui.data.inputs_button or {} - element = elements[event.element.name] - end - if element then - verbose('There was a gui event ('..Event.names[event.name]..') with element: '..event.element.name) - if not is_type(element.events[event.name],'function') then return end - local success, err = Manager.sandbox(element.events[event.name],{},event) - if not success then - if is_type(element._error,'function') then pcall(element._error) - else error(err) end - end - end -end - -Event.add(inputs.events,inputs._event_handler) -inputs.events.error = {} - --- the following functions are just to make inputs easier but if what you want is not include use inputs.add(obj) ---- Used to define a button, can have many function --- @usage Gui.inputs.add_button('test','Test','Just for testing',{{condition,callback},...}) --- @tparam string name the name of this button --- @tparam string the display for this button, either text or sprite path --- @tparam string tooltip the tooltip to show on the button --- @param callbacks can either be a single function or a list of function pairs see examples at bottom --- @treturn table the button object that was made, to allow a custom error event if wanted -function inputs.add_button(name,display,tooltip,callbacks) - local rtn_button = inputs.add{ - type='button', - name=name, - caption=display, - tooltip=tooltip - } - rtn_button.data._callbacks = callbacks - rtn_button:on_event('click',function(event) - local elements = Gui.data['inputs_'..event.element.type] or {} - local button = elements[event.element.name] - if not button and event.element.type == 'sprite-button' then - elements = Gui.data.inputs_button or {} - button = elements[event.element.name] - end - local player = Game.get_player(event) - local mouse = event.button - local keys = {alt=event.alt,ctrl=event.control,shift=event.shift} - local element = event.element - local btn_callbacks = button.data._callbacks - if is_type(btn_callbacks,'function') then btn_callbacks = {{function() return true end,btn_callbacks}} end - for _,data in pairs(btn_callbacks) do - if is_type(data[1],'function') and is_type(data[2],'function') then - local success, err = pcall(data[1],player,mouse,keys,event) - if success and err == true then - local _success, _err = pcall(data[2],player,element,event) - if not _success then error(_err) end - elseif not success then error(err) end - else error('Invalid Callback Condition Format') end - end - end) - return rtn_button -end - ---- Used to define a choose-elem-button callback only on elem_changed --- @usage Gui.inputs.add_elem_button('test','Test','Just for testing',function) --- @tparam string name the name of this button --- @tparam string elem_type the display for this button, either text or sprite path --- @tparam string tooltip the tooltip to show on the button --- @tparam function callback the callback to call on change function(player,element,elem) --- @treturn table the button object that was made, to allow a custom error event if wanted -function inputs.add_elem_button(name,elem_type,tooltip,callback) - local button = inputs.add{ - type='choose-elem-button', - name=name, - elem_type=elem_type, - tooltip=tooltip - } - button.data._callback = callback - button:on_event('elem',function(event) - local button = Gui.data['inputs_'..event.element.type][event.element.name] - local player = Game.get_player(event) - local element = event.element or {elem_type=nil,elem_value=nil} - local elem = {type=element.elem_type,value=element.elem_value} - if is_type(button.data._callback,'function') then - local success, err = pcall(button.data._callback,player,element,elem) - if not success then error(err) end - else error('Invalid Callback') end - end) - return button -end - ---- Used to define a checkbox callback only on state_changed --- @usage Gui.inputs.add_checkbox('test',false,'Just for testing',function,function,funvtion) --- @tparam string name the name of this button --- @tparam boolean radio if this is a radio button --- @tparam string display the display for this button, either text or sprite path --- @tparam function default the callback which choses the default check state --- @tparam function callback_true the callback to call when changed to true --- @tparam function callback_false the callback to call when changed to false --- @treturn table the button object that was made, to allow a custom error event if wanted -function inputs.add_checkbox(name,radio,display,default,callback_true,callback_false) - local type = 'checkbox'; if radio then type='radiobutton' end - local state = false; if is_type(default,'boolean') then state = default end - local rtn_checkbox = inputs.add{ - type=type, - name=name, - caption=display, - state=state - } - if is_type(default,'function') then rtn_checkbox.data._state = default end - rtn_checkbox.data._true = callback_true - rtn_checkbox.data._false = callback_false - rtn_checkbox:on_event('state',function(event) - local checkbox = Gui.data['inputs_'..event.element.type][event.element.name] - local player = Game.get_player(event) - if event.element.state then - if is_type(checkbox.data._true,'function') then - local success, err = pcall(checkbox.data._true,player,event.element) - if not success then error(err) end - else error('Invalid Callback') end - else - if is_type(checkbox.data._false,'function') then - local success, err = pcall(checkbox.data._false,player,event.element) - if not success then error(err) end - else error('Invalid Callback') end - end - end) - return rtn_checkbox -end - ---- Used to reset the state of radio buttons, recommended to be called on_state_change to reset any radio buttons it is meant to work with. --- @usage Gui.inputs.reset_radio{radio1,radio2,...} --- @param elements can be a list of elements or a single element -function inputs.reset_radio(elements) - if #elements > 0 then - for _,element in pairs(elements) do - if element.valid then - local _elements = Gui.data['inputs_'..element.type] or {} - local _element = _elements[element.name] - local player = Game.get_player(element.player_index) - local state = false - local success, err = pcall(_element.data._state,player,element.parent) - if success then state = err else error(err) end - element.state = state - end - end - else - if elements.valid then - local _elements = Gui.data['inputs_'..elements.type] or {} - local _element = _elements[elements.name] - local player = Game.get_player(elements.player_index) - local state = false - local success, err = pcall(_element.data._state,player,elements.parent) - if success then state = err else error(err) end - elements.state = state - end - end -end - ---- Used to define a text callback only on text_changed --- @usage Gui.inputs.add_text('test',false,'Just for testing',function) --- @tparam string name the name of this button --- @tparam boolean box is it a text box rather than a text field --- @tparam string text the starting text --- @tparam function callback the callback to call on change function(player,text,element) --- @treturn table the text object that was made, to allow a custom error event if wanted -function inputs.add_text(name,box,text,callback) - local type = 'textfield'; if box then type='text-box' end - local rtn_textbox = inputs.add{ - type=type, - name=name, - text=text - } - rtn_textbox.data._callback = callback - rtn_textbox:on_event('text',function(event) - local textbox = Gui.data['inputs_'..event.element.type][event.element.name] - local player = Game.get_player(event) - local element = event.element - local event_callback = textbox.data._callback - if is_type(event_callback,'function') then - local success, err = pcall(event_callback,player,element.text,element) - if not success then error(err) end - else error('Invalid Callback Condition Format') end - end) - return rtn_textbox -end - ---- Used to define a slider callback only on value_changed --- @usage Gui.inputs.add_slider('test','horizontal',1,10,5,function) --- @tparam string name the name of this button --- @tparam string orientation direction of the slider --- @tparam number min the lowest number --- @tparam number max the highest number --- @tparam number function function start_callback either a or a to return a number --- @tparam function function callback the to be called on value_changed function(player,value,percent,element) --- @treturn table the slider object that was made, to allow a custom error event if wanted -function inputs.add_slider(name,orientation,min,max,start_callback,callback) - local slider = inputs.add{ - type='slider', - name=name, - orientation=orientation, - minimum_value=min, - maximum_value=max, - value=start_callback - } - slider.data._start = start_callback - slider.data._callback = callback - slider:on_event('slider',function(event) - local slider = Gui.data['inputs_'..event.element.type][event.element.name] - local player = Game.get_player(event) - local value = event.element.slider_value - local data = slider.data - local percent = value/event.element.get_slider_maximum() - if is_type(data._callback,'function') then - local success, err = pcall(data._callback,player,value,percent,event.element) - if not success then error(err) end - else error('Invalid Callback Condition Format') end - end) - return slider -end - ---- Used to define a drop down callback only on value_changed --- @usage Gui.inputs.add_drop_down('test',{1,2,3},1,function) --- @tparam string name name of the drop down --- @param items either a list or a function which returns a list --- @param index either a number or a function which returns a number --- @tparam function callback the callback which is called when a new index is selected function(player,selected,items,element) --- @treturn table the drop-down object that was made, to allow a custom error event if wanted -function inputs.add_drop_down(name,items,index,callback) - local rtn_dropdown = inputs.add{ - type='drop-down', - name=name, - items=items, - selected_index=index - } - rtn_dropdown.data._items = items - rtn_dropdown.data._index = index - rtn_dropdown.data._callback = callback - rtn_dropdown:on_event('selection',function(event) - local dropdown = Gui.data['inputs_'..event.element.type][event.element.name] - local player = Game.get_player(event) - local element = event.element - local drop_items = element.items - local selected = drop_items[element.selected_index] - local drop_callback = dropdown.data._callback - if is_type(drop_callback,'function') then - local success, err = pcall(drop_callback,player,selected,drop_items,element) - if not success then error(err) end - else error('Invalid Callback Condition Format') end - end) - return rtn_dropdown -end - --- calling will attempt to add a new input -return setmetatable(inputs,{__call=function(self,...) return self.add(...) end}) diff --git a/old/modules/DONE/Core/Gui/inputs/softmod.json b/old/modules/DONE/Core/Gui/inputs/softmod.json deleted file mode 100644 index ba17e5a2..00000000 --- a/old/modules/DONE/Core/Gui/inputs/softmod.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "ExpGamingCore.Gui.inputs", - "version": "4.0.0", - "description": "Addds an event manager for gui inputs and easy input creation", - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "location": "FSM_ARCHIVE", - "keywords": [ - "Gui", - "Inputs", - "Buttons", - "Text Fields" - ], - "collection": "ExpGamingCore.Gui@4.0.0", - "dependencies": { - "mod-gui": "*", - "FactorioStdLib.Color": "^0.8.0", - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Gui": "^4.0.0" - }, - "submodules": {} -} diff --git a/old/modules/DONE/Core/Gui/left/control.lua b/old/modules/DONE/Core/Gui/left/control.lua deleted file mode 100644 index ac281d58..00000000 --- a/old/modules/DONE/Core/Gui/left/control.lua +++ /dev/null @@ -1,246 +0,0 @@ ---- Adds a organiser for left gui elements which will automatically update there information and have open requirements --- @module ExpGamingCore.Gui.Left --- @alias left --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - ---- This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module --- @function _comment -local Game = require('FactorioStdLib.Game') -local Server = require('ExpGamingCore.Server') -local Color = require('FactorioStdLib.Color') -local mod_gui = require('mod-gui') -local Gui = require('ExpGamingCore.Gui') -local order_config = require(module_path..'/order_config') -local Role -- this is optional and is handled by it being present, it is loaded on init - -local left = {} -left._prototype = {} - -left.hide = Gui.inputs{ - name='gui-left-hide', - type='button', - caption='<' -}:on_event('click',function(event) - for _,child in pairs(event.element.parent.children) do - if child.name ~= 'popups' then child.style.visible = false end - end -end) - -local global = {} -Global.register(global,function(tbl) global = tbl end) - --- used for debugging -function left.override_open(state) - global.over_ride_left_can_open = state -end ---- Used to add a left gui frame --- @usage Gui.left.add{name='foo',caption='Foo',tooltip='just testing',open_on_join=true,can_open=function,draw=function} --- @usage return_value(player) -- toggles visibility for that player, if no player then updates for all players --- @param obj this is what will be made, needs a name and a draw function(root_frame), open_on_join can be used to set the default state true/false, can_open is a test to block it from opening but is not needed --- @return the object that is made, calling the returned value with out a param will update the gui, else will toggle visibility for that player -function left.add(obj) - if not is_type(obj,'table') then return end - if not is_type(obj.name,'string') then return end - verbose('Created Left Gui: '..obj.name) - setmetatable(obj,{__index=left._prototype,__call=function(self,player) if player then return self:toggle(player) else return left.update(self.name) end end}) - Gui.data('left',obj.name,obj) - if Gui.toolbar then Gui.toolbar(obj.name,obj.caption,obj.tooltip,function(event) obj:toggle(event) end) end - return obj -end - ---- This is used to update all the guis of connected players, good idea to use our thread system as it as nested for loops --- @usage Gui.left.update() --- @tparam[opt] string frame this is the name of a frame if you only want to update one --- @param[opt] players the player to update for, if not given all players are updated, can be one player -function left.update(frame,players) - if not Server or not Server._thread then - players = is_type(players,'table') and #players > 0 and {unpack(players)} or is_type(players,'table') and {players} or Game.get_player(players) and {Game.get_player(players)} or game.connected_players - for _,player in pairs(players) do - local frames = Gui.data.left or {} - if frame then frames = {[frame]=frames[frame]} or {} end - for _,left_frame in pairs(frames) do - if left_frame then left_frame:first_open(player) end - end - end - else - local frames = Gui.data.left or {} - if frame then frames = {[frame]=frames[frame]} or {} end - players = is_type(players,'table') and #players > 0 and {unpack(players)} or is_type(players,'table') and {players} or Game.get_player(players) and {Game.get_player(players)} or game.connected_players - Server.new_thread{ - data={players=players,frames=frames} - }:on_event('tick',function(thread) - if #thread.data.players == 0 then thread:close() return end - local player = table.remove(thread.data.players,1) - Server.new_thread{ - data={player=player,frames=thread.data.frames} - }:on_event('resolve',function(thread) - for _,left_frame in pairs(thread.data.frames) do - if left_frame then left_frame:first_open(thread.data.player) end - end - end):queue() - end):open() - end -end - ---- Used to open the left gui of every player --- @usage Gui.left.open('foo') --- @tparam string left_name this is the gui that you want to open --- @tparam[opt] LuaPlayer the player to open the gui for -function left.open(left_name,player) - local players = player and {player} or game.connected_players - local _left = Gui.data.left[left_name] - if not _left then return end - if not Server or not Server._thread then - for _,next_player in pairs(players) do _left:open(next_player) end - else - Server.new_thread{ - data={players=players} - }:on_event('tick',function(thread) - if #thread.data.players == 0 then thread:close() return end - local next_player = table.remove(thread.data.players,1) - _left:open(next_player) - end):open() - end -end - ---- Used to close the left gui of every player --- @usage Gui.left.close('foo') --- @tparam string left_name this is the gui that you want to close --- @tparam[opt] LuaPlayer the player to close the gui for -function left.close(left_name,player) - local players = player and {player} or game.connected_players - local _left = Gui.data.left[left_name] - if not _left then return end - if not Server or not Server._thread or player then - for _,next_player in pairs(players) do _left:close(next_player) end - else - Server.new_thread{ - data={players=players} - }:on_event('tick',function(thread) - if #thread.data.players == 0 then thread:close() return end - local next_player = table.remove(thread.data.players,1) - _left:close(next_player) - end):open() - end -end - - ---- Used to force the gui open for the player --- @usage left:open(player) --- @tparam luaPlayer player the player to open the gui for -function left._prototype:open(player) - player = Game.get_player(player) - if not player then error('Invalid Player') end - local left_flow = mod_gui.get_frame_flow(player) - if not left_flow[self.name] then self:first_open(player) end - left_flow[self.name].style.visible = true - if left_flow['gui-left-hide'] then left_flow['gui-left-hide'].style.visible = true end -end - ---- Used to force the gui closed for the player --- @usage left:open(player) --- @tparam luaPlayer player the player to close the gui for -function left._prototype:close(player) - player = Game.get_player(player) - if not player then error('Invalid Player') end - local left_flow = mod_gui.get_frame_flow(player) - if not left_flow[self.name] then self:first_open(player) end - left_flow[self.name].style.visible = false - local count = 0 - for _,child in pairs(left_flow.children) do if child.style.visible then count = count+1 end if count > 1 then break end end - if count == 1 and left_flow['gui-left-hide'] then left_flow['gui-left-hide'].style.visible = false end -end - ---- When the gui is first made or is updated this function is called, used by the script --- @usage left:first_open(player) -- returns the frame --- @tparam LuaPlayer player the player to draw the gui for --- @treturn LuaFrame the frame made/updated -function left._prototype:first_open(player) - player = Game.get_player(player) - local left_flow = mod_gui.get_frame_flow(player) - local frame - if left_flow[self.name] then - frame = left_flow[self.name] - frame.clear() - else - if not left_flow['gui-left-hide'] then left.hide(left_flow).style.maximal_width=15 end - frame = left_flow.add{type='frame',name=self.name,style=mod_gui.frame_style,caption=self.caption,direction='vertical'} - frame.style.visible = false - if is_type(self.open_on_join,'boolean') then frame.style.visible = self.open_on_join left_flow['gui-left-hide'].style.visible = true end - end - if is_type(self.draw,'function') then self:draw(frame) else frame.style.visible = false error('No Callback On '..self.name) end - return frame -end - ---- Toggles the visibility of the gui based on some conditions --- @usage left:toggle(player) -- returns new state --- @tparam LuaPlayer player the player to toggle the gui for, remember there are condition which need to be met --- @treturn boolean the new state that the gui is in -function left._prototype:toggle(player) - player = Game.get_player(player) - local left_flow = mod_gui.get_frame_flow(player) - if not left_flow[self.name] then self:first_open(player) end - local left_frame = left_flow[self.name] - local open = false - if is_type(self.can_open,'function') then - local success, err = pcall(self.can_open,player) - if not success then error(err) - elseif err == true then open = true - elseif global.over_ride_left_can_open then - if is_type(Role,'table') then - if Role.allowed(player,self.name) then open = true - else open = {'ExpGamingCore_Gui.unauthorized'} end - else open = true end - else open = err end - else - if is_type(Role,'table') then - if Role.allowed(player,self.name) then open = true - else open = {'ExpGamingCore_Gui.unauthorized'} end - else open = true end - end - if open == true and left_frame.style.visible ~= true then - left_frame.style.visible = true - left_flow['gui-left-hide'].style.visible = true - else - left_frame.style.visible = false - local count = 0 - for _,child in pairs(left_flow.children) do if child.style.visible then count = count+1 end if count > 1 then break end end - if count == 1 and left_flow['gui-left-hide'] then left_flow['gui-left-hide'].style.visible = false end - end - if open == false then player_return({'ExpGamingCore_Gui.cant-open-no-reason'},defines.textcolor.crit,player) player.play_sound{path='utility/cannot_build'} - elseif open ~= true then player_return({'ExpGamingCore_Gui.cant-open',open},defines.textcolor.crit,player) player.play_sound{path='utility/cannot_build'} end - return left_frame.style.visible -end - -Event.add(defines.events.on_player_joined_game,function(event) - -- draws the left guis when a player first joins, fake_event is just because i am lazy - local player = Game.get_player(event) - local frames = Gui.data.left or {} - local left_flow = mod_gui.get_frame_flow(player) - if not left_flow['gui-left-hide'] then left.hide(left_flow).style.maximal_width=15 end - local done = {} - for _,name in pairs(order_config) do - local left_frame = Gui.data.left[name] - if left_frame then - done[name] = true - left_frame:first_open(player) - end - end - for name,left_frame in pairs(frames) do - if not done[name] then left_frame:first_open(player) end - end -end) - -Event.add(defines.events.on_tick,function(event) - if ((event.tick+10)/(3600*game.speed)) % 15 == 0 then - left.update() - end -end) - -function left.on_init() - if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end -end - --- calling will attempt to add a new gui -return setmetatable(left,{__call=function(self,...) return self.add(...) end}) \ No newline at end of file diff --git a/old/modules/DONE/Core/Gui/left/order_config.lua b/old/modules/DONE/Core/Gui/left/order_config.lua deleted file mode 100644 index 7f19658f..00000000 --- a/old/modules/DONE/Core/Gui/left/order_config.lua +++ /dev/null @@ -1,13 +0,0 @@ -return { - 'server-info', - 'readme', - 'science', - 'rockets', - 'player-list', - 'tasklist', - 'warp-list', - 'polls', - 'announcements', - 'admin-commands', - 'game-settings' -} \ No newline at end of file diff --git a/old/modules/DONE/Core/Gui/left/softmod.json b/old/modules/DONE/Core/Gui/left/softmod.json deleted file mode 100644 index d02b320e..00000000 --- a/old/modules/DONE/Core/Gui/left/softmod.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "ExpGamingCore.Gui.left", - "version": "4.0.0", - "description": "Adds an easy way to create auto updating left guis with toggle buttons.", - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "location": "FSM_ARCHIVE", - "keywords": [ - "Gui", - "Left", - "AutoUpdate" - ], - "collection": "ExpGamingCore.Gui@4.0.0", - "dependencies": { - "mod-gui": "*", - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Server": "^4.0.0", - "FactorioStdLib.Color": "^0.8.0", - "ExpGamingCore.Gui": "^4.0.0", - "ExpGamingCore.Gui.inputs": "^4.0.0", - "ExpGamingCore.Gui.toolbar": "?^4.0.0", - "ExpGamingCore.Role": "?^4.0.0" - }, - "submodules": {} -} diff --git a/old/modules/DONE/Core/Gui/locale/de.cfg b/old/modules/DONE/Core/Gui/locale/de.cfg deleted file mode 100644 index fbdba2f7..00000000 --- a/old/modules/DONE/Core/Gui/locale/de.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingCore_Gui] -unauthorized=401 - Unbefugt: Du hast keinen Zugriff auf diese Befehle! -cant-open=Du kannst dieses Menü nicht öffnen, Grund: __1__ -cant-open-no-reason=Du kannst dieses Menü gerade nicht öffnen. \ No newline at end of file diff --git a/old/modules/DONE/Core/Gui/locale/en.cfg b/old/modules/DONE/Core/Gui/locale/en.cfg deleted file mode 100644 index f7eb1a6a..00000000 --- a/old/modules/DONE/Core/Gui/locale/en.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingCore_Gui] -unauthorized=401 - Unauthorized: Access is denied due to invalid credentials -cant-open=You can't open this panel right now, reason: __1__ -cant-open-no-reason=You can't open this panel right now \ No newline at end of file diff --git a/old/modules/DONE/Core/Gui/locale/fr.cfg b/old/modules/DONE/Core/Gui/locale/fr.cfg deleted file mode 100644 index a8976a4e..00000000 --- a/old/modules/DONE/Core/Gui/locale/fr.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingCore_Gui] -unauthorized=401 - Unauthorized: Access is denied due to invalid credentials -cant-open=You can not open this panel right now, reason: __1__ -cant-open-no-reason=You can not open this panel right now \ No newline at end of file diff --git a/old/modules/DONE/Core/Gui/locale/nl.cfg b/old/modules/DONE/Core/Gui/locale/nl.cfg deleted file mode 100644 index d53dc64c..00000000 --- a/old/modules/DONE/Core/Gui/locale/nl.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingCore_Gui] -unauthorized=401 - Onbevoegd: toegang wordt geweigerd vanwege ongeldige inloggegevens -cant-open=Je kan dit momenteel niet openen. Reden: __1__ -cant-open-no-reason=Je kan dit momenteel niet openen. \ No newline at end of file diff --git a/old/modules/DONE/Core/Gui/locale/sv-SE.cfg b/old/modules/DONE/Core/Gui/locale/sv-SE.cfg deleted file mode 100644 index 279ba842..00000000 --- a/old/modules/DONE/Core/Gui/locale/sv-SE.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingCore_Gui] -unauthorized=401 -Otillåten: Tillgång nekas på grund av otillräcklig säkerhetsprövning. -cant-open=Du kan inte öppna den här panelen just nu, orsak: __1__ -cant-open-no-reason=Du kan inte öppna den här panelen just nu \ No newline at end of file diff --git a/old/modules/DONE/Core/Gui/popup/control.lua b/old/modules/DONE/Core/Gui/popup/control.lua deleted file mode 100644 index a773c901..00000000 --- a/old/modules/DONE/Core/Gui/popup/control.lua +++ /dev/null @@ -1,130 +0,0 @@ ---- Adds a location for popups which can be dismissed by a player and created from other scripts --- @module ExpGamingCore.Gui.Popup --- @alias popup --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - ---- This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module --- @function _comment - -local Game = require('FactorioStdLib.Game') -local mod_gui = require('mod-gui') -local Gui = require('ExpGamingCore.Gui') -local Server -- loaded on_init - -local popup = {} -popup._prototype = {} - ---- Used to add a popup gui style --- @usage Gui.left.add{name='foo',caption='Foo',draw=function} --- @usage return_value(data,player) -- opens popup for one player use popup.open to open for more than one player --- @param obj this is what will be made, needs a name and a draw function(root_frame,data) --- @return the object that is made, calling the returned value will open the popup for that player -function popup.add(obj) - if not is_type(obj,'table') then return end - if not is_type(obj.name,'string') then return end - verbose('Created Popup Gui: '..obj.name) - setmetatable(obj,{__index=popup._prototype,__call=function(self,data,player) local players = player and {player} or nil return popup.open(self.name,data,players) end}) - local name = obj.name; obj.name = nil - Gui.data('popup',name,obj) - obj.name = name - return obj -end - --- this is used by the script to find the popup flow -function popup.flow(player) - player = Game.get_player(player) - if not player then error('Invalid Player',2) end - local flow = mod_gui.get_frame_flow(player).popups - if not flow then flow = mod_gui.get_frame_flow(player).add{name='popups',type='flow',direction='vertical'} flow.style.visible=false end - return flow -end - ---- Use to open a popup for these players --- @usage Gui.popup.open('ban',nil,{player=1,reason='foo'}) --- @tparam string style this is the name you gave to the popup when added --- @param data this is the data that is sent to the draw function --- @tparam[opt=game.connected_players] table players the players to open the popup for -function popup.open(style,data,players) - local _popup = Gui.data.popup[style] - players = players or game.connected_players - data = data or {} - if not _popup then return end - if not Server or not Server._thread then - for _,player in pairs(players) do - if _popup.left then _popup.left:close(player) end - local flow = popup.flow(player) - flow.style.visible=true - local _frame = flow.add{ - type='frame', - direction='horizontal', - style=mod_gui.frame_style - } - local frame = _frame.add{ - type='frame', - name='inner_frame', - direction='vertical', - style='image_frame' - } - _popup.close(_frame) - if is_type(_popup.draw,'function') then - local success, err = pcall(_popup.draw,_popup,frame,data) - if not success then error(err) end - else error('No Draw On Popup '.._popup.name) end - end - else - Server.new_thread{ - data={players=players,popup=_popup,data=data} - }:on_event('tick',function(self) - if #self.data.players == 0 then self:close() return end - local player = table.remove(self.data.players,1) - if self.data.popup.left then self.data.popup.left:close(player) end - local flow = popup.flow(player) - flow.style.visible=true - local _frame = flow.add{ - type='frame', - direction='horizontal', - style=mod_gui.frame_style - } - local frame = _frame.add{ - type='frame', - name='inner_frame', - direction='vertical', - style='image_frame' - } - self.data.popup.close(_frame) - if is_type(self.data.popup.draw,'function') then - local success, err = pcall(self.data.popup.draw,self.data.popup,frame,self.data.data) - if not success then error(err) end - else error('No Draw On Popup '..self.data.popup.name) end - end):open() - end -end - -function popup._prototype:add_left(obj) - if not Gui.left then return end - obj.name = obj.name or self.name - self.left = Gui.left(obj) -end - -function popup.on_init() - if loaded_modules['ExpGamingCore.Server'] then Server = require('ExpGamingCore.Server') end -end - -function popup.on_post() - popup._prototype.close = Gui.inputs.add{ - type='button', - name='popup-close', - caption='utility/set_bar_slot', - tooltip='Close This Popup' - }:on_event('click',function(event) - local frame = event.element.parent - local parent = frame.parent - if frame and frame.valid then frame.destroy() if #parent.children == 0 then parent.style.visible = false end end - end) -end - -Event.add(defines.events.on_player_joined_game,popup.flow) - --- calling will attempt to add a new popup style -return setmetatable(popup,{__call=function(self,...) return self.add(...) end}) \ No newline at end of file diff --git a/old/modules/DONE/Core/Gui/popup/softmod.json b/old/modules/DONE/Core/Gui/popup/softmod.json deleted file mode 100644 index f4b3f736..00000000 --- a/old/modules/DONE/Core/Gui/popup/softmod.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "ExpGamingCore.Gui.popup", - "version": "4.0.0", - "description": "Adds popup guis to the gui system which builds upon the left gui system.", - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "location": "FSM_ARCHIVE", - "keywords": [ - "Gui", - "Popup", - "Left" - ], - "collection": "ExpGamingCore.Gui@4.0.0", - "dependencies": { - "mod-gui": "*", - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Gui": "^4.0.0", - "ExpGamingCore.Gui.inputs": "^4.0.0", - "ExpGamingCore.Server": "?^4.0.0", - "ExpGamingCore.Gui.left": "?^4.0.0" - }, - "submodules": {} -} diff --git a/old/modules/DONE/Core/Gui/softmod.json b/old/modules/DONE/Core/Gui/softmod.json deleted file mode 100644 index 7363526b..00000000 --- a/old/modules/DONE/Core/Gui/softmod.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "ExpGamingCore.Gui", - "version": "4.0.0", - "description": "Adds a objective version to custom guis.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Library", - "Lib", - "ExpGaming", - "Core", - "Gui", - "ExpGui" - ], - "dependencies": { - "ExpGamingLib": "^4.0.0", - "FactorioStdLib.Table": "^0.8.0", - "FactorioStdLib.Color": "^0.8.0", - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Server": "?^4.0.0" - }, - "collection": "ExpGamingCore@4.0.0", - "submodules": { - "ExpGamingCore.Gui.center": "4.0.0", - "ExpGamingCore.Gui.inputs": "4.0.0", - "ExpGamingCore.Gui.left": "4.0.0", - "ExpGamingCore.Gui.popup": "4.0.0", - "ExpGamingCore.Gui.toolbar": "4.0.0" - } -} diff --git a/old/modules/DONE/Core/Gui/src/server.lua b/old/modules/DONE/Core/Gui/src/server.lua deleted file mode 100644 index 1b613e11..00000000 --- a/old/modules/DONE/Core/Gui/src/server.lua +++ /dev/null @@ -1,40 +0,0 @@ ---- This file will be loaded when ExpGamingCore.Server is present --- @function _comment - -local Game = require('FactorioStdLib.Game') -local Server = require('ExpGamingCore.Server') - -Server.add_module_to_interface('ExpGui','ExpGamingCore.Gui') - ---- Adds a server thread that allows the camera follows to be toggled off and on -return function() - Server.new_thread{ - name='camera-follow', - data={cams={},cam_index=1,players={}} - }:on_event('tick',function(self) - local update = 4 - if self.data.cam_index >= #self.data.cams then self.data.cam_index = 1 end - if update > #self.data.cams then update = #self.data.cams end - for cam_offset = 0,update do - local _cam = self.data.cams[self.data.cam_index+cam_offset] - if not _cam then break end - if not _cam.cam.valid then table.remove(self.data.cams,self.data.cam_index) - elseif not _cam.entity.valid then table.remove(self.data.cams,self.data.cam_index) - else _cam.cam.position = _cam.entity.position if not _cam.surface then _cam.cam.surface_index = _cam.entity.surface.index end - end - end - self.data.cam_index = self.data.cam_index+update - end):on_event(defines.events.on_player_respawned,function(self,event) - if self.data.players[event.player_index] then - local remove = {} - local player = Game.get_player(event) - for index,cam in pairs(self.data.players[event.player_index]) do - if cam.valid then table.insert(self.data.cams,{cam=cam,entity=player.character,surface=player.surface}) - else table.insert(remove,index) end - end - for n,index in pairs(remove) do - table.remove(self.data.players[event.player_index],index-n+1) - end - end - end):open() -end \ No newline at end of file diff --git a/old/modules/DONE/Core/Gui/src/test.lua b/old/modules/DONE/Core/Gui/src/test.lua deleted file mode 100644 index 9ba60632..00000000 --- a/old/modules/DONE/Core/Gui/src/test.lua +++ /dev/null @@ -1,187 +0,0 @@ ---- Used to test all gui elements and parts can be used in game via Gui.test() --- @module ExpGamingCore.Gui.Test --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - ---- This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module --- @function _comment - -local Game = require('FactorioStdLib.Game') -local Gui = Gui -- this is to force gui to remain in the ENV -local mod_gui = require("mod-gui") - -local gui_test_close = Gui.inputs{ - name='gui-test-close', - type='button', - caption='Close Test Gui' -}:on_event('click',function(event) event.element.parent.destroy() end) - -local caption_test = Gui.inputs{ - name='text-button', - type='button', - caption='Test' -}:on_event('click',function(event) game.print('test') end) - -local sprite_test = Gui.inputs{ - name='sprite-button', - type='button', - sprite='item/lab' -}:on_event('click',function(event) game.print('test') end) - -local input_test = Gui.inputs.add_button('test-inputs','Try RMB','alt,ctrl,shift and mouse buttons',{ - { - function(player,mouse,keys) return mouse == defines.mouse_button_type.left and keys.alt end, - function(player,element) player_return('Left: Alt',nil,player) end - }, - { - function(player,mouse,keys) return mouse == defines.mouse_button_type.left and keys.ctrl end, - function(player,element) player_return('Left: Ctrl',nil,player) end - }, - { - function(player,mouse,keys) return mouse == defines.mouse_button_type.left and keys.shift end, - function(player,element) player_return('Left: Shift',nil,player) end - }, - { - function(player,mouse,keys) return mouse == defines.mouse_button_type.right and keys.alt end, - function(player,element) player_return('Right: Alt',nil,player) end - }, - { - function(player,mouse,keys) return mouse == defines.mouse_button_type.right and keys.ctrl end, - function(player,element) player_return('Right: Ctrl',nil,player) end - }, - { - function(player,mouse,keys) return mouse == defines.mouse_button_type.right and keys.shift end, - function(player,element) player_return('Right: Shift',nil,player) end - } -}):on_event('error',function(err) game.print('this is error handling') end) - -local elem_test = Gui.inputs.add_elem_button('test-elem','item','Testing Elems',function(player,element,elem) - player_return(elem.type..' '..elem.value,nil,player) -end) - -local check_test = Gui.inputs.add_checkbox('test-check',false,'Cheat Mode',function(player,parent) - return game.players[parent.player_index].cheat_mode -end,function(player,element) - player.cheat_mode = true -end,function(player,element) - player.cheat_mode = false -end) - -local radio_test = Gui.inputs.add_checkbox('test-radio',true,'Kill Self',function(player,parent) - return false -end,function(player,element) - if player.character then player.character.die() end - Gui.inputs.reset_radio(element.parent['test-radio-reset']) -end) - -local radio_test_reset = Gui.inputs.add_checkbox('test-radio-reset',true,'Reset Kill Self',function(player,parent) - return not parent['test-radio'].state -end,function(player,element) - Gui.inputs.reset_radio(element.parent['test-radio']) -end) - -local text_test = Gui.inputs.add_text('test-text',false,'default text',function(player,text,element) - player_return(text,nil,player) -end) - -local box_test = Gui.inputs.add_text('test-box',true,'default text but a box',function(player,text,element) - player_return(text,nil,player) -end) - -local slider_test = Gui.inputs.add_slider('test-slider','vertical',0,5,function(player,parent) - return player.character_running_speed_modifier -end,function(player,value,percent,element) - player.character_running_speed_modifier = value - player_return('Value In Percent of Max '..math.floor(percent*100)-(math.floor(percent*100)%5),nil,player) -end) - -local drop_test = Gui.inputs.add_drop_down('test-drop',table.keys(defines.color),1,function(player,selected,items,element) - player.color = defines.color[selected] - player.chat_color = defines.color[selected] -end) - ---- The funcation that is called when calling Gui.test --- @function Gui.test --- @usage Gui.test() -- draws test gui --- @param[opt=game.player] player a pointer to a player to draw the test gui for -local function test_gui(player) - local player = game.player or Game.get_player(player) or nil - if not player then return end - if mod_gui.get_frame_flow(player)['gui-test'] then mod_gui.get_frame_flow(player)['gui-test'].destroy() end - local frame = mod_gui.get_frame_flow(player).add{type='frame',name='gui-test',direction='vertical'} - gui_test_close(frame) - caption_test(frame) - sprite_test(frame) - input_test(frame) - elem_test(frame) - check_test(frame) - radio_test(frame) - radio_test_reset(frame) - text_test(frame) - box_test(frame) - slider_test(frame) - drop_test(frame) -end - -Gui.toolbar.add('open-gui-test','Open Test Gui','Opens the test gui with every input',test_gui) - --- testing the center gui -Gui.center{ - name='test-center', - caption='Gui Center', - tooltip='Just a gui test' -}:add_tab('tab-1','Tab 1','Just a tab',function(frame) - frame.add{type='label',caption='Test'} -end):add_tab('tab-2','Tab 2','Just a tab',function(frame) - for i = 1,100 do - frame.add{type='label',caption='Test 2'} - end -end) - --- testing the left gui -Gui.left{ - name='test-left', - caption='Gui Left', - tooltip='just testing', - draw=function(self,frame) - for _,player in pairs(game.connected_players) do - frame.add{type='label',caption=player.name} - end - end, - can_open=function(player) return player.index == 1 end -} - -local text_popup = Gui.inputs.add_text('test-popup-text',true,'Message To Send',function(player,text,element) - element.text = text -end) -local send_popup = Gui.inputs{ - type='button', - name='test-popup-send', - caption='Send Message' -}:on_event('click',function(event) - local player = Game.get_player(event) - local message = event.element.parent['test-popup-text'].text - Gui.popup.open('test-popup',{message=message,player=player.name}) -end) -Gui.popup{ - name='test-popup', - caption='Gui Popup', - draw=function(self,frame,data) - frame.add{type='label',caption='Opened by: '..data.player} - frame.add{type='label',caption='Message: '..data.message} - end -}:add_left{ - caption='Gui Left w/ Popup', - tooltip='Send a message', - draw=function(self,frame) - text_popup:draw(frame) - send_popup:draw(frame) - end -} - -return test_gui - - - - - diff --git a/old/modules/DONE/Core/Gui/toolbar/control.lua b/old/modules/DONE/Core/Gui/toolbar/control.lua deleted file mode 100644 index 4bc95bb4..00000000 --- a/old/modules/DONE/Core/Gui/toolbar/control.lua +++ /dev/null @@ -1,90 +0,0 @@ ---- Adds a toolbar to the top left of the screen --- @module ExpGamingCore.Gui.Toolbar --- @alias toolbar --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - ---- This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module --- @function _comment - -local Game = require('FactorioStdLib.Game') -local mod_gui = require('mod-gui') -local Gui = require('ExpGamingCore.Gui') -local order_config = require(module_path..'/order_config') -local Role -- this is optional and is handled by it being present, it is loaded on init - -local toolbar = {} - -toolbar.hide = Gui.inputs{ - name='gui-toolbar-hide', - type='button', - caption='<' -}:on_event('click',function(event) - if event.element.caption == '<' then - event.element.caption = '>' - for _,child in pairs(event.element.parent.children) do - if child.name ~= event.element.name then child.style.visible = false end - end - else - event.element.caption = '<' - for _,child in pairs(event.element.parent.children) do - if child.name ~= event.element.name then child.style.visible = true end - end - end -end) - ---- Add a button to the toolbar, ranks need to be allowed to use these buttons if ranks is preset --- @usage toolbar.add('foo','Foo','Test',function() game.print('test') end) --- @tparam string name the name of the button --- @tparam string caption can be a sprite path or text to show --- @tparam string tooltip the help to show for the button --- @tparam function function callback the which is called on_click --- @treturn table the button object that was made, calling the returned value will draw the toolbar button added -function toolbar.add(name,caption,tooltip,callback) - verbose('Created Toolbar Button: '..name) - local button = Gui.inputs.add{type='button',name=name,caption=caption,tooltip=tooltip} - button:on_event(Gui.inputs.events.click,callback) - Gui.data('toolbar',name,button) - return button -end - ---- Draws the toolbar for a certain player --- @usage toolbar.draw(1) --- @param player the player to draw the tool bar of -function toolbar.draw(player) - player = Game.get_player(player) - if not player then return end - local toolbar_frame = mod_gui.get_button_flow(player) - toolbar_frame.clear() - if not Gui.data.toolbar then return end - toolbar.hide(toolbar_frame).style.maximal_width = 15 - local done = {} - for _,name in pairs(order_config) do - local button = Gui.data.toolbar[name] - if button then - done[name] = true - if is_type(Role,'table') then - if Role.allowed(player,name) then - button(toolbar_frame) - end - else button(toolbar_frame) end - end - end - for name,button in pairs(Gui.data.toolbar) do - if not done[name] then - if is_type(Role,'table') then - if Role.allowed(player,name) then - button(toolbar_frame) - end - else button(toolbar_frame) end - end - end -end - -function toolbar.on_init() - if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end -end - -Event.add({defines.events.on_role_change,defines.events.on_player_joined_game},toolbar.draw) --- calling with only a player will draw the toolbar for that player, more params will attempt to add a button -return setmetatable(toolbar,{__call=function(self,player,extra,...) if extra then return self.add(player,extra,...) else self.draw(player) end end}) \ No newline at end of file diff --git a/old/modules/DONE/Core/Gui/toolbar/order_config.lua b/old/modules/DONE/Core/Gui/toolbar/order_config.lua deleted file mode 100644 index 7f19658f..00000000 --- a/old/modules/DONE/Core/Gui/toolbar/order_config.lua +++ /dev/null @@ -1,13 +0,0 @@ -return { - 'server-info', - 'readme', - 'science', - 'rockets', - 'player-list', - 'tasklist', - 'warp-list', - 'polls', - 'announcements', - 'admin-commands', - 'game-settings' -} \ No newline at end of file diff --git a/old/modules/DONE/Core/Gui/toolbar/softmod.json b/old/modules/DONE/Core/Gui/toolbar/softmod.json deleted file mode 100644 index 54884fbf..00000000 --- a/old/modules/DONE/Core/Gui/toolbar/softmod.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "ExpGamingCore.Gui.toolbar", - "version": "4.0.0", - "description": "Adds a toolbar at the top of the screen", - "author": "Cooldude2606", - "contact": "Discord: Cooldude26060#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "location": "FSM_ARCHIVE", - "keywords": [ - "Gui", - "Toolbar", - "Buttons" - ], - "collection": "ExpGamingCore.Gui@4.0.0", - "dependencies": { - "mod-gui": "*", - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Gui": "^4.0.0", - "ExpGamingCore.Gui.inputs": "^4.0.0", - "ExpGamingCore.Role": "?^4.0.0" - }, - "submodules": {} -} diff --git a/old/modules/DONE/Core/Role/config.lua b/old/modules/DONE/Core/Role/config.lua deleted file mode 100644 index aadb38fb..00000000 --- a/old/modules/DONE/Core/Role/config.lua +++ /dev/null @@ -1,284 +0,0 @@ --- the two below are used internally by the role system and should not be REMOVED, name must be kept the same and used at least once -Role.add_flag('is_default') -- this must be included in at least one role -Role.add_flag('is_root',function(player,state) - if state then game.print('--- !!!ALERT!!! --- '..player.name..' has been given a role with ROOT ACCESS --- !!!ALERT!!! ---') end - if player.character then player.character.destructible = not state end -end) -- the SERVER role will have root but you may assign this to other roles --- the two below are ised internally by the role system and should not be RENAMED, name must be kept the same but does not need to be used -Role.add_flag('block_auto_promote') -- is not required but name is used internally to block time based promotions -Role.add_flag('is_antiroot',function(player,state) if player.character then player.character.destructible = not state end end) -- not required but setting true will disallow everything for that role --- all below are not required and are not used internally -Role.add_flag('is_admin',function(player,state) player.admin = state end) -- highly recommenced but not required -Role.add_flag('is_spectator',function(player,state) player.spectator = state end) -Role.add_flag('is_jail',function(player,state) if player.character then player.character.active = not state end end) -Role.add_flag('allow_afk_kick') -Role.add_flag('is_donator') -Role.add_flag('is_timed') -Role.add_flag('is_verified') -Role.add_flag('not_reportable') - --- Root -Role{ - name='Root', - short_hand='Root', - tag='[Root]', - group='Root', - colour={r=255,b=255,g=255}, - is_root=true, - is_admin=true, - is_spectator=true, - not_reportable=true, - allow={} -} -Role{ - name='Community Manager', - short_hand='Com Mngr', - tag='[Com Mngr]', - group='Root', - colour={r=150,g=68,b=161}, - is_admin=true, - is_spectator=true, - is_donator=true, - not_reportable=true, - allow={} -} -Role{ - name='Developer', - short_hand='Dev', - tag='[Dev]', - group='Root', - colour={r=179,g=125,b=46}, - is_admin=true, - is_spectator=true, - is_donator=true, - not_reportable=true, - allow={ - ['interface']=true, - ['cheat-mode']=true - } -} - --- Admin -Role{ - name='Administrator', - short_hand='Admin', - tag='[Admin]', - group='Admin', - colour={r=233,g=63,b=233}, - is_admin=true, - is_spectator=true, - is_verified=true, - not_reportable=true, - allow={ - ['game-settings']=true, - ['always-warp']=true, - ['admin-items']=true - } -} -Role{ - name='Moderator', - short_hand='Mod', - tag='[Mod]', - group='Admin', - colour={r=0,g=170,b=0}, - is_admin=true, - is_spectator=true, - is_verified=true, - not_reportable=true, - allow={ - ['set-home']=true, - ['home']=true, - ['return']=true, - ['bonus']=true, - ['announcements']=true, - ['rank-changer']=true, - } -} -Role{ - name='Trainee', - short_hand='TrMod', - tag='[TrMod]', - group='Admin', - colour={r=0,g=196,b=137}, - is_spectator=true, - is_verified=true, - not_reportable=true, - allow={ - ['go-to']=true, - ['bring']=true, - ['set-home']=false, - ['home']=false, - ['return']=false, - ['bonus']=false, - ['admin-commands']=true, - ['warn']=true, - ['temp-ban']=true, - ['clear-warnings']=true, - ['clear-reports']=true, - ['clear-all']=true, - ['clear-inv']=true, - } -} - --- High Member -Role{ - name='Sponsor', - short_hand='Spon', - tag='[Sponsor]', - group='HiMember', - colour={r=247,g=246,b=54}, - is_spectator=true, - is_donator=true, - allow={} -} -Role{ - name='Pay to Win', - short_hand='P2W', - tag='[P2W]', - group='HiMember', - colour={r=238,g=172,b=44}, - is_donator=true, - allow={ - ['jail']=true, - ['unjail']=true, - ['bonus']=true, - ['bonus-respawn']=true - } -} -Role{ - name='Donator', - short_hand='Don', - tag='[Donator]', - group='HiMember', - colour={r=230,g=99,b=34}, - is_donator=true, - allow_afk_kick=true, - allow={ - ['set-home']=true, - ['home']=true, - ['return']=true, - } -} -Role{ - name='Partner', - short_hand='Part', - tag='[Partner]', - group='HiMember', - colour={r=140,g=120,b=200}, - allow_afk_kick=false, - is_spectator=true, - allow={ - ['global-chat']=true, - } -} -Role{ - name='Veteran', - short_hand='Vet', - tag='[Veteran]', - group='HiMember', - colour={r=140,g=120,b=200}, - is_timed=true, - is_verified=true, - allow_afk_kick=true, - time=600, -- 10 hours - allow={ - ['tree-decon']=true, - ['create-poll']=true, - ['repair']=true - } -} - --- Member -Role{ - name='Member', - short_hand='Mem', - tag='[Member]', - group='Member', - colour={r=24,g=172,b=188}, - is_verified=true, - allow_afk_kick=true, - allow={ - ['edit-tasklist']=true, - ['make-warp']=true, - ['nuke']=true, - ['verified']=true - } -} -Role{ - name='Regular', - short_hand='Reg', - tag='[Regular]', - group='Member', - colour={r=79,g=155,b=163}, - allow_afk_kick=true, - is_timed=true, - time=180, -- 3 hours - allow={ - ['kill']=true, - ['decon']=true, - ['capsules']=true - } -} - --- Guest -Role{ - name='Guest', - short_hand='', - tag='', - group='User', - colour={r=185,g=187,b=160}, - allow_afk_kick=true, - is_default=true, - allow={ - ['player-list']=true, - ['readme']=true, - ['rockets']=true, - ['science']=true, - ['tasklist']=true, - ['report']=true, - ['warp-list']=true, - ['polls']=true, - ['tag']=true, - ['tag-clear']=true, - ['report']=true - } -} - --- Jail -Role{ - name='Jail', - short_hand='Jail', - tag='[Jail]', - group='Jail', - colour={r=50,g=50,b=50}, - is_jail=true, - is_antiroot=true, - block_auto_promote=true, - allow={} -} - -Role.order = { - 'Root', - 'Community Manager', - 'Developer', - 'Administrator', - 'Moderator', - 'Trainee', - 'Sponsor', - 'Pay to Win', - 'Donator', - 'Partner', - 'Veteran', - 'Member', - 'Regular', - 'Guest', - 'Jail' -} - -Role.set_preassign{ - ["cooldude2606"]={"Developer","Admin","Mod"}, - ["aldldl"]={"Sponsor","Admin","Donator","Sponsor","Member","Mod"}, - ["arty714"]={"Admin","Community Manager","Member","Mod"}, - ["drahc_pro"]={"Admin","Member","Mod"}, - ["mark9064"]={"Admin","Member","Mod"} -} diff --git a/old/modules/DONE/Core/Role/control.lua b/old/modules/DONE/Core/Role/control.lua deleted file mode 100644 index 61a32206..00000000 --- a/old/modules/DONE/Core/Role/control.lua +++ /dev/null @@ -1,532 +0,0 @@ ---- Adds roles where a player can have more than one role --- @module ExpGamingCore.Role@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias Role - --- Module Require -local Group = require('ExpGamingCore.Group') -local Game = require('FactorioStdLib.Game') - --- Local Variables -local role_change_event_id = script.generate_event_name('on_role_change') -local RoleGlobal - --- Module Define -local _RoleSelfReference -local module_verbose = false -local Role = { - _prototype={}, - order={}, - flags={}, - actions={}, - preassign={}, - meta={times={},groups={},count=0}, - roles=setmetatable({},{ - __index=table.autokey, - __newindex=function(tbl,key,value) - rawset(tbl,key,_RoleSelfReference.define(value)) - end - }), - on_init=function(self) - if loaded_modules['ExpGamingCore.Server'] then require('ExpGamingCore.Server').add_module_to_interface('Role','ExpGamingCore.Role') end - if loaded_modules['ExpGamingCore.Command'] then require(module_path..'/src/commands',{self=self}) end - if loaded_modules['ExpGamingCore.Sync'] then require(module_path..'/src/sync',{self=self,RoleGlobal=RoleGlobal}) end - end, - on_post=function(self) - -- creates a server role with root access - self.meta.server = self{name='SERVER',group='Root',is_root=true,allow={}} - -- loads the roles in config - require(module_path..'/config',{Role=self}) - self.order[0] = 'SERVER' - -- joins role allows into a chain - local previous - for index,role_name in pairs(self.order) do - local role = self.get(role_name) - if not role then error('Invalid role name in order listing: '..role_name) return end - if role.is_default then self.meta.default = role end - if role.is_timed then self.meta.times[role.name] = {index,role.time*3600} end - if not self.meta.groups[role.group.name] then self.meta.groups[role.group.name] = {lowest=index,highest=index} end - if self.meta.groups[role.group.name].highest > index then self.meta.groups[role.group.name].highest = index end - if self.meta.groups[role.group.name].lowest < index then self.meta.groups[role.group.name].lowest = index end - if previous then setmetatable(previous.allow,{__index=role.allow}) end - self.meta.count = self.meta.count+1 - role.index = index - previous = role - end - if previous then setmetatable(previous.allow,{__index=function(tbl,key) return false end}) - else error('Invalid roles, no roles to load.') end - end -} -_RoleSelfReference=Role - --- Global Define -local global = { - change_cache_length=15, - changes={}, - latest_change={}, - preassign={}, - players={}, - roles={} -} -Global.register(global,function(tbl) RoleGlobal = tbl end) - --- Function Define - ---- Used to set default roles for players who join --- @usage Role.set_preassign{name={roles}} -function Role.set_preassign(tbl) if game then global.preassign = tbl else Role.preassign = tbl end end - ---- Defines a new instance of a role --- @usage Role.define{name='Root',short_hand='Root',tag='[Root]',group='Root',colour={r=255,b=255,g=255},is_root=true,allow={}} -- returns new role --- @usage Role{name='Root',short_hand='Root',tag='[Root]',group='Root',colour={r=255,b=255,g=255},is_root=true,allow={}} -- returns new role --- @tparam table table obj contains the strings: name,short_hand,tag a called allow a table called colour and a pointer to a permission group --- @treturn Role the role which has been made -function Role.define(obj) - if not type_error(game,nil,'Cant define Role during runtime.') then return end - if not type_error(obj.name,'string','Role creation is invalid: role.name is not a string') then return end - if not is_type(obj.short_hand,'string') then obj.short_hand = obj.name:sub(1,3) end - if not is_type(obj.tag,'string') then obj.tag = '['..obj.short_hand..']' end - if not is_type(obj.colour,'table') then obj.colour = {r=255,b=255,g=255} end - if not type_error(obj.allow,'table','Role creation is invalid: role.allow is not a table') then return end - obj.group = Group.get(obj.group) - if not type_error(obj.group,'table','Role creation is invalid: role.group is invalid') then return end - if obj.time and not type_error(obj.time,'number','Role creation is invalid: role.time is not a number') then return end - verbose('Created Role: '..obj.name) - setmetatable(obj,{__index=Role._prototype}) - obj.connected_players = setmetatable({self=obj,connected=true},Role._prototype.players_mt) - obj.players = setmetatable({self=obj},Role._prototype.players_mt) - rawset(Role.roles,obj.name,obj) - table.insert(Role.order,obj.name) - return obj -end - ---- Used to get the role of a player or the role by name --- @usage Role.get('foo') -- returns group foo --- @usage Role.get(player) -- returns group of player --- @tparam ?LuaPlayer|pointerToPlayer|string mixed can either be the name of the role or a player identifier --- @treturn table the group which was found or nil -function Role.get(mixed,forceIsRole) - local player = game and Game.get_player(mixed) - if player == SERVER then return {Role.meta.server} end - if not forceIsRole and player then - local rtn = {} - if not global.players[player.index] then return Role.meta.default and {Role.meta.default} or {} end - for _,role in pairs(global.players[player.index]) do table.insert(rtn,Role.get(role)) end - return rtn - elseif is_type(mixed,'table') and mixed.group then return mixed - elseif is_type(mixed,'string') then return Role.roles[mixed] - elseif is_type(mixed,'number') then - for _,role in pairs(Role.roles) do - if role.index == mixed then return role end - end - end -end - ---- Used to place a player into a role(s) --- @usage Role.assign(player,'Root') --- @usage Role.assign(player,{'Root','Foo'}) --- @tparam ?LuaPlayer|pointerToPlayer player the player to assign the role to --- @tparam table ?string|role|table the role to add the player to, if its a then it will act recursively though the table --- @tparam[opt=''] ?LuaPlayer|pointerToPlayer by_player the player who assigned the roles to the player --- @tparam[opt] table batch this is used internally to prevent multiple event calls, contains {role_index_in_batch,batch} --- @treturn boolean was the player assigned the roles -function Role.assign(player,role,by_player,batch) - player = Game.get_player(player) - if not player then error('Invalid player #1 given to Role.assign.',2) return end - verbose('Assigning Roles: '..serpent.line(role)..' to: '..player.name) - -- this loops over a table of role if given; will return if ipairs returns, else will assume it was meant to be a role and error - if is_type(role,'table') and not role.name then - local ctn = 0 - for n,_role in ipairs(role) do ctn=ctn+1 Role.assign(player,_role,by_player,{n,role}) end - if ctn > 0 then if not batch then table.insert(global.changes[player.index],{'assign',role}) global.latest_change = {player.index,'assign',role} end return end - end - role = Role.get(role) - if not role then error('Invalid role #2 given to Role.assign.',2) return end - -- this acts as a way to prevent the global table getting too full - if not global.changes[player.index] then global.changes[player.index]={} end - if #global.changes[player.index] > global.change_cache_length then table.remove(global.changes[player.index],1) end - if not batch then table.insert(global.changes[player.index],{'assign',role.name}) global.latest_change = {player.index,'assign',role.name} end - return role:add_player(player,by_player,batch) -end - ---- Used to remove a player from a role(s) --- @usage Role.unassign(player,'Root') --- @tparam ?LuaPlayer|pointerToPlayer player the player to unassign the role to --- @tparam table ?string|role|table role the role to remove the player from, if its a then it will act recursively though the table --- @tparam[opt=''] ?LuaPlayer|pointerToPlayer by_player the player who unassigned the roles from the player --- @tparam[opt] table batch this is used internally to prevent multiple event calls --- @treturn boolean was the player unassigned the roles -function Role.unassign(player,role,by_player,batch) - player = Game.get_player(player) - if not player then error('Invalid player #1 given to Role.unassign.',2) return end - verbose('Assigning Roles: '..serpent.line(role)..' to: '..player.name) - -- this loops over a table of role if given; will return if ipairs returns, else will assume it was meant to be a role and error - if is_type(role,'table') and not role.name then - local ctn = 0 - for n,_role in ipairs(role) do ctn=ctn+1 Role.unassign(player,_role,by_player,{n,role}) end - if ctn > 0 then if not batch then table.insert(global.changes[player.index],{'unassign',role}) global.latest_change = {player.index,'unassign',role} end return end - end - role = Role.get(role) - if not role then error('Invalid role #2 given to Role.unassign.',2) return end - if not global.changes[player.index] then global.changes[player.index]={} end - -- this acts as a way to prevent the global table getting too full - if #global.changes[player.index] > global.change_cache_length then table.remove(global.changes[player.index],1) end - if not batch then table.insert(global.changes[player.index],{'unassign',role.name}) global.latest_change = {player.index,'unassign',role.name} end - return role:remove_player(player,by_player,batch) -end - ---- Returns the highest role given in a list, if a player is passed then it returns the highest role of the player --- @usage Role.get_highest{'Root','Admin','Mod'} -- returns Root (given that root is highest) --- @usage Role.get_highest(player) -- returns the players highest role --- @tparam table ?table|LuaPlayer|pointerToPlayer options of options or a player --- @treturn role the highest role given in the options -function Role.get_highest(options) - local player = Game.get_player(options) - if player then options = Role.get(player) end - if not type_error(options,'table','Invalid argument #1 to Role.get_highest, options is not a table of roles.') then return end - local highest_index = -1 - local highest - for _,role_name in pairs(options) do - local role = Role.get(role_name) - if not role then error('Invalid role inside options: '..serpent.line(role_name)) return end - if highest_index == -1 or role.index < highest_index then highest_index,highest = role.index,role end - end - return highest -end - ---- Uses the change cache to revert changes to players roles --- @usage Role.revert(player) -- reverts the last change to the players roles --- @tparam ?LuaPlayer|pointerToPlayer player the player to revert the changes of --- @tparam[opt] ?LuaPlayer|pointerToPlayer the player who preformed the role revert --- @tparam[opt=1] number count the of reverts to do, if 0 all changes cached are reverted --- @treturn number the number of changes that occurred -function Role.revert(player,by_player,count) - player = Game.get_player(player) - if not player then error('Invalid player #1 given to Role.revert.',2) return end - if count and not type_error(count,'number','Invalid argument #2 to Role.revert, count is not a number.') then return end - local changes = global.changes[player.index] or {} - if #changes == 0 then error('Player has no role changes logged, can not revert.') end - count = count or 1 - local ctn = 0 - if count > #changes or count == 0 then count = #changes end - for i = 1,count do - local change = table.remove(changes) - if not change then break end - local batch = is_type(change[2],'table') and change[2] or {change[2]} - if change[1] == 'assign' then Role.unassign(player,change[2],by_player,batch) end - if change[1] == 'unassign' then Role.assign(player,change[2],by_player,batch) end - ctn=ctn+1 - end - return ctn -end - ---- Adds a flag which can be set on roles; these flags act as a quick way to access general role changes --- @usage Role.add_flag('is_admin',function(player,state) player.admin = state end) -- the function is passed player and if the flag is true or false --- @tparam string flag the name of the flag that is being added --- @tparam[opt] function function callback the function(player,state) which is called when a player loses or gains a flag, if nil no is called -function Role.add_flag(flag,callback) - if not type_error(flag,'string','Invalid argument #1 to Role.add_flag, flag is not a string.') then return end - if callback and not type_error(callback,'function','Invalid argument #2 to Role.add_flag, callback is not a function.') then return end - verbose('Added flag: '..flag) - Role.flags[flag] = callback or true -end - ---- Checks if a player or role has the requested flag, if player all roles of player are checked (true has priority) --- @usage Role.has_flag(role,'is_admin') -- returns true if this role has is_admin set --- @tparam role|LuaPlayer|pointerToPlayer mixed the player or role that will be tested --- @tparam string flag the flag to test for --- @treturn boolean if the flag was true or false, false if nil -function Role.has_flag(mixed,flag) - if not type_error(flag,'string','Invalid argument #2 to Role.has_flag, flag is not a string.') then return end - local roles = Role.get(mixed) - if not type_error(roles,'table','Invalid argument #1 to Role.has_flag, mixed is not a role or player.') then return end - if #roles > 0 then for _,role in pairs(roles) do - if role:has_flag(flag) then return true end - end elseif roles:has_flag(flag) then return true end - return false -end - ---- Adds a action to be used by the role system --- @usage Role.add_action('foo') --- @tparam string action the name of the action that will be added -function Role.add_action(action) - if not type_error(action,'string','Invalid argument #1 to Role.add_action, action is not a string.') then return end - verbose('Added action: '..action) - table.insert(Role.actions,action) -end - ---- Checks if a player or role is allowed the requested action, if player all roles of player are checked (true has priority) --- @usage Role.allowed(role,'foo') -- returns true if this role is allowed 'foo' --- @tparam ?role|LuaPlayer|pointerToPlayer mixed the player or role that will be tested --- @tparam string action the action to test for --- @treturn boolean if the action is allowed for the player or role -function Role.allowed(mixed,action) - if not type_error(action,'string','Invalid argument #2 to Role.allowed, action is not a string.') then return end - local roles = Role.get(mixed) - if not type_error(roles,'table','Invalid argument #1 to Role.allowed, mixed is not a role or player.') then return end - if #roles > 0 then for _,role in pairs(roles) do - if role:allowed(action) then return true end - end elseif roles:allowed(action) then return true end - return false -end - ---- Prints to all roles and players of those roles which are greater than the given role (or if inv then all below) --- @usage Role.print('Admin','Hello, World!') -- returns the number of players who received the message --- @tparam ?role|string role the role which acts as the turning point of the print (always included regardless of inv value) --- @param rtn the value that will be returned to the players --- @tparam[opt] table colour the colour that you want the message printed in --- @tparam[opt=false] boolean inv true to print to roles below, false to print to roles above --- @treturn number the number of players who received the message -function Role.print(role,rtn,colour,inv) - role = Role.get(role,true) - if not type_error(role,'table','Invalid argument #1 to Role.print, role is invalid.') then return end - if colour and not type_error(colour,'table','Invalid argument #3 to Role.print, colour is not a table.') then return end - if inv and not type_error(inv,'boolean','Invalid argument #4 to Role.print, inv is not a boolean.') then return end - local message = inv and {'ExpGamingCore-Role.default-print',rtn} or {'ExpGamingCore-Role.print',role.name,rtn} - local change = inv and 1 or -1 - local ctn = 0 - local i = role.index - while true do - local _role = Role.get(i,true) - if not _role then break end - ctn=ctn+_role:print(message,colour) - i=i+change - end - return ctn -end - ---- Prints all registered roles and there important information (debug) --- @tparam[opt] ?role|string the role to print the info of, if nil then all roles are printed in order of power --- @tparam[opt=game.player] ?LuaPlayer|pointerToPlayer the player to print the info to, default the player who ran command -function Role.debug_output(role,player) - player = Game.get_player(player) or game.player - if not player then error('Invalid player #2 given to Role.debug_output.',2) return end - local function _output(_role) - local flags = {};for flag in pairs(Role.flags) do if _role:has_flag(flag) then table.insert(flags,flag) end end - local rtn = string.format('%s) %q-%q || Tag: %s Short Hand: %q Time: %s Flags: %s', - _role.index,_role.group.name,_role.name,_role.tag,_role.short_hand,tostring(_role.time),table.concat(flags,', ')) - player_return(rtn,_role.colour,player) - end - if role then - role = Role.get(role) - if not type_error(role,'table','Invalid argument #1 to Role.print, role is invalid.') then return end - _output(role) - else for index,_role in pairs(Role.roles) do _output(_role) end end -end - ---- Used to test if a role has a flag set --- @usage role:has_flag('is_admin') -- returns true if the role has the flag 'is_admin' --- @tparam string flag the flag to test for --- @treturn boolean true if the flag is set else false -function Role._prototype:has_flag(flag) - if not self_test(self,'role','has_flag') then return end - if not type_error(flag,'string','Invalid argument #1 to role:has_flag, flag is not a string.') then return end - return self[flag] or false -end - ---- Used to test if a role is allowed an action --- @usage role:allowed('foo') -- returns true if the role is allowed 'foo' --- @tparam string action the action to test for --- @treturn boolean true if the action is allowed else false -function Role._prototype:allowed(action) - if not self_test(self,'role','allowed') then return end - if not type_error(action,'string','Invalid argument #1 to role:allowed, action is not a string.') then return end - if self.is_antiroot then return false end - return self.allow[action] or self.is_root or false -- still include is_root exception flag -end - ---- Returns the players who have this role --- @usage role:get_player() -- returns table of players --- @usage role.players -- returns table of players --- @usage role.connected_players -- returns table of online players --- @tparam[opt] boolean online if true only returns online players -function Role._prototype:get_players(online) - if not self_test(self,'role','get_players') then return end - if online and not type_error(online,'boolean','Invalid argument #1 to role:get_players, online is not a boolean.') then return end - if not global.roles[self.name] then global.roles[self.name] = {} end - if self.is_default then if online then return game.connected_players else return game.players end end - local rtn = {} - for _,player_index in pairs(global.roles[self.name]) do - local player = game.players[player_index] - if player and not online or player.connected then table.insert(rtn,player) end - end - return rtn -end - --- this is used to create a connected_players table -Role._prototype.players_mt = { - __call=function(tbl) return tbl.self:get_players(tbl.connected) end, - __pairs=function(tbl) - local players = tbl.self:get_players(tbl.connected) - local function next_pair(tbl,key) - local k, v = next(players, key) - if v then return k,v end - end - return next_pair, players, nil - end, - __ipairs=function(tbl) - local players = tbl.self:get_players(tbl.connected) - local function next_pair(tbl,key) - local k, v = next(players, key) - if v then return k,v end - end - return next_pair, players, nil - end -} - - ---- Prints a message to all players who have this role --- @usage role:print('Hello, World!') -- returns number of players who received the message --- @param rtn the message to print to the players --- @tparam[opt] table colour the colour to print the message in --- @treturn number the number of players who received the message -function Role._prototype:print(rtn,colour) - if not self_test(self,'role','print') then return end - if colour and not type_error(colour,'table','Invalid argument #2 to Role.print, colour is not a table.') then return end - local ctn = 0 - for _,player in pairs(self:get_players(true)) do ctn=ctn+1 player_return(rtn,colour,player) end - return ctn -end - ---- Returns a table that describes all the permissions and which this role is allowed --- @usage role:get_permissions() -- returns table of permissions --- @treturn table a table of permissions, only includes ones which were defined with Role.add_action -function Role._prototype:get_permissions() - if not self_test(self,'role','get_permissions') then return end - local rtn = {} - for _,action in pairs(Role.actions) do rtn[action] = self:allowed(action) end - return rtn -end - ---- Adds a player to this role (players can have more than one role) --- @usage role:add_player(player) --- @tparam ?LuaPlayer|PointerToPlayer player the player to add --- @tparam[opt] ?LuaPlayer|PointerToPlayer by_player the player who ran the command --- @tparam[opt] table batch this is used internally to prevent multiple event calls -function Role._prototype:add_player(player,by_player,batch) - if not self_test(self,'role','add_player') then return end - player = Game.get_player(player) - if not player then error('Invalid player #1 given to role:add_player.',2) return end - by_player = Game.get_player(by_player) or SERVER - if not global.roles[self.name] then global.roles[self.name] = {} end - if not global.players[player.index] then global.players[player.index] = {} end - local highest = Role.get_highest(player) or Role.meta.default - for _,player_index in pairs(global.roles[self.name]) do if player_index == player.index then return end end - table.insert(global.roles[self.name],player.index) - table.insert(global.players[player.index],self.name) - script.raise_event(role_change_event_id,{ - name=role_change_event_id, - tick=game.tick, - player_index=player.index, - by_player_index=by_player.index, - old_highest=highest.name, - role_name=self.name, - batch=batch and batch[2] or {self.name}, - batch_index=batch and batch[1] or 1, - effect='assign' - }) -end - ---- Removes a player from this role (players can have more than one role) --- @usage role:remove_player(player) --- @tparam ?LuaPlayer|PointerToPlayer player the player to remove --- @tparam[opt] ?LuaPlayer|PointerToPlayer by_player the player who ran the command --- @tparam[opt] table batch this is used internally to prevent multiple event calls -function Role._prototype:remove_player(player,by_player,batch) - if not self_test(self,'role','add_player') then return end - player = Game.get_player(player) - if not player then error('Invalid player #1 given to role:remove_player.',2) return end - by_player = Game.get_player(by_player) or SERVER - if not global.roles[self.name] then global.roles[self.name] = {} end - if not global.players[player.index] then global.players[player.index] = {} end - local highest = Role.get_highest(player) or Role.meta.default - local index = 0 - for _index,player_index in pairs(global.roles[self.name]) do if player_index == player.index then index=_index break end end - table.remove(global.roles[self.name],index) - for _index,role_name in pairs(global.players[player.index]) do if role_name == self.name then index=_index break end end - table.remove(global.players[player.index],index) - script.raise_event(role_change_event_id,{ - name=role_change_event_id, - tick=game.tick, - player_index=player.index, - by_player_index=by_player.index, - old_highest=highest.name, - role_name=self.name, - batch=batch and batch[2] or {self.name}, - batch_index=batch and batch[1] or 1, - effect='unassign' - }) -end - --- Event Handlers Define -Event.add(role_change_event_id,function(event) - -- variable init - local player = Game.get_player(event) - local by_player = Game.get_player(event.by_player_index) or SERVER - local role = Role.get(event.role_name) - local highest = Role.get_highest(player) - if not highest then Role.meta.default:add_player(player) highest = Role.meta.default end - -- gets the flags the player currently has - for flag,callback in pairs(Role.flags) do if is_type(callback,'function') then callback(player,Role.has_flag(player,flag)) end end - -- assign new tag and group of highest role - Group.assign(player,highest.group) - local old_highest_tag = Role.get(event.old_highest).tag or '' - local start, _end = string.find(player.tag,old_highest_tag,1,true) - if start and old_highest_tag ~= highest.tag then player.tag = string.sub(player.tag,0,start-1)..highest.tag..string.sub(player.tag,_end+1) end - if not start then player.tag = highest.tag player_return({'ExpGamingCore-Role.tag-reset'},nil,player) end - if player.online_time > 60 then - -- send a message to other players - if event.batch_index == 1 then - local names = {} - for _,name in pairs(event.batch) do local next_role = Role.get(name) if next_role then table.insert(names,next_role.name) end end - if event.effect == 'assign' then - if not role.is_jail then player.play_sound{path='utility/achievement_unlocked'} end - game.print{'ExpGamingCore-Role.default-print',{'ExpGamingCore-Role.assign',player.name,table.concat(names,', '),by_player.name}} - else - player.play_sound{path='utility/game_lost'} - game.print{'ExpGamingCore-Role.default-print',{'ExpGamingCore-Role.unassign',player.name,table.concat(names,', '),by_player.name}} - end - end - -- log change to file - game.write_file('role-change.json', - table.json({ - tick=game.tick, - effect=event.effect, - role_name=role.name, - player_name=player.name, - by_player_name=by_player.name, - play_time=player.online_time, - highest_role_name=highest.name, - old_highest=event.highest, - batch_count=#event.batch, - batch_index=event.batch_index - })..'\n' - , true, 0) - end -end) - -Event.add(defines.events.on_player_created,function(event) - local player = Game.get_player(event) - local highest = Role.get_highest(player) or Role.meta.default - Group.assign(player,highest.group) - player.tag=highest.tag - if global.preassign[player.name:lower()] then Role.assign(player,global.preassign[player.name:lower()]) end - if Role.preassign[player.name:lower()] then Role.assign(player,Role.preassign[player.name:lower()]) end -end) - -Event.add(defines.events.on_tick,function(event) - if game.tick%(3600*5) ~= 0 then return end -- every 5 minutes - for _,player in pairs(game.connected_players) do - if not Role.has_flag(player,'block_auto_promote') then - local highest = Role.get_highest(player) - for role_name, time in pairs(Role.meta.times) do - if highest.index > time[1] and (player.online_time) > time[2] then Role.assign(player,role_name) end - end - end - end -end) - --- Module Return --- calling will attempt to define a new role -return setmetatable(Role,{__call=function(tbl,...) return tbl.define(...) end}) \ No newline at end of file diff --git a/old/modules/DONE/Core/Role/locale/en.cfg b/old/modules/DONE/Core/Role/locale/en.cfg deleted file mode 100644 index 4cb41594..00000000 --- a/old/modules/DONE/Core/Role/locale/en.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[ExpGamingCore-Role] -default-print=[Everyone]: __1__ -print=[__1__]: __2__ -assign=__1__ was assigned to __2__ by __3__ -unassign=__1__ was unassigned from __2__ by __3__ -tag-reset=Your Tag was reset due to a role change \ No newline at end of file diff --git a/old/modules/DONE/Core/Role/softmod.json b/old/modules/DONE/Core/Role/softmod.json deleted file mode 100644 index 3af9da54..00000000 --- a/old/modules/DONE/Core/Role/softmod.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "ExpGamingCore.Role", - "version": "4.0.0", - "description": "Adds roles where a player can have more than one role", - "location": "FSM_ARCHIVE", - "keywords": [ - "Role", - "Ranks", - "Permissions", - "Alowed", - "Admin" - ], - "dependencies": { - "ExpGamingLib": "^4.0.0", - "FactorioStdLib.Table": "^0.8.0", - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Group": "^4.0.0", - "ExpGamingCore.Server": "?^4.0.0", - "ExpGamingCore.Command": "?^4.0.0", - "ExpGamingCore.Sync": "?^4.0.0" - }, - "collection": "ExpGamingCore@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/Core/Role/src/commands.lua b/old/modules/DONE/Core/Role/src/commands.lua deleted file mode 100644 index 612a781a..00000000 --- a/old/modules/DONE/Core/Role/src/commands.lua +++ /dev/null @@ -1,28 +0,0 @@ -local Role = self - -commands.add_validation('player-rank',function(value,event) - local player,err = commands.validate['player'](value) - if err then return commands.error(err) end - local rtn = Role.get_highest(player).index > Role.get_highest(event).index and player or player.index == event.player_index and player or nil - if not rtn then return commands.error{'ExpGamingCore_Command.error-player-rank'} end return rtn -end) - -commands.add_validation('player-rank-online',function(value,event) - local player,err = commands.validate['player-online'](value) - if err then return commands.error(err) end - local player,err = commands.validate['player-rank'](player) - if err then return commands.error(err) end - return player -end) - -commands.add_validation('player-rank-alive',function(value,event) - local player,err = commands.validate['player-alive'](value) - if err then return commands.error(err) end - local player,err = commands.validate['player-rank'](player,event) - if err then return commands.error(err) end - return player -end) - -commands.add_middleware(function(player,command_name,event) - return Role.allowed(player,command_name) -end) \ No newline at end of file diff --git a/old/modules/DONE/Core/Role/src/sync.lua b/old/modules/DONE/Core/Role/src/sync.lua deleted file mode 100644 index 6f5361ad..00000000 --- a/old/modules/DONE/Core/Role/src/sync.lua +++ /dev/null @@ -1,82 +0,0 @@ -local Role = self -local RoleGlobal = RoleGlobal -local Sync = require('ExpGamingCore.Sync') -local Game = require('FactorioStdLib.Game') -local Color = require('FactorioStdLib.Color') - --- just to hard reset the role sync -function Sync.set_roles(...) - Role.set_preassign(...) -end - --- used to assign the role if the player is online, or add to the the preassign -function Sync.assign_role(player_name,roles,by_player_name) - if not game then return end - local preassign = RoleGlobal.preassign - local player_roles = preassign[player_name] - if Game.get_player(player_name) then Role.assign(player_name,roles,by_player_name) - else - if not is_type(roles,'table') then roles = {roles} end - if not player_roles then preassign[player_name] = roles return end - for _,role_name in pairs(roles) do - if not table.includes(player_roles,role_name) then table.insert(player_roles,role_name) end - end - end -end - --- used to unassign the role if the player is online, or removes the preassign -function Sync.unassign_role(player_name,roles,by_player_name) - if not game then return end - local preassign = RoleGlobal.preassign - local player_roles = preassign[player_name] - if Game.get_player(player_name) then Role.unassign(player_name,roles,by_player_name) - else - if not is_type(roles,'table') then roles = {roles} end - if not player_roles then preassign[player_name] = nil return end - for _,role_name in pairs(roles) do - local index = table.index(player_roles,role_name) - if index then table.remove(player_roles,index) end - end - end -end - -Sync.add_update('roles',function() - if not game then return {'Offline'} end - local _rtn = {} - for _,role in pairs(Role.roles) do - local players = role:get_players() - local _players = {} - for k,player in pairs(players) do _players[k] = player.name end - local online = role:get_players(true) - local _online = {} - for k,player in pairs(online) do _online[k] = player.name end - _rtn[role.name] = {players=_players,online=_online,n_players=#_players,n_online=#_online} - end - return _rtn -end) - --- Adds a caption to the info gui that shows the rank given to the player -if Sync.add_to_gui then - Sync.add_to_gui(function(player) - local names = {} - for _,role in pairs(Role.get(player)) do table.insert(names,role.name) end - return 'You have been assigned the roles: '..table.concat(names,', ') - end) -end - --- adds a discord emit for rank changing -Event.add('on_role_change',function(event) - local role = Role.get(event.role_name) - local player = Game.get_player(event) - local by_player = Game.get_player(event.by_player_index) or SERVER - if role.is_jail and RoleGlobal.last_change[1] ~= player.index then - Sync.emit_embedded{ - title='Player Jail', - color=Color.to_hex(defines.textcolor.med), - description='There was a player jailed.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player.name, - ['Reason:']='No Reason' - } - end -end) \ No newline at end of file diff --git a/old/modules/DONE/DamagePopup/control.lua b/old/modules/DONE/DamagePopup/control.lua deleted file mode 100644 index d172b8e3..00000000 --- a/old/modules/DONE/DamagePopup/control.lua +++ /dev/null @@ -1,45 +0,0 @@ ---- When a entity is damaged y a player it will show how much damage you've death, When a player gets attacked by a entity it will popup the player's health in color. --- @module DamagePopup@4.0.0 --- @author badgamernl --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias DamagePopup - --- Module Require -local Color = require('FactorioStdLib.Color') - -local DamagePopup = {} - -Event.add(defines.events.on_entity_damaged, function(event) - local entity = event.entity - local cause = event.cause - local damage = event.original_damage_amount - local health = entity.health - -- local pre_attack_health = health + damage -- Didn't use it after all, maybe useful later - - local color = defines.textcolor.crit - - if entity.name == 'player' then - if health > 100 then - if health > 200 then - color = defines.textcolor.low - else - color = defines.textcolor.med - end - end - entity.surface.create_entity{ - name="flying-text", - color=color, - text=math.floor(health), - position=entity.position - } - elseif cause and cause.name == 'player' then - entity.surface.create_entity{ - name="flying-text", - color=defines.textcolor.med, - text='-'..math.floor(damage), -- cooldude2606 added floor for damage amount - position=entity.position - } - end -end) - -return DamagePopup \ No newline at end of file diff --git a/old/modules/DONE/DamagePopup/softmod.json b/old/modules/DONE/DamagePopup/softmod.json deleted file mode 100644 index a5ea4de0..00000000 --- a/old/modules/DONE/DamagePopup/softmod.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "DamagePopup", - "version": "4.0.0", - "description": "When a entibty is damaged y a player it will show how much damage you've dealth, When a player gets attacked by a entity it will popup the player's health in color.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Damage", - "Popup", - "Floating", - "Text" - ], - "author": "badgamernl", - "contact": "badgamernl@gmail.com", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "dependencies": { - "FactorioStdLib.Color": "^0.8.0" - }, - "submodules": {} -} diff --git a/old/modules/DONE/DeathMarkers/control.lua b/old/modules/DONE/DeathMarkers/control.lua deleted file mode 100644 index 3e0e9004..00000000 --- a/old/modules/DONE/DeathMarkers/control.lua +++ /dev/null @@ -1,46 +0,0 @@ ---- Adds markers to the map when a player dies and removes it when the body is removed. --- @module DeathMarkers@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Define -local module_verbose = false -local ThisModule = {} - --- Global Define -local global = { - corpses={} -} -Global.register(global,function(tbl) global = tbl end) - --- Event Handlers Define -Event.add(defines.events.on_player_died, function(event) - local player = game.players[event.player_index] - local tag = player.force.add_chart_tag(player.surface,{ - position=player.position, - text='Death: '..player.name..' ('..tick_to_display_format(event.tick)..')' - }) - if not global.corpses then global.corpses = {} end - table.insert(global.corpses,tag) -end) - -Event.add(defines.events.on_tick, function(event) - if (game.tick%3600) ~= 0 then return end - if not global.corpses then global.corpses = {} end - local key = 1 - while key <= #global.corpses do - local tag = global.corpses[key] - if not tag or not tag.valid then table.remove(global.corpses,key) else - if not tag.target then - local entity = tag.surface.find_entity('character-corpse',tag.position) - if entity then tag.target = entity - else tag.destroy() table.remove(global.corpses,key) key=key-1 end - elseif not tag.target.valid then tag.destroy() table.remove(global.corpses,key) key=key-1 end - end - key=key+1 - end -end) - --- Module Return -return ThisModule \ No newline at end of file diff --git a/old/modules/DONE/DeathMarkers/softmod.json b/old/modules/DONE/DeathMarkers/softmod.json deleted file mode 100644 index ac58f593..00000000 --- a/old/modules/DONE/DeathMarkers/softmod.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "DeathMarkers", - "version": "4.0.0", - "description": "Adds markers to the map when a player dies and removes it when the body is removed.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Death", - "Marker", - "Body", - "Map" - ], - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "dependencies": {}, - "submodules": {} -} diff --git a/old/modules/DONE/ExpAdmin/Ban/control.lua b/old/modules/DONE/ExpAdmin/Ban/control.lua deleted file mode 100644 index 0a5f1935..00000000 --- a/old/modules/DONE/ExpAdmin/Ban/control.lua +++ /dev/null @@ -1,49 +0,0 @@ ---- Adds a custom ban function to the admin command set. --- @module ExpGamingAdmin.Ban@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Admin = require('ExpGamingAdmin') -local AdminGui = require('ExpGamingAdmin.Gui') -local Server = require('ExpGamingCore.Server') -local Game = require('FactorioStdLib.Game') -local Color -- FactorioStdLib.Color@^0.8.0 -local Sync -- ExpGamingCore.Sync@^4.0.0 - --- Module Define -local module_verbose = false -local ThisModule = { - on_init=function() - if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end - if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end - end -} - --- Function Define -AdminGui.add_button('Ban','utility/danger_icon',{'ExpGamingAdmin.tooltip-ban'},function(player,byPlayer) - Admin.open(byPlayer,player,'Ban') -end) - -function Admin.ban(player,by_player,reason) - player = Game.get_player(player) - local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' - reason = Admin.create_reason(reason,by_player_name) - Admin.set_banned(player,true) - if Sync then Sync.emit_embedded{ - title='Player Ban', - color=Color.to_hex(defines.textcolor.crit), - description='There was a player banned.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player_name, - ['Reason:']=reason - } end - if Admin.move_inventory then Admin.move_inventory(player) end - Server.interface(game.ban_player,true,player,reason) -end - -Admin.add_action('Ban',Admin.ban) - --- Module Return -return setmetatable(ThisModule,{__call=Admin.ban}) \ No newline at end of file diff --git a/old/modules/DONE/ExpAdmin/Ban/softmod.json b/old/modules/DONE/ExpAdmin/Ban/softmod.json deleted file mode 100644 index a055b3e5..00000000 --- a/old/modules/DONE/ExpAdmin/Ban/softmod.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "ExpGamingAdmin.Ban", - "version": "4.0.0", - "description": "Adds a custom ban function to the admin command set.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Ban", - "Admin", - "Set", - "ExpGaming" - ], - "dependencies": { - "ExpGamingAdmin.Gui": "^4.0.0", - "ExpGamingCore.Server": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0", - "FactorioStdLib.Color": "?^0.8.0", - "ExpGamingCore.Sync": "?^4.0.0", - "ExpGamingAdmin.ClearInventory": "?^4.0.0", - "ExpGamingAdmin": "^4.0.0" - }, - "collection": "ExpGamingAdmin@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/ExpAdmin/ClearInventory/control.lua b/old/modules/DONE/ExpAdmin/ClearInventory/control.lua deleted file mode 100644 index dea36113..00000000 --- a/old/modules/DONE/ExpAdmin/ClearInventory/control.lua +++ /dev/null @@ -1,58 +0,0 @@ ---- Adds a function to clear a players inventory and move the items to spawn. --- @module ExpGamingAdmin.ClearInventory@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Admin = require('ExpGamingAdmin') -local Game = require('FactorioStdLib.Game') - --- Module Define -local module_verbose = false -local ThisModule = {} - --- Function Define -local inventories = { - defines.inventory.player_main, - defines.inventory.player_quickbar, - defines.inventory.player_trash, - defines.inventory.player_guns, - defines.inventory.player_ammo, - defines.inventory.player_armor -} - -function Admin.move_item_to_spawn(item,surface,chests) - chests = chests or surface.find_entities_filtered{area={{-10,-10},{10,10}},name='iron-chest'} or {} - local chest = nil - while not chest or not chest.get_inventory(defines.inventory.chest).can_insert(item) do - chest = table.remove(chests,1) - if not chest then chest = surface.create_entity{ - name='iron-chest', - position=surface.find_non_colliding_position('iron-chest',{0,0},32,1) - } end - end - chest.get_inventory(defines.inventory.chest).insert(item) - table.insert(chests,chest) - return chests -end - -function Admin.move_inventory(player) - player = Game.get_player(player) - if not player then return end - local chests = player.surface.find_entities_filtered{area={{-10,-10},{10,10}},name='iron-chest'} or {} - for _,_inventory in pairs(inventories) do - local inventory = player.get_inventory(_inventory) - if inventory then - for item,count in pairs(inventory.get_contents()) do - item = {name=item,count=count} - chests = Admin.move_item_to_spawn(item,player.surface,chests) - end - inventory.clear() - end - end -end - -Admin.add_action('Clear Inventory',Admin.move_inventory) --- Module Return -return setmetatable(ThisModule,{__call=Admin.move_inventory}) \ No newline at end of file diff --git a/old/modules/DONE/ExpAdmin/ClearInventory/softmod.json b/old/modules/DONE/ExpAdmin/ClearInventory/softmod.json deleted file mode 100644 index ae931353..00000000 --- a/old/modules/DONE/ExpAdmin/ClearInventory/softmod.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "ExpGamingAdmin.ClearInventory", - "version": "4.0.0", - "description": "Adds a function to clear a players inventoy and move the items to spawn.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Spawn", - "Items", - "Admin", - "Move", - "Clear", - "Inventory" - ], - "dependencies": { - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingAdmin": "^4.0.0" - }, - "collection": "ExpGamingAdmin@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/ExpAdmin/Commands/control.lua b/old/modules/DONE/ExpAdmin/Commands/control.lua deleted file mode 100644 index 73038cd6..00000000 --- a/old/modules/DONE/ExpAdmin/Commands/control.lua +++ /dev/null @@ -1,25 +0,0 @@ ---- A full ranking system for factorio. --- @module ExpGamingAdmin.Commands@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - -local Admin = require('ExpGamingAdmin') - ---- Used to clear all parts of a player, removing warnings, reports, jail and temp ban --- @command clear-all --- @param player the player to clear -commands.add_command('clear-all', 'Clears a player of any temp-ban, reports or warnings', { - ['player']={true,'player'} -}, function(event,args) - Admin.clear_player(args.player,event.player_index) -end) - -return { - on_init = function(self) - if loaded_modules['ExpGamingAdmin.TempBan'] then verbose('ExpGamingAdmin.TempBan is installed; Loading tempban src') require(module_path..'/src/tempban',{self=Admin}) end - if loaded_modules['ExpGamingAdmin.Jail'] then verbose('ExpGamingAdmin.Jail is installed; Loading tempban src') require(module_path..'/src/jail',{self=Admin}) end - if loaded_modules['ExpGamingAdmin.Warnings'] then verbose('ExpGamingAdmin.Warnings is installed; Loading tempban src') require(module_path..'/src/warnings',{self=Admin}) end - if loaded_modules['ExpGamingAdmin.Reports'] then verbose('ExpGamingAdmin.Reports is installed; Loading tempban src') require(module_path..'/src/reports',{self=Admin}) end - if loaded_modules['ExpGamingAdmin.ClearInventory'] then verbose('ExpGamingAdmin.ClearInventory is installed; Loading tempban src') require(module_path..'/src/clear',{self=Admin}) end - end -} \ No newline at end of file diff --git a/old/modules/DONE/ExpAdmin/Commands/softmod.json b/old/modules/DONE/ExpAdmin/Commands/softmod.json deleted file mode 100644 index 541a7255..00000000 --- a/old/modules/DONE/ExpAdmin/Commands/softmod.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "ExpGamingAdmin.Commands", - "version": "4.0.0", - "description": "Admins many of the admin featues which the script can use as in game commands.", - "location": "FSM_ARCHIVE", - "keywords": [ - "ExpGaming", - "Admin", - "Tools", - "Commands", - "Temp ban", - "Jail", - "Clear Inventory", - "Report", - "Warnings" - ], - "dependencies": { - "ExpGamingLib": "^4.0.0", - "ExpGamingCore.Command": "^4.0.0", - "ExpGamingAdmin.TempBan": "?^4.0.0", - "ExpGamingAdmin.Jail": "?^4.0.0", - "ExpGamingAdmin.Warnings": "?^4.0.0", - "ExpGamingAdmin.Reports": "?^4.0.0", - "ExpGamingAdmin.ClearInventory": "?^4.0.0", - "ExpGamingAdmin": "^4.0.0" - }, - "collection": "ExpGamingAdmin@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/ExpAdmin/Commands/src/clear.lua b/old/modules/DONE/ExpAdmin/Commands/src/clear.lua deleted file mode 100644 index ec6262a7..00000000 --- a/old/modules/DONE/ExpAdmin/Commands/src/clear.lua +++ /dev/null @@ -1,12 +0,0 @@ -local Admin = self - ---- Clears a players inventory and moves it to chests in spawn --- @command clear-inv --- @param player the player to clear the inventory of -commands.add_command('clear-inv', 'Clears a player\'s invetory', { - ['player'] = {true,'player-rank'} -}, function(event,args) - local player = args.player - if Admin.is_banned(player) then player_return({'ExpGamingAdmin.cant-report-ban',args.player.name}) return commands.error end - Admin.move_inventory(player) -end) diff --git a/old/modules/DONE/ExpAdmin/Commands/src/jail.lua b/old/modules/DONE/ExpAdmin/Commands/src/jail.lua deleted file mode 100644 index 7d60da06..00000000 --- a/old/modules/DONE/ExpAdmin/Commands/src/jail.lua +++ /dev/null @@ -1,30 +0,0 @@ -local Admin = self -local Role = require('ExpGamingCore.Role') -local Server = require('ExpGamingCore.Server') - ---- Used to jail a player which stops them from moving --- @command jail --- @param player the player to be jailed --- @param[opt] reason the reason the player was jailed -commands.add_command('jail', 'Jails a player', { - ['player']={true,'player-rank'}, - ['reason']={false,'string-inf'} -}, function(event,args) - local player = args.player - local reason = args.reason - if Role.has_flag(player,'not_reportable') then player_return{'ExpGamingAdmin.cant-report',args.player.name} return commands.error end - if Admin.is_banned(player) then player_return{'ExpGamingAdmin.cant-report-ban',args.player.name} return commands.error end - Admin.jail(player,event.player_index,reason) -end) - ---- Used to unjail a player --- @command unjail --- @param player the player to unjail -commands.add_command('unjail', 'Returns a player\'s old rank', { - ['player']={true,'player'} -}, function(event,args) - local player = args.player - if Admin.is_banned(player,true) ~= 'jail' then player_return({'ExpGamingAdmin.cant-report-ban',args.player.name}) return commands.error end - Admin.set_banned(player,false) - Server.interface(Role.revert,true,player,event.player_index,2) -end) \ No newline at end of file diff --git a/old/modules/DONE/ExpAdmin/Commands/src/reports.lua b/old/modules/DONE/ExpAdmin/Commands/src/reports.lua deleted file mode 100644 index be67e7d8..00000000 --- a/old/modules/DONE/ExpAdmin/Commands/src/reports.lua +++ /dev/null @@ -1,35 +0,0 @@ -local Admin = self -local Role = require('ExpGamingCore.Role') -local Game = require('FactorioStdLib.Game') - ---- Reports a player --- @command report --- @param player the player to report --- @param[opt] reason the reason why the player was reported -commands.add_command('report', 'Reports a player', { - ['player']={true,'player-rank'}, - ['reason']={false,'string-inf'} -}, function(event,args) - local _player = Game.get_player(event) - local player = args.player - local reason = args.reason - if Admin.is_banned(player) then player_return({'ExpGamingAdmin.cant-report-ban',args.player.name}) return commands.error end - if Role.has_flag(player,'not_reportable') then player_return({'ExpGamingAdmin.cant-report',args.player.name}) return commands.error end - for _,report in pairs(global.addons.reports.reports) do if report[1] == _player.name then player_return({'ExpGamingAdmin.cant-report',args.player.name}) return commands.error end end - for _,report in pairs(global.addons.reports.verified) do if report[1] == _player.name then player_return({'ExpGamingAdmin.cant-report',args.player.name}) return commands.error end end - Admin.report(player,event.player_index,reason) -end) - ---- Clears the reports of the player --- @command clear-reports --- @param player the player to clear the reports of -commands.add_command('clear-reports', 'Clears a player\'s reports', { - ['player'] = {true,function(value) - local player,err = commands.validate['player'](value) - if err then return commands.error(err) end - local rtn = not Admin.is_banned(player) and player - if not rtn then return commands.error{'ExpGamingAdmin.cant-report-ban',value} end return rtn - end} -}, function(event,args) - Admin.clear_reports(args.player,event.player_index) -end) \ No newline at end of file diff --git a/old/modules/DONE/ExpAdmin/Commands/src/tempban.lua b/old/modules/DONE/ExpAdmin/Commands/src/tempban.lua deleted file mode 100644 index 8657d1ad..00000000 --- a/old/modules/DONE/ExpAdmin/Commands/src/tempban.lua +++ /dev/null @@ -1,15 +0,0 @@ -local Admin = self - ---- Used to temp ban a player and give a reason --- @command temp-ban --- @param player the player to temp ban --- @param[opt] reason the reason for the ban -commands.add_command('temp-ban', 'Temporarily ban a player', { - ['player']={true,'player-rank'}, - ['reason']={false,'string-inf'} -}, function(event,args) - local player = args.player - local reason = args.reason - if Admin.is_banned(player) and Admin.is_banned(player,true) ~= 'jail' then player_return({'ExpGamingAdmin.cant-report-ban',args.player.name}) return commands.error end - Admin.temp_ban(player,event.player_index,reason) -end) \ No newline at end of file diff --git a/old/modules/DONE/ExpAdmin/Commands/src/warnings.lua b/old/modules/DONE/ExpAdmin/Commands/src/warnings.lua deleted file mode 100644 index b3796656..00000000 --- a/old/modules/DONE/ExpAdmin/Commands/src/warnings.lua +++ /dev/null @@ -1,28 +0,0 @@ -local Admin = self -local Role = require('ExpGamingCore.Role') - ---- Gives a warning to a player --- @command warn --- @param player the player to give a warning to --- @param[opt] reason the reason the player was given a warning -commands.add_command('warn', 'Gives a player a warning', { - ['player']={true,'player-rank'}, - ['reason']={false,'string-inf'} -}, function(event,args) - local player = args.player - local reason = args.reason - if Admin.is_banned(player) then player_return{'ExpGamingAdmin.cant-report-ban',args.player.name} return commands.error end - if Role.has_flag(player,'not_reportable') then player_return{'ExpGamingAdmin.cant-report',args.player.name} return commands.error end - Admin.give_warning(player,event.player_index,reason) -end) - ---- Clears the warning of a player --- @command clear-warnings --- @param player the player to clear the warning of -commands.add_command('clear-warnings', 'Clears a player\'s warnings', { - ['player'] = {true,'player'} -}, function(event,args) - local player = args.player - if Admin.is_banned(player) then player_return({'ExpGamingAdmin.cant-report-ban',args.player.name}) return commands.error end - Admin.clear_warnings(player,event.player_index) -end) \ No newline at end of file diff --git a/old/modules/DONE/ExpAdmin/Jail/control.lua b/old/modules/DONE/ExpAdmin/Jail/control.lua deleted file mode 100644 index 49ed0f56..00000000 --- a/old/modules/DONE/ExpAdmin/Jail/control.lua +++ /dev/null @@ -1,51 +0,0 @@ ---- Adds a jail function to the admin set, require ExpGamingRole to work. --- @module ExpGamingAdmin.Jail@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Admin = require('ExpGamingAdmin') -local AdminGui = require('ExpGamingAdmin.Gui') -local Server = require('ExpGamingCore.Server') -local Role = require('ExpGamingCore.Role') -local Color -- FactorioStdLib.Color@^0.8.0 -local Sync -- ExpGamingCore.Sync@^4.0.0 - --- Module Define -local module_verbose = false -local ThisModule = { - on_init=function() - if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end - if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end - end -} - --- Function Define -AdminGui.add_button('jail','utility/clock',{'ExpGamingAdmin.tooltip-jail'},function(player,byPlayer) - Admin.open(byPlayer,player,'Jail') -end) - -function Admin.jail(player,by_player,reason) - player, by_player = Admin.valid_players(player,by_player) - if not player then return end - reason = Admin.create_reason(reason,by_player.name) - Admin.set_banned(player,'jail') - if Sync then Sync.emit_embedded{ - title='Player Jail', - color=Color.to_hex(defines.textcolor.med), - description='There was a player jailed.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player.name, - ['Reason:']=reason - } end - Role.meta.last_jail = player.name - player.driving = false - Server.interface(Role.assign,true,player,'Jail',by_player.name) - Server.interface(Role.unassign,true,player,Role.get(player),by_player.name) -end - -Admin.add_action('Jail',Admin.jail) - --- Module Return -return setmetatable(ThisModule,{__call=Admin.jail}) \ No newline at end of file diff --git a/old/modules/DONE/ExpAdmin/Jail/softmod.json b/old/modules/DONE/ExpAdmin/Jail/softmod.json deleted file mode 100644 index c6dba711..00000000 --- a/old/modules/DONE/ExpAdmin/Jail/softmod.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "ExpGamingAdmin.Jail", - "version": "4.0.0", - "description": "Adds a jail function to the admin set, require ExpGamingRole to work.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Jail", - "Roles", - "Admin", - "ExpGaming" - ], - "dependencies": { - "ExpGamingAdmin.Gui": "^4.0.0", - "ExpGamingCore.Server": "^4.0.0", - "ExpGamingCore.Role": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0", - "FactorioStdLib.Color": "?^0.8.0", - "ExpGamingCore.Sync": "?^4.0.0", - "ExpGamingAdmin.ClearInventory": "?^4.0.0", - "ExpGamingAdmin": "^4.0.0" - }, - "collection": "ExpGamingAdmin@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/ExpAdmin/Kick/control.lua b/old/modules/DONE/ExpAdmin/Kick/control.lua deleted file mode 100644 index 33fdf2c8..00000000 --- a/old/modules/DONE/ExpAdmin/Kick/control.lua +++ /dev/null @@ -1,47 +0,0 @@ ---- Adds a kick function to the admin function set. --- @module ExpGamingAdmin.Kick@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Admin = require('ExpGamingAdmin') -local AdminGui = require('ExpGamingAdmin.Gui') -local Server = require('ExpGamingCore.Server') -local Game = require('FactorioStdLib.Game') -local Color -- FactorioStdLib.Color@^0.8.0 -local Sync -- ExpGamingCore.Sync@^4.0.0 - --- Module Define -local module_verbose = false -local ThisModule = { - on_init=function() - if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end - if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end - end -} --- Function Define -AdminGui.add_button('Kick','utility/warning_icon',{'ExpGamingAdmin.tooltip-kick'},function(player,byPlayer) - Admin.open(byPlayer,player,'Kick') -end) - -function Admin.kick(player,by_player,reason) - player = Game.get_player(player) - local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' - reason = Admin.create_reason(reason,by_player_name) - if Sync then Sync.emit_embedded{ - title='Player Kick', - color=Color.to_hex(defines.textcolor.high), - description='There was a player kicked.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player_name, - ['Reason:']=reason - } end - if Admin.move_inventory then Admin.move_inventory(player) end - Server.interface(game.kick_player,true,player,reason) -end - -Admin.add_action('Kick',Admin.kick) - --- Module Return -return setmetatable(ThisModule,{__call=Admin.kick}) \ No newline at end of file diff --git a/old/modules/DONE/ExpAdmin/Kick/softmod.json b/old/modules/DONE/ExpAdmin/Kick/softmod.json deleted file mode 100644 index 26baa78c..00000000 --- a/old/modules/DONE/ExpAdmin/Kick/softmod.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "ExpGamingAdmin.Kick", - "version": "4.0.0", - "description": "Adds a kick function to the admin function set.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Admin", - "ExpGaming", - "Kick", - "Commands" - ], - "dependencies": { - "ExpGamingAdmin.Gui": "^4.0.0", - "ExpGamingCore.Server": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0", - "FactorioStdLib.Color": "?^0.8.0", - "ExpGamingCore.Sync": "?^4.0.0", - "ExpGamingAdmin.ClearInventory": "?^4.0.0", - "ExpGamingAdmin": "^4.0.0" - }, - "collection": "ExpGamingAdmin@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/ExpAdmin/Reports/control.lua b/old/modules/DONE/ExpAdmin/Reports/control.lua deleted file mode 100644 index 521397ae..00000000 --- a/old/modules/DONE/ExpAdmin/Reports/control.lua +++ /dev/null @@ -1,163 +0,0 @@ ---- Adds a report system into the game that can also push notifactions to discord. --- @module ExpGamingAdmin.Reports@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Admin = require('ExpGamingAdmin') -local Role = require('ExpGamingCore.Role') -local Gui = require('ExpGamingCore.Gui') -local Game = require('FactorioStdLib.Game') -local Color -- FactorioStdLib.Color@^0.8.0 -local Sync -- ExpGamingCore.Sync@^4.0.0 - --- Module Define -local module_verbose = false -local ThisModule = { - on_init=function() - if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end - if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end - end -} - --- Global Define -local global = { - reports={}, - verified={} -} -Global.register(global,function(tbl) global = tbl end) - --- Local Variables -local report_to_warnings = 1 -- used in count_reports -local verified_to_warnings = 3 -- used in count_reports -local reports_needed_for_jail = 6 - --- Function Define -local function report_message(player,by_player,reason) - player, by_player = Admin.valid_players(player,by_player) - if not player then return end - if Admin.is_banned(player,true) == 'report' then return end - Role.print(Role.meta.groups.User.lowest,{'ExpGamingAdmin.low-print',player.name,reason},defines.textcolor.info,true) - Role.print(Role.meta.groups.Admin.lowest,{'ExpGamingAdmin.high-print',player.name,by_player.name,reason},defines.textcolor.med) - if Sync then Sync.emit_embedded{ - title='Player Report', - color=Color.to_hex(defines.textcolor.med), - description='A player was reported.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player.name, - ['Reason:']=reason - } end -end - -local function cheak_reports(player) - player = Game.get_player(player) - if not player then return end - local reports = Admin.count_reports(player) - if reports >= reports_needed_for_jail and Role.get_highest(player).group.name ~= 'Jail' then - Admin.jail(player,'','Too many user reports. Contact an Admin to be unjailed.') - end -end - -function Admin.count_reports(player) - player = Game.get_player(player) - if not player then return 0 end - local _count = 0 - if global.reports[player.name] then - for _ in pairs(global.reports[player.name]) do - _count=_count+report_to_warnings - end - end - if global.verified[player.name] then - for _ in pairs(global.verified[player.name]) do - _count=_count+verified_to_warnings - end - end - return _count -end - -function Admin.report(player,by_player,reason) - player, by_player = Admin.valid_players(player,by_player) - if not player or Role.has_flag(player,'not_reportable') then return end - if Admin.is_banned(by_player) or Role.has_flag(by_player,'is_jail') then return end - if Role.has_flag(by_player,'is_verified') then - global.verified[player.name] = global.verified[player.name] or {} - local reports = global.verified[player.name] - for _,value in pairs(reports) do - if value[1] == by_player.name then return end - end - table.insert(reports,{by_player.name,reason}) - else - global.reports[player.name] = global.reports[player.name] or {} - local reports = global.reports[player.name] - for _,value in pairs(reports) do - if value[1] == by_player.name then return end - end - table.insert(reports,{by_player.name,reason}) - end - report_message(player,by_player,reason) - cheak_reports(player) -end - -function Admin.clear_reports(player,by_player,no_emit) - player, by_player = Admin.valid_players(player,by_player) - if not player then return end - global.reports[player.name]={} - global.verified[player.name]={} - if not no_emit and Sync then - Sync.emit_embedded{ - title='Player Clear', - color=Color.to_hex(defines.textcolor.low), - description='A player had their reports cleared.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player.name, - } - end -end - -local confirm_report = Gui.inputs{ - type='button', - name='admin-report-confirm', - caption='utility/spawn_flag', - tooltip={'ExpGamingAdmin.report'} -}:on_event('click',function(event) - local parent = event.element.parent - local player = Game.get_player(parent.player.caption) - local reason = parent.reason.text - Admin.report(player,event.player_index,reason) - Gui.center.clear(event.player_index) -end) - -Admin.report_btn = Gui.inputs{ - type='button', - name='admin-report', - caption='utility/spawn_flag', - tooltip={'ExpGamingAdmin.report'} -}:on_event('click',function(event) - local parent = event.element.parent - local player = Game.get_player(parent.children[1].name) - if not player then return end - local _player = Game.get_player(event) - Gui.center.clear(_player) - local frame = Gui.center.get_flow(_player).add{ - type='frame', - name='report-gui' - } - _player.opened=frame - frame.caption={'ExpGamingAdmin.report'} - frame.add{ - type='textfield', - name='reason' - }.style.width = 300 - local btn = confirm_report:draw(frame) - btn.style.height = 30 - btn.style.width = 30 - frame.add{ - type='label', - name='player', - caption=player.name - }.style.visible = false -end) - --- Module Return -return ThisModule \ No newline at end of file diff --git a/old/modules/DONE/ExpAdmin/Reports/softmod.json b/old/modules/DONE/ExpAdmin/Reports/softmod.json deleted file mode 100644 index 4aee29bb..00000000 --- a/old/modules/DONE/ExpAdmin/Reports/softmod.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "ExpGamingAdmin.Reports", - "version": "4.0.0", - "description": "Adds a report system into the game that can also push notifactions to discord.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Report", - "Player", - "Admin", - "ExpGaming", - "Player List", - "Commands" - ], - "dependencies": { - "ExpGamingCore.Server": "^4.0.0", - "ExpGamingCore.Role": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0", - "FactorioStdLib.Color": "?^0.8.0", - "ExpGamingCore.Sync": "?^4.0.0", - "ExpGamingCore.Gui": "^4.0.0", - "ExpGamingAdmin": "^4.0.0" - }, - "collection": "ExpGamingAdmin@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/ExpAdmin/Teleport/control.lua b/old/modules/DONE/ExpAdmin/Teleport/control.lua deleted file mode 100644 index f745add4..00000000 --- a/old/modules/DONE/ExpAdmin/Teleport/control.lua +++ /dev/null @@ -1,43 +0,0 @@ ---- Adds three function to admin: tp, bring and go to, these all move the player --- @module ExpGamingAdmin.Teleport@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Admin = require('ExpGamingAdmin') -local AdminGui = require('ExpGamingAdmin.Gui') -local Game = require('FactorioStdLib.Game') - --- Module Define -local module_verbose = false -local ThisModule = {} - --- Function Define -AdminGui.add_button('Go To','utility/export_slot',{'ExpGamingAdmin.tooltip-go-to'},function(player,byPlayer) - Admin.go_to(player,byPlayer) -end) -AdminGui.add_button('Bring','utility/import_slot',{'ExpGamingAdmin.tooltip-bring'},function(player,byPlayer) - Admin.bring(player,byPlayer) -end) - -function Admin.tp(from_player, to_player) - local _from_player = Game.get_player(from_player) - local _to_player = Game.get_player(to_player) - if not _from_player or not _to_player then return end - _from_player.teleport(_to_player.surface.find_non_colliding_position('player',_to_player.position,32,1),_to_player.surface) -end - -function Admin.go_to(player,by_player) - Admin.tp(by_player, player) -end - -function Admin.bring(player,by_player) - Admin.tp(player, by_player) -end - -Admin.add_action('Go To',Admin.go_to) -Admin.add_action('Bring',Admin.bring) - --- Module Return -return setmetatable(ThisModule,{__call=Admin.tp}) \ No newline at end of file diff --git a/old/modules/DONE/ExpAdmin/Teleport/softmod.json b/old/modules/DONE/ExpAdmin/Teleport/softmod.json deleted file mode 100644 index 2bebb4c4..00000000 --- a/old/modules/DONE/ExpAdmin/Teleport/softmod.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "ExpGamingAdmin.Teleport", - "version": "4.0.0", - "description": "Adds three function to admin: tp, bring and go to, these all move the player.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Tp", - "Bring", - "Go To", - "Admin", - "ExpGaming", - "Teleport", - "Commands" - ], - "dependencies": { - "ExpGamingAdmin.Gui": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingAdmin": "^4.0.0" - }, - "collection": "ExpGamingAdmin@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/ExpAdmin/TempBan/control.lua b/old/modules/DONE/ExpAdmin/TempBan/control.lua deleted file mode 100644 index 5848fd5c..00000000 --- a/old/modules/DONE/ExpAdmin/TempBan/control.lua +++ /dev/null @@ -1,48 +0,0 @@ ---- Adds a temp ban function to the admin set, requires ExpGamingCore.Role to work. --- @module ExpGamingAdmin.KicTempBan@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Admin = require('ExpGamingAdmin') -local Server = require('ExpGamingCore.Server') -local Role = require('ExpGamingCore.Role') -local Game = require('FactorioStdLib.Game') -local Color -- FactorioStdLib.Color@^0.8.0 -local Sync -- ExpGamingCore.Sync@^4.0.0 - --- Module Define -local module_verbose = false -local ThisModule = { - on_init=function() - if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end - if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end - end -} - --- Function Define -function Admin.temp_ban(player,by_player,reason) - local player = Game.get_player(player) - local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' - if not player or Admin.is_banned(player) then return end - Admin.set_banned(player,'temp') - if Sync then Sync.emit_embedded{ - title='Player Temp-Ban', - color=Color.to_hex(defines.textcolor.high), - description='A player was jailed.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player_name, - ['Reason:']=Admin.create_reason(reason,by_player_name) - } end - game.print({'ExpGamingAdmin.temp-ban',player.name,by_player_name,reason},defines.textcolor.info) - if Admin.move_inventory then Admin.move_inventory(player) end - Role.meta.last_jail = player.name - Server.interface(Role.unassign,true,player,Role.get(player),by_player_name) - Server.interface(Role.assign,true,player,'Jail',by_player_name) -end - -Admin.add_action('Temp Ban',Admin.temp_ban) - --- Module Return -return setmetatable(ThisModule,{__call=Admin.temp_ban}) \ No newline at end of file diff --git a/old/modules/DONE/ExpAdmin/TempBan/softmod.json b/old/modules/DONE/ExpAdmin/TempBan/softmod.json deleted file mode 100644 index 64853ebb..00000000 --- a/old/modules/DONE/ExpAdmin/TempBan/softmod.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "ExpGamingAdmin.TempBan", - "version": "4.0.0", - "description": "Adds a temp ban function to the admin set, requires ExpGamingCore.Role to work.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Jail", - "Temp Ban", - "Admin", - "ExpGaming", - "Roles" - ], - "dependencies": { - "ExpGamingCore.Server": "^4.0.0", - "ExpGamingCore.Role": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0", - "FactorioStdLib.Color": "?^0.8.0", - "ExpGamingCore.Sync": "?^4.0.0", - "ExpGamingAdmin.ClearInventory": "?^4.0.0", - "ExpGamingAdmin": "^4.0.0" - }, - "collection": "ExpGamingAdmin@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/ExpAdmin/Warnings/control.lua b/old/modules/DONE/ExpAdmin/Warnings/control.lua deleted file mode 100644 index f10bc95a..00000000 --- a/old/modules/DONE/ExpAdmin/Warnings/control.lua +++ /dev/null @@ -1,142 +0,0 @@ ---- Adds a warning system into the admin set which can be used by admins and the script. --- @module ExpGamingAdmin.Warnings@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Admin = require('ExpGamingAdmin') -local Server = require('ExpGamingCore.Server') -local Role = require('ExpGamingCore.Role') -local Game = require('FactorioStdLib.Game') -local Color -- FactorioStdLib.Color@^0.8.0 -local Sync -- ExpGamingCore.Sync@^4.0.0 - --- Local Variables -local take_action = 8 -- the first admin given warning jumps to this number, this case kick-warn is giving -local remove_warnings_time = {} -local min_time_to_remove_warning = 18000 -- this is in ticks -local punishments = { - {'nothing'}, - {'nothing'}, - {'nothing'}, - {'nothing'}, - {'nothing'}, - {'message',{'ExpGamingAdmin-Warnings.message'},defines.textcolor.info}, - {'message',{'ExpGamingAdmin-Warnings.message'},defines.textcolor.info}, - {'message',{'ExpGamingAdmin-Warnings.kick-warn'},defines.textcolor.med}, - {'kick'}, - {'message',{'ExpGamingAdmin-Warnings.temp-warn'},defines.textcolor.high}, - {'temp-ban'}, - {'message',{'ExpGamingAdmin-Warnings.ban-warn'},defines.textcolor.high}, - {'message',{'ExpGamingAdmin-Warnings.last-warn'},defines.textcolor.crit}, - {'ban'} -} - --- Module Define -local module_verbose = false -local ThisModule = { - on_init=function() - if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end - if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end - if loaded_modules['ExpGamingAdmin.Reports'] then - take_action = take_action + 1 - table.insert(punishments,take_action,{'report',{'ExpGamingAdmin-Warnings.reported'},defines.textcolor.med}) - end - end, - on_post=function() - local highest = nil - for _,role in pairs(Role.roles) do - local power = role.index - if not highest and not role.not_reportable then highest = power-1 end - local _power = power; if highest then _power = power-highest end - if role.not_reportable then remove_warnings_time[power] = 0 - else remove_warnings_time[power] = min_time_to_remove_warning*_power end - end - end -} - --- Global Define -local global = {} -Global.register(global,function(tbl) global = tbl end) - --- Function Define -local function give_punishment(player,by_player,reason) - player, by_player = Admin.valid_players(player,by_player) - reason = reason or 'No Other Reason' - local warnings = Admin.get_warnings(player) - local punishment = punishments[warnings] - if not punishment or punishment[1] == 'nothing' then return - elseif punishment[1] == 'message' then - local message = punishment[2] - local colour = punishment[3] - player_return(message,colour,player) - elseif punishment[1] == 'report' then - local message = punishment[2] - local colour = punishment[3] - player_return(message,colour,player) - Admin.report(player,'',reason) - elseif punishment[1] == 'kick' then - Admin.kick(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason) - elseif punishment[1] == 'temp-ban' then - Admin.temp_ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason) - elseif punishment[1] == 'ban' then - Admin.ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason) - end -end - -function Admin.get_warnings(player) - player = Game.get_player(player) - return global[player.name] or 0 -end - -function Admin.give_warning(player,by_player,reason,min) - player, by_player = Admin.valid_players(player,by_player) - if not player then return end - min = Game.get_player(by_player) and Game.get_player(by_player) ~= SERVER and take_action or min or 0 - local warnings = Admin.get_warnings(player) - if warnings < min then warnings = min-1 end - warnings = warnings+1 - global[player.name] = warnings - if warnings > take_action then - player_return({'ExpGamingAdmin-Warnings.warning-given-by',by_player.name},defines.textcolor.info,player) - game.print({'ExpGamingAdmin-Warnings.player-warning',player.name,by_player.name,reason}) - end - give_punishment(player,by_player,reason) -end - -function Admin.clear_warnings(player,by_player,no_emit) - player, by_player = Admin.valid_players(player,by_player) - if not player then return end - global[player.name]=nil - if not no_emit and Sync then - Sync.emit_embedded{ - title='Player Clear', - color=Color.to_hex(defines.textcolor.low), - description='A player had their warnings cleared.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player.name, - } - end -end - --- Event Handlers Define -Event.add(defines.events.on_tick,function(event) - if (game.tick % min_time_to_remove_warning) == 0 then - for name,warnings in pairs(global) do - if warnings > 0 then - local role = Role.get_highest(name) - local time_to_remove = remove_warnings_time[role.index] - if (game.tick % time_to_remove) == 0 then - global[name]=warnings-1 - if global[name] > 5 then - player_return({'ExpGamingAdmin-Warnings.remove-warn',global[name],tick_to_display_format(time_to_remove)},defines.textcolor.low,name) - end - end - end - end - end -end) - --- Module Return -return ThisModule \ No newline at end of file diff --git a/old/modules/DONE/ExpAdmin/Warnings/locale/de.cfg b/old/modules/DONE/ExpAdmin/Warnings/locale/de.cfg deleted file mode 100644 index c48f518a..00000000 --- a/old/modules/DONE/ExpAdmin/Warnings/locale/de.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[ExpGamingAdmin-Warnings] -warning-given-by=This Warnings Was Given By: __1__ -player-warning=__1__ was given a warning by __2__ reason: __3__ -temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset -remove-warn=You are had a warning Removed, you have __1__ warnings, next removed in __2__ -message=You Are Currently Reciving Warnings From The Script, This Will Continue Unless You Cease And Desist -reported=You Have Been Reported To The Admins By The Script, Further Acction May Be Taken If You Do Not Cease And Desist. -kick-warn=You Are On A Warning To Be KICKED, The Script Will Auto Kick If You Do Not Cease And Desist. -temp-warn=You Are On A Warning To Be TEMP BANNED, The Script Will Auto Ban If You Do Not Cease And Desist. -ban-warn=You Are On A Warning To Be BANNED, The Script Will Auto Ban If You Do Not Cease And Desist. -last-warn=YOU ARE ON A LAST WARNING TO BE BANNED, THE SCRIPT WILL AUTO BAN IF YOU DO NOT CEASE AND DESIST. \ No newline at end of file diff --git a/old/modules/DONE/ExpAdmin/Warnings/locale/en.cfg b/old/modules/DONE/ExpAdmin/Warnings/locale/en.cfg deleted file mode 100644 index 01715fc7..00000000 --- a/old/modules/DONE/ExpAdmin/Warnings/locale/en.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[ExpGamingAdmin-Warnings] -warning-given-by=This warning was given by: __1__ -player-warning=__1__ was given a warning by __2__ for: __3__ -remove-warn=One of your warnings expired. You have __1__ warnings left, next warning will be removed in __2__ -message=You are currently being warned by the system. These will continue until you cease and desist. -reported=You have been reported to the admins by the system. Further action may be taken if you do not cease and desist. -kick-warn=This is your last warning before you get kicked. The system will automatically kick you if you do not cease and desist. -temp-warn=This is your last warning before you get temporary banned. The system will automatically ban you if you do not cease and desist. -ban-warn=WARNING: This is your last warning before you get BANNED. The system will automatically BAN you if you do not cease and desist. -last-warn=WARNING: This is your last warning before you get PERMANENTLY BANNED. The system will automatically PERMANENTLY BAN you if you do not cease and desist. diff --git a/old/modules/DONE/ExpAdmin/Warnings/locale/fr.cfg b/old/modules/DONE/ExpAdmin/Warnings/locale/fr.cfg deleted file mode 100644 index c48f518a..00000000 --- a/old/modules/DONE/ExpAdmin/Warnings/locale/fr.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[ExpGamingAdmin-Warnings] -warning-given-by=This Warnings Was Given By: __1__ -player-warning=__1__ was given a warning by __2__ reason: __3__ -temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset -remove-warn=You are had a warning Removed, you have __1__ warnings, next removed in __2__ -message=You Are Currently Reciving Warnings From The Script, This Will Continue Unless You Cease And Desist -reported=You Have Been Reported To The Admins By The Script, Further Acction May Be Taken If You Do Not Cease And Desist. -kick-warn=You Are On A Warning To Be KICKED, The Script Will Auto Kick If You Do Not Cease And Desist. -temp-warn=You Are On A Warning To Be TEMP BANNED, The Script Will Auto Ban If You Do Not Cease And Desist. -ban-warn=You Are On A Warning To Be BANNED, The Script Will Auto Ban If You Do Not Cease And Desist. -last-warn=YOU ARE ON A LAST WARNING TO BE BANNED, THE SCRIPT WILL AUTO BAN IF YOU DO NOT CEASE AND DESIST. \ No newline at end of file diff --git a/old/modules/DONE/ExpAdmin/Warnings/locale/nl.cfg b/old/modules/DONE/ExpAdmin/Warnings/locale/nl.cfg deleted file mode 100644 index 104ef981..00000000 --- a/old/modules/DONE/ExpAdmin/Warnings/locale/nl.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[ExpGamingAdmin-Warnings] -warning-given-by=Deze waarschuwing is gegeven door: __1__ -player-warning=__1__ is gewaarschuwd door __2__ met de reden: __3__ -temp-ban=__1__ is verbannen door __2__ en is gejailed tot de volgende reset. -remove-warn=Een waarschuwing is verlopen. Je hebt nu nog maar __1__ waarschuwing, volgende waarschuwing verloopt in __2__ -message=Je ontvangt waarschuwingen door het systeem. Deze waarschuwingen stoppen niet tot je stopt met wat je verkeerd doet. -reported=Je bent gerapporteerd aan de administrators door het systeem. Je zal bestraft worden als je niet stopt met wat je verkeerd doet. -kick-warn=WAARSCHUWING: Dit is je laatste waarschuwing voordat je gekickt wordt. -temp-warn=WAARSCHUWING: Dit is je laatste waarschuwing voordat je tijdelijk verbannen wordt. -ban-warn=WAARSCHUWING: Dit is je laatste waarschuwing voordat je permanent verbannen wordt. -last-warn=DIT IS JE LAATSTE WAARSCHUWING. Het systeem zal je automatisch VERBANNEN als je niet stopt met wat je verkeerd doet. diff --git a/old/modules/DONE/ExpAdmin/Warnings/locale/sv-SE.cfg b/old/modules/DONE/ExpAdmin/Warnings/locale/sv-SE.cfg deleted file mode 100644 index 9358b9cf..00000000 --- a/old/modules/DONE/ExpAdmin/Warnings/locale/sv-SE.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[ExpGamingAdmin-Warnings] -warning-given-by=Den här varningen gavs av: __1__ -player-warning=__1__ var tillfälligt bannlyst av __2__ och kommer att förbli i fängelset tills nästa återställning (reset) -remove-warn=En av dina varningar har gått ut. Du har __1__ varning kvar, nästa varning kommer at tas bort om __2__ -message=Du får för nuvarande varningar av systemet. De kommer fortsätta tills du upphör med överträdelsen. -reported= Du har blivit rapporterad till administrationen av systemet. Mer påföljd kan komma att tas om du inte upphör med överträdelsen. -kick-warn=Det här är din sista varning innan du blir sparkad. Systemet kommer att automatisk sparka dig om du inte upphör med överträdelsen -temp-warn=Det här är din sista varning innan du blir tillfälligt bannlyst. Systemet kommer att automatiskt bannlysa dig om du inte upphör överträdelsen -ban-warn=VARNING: Det här är din sista varning innan du blir bannlyst. Systemet kommer att automatisk bannlysa dig om du inte upphör med överträdelsen. -last-warn=VARNING: Det här är din sista varning innan du blir permanent bannlyst. Systemet kommer att automatiskt permanent bannlysa dig om du inte upphör med överträdelsen. diff --git a/old/modules/DONE/ExpAdmin/Warnings/softmod.json b/old/modules/DONE/ExpAdmin/Warnings/softmod.json deleted file mode 100644 index 70c11140..00000000 --- a/old/modules/DONE/ExpAdmin/Warnings/softmod.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "ExpGamingAdmin.Warnings", - "version": "4.0.0", - "description": "Adds a warning system into the admin set which can be used by admins and the script.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Warning", - "Admin", - "ExpGaming", - "Report", - "Kick", - "Punishments", - "Ban" - ], - "dependencies": { - "ExpGamingCore.Server": "^4.0.0", - "ExpGamingCore.Role": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0", - "FactorioStdLib.Color": "?^0.8.0", - "ExpGamingAdmin.Reports": "?^4.0.0", - "ExpGamingCore.Sync": "?^4.0.0", - "ExpGamingAdmin": "^4.0.0" - }, - "collection": "ExpGamingAdmin@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/ExpGamingBot/softmod.json b/old/modules/DONE/ExpGamingBot/softmod.json deleted file mode 100644 index a7328e25..00000000 --- a/old/modules/DONE/ExpGamingBot/softmod.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "ExpGamingBot", - "version": "4.0.0", - "description": "Different parts of a useful bot to help run a server. Discord Bot Not Included.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Discord", - "Bot", - "Messages", - "Chat", - "Auto" - ], - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "submodules": { - "ExpGamingBot.autoChat": "4.0.0", - "ExpGamingBot.autoMessage": "4.0.0", - "ExpGamingBot.discordAlerts": "4.0.0" - }, - "dependencies": {} -} diff --git a/old/modules/DONE/ExpGamingLib/control.lua b/old/modules/DONE/ExpGamingLib/control.lua deleted file mode 100644 index 5bc65516..00000000 --- a/old/modules/DONE/ExpGamingLib/control.lua +++ /dev/null @@ -1,330 +0,0 @@ ---- Adds some common functions used though out all ExpGaming modules --- @module ExpGamingLib --- @alias ExpLib --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - -local Game = require('FactorioStdLib.Game') -local Color = require('FactorioStdLib.Color') - -local module_verbose = false -- there is no verbose in this file so true will do nothing -local ExpLib = {} - ---- Loads a table into _G even when sandboxes; will not overwrite values or append to tables; will not work during runtime to avoid desyncs --- @usage unpack_to_G{key1='foo',key2='bar'} --- @tparam table table tbl to be unpacked -function ExpLib.unpack_to_G(tbl) - if not type(tbl) == 'table' or game then return end - for key,value in pairs(tbl) do - if not _G[key] then rawset(_G,key,value) end - end -end - ---- Used to get the current ENV with all _G keys removed; useful when saving function to global --- @usage get_env() returns current ENV with _G keys removed --- @treturn table the env table with _G keys removed --- @warning does not work from console -function ExpLib.get_env(level) - level = level and level+1 or 2 - local env = setmetatable({},{__index=_G}) - while true do - if not debug.getinfo(level) then break end - local i = 1 - while true do - local name, value = debug.getlocal(level,i) - if not name or _G[name] == value then break else env[name] = value end - i=i+1 - end - level=level+1 - end - return env -end - ---- Used to get the current ENV with all _G keys removed; useful when saving function to global --- @usage get_env() returns current ENV with _G keys removed --- @treturn table the env table with _G keys removed --- @warning does not work from console -function ExpLib.get_upvalues(level) - local func = level and ExpLib.is_type(level,'function') and level or nil - level = level and ExpLib.is_type(level,'number') and level+1 or 2 - func = func or debug.getinfo(level).func - local upvalues = setmetatable({},{__index=_G}) - local i = 1 - while true do - local name, value = debug.getupvalue(func,i) - if not name then break else upvalues[name] = value end - i=i+1 - end - return upvalues -end - ---- Creates a table that will act like a string and a function --- @usage add_metatable({},function) -- returns table --- @tparam table table tbl the that will have its metatable set --- @tparam[opt=tostring] function function callback the that will be used for the call --- @tparam[opt=table.tostring] function string string ?function|string a that resolves to a or a string --- @treturn table the new table with its metatable set -function ExpLib.add_metatable(tbl,callback,string) - if not ExpLib.is_type(tbl,'table') then error('No table given to add_metatable',2) end - callback = ExpLib.is_type(callback,'function') and callback or tostring - string = ExpLib.is_type(string,'function') and string or ExpLib.is_type(string,'string') and function() return string end or table.tostring - return setmetatable(tbl,{ - __tostring=string, - __concat=function(val1,val2) return type(val1) == 'string' and val1..string(val2) or string(val1)..val2 end, - __call=callback - }) -end - ---- Compare types faster for faster validation of prams --- @usage is_type('foo','string') -- return true --- @usage is_type('foo') -- return false --- @param v the value to be tested --- @tparam[opt=nil] string test_type the type to test for if not given then it tests for nil --- @treturn boolean is v of type test_type -function ExpLib.is_type(v,test_type) - return test_type and v and type(v) == test_type or not test_type and not v or false -end - ---- Compare types faster for faster validation of prams, including giving an error if incorrect --- @usage type_error('foo','string','Value is not a string') -- return true --- @usage type_error('foo','table','Value is not a string') -- return error --- @param value the value to be tested --- @tparam[opt=nil] string type the type that the value should be --- @tparam string error_message the message given when type is not matched --- @treturn boolean if it matched or and error -function ExpLib.type_error(value,type,error_message) - return ExpLib.is_type(value,type) or error(error_message,3) -end - ---- A specialised version of type_error to test for self --- @usage self_test(self,'Object','get_name') --- @tparam table table self the that is the object --- @tparam string prototype_name the name of the class --- @tparam string function_name the name of the function -function ExpLib.self_test(self,prototype_name,function_name) - return ExpLib.is_type(self,'table') or error('Call to prototype without context, either supply a '..prototype_name..' or use '..prototype_name..':'..function_name,3) -end - ---- Will return a value of any type to the player/server console, allows colour for in-game players --- @usage player_return('Hello, World!') -- returns 'Hello, World!' to game.player or server console --- @usage player_return('Hello, World!','green') -- returns 'Hello, World!' to game.player with colour green or server console --- @usage player_return('Hello, World!',nil,player) -- returns 'Hello, World!' to the given player --- @param rtn any value of any type that will be returned to the player or console --- @tparam[opt=defines.colour.white] ?defines.color|string colour the colour of the text for the player, ignored when printing to console --- @tparam[opt=game.player] LuaPlayer player the player that return will go to, if no game.player then returns to server -function ExpLib.player_return(rtn,colour,player) - colour = ExpLib.is_type(colour,'table') and colour or defines.textcolor[colour] ~= defines.color.white and defines.textcolor[colour] or defines.color[colour] - player = player or game.player - -- converts the value to a string - local returnAsString - if ExpLib.is_type(rtn,'table') then - if ExpLib.is_type(rtn.__self,'userdata') then - -- value is userdata - returnAsString = 'Cant Display Userdata' - elseif ExpLib.is_type(rtn[1],'string') and string.find(rtn[1],'.+[.].+') and not string.find(rtn[1],'%s') then - -- value is a locale string - returnAsString = rtn - elseif getmetatable(rtn) ~= nil and not tostring(rtn):find('table: 0x') then - -- value has a tostring meta method - returnAsString = tostring(rtn) - else - -- value is a table - returnAsString = table.tostring(rtn) - end - elseif ExpLib.is_type(rtn,'function') then - -- value is a function - returnAsString = 'Cant Display Functions' - else returnAsString = tostring(rtn) end - -- returns to the player or the server - if player then - -- allows any valid player identifier to be used - player = Game.get_player(player) - if not player then error('Invalid Player given to player_return',2) end - -- plays a nice sound that is different to normal message sound - player.play_sound{path='utility/scenario_message'} - player.print(returnAsString,colour) - else rcon.print(returnAsString) end -end - ---- Convert ticks to hours --- @usage tick_to_hour(216001) -- return 1 --- @tparam number tick tick to convert to hours --- @treturn number the number of whole hours from this tick -function ExpLib.tick_to_hour(tick) - if not ExpLib.is_type(tick,'number') then return 0 end - if not game then return math.floor(tick/216000) end - return math.floor(tick/(216000*game.speed)) -end - ---- Convert ticks to minutes --- @usage tick_to_hour(3601) -- return 1 --- @tparam number tick tick to convert to minutes --- @treturn number the number of whole minutes from this tick -function ExpLib.tick_to_min (tick) - if not ExpLib.is_type(tick,'number') then return 0 end - if not game then return math.floor(tick/3600) end - return math.floor(tick/(3600*game.speed)) -end - ---- Converts a tick into a clean format for end user --- @usage tick_to_display_format(3600) -- return '1.00 M' --- @usage tick_to_display_format(234000) -- return '1 H 5 M' --- @tparam number tick the tick to convert --- @treturn string the formated string -function ExpLib.tick_to_display_format(tick) - if not ExpLib.is_type(tick,'number') then return '0H 0M' end - if ExpLib.tick_to_min(tick) < 10 then - if not game then return math.floor(tick/3600) end - return string.format('%.2f M',tick/(3600*game.speed)) - else - return string.format('%d H %d M', - ExpLib.tick_to_hour(tick), - ExpLib.tick_to_min(tick)-60*ExpLib.tick_to_hour(tick) - ) - end -end - ---- Used as a way to view the structure of a gui, used for debugging --- @usage Gui_tree(root) returns all children of gui recursively --- @tparam LuaGuiElement root the root to start the tree from --- @treturn table the table that describes the gui -function ExpLib.gui_tree(root) - if not ExpLib.is_type(root,'table') or not root.valid then error('Invalid Gui Element given to gui_tree',2) end - local tree = {} - for _,child in pairs(root.children) do - if #child.children > 0 then - if child.name then tree[child.name] = ExpLib.gui_tree(child) - else table.insert(tree,ExpLib.gui_tree(child)) end - else - if child.name then tree[child.name] = child.type - else table.insert(tree,child.type) end - end - end - return tree -end - ---- Extents the table class --- @type table --- @alias table - ---- Returns a value in a form able to be read as a value, any value to string --- @usage table.val_to_str{a='foo'} -- return '"foo"' --- @param v value to convert --- @treturn string the converted value -function table.val_to_str(v) - if "string" == type( v ) then - v = string.gsub(v,"\n","\\n") - if string.match(string.gsub(v,"[^'\"]",""),'^"+$') then - return "'"..v.."'" - end - return '"'..string.gsub(v,'"', '\\"' )..'"' - else - return "table" == type( v) and table.tostring(v) or - "function" == type(v) and '"cant-display-function"' or - "userdata" == type(v) and '"cant-display-userdata"' or - tostring(v) - end -end - ---- Returns a value in a form able to be read as a key, any key to string --- @usage table.val_to_str{a='foo'} -- return '["a"]' --- @param k key to convert --- @treturn string the converted key -function table.key_to_str (k) - if "string" == type(k) and string.match(k,"^[_%player][_%player%d]*$") then - return k - else - return "["..table.val_to_str(k).."]" - end -end - ---- Returns a table in a form able to be read as a table --- @usage table.tostring{k1='foo',k2='bar'} -- return '{["k1"]="foo",["k2"]="bar"}' --- @tparam table table tbl to convert --- @treturn string the converted table -function table.tostring(tbl) - if type(tbl) ~= 'table' then return tostring(tbl) end - local result, done = {}, {} - for k, v in ipairs(tbl) do - table.insert(result,table.val_to_str(v)) - done[k] = true - end - for k, v in pairs(tbl) do - if not done[k] then - table.insert(result, - table.key_to_str(k).."="..table.val_to_str(v)) - end - end - return "{"..table.concat(result,",") .."}" -end - ---- Similar to table.tostring but converts a lua table to a json one --- @usage table.json{k1='foo',k2='bar'} -- return '{"k1":"foo","k2":"bar"}' --- @tparam table table lua_table the to convert --- @treturn string the table in a json format -function table.json(lua_table) - --if game and game.table_to_json then return game.table_to_json(lua_table) end - local result, done, only_indexes = {}, {}, true - for key,value in ipairs(lua_table) do - done[key] = true - if type(value) == 'table' then table.insert(result,table.json(value,true)) - elseif not value then table.insert(result,'null') - else table.insert(result,table.val_to_str(value)) - end - end - for key,value in pairs(lua_table) do - if not done[key] then - only_indexes = false - if type(value) == 'table' then table.insert(result,table.val_to_str(key)..':'..table.json(value,true)) - elseif not value then table.insert(result,table.val_to_str(key)..':null') - else table.insert(result,table.val_to_str(key)..':'..table.val_to_str(value)) - end - end - end - if only_indexes then return "["..table.concat(result,",").."]" - else return "{"..table.concat(result,",").."}" - end -end - ---- Returns the closest match to a key --- @usage table.autokey({foo=1,bar=2},'f') -- return 1 --- @tparam table table tbl the that will be searched --- @tparam string string str the that will be looked for in the keys -function table.autokey(tbl,str) - if not ExpLib.is_type(str,'string') then return end - local _return = {} - for key,value in pairs(tbl) do - if string.contains(string.lower(key),string.lower(str)) then table.insert(_return,value) end - end - return _return[1] or false -end - ---- Returns the list is a sorted way that would be expected by people (this is by key) --- @usage tbl = table.alphanumsort(tbl) --- @tparam table table tbl the to be sorted --- @treturn table the sorted table -function table.alphanumsort(tbl) - local o = table.keys(tbl) - local function padnum(d) local dec, n = string.match(d, "(%.?)0*(.+)") - return #dec > 0 and ("%.12f"):format(d) or ("%s%03d%s"):format(dec, #n, n) end - table.sort(o, function(a,b) - return tostring(a):gsub("%.?%d+",padnum)..("%3d"):format(#b) - < tostring(b):gsub("%.?%d+",padnum)..("%3d"):format(#a) end) - local _tbl = {} - for _,k in pairs(o) do _tbl[k] = tbl[k] end - return _tbl -end - ---- Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above) --- @usage tbl = table.alphanumsort(tbl) --- @tparam table table tbl the to be sorted --- @treturn table the sorted table -function table.keysort(tbl) - local o = table.keys(tbl,true) - local _tbl = {} - for _,k in pairs(o) do _tbl[k] = tbl[k] end - return _tbl -end - -ExpLib:unpack_to_G() -return ExpLib \ No newline at end of file diff --git a/old/modules/DONE/ExpGamingLib/softmod.json b/old/modules/DONE/ExpGamingLib/softmod.json deleted file mode 100644 index 160803be..00000000 --- a/old/modules/DONE/ExpGamingLib/softmod.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "ExpGamingLib", - "version": "4.0.0", - "description": "Adds some common functions used though out all ExpGaming modules", - "location": "FSM_ARCHIVE", - "keywords": [ - "ExpGaming", - "Lib" - ], - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "dependencies": { - "FactorioStdLib.Game": "^0.8.0", - "FactorioStdLib.Color": "^0.8.0", - "FactorioStdLib.Table": "^0.8.0" - }, - "submodules": {} -} diff --git a/old/modules/DONE/FactorioStdLib/Color/control.lua b/old/modules/DONE/FactorioStdLib/Color/control.lua deleted file mode 100644 index e7eeae1f..00000000 --- a/old/modules/DONE/FactorioStdLib/Color/control.lua +++ /dev/null @@ -1,232 +0,0 @@ ---- A defines module for retrieving colors by name. --- Extends the Factorio defines table. --- @module StdLib.Color --- @alias defines.color - --- defines table is automatically required in all mod loading stages. --- luacheck: ignore 122/defines --- Ignore assigning to read only defines table. defines table is not ready only, however --- marking it this way allows warnings to be generated when trying to assign values - -defines = defines or {} --luacheck: ignore defines (This is used for testing locally) - ---- A table of colors allowing retrieval by color name. --- @table defines.color --- @field white {r=1.00,g=1.00,b=1.00} --- @field black {r=0.00,g=0.00,b=0.00} --- @field darkgrey {r=0.25,g=0.25,b=0.25} --- @field grey {r=0.50,g=0.50,b=0.50} --- @field lightgrey {r=0.75,g=0.75,b=0.75} --- @field red {r=1.00,g=0.00,b=0.00} --- @field darkred {r=0.50,g=0.00,b=0.00} --- @field lightred {r=1.00,g=0.50,b=0.50} --- @field green {r=0.00,g=1.00,b=0.00} --- @field darkgreen {r=0.00,g=0.50,b=0.00} --- @field lightgreen {r=0.50,g=1.00,b=0.50} --- @field blue {r=0.00,g=0.00,b=1.00} --- @field darkblue {r=0.00,g=0.00,b=0.50} --- @field lightblue {r=0.50,g=0.50,b=1.00} --- @field orange {r=1.00,g=0.55,b=0.10} --- @field yellow {r=1.00,g=1.00,b=0.00} --- @field pink {r=1.00,g=0.00,b=1.00} --- @field purple {r=0.60,g=0.10,b=0.60} --- @field brown {r=0.60,g=0.40,b=0.10} -defines.color = { - white={r=1.00,g=1.00,b=1.00}, - black={r=0.00,g=0.00,b=0.00}, - darkgrey={r=0.25,g=0.25,b=0.25}, - grey={r=0.50,g=0.50,b=0.50}, - lightgrey={r=0.75,g=0.75,b=0.75}, - red={r=1.00,g=0.00,b=0.00}, - darkred={r=0.50,g=0.00,b=0.00}, - lightred={r=1.00,g=0.50,b=0.50}, - green={r=0.00,g=1.00,b=0.00}, - darkgreen={r=0.00,g=0.50,b=0.00}, - lightgreen={r=0.50,g=1.00,b=0.50}, - blue={r=0.00,g=0.00,b=1.00}, - darkblue={r=0.00,g=0.00,b=0.50}, - lightblue={r=0.50,g=0.50,b=1.00}, - orange={r=1.00,g=0.55,b=0.10}, - yellow={r=1.00,g=1.00,b=0.00}, - pink={r=1.00,g=0.00,b=1.00}, - purple={r=0.60,g=0.10,b=0.60}, - brown={r=0.60,g=0.40,b=0.10} -} -local colors = defines.color - ---- Returns white for dark colors or black for lighter colors. --- @table defines.anticolor -defines.anticolor = { - green = colors.black, -- defines.color.black - grey = colors.black, -- defines.color.black - lightblue = colors.black, -- defines.color.black - lightgreen = colors.black, -- defines.color.black - lightgrey = colors.black, -- defines.color.black - lightred = colors.black, -- defines.color.black - orange = colors.black, -- defines.color.black - white = colors.black, -- defines.color.black - yellow = colors.black, -- defines.color.black - black = colors.white, -- defines.color.white - blue = colors.white, -- defines.color.white - brown = colors.white, -- defines.color.white - darkblue = colors.white, -- defines.color.white - darkgreen = colors.white, -- defines.color.white - darkgrey = colors.white, -- defines.color.white - darkred = colors.white, -- defines.color.white - pink = colors.white, -- defines.color.white - purple = colors.white, -- defines.color.white - red = colors.white -- defines.color.white -} - ---- Returns a lighter color of a named color --- @table defines.lightcolor -defines.lightcolor = { - white = colors.lightgrey, -- defines.color.lightgrey - grey = colors.darkgrey, -- defines.color.darkgrey - lightgrey = colors.grey, -- defines.color.grey - red = colors.lightred, -- defines.color.lightred - green = colors.lightgreen, -- defines.color.lightgreen - blue = colors.lightblue, -- defines.color.lightblue - yellow = colors.orange, -- defines.color.orange - pink = colors.purple -- defines.color.purple -} - --- added by cooldude260 - ---- Returns a lighter color of a named color. --- @table defines.textcolor --- @field info {r=0.21,g=0.95,b=1.00} --- @field bg {r=0.00,g=0.00,b=0.00} --- @field low {r=0.18,g=0.77,b=0.18} --- @field med {r=1.00,g=0.89,b=0.26} --- @field high {r=1.00,g=0.33,b=0.00} --- @field crit {r=1.00,g=0.00,b=0.00} -defines.textcolor = { - info={r=0.21,g=0.95,b=1.00}, - bg={r=0.00,g=0.00,b=0.00}, - low={r=0.18,g=0.77,b=0.18}, - med={r=1.00,g=0.89,b=0.26}, - high={r=1.00,g=0.33,b=0.00}, - crit={r=1.00,g=0.00,b=0.00} -} - --- metatable remade by cooldude -local _mt = { - __index=function(tbl,key) - return rawget(tbl,tostring(key):lower()) or rawget(defines.color,'white') - end, - __pairs=function(tbl) - return function() - local v - k, v = next(tbl, k) - return k, (v and {r = v['r'], g = v['g'], b = v['b'], a = v['a']}) or nil - end, tbl, nil - end, - __eq=function(tbl1,tbl2) - return tbl1.r == tbl2.r and tbl1.g == tbl2.g and tbl1.b == tbl2.b and tbl1.a == tbl2.a - end -} - -setmetatable(defines.color, _mt) -setmetatable(defines.anticolor, _mt) -setmetatable(defines.textcolor, _mt) -setmetatable(defines.lightcolor, _mt) - -local Color = {} --luacheck: allow defined top - ---- Set a value for the alpha channel in the given color table. --- `color.a` represents the alpha channel in the given color table. ---
      ---
    • If ***alpha*** is given, set `color.a` to it. ---
    • If ***alpha*** is not given, and if the given color table does not have a value for `color.a`, set `color.a` to 1. ---
    • If ***alpha*** is not given, and if the given color table already has a value for `color.a`, then leave `color.a` alone. ---
    --- @tparam[opt=white] defines.color|Concepts.Color color the color to configure --- @tparam[opt=1] float alpha the alpha value (*[0 - 1]*) to set for the given color --- @treturn a color table that has the specified value for the alpha channel -function Color.set(color, alpha) - color = color or defines.color.white - Color.to_table(color) - color.a = alpha or color.a or 1 - return color -end - ---- Converts a color in the array format to a color in the table format. --- @tparam table c_arr the color to convert --- @treturn a converted color — { r = c\_arr[1], g = c\_arr[2], b = c\_arr[3], a = c\_arr[4] } -function Color.to_table(c_arr) - if #c_arr > 0 then - return {r = c_arr[1], g = c_arr[2], b = c_arr[3], a = c_arr[4]} - end - return c_arr -end - ---- Converts a color in the rgb format to a color table --- @tparam[opt=0] int r 0-255 red --- @tparam[opt=0] int g 0-255 green --- @tparam[opt=0] int b 0-255 blue --- @tparam[opt=255] int a 0-255 alpha --- @treturn Concepts.Color -function Color.from_rgb(r, g, b, a) - r = r or 0 - g = g or 0 - b = b or 0 - a = a or 255 - return {r = r/255, g = g/255, b = b/255, a = a/255} -end - ---- Get a color table with a hexadecimal string. --- Optionally provide the value for the alpha channel. --- @tparam string string hex hexadecimal color (#ffffff, not #fff) --- @tparam[opt=1] float alpha the alpha value to set; such that ***[ 0 ⋜ value ⋜ 1 ]*** --- @treturn a color table with RGB converted from Hex and with alpha -function Color.from_hex(hex, alpha) - if not _G.Game then error('StdLib/Game not loaded') end - _G.Game.fail_if_missing(hex, "missing color hex value") - if hex:find("#") then hex = hex:sub(2) end - if not(#hex == 6) then error("invalid color hex value: "..hex) end - local number = tonumber(hex, 16) - return { - r = bit32.extract(number, 16, 8) / 255, - g = bit32.extract(number, 8, 8) / 255, - b = bit32.extract(number, 0, 8) / 255, - a = alpha or 1 - } -end - ---added by cooldude2606 - ---- Converts a color in the color table format to rgb --- @tparam table color the color to convert --- @treturn table the color as rgb -function Color.to_rgb(color) - local r = color.r or 0 - local g = color.g or 0 - local b = color.b or 0 - local a = color.a or 0.5 - return {r = r*255, g = g*255, b = b*255, a = a*255} -end - ---added by cooldude2606 - ---- Converts a color in the color table format to hex --- @tparam table color the color to convert --- @treturn string the color as hex -function Color.to_hex(color) - local hexadecimal = '0x' - for key, value in pairs{math.floor(color.r*255),math.floor(color.g*255),math.floor(color.b*255)} do - local hex = '' - while(value > 0)do - local index = math.fmod(value, 16) + 1 - value = math.floor(value / 16) - hex = string.sub('0123456789ABCDEF', index, index) .. hex - end - if string.len(hex) == 0 then hex = '00' - elseif string.len(hex) == 1 then hex = '0' .. hex - end - hexadecimal = hexadecimal .. hex - end - return hexadecimal -end - -return Color diff --git a/old/modules/DONE/FactorioStdLib/Color/softmod.json b/old/modules/DONE/FactorioStdLib/Color/softmod.json deleted file mode 100644 index c95f14bc..00000000 --- a/old/modules/DONE/FactorioStdLib/Color/softmod.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "FactorioStdLib.Color", - "version": "0.8.0", - "description": "A defines module for retrieving colors by name.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Standard Library", - "Lib", - "StdLib", - "Color", - "Extends" - ], - "dependencies": {}, - "collection": "FactorioStdLib@0.8.0", - "submodules": {} -} diff --git a/old/modules/DONE/FactorioStdLib/Game/control.lua b/old/modules/DONE/FactorioStdLib/Game/control.lua deleted file mode 100644 index 1c783c38..00000000 --- a/old/modules/DONE/FactorioStdLib/Game/control.lua +++ /dev/null @@ -1,110 +0,0 @@ ---- The game module. --- @module StdLib.Game - -local Game = { --luacheck: allow defined top - VALID_FILTER = function(v) - return v and v.valid - end, - _protect = function(moduleName) - return { - __newindex = function() error("Attempt to mutatate read-only "..moduleName.." Module") end, - __metatable = true - } - end, - _concat = function(lhs, rhs) - --Sanatize to remove address - return tostring(lhs):gsub("(%w+)%: %x+", "%1: (ADDR)") .. tostring(rhs):gsub("(%w+)%: %x+", "%1: (ADDR)") - end, - _rawstring = function (t) - local m = getmetatable(t) - local f = m.__tostring - m.__tostring = nil - local s = tostring(t) - m.__tostring = f - return s - end -} - --- No Doc --- This is a helper global and functions until .16 --- to set the name of your mod in control.lua set _stdlib_mod_name = 'name of your mod' --- luacheck: ignore _stdlib_mod_name -function Game.get_mod_name() - local ok, mod_name = pcall(function() return script.mod_name end) - return ok and mod_name or _stdlib_mod_name or "stdlib" -end - ---- Print msg if specified var evaluates to false. --- @tparam Mixed var variable to evaluate --- @tparam[opt="missing string value"] msg message -function Game.fail_if_missing(var, msg) - if not var then - error(msg or "Missing value", 3) - end - return false -end - ---- Return a valid player object from event, index, string, or userdata --- @tparam string|number|LuaPlayer|event mixed --- @treturn LuaPlayer a valid player or nil -function Game.get_player(mixed) - if type(mixed) == "table" then - if mixed.__self then - return mixed and mixed.valid and mixed - elseif mixed.player_index then - local player = game.players[mixed.player_index] - return player and player.valid and player - end - elseif mixed then - local player = game.players[mixed] - if type(mixed) == "string" and tonumber(mixed) then - for _, p in pairs(game.players) do - if p.name == mixed then - player = p - break - end - end - end - return player and player.valid and player - end -end - ---- Return a valid force object from event, string, or userdata --- @tparam string|LuaForce|event mixed --- @treturn LuaForce a valid force or nil -function Game.get_force(mixed) - if type(mixed) == "table" then - if mixed.__self then - return mixed and mixed.valid and mixed - elseif mixed.force then - return Game.get_force(mixed.force) - end - elseif type(mixed) == "string" then - local force = game.forces[mixed] - return (force and force.valid) and force - end -end - ---- Messages all players currently connected to the game. ---> Offline players are not counted as having received the message. --- If no players exist msg is stored in the `global._print_queue` table. --- @tparam string msg the message to send to players --- @tparam[opt] ?|nil|boolean condition the condition to be true for a player to be messaged --- @treturn uint the number of players who received the message. -function Game.print_all(msg, condition) - local num = 0 - if #game.players > 0 then - for _, player in pairs(game.players) do - if condition == nil or select(2, pcall(condition, player)) then - player.print(msg) - num = num + 1 - end - end - return num - else - global._print_queue = global._print_queue or {} - global._print_queue[#global._print_queue + 1] = msg - end -end - -return Game diff --git a/old/modules/DONE/FactorioStdLib/Game/softmod.json b/old/modules/DONE/FactorioStdLib/Game/softmod.json deleted file mode 100644 index 76b50163..00000000 --- a/old/modules/DONE/FactorioStdLib/Game/softmod.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "FactorioStdLib.Game", - "version": "0.8.0", - "description": "The game module.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Standard Library", - "Lib", - "StdLib", - "Game", - "Extends" - ], - "dependencies": {}, - "collection": "FactorioStdLib@0.8.0", - "submodules": {} -} diff --git a/old/modules/DONE/FactorioStdLib/String/control.lua b/old/modules/DONE/FactorioStdLib/String/control.lua deleted file mode 100644 index 48ccea0b..00000000 --- a/old/modules/DONE/FactorioStdLib/String/control.lua +++ /dev/null @@ -1,86 +0,0 @@ ---- Extends Lua 5.2 string. --- @module StdLib.String --- @alias string - --- luacheck: globals string (Allow mutating string) - ---- Returns a copy of the string with any leading or trailing whitespace from the string removed. --- @tparam string string s the to remove leading or trailing whitespace from --- @treturn string a copy of the string without leading or trailing whitespace -function string.trim(s) - return (s:gsub("^%s*(.-)%s*$", "%1")) -end - ---- Tests if a string starts with a given substring. --- @tparam string string s the to check for the start substring --- @tparam string start the substring to test for --- @treturn boolean true if the start substring was found in the string -function string.starts_with(s, start) - return string.find(s, start, 1, true) == 1 -end - ---- Tests if a string ends with a given substring. --- @tparam string string s the to check for the end substring --- @tparam string ends the substring to test for --- @treturn boolean true if the end substring was found in the string -function string.ends_with(s, ends) - return #s >= #ends and string.find(s, ends, #s - #ends + 1, true) and true or false -end - ---- Tests if a string contains a given substring. --- @tparam string string s the to check for the substring --- @tparam string contains the substring to test for --- @treturn boolean true if the substring was found in the string -function string.contains(s, contains) - return s and string.find(s, contains) ~= nil -end - ---- Tests whether a string is empty. --- @tparam string string s the to test --- @treturn boolean true if the string is empty -function string.is_empty(s) - return s == nil or s == '' -end - ---- Splits a string into an array. --- *Note:* Empty split substrings are not included in the resulting table. ---

    For example, `string.split("foo.bar...", ".", false)` results in the table `{"foo", "bar"}`. --- @tparam string string s the to split --- @tparam[opt="."] string sep the separator to use. --- @tparam[opt=false] string boolean pattern whether to interpret the separator as a lua pattern or plaintext for the split --- @treturn {string,...} an array of strings -function string.split(s, sep, pattern) - sep = sep or "." - sep = sep ~= "" and sep or "." - sep = not pattern and string.gsub(sep, "([^%w])", "%%%1") or sep - - local fields = {} - local start_idx, end_idx = string.find(s, sep) - local last_find = 1 - while start_idx do - local substr = string.sub(s, last_find, start_idx - 1) - if string.len(substr) > 0 then - table.insert(fields, string.sub(s, last_find, start_idx - 1)) - end - last_find = end_idx + 1 - start_idx, end_idx = string.find(s, sep, end_idx + 1) - end - local substr = string.sub(s, last_find) - if string.len(substr) > 0 then - table.insert(fields, string.sub(s, last_find)) - end - return fields -end - --- added by cooldude2606 ---- Returns a string as a hex format (also a string) --- @usage a = 'foo' --- string.to_hex(a) -- return '666f6f' --- @tparam string string str the to encode --- @treturn string the hex format of the string -function string.to_hex(str) - if not is_type(str,'string') then return '' end - return str:gsub('.',function (c) - return string.format('%02X',string.byte(c)) - end) -end \ No newline at end of file diff --git a/old/modules/DONE/FactorioStdLib/String/softmod.json b/old/modules/DONE/FactorioStdLib/String/softmod.json deleted file mode 100644 index 3ef2d9a6..00000000 --- a/old/modules/DONE/FactorioStdLib/String/softmod.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "FactorioStdLib.String", - "version": "0.8.0", - "description": "Extends Lua 5.2 string.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Standard Library", - "Lib", - "StdLib", - "String", - "Extends" - ], - "dependencies": {}, - "collection": "FactorioStdLib@0.8.0", - "submodules": {} -} diff --git a/old/modules/DONE/FactorioStdLib/Table/control.lua b/old/modules/DONE/FactorioStdLib/Table/control.lua deleted file mode 100644 index e9196e1c..00000000 --- a/old/modules/DONE/FactorioStdLib/Table/control.lua +++ /dev/null @@ -1,423 +0,0 @@ ---- Extends Lua 5.2 table. --- @module StdLib.Table --- @alias table - --- luacheck: globals table (Allow mutating global table) - ---- Given a mapping function, creates a transformed copy of the table ---- by calling the function for each element in the table, and using ---- the result as the new value for the key. Passes the index as second argument to the function. ---- @usage a= { 1, 2, 3, 4, 5} ----table.map(a, function(v) return v * 10 end) --produces: { 10, 20, 30, 40, 50 } ---- @usage a = {1, 2, 3, 4, 5} ----table.map(a, function(v, k, x) return v * k + x end, 100) --produces { 101, 104, 109, 116, 125} --- @tparam table table tbl the to be mapped to the transform --- @tparam function function func the to transform values --- @param[opt] ... additional arguments passed to the function --- @treturn table a new table containing the keys and mapped values -function table.map(tbl, func, ...) - local newtbl = {} - for i, v in pairs(tbl) do - newtbl[i] = func(v, i, ...) - end - return newtbl -end - ---- Given a filter function, creates a filtered copy of the table ---- by calling the function for each element in the table, and ---- filtering out any key-value pairs for non-true results. Passes the index as second argument to the function. ---- @usage a= { 1, 2, 3, 4, 5} ----table.filter(a, function(v) return v % 2 == 0 end) --produces: { 2, 4 } ---- @usage a = {1, 2, 3, 4, 5} ----table.filter(a, function(v, k, x) return k % 2 == 1 end) --produces: { 1, 3, 5 } --- @tparam table table tbl the to be filtered --- @tparam function function func the to filter values --- @param[opt] ... additional arguments passed to the function --- @treturn table a new table containing the filtered key-value pairs -function table.filter(tbl, func, ...) - local newtbl = {} - local insert = #tbl > 0 - for k, v in pairs(tbl) do - if func(v, k, ...) then - if insert then table.insert(newtbl, v) - else newtbl[k] = v end - end - end - return newtbl -end - ---- Given a candidate search function, iterates over the table, calling the function ---- for each element in the table, and returns the first element the search function returned true. ---- Passes the index as second argument to the function. ---- @usage a= { 1, 2, 3, 4, 5} ----table.find(a, function(v) return v % 2 == 0 end) --produces: 2 ---- @usage a = {1, 2, 3, 4, 5} ----table.find(a, function(v, k, x) return k % 2 == 1 end) --produces: 1 --- @tparam table table tbl the to be searched --- @tparam function any func the function to use to search for matching element --- @param[opt] ... additional arguments passed to the function --- @treturn ?|nil|Mixed the first found value, or nil if none was found -function table.find(tbl, func, ...) - for k, v in pairs(tbl) do - if func(v, k, ...) then - return v, k - end - end - return nil -end - ---- Finds the first index at which the value appears in the table --- @usage table.index({'foo','bar','baz'},'bar') -- retuns 2,'bar' --- @tparam table table tbl the to search though --- @param value the value you want the index of --- @treturn number the index that the value apeears at --- @return the value in that possition -function table.index(tbl, value) - for k, v in pairs(tbl) do - if v == value then - return k, v - end - end - return nil -end - ---- Returns a boolean on weather the table includes the value or not --- @usage table.includes({'foo','bar','baz'},'bar') -- retuns true --- @tparam table table tbl the to search though --- @param value the value you want the index of --- @treturn boolean if the table includes the value -function table.includes(tbl, value) - for k, v in pairs(tbl) do - if v == value then - return true - end - end - return false -end - ---- Given a candidate search function, iterates over the table, calling the function --- for each element in the table, and returns true if search function returned true. --- Passes the index as second argument to the function. --- @usage a= { 1, 2, 3, 4, 5} table.any(a, function(v) return v % 2 == 0 end) --produces: true --- @usage a = {1, 2, 3, 4, 5} table.any(a, function(v, k, x) return k % 2 == 1 end) --produces: true --- @tparam table table tbl the to be searched --- @tparam function any func the function to use to search for matching element --- @param[opt] ... additional arguments passed to the function --- @treturn boolean true if an element was found, false if none was found -function table.any(tbl, func, ...) - return table.find(tbl, func, ...) ~= nil -end - ---- Given a function, apply it to each element in the table. --- Passes the index as the second argument to the function. ---

    Iteration is aborted if the applied function returns true for any element during iteration. --- @usage --- a = {10, 20, 30, 40} --- table.each(a, function(v) game.print(v) end) --prints 10, 20, 30, 40, 50 --- @tparam table table tbl the to be iterated --- @tparam function function func the to apply to elements --- @param[opt] ... additional arguments passed to the function --- @treturn table the table where the given function has been applied to its elements -function table.each(tbl, func, ...) - for k, v in pairs(tbl) do - if func(v, k, ...) then - break - end - end - return tbl -end - ---- Returns a new array that is a one-dimensional recursive flattening of the given array. --- For every element that is an array, extract its elements into the new array. ---

    The optional level argument determines the level of recursion to flatten. ---> This function flattens an integer-indexed array, but not an associative array. --- @tparam array tbl the array to be flattened --- @tparam[opt] uint level recursive levels, or no limit to recursion if not supplied --- @treturn array a new array that represents the flattened contents of the given array -function table.flatten(tbl, level) - local flattened = {} - table.each(tbl, - function(value) - if type(value) == "table" and #value > 0 then - if level then - if level > 0 then - table.merge(flattened, table.flatten(value, level - 1), true) - else - table.insert(flattened, value) - end - else - table.merge(flattened, table.flatten(value), true) - end - else - table.insert(flattened, value) - end - end - ) - return flattened -end - ---- Given an array, returns the first element or nil if no element exists. --- @tparam array tbl the array --- @treturn ?|nil|Mixed the first element -function table.first(tbl) - return tbl[1] -end - ---- Given an array, returns the last element or nil if no elements exist. --- @tparam array tbl the array --- @treturn ?|nil|Mixed the last element or nil -function table.last(tbl) - local size = #tbl - if size == 0 then return nil end - return tbl[size] -end - ---- Given an array of only numeric values, returns the minimum or nil if no element exists. --- @tparam {number,...} tbl the array with only numeric values --- @treturn ?|nil|number the minimum value -function table.min(tbl) - if #tbl == 0 then return nil end - - local min = tbl[1] - for _, num in pairs(tbl) do - min = num < min and num or min - end - return min -end - ----Given an array of only numeric values, returns the maximum or nil if no element exists. --- @tparam {number,...} tbl the array with only numeric values --- @treturn ?|nil|number the maximum value -function table.max(tbl) - if #tbl == 0 then return nil end - - local max = tbl[1] - for _, num in pairs(tbl) do - max = num > max and num or max - end - return max -end - ---- Given an array of only numeric values, return the sum of all values, or 0 for empty arrays. --- @tparam {number,...} tbl the array with only numeric values --- @treturn number the sum of the numbers or zero if the given array was empty -function table.sum(tbl) - local sum = 0 - for _, num in pairs(tbl) do - sum = sum + num - end - return sum -end - ---- Given an array of only numeric values, returns the average or nil if no element exists. --- @tparam {number,...} tbl the array with only numeric values --- @treturn ?|nil|number the average value -function table.avg(tbl) - local cnt = #tbl - return cnt ~= 0 and table.sum(tbl) / cnt or nil -end - ---- Merges two tables — values from first get overwritten by the second. ---- @usage --- function some_func(x, y, args) --- args = table.merge({option1=false}, args) --- if opts.option1 == true then return x else return y end --- end --- some_func(1,2) -- returns 2 --- some_func(1,2,{option1=true}) -- returns 1 --- @tparam table tblA first table --- @tparam table tblB second table --- @tparam[opt=false] boolean array_merge set to true to merge the tables as an array or false for an associative array --- @treturn array|table an array or an associated array where tblA and tblB have been merged -function table.merge(tblA, tblB, array_merge) - if not tblB then - return tblA - end - if array_merge then - for _, v in pairs(tblB) do - table.insert(tblA, v) - end - - else - for k, v in pairs(tblB) do - tblA[k] = v - end - end - return tblA -end - --- copied from factorio/data/core/luablib/util.lua - ---- Creates a deep copy of table without copying Factorio objects. --- @usage local copy = table.deepcopy[data.raw.["stone-furnace"]["stone-furnace"]] -- returns a copy of the stone furnace entity --- @tparam table table object the to copy --- @treturn table a copy of the table -function table.deepcopy(object) - local lookup_table = {} - local function _copy(this_object) - if type(this_object) ~= "table" then - return this_object - elseif this_object.__self then - return this_object - elseif lookup_table[this_object] then - return lookup_table[this_object] - end - local new_table = {} - lookup_table[this_object] = new_table - for index, value in pairs(this_object) do - new_table[_copy(index)] = _copy(value) - end - return setmetatable(new_table, getmetatable(this_object)) - end - return _copy(object) -end - ---- Default table comparator sort function. --- @local --- @param x one comparator operand --- @param y the other comparator operand --- @return true if x logically comes before y in a list, false otherwise -local function sortFunc(x, y) --sorts tables with mixed index types. - local tx = type(x) - local ty = type(y) - if tx == ty then - if type(x) == 'string' then - return string.lower(x) < string.lower(y) - else - return x < y - end - elseif tx == 'number' then - return true --only x is a number and goes first - else - return false --only y is a number and goes first - end -end - ---- Returns a copy of all of the values in the table. --- @tparam table table tbl the to copy the keys from, or an empty table if tbl is nil --- @tparam[opt] boolean sorted whether to sort the keys (slower) or keep the random order from pairs() --- @tparam[opt] boolean as_string whether to try and parse the values as strings, or leave them as their existing type --- @treturn array an array with a copy of all the values in the table -function table.values(tbl, sorted, as_string) - if not tbl then return {} end - local valueset = {} - local n = 0 - if as_string then --checking as_string /before/ looping is faster - for _, v in pairs(tbl) do - n = n + 1 - valueset[n] = tostring(v) - end - else - for _, v in pairs(tbl) do - n = n + 1 - valueset[n] = v - end - end - if sorted then - table.sort(valueset,sortFunc) - end - return valueset -end - ---- Returns a copy of all of the keys in the table. --- @tparam table table tbl the to copy the keys from, or an empty table if tbl is nil --- @tparam[opt] boolean sorted whether to sort the keys (slower) or keep the random order from pairs() --- @tparam[opt] boolean as_string whether to try and parse the keys as strings, or leave them as their existing type --- @treturn array an array with a copy of all the keys in the table -function table.keys(tbl, sorted, as_string) - if not tbl then return {} end - local keyset = {} - local n = 0 - if as_string then --checking as_string /before/ looping is faster - for k, _ in pairs(tbl) do - n = n + 1 - keyset[n] = tostring(k) - end - else - for k, _ in pairs(tbl) do - n = n + 1 - keyset[n] = k - end - end - if sorted then - table.sort(keyset,sortFunc) - end - return keyset -end - ---- Removes keys from a table by setting the values associated with the keys to nil. --- @usage local a = {1, 2, 3, 4} ---table.remove_keys(a, {1,3}) --returns {nil, 2, nil, 4} --- @usage local b = {k1 = 1, k2 = 'foo', old_key = 'bar'} ---table.remove_keys(b, {'old_key'}) --returns {k1 = 1, k2 = 'foo'} --- @tparam table table tbl the to remove the keys from --- @tparam {Mixed,...} keys an array of keys that exist in the given table --- @treturn table tbl without the specified keys -function table.remove_keys(tbl, keys) - for i = 1, #keys do - tbl[keys[i]] = nil - end - return tbl -end - ---- Returns the number of keys in a table, if func is passed only count keys when the function is true. --- @tparam table tbl to count keys --- @tparam[opt] function func to incremement counter --- @param[optchain] ... additional arguments passed to the function --- @treturn number The number of keys matching the function or the number of all keys if func isn't passed --- @treturn number The total number of keys --- @usage local a = { 1, 2, 3, 4, 5} --- table.count_keys(a) -- produces: 5, 5 --- @usage local a = {1, 2, 3, 4, 5} --- table.count_keys(a, function(v, k) return k % 2 == 1 end) -- produces: 3, 5 -function table.count_keys(tbl, func, ...) - if type(tbl) ~= 'table' then return 0, 0 end - local count, total = 0, 0 - for k, v in pairs(tbl) do - total = total + 1 - if func then - if func(v, k, ...) then - count = count + 1 - end - else - count = count + 1 - end - end - return count, total -end - ---- Returns an inverted (***{[value] = key,...}***) copy of the given table. If the values are not unique, the assigned key depends on the order of pairs(). --- @usage local a = {k1 = 'foo', k2 = 'bar'} ---table.invert(a) --returns {'foo' = k1, 'bar' = k2} --- @usage local b = {k1 = 'foo', k2 = 'bar', k3 = 'bar'} ---table.invert(b) --returns {'foo' = k1, 'bar' = ?} --- @tparam table table tbl the to invert --- @treturn table a new table with inverted mapping -function table.invert(tbl) - local inverted = {} - for k, v in pairs(tbl) do - inverted[v] = k - end - return inverted -end - ---- Return the size of a table using built in table_size function --- @function size --- @tparam table table to use --- @treturn int size of the table -table.size = table_size - ---- For all string or number values in an array map them to a key = true table --- @usage local a = {"v1", "v2"} --- table.array_to_dict_bool(a) -- return {["v1"] = true, ["v2"]= true} --- @tparam table table tbl the to convert --- @treturn table the converted table -function table.arr_to_bool(tbl) - local newtbl = {} - for _, v in pairs(tbl) do - if type(v) == "string" or type(v) == "number" then - newtbl[v] = true - end - end - return newtbl -end \ No newline at end of file diff --git a/old/modules/DONE/FactorioStdLib/Table/softmod.json b/old/modules/DONE/FactorioStdLib/Table/softmod.json deleted file mode 100644 index e915763c..00000000 --- a/old/modules/DONE/FactorioStdLib/Table/softmod.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "FactorioStdLib.Table", - "version": "0.8.0", - "description": "Extends Lua 5.2 table.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Standard Library", - "Lib", - "StdLib", - "Table", - "Extends" - ], - "dependencies": {}, - "collection": "FactorioStdLib@0.8.0", - "submodules": {} -} diff --git a/old/modules/DONE/FactorioStdLib/softmod.json b/old/modules/DONE/FactorioStdLib/softmod.json deleted file mode 100644 index 7cc751b9..00000000 --- a/old/modules/DONE/FactorioStdLib/softmod.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "FactorioStdLib", - "version": "0.8.0", - "description": "Factorio Standard Library Projects", - "location": "FSM_ARCHIVE", - "keywords": [ - "Standard Library", - "Lib", - "StdLib" - ], - "author": "Afforess", - "contact": "https://github.com/Afforess/Factorio-Stdlib/issues", - "license": "https://github.com/Afforess/Factorio-Stdlib/blob/master/LICENSE", - "submodules": { - "FactorioStdLib.Color": "0.8.0", - "FactorioStdLib.Game": "0.8.0", - "FactorioStdLib.String": "0.8.0", - "FactorioStdLib.Table": "0.8.0" - }, - "dependencies": {} -} diff --git a/old/modules/DONE/Guis/ExpGamingAdmin/Gui/control.lua b/old/modules/DONE/Guis/ExpGamingAdmin/Gui/control.lua deleted file mode 100644 index 7dd8c2e7..00000000 --- a/old/modules/DONE/Guis/ExpGamingAdmin/Gui/control.lua +++ /dev/null @@ -1,202 +0,0 @@ ---- Adds a gui that can be used to access all the admin commands. --- @module ExpGamingAdmin.Gui@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias AdminGui - --- Module Require -local Admin = require('ExpGamingAdmin') -local Gui = require('ExpGamingCore.Gui') -local Role = require('ExpGamingCore.Role') -local Game = require('FactorioStdLib.Game') -local playerInfo -- ExpGamingPlayer.playerInfo@^4.0.0 - --- Module Define -local module_verbose = false -local AdminGui = { - on_init=function() - if loaded_modules['ExpGamingPlayer.playerInfo'] then playerInfo = require('ExpGamingPlayer.playerInfo') - else playerInfo = function(player,frame) - frame.add{ - type='label', - caption={'ExpGamingAdmin.no-info-file'} - } - end end - --code - end, - buttons={} -} - -function Admin.open(player,pre_select_player,pre_select_action) - Gui.center.clear(player) - Admin.center(player,pre_select_player,pre_select_action) -end - --- Function Define -function AdminGui.add_button(name,caption,tooltip,callback) - AdminGui.buttons[name] = Gui.inputs.add{ - type='button', - name='admin-gui-'..name, - caption=caption, - tooltip=tooltip - }:on_event('click',function(event) - local parent = event.element.parent - local pre_select_player = parent.player and parent.player.caption or nil - callback(pre_select_player,event.player_index) - end) -end - -function AdminGui.draw(frame,filter_buttons) - local frame = frame.add{ - type='flow', - name='admin' - } - frame.add{ - type='label', - caption='', - name='player' - }.style.visible = false - local function format(btn) - btn.style.height = 30 - btn.style.width = 30 - end - for name,button in pairs(AdminGui.buttons) do - if not filter_buttons or filter_buttons[name] then format(button(frame)) end - end - return frame.player -end - --- Gui Define -local function get_players(_player,root_frame,state) - local players = {'Select Player'} - local _players = state and game.players or game.connected_players - for _,player in pairs(_players) do - if player.name ~= _player.name then - if not Admin.is_banned or not Admin.is_banned(player) then - table.insert(players,player.name) - end - end - end - return players -end - -local online_check = Gui.inputs.add_checkbox('online-check-admin-commands',false,'Show Offline',false,function(player,element) - element.parent['player-drop-down-admin-commands'].items = get_players(player,element.parent,true) - element.parent['player-drop-down-admin-commands'].selected_index = 1 -end,function(player,element) - element.parent['player-drop-down-admin-commands'].items = get_players(player,element.parent,false) - element.parent['player-drop-down-admin-commands'].selected_index = 1 -end) - -local player_drop_down = Gui.inputs.add_drop_down('player-drop-down-admin-commands',get_players,1,function(player,selected,items,element) - element.parent.parent.player.caption = selected - local player_info_flow = element.parent.parent.info_flow - player_info_flow.clear() - if selected == 'Select Player' then return - else playerInfo(selected,player_info_flow,true) end - local role = Role.get_highest(player) - local _role = Role.get_highest(selected) - if role.index >= _role.index then element.parent.warning.caption = {'ExpGamingAdmin.warning'} - else element.parent.warning.caption = '' end -end) - -local reason_input = Gui.inputs.add_text('reason-input-admin-commands',false,'Enter Reason',function(player,text,element) - if string.len(text) < 20 or text == 'Enter Reason' then - element.parent.warning.caption = {'ExpGamingAdmin.short-reason'} - else - element.parent.warning.caption = '' - end -end) - -local action_drop_down = Gui.inputs.add_drop_down('action-drop-down-rank-change',function() return {'Select Action',unpack(Admin.action_names)} end,1,function(player,selected,items,element) - element.parent.parent.action.caption = selected - if selected == 'Jail' or selected == 'Kick' or selected == 'Ban' or selected == 'Temp Ban' then - element.parent['reason-input-admin-commands'].style.visible = true - else - element.parent['reason-input-admin-commands'].style.visible = false - end -end) - -local take_action = Gui.inputs{ - type='button', - name='admin-commands-take', - caption={'ExpGamingAdmin.take-action'} -}:on_event('click',function(event) - local dropdowns = event.element.parent - local role = Role.get_highest(event.player_index) - local _action= dropdowns.parent.action.caption ~= 'Select Action' and dropdowns.parent.action.caption or nil - local _player = Game.get_player(dropdowns.parent.player.caption) - if not _player or not _action then dropdowns.warning.caption = {'ExpGamingAdmin.invalid'} return end - local _role = Role.get_highest(_player) - if role.index >= _role.index then dropdowns.warning.caption = {'ExpGamingAdmin.rank-high'} return end - local _reason = dropdowns['reason-input-admin-commands'] and dropdowns['reason-input-admin-commands'].text - if (_action == 'Jail' or _action == 'Kick' or _action == 'Ban' or _action == 'Temp Ban') and (_reason == 'Enter Reason' or string.len(_reason) < 10) then return end - Admin.take_action(_action,_player,event.player_index,_reason) - Gui.center.clear(event) -end) - -Admin.center = Gui.center{ - name='admin-commands', - caption='utility/danger_icon', - tooltip={'ExpGamingAdmin.tooltip'}, - draw=function(self,frame,pre_select_player,pre_select_action) - frame.caption={'ExpGamingAdmin.name'} - frame = frame.add{ - type='flow', - direction='horizontal' - } - local dropdowns = frame.add{ - type='flow', - direction='vertical' - } - local player_info_flow = frame.add{ - name='info_flow', - type='flow', - direction='vertical' - } - player_info_flow.style.height = 280 - player_info_flow.style.width = 200 - local label = dropdowns.add{ - type='label', - caption={'ExpGamingAdmin.message'} - } - label.style.single_line = false - label.style.width = 200 - online_check:draw(dropdowns) - local _drop = player_drop_down:draw(dropdowns) - if pre_select_player then Gui.set_dropdown_index(_drop,pre_select_player.name) end - _drop = action_drop_down:draw(dropdowns) - Gui.set_dropdown_index(_drop,pre_select_action) - local _text = reason_input:draw(dropdowns) - if pre_select_action == 'Jail' or pre_select_action == 'Kick' or pre_select_action == 'Ban' then - _text.style.visible = true else _text.style.visible = false - end - if pre_select_player then playerInfo(pre_select_player,player_info_flow,true) end - _text.style.width = 200 - label = dropdowns.add{ - name='warning', - type='label', - caption='', - style='bold_red_label' - } - label.style.single_line = false - label.style.width = 200 - take_action:draw(dropdowns) - local caption = pre_select_player and pre_select_player.name or '' - frame.add{ - name='player', - type='label', - caption=caption - }.style.visible = false - caption = pre_select_action or '' - frame.add{ - name='action', - type='label', - caption=caption - }.style.visible = false - end -} - --- Module Return --- calling will draw the admin buttons to that frame -return setmetatable(AdminGui,{__call=function(self,...) return self.draw(...) end}) \ No newline at end of file diff --git a/old/modules/DONE/Guis/ExpGamingAdmin/Gui/softmod.json b/old/modules/DONE/Guis/ExpGamingAdmin/Gui/softmod.json deleted file mode 100644 index 97fc27d7..00000000 --- a/old/modules/DONE/Guis/ExpGamingAdmin/Gui/softmod.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "ExpGamingAdmin.Gui", - "version": "4.0.0", - "description": "Adds a gui that can be used to access all the admin commands.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Admin", - "ExpGaming", - "Commands", - "Gui" - ], - "dependencies": { - "ExpGamingCore.Gui": "^4.0.0", - "ExpGamingCore.Role": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingPlayer": "?^4.0.0", - "ExpGamingPlayer.playerInfo": "?^4.0.0", - "mod-gui": "*", - "ExpGamingAdmin": "^4.0.0" - }, - "collection": "ExpGamingAdmin@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/Guis/ExpGamingAdmin/control.lua b/old/modules/DONE/Guis/ExpGamingAdmin/control.lua deleted file mode 100644 index 9642ee9b..00000000 --- a/old/modules/DONE/Guis/ExpGamingAdmin/control.lua +++ /dev/null @@ -1,103 +0,0 @@ ---- The base functions required to make the others work. --- @module ExpGamingAdmin@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias Admin - --- Module Require -local Game = require('FactorioStdLib.Game') -local Color = require('FactorioStdLib.Color') -local Role -- ExpGamingCore.Role@^4.0.0 -local Sync -- ExpGamingCore.Sync@^4.0.0 -local Server -- ExpGamingCore.Server@^4.0.0 - --- Module Define -local module_verbose = false -local Admin = { - on_init=function() - if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end - if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end - if loaded_modules['ExpGamingCore.Server'] then - Server = require('ExpGamingCore.Server') - Server.add_module_to_interface('Admin','ExpGamingAdmin') - end - end, - actions={}, - action_functions={}, - action_names={} -} - --- Global Define -local global = { - banned = {} -} -Global.register(global,function(tbl) global = tbl end) - --- Function Define -function Admin.valid_players(player,by_player) - player = Game.get_player(player) - by_player = Game.get_player(by_player) or SERVER - return player, by_player -end - -function Admin.create_reason(reason,name) - reason = reason or 'No Reason' - if not string.find(string.lower(reason),string.lower(name)) then reason = reason..' - '..name end - if Sync and Sync.info.date ~= '0000/00/00' and not string.find(string.lower(reason),Sync.info.date) then reason = reason..' - '..Sync.info.date end - if not string.find(string.lower(reason),'appeal') then reason = reason..' - Visit www.explosivegaming.nl to appeal.' end - return reason -end - -function Admin.allowed(player) - player = Game.get_player(player) - if Role then - return Role.allowed(player,'admin-commands') - else return player.admin end -end - -function Admin.set_banned(player,set) - player = Game.get_player(player) - if not player then return false end - global.banned[player.name] = set -end - -function Admin.is_banned(player,detail) - player = Game.get_player(player) - if not player then return false end - local banned = global.banned[player.name] - if banned == true then return true end - if not banned then return false end - if detail then return banned - else return true end -end - -function Admin.add_action(action,callback) - verbose('Added admin action: '..action) - Admin.actions[string.lower(action)] = table.insert(Admin.action_names,action) - Admin.action_functions[string.lower(action)] = callback -end - -function Admin.take_action(action,player,by_player,reason) - if Admin.action_functions[string.lower(action)] then Admin.action_functions[string.lower(action)](player,by_player,reason) end - if Admin[action] then Admin[action](player,by_player,reason) end -end - -function Admin.clear_player(player,by_player) - player, by_player = Admin.valid_players(player,by_player) - if not player then return end - if Server and Admin.is_banned(player,true) == true then Server.interface(game.unban_player,true,player) end - if Admin.clear_warnings then Admin.clear_warnings(player,by_player,true) end - if Admin.clear_reports then Admin.clear_reports(player,by_player,true) end - if Server and Role.has_flag(player,'is_jail') then Server.interface(Role.revert,true,player,by_player,2) end - if Sync then Sync.emit_embedded{ - title='Player Clear', - color=Color.to_hex(defines.textcolor.low), - description='A player had their reports and warnings cleared.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player.name, - } end - Admin.set_banned(player,false) -end - --- Module Return -return Admin \ No newline at end of file diff --git a/old/modules/DONE/Guis/ExpGamingAdmin/locale/de.cfg b/old/modules/DONE/Guis/ExpGamingAdmin/locale/de.cfg deleted file mode 100644 index 299b094f..00000000 --- a/old/modules/DONE/Guis/ExpGamingAdmin/locale/de.cfg +++ /dev/null @@ -1,15 +0,0 @@ -[ExpGamingAdmin] -name=Admin-Befehle -tooltip=Die mächtigsten Befehle sind hier zuhause. -no-info-file=Die Informationsdatei wurde nicht gefunden. -message=Wähle einen Spieler und eine Aktion. Stell vor dem Ausführen sicher, dass der Richtige ist! -warning=Achtung, dieser Spieler hat einen höheren Rang als du selbst, weshalb du seinen Rang nicht ändern kannst. -short-reason=Achtung, dies ist ein sehr kurzer Grund. Bitte versuche, mehr Informationen anzugeben. (Warning: The reason is too short. UPDATE) -rank-high=Dieser Spieler hat einen hohen Rang. Bitte benutze nur Ingame-Befehle gegen diese Person, wenn du dir sicher bist! -invalid=Der Spieler oder die Aktion war ungültig. Bitte versuche es noch einmal! -take-action= Ergreife Maßnahme -tooltip-ban=Banne Spieler -tooltip-kick=Kicke Spieler -tooltip-jail=Sperre Spieler ins Gefängnis -tooltip-go-to=Gehe zum Spieler -tooltip-bring=Bringe den Spieler zu dir \ No newline at end of file diff --git a/old/modules/DONE/Guis/ExpGamingAdmin/locale/en.cfg b/old/modules/DONE/Guis/ExpGamingAdmin/locale/en.cfg deleted file mode 100644 index f240bac1..00000000 --- a/old/modules/DONE/Guis/ExpGamingAdmin/locale/en.cfg +++ /dev/null @@ -1,21 +0,0 @@ -[ExpGamingAdmin] -name=Admin Commands -tooltip=Admin commands make their home here -no-info-file=No info file was found -message=Please select a player and an action to take. Make sure to choose the correct one! -warning=Warning: This player outranks you. Therefore, you cannot edit their rank. -short-reason=Warning: The reason is too short. -rank-high=Warning: This player outranks you. Therefore, you cannot edit their rank. -invalid=The player or the action is invalid. Please try again! -take-action=Take Action -tooltip-ban=Ban Player -tooltip-kick=Kick Player -tooltip-jail=Jail Player -tooltip-go-to=Go To Player -tooltip-bring=Bring Player -temp-ban=__1__ was temporary banned by __2__ and will remain in jail until next reset -report=Report Player -cant-report-ban=Invalid player as player is banned; Either unban or use /clear-all -low-print=__1__ has been reported by a user for: __2__ -high-print=__1__ has been reported by __2__ for: __3__ -cant-report=This player can't be reported. \ No newline at end of file diff --git a/old/modules/DONE/Guis/ExpGamingAdmin/locale/fr.cfg b/old/modules/DONE/Guis/ExpGamingAdmin/locale/fr.cfg deleted file mode 100644 index f882fc1c..00000000 --- a/old/modules/DONE/Guis/ExpGamingAdmin/locale/fr.cfg +++ /dev/null @@ -1,15 +0,0 @@ -[ExpGamingAdmin] -name=Commandes Admin -tooltip=Des commandes très puissantes résident ici. -no-info-file=Aucun fichier info trouvé -message=Veuillez sélectionner un joueur et une action, faites en sorte que ce soit la bonne ! -warning=Attention, ce joueur est de rang supérieur au vôtre, vous ne pouvez le modifier. -short-reason=Attention, la raison indiquée est trop courte. Soyez concis mais aussi précis. (Warning: The reason is too short. UPDATE) -rank-high=Ce joueur est de rang supérieur, veuillez utiliser une commande dont vous maîtriser l'utilisation ! -invalid=Le Joueur ou l'action est invalide, ré-essayez ! -take-action=Agir -tooltip-ban=Bannir un Joueur -tooltip-kick=Exclure un Joueur -tooltip-jail=Emprisonner un Joueur -tooltip-go-to=Aller à la position d'un Joueur -tooltip-bring=Amener le Joueur à soi diff --git a/old/modules/DONE/Guis/ExpGamingAdmin/locale/nl.cfg b/old/modules/DONE/Guis/ExpGamingAdmin/locale/nl.cfg deleted file mode 100644 index ff47947a..00000000 --- a/old/modules/DONE/Guis/ExpGamingAdmin/locale/nl.cfg +++ /dev/null @@ -1,15 +0,0 @@ -[ExpGamingAdmin] -name=Admin Commands -tooltip=Admin Commands kan je hier vinden. -no-info-file=Infobestand niet gevonden. -message=Selecteer een speler en de bijbehorende actie. Wees er zeker van dat je de correcte actie kiest. -warning=Fout: Je kan de rank van deze speler niet aanpassen omdat het jouw rank overtreft. -short-reason=Fout: De reden is te kort. (Warning: The reason is too short. UPDATE) -rank-high=Fout: Deze speler overtreft jouw rank. -invalid=Fout: De speler kan niet gevonden worden en/of de actie is onjuist. Probeer opnieuw! -take-action=Actie ondernemen -tooltip-ban=Ban speler -tooltip-kick=Kick speler -tooltip-jail=Jail speler -tooltip-go-to=Ga naar speler -tooltip-bring=Breng speler diff --git a/old/modules/DONE/Guis/ExpGamingAdmin/locale/sv-SE.cfg b/old/modules/DONE/Guis/ExpGamingAdmin/locale/sv-SE.cfg deleted file mode 100644 index 679188c2..00000000 --- a/old/modules/DONE/Guis/ExpGamingAdmin/locale/sv-SE.cfg +++ /dev/null @@ -1,19 +0,0 @@ -[ExpGamingAdmin] -name=Adminkommandon -tooltip=Adminkommando gör dit hem här -no-info-file=Ingen informationsfil kunde hittas -message=Var snäll och välj en spelare och en åtgärd att utfärda, se till att du väljer den rätta! -warning=Warning: Den här spelaren har högre rang än dig. Därför kan du inte redigera dess rang. -short-reason=Warning: Skälet är för kort. -rank-high=Warning: Den här spelaren har högre rang än dig. Därför kan du inte redigera dess rang. -invalid=Spelaren eller åtgärden är ogiltig. Var vänlig och försök igen! -take-action=Utför åtgärd. -tooltip-ban=Bannlys Spelare -tooltip-kick=Sparka Spelare -tooltip-jail=Fängsla Spelare -tooltip-go-to=Gå till Spelare -tooltip-bring=Hämta spelare -report=Rapportera Spelare -low-print=__1__ har blivit rapporterad av __2__ för: __3__ -high-print=__1__ har blivit rapporterad av __2__ för: __3__ -cant-report=Den här spelaren kan inte bli rapporterad. diff --git a/old/modules/DONE/Guis/ExpGamingAdmin/softmod.json b/old/modules/DONE/Guis/ExpGamingAdmin/softmod.json deleted file mode 100644 index efeae92e..00000000 --- a/old/modules/DONE/Guis/ExpGamingAdmin/softmod.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "ExpGamingAdmin", - "version": "4.0.0", - "description": "A set of useful admin commands and functions that can be used by other modules.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Admin", - "ExpGaming", - "Set", - "Commands", - "Functions", - "Scripts", - "Useful" - ], - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "submodules": { - "ExpGamingAdmin": "4.0.0", - "ExpGamingAdmin.Ban": "4.0.0", - "ExpGamingAdmin.ClearInventory": "4.0.0", - "ExpGamingAdmin.Gui": "4.0.0", - "ExpGamingAdmin.Jail": "4.0.0", - "ExpGamingAdmin.Kick": "4.0.0", - "ExpGamingAdmin.Reports": "4.0.0", - "ExpGamingAdmin.Teleport": "4.0.0", - "ExpGamingAdmin.TempBan": "4.0.0", - "ExpGamingAdmin.Warnings": "4.0.0", - "ExpGamingAdmin.Commands": "4.0.0" - }, - "dependencies": { - "ExpGamingCore.Role": "?^4.0.0", - "ExpGamingCore.Sync": "?^4.0.0", - "ExpGamingCore.Server": "?^4.0.0", - "FactorioStdLib.Game": "^0.8.0" - } -} diff --git a/old/modules/DONE/Guis/Rockets/control.lua b/old/modules/DONE/Guis/Rockets/control.lua deleted file mode 100644 index d11f558d..00000000 --- a/old/modules/DONE/Guis/Rockets/control.lua +++ /dev/null @@ -1,105 +0,0 @@ ---- Adds a rocket count gui to the game that shows milestones and average rocket time --- @module ExpGamingInfo.Rockets --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Gui = require('ExpGamingCore.Gui') -local Game = require('FactorioStdLib.Game') - --- Module Define -local module_verbose = false -local ThisModule = { - on_init=function() - if loaded_modules['ExpGamingCore.Sync^4.0.0'] then require(module_path..'/src/sync') end - end -} - --- Global Define -local global = { - update=0, - first=0, - _last=0, - last=0, - fastest=0, - milestones={m1=0,m2=0,m5=0,m10=0,m20=0,m50=0,m100=0,m200=0,m500=0,m1000=0,m2000=0,m5000=0} -} -Global.register(global,function(tbl) global = tbl end) - --- Function Define -ThisModule.Gui = Gui.left{ - name='rockets', - caption='item/rocket-silo', - tooltip={'ExpGamingInfo-Rockets.tooltip'}, - draw=function(self,frame) - frame.caption = {'ExpGamingInfo-Rockets.name'} - local player = Game.get_player(frame.player_index) - local satellites = player.force.get_item_launched('satellite') - local time = {'ExpGamingInfo-Rockets.nan'} - if satellites == 1 then time = tick_to_display_format(game.tick) - elseif satellites > 1 then time = tick_to_display_format((game.tick-global.first)/satellites) end - if satellites ~= global.update then - global.update = satellites - if global.first == 0 then global.first = game.tick end - global._last = global.last - global.last = game.tick - if global.last-global._last < global.fastest or global.fastest == 0 then global.fastest = global.last-global._last end - end - frame.add{ - type='label', - caption={'ExpGamingInfo-Rockets.sent',satellites} - } - frame.add{ - type='label', - caption={'ExpGamingInfo-Rockets.first',tick_to_display_format(global.first)} - } - frame.add{ - type='label', - caption={'ExpGamingInfo-Rockets.last',tick_to_display_format(global.last-global._last)} - } - frame.add{ - type='label', - caption={'ExpGamingInfo-Rockets.time',time} - } - frame.add{ - type='label', - caption={'ExpGamingInfo-Rockets.fastest',tick_to_display_format(global.fastest)} - } - frame.add{ - type='label', - caption={'ExpGamingInfo-Rockets.milestones'}, - style='caption_label' - } - local milestones = frame.add{ - type='flow', - direction='vertical' - } - for milestone,next_time in pairs(global.milestones) do - milestone = tonumber(milestone:match('%d+')) - if next_time == 0 and satellites == milestone then - global.milestones['m'..milestone] = global.last - next_time = global.last - Gui.left.open('rockets') - end - local _time = {'ExpGamingInfo-Rockets.nan'} - if next_time > 0 then _time = tick_to_display_format(next_time) end - milestones.add{ - type='label', - caption={'ExpGamingInfo-Rockets.format',tostring(milestone),_time} - } - if next_time == 0 then break end - end - end, - can_open=function(player) - if player.force.get_item_launched('satellite') > 0 then return true - else return {'ExpGamingInfo-Rockets.none'} end - end -} - --- Event Define -Event.add(defines.events.on_rocket_launched,function(event) Gui.left.update('rockets') end) - --- Module Return --- when called will toggle the gui for that player, updates gui if no player given -return setmetatable(ThisModule,{__call=function(self,...) self.Gui(...) end}) \ No newline at end of file diff --git a/old/modules/DONE/Guis/Rockets/locale/de.cfg b/old/modules/DONE/Guis/Rockets/locale/de.cfg deleted file mode 100644 index 8fd5471e..00000000 --- a/old/modules/DONE/Guis/Rockets/locale/de.cfg +++ /dev/null @@ -1,12 +0,0 @@ -[ExpGamingInfo-Rockets] -name=Raketeninfo -tooltip=Detailliste über gestartete Raketen. -none=Es wurden noch keine Rakten gestartet. -nan=NaN -sent=Gestartete Raketen: __1__ -first=Erster Start: __1__ -last=Dauer bis zum letzten Start: __1__ -time=Durchschnittliche Starzeit: __1__ -fastest=Schnellster Start: __1__ -milestones=Meilensteine: -format=__1__: __2__ \ No newline at end of file diff --git a/old/modules/DONE/Guis/Rockets/locale/en.cfg b/old/modules/DONE/Guis/Rockets/locale/en.cfg deleted file mode 100644 index 263d9b2c..00000000 --- a/old/modules/DONE/Guis/Rockets/locale/en.cfg +++ /dev/null @@ -1,12 +0,0 @@ -[ExpGamingInfo-Rockets] -name=Rocket Info -tooltip=List of details about the rockets sent. -none=No rockets have been sent yet. -nan=Not available -sent=Rockets Sent: __1__ -first=First Lanuched At: __1__ -last=Last Launch Took: __1__ -time=Average Launch Time: __1__ -fastest=Fastest Launch: __1__ -milestones=Milestones: -format=__1__: __2__ \ No newline at end of file diff --git a/old/modules/DONE/Guis/Rockets/locale/fr.cfg b/old/modules/DONE/Guis/Rockets/locale/fr.cfg deleted file mode 100644 index 344c368d..00000000 --- a/old/modules/DONE/Guis/Rockets/locale/fr.cfg +++ /dev/null @@ -1,12 +0,0 @@ -[ExpGamingInfo-Rockets] -name=Rocket Info -tooltip=List of details about the rockets sent. -none=No rockets have been sent yet. -nan=NaN -sent=Rockets Sent: __1__ -first=First Lanuched At: __1__ -last=Last Launch Took: __1__ -time=Average Launch Time: __1__ -fastest=Fastest Launch: __1__ -milestones=Milestones: -format=__1__: __2__ \ No newline at end of file diff --git a/old/modules/DONE/Guis/Rockets/locale/nl.cfg b/old/modules/DONE/Guis/Rockets/locale/nl.cfg deleted file mode 100644 index 2fee0a06..00000000 --- a/old/modules/DONE/Guis/Rockets/locale/nl.cfg +++ /dev/null @@ -1,12 +0,0 @@ -[ExpGamingInfo-Rockets] -name=Raket Info -tooltip=Lijst met details over de verstuurde raketten. -none=Er zijn nog geen raketten verstuurd. -nan=Niet beschikbaar -sent=Raketten verstuurd: __1__ -first=Eerste raket gelanceerd op: __1__ -last=Meest recente lancering: __1__ -time=Gemiddelde lanceertijd: __1__ -fastest=Snelste lancering: __1__ -milestones=Mijlpalen: -format=__1__: __2__ diff --git a/old/modules/DONE/Guis/Rockets/locale/sv-SE.cfg b/old/modules/DONE/Guis/Rockets/locale/sv-SE.cfg deleted file mode 100644 index eb4d93bd..00000000 --- a/old/modules/DONE/Guis/Rockets/locale/sv-SE.cfg +++ /dev/null @@ -1,13 +0,0 @@ - -[ExpGamingInfo-Rockets] -name=Raketinformation -tooltip=Lista över detaljerna kring skickade raketer. -none=Inga raketer har blivit skickade ännu. -nan=Inte tillgängligt -sent=Skickade raketer: __1__ -first=Första uppskjutningen skedde: __1__ -last=Senaste uppskjutningen tog: __1__ -time=Genomsnittlig uppskjutningstid: __1__ -fastest=Snabbaste uppskjutning: __1__ -milestones=Milstolpar: -format=__1__: __2__ diff --git a/old/modules/DONE/Guis/Rockets/softmod.json b/old/modules/DONE/Guis/Rockets/softmod.json deleted file mode 100644 index 10c6e3e8..00000000 --- a/old/modules/DONE/Guis/Rockets/softmod.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "ExpGamingInfo.Rockets", - "version": "4.0.0", - "description": "Adds a rocket count gui to the game that shows milestones and average rocket time", - "location": "FSM_ARCHIVE", - "keywords": [ - "Gui", - "Info", - "ExpGaming", - "Rockets" - ], - "author": "", - "contact": "", - "license": "", - "dependencies": { - "ExpGamingCore.Gui": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Sync": "?^4.0.0", - "ExpGamingCore.Sync^4.0.0": "?*" - }, - "submodules": {}, - "collection": "ExpGamingInfo@4.0.0" -} diff --git a/old/modules/DONE/Guis/Rockets/src/sync.lua b/old/modules/DONE/Guis/Rockets/src/sync.lua deleted file mode 100644 index 82482eac..00000000 --- a/old/modules/DONE/Guis/Rockets/src/sync.lua +++ /dev/null @@ -1,20 +0,0 @@ -local Sync = require('ExpGamingCore.Sync') -local global = global['ExpGamingInfo.Rockets'] - -Sync.add_update('rockets',function() - local _return = {} - local satellites = game.forces.player.get_item_launched('satellite') - local time = {'rockets.nan'} - if satellites == 1 then time = tick_to_display_format(game.tick) - elseif satellites > 1 then time = tick_to_display_format((game.tick-global.first)/satellites) end - _return.total = satellites - _return.first = Sync.tick_format(global.first) - _return.last = Sync.tick_format(global.last-global._last) - _return.time = Sync.tick_format(time) - _return.fastest = Sync.tick_format(global.fastest) - _return.milestones = {} - for milestone,next_time in pairs(global.milestones) do - _return.milestones[milestone] = Sync.tick_format(next_time) - end - return _return -end) \ No newline at end of file diff --git a/old/modules/DONE/Guis/Science/control.lua b/old/modules/DONE/Guis/Science/control.lua deleted file mode 100644 index 9edfa55f..00000000 --- a/old/modules/DONE/Guis/Science/control.lua +++ /dev/null @@ -1,106 +0,0 @@ ---- Adds a science count gui to the game that shows total made and per minute --- @module ExpGamingInfo.Science --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Gui = require('ExpGamingCore.Gui') -local Game = require('FactorioStdLib.Game') - --- Local Variables -local science_packs = { - 'science-pack-1', - 'science-pack-2', - 'science-pack-3', - 'military-science-pack', - 'production-science-pack', - 'high-tech-science-pack', - 'space-science-pack' -} - --- Module Define -local module_verbose = false -local ThisModule = { - on_init=function() - if loaded_modules['ExpGamingCore.Sync^4.0.0'] then require(module_path..'/src/sync',{science_packs=science_packs}) end - end -} - --- Global Define -local global = { - _base={ - update=0, - _update=0, - made={0,0,0,0,0,0,0}, - _made={0,0,0,0,0,0,0} - } -} -Global.register(global,function(tbl) global = tbl end) - --- Function Define -ThisModule.Gui = Gui.left{ - name='science', - caption='item/lab', - tooltip={'ExpGamingInfo-Science.tooltip'}, - draw=function(self,frame) - local player = Game.get_player(frame.player_index) - if not global[player.force.name] then - verbose('Added Science Global for: '..player.force.name) - global[player.force.name] = table.deepcopy(global._base) - end - local force_data = global[player.force.name] - frame.caption = {'ExpGamingInfo-Science.name'} - frame.add{ - type='label', - caption={'ExpGamingInfo-Science.total'}, - style='caption_label' - } - local totals = frame.add{ - type='flow', - direction='vertical' - } - frame.add{ - type='label', - caption={'ExpGamingInfo-Science.time'}, - style='caption_label' - } - local times = frame.add{ - type='flow', - direction='vertical' - } - if force_data.update < game.tick-100 then - force_data._update = force_data.update - force_data._made = table.deepcopy(force_data.made) - for i,name in pairs(science_packs) do - force_data.made[i] = player.force.item_production_statistics.get_input_count(name) - end - force_data.update = game.tick - end - for i,name in pairs(science_packs) do - local made = force_data.made[i] - if made > 0 then - totals.add{ - type='label', - caption={'ExpGamingInfo-Science.format',{'ExpGamingInfo-Science.'..name},made} - } - local _made = string.format('%.2f',(made-force_data._made[i])/((force_data.update-force_data._update)/(3600*game.speed))) - times.add{ - type='label', - caption={'ExpGamingInfo-Science.format',{'ExpGamingInfo-Science.'..name},_made} - } - end - end - end, - can_open=function(player) - if player.force.item_production_statistics.get_input_count('science-pack-1') > 0 then return true - else return {'ExpGamingInfo-Science.none'} end - end -} - --- Event Define -Event.add(defines.events.on_research_finished,function(event) Gui.left.update('science') end) - --- Module Return --- when called will toggle the gui for that player, if no player it will update the gui -return setmetatable(ThisModule,{_call=function(self,...) self.Gui(...) end}) \ No newline at end of file diff --git a/old/modules/DONE/Guis/Science/locale/de.cfg b/old/modules/DONE/Guis/Science/locale/de.cfg deleted file mode 100644 index e10b31a4..00000000 --- a/old/modules/DONE/Guis/Science/locale/de.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[ExpGamingInfo-Science] -name=Wissenschaftsinfo -tooltip=Detailliste über Wissenschaftspakete -total=Gemachte Pakete: -time=Pakete pro Minute: -format=__1__: __2__ -science-pack-1=Rot -science-pack-2=Grün -science-pack-3=Blau -military-science-pack=Militär -production-science-pack=Produktion -high-tech-science-pack=Hochtechnologie -space-science-pack=Weltraum -none=Es wurden noch keine Wissenschaftspakete gemacht. \ No newline at end of file diff --git a/old/modules/DONE/Guis/Science/locale/en.cfg b/old/modules/DONE/Guis/Science/locale/en.cfg deleted file mode 100644 index a9bc1526..00000000 --- a/old/modules/DONE/Guis/Science/locale/en.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[ExpGamingInfo-Science] -name=Science Info -tooltip=List of details about science packs. -total=Packs Made: -time=Packs Per Minute: -format=__1__: __2__ -science-pack-1=Red -science-pack-2=Green -science-pack-3=Blue -military-science-pack=Military -production-science-pack=Production -high-tech-science-pack=High Tech -space-science-pack=Space -none=No science packs have been made yet. \ No newline at end of file diff --git a/old/modules/DONE/Guis/Science/locale/fr.cfg b/old/modules/DONE/Guis/Science/locale/fr.cfg deleted file mode 100644 index a9bc1526..00000000 --- a/old/modules/DONE/Guis/Science/locale/fr.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[ExpGamingInfo-Science] -name=Science Info -tooltip=List of details about science packs. -total=Packs Made: -time=Packs Per Minute: -format=__1__: __2__ -science-pack-1=Red -science-pack-2=Green -science-pack-3=Blue -military-science-pack=Military -production-science-pack=Production -high-tech-science-pack=High Tech -space-science-pack=Space -none=No science packs have been made yet. \ No newline at end of file diff --git a/old/modules/DONE/Guis/Science/locale/nl.cfg b/old/modules/DONE/Guis/Science/locale/nl.cfg deleted file mode 100644 index 2ac8d7c0..00000000 --- a/old/modules/DONE/Guis/Science/locale/nl.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[ExpGamingInfo-Science] -name=Wetenschap info -tooltip=Lijst met details over de wetenschaps pakketten. -total=Pakketten gemaakt: -time=Pakketten per minuut: -format=__1__: __2__ -science-pack-1=Rood -science-pack-2=Groen -science-pack-3=Blauw -military-science-pack=Militair -production-science-pack=Productie -high-tech-science-pack=High Tech -space-science-pack=Ruimte -none=Er zijn nog geen wetenschaps pakketten gemaakt. diff --git a/old/modules/DONE/Guis/Science/locale/sv-Se.cfg b/old/modules/DONE/Guis/Science/locale/sv-Se.cfg deleted file mode 100644 index db40737c..00000000 --- a/old/modules/DONE/Guis/Science/locale/sv-Se.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[ExpGamingInfo-Science] -name=Vetenskapsinformation -tooltip=Detaljerad lista över vetenskapspaket. -total=Paket gjorda: -time=Paket per minut: -format=__1__: __2__ -science-pack-1=Röda -science-pack-2=Gröna -science-pack-3=Blåa -military-science-pack=Militära -production-science-pack=Produktion -high-tech-science-pack=Högteknologiska -space-science-pack=Rymd -none=Inga vetenskapspaket har blivit gjorda ännu. diff --git a/old/modules/DONE/Guis/Science/softmod.json b/old/modules/DONE/Guis/Science/softmod.json deleted file mode 100644 index 8f9cf99a..00000000 --- a/old/modules/DONE/Guis/Science/softmod.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "ExpGamingInfo.Science", - "version": "4.0.0", - "description": "Adds a science count gui to the game that shows toatal made and per minute", - "location": "FSM_ARCHIVE", - "keywords": [ - "Gui", - "Info", - "ExpGaming", - "Science", - "Production" - ], - "author": "", - "contact": "", - "license": "", - "dependencies": { - "ExpGamingCore.Gui": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Sync": "?^4.0.0", - "ExpGamingCore.Sync^4.0.0": "?*" - }, - "submodules": {}, - "collection": "ExpGamingInfo@4.0.0" -} diff --git a/old/modules/DONE/Guis/Science/src/sync.lua b/old/modules/DONE/Guis/Science/src/sync.lua deleted file mode 100644 index 6f624d4f..00000000 --- a/old/modules/DONE/Guis/Science/src/sync.lua +++ /dev/null @@ -1,19 +0,0 @@ -local Sync = require('ExpGamingCore.Sync') -local data = global['ExpGamingInfo.Science'] -local science_packs = science_packs - -Sync.add_update('science',function() - local _return = {} - for force_name,global in pairs(data) do - if force_name ~= '_base' then - _return[force_name] = {totals={},times={}} - for i,name in pairs(science_packs) do - local made = global.made[i] - _return[force_name].totals[name] = made - local _made = string.format('%.2f',(made-global._made[i])/((global.update-global._update)/(3600*game.speed))) - _return[force_name].times[name] = _made - end - end - end - return _return -end) \ No newline at end of file diff --git a/old/modules/DONE/Guis/Tasklist/control.lua b/old/modules/DONE/Guis/Tasklist/control.lua deleted file mode 100644 index d8dbe8b5..00000000 --- a/old/modules/DONE/Guis/Tasklist/control.lua +++ /dev/null @@ -1,207 +0,0 @@ ---- Adds a task list gui which acts like a bulletin board for the current tasks --- @module ExpGamingInfo.Tasklist --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Gui = require('ExpGamingCore.Gui') -local Role = require('ExpGamingCore.Role') -local Game = require('FactorioStdLib.Game') - --- Module Define -local module_verbose = false -local ThisModule = {} - --- Global Define -local global = { - tasks={}, - _edit={}, - _base={ - _edit=false, - _tasks={}, - _editing={} - } -} -Global.register(global,function(tbl) global = tbl end) - --- Function Define -local edit = Gui.inputs{ - name='tasklist-edit', - type='button', - caption='utility/rename_icon_normal' -}:on_event('click',function(event) - local text_flow = event.element.parent.parent.text_flow - local data = global._edit[event.player_index] - if not data._edit then data._tasks = table.deepcopy(global.tasks) end - if text_flow.input.type == 'label' then - data._editing[tonumber(text_flow.parent.name)]=true - Gui.left.update('tasklist',event.player_index) - elseif text_flow.input.type == 'textfield' then - local text = text_flow.input.text - data._editing[tonumber(text_flow.parent.name)]=false - data._tasks[tonumber(text_flow.parent.name)]=text - Gui.left.update('tasklist',event.player_index) - end -end) - -local function _edit(frame) - local element = edit(frame) - element.style.height = 20 - element.style.width = 20 - local text_flow = element.parent.parent.text_flow - local data = global._edit[frame.player_index] - data._tasks[text_flow.parent.name]=text - if data._editing[tonumber(text_flow.parent.name)] then - element.style.height = 30 - element.style.width = 30 - local text = text_flow.input.caption - text_flow.clear() - local _text = text_flow.add{ - name='input', - type='textfield', - text=text - } - _text.style.width = 200 - element.sprite = 'utility/enter' - end -end - -local remove = Gui.inputs{ - name='tasklist-remove', - type='button', - caption='utility/remove' -}:on_event('click',function(event) - local frame = event.element.parent.parent - local data = global._edit[event.player_index] - if data._edit then - table.remove(data._tasks,tonumber(frame.name)) - table.remove(data._editing,tonumber(frame.name)) - else - table.remove(global.tasks,tonumber(frame.name)) - Gui.left.update('tasklist') - end - Gui.left.update('tasklist',event.player_index) -end) - -local add = Gui.inputs{ - name='tasklist-add', - type='button', - caption='utility/add' -}:on_event('click',function(event) - local frame = event.element.parent.parent - local data = global._edit[event.player_index] - if data._edit then - table.insert(data._tasks,tonumber(frame.name)+1,'New Value') - table.insert(data._editing,tonumber(frame.name)+1,true) - else - data._tasks = table.deepcopy(global.tasks) - table.insert(data._tasks,tonumber(frame.name)+1,'New Value') - table.insert(data._editing,tonumber(frame.name)+1,true) - end - Gui.left.update('tasklist',event.player_index) -end) - -local function _tasks(player) - player = Game.get_player(player) - local data = global._edit[player.index] - if not data then return global.tasks end - local editing = false - for _,v in pairs(data._editing) do - if v == true then - editing = true - break - end - end - if data._edit and not editing then - global.tasks = table.deepcopy(data._tasks) - global._edit[player.index] = table.deepcopy(global._base) - Gui.left.update('tasklist') - return global.tasks - elseif not data._edit and editing then - data._edit = true - for key,_ in pairs(data._tasks) do if not data._editing[key] then data._editing[key] = false end end - return data._tasks - elseif editing then return data._tasks - else return global.tasks - end -end - -ThisModule.Gui = Gui.left{ - name='tasklist', - caption='utility/not_enough_repair_packs_icon', - tooltip={'ExpGamingInfo-Tasklist.tooltip'}, - draw=function(self,frame) - frame.caption = '' - local title = frame.add{ - type='flow', - direction='horizontal' - } - title.add{ - type='label', - caption={'ExpGamingInfo-Tasklist.name'}, - style='caption_label' - } - local player = Game.get_player(frame.player_index) - local allowed = Role.allowed(player,'edit-tasklist') - if allowed then - if not global._edit[player.index] then global._edit[player.index] = table.deepcopy(global._base) end - end - for i,task in pairs(_tasks(player)) do - local flow = frame.add{ - name=i, - type='flow', - direction='horizontal' - } - local text_flow = flow.add{ - name='text_flow', - type='flow', - direction='horizontal' - } - text_flow.add{ - name='input', - type='label', - caption=task - } - local button_flow = flow.add{ - type='flow', - direction='horizontal' - } - if allowed then - _edit(button_flow) - if global._edit[player.index]._editing[i] then - local element = remove(button_flow) - element.style.height = 30 - element.style.width = 30 - local _element = add(button_flow) - _element.style.height = 30 - _element.style.width = 30 - end - end - end - if allowed then - local flow = title.add{ - name=#_tasks(player), - type='flow', - direction='horizontal' - } - local button_flow = flow.add{ - type='flow', - direction='horizontal' - } - local element = add(button_flow) - element.style.height = 20 - element.style.width = 20 - end - if #_tasks(player) == 0 and not allowed then frame.style.visible = false end - end, - can_open=function(player) - if Role.allowed(player,'edit-tasklist') or #global.tasks > 0 then return true - else return {'ExpGamingInfo-Tasklist.none'} end - end, - open_on_join=true -} - --- Module return --- when called it will toggle the gui for that player, if no player then it will update the gui -return setmetatable(ThisModule,{__call=function(self,...) self.Gui(...) end}) \ No newline at end of file diff --git a/old/modules/DONE/Guis/Tasklist/locale/de.cfg b/old/modules/DONE/Guis/Tasklist/locale/de.cfg deleted file mode 100644 index 48573724..00000000 --- a/old/modules/DONE/Guis/Tasklist/locale/de.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingInfo-Tasklist] -name=Taskliste -tooltip=Welche Aufgaben müssen rund um die Fabrik erledigt werden? -none=Es sind aktuell keine Tasks erfasst, frage einen Member um einen hinzuzufügen. \ No newline at end of file diff --git a/old/modules/DONE/Guis/Tasklist/locale/en.cfg b/old/modules/DONE/Guis/Tasklist/locale/en.cfg deleted file mode 100644 index 7e698acf..00000000 --- a/old/modules/DONE/Guis/Tasklist/locale/en.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingInfo-Tasklist] -name=Task List -tooltip=Jobs that needs to be completed all around the factory. -none=There are currently no tasks. Ask a Member in-game or through Discord to add tasks. \ No newline at end of file diff --git a/old/modules/DONE/Guis/Tasklist/locale/fr.cfg b/old/modules/DONE/Guis/Tasklist/locale/fr.cfg deleted file mode 100644 index e739ac38..00000000 --- a/old/modules/DONE/Guis/Tasklist/locale/fr.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingInfo-Tasklist] -name=Task List -tooltip=What jobs need to be done round the factory. -none=There are no tasks to do right now, ask a member to add some. \ No newline at end of file diff --git a/old/modules/DONE/Guis/Tasklist/locale/nl.cfg b/old/modules/DONE/Guis/Tasklist/locale/nl.cfg deleted file mode 100644 index 6ab37662..00000000 --- a/old/modules/DONE/Guis/Tasklist/locale/nl.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingInfo-Tasklist] -name=Taaklijst -tooltip=Wat voor werk er rondom de fabriek gedaan moet worden -none=Er zijn momenteel geen taken. Vraag een Member om taken toe te voegen. diff --git a/old/modules/DONE/Guis/Tasklist/locale/sv-SE.cfg b/old/modules/DONE/Guis/Tasklist/locale/sv-SE.cfg deleted file mode 100644 index 5b0009bf..00000000 --- a/old/modules/DONE/Guis/Tasklist/locale/sv-SE.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingInfo-Tasklist] -name=Uppgiftslista -tooltip=Jobb som behövs slutföras överallt i fabriken -none=Det finns för närvarande inga uppgifter. Fråga en medlem i spelet eller via Discord för att lägga till nya uppgifter. \ No newline at end of file diff --git a/old/modules/DONE/Guis/Tasklist/softmod.json b/old/modules/DONE/Guis/Tasklist/softmod.json deleted file mode 100644 index dcb673a7..00000000 --- a/old/modules/DONE/Guis/Tasklist/softmod.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "ExpGamingInfo.Tasklist", - "version": "4.0.0", - "description": "Adds a task list gui which acts like a bulletin board for the current tasks", - "location": "FSM_ARCHIVE", - "keywords": [ - "Gui", - "Info", - "ExpGaming", - "Tasks" - ], - "author": "", - "contact": "", - "license": "", - "dependencies": { - "ExpGamingCore.Gui": "^4.0.0", - "ExpGamingCore.Role": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0" - }, - "submodules": {}, - "collection": "ExpGamingInfo@4.0.0" -} diff --git a/old/modules/DONE/Guis/playerList/control.lua b/old/modules/DONE/Guis/playerList/control.lua deleted file mode 100644 index 536519f2..00000000 --- a/old/modules/DONE/Guis/playerList/control.lua +++ /dev/null @@ -1,145 +0,0 @@ ---- A full ranking system for factorio. --- @module ExpGamingPlayer.playerList@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - -local Game = require('FactorioStdLib.Game') -local Gui = require('ExpGamingCore.Gui') -local Admin -- ExpGamingAdmin@^4.0.0 -local AdminGui -- ExpGamingAdmin.Gui@^4.0.0 - --- Local Variables -local playerInfo = function(player,frame) - frame.add{ - type='label', - caption={'ExpGamingPlayer-playerList.no-info-file'} - } -end - -local getPlayers = function() - local rtn = {{{r=233,g=63,b=233},'Admin',{},true},{{r=255,g=159,b=27},'',{},false}} - for _,player in pairs(game.connected_players) do - if player.admin then table.insert(rtn[2][3],player) - else table.insert(rtn[1][3],player) end - end - return rtn -end - --- Module Define -local module_verbose = false -local ThisModule = { - on_init=function(self) - if loaded_modules['ExpGamingPlayer.playerInfo'] then playerInfo = require('ExpGamingPlayer.playerInfo') end - if loaded_modules['ExpGamingCore.Role'] then getPlayers = require(module_path..'/src/ranking',{self=self}) end - if loaded_modules['ExpGamingAdmin'] then Admin = require('ExpGamingAdmin') end - if loaded_modules['ExpGamingAdmin.Gui'] then AdminGui = require('ExpGamingAdmin.Gui') end - end -} - --- Global Define -local global = { - update=0, - delay=10, - interval=54000 -} -Global.register(global,function(tbl) global = tbl end) - -function ThisModule.update(tick) - local tick = is_type(tick,'table') and tick.tick or is_type(tick,'number') and tick or game.tick - if tick + global.delay > global.update - global.interval then - global.update = tick + global.delay - end -end - -local back_btn = Gui.inputs{ - type='button', - caption='utility/enter', - name='player-list-back' -}:on_event('click',function(event) - event.element.parent.parent.scroll.style.visible = true - event.element.parent.destroy() -end) - -ThisModule.Gui = Gui.left{ - name='player-list', - caption='entity/player', - tooltip={'ExpGamingPlayer-playerList.tooltip'}, - draw=function(self,frame) - frame.caption = '' - local player_list = frame.add{ - name='scroll', - type = 'scroll-pane', - direction = 'vertical', - vertical_scroll_policy='auto', - horizontal_scroll_policy='never' - } - player_list.vertical_scroll_policy = 'auto' - player_list.style.maximal_height=195 - local done = {} - local players = getPlayers() -- list of [colour,shortHand,[playerOne,playerTwo]] - for _,rank in pairs(players) do - for _,player in pairs(rank[3]) do - if not done[player.index] then - done[player.index] = true - local flow = player_list.add{type='flow'} - if rank[2] == '' then - flow.add{ - type='label', - name=player.name, - style='caption_label', - caption={'ExpGamingPlayer-playerList.format-nil',tick_to_display_format(player.online_time),player.name} - }.style.font_color = rank[1] - else - flow.add{ - type='label', - name=player.name, - style='caption_label', - caption={'ExpGamingPlayer-playerList.format',tick_to_display_format(player.online_time),player.name,rank[2]} - }.style.font_color = rank[1] - end - if Admin and Admin.report_btn then - if not rank[4] and player.index ~= frame.player_index then - local btn = Admin.report_btn(flow) - btn.style.height = 20 - btn.style.width = 20 - end - end - end - end - end - end, - open_on_join=true -} - -Event.add(defines.events.on_tick,function(event) - if event.tick > global.update then - ThisModule.Gui() - global.update = event.tick + global.interval - end -end) - -Event.add(defines.events.on_gui_click,function(event) - -- lots of checks for it being valid - if event.element and event.element.valid - and event.element.parent and event.element.parent.parent and event.element.parent.parent.parent - and event.element.parent.parent.parent.name == 'player-list' then else return end - -- must be a right click - if event.button == defines.mouse_button_type.right then else return end - local player_list = event.element.parent.parent.parent - -- must be a valid player which is clicked - if not Game.get_player(event.element.name) then return end - -- hides the player list to show the info - player_list.scroll.style.visible = false - local flow = player_list.add{type='flow',direction='vertical'} - back_btn:draw(flow) - playerInfo(event.element.name,flow,true) - if Game.get_player(event.element.name) and event.player_index == Game.get_player(event.element.name).index then return end - if Admin and AdminGui and Admin.allowed(event.player_index) then AdminGui(flow).caption = event.element.name end -end) - -Event.add(defines.events.on_player_joined_game,function() ThisModule.update() end) -Event.add(defines.events.on_player_left_game,function() ThisModule.update() end) - -ThisModule.force_update = function() return ThisModule.Gui() end --- when called it will queue an update to the player list -return setmetatable(ThisModule,{__call=function(self,...) self.update(...) end}) \ No newline at end of file diff --git a/old/modules/DONE/Guis/playerList/locale/de.cfg b/old/modules/DONE/Guis/playerList/locale/de.cfg deleted file mode 100644 index ed48069f..00000000 --- a/old/modules/DONE/Guis/playerList/locale/de.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[ExpGamingPlayer-playerList] -tooltip=Verkleinere die Spielerliste. Rechtsklicke einen Spieler für Informationen über ihn. -format-nil=__1__ - __2__ -format=__1__ - __2__ - __3__ -no-info-file=Es wurden keine Informationen gefunden. \ No newline at end of file diff --git a/old/modules/DONE/Guis/playerList/locale/en.cfg b/old/modules/DONE/Guis/playerList/locale/en.cfg deleted file mode 100644 index d2c2e345..00000000 --- a/old/modules/DONE/Guis/playerList/locale/en.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[ExpGamingPlayer-playerList] -tooltip=Toggle player list, right click player for more info -format-nil=__1__ - __2__ -format=__1__ - __2__ - __3__ -no-info-file=No info file was found \ No newline at end of file diff --git a/old/modules/DONE/Guis/playerList/locale/fr.cfg b/old/modules/DONE/Guis/playerList/locale/fr.cfg deleted file mode 100644 index 83d2dd03..00000000 --- a/old/modules/DONE/Guis/playerList/locale/fr.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[ExpGamingPlayer-playerList] -tooltip=Toogle player list, right click player for info -format-nil=__1__ - __2__ -format=__1__ - __2__ - __3__ -no-info-file=No info file was found \ No newline at end of file diff --git a/old/modules/DONE/Guis/playerList/locale/nl.cfg b/old/modules/DONE/Guis/playerList/locale/nl.cfg deleted file mode 100644 index 6a58e08a..00000000 --- a/old/modules/DONE/Guis/playerList/locale/nl.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[ExpGamingPlayer-playerList] -tooltip=Toggle speler lijst. Rechtermuisklik op een speler voor meer info -format-nil=__1__ - __2__ -format=__1__ - __2__ - __3__ -no-info-file=Geen infobestand gevonden. diff --git a/old/modules/DONE/Guis/playerList/locale/sv-SE.cfg b/old/modules/DONE/Guis/playerList/locale/sv-SE.cfg deleted file mode 100644 index b871c389..00000000 --- a/old/modules/DONE/Guis/playerList/locale/sv-SE.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[ExpGamingPlayer-playerList] -tooltip=Växla spelarlista, högerklicka på spelare för mer information. -format-nil=__1__ - __2__ -format=__1__ - __2__ - __3__ -no-info-file=Ingen informationsfil kunde hittas diff --git a/old/modules/DONE/Guis/playerList/softmod.json b/old/modules/DONE/Guis/playerList/softmod.json deleted file mode 100644 index bda73c47..00000000 --- a/old/modules/DONE/Guis/playerList/softmod.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "ExpGamingPlayer.playerList", - "version": "4.0.0", - "description": "Used to display player names and online time on the top left.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Player List", - "List", - "Gui", - "Names" - ], - "dependencies": { - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Gui": "^4.0.0", - "ExpGamingCore.Role": "?^4.0.0", - "ExpGamingAdmin": "?^4.0.0", - "ExpGamingAdmin.buttonFlow": "?^4.0.0", - "ExpGamingAdmin.reports": "?^4.0.0", - "ExpGamingPlayer.playerInfo": "?^4.0.0", - "ExpGamingAdmin.Gui": "?^4.0.0" - }, - "collection": "ExpGamingPlayer@4.0.0", - "submodules": {} -} diff --git a/old/modules/DONE/Guis/playerList/src/ranking.lua b/old/modules/DONE/Guis/playerList/src/ranking.lua deleted file mode 100644 index 266741b9..00000000 --- a/old/modules/DONE/Guis/playerList/src/ranking.lua +++ /dev/null @@ -1,15 +0,0 @@ -local Role = require('ExpGamingCore.Role') - -Event.add(defines.events.on_role_change,self.update) - -return function() - local rtn = {} - local default = {} - for _,role_name in pairs(Role.order) do - local role = Role.get(role_name,true) - if role.is_default then default = {role.colour,role.short_hand,role:get_players(true),role.not_reportable} - else table.insert(rtn,{role.colour,role.short_hand,role:get_players(true),role.not_reportable}) end - end - table.insert(rtn,default) - return rtn -end \ No newline at end of file diff --git a/old/modules/DONE/PlayerAutoColor/control.lua b/old/modules/DONE/PlayerAutoColor/control.lua deleted file mode 100644 index 3dc7a494..00000000 --- a/old/modules/DONE/PlayerAutoColor/control.lua +++ /dev/null @@ -1,48 +0,0 @@ ---- Assigns random colours to players (larger range than default) and allows predefined colours for users. --- @module PlayerAutoColor@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Color = require('FactorioStdLib.Color') - --- Module Define -local module_verbose = false -local ThisModule = {} - --- Global Define -local global = { - BADgamerNL={r=255,g=20,b=147}, - arty714={r=150,g=68,b=161}, - Cooldude2606={r=57,g=192,b=207}, - mark9064={r=99,g=0,b=255}, - eissturm={r=25,g=25,b=112}, - Sakama={r=20,g=213,b=80}, - Sakama={r=20,g=213,b=80}, - freek18={r=50,g=0,b=255}, - aldldl={r=0,g=131,b=255}, - NAD4X4={r=135,g=206,b=250}, - cydes={r=82,g=249,b=155}, - UUBlueFire={r=0,g=204,b=255} -} -Global.register(global,function(tbl) global = tbl end) - --- Event Handlers Define -Event.add(defines.events.on_player_created, function(event) - local player = game.players[event.player_index] - local colours = table.keys(defines.color) - player.color = defines.color.black - while player.color.r == defines.color.black.r and player.color.g == defines.color.black.g and player.color.b == defines.color.black.b - or player.color.r == defines.color.white.r and player.color.g == defines.color.white.g and player.color.b == defines.color.white.b do - player.color = defines.color[colours[math.random(#colours)]] - if global[player.name] then - local c = global[player.name] - player.color = Color.from_rgb(c.r,c.g,c.b) - end - end - player.chat_color = player.color -end) - --- Module Return -return ThisModule \ No newline at end of file diff --git a/old/modules/DONE/PlayerAutoColor/softmod.json b/old/modules/DONE/PlayerAutoColor/softmod.json deleted file mode 100644 index d028bba7..00000000 --- a/old/modules/DONE/PlayerAutoColor/softmod.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "PlayerAutoColor", - "version": "4.0.0", - "description": "Assigns random colours to players (larger range than default) and allows predefined colours for users.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Colour", - "Color", - "Player", - "Vibrant" - ], - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "dependencies": { - "FactorioStdLib.Color": "^0.8.0" - }, - "submodules": {} -} diff --git a/old/modules/DONE/SpawnArea/control.lua b/old/modules/DONE/SpawnArea/control.lua deleted file mode 100644 index 0e9e1d2c..00000000 --- a/old/modules/DONE/SpawnArea/control.lua +++ /dev/null @@ -1,127 +0,0 @@ ---- Creates a safe spawn area with chests and auto refilling turrets. --- @module SpawnArea@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Game = require('FactorioStdLib.Game') - --- Local Variables -local turret_enabled = true -local turret_ammo = 'uranium-rounds-magazine' - -local tile_positions = require(module_path..'/src/spawn_tiles') -local entity_positions = require(module_path..'/src/spawn_entities') - -local global_offset = {x=0,y=-2} -local decon_radius = 20 -local decon_tile = 'concrete' -local pattern_radius = 50 -local pattern_tile = 'stone-path' - --- Module Define -local module_verbose = false -local ThisModule = {} - --- Global Define --- location of auto refill turrets -local global = { - {1,-3,-3}, - {1,-3,3}, - {1,3,-3}, - {1,3,3} -} -Global.register(global,function(tbl) global = tbl end) - --- Function Define -function ThisModule.afk_belt(surface,offset) - local belts = {{-0.5,-0.5,2},{0.5,-0.5,4},{-0.5,0.5,0},{0.5,0.5,6}} - for _,pos in pairs(belts) do - local position = {pos[1]+offset[1],pos[2]+offset[2]} - local belt = surface.create_entity{name='transport-belt',position=position,force='neutral',direction=pos[3]} - belt.destructible = false; belt.health = 0; belt.minable = false; belt.rotatable = false - end -end - -function ThisModule.auto_turret(surface,pos) - if not turret_enabled then error('Auto Turrets are disabled.') end - -- adds a new turret to the global list, returns index - local _return - if surface then - surface = Game.get_surface(surface) - if not surface then error('Surface is not valid.') end - local posx = pos.x or pos[1] or error('Position is not valid.') - local posy = pos.y or pos[2] or error('Position is not valid.') - _return = table.insert(global,{surface.index,posx,posy}) - end - -- spawns turrets and refills them - if not game.forces['spawn'] then game.create_force('spawn').set_cease_fire('player',true) game.forces['player'].set_cease_fire('spawn',true) end - for _,pos in pairs(global) do - surface = game.surfaces[pos[1]] - local turret = surface.find_entity('gun-turret',{pos[2],pos[3]}) - if not turret then - turret = surface.create_entity{name='gun-turret',position={pos[2],pos[3]},force='spawn'} - turret.destructible = false; turret.health = 0; turret.minable = false; turret.rotatable = false; turret.operable = false; turret.health = 0 - end - if turret.get_inventory(defines.inventory.turret_ammo).can_insert{name=turret_ammo,count=10} then - turret.get_inventory(defines.inventory.turret_ammo).insert{name=turret_ammo,count=10} - end - end -end - --- Event Handlers Define -if turret_enabled then - Event.add(defines.events.on_tick,function(event) - if event.tick % 3600 then - ThisModule.auto_turret() - end - end) -end - -Event.add(defines.events.on_player_created, function(event) - if event.player_index == 1 then - local player = Game.get_player(event) - local surface = player.surface - local offset = {x=0,y=0} - local pattern_base_tile = surface.get_tile(player.position).name - if pattern_base_tile == 'deepwater' or pattern_base_tile == 'water' then pattern_base_tile = 'grass-1' end - local base_tiles = {} - local tiles = {} - -- generates a safe area of land and removes all entities - for x = -pattern_radius, pattern_radius do - for y = -pattern_radius, pattern_radius do - if x^2+y^2 < decon_radius^2 then - table.insert(base_tiles,{name=decon_tile,position={x+offset.x,y+offset.y}}) - local entities = surface.find_entities_filtered{area={{x+offset.x-1,y+offset.y-1},{x+offset.x,y+offset.y}}} - for _,entity in pairs(entities) do if entity.name ~= 'player' then entity.destroy() end end - elseif x^2+y^2 < pattern_radius^2 then - table.insert(base_tiles,{name=pattern_base_tile,position={x+offset.x,y+offset.y}}) - end - end - end - surface.set_tiles(base_tiles) - -- creates the pattern in the spawn - for _,position in pairs(tile_positions) do - table.insert(tiles,{name=pattern_tile,position={position[1]+offset.x+global_offset.x,position[2]+offset.y+global_offset.y}}) - end - surface.set_tiles(tiles) - -- spawns all the entities in spawn - for _,entity in pairs(entity_positions) do - entity = surface.create_entity{name=entity[1],position={entity[2]+offset.x+global_offset.x,entity[3]+offset.y+global_offset.y},force='neutral'} - entity.destructible = false; entity.health = 0; entity.minable = false; entity.rotatable = false - end - -- generates spawn turrets and afk belts - if turret_enabled then ThisModule.auto_turret() end - ThisModule.afk_belt(surface,{offset.x-5,offset.y-5}) - ThisModule.afk_belt(surface,{offset.x+5,offset.y-5}) - ThisModule.afk_belt(surface,{offset.x-5,offset.y+5}) - ThisModule.afk_belt(surface,{offset.x+5,offset.y+5}) - -- sets the spawn and moves the first player there - player.force.set_spawn_position(offset,surface) - player.teleport(offset,surface) - end -end) - --- Module Return -return ThisModule \ No newline at end of file diff --git a/old/modules/DONE/SpawnArea/softmod.json b/old/modules/DONE/SpawnArea/softmod.json deleted file mode 100644 index 240e1af4..00000000 --- a/old/modules/DONE/SpawnArea/softmod.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "SpawnArea", - "version": "4.0.0", - "description": "Creates a safe spawn area with chests and auto refilling turrets.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Spawn", - "Safe", - "Turrets", - "Auto Refill" - ], - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "dependencies": { - "FactorioStdLib.Game": "^0.8.0" - }, - "submodules": {} -} diff --git a/old/modules/DONE/SpawnArea/src/spawn_entities.lua b/old/modules/DONE/SpawnArea/src/spawn_entities.lua deleted file mode 100644 index 408082d5..00000000 --- a/old/modules/DONE/SpawnArea/src/spawn_entities.lua +++ /dev/null @@ -1,16 +0,0 @@ -return { - {"stone-wall",-10,-6},{"stone-wall",-10,-5},{"stone-wall",-10,-4},{"stone-wall",-10,-3},{"stone-wall",-10,-2},{"stone-wall",-10,-1},{"stone-wall",-10,0},{"stone-wall",-10,3},{"stone-wall",-10,4},{"stone-wall",-10,5}, - {"stone-wall",-10,6},{"stone-wall",-10,7},{"stone-wall",-10,8},{"stone-wall",-10,9},{"stone-wall",-8,-8},{"small-lamp",-8,-4},{"small-lamp",-8,-1},{"iron-chest",-8,0},{"iron-chest",-8,3},{"small-lamp",-8,4}, - {"small-lamp",-8,7},{"stone-wall",-8,11},{"stone-wall",-7,-8},{"small-electric-pole",-7,-2},{"iron-chest",-7,0},{"iron-chest",-7,3},{"small-electric-pole",-7,5},{"stone-wall",-7,11},{"stone-wall",-6,-8},{"small-lamp",-6,-6}, - {"iron-chest",-6,0},{"iron-chest",-6,3},{"small-lamp",-6,9},{"stone-wall",-6,11},{"stone-wall",-5,-8},{"small-lamp",-5,-1},{"iron-chest",-5,0},{"iron-chest",-5,3},{"small-lamp",-5,4},{"stone-wall",-5,11}, - {"stone-wall",-4,-8},{"small-electric-pole",-4,-5},{"iron-chest",-4,0},{"iron-chest",-4,3},{"small-electric-pole",-4,8},{"stone-wall",-4,11},{"stone-wall",-3,-8},{"small-lamp",-3,-6},{"small-lamp",-3,-3},{"small-lamp",-3,6}, - {"small-lamp",-3,9},{"stone-wall",-3,11},{"stone-wall",-2,-8},{"iron-chest",-2,-6},{"iron-chest",-2,-5},{"iron-chest",-2,-4},{"iron-chest",-2,-3},{"iron-chest",-2,-2},{"iron-chest",-2,5},{"iron-chest",-2,6}, - {"iron-chest",-2,7},{"iron-chest",-2,8},{"iron-chest",-2,9},{"stone-wall",-2,11},{"stone-wall",1,-8},{"iron-chest",1,-6}, - {"iron-chest",1,-5},{"iron-chest",1,-4},{"iron-chest",1,-3},{"iron-chest",1,-2},{"iron-chest",1,5},{"iron-chest",1,6},{"iron-chest",1,7},{"iron-chest",1,8},{"iron-chest",1,9},{"stone-wall",1,11}, - {"stone-wall",2,-8},{"small-lamp",2,-6},{"small-lamp",2,-3},{"small-lamp",2,6},{"small-lamp",2,9},{"stone-wall",2,11},{"stone-wall",3,-8},{"small-electric-pole",3,-5},{"iron-chest",3,0},{"iron-chest",3,3}, - {"small-electric-pole",3,8},{"stone-wall",3,11},{"stone-wall",4,-8},{"small-lamp",4,-1},{"iron-chest",4,0},{"iron-chest",4,3},{"small-lamp",4,4},{"stone-wall",4,11},{"stone-wall",5,-8},{"small-lamp",5,-6}, - {"iron-chest",5,0},{"iron-chest",5,3},{"small-lamp",5,9},{"stone-wall",5,11},{"stone-wall",6,-8},{"small-electric-pole",6,-2},{"iron-chest",6,0},{"iron-chest",6,3},{"small-electric-pole",6,5},{"stone-wall",6,11}, - {"stone-wall",7,-8},{"small-lamp",7,-4},{"small-lamp",7,-1},{"iron-chest",7,0},{"iron-chest",7,3},{"small-lamp",7,4},{"small-lamp",7,7},{"stone-wall",7,11},{"stone-wall",9,-6},{"stone-wall",9,-5}, - {"stone-wall",9,-4},{"stone-wall",9,-3},{"stone-wall",9,-2},{"stone-wall",9,-1},{"stone-wall",9,0},{"stone-wall",9,3},{"stone-wall",9,4},{"stone-wall",9,5},{"stone-wall",9,6},{"stone-wall",9,7}, - {"stone-wall",9,8},{"stone-wall",9,9} -} \ No newline at end of file diff --git a/old/modules/DONE/SpawnArea/src/spawn_tiles.lua b/old/modules/DONE/SpawnArea/src/spawn_tiles.lua deleted file mode 100644 index 77aa62c6..00000000 --- a/old/modules/DONE/SpawnArea/src/spawn_tiles.lua +++ /dev/null @@ -1,109 +0,0 @@ -return { - {-49,-3},{-49,-2},{-49,1},{-49,2},{-49,5},{-49,6},{-48,-4},{-48,-3},{-48,-2},{-48,1},{-48,2},{-48,5},{-48,6},{-48,7},{-47,-7},{-47,-6},{-47,-5},{-47,-4},{-47,-3},{-47,-2},{-47,5},{-47,6},{-47,7},{-47,8},{-47,9},{-47,10},{-46,-8},{-46,-7},{-46,-6},{-46,-5}, - {-46,-4},{-46,-3},{-46,-2},{-46,-1},{-46,4},{-46,5},{-46,6},{-46,7},{-46,8},{-46,9},{-46,10},{-46,11},{-45,-17},{-45,-16},{-45,-15},{-45,-14},{-45,-13},{-45,-12},{-45,-9},{-45,-8},{-45,-7},{-45,-2},{-45,-1},{-45,0},{-45,1},{-45,2},{-45,3},{-45,4},{-45,5},{-45,10}, - {-45,11},{-45,12},{-45,15},{-45,16},{-45,17},{-45,18},{-45,19},{-45,20},{-44,-18},{-44,-17},{-44,-16},{-44,-15},{-44,-14},{-44,-13},{-44,-12},{-44,-9},{-44,-8},{-44,-1},{-44,0},{-44,1},{-44,2},{-44,3},{-44,4},{-44,11},{-44,12},{-44,15},{-44,16},{-44,17},{-44,18},{-44,19}, - {-44,20},{-44,21},{-43,-19},{-43,-18},{-43,-17},{-43,-1},{-43,0},{-43,1},{-43,2},{-43,3},{-43,4},{-43,20},{-43,21},{-43,22},{-42,-19},{-42,-18},{-42,-1},{-42,0},{-42,1},{-42,2},{-42,3},{-42,4},{-42,21},{-42,22},{-41,-25},{-41,-24},{-41,-19},{-41,-18},{-41,-13},{-41,-12}, - {-41,-11},{-41,-10},{-41,-5},{-41,-4},{-41,7},{-41,8},{-41,13},{-41,14},{-41,15},{-41,16},{-41,21},{-41,22},{-41,27},{-41,28},{-40,-26},{-40,-25},{-40,-24},{-40,-20},{-40,-19},{-40,-18},{-40,-13},{-40,-12},{-40,-11},{-40,-10},{-40,-5},{-40,-4},{-40,7},{-40,8},{-40,13},{-40,14}, - {-40,15},{-40,16},{-40,21},{-40,22},{-40,23},{-40,27},{-40,28},{-40,29},{-39,-27},{-39,-26},{-39,-25},{-39,-24},{-39,-21},{-39,-20},{-39,-19},{-39,-13},{-39,-12},{-39,-5},{-39,-4},{-39,-3},{-39,-2},{-39,-1},{-39,0},{-39,1},{-39,2},{-39,3},{-39,4},{-39,5},{-39,6},{-39,7}, - {-39,8},{-39,15},{-39,16},{-39,22},{-39,23},{-39,24},{-39,27},{-39,28},{-39,29},{-39,30},{-38,-27},{-38,-26},{-38,-25},{-38,-24},{-38,-21},{-38,-20},{-38,-13},{-38,-12},{-38,-5},{-38,-4},{-38,-3},{-38,-2},{-38,-1},{-38,0},{-38,1},{-38,2},{-38,3},{-38,4},{-38,5},{-38,6}, - {-38,7},{-38,8},{-38,15},{-38,16},{-38,23},{-38,24},{-38,27},{-38,28},{-38,29},{-38,30},{-37,-17},{-37,-16},{-37,-13},{-37,-12},{-37,-11},{-37,-10},{-37,-4},{-37,-3},{-37,-2},{-37,-1},{-37,0},{-37,3},{-37,4},{-37,5},{-37,6},{-37,7},{-37,13},{-37,14},{-37,15},{-37,16}, - {-37,19},{-37,20},{-36,-17},{-36,-16},{-36,-13},{-36,-12},{-36,-11},{-36,-10},{-36,-9},{-36,-3},{-36,-2},{-36,-1},{-36,0},{-36,3},{-36,4},{-36,5},{-36,6},{-36,12},{-36,13},{-36,14},{-36,15},{-36,16},{-36,19},{-36,20},{-35,-29},{-35,-28},{-35,-23},{-35,-22},{-35,-17},{-35,-16}, - {-35,-12},{-35,-11},{-35,-10},{-35,-9},{-35,-8},{-35,11},{-35,12},{-35,13},{-35,14},{-35,15},{-35,19},{-35,20},{-35,25},{-35,26},{-35,31},{-35,32},{-34,-30},{-34,-29},{-34,-28},{-34,-23},{-34,-22},{-34,-17},{-34,-16},{-34,-15},{-34,-11},{-34,-10},{-34,-9},{-34,-8},{-34,11},{-34,12}, - {-34,13},{-34,14},{-34,18},{-34,19},{-34,20},{-34,25},{-34,26},{-34,31},{-34,32},{-34,33},{-33,-31},{-33,-30},{-33,-29},{-33,-28},{-33,-23},{-33,-22},{-33,-16},{-33,-15},{-33,-14},{-33,-5},{-33,-4},{-33,-1},{-33,0},{-33,3},{-33,4},{-33,7},{-33,8},{-33,17},{-33,18},{-33,19}, - {-33,25},{-33,26},{-33,31},{-33,32},{-33,33},{-33,34},{-32,-32},{-32,-31},{-32,-30},{-32,-29},{-32,-28},{-32,-27},{-32,-23},{-32,-22},{-32,-21},{-32,-15},{-32,-14},{-32,-6},{-32,-5},{-32,-4},{-32,-1},{-32,0},{-32,3},{-32,4},{-32,7},{-32,8},{-32,9},{-32,17},{-32,18},{-32,24}, - {-32,25},{-32,26},{-32,30},{-32,31},{-32,32},{-32,33},{-32,34},{-32,35},{-31,-33},{-31,-32},{-31,-31},{-31,-30},{-31,-29},{-31,-28},{-31,-27},{-31,-26},{-31,-22},{-31,-21},{-31,-20},{-31,-19},{-31,-18},{-31,-11},{-31,-10},{-31,-9},{-31,-8},{-31,-7},{-31,-6},{-31,-5},{-31,-1},{-31,0}, - {-31,1},{-31,2},{-31,3},{-31,4},{-31,8},{-31,9},{-31,10},{-31,11},{-31,12},{-31,13},{-31,14},{-31,21},{-31,22},{-31,23},{-31,24},{-31,25},{-31,29},{-31,30},{-31,31},{-31,32},{-31,33},{-31,34},{-31,35},{-31,36},{-30,-33},{-30,-32},{-30,-31},{-30,-30},{-30,-29},{-30,-28}, - {-30,-27},{-30,-26},{-30,-21},{-30,-20},{-30,-19},{-30,-18},{-30,-11},{-30,-10},{-30,-9},{-30,-8},{-30,-7},{-30,-6},{-30,-1},{-30,0},{-30,1},{-30,2},{-30,3},{-30,4},{-30,9},{-30,10},{-30,11},{-30,12},{-30,13},{-30,14},{-30,21},{-30,22},{-30,23},{-30,24},{-30,29},{-30,30}, - {-30,31},{-30,32},{-30,33},{-30,34},{-30,35},{-30,36},{-29,-37},{-29,-36},{-29,-30},{-29,-29},{-29,-28},{-29,-27},{-29,-26},{-29,-15},{-29,-14},{-29,-10},{-29,-9},{-29,-8},{-29,-7},{-29,10},{-29,11},{-29,12},{-29,13},{-29,17},{-29,18},{-29,29},{-29,30},{-29,31},{-29,32},{-29,33}, - {-29,39},{-29,40},{-28,-38},{-28,-37},{-28,-36},{-28,-29},{-28,-28},{-28,-27},{-28,-26},{-28,-16},{-28,-15},{-28,-14},{-28,-9},{-28,-8},{-28,11},{-28,12},{-28,17},{-28,18},{-28,19},{-28,29},{-28,30},{-28,31},{-28,32},{-28,39},{-28,40},{-28,41},{-27,-39},{-27,-38},{-27,-37},{-27,-36}, - {-27,-23},{-27,-22},{-27,-19},{-27,-18},{-27,-17},{-27,-16},{-27,-15},{-27,-5},{-27,-4},{-27,-1},{-27,0},{-27,1},{-27,2},{-27,3},{-27,4},{-27,7},{-27,8},{-27,18},{-27,19},{-27,20},{-27,21},{-27,22},{-27,25},{-27,26},{-27,39},{-27,40},{-27,41},{-27,42},{-26,-39},{-26,-38}, - {-26,-37},{-26,-36},{-26,-24},{-26,-23},{-26,-22},{-26,-19},{-26,-18},{-26,-17},{-26,-16},{-26,-6},{-26,-5},{-26,-4},{-26,-1},{-26,0},{-26,1},{-26,2},{-26,3},{-26,4},{-26,7},{-26,8},{-26,9},{-26,19},{-26,20},{-26,21},{-26,22},{-26,25},{-26,26},{-26,27},{-26,39},{-26,40}, - {-26,41},{-26,42},{-25,-33},{-25,-32},{-25,-31},{-25,-30},{-25,-25},{-25,-24},{-25,-23},{-25,-22},{-25,-19},{-25,-18},{-25,-17},{-25,-9},{-25,-8},{-25,-7},{-25,-6},{-25,-5},{-25,-4},{-25,-1},{-25,0},{-25,1},{-25,2},{-25,3},{-25,4},{-25,7},{-25,8},{-25,9},{-25,10},{-25,11}, - {-25,12},{-25,20},{-25,21},{-25,22},{-25,25},{-25,26},{-25,27},{-25,28},{-25,33},{-25,34},{-25,35},{-25,36},{-24,-33},{-24,-32},{-24,-31},{-24,-30},{-24,-29},{-24,-25},{-24,-24},{-24,-23},{-24,-22},{-24,-19},{-24,-18},{-24,-9},{-24,-8},{-24,-7},{-24,-6},{-24,-5},{-24,-4},{-24,-1}, - {-24,0},{-24,1},{-24,2},{-24,3},{-24,4},{-24,7},{-24,8},{-24,9},{-24,10},{-24,11},{-24,12},{-24,21},{-24,22},{-24,25},{-24,26},{-24,27},{-24,28},{-24,32},{-24,33},{-24,34},{-24,35},{-24,36},{-23,-37},{-23,-36},{-23,-30},{-23,-29},{-23,-28},{-23,-19},{-23,-18},{-23,-15}, - {-23,-14},{-23,-9},{-23,-8},{-23,-7},{-23,-6},{-23,-5},{-23,0},{-23,1},{-23,2},{-23,3},{-23,8},{-23,9},{-23,10},{-23,11},{-23,12},{-23,17},{-23,18},{-23,21},{-23,22},{-23,31},{-23,32},{-23,33},{-23,39},{-23,40},{-22,-38},{-22,-37},{-22,-36},{-22,-29},{-22,-28},{-22,-19}, - {-22,-18},{-22,-15},{-22,-14},{-22,-13},{-22,-9},{-22,-8},{-22,-7},{-22,-6},{-22,1},{-22,2},{-22,9},{-22,10},{-22,11},{-22,12},{-22,16},{-22,17},{-22,18},{-22,21},{-22,22},{-22,31},{-22,32},{-22,39},{-22,40},{-22,41},{-21,-41},{-21,-40},{-21,-39},{-21,-38},{-21,-37},{-21,-29}, - {-21,-28},{-21,-25},{-21,-24},{-21,-23},{-21,-22},{-21,-21},{-21,-20},{-21,-19},{-21,-18},{-21,-15},{-21,-14},{-21,-13},{-21,-12},{-21,-3},{-21,-2},{-21,5},{-21,6},{-21,15},{-21,16},{-21,17},{-21,18},{-21,21},{-21,22},{-21,23},{-21,24},{-21,25},{-21,26},{-21,27},{-21,28},{-21,31}, - {-21,32},{-21,40},{-21,41},{-21,42},{-21,43},{-21,44},{-20,-42},{-20,-41},{-20,-40},{-20,-39},{-20,-38},{-20,-29},{-20,-28},{-20,-25},{-20,-24},{-20,-23},{-20,-22},{-20,-21},{-20,-20},{-20,-19},{-20,-18},{-20,-15},{-20,-14},{-20,-13},{-20,-12},{-20,-3},{-20,-2},{-20,-1},{-20,4},{-20,5}, - {-20,6},{-20,15},{-20,16},{-20,17},{-20,18},{-20,21},{-20,22},{-20,23},{-20,24},{-20,25},{-20,26},{-20,27},{-20,28},{-20,31},{-20,32},{-20,41},{-20,42},{-20,43},{-20,44},{-20,45},{-19,-43},{-19,-42},{-19,-41},{-19,-35},{-19,-34},{-19,-33},{-19,-32},{-19,-25},{-19,-24},{-19,-23}, - {-19,-15},{-19,-14},{-19,-13},{-19,-9},{-19,-8},{-19,-7},{-19,-6},{-19,-2},{-19,-1},{-19,0},{-19,1},{-19,2},{-19,3},{-19,4},{-19,5},{-19,9},{-19,10},{-19,11},{-19,12},{-19,16},{-19,17},{-19,18},{-19,26},{-19,27},{-19,28},{-19,35},{-19,36},{-19,37},{-19,38},{-19,44}, - {-19,45},{-19,46},{-18,-43},{-18,-42},{-18,-35},{-18,-34},{-18,-33},{-18,-32},{-18,-31},{-18,-26},{-18,-25},{-18,-24},{-18,-15},{-18,-14},{-18,-10},{-18,-9},{-18,-8},{-18,-7},{-18,-6},{-18,-1},{-18,0},{-18,1},{-18,2},{-18,3},{-18,4},{-18,9},{-18,10},{-18,11},{-18,12},{-18,13}, - {-18,17},{-18,18},{-18,27},{-18,28},{-18,29},{-18,34},{-18,35},{-18,36},{-18,37},{-18,38},{-18,45},{-18,46},{-17,-43},{-17,-42},{-17,-32},{-17,-31},{-17,-30},{-17,-27},{-17,-26},{-17,-25},{-17,-21},{-17,-20},{-17,-19},{-17,-18},{-17,-17},{-17,-16},{-17,-15},{-17,-14},{-17,-11},{-17,-10}, - {-17,-9},{-17,-8},{-17,-7},{-17,-6},{-17,0},{-17,1},{-17,2},{-17,3},{-17,9},{-17,10},{-17,11},{-17,12},{-17,13},{-17,14},{-17,17},{-17,18},{-17,19},{-17,20},{-17,21},{-17,22},{-17,23},{-17,24},{-17,28},{-17,29},{-17,30},{-17,33},{-17,34},{-17,35},{-17,45},{-17,46}, - {-16,-43},{-16,-42},{-16,-31},{-16,-30},{-16,-27},{-16,-26},{-16,-21},{-16,-20},{-16,-19},{-16,-18},{-16,-17},{-16,-16},{-16,-15},{-16,-14},{-16,-11},{-16,-10},{-16,-9},{-16,-8},{-16,-7},{-16,-6},{-16,1},{-16,2},{-16,9},{-16,10},{-16,11},{-16,12},{-16,13},{-16,14},{-16,17},{-16,18}, - {-16,19},{-16,20},{-16,21},{-16,22},{-16,23},{-16,24},{-16,29},{-16,30},{-16,33},{-16,34},{-16,45},{-16,46},{-15,-43},{-15,-42},{-15,-39},{-15,-38},{-15,-37},{-15,-36},{-15,-35},{-15,-34},{-15,-20},{-15,-19},{-15,-18},{-15,-17},{-15,-10},{-15,-9},{-15,-8},{-15,-7},{-15,-3},{-15,-2}, - {-15,1},{-15,2},{-15,5},{-15,6},{-15,10},{-15,11},{-15,12},{-15,13},{-15,20},{-15,21},{-15,22},{-15,23},{-15,37},{-15,38},{-15,39},{-15,40},{-15,41},{-15,42},{-15,45},{-15,46},{-14,-43},{-14,-42},{-14,-39},{-14,-38},{-14,-37},{-14,-36},{-14,-35},{-14,-34},{-14,-33},{-14,-19}, - {-14,-18},{-14,-9},{-14,-8},{-14,-4},{-14,-3},{-14,-2},{-14,1},{-14,2},{-14,5},{-14,6},{-14,7},{-14,11},{-14,12},{-14,21},{-14,22},{-14,36},{-14,37},{-14,38},{-14,39},{-14,40},{-14,41},{-14,42},{-14,45},{-14,46},{-13,-39},{-13,-38},{-13,-35},{-13,-34},{-13,-33},{-13,-32}, - {-13,-29},{-13,-28},{-13,-15},{-13,-14},{-13,-5},{-13,-4},{-13,-3},{-13,-2},{-13,5},{-13,6},{-13,7},{-13,8},{-13,17},{-13,18},{-13,31},{-13,32},{-13,35},{-13,36},{-13,37},{-13,38},{-13,41},{-13,42},{-12,-39},{-12,-38},{-12,-35},{-12,-34},{-12,-33},{-12,-32},{-12,-29},{-12,-28}, - {-12,-27},{-12,-16},{-12,-15},{-12,-14},{-12,-13},{-12,-5},{-12,-4},{-12,-3},{-12,-2},{-12,5},{-12,6},{-12,7},{-12,8},{-12,16},{-12,17},{-12,18},{-12,19},{-12,30},{-12,31},{-12,32},{-12,35},{-12,36},{-12,37},{-12,38},{-12,41},{-12,42},{-11,-43},{-11,-42},{-11,-34},{-11,-33}, - {-11,-32},{-11,-29},{-11,-28},{-11,-27},{-11,-26},{-11,-23},{-11,-22},{-11,-21},{-11,-20},{-11,-17},{-11,-16},{-11,-15},{-11,-14},{-11,-13},{-11,-12},{-11,-9},{-11,-8},{-11,1},{-11,2},{-11,11},{-11,12},{-11,15},{-11,16},{-11,17},{-11,18},{-11,19},{-11,20},{-11,23},{-11,24},{-11,25}, - {-11,26},{-11,29},{-11,30},{-11,31},{-11,32},{-11,35},{-11,36},{-11,37},{-11,45},{-11,46},{-10,-44},{-10,-43},{-10,-42},{-10,-33},{-10,-32},{-10,-29},{-10,-28},{-10,-27},{-10,-26},{-10,-23},{-10,-22},{-10,-21},{-10,-20},{-10,-17},{-10,-16},{-10,-15},{-10,-14},{-10,-13},{-10,-12},{-10,-9}, - {-10,-8},{-10,-7},{-10,0},{-10,1},{-10,2},{-10,3},{-10,10},{-10,11},{-10,12},{-10,15},{-10,16},{-10,17},{-10,18},{-10,19},{-10,20},{-10,23},{-10,24},{-10,25},{-10,26},{-10,29},{-10,30},{-10,31},{-10,32},{-10,35},{-10,36},{-10,45},{-10,46},{-10,47},{-9,-45},{-9,-44}, - {-9,-43},{-9,-29},{-9,-28},{-9,-27},{-9,-23},{-9,-22},{-9,-21},{-9,-20},{-9,-17},{-9,-16},{-9,-15},{-9,-14},{-9,-13},{-9,-8},{-9,-7},{-9,-6},{-9,-5},{-9,-1},{-9,0},{-9,1},{-9,2},{-9,3},{-9,4},{-9,8},{-9,9},{-9,10},{-9,11},{-9,16},{-9,17},{-9,18}, - {-9,19},{-9,20},{-9,23},{-9,24},{-9,25},{-9,26},{-9,30},{-9,31},{-9,32},{-9,46},{-9,47},{-9,48},{-8,-45},{-8,-44},{-8,-30},{-8,-29},{-8,-28},{-8,-24},{-8,-23},{-8,-22},{-8,-21},{-8,-20},{-8,-17},{-8,-16},{-8,-15},{-8,-14},{-8,-7},{-8,-6},{-8,-5},{-8,-4}, - {-8,-1},{-8,0},{-8,1},{-8,2},{-8,3},{-8,4},{-8,7},{-8,8},{-8,9},{-8,10},{-8,17},{-8,18},{-8,19},{-8,20},{-8,23},{-8,24},{-8,25},{-8,26},{-8,27},{-8,31},{-8,32},{-8,33},{-8,47},{-8,48},{-7,-45},{-7,-44},{-7,-39},{-7,-38},{-7,-37},{-7,-36}, - {-7,-31},{-7,-30},{-7,-29},{-7,-25},{-7,-24},{-7,-23},{-7,-22},{-7,-21},{-7,-11},{-7,-10},{-7,-7},{-7,-6},{-7,-5},{-7,-4},{-7,7},{-7,8},{-7,9},{-7,10},{-7,13},{-7,14},{-7,24},{-7,25},{-7,26},{-7,27},{-7,28},{-7,32},{-7,33},{-7,34},{-7,39},{-7,40}, - {-7,41},{-7,42},{-7,47},{-7,48},{-6,-46},{-6,-45},{-6,-44},{-6,-39},{-6,-38},{-6,-37},{-6,-36},{-6,-35},{-6,-31},{-6,-30},{-6,-25},{-6,-24},{-6,-23},{-6,-22},{-6,-12},{-6,-11},{-6,-10},{-6,-6},{-6,-5},{-6,8},{-6,9},{-6,13},{-6,14},{-6,15},{-6,25},{-6,26}, - {-6,27},{-6,28},{-6,33},{-6,34},{-6,38},{-6,39},{-6,40},{-6,41},{-6,42},{-6,47},{-6,48},{-6,49},{-5,-47},{-5,-46},{-5,-45},{-5,-44},{-5,-37},{-5,-36},{-5,-35},{-5,-34},{-5,-19},{-5,-18},{-5,-13},{-5,-12},{-5,-11},{-5,-10},{-5,-1},{-5,0},{-5,1},{-5,2}, - {-5,3},{-5,4},{-5,13},{-5,14},{-5,15},{-5,16},{-5,21},{-5,22},{-5,37},{-5,38},{-5,39},{-5,40},{-5,47},{-5,48},{-5,49},{-5,50},{-4,-47},{-4,-46},{-4,-45},{-4,-44},{-4,-43},{-4,-37},{-4,-36},{-4,-35},{-4,-34},{-4,-19},{-4,-18},{-4,-17},{-4,-13},{-4,-12}, - {-4,-11},{-4,-10},{-4,-2},{-4,-1},{-4,0},{-4,1},{-4,2},{-4,3},{-4,4},{-4,5},{-4,13},{-4,14},{-4,15},{-4,16},{-4,20},{-4,21},{-4,22},{-4,37},{-4,38},{-4,39},{-4,40},{-4,46},{-4,47},{-4,48},{-4,49},{-4,50},{-3,-44},{-3,-43},{-3,-42},{-3,-41}, - {-3,-40},{-3,-37},{-3,-36},{-3,-35},{-3,-34},{-3,-31},{-3,-30},{-3,-29},{-3,-28},{-3,-25},{-3,-24},{-3,-23},{-3,-22},{-3,-18},{-3,-17},{-3,-16},{-3,-7},{-3,-6},{-3,-3},{-3,-2},{-3,-1},{-3,0},{-3,3},{-3,4},{-3,5},{-3,6},{-3,9},{-3,10},{-3,19},{-3,20}, - {-3,21},{-3,25},{-3,26},{-3,27},{-3,28},{-3,31},{-3,32},{-3,33},{-3,34},{-3,37},{-3,38},{-3,39},{-3,40},{-3,43},{-3,44},{-3,45},{-3,46},{-3,47},{-2,-43},{-2,-42},{-2,-41},{-2,-40},{-2,-37},{-2,-36},{-2,-35},{-2,-34},{-2,-31},{-2,-30},{-2,-29},{-2,-28}, - {-2,-25},{-2,-24},{-2,-23},{-2,-22},{-2,-21},{-2,-17},{-2,-16},{-2,-15},{-2,-8},{-2,-7},{-2,-6},{-2,-3},{-2,-2},{-2,-1},{-2,0},{-2,3},{-2,4},{-2,5},{-2,6},{-2,9},{-2,10},{-2,11},{-2,18},{-2,19},{-2,20},{-2,24},{-2,25},{-2,26},{-2,27},{-2,28}, - {-2,31},{-2,32},{-2,33},{-2,34},{-2,37},{-2,38},{-2,39},{-2,40},{-2,43},{-2,44},{-2,45},{-2,46},{-1,-47},{-1,-46},{-1,-43},{-1,-42},{-1,-41},{-1,-40},{-1,-37},{-1,-36},{-1,-29},{-1,-28},{-1,-25},{-1,-24},{-1,-23},{-1,-22},{-1,-21},{-1,-20},{-1,-17},{-1,-16}, - {-1,-15},{-1,-14},{-1,-13},{-1,-12},{-1,-9},{-1,-8},{-1,-7},{-1,-6},{-1,-3},{-1,-2},{-1,5},{-1,6},{-1,9},{-1,10},{-1,11},{-1,12},{-1,15},{-1,16},{-1,17},{-1,18},{-1,19},{-1,20},{-1,23},{-1,24},{-1,25},{-1,26},{-1,27},{-1,28},{-1,31},{-1,32}, - {-1,39},{-1,40},{-1,43},{-1,44},{-1,45},{-1,46},{-1,49},{-1,50},{0,-47},{0,-46},{0,-43},{0,-42},{0,-41},{0,-40},{0,-37},{0,-36},{0,-29},{0,-28},{0,-25},{0,-24},{0,-23},{0,-22},{0,-21},{0,-20},{0,-17},{0,-16},{0,-15},{0,-14},{0,-13},{0,-12}, - {0,-9},{0,-8},{0,-7},{0,-6},{0,-3},{0,-2},{0,5},{0,6},{0,9},{0,10},{0,11},{0,12},{0,15},{0,16},{0,17},{0,18},{0,19},{0,20},{0,23},{0,24},{0,25},{0,26},{0,27},{0,28},{0,31},{0,32},{0,39},{0,40},{0,43},{0,44}, - {0,45},{0,46},{0,49},{0,50},{1,-43},{1,-42},{1,-41},{1,-40},{1,-37},{1,-36},{1,-35},{1,-34},{1,-31},{1,-30},{1,-29},{1,-28},{1,-25},{1,-24},{1,-23},{1,-22},{1,-21},{1,-17},{1,-16},{1,-15},{1,-8},{1,-7},{1,-6},{1,-3},{1,-2},{1,-1}, - {1,0},{1,3},{1,4},{1,5},{1,6},{1,9},{1,10},{1,11},{1,18},{1,19},{1,20},{1,24},{1,25},{1,26},{1,27},{1,28},{1,31},{1,32},{1,33},{1,34},{1,37},{1,38},{1,39},{1,40},{1,43},{1,44},{1,45},{1,46},{2,-44},{2,-43}, - {2,-42},{2,-41},{2,-40},{2,-37},{2,-36},{2,-35},{2,-34},{2,-31},{2,-30},{2,-29},{2,-28},{2,-25},{2,-24},{2,-23},{2,-22},{2,-18},{2,-17},{2,-16},{2,-7},{2,-6},{2,-3},{2,-2},{2,-1},{2,0},{2,3},{2,4},{2,5},{2,6},{2,9},{2,10}, - {2,19},{2,20},{2,21},{2,25},{2,26},{2,27},{2,28},{2,31},{2,32},{2,33},{2,34},{2,37},{2,38},{2,39},{2,40},{2,43},{2,44},{2,45},{2,46},{2,47},{3,-47},{3,-46},{3,-45},{3,-44},{3,-43},{3,-37},{3,-36},{3,-35},{3,-34},{3,-19}, - {3,-18},{3,-17},{3,-13},{3,-12},{3,-11},{3,-10},{3,-2},{3,-1},{3,0},{3,1},{3,2},{3,3},{3,4},{3,5},{3,13},{3,14},{3,15},{3,16},{3,20},{3,21},{3,22},{3,37},{3,38},{3,39},{3,40},{3,46},{3,47},{3,48},{3,49},{3,50}, - {4,-47},{4,-46},{4,-45},{4,-44},{4,-37},{4,-36},{4,-35},{4,-34},{4,-19},{4,-18},{4,-13},{4,-12},{4,-11},{4,-10},{4,-1},{4,0},{4,1},{4,2},{4,3},{4,4},{4,13},{4,14},{4,15},{4,16},{4,21},{4,22},{4,37},{4,38},{4,39},{4,40}, - {4,47},{4,48},{4,49},{4,50},{5,-46},{5,-45},{5,-44},{5,-39},{5,-38},{5,-37},{5,-36},{5,-35},{5,-31},{5,-30},{5,-25},{5,-24},{5,-23},{5,-22},{5,-12},{5,-11},{5,-10},{5,-6},{5,-5},{5,8},{5,9},{5,13},{5,14},{5,15},{5,25},{5,26}, - {5,27},{5,28},{5,33},{5,34},{5,38},{5,39},{5,40},{5,41},{5,42},{5,47},{5,48},{5,49},{6,-45},{6,-44},{6,-39},{6,-38},{6,-37},{6,-36},{6,-31},{6,-30},{6,-29},{6,-25},{6,-24},{6,-23},{6,-22},{6,-21},{6,-11},{6,-10},{6,-7},{6,-6}, - {6,-5},{6,-4},{6,7},{6,8},{6,9},{6,10},{6,13},{6,14},{6,24},{6,25},{6,26},{6,27},{6,28},{6,32},{6,33},{6,34},{6,39},{6,40},{6,41},{6,42},{6,47},{6,48},{7,-45},{7,-44},{7,-30},{7,-29},{7,-28},{7,-24},{7,-23},{7,-22}, - {7,-21},{7,-20},{7,-17},{7,-16},{7,-15},{7,-14},{7,-7},{7,-6},{7,-5},{7,-4},{7,-1},{7,0},{7,1},{7,2},{7,3},{7,4},{7,7},{7,8},{7,9},{7,10},{7,17},{7,18},{7,19},{7,20},{7,23},{7,24},{7,25},{7,26},{7,27},{7,31}, - {7,32},{7,33},{7,47},{7,48},{8,-45},{8,-44},{8,-43},{8,-29},{8,-28},{8,-27},{8,-23},{8,-22},{8,-21},{8,-20},{8,-17},{8,-16},{8,-15},{8,-14},{8,-13},{8,-8},{8,-7},{8,-6},{8,-5},{8,-1},{8,0},{8,1},{8,2},{8,3},{8,4},{8,8}, - {8,9},{8,10},{8,11},{8,16},{8,17},{8,18},{8,19},{8,20},{8,23},{8,24},{8,25},{8,26},{8,30},{8,31},{8,32},{8,46},{8,47},{8,48},{9,-44},{9,-43},{9,-42},{9,-33},{9,-32},{9,-29},{9,-28},{9,-27},{9,-26},{9,-23},{9,-22},{9,-21}, - {9,-20},{9,-17},{9,-16},{9,-15},{9,-14},{9,-13},{9,-12},{9,-9},{9,-8},{9,-7},{9,0},{9,1},{9,2},{9,3},{9,10},{9,11},{9,12},{9,15},{9,16},{9,17},{9,18},{9,19},{9,20},{9,23},{9,24},{9,25},{9,26},{9,29},{9,30},{9,31}, - {9,32},{9,35},{9,36},{9,45},{9,46},{9,47},{10,-43},{10,-42},{10,-34},{10,-33},{10,-32},{10,-29},{10,-28},{10,-27},{10,-26},{10,-23},{10,-22},{10,-21},{10,-20},{10,-17},{10,-16},{10,-15},{10,-14},{10,-13},{10,-12},{10,-9},{10,-8},{10,1},{10,2},{10,11}, - {10,12},{10,15},{10,16},{10,17},{10,18},{10,19},{10,20},{10,23},{10,24},{10,25},{10,26},{10,29},{10,30},{10,31},{10,32},{10,35},{10,36},{10,37},{10,45},{10,46},{11,-39},{11,-38},{11,-35},{11,-34},{11,-33},{11,-32},{11,-29},{11,-28},{11,-27},{11,-16}, - {11,-15},{11,-14},{11,-13},{11,-5},{11,-4},{11,-3},{11,-2},{11,5},{11,6},{11,7},{11,8},{11,16},{11,17},{11,18},{11,19},{11,30},{11,31},{11,32},{11,35},{11,36},{11,37},{11,38},{11,41},{11,42},{12,-39},{12,-38},{12,-35},{12,-34},{12,-33},{12,-32}, - {12,-29},{12,-28},{12,-15},{12,-14},{12,-5},{12,-4},{12,-3},{12,-2},{12,5},{12,6},{12,7},{12,8},{12,17},{12,18},{12,31},{12,32},{12,35},{12,36},{12,37},{12,38},{12,41},{12,42},{13,-43},{13,-42},{13,-39},{13,-38},{13,-37},{13,-36},{13,-35},{13,-34}, - {13,-33},{13,-19},{13,-18},{13,-9},{13,-8},{13,-4},{13,-3},{13,-2},{13,1},{13,2},{13,5},{13,6},{13,7},{13,11},{13,12},{13,21},{13,22},{13,36},{13,37},{13,38},{13,39},{13,40},{13,41},{13,42},{13,45},{13,46},{14,-43},{14,-42},{14,-39},{14,-38}, - {14,-37},{14,-36},{14,-35},{14,-34},{14,-20},{14,-19},{14,-18},{14,-17},{14,-10},{14,-9},{14,-8},{14,-7},{14,-3},{14,-2},{14,1},{14,2},{14,5},{14,6},{14,10},{14,11},{14,12},{14,13},{14,20},{14,21},{14,22},{14,23},{14,37},{14,38},{14,39},{14,40}, - {14,41},{14,42},{14,45},{14,46},{15,-43},{15,-42},{15,-31},{15,-30},{15,-27},{15,-26},{15,-21},{15,-20},{15,-19},{15,-18},{15,-17},{15,-16},{15,-15},{15,-14},{15,-11},{15,-10},{15,-9},{15,-8},{15,-7},{15,-6},{15,1},{15,2},{15,9},{15,10},{15,11},{15,12}, - {15,13},{15,14},{15,17},{15,18},{15,19},{15,20},{15,21},{15,22},{15,23},{15,24},{15,29},{15,30},{15,33},{15,34},{15,45},{15,46},{16,-43},{16,-42},{16,-32},{16,-31},{16,-30},{16,-27},{16,-26},{16,-25},{16,-21},{16,-20},{16,-19},{16,-18},{16,-17},{16,-16}, - {16,-15},{16,-14},{16,-11},{16,-10},{16,-9},{16,-8},{16,-7},{16,-6},{16,0},{16,1},{16,2},{16,3},{16,9},{16,10},{16,11},{16,12},{16,13},{16,14},{16,17},{16,18},{16,19},{16,20},{16,21},{16,22},{16,23},{16,24},{16,28},{16,29},{16,30},{16,33}, - {16,34},{16,35},{16,45},{16,46},{17,-43},{17,-42},{17,-35},{17,-34},{17,-33},{17,-32},{17,-31},{17,-26},{17,-25},{17,-24},{17,-15},{17,-14},{17,-10},{17,-9},{17,-8},{17,-7},{17,-6},{17,-1},{17,0},{17,1},{17,2},{17,3},{17,4},{17,9},{17,10},{17,11}, - {17,12},{17,13},{17,17},{17,18},{17,27},{17,28},{17,29},{17,34},{17,35},{17,36},{17,37},{17,38},{17,45},{17,46},{18,-43},{18,-42},{18,-41},{18,-35},{18,-34},{18,-33},{18,-32},{18,-25},{18,-24},{18,-23},{18,-15},{18,-14},{18,-13},{18,-9},{18,-8},{18,-7}, - {18,-6},{18,-2},{18,-1},{18,0},{18,1},{18,2},{18,3},{18,4},{18,5},{18,9},{18,10},{18,11},{18,12},{18,16},{18,17},{18,18},{18,26},{18,27},{18,28},{18,35},{18,36},{18,37},{18,38},{18,44},{18,45},{18,46},{19,-42},{19,-41},{19,-40},{19,-39}, - {19,-38},{19,-29},{19,-28},{19,-25},{19,-24},{19,-23},{19,-22},{19,-21},{19,-20},{19,-19},{19,-18},{19,-15},{19,-14},{19,-13},{19,-12},{19,-3},{19,-2},{19,-1},{19,4},{19,5},{19,6},{19,15},{19,16},{19,17},{19,18},{19,21},{19,22},{19,23},{19,24},{19,25}, - {19,26},{19,27},{19,28},{19,31},{19,32},{19,41},{19,42},{19,43},{19,44},{19,45},{20,-41},{20,-40},{20,-39},{20,-38},{20,-37},{20,-29},{20,-28},{20,-25},{20,-24},{20,-23},{20,-22},{20,-21},{20,-20},{20,-19},{20,-18},{20,-15},{20,-14},{20,-13},{20,-12},{20,-3}, - {20,-2},{20,5},{20,6},{20,15},{20,16},{20,17},{20,18},{20,21},{20,22},{20,23},{20,24},{20,25},{20,26},{20,27},{20,28},{20,31},{20,32},{20,40},{20,41},{20,42},{20,43},{20,44},{21,-38},{21,-37},{21,-36},{21,-29},{21,-28},{21,-19},{21,-18},{21,-15}, - {21,-14},{21,-13},{21,-9},{21,-8},{21,-7},{21,-6},{21,1},{21,2},{21,9},{21,10},{21,11},{21,12},{21,16},{21,17},{21,18},{21,21},{21,22},{21,31},{21,32},{21,39},{21,40},{21,41},{22,-37},{22,-36},{22,-30},{22,-29},{22,-28},{22,-19},{22,-18},{22,-15}, - {22,-14},{22,-9},{22,-8},{22,-7},{22,-6},{22,-5},{22,0},{22,1},{22,2},{22,3},{22,8},{22,9},{22,10},{22,11},{22,12},{22,17},{22,18},{22,21},{22,22},{22,31},{22,32},{22,33},{22,39},{22,40},{23,-33},{23,-32},{23,-31},{23,-30},{23,-29},{23,-25}, - {23,-24},{23,-23},{23,-22},{23,-19},{23,-18},{23,-9},{23,-8},{23,-7},{23,-6},{23,-5},{23,-4},{23,-1},{23,0},{23,1},{23,2},{23,3},{23,4},{23,7},{23,8},{23,9},{23,10},{23,11},{23,12},{23,21},{23,22},{23,25},{23,26},{23,27},{23,28},{23,32}, - {23,33},{23,34},{23,35},{23,36},{24,-33},{24,-32},{24,-31},{24,-30},{24,-25},{24,-24},{24,-23},{24,-22},{24,-19},{24,-18},{24,-17},{24,-9},{24,-8},{24,-7},{24,-6},{24,-5},{24,-4},{24,-1},{24,0},{24,1},{24,2},{24,3},{24,4},{24,7},{24,8},{24,9}, - {24,10},{24,11},{24,12},{24,20},{24,21},{24,22},{24,25},{24,26},{24,27},{24,28},{24,33},{24,34},{24,35},{24,36},{25,-39},{25,-38},{25,-37},{25,-36},{25,-24},{25,-23},{25,-22},{25,-19},{25,-18},{25,-17},{25,-16},{25,-6},{25,-5},{25,-4},{25,-1},{25,0}, - {25,1},{25,2},{25,3},{25,4},{25,7},{25,8},{25,9},{25,19},{25,20},{25,21},{25,22},{25,25},{25,26},{25,27},{25,39},{25,40},{25,41},{25,42},{26,-39},{26,-38},{26,-37},{26,-36},{26,-23},{26,-22},{26,-19},{26,-18},{26,-17},{26,-16},{26,-15},{26,-5}, - {26,-4},{26,-1},{26,0},{26,1},{26,2},{26,3},{26,4},{26,7},{26,8},{26,18},{26,19},{26,20},{26,21},{26,22},{26,25},{26,26},{26,39},{26,40},{26,41},{26,42},{27,-38},{27,-37},{27,-36},{27,-29},{27,-28},{27,-27},{27,-26},{27,-16},{27,-15},{27,-14}, - {27,-9},{27,-8},{27,11},{27,12},{27,17},{27,18},{27,19},{27,29},{27,30},{27,31},{27,32},{27,39},{27,40},{27,41},{28,-37},{28,-36},{28,-30},{28,-29},{28,-28},{28,-27},{28,-26},{28,-15},{28,-14},{28,-10},{28,-9},{28,-8},{28,-7},{28,10},{28,11},{28,12}, - {28,13},{28,17},{28,18},{28,29},{28,30},{28,31},{28,32},{28,33},{28,39},{28,40},{29,-33},{29,-32},{29,-31},{29,-30},{29,-29},{29,-28},{29,-27},{29,-26},{29,-21},{29,-20},{29,-19},{29,-18},{29,-11},{29,-10},{29,-9},{29,-8},{29,-7},{29,-6},{29,-1},{29,0}, - {29,1},{29,2},{29,3},{29,4},{29,9},{29,10},{29,11},{29,12},{29,13},{29,14},{29,21},{29,22},{29,23},{29,24},{29,29},{29,30},{29,31},{29,32},{29,33},{29,34},{29,35},{29,36},{30,-33},{30,-32},{30,-31},{30,-30},{30,-29},{30,-28},{30,-27},{30,-26}, - {30,-22},{30,-21},{30,-20},{30,-19},{30,-18},{30,-11},{30,-10},{30,-9},{30,-8},{30,-7},{30,-6},{30,-5},{30,-1},{30,0},{30,1},{30,2},{30,3},{30,4},{30,8},{30,9},{30,10},{30,11},{30,12},{30,13},{30,14},{30,21},{30,22},{30,23},{30,24},{30,25}, - {30,29},{30,30},{30,31},{30,32},{30,33},{30,34},{30,35},{30,36},{31,-32},{31,-31},{31,-30},{31,-29},{31,-28},{31,-27},{31,-23},{31,-22},{31,-21},{31,-15},{31,-14},{31,-6},{31,-5},{31,-4},{31,-1},{31,0},{31,3},{31,4},{31,7},{31,8},{31,9},{31,17}, - {31,18},{31,24},{31,25},{31,26},{31,30},{31,31},{31,32},{31,33},{31,34},{31,35},{32,-31},{32,-30},{32,-29},{32,-28},{32,-23},{32,-22},{32,-16},{32,-15},{32,-14},{32,-5},{32,-4},{32,-1},{32,0},{32,3},{32,4},{32,7},{32,8},{32,17},{32,18},{32,19}, - {32,25},{32,26},{32,31},{32,32},{32,33},{32,34},{33,-30},{33,-29},{33,-28},{33,-23},{33,-22},{33,-17},{33,-16},{33,-15},{33,-11},{33,-10},{33,-9},{33,-8},{33,11},{33,12},{33,13},{33,14},{33,18},{33,19},{33,20},{33,25},{33,26},{33,31},{33,32},{33,33}, - {34,-29},{34,-28},{34,-23},{34,-22},{34,-17},{34,-16},{34,-12},{34,-11},{34,-10},{34,-9},{34,-8},{34,11},{34,12},{34,13},{34,14},{34,15},{34,19},{34,20},{34,25},{34,26},{34,31},{34,32},{35,-17},{35,-16},{35,-13},{35,-12},{35,-11},{35,-10},{35,-9},{35,-3}, - {35,-2},{35,-1},{35,0},{35,3},{35,4},{35,5},{35,6},{35,12},{35,13},{35,14},{35,15},{35,16},{35,19},{35,20},{36,-17},{36,-16},{36,-13},{36,-12},{36,-11},{36,-10},{36,-4},{36,-3},{36,-2},{36,-1},{36,0},{36,3},{36,4},{36,5},{36,6},{36,7}, - {36,13},{36,14},{36,15},{36,16},{36,19},{36,20},{37,-27},{37,-26},{37,-25},{37,-24},{37,-21},{37,-20},{37,-13},{37,-12},{37,-5},{37,-4},{37,-3},{37,-2},{37,-1},{37,0},{37,1},{37,2},{37,3},{37,4},{37,5},{37,6},{37,7},{37,8},{37,15},{37,16}, - {37,23},{37,24},{37,27},{37,28},{37,29},{37,30},{38,-27},{38,-26},{38,-25},{38,-24},{38,-21},{38,-20},{38,-19},{38,-13},{38,-12},{38,-5},{38,-4},{38,-3},{38,-2},{38,-1},{38,0},{38,1},{38,2},{38,3},{38,4},{38,5},{38,6},{38,7},{38,8},{38,15}, - {38,16},{38,22},{38,23},{38,24},{38,27},{38,28},{38,29},{38,30},{39,-26},{39,-25},{39,-24},{39,-20},{39,-19},{39,-18},{39,-13},{39,-12},{39,-11},{39,-10},{39,-5},{39,-4},{39,7},{39,8},{39,13},{39,14},{39,15},{39,16},{39,21},{39,22},{39,23},{39,27}, - {39,28},{39,29},{40,-25},{40,-24},{40,-19},{40,-18},{40,-13},{40,-12},{40,-11},{40,-10},{40,-5},{40,-4},{40,7},{40,8},{40,13},{40,14},{40,15},{40,16},{40,21},{40,22},{40,27},{40,28},{41,-19},{41,-18},{41,-1},{41,0},{41,1},{41,2},{41,3},{41,4}, - {41,21},{41,22},{42,-19},{42,-18},{42,-17},{42,-1},{42,0},{42,1},{42,2},{42,3},{42,4},{42,20},{42,21},{42,22},{43,-18},{43,-17},{43,-16},{43,-15},{43,-14},{43,-13},{43,-12},{43,-9},{43,-8},{43,-1},{43,0},{43,1},{43,2},{43,3},{43,4},{43,11}, - {43,12},{43,15},{43,16},{43,17},{43,18},{43,19},{43,20},{43,21},{44,-17},{44,-16},{44,-15},{44,-14},{44,-13},{44,-12},{44,-9},{44,-8},{44,-7},{44,-2},{44,-1},{44,0},{44,1},{44,2},{44,3},{44,4},{44,5},{44,10},{44,11},{44,12},{44,15},{44,16}, - {44,17},{44,18},{44,19},{44,20},{45,-8},{45,-7},{45,-6},{45,-5},{45,-4},{45,-3},{45,-2},{45,-1},{45,4},{45,5},{45,6},{45,7},{45,8},{45,9},{45,10},{45,11},{46,-7},{46,-6},{46,-5},{46,-4},{46,-3},{46,-2},{46,5},{46,6},{46,7},{46,8}, - {46,9},{46,10},{47,-4},{47,-3},{47,-2},{47,1},{47,2},{47,5},{47,6},{47,7},{48,-3},{48,-2},{48,1},{48,2},{48,5},{48,6} -} \ No newline at end of file diff --git a/old/modules/DONE/WarpPoints/control.lua b/old/modules/DONE/WarpPoints/control.lua deleted file mode 100644 index 19b5a9ad..00000000 --- a/old/modules/DONE/WarpPoints/control.lua +++ /dev/null @@ -1,250 +0,0 @@ ---- Creates a warp point system which makes moving around large maps easier. --- @module WarpPoints@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Gui = require('ExpGamingCore.Gui') -local Game = require('FactorioStdLib.Game') -local Role -- ExpGamingCore.Role@^4.0.0 - --- Local Variables -local warp_tiles = require(module_path..'/src/warp_tiles') -local warp_entities = require(module_path..'/src/warp_entities') - -local warp_radius = 4 -local spawn_warp_scale = 5 -local warp_tile = 'tutorial-grid' -local warp_limit = 60 -local warp_item = 'discharge-defense-equipment' -local global_offset = {x=0,y=0} -local warp_min_distance = 25 - --- Module Define -local global -local module_verbose = false -local ThisModule = { - on_init=function(self) - if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end - if loaded_modules['ExpGamingCore.Command'] then require(module_path..'/src/commands',{self=self,warps=global,warp_min_distance=warp_min_distance}) end - end -} - --- Global Define -global = { - warps={}, -- 0,0 is always a warp - cooldowns={} -} -Global.register(global,function(tbl) global = tbl end) - --- Function Define - ---- Removes a warp point from the list, and then updates the gui --- @usage ThisModule.remove_warp_point(name) -- name cant be spawn --- @tparam string name the name of the warp point -function ThisModule.remove_warp_point(name) - local warp = global.warps[name] - if not warp then return end - local surface = game.surfaces[warp.surface] - local offset = warp.position - local tiles = {} - -- clears the area where the warp was - for x = -warp_radius, warp_radius do - for y = -warp_radius, warp_radius do - if x^2+y^2 < (warp_radius+1)^2 then - table.insert(tiles,{name=warp.old_tile,position={x+offset.x,y+offset.y}}) - local entities = surface.find_entities_filtered{area={{x+offset.x-1,y+offset.y-1},{x+offset.x,y+offset.y}}} - for _,entity in pairs(entities) do if entity.name ~= 'player' then entity.destroy() end end - end - end - end - surface.set_tiles(tiles) - if warp.tag.valid then warp.tag.destroy() end - global.warps[name] = nil - ThisModule.Gui() -end - ---- Adds a warp point from the list, and then updates the gui --- @usage ThisModule.make_warp_point({x=10,y=10},surface,force,name) --- @tparam table position the position of the new warp point --- @tparam surface surface the surface that the warp point is on --- @tparam force force the force that the warp point will belong to --- @tparam string name the name of the warp point to be made -function ThisModule.make_warp_point(position,surface,force,warpName) - local warp = global.warps[warpName] - if warp then return end - local offset = {x=math.floor(position.x),y=math.floor(position.y)} - local old_tile = surface.get_tile(offset).name - local base_tiles = {} - local tiles = {} - -- this makes a base plate to make the warp point - for x = -warp_radius, warp_radius do - for y = -warp_radius, warp_radius do - if x^2+y^2 < warp_radius^2 then - table.insert(base_tiles,{name=warp_tile,position={x+offset.x,y+offset.y}}) - end - end - end - surface.set_tiles(base_tiles) - -- this adds the pattern and entities - for _,pos in pairs(warp_tiles) do - table.insert(tiles,{name=warp_tile,position={pos[1]+offset.x+global_offset.x,pos[2]+offset.y+global_offset.y}}) - end - surface.set_tiles(tiles) - for _,entity in pairs(warp_entities) do - entity = surface.create_entity{name=entity[1],position={entity[2]+offset.x+global_offset.x,entity[3]+offset.y+global_offset.y},force='neutral'} - entity.destructible = false; entity.health = 0; entity.minable = false; entity.rotatable = false - end - -- creates a tag on the map for the wap point - local tag = force.add_chart_tag(surface,{ - position={offset.x+0.5,offset.y+0.5}, - text='Warp: '..warpName, - icon={type='item',name=warp_item} - }) - global.warps[warpName] = {tag=tag,surface=surface.index,position=tag.position,old_tile=old_tile} - local _temp = {spawn=global.warps.spawn} - global.warps.spawn = nil - for name,data in pairs(table.keysort(global.warps)) do _temp[name] = data end - global.warps = _temp - ThisModule.Gui() -end - -local remove_warp = Gui.inputs{ - type='button', - name='remove-warp-point', - caption='utility/remove', - tooltip={'WarpPoints.remove-tooltip'} -}:on_event('click',function(event) - local name = event.element.parent.name - ThisModule.remove_warp_point(name) -end) - -local go_to_warp = Gui.inputs{ - type='button', - name='go-to-warp-point', - caption='utility/export_slot', - tooltip={'WarpPoints.go-to-tooltip'} -}:on_event('click',function(event) - local player = Game.get_player(event) - local cooldown = global.cooldowns[event.player_index] or 0 - local warp = global.warps[event.element.parent.name] - if not warp then return end - if cooldown > 0 then player_return({'WarpPoints.cooldown',cooldown},nil,event) return end - if player.vehicle then player.vehicle.set_driver(nil) end - if player.vehicle then player.vehicle.set_passenger(nil) end - if player.vehicle then return end - local surface = game.surfaces[warp.surface] - player.teleport(surface.find_non_colliding_position('player',warp.position,32,1),surface) - if not Role and not player.admin or Role and not Role.allowed(player,'always-warp') then - event.element.parent.parent.parent.parent.style.visible = false - global.cooldowns[event.player_index] = warp_limit - end -end) - -ThisModule.Gui = Gui.left{ - name='warp-list', - caption='item/'..warp_item, - tooltip={'WarpPoints.tooltip'}, - draw=function(self,frame) - local player = Game.get_player(frame.player_index) - frame.caption={'WarpPoints.name'} - local warp_list = frame.add{ - type='scroll-pane', - direction='vertical', - vertical_scroll_policy='auto', - horizontal_scroll_policy='never' - } - warp_list.vertical_scroll_policy = 'auto' - warp_list.style.maximal_height = 150 - local table = warp_list.add{ - type='table', - column_count=2 - } - for name,warp in pairs(global.warps) do - if not warp.tag or not warp.tag.valid then - warp.tag = player.force.add_chart_tag(game.surfaces[warp.surface],{ - position=warp.position, - text='Warp: '..name, - icon={type='item',name=warp_item} - }) - end - table.add{ - type='label', - caption=name, - style='caption_label' - } - local _flow = table.add{ - type='flow', - name=name - } - local btn = go_to_warp(_flow) - btn.style.height = 20 - btn.style.width = 20 - if not Role and player.admin and name ~= 'spawn' or Role and Role.allowed(player,'make-warp') and name ~= 'spawn' then - local btn = remove_warp(_flow) - btn.style.height = 20 - btn.style.width = 20 - end - end - local cooldown = global.cooldowns[player.index] or 0 - if cooldown > 0 then frame.style.visible = false return - elseif not Role and player.admin or Role and Role.allowed(player,'always-warp') then return - elseif player.surface.get_tile(player.position).name == warp_tile - and player.surface.name == 'nauvis' - then return - elseif player.position.x^2+player.position.y^2 < (warp_radius*spawn_warp_scale)^2 then return - else frame.style.visible = false end - end, - can_open=function(player) - local cooldown = global.cooldowns[player.index] or 0 - if not Role and player.admin or Role and Role.allowed(player,'always-warp') then return true - elseif player.surface.get_tile(player.position).name == warp_tile - and player.surface.name == 'nauvis' - then return true - elseif player.position.x^2+player.position.y^2 < (warp_radius*spawn_warp_scale)^2 then return true - elseif cooldown > 0 then return {'WarpPoints.cooldown',cooldown} - else return {'WarpPoints.not-on-warp'} end - end, - open_on_join=true -} - --- Event Handlers Define -Event.add(defines.events.on_tick,function(event) - if not (event.tick % 60 == 0) then return end - for index,time in pairs(global.cooldowns) do - if time > 0 then - global.cooldowns[index] = time-1 - if global.cooldowns[index] == 0 then player_return({'WarpPoints.cooldown-zero'},defines.textcolor.low,index) end - end - end -end) - -Event.add(defines.events.on_player_changed_position, function(event) - local player = Game.get_player(event) - local cooldown = global.cooldowns[player.index] or 0 - local tile = player.surface.get_tile(player.position).name - if not Role and player.admin or Role and not Role.allowed(player,'always-warp') and cooldown == 0 then - if tile == warp_tile and player.surface.name == 'nauvis' then - ThisModule.Gui:open(player) - elseif player.position.x^2+player.position.y^2 < (warp_radius*spawn_warp_scale)^2 then - ThisModule.Gui:open(player) - else ThisModule.Gui:close(player) end - end -end) - -Event.add(defines.events.on_player_created, function(event) - if event.player_index == 1 then - local player = Game.get_player(event) - player.force.chart(player.surface, {{player.position.x - 20, player.position.y - 20}, {player.position.x + 20, player.position.y + 20}}) - local tag = player.force.add_chart_tag(player.surface,{ - position={0,0}, - text='Warp: spawn', - icon={type='item',name=warp_item} - }) - global.warps['spawn'] = {tag=tag,surface=player.surface.index,position={x=0,y=0}} - end -end) - --- Module Return -return ThisModule \ No newline at end of file diff --git a/old/modules/DONE/WarpPoints/locale/de.cfg b/old/modules/DONE/WarpPoints/locale/de.cfg deleted file mode 100644 index fac81895..00000000 --- a/old/modules/DONE/WarpPoints/locale/de.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[WarpPoints] -name=Warp List -tooltip=Die Liste mit den Warp-Punkten -remove-tooltip=Entferne Warp-Punkt -go-to-tooltip=Gehe zu Warp-Punkt -cooldown=Warte, bis der Cooldown abgelaufen ist. Verbleibende Zeit: __1__ -cooldown-zero=Dein Cooldown ist abgelaufen, du kannst jetzt wieder Warp-Punkte verwenden. -name-used=Dieser Name ist schon vergeben. -not-on-warp=Du bist nicht auf einem Warp-Punkt. Gehe auf einen Warp-Punkt, um zu einem anderen zu springen. \ No newline at end of file diff --git a/old/modules/DONE/WarpPoints/locale/en.cfg b/old/modules/DONE/WarpPoints/locale/en.cfg deleted file mode 100644 index 0f517e6e..00000000 --- a/old/modules/DONE/WarpPoints/locale/en.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[WarpPoints] -name=Warp List -tooltip=A list of warp points. -remove-tooltip=Remove Warp point -go-to-tooltip=Go To -cooldown=You must wait for the cooldown. Time left: __1__ -cooldown-zero=Your cooldown has expired, You can use warp points again. -name-used=That name is already taken. -too-close=You are too close to an existing warp point to make a new one. -not-on-warp=You are not on a warp point right now, you must be on a warp point to go to one. \ No newline at end of file diff --git a/old/modules/DONE/WarpPoints/locale/fr.cfg b/old/modules/DONE/WarpPoints/locale/fr.cfg deleted file mode 100644 index b15a3345..00000000 --- a/old/modules/DONE/WarpPoints/locale/fr.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[WarpPoints] -name=Warp List -tooltip=A list of warp points. -remove-tooltip=Remove Warp Point -go-to-tooltip=Go To -cooldown=You Must Wait For The Cooldown, Time Left: __1__ -cooldown-zero=You Cooldown Has Expired, YOu Can Use Warp Points Again. -name-used=That Name Is Already Taken -not-on-warp=You Are Not On A Warp Point Right Now, You Must Be On A Warp Point To Go To One. \ No newline at end of file diff --git a/old/modules/DONE/WarpPoints/locale/nl.cfg b/old/modules/DONE/WarpPoints/locale/nl.cfg deleted file mode 100644 index b15a3345..00000000 --- a/old/modules/DONE/WarpPoints/locale/nl.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[WarpPoints] -name=Warp List -tooltip=A list of warp points. -remove-tooltip=Remove Warp Point -go-to-tooltip=Go To -cooldown=You Must Wait For The Cooldown, Time Left: __1__ -cooldown-zero=You Cooldown Has Expired, YOu Can Use Warp Points Again. -name-used=That Name Is Already Taken -not-on-warp=You Are Not On A Warp Point Right Now, You Must Be On A Warp Point To Go To One. \ No newline at end of file diff --git a/old/modules/DONE/WarpPoints/locale/sv-SE.cfg b/old/modules/DONE/WarpPoints/locale/sv-SE.cfg deleted file mode 100644 index afbdb799..00000000 --- a/old/modules/DONE/WarpPoints/locale/sv-SE.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[WarpPoints] -name=Warp-lista -tooltip=En lista över Warp-punkter. -remove-tooltip=Ta bort Warp-punkt -go-to-tooltip=Gå till -cooldown=Du måste vänta på nedräkningen. Tid kvar: __1__ -cooldown-zero=Din nedräkningstimer har gått ut, så nu kan du använda Warp-punkter igen. -name-used=Det namnet är redan taget. -not-on-warp=Du är inte på en Warp-punkt just nu, för att gå till en Warp-punkt måste du befinna dig på en. diff --git a/old/modules/DONE/WarpPoints/softmod.json b/old/modules/DONE/WarpPoints/softmod.json deleted file mode 100644 index 82df5531..00000000 --- a/old/modules/DONE/WarpPoints/softmod.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "WarpPoints", - "version": "4.0.0", - "description": "Creates a warp point system which makes moving around large maps easier.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Warps", - "System", - "Teleport", - "PAX" - ], - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "dependencies": { - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Role": "?^4.0.0", - "ExpGamingCore.Command": "?^4.0.0", - "ExpGamingCore.Gui": "^4.0.0" - }, - "submodules": {} -} diff --git a/old/modules/DONE/WarpPoints/src/commands.lua b/old/modules/DONE/WarpPoints/src/commands.lua deleted file mode 100644 index 9fe0e436..00000000 --- a/old/modules/DONE/WarpPoints/src/commands.lua +++ /dev/null @@ -1,21 +0,0 @@ -local warp_min_distance = warp_min_distance^2 -local warps = warps -local self = self - -commands.add_command('make-warp', 'Make a warp point at your location', { - ['name']={true,'string-inf'} -}, function(event,args) - if not game.player then return end - local position = game.player.position - local name = args.name - if name:len() > 40 then player_return({'ExpGamingCore_Command.error-string-len',40},defines.textcolor.med) return commands.error end - if game.player.gui.top[name] then player_return({'WarpPoints.name-used'},defines.textcolor.med) return commands.error end - if warps.warps[name] then player_return({'WarpPoints.name-used'},defines.textcolor.med) return commands.error end - for name,warp in pairs(warps.warps) do - local dx = position.x-warp.position.x - local dy = position.y-warp.position.y - if dx^2 + dy^2 < warp_min_distance then player_return({'WarpPoints.too-close'},defines.textcolor.med) return commands.error end - end - -- to do add a test for all warps - self.make_warp_point(position,game.player.surface,game.player.force,name) -end) \ No newline at end of file diff --git a/old/modules/DONE/WarpPoints/src/warp_entities.lua b/old/modules/DONE/WarpPoints/src/warp_entities.lua deleted file mode 100644 index 8944daf4..00000000 --- a/old/modules/DONE/WarpPoints/src/warp_entities.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - {'small-lamp',-3,-2},{'small-lamp',-3,2},{'small-lamp',3,-2},{'small-lamp',3,2}, - {'small-lamp',-2,-3},{'small-lamp',2,-3},{'small-lamp',-2,3},{'small-lamp',2,3}, - {'small-electric-pole',-3,-3},{'small-electric-pole',3,3},{'small-electric-pole',-3,3},{'small-electric-pole',3,-3} -} \ No newline at end of file diff --git a/old/modules/DONE/WarpPoints/src/warp_tiles.lua b/old/modules/DONE/WarpPoints/src/warp_tiles.lua deleted file mode 100644 index 01d7b6af..00000000 --- a/old/modules/DONE/WarpPoints/src/warp_tiles.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - {-3,-2},{-3,-1},{-3,0},{-3,1},{-3,2},{3,-2},{3,-1},{3,0},{3,1},{3,2}, - {-2,-3},{-1,-3},{0,-3},{1,-3},{2,-3},{-2,3},{-1,3},{0,3},{1,3},{2,3} -} \ No newline at end of file diff --git a/old/modules/DONE/WornPaths/control.lua b/old/modules/DONE/WornPaths/control.lua deleted file mode 100644 index 0459de26..00000000 --- a/old/modules/DONE/WornPaths/control.lua +++ /dev/null @@ -1,105 +0,0 @@ ---- Makes paths which wear down and paths where entities are placed. --- @module WornPaths@^4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Game = require('FactorioStdLib.Game') - --- Local Variables -local entities = require(module_path..'/src/entites') -local paths = require(module_path..'/src/paths') -for _,value in pairs(paths) do value[1]=-1/value[1] end -local placed_paths = require(module_path..'/src/placed') - -local adjacency_boost = 2 -- makes paths more likely to be next to each other; must be greater than 0 -adjacency_boost = 10/adjacency_boost -- dont change this line - --- Module Define -local module_verbose = false -local ThisModule = {} - --- Global Define -local global = {} -Global.register(global,function(tbl) global = tbl end) - --- Function Define -local function global_key(surface,pos) - return 'S'..surface.name..'X'..math.floor(pos.x)..'Y'..math.floor(pos.y) -end - ---- Downgrades a tile in this position --- @usage ThisModule.down_grade(surface,{x=10,y=10}) --- @tparam surface surface the surface the tile is on --- @tparam table pos the position of the tile to change -function ThisModule.down_grade(surface,pos) - local tile = surface.get_tile(pos).name - local new_tile = paths[tile][2] - if new_tile == 'world-gen' then - new_tile = global[global_key(surface,pos)] or 'grass-1' - end - surface.set_tiles{{name=new_tile,position=pos}} -end - --- Event Handlers Define -Event.add({defines.events.on_player_built_tile,defines.events.on_robot_built_tile}, function(event) - local surface = event.surface_index and game.surfaces[event.surface_index] or event.robot and event.robot.surface - local old_tiles = event.tiles - for _,old_tile in pairs(old_tiles) do - if not placed_paths[old_tile.old_tile.name] and old_tile.old_tile.name ~= 'water' and old_tile.old_tile.name ~= 'deepwater' then - global[global_key(surface,old_tile.position)]=old_tile.old_tile.name -- not a mistake, this makes it have demising returns - end - end -end) - -Event.add(defines.events.on_player_changed_position, function(event) - local player = Game.get_player(event) - if not player or not player.valid or game.tick < 10 then return end - if player.afk_time > 300 then return end - local surface = player.surface - local pos = player.position - local tile_name = surface.get_tile(pos).name - if not paths[tile_name] then return end - local count = -9 -- this value is important - for x = -1,1 do for y = -1,1 do - local _pos = {pos.x+x,pos.y+y} - if placed_paths[tile_name] and not placed_paths[surface.get_tile(_pos).name] - or surface.get_tile(_pos).name == paths[tile_name][2] - then count=count+1 end - end end - local chance = paths[tile_name][1]/(count-adjacency_boost) - if math.random() < chance then - ThisModule.down_grade(surface,pos) - end -end) - -Event.add({defines.events.on_built_entity,on_robot_built_entity}, function(event) - local entity = event.created_entity - local surface = entity.surface - if entities[entity.name] then - local box = entity.prototype.collision_box - for x = box.left_top.x,box.right_bottom.x do for y = box.left_top.y,box.right_bottom.y do - local pos = {x=entity.position.x+x,y=entity.position.y+y} - local tile = surface.get_tile(pos).name - if paths[tile] then ThisModule.down_grade(surface,pos) end - end end - end -end) --- Module Return --- when called it will downgrade a tile -return setmetatable(ThisModule,{__call=function(self,...) self.down_grade(...) end}) - ---[[ -/interface -local tile_name = surface.get_tile(position).name -if not paths[tile_name] then return end -local count = -9 -- this value is important -for x = -1,1 do for y = -1,1 do - local _pos = {position.x+x,position.y+y} - if placed_paths[tile_name] and not placed_paths[surface.get_tile(_pos).name] - or surface.get_tile(_pos).name == paths[tile_name][2] - then count=count+1 end -end end -return paths[tile_name][1]/(count-adjacency_boost) -]] \ No newline at end of file diff --git a/old/modules/DONE/WornPaths/softmod.json b/old/modules/DONE/WornPaths/softmod.json deleted file mode 100644 index 1b1a489a..00000000 --- a/old/modules/DONE/WornPaths/softmod.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "WornPaths", - "version": "4.0.0", - "description": "Makes paths which wear down and paths where entites are placed.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Paths", - "Worn", - "Decay", - "Degrade" - ], - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "dependencies": { - "FactorioStdLib.Game": "^0.8.0" - }, - "submodules": {} -} diff --git a/old/modules/DONE/WornPaths/src/entites.lua b/old/modules/DONE/WornPaths/src/entites.lua deleted file mode 100644 index 6ee6868b..00000000 --- a/old/modules/DONE/WornPaths/src/entites.lua +++ /dev/null @@ -1,31 +0,0 @@ -return { - ['stone-furnace']=true, - ['steel-furnace']=true, - ['electric-furnace']=true, - ['assembling-machine-1']=true, - ['assembling-machine-2']=true, - ['assembling-machine-3']=true, - ['beacon']=true, - ['centrifuge']=true, - ['chemical-plant']=true, - ['oil-refinery']=true, - ['storage-tank']=true, - ['nuclear-reactor']=true, - ['steam-engine']=true, - ['steam-turbine']=true, - ['boiler']=true, - ['heat-exchanger']=true, - ['stone-wall']=true, - ['gate']=true, - ['gun-turret']=true, - ['laser-turret']=true, - ['flamethrower-turret']=true, - ['radar']=true, - ['lab']=true, - ['big-electric-pole']=true, - ['substation']=true, - ['rocket-silo']=true, - ['pumpjack']=true, - ['electric-mining-drill']=true, - ['roboport']=true -} \ No newline at end of file diff --git a/old/modules/DONE/WornPaths/src/paths.lua b/old/modules/DONE/WornPaths/src/paths.lua deleted file mode 100644 index a41a7dfc..00000000 --- a/old/modules/DONE/WornPaths/src/paths.lua +++ /dev/null @@ -1,27 +0,0 @@ -return { - -- ['tile name'] = {health,convert to} - -- the greater health is the lower the chance it will be down graded, must be grater than 0 - ['refined-concrete']={70,'concrete'}, - ['refined-hazard-concrete-right']={70,'hazard-concrete-right'}, - ['refined-hazard-concrete-left']={70,'hazard-concrete-left'}, - ['concrete']={50,'stone-path'}, - ['hazard-concrete-right']={50,'stone-path'}, - ['hazard-concrete-left']={50,'stone-path'}, - ['stone-path']={40,'world-gen'}, -- world-gen just makes it pick the last tile not placed by a player - ['sand-1']={5,'sand-2'}, - ['sand-2']={10,'sand-3'}, - ['sand-3']={5,'red-desert-3'}, - ['red-desert-3']={5,'red-desert-2'}, - ['red-desert-2']={10,'dirt-1'}, - ['grass-2']={5,'grass-1'}, - ['grass-1']={5,'grass-3'}, - ['grass-3']={10,'red-desert-0'}, - ['red-desert-0']={5,'red-desert-1'}, - ['red-desert-1']={10,'dirt-1'}, - ['dirt-1']={5,'dirt-2'}, - ['dirt-2']={5,'dirt-3'}, - ['dirt-3']={10,'dirt-4'}, - ['dirt-4']={5,'dirt-5'}, - ['dirt-5']={5,'dirt-6'}, - ['grass-4']={10,'dirt-4'} -} \ No newline at end of file diff --git a/old/modules/DONE/WornPaths/src/placed.lua b/old/modules/DONE/WornPaths/src/placed.lua deleted file mode 100644 index 2fb909b1..00000000 --- a/old/modules/DONE/WornPaths/src/placed.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - ['refined-concrete']=true, - ['refined-hazard-concrete-right']=true, - ['refined-hazard-concrete-left']=true, - ['concrete']=true, - ['hazard-concrete-right']=true, - ['hazard-concrete-left']=true, - ['stone-path']=true -} \ No newline at end of file diff --git a/old/modules/DeconControl/control.lua b/old/modules/DeconControl/control.lua deleted file mode 100644 index 2976cb33..00000000 --- a/old/modules/DeconControl/control.lua +++ /dev/null @@ -1,72 +0,0 @@ ---- Allows control over decon rights, if ExpGamingCore.Role is not installed it will allow admins to instant remove trees and thats it. --- @module DeconControl@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Game = require('FactorioStdLib.Game') -local Server = require('ExpGamingCore.Server') -local Role -- ExpGamingCore.Role@^4.0.0 -local Admin -- ExpGamingAdmin@^4.0.0 - --- Module Define -local module_verbose = false -local ThisModule = { - on_init=function() - if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end - if loaded_modules['ExpGamingAdmin'] then Admin = require('ExpGamingAdmin') end - end -} - --- Event Handlers Define -Event.register(-1,function(event) - Server.new_thread{ - name='tree-decon', - data={trees={},cache={},clear=0} - }:on_event('tick',function(self) - local trees = self.data.trees - if self.data.clear ~= 0 and self.data.clear < game.tick then self.data.cache = {} self.data.clear = 0 end - if #trees == 0 then return end - for i = 0,math.ceil(#trees/10) do - local tree = table.remove(trees,1) - if tree and tree.valid then tree.destroy() end - end - end):on_event(defines.events.on_marked_for_deconstruction,function(self,event) - local cache = self.data.cache[event.player_index] - if not cache then - local player = Game.get_player(event) - if not player then return end - if not Role then - if player.admin then self.data.cache[event.player_index] = {'tree-decon',false} - else self.data.cache[event.player_index] = {'decon',false} end - else - if Role.allowed(player,'tree-decon') then self.data.cache[event.player_index] = {'tree-decon',false} - elseif not Role.allowed(player,'decon') then self.data.cache[event.player_index] = {'no-decon',false} - else self.data.cache[event.player_index] = {'decon',false} end - end - cache = self.data.cache[event.player_index] - end - if not event.entity.last_user or event.entity.name == 'entity-ghost' then - if cache[1] == 'tree-decon' then - table.insert(self.data.trees,event.entity) - self.data.clear = game.tick + 10 - end - else - if cache[1] == 'no-decon' then - event.entity.cancel_deconstruction('player') - if not cache[2] then - cache[2] = true - local player = Game.get_player(event) - player_return({'DeconControl.player-print'},defines.textcolor.crit,player) - Role.print(Role.meta.groups.Admin.lowest,{'DeconControl.rank-print',player.name},defines.textcolor.info) - if Admin then Admin.give_warning(player,'','Trying To Decon The Base') end - end - self.data.clear = game.tick + 10 - end - end - end):open() -end) - --- Module Return -return ThisModule \ No newline at end of file diff --git a/old/modules/DeconControl/locale/de.cfg b/old/modules/DeconControl/locale/de.cfg deleted file mode 100644 index efab5765..00000000 --- a/old/modules/DeconControl/locale/de.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[DeconControl] -player-print=Du darfst dies noch nicht entfernen. Du benötigst dazu den Rang Regular, den du nach 3 Stunden auf dem Server automatisch erhältst. -rank-print=__1__ versuchte etwas zu entfernen. \ No newline at end of file diff --git a/old/modules/DeconControl/locale/en.cfg b/old/modules/DeconControl/locale/en.cfg deleted file mode 100644 index 556c1f3a..00000000 --- a/old/modules/DeconControl/locale/en.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[DeconControl] -player-print=You do not have permission to do this right now. You require the Regular rank which can be obtained through 3 hours of in-game playtime on a server. -rank-print=__1__ tried to deconstruct something. diff --git a/old/modules/DeconControl/locale/fr.cfg b/old/modules/DeconControl/locale/fr.cfg deleted file mode 100644 index 8eca4e13..00000000 --- a/old/modules/DeconControl/locale/fr.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[DeconControl] -player-print=You are not allowed to do this yet, You require the Regular rank, you must play for at least 3 hours -rank-print=__1__ tried to deconstruct something. \ No newline at end of file diff --git a/old/modules/DeconControl/locale/nl.cfg b/old/modules/DeconControl/locale/nl.cfg deleted file mode 100644 index bc857511..00000000 --- a/old/modules/DeconControl/locale/nl.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[DeconControl] -player-print=Je moet minstens 3 uur gespeeld hebben om dit uit te voeren. -rank-print=__1__ heeft geprobeerd iets te deconstrueren. diff --git a/old/modules/DeconControl/locale/sv-SE.cfg b/old/modules/DeconControl/locale/sv-SE.cfg deleted file mode 100644 index c8ad5cb7..00000000 --- a/old/modules/DeconControl/locale/sv-SE.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[DeconControl] -player-print=Du har inte tillåtelse med det här just nu. Du behöver ha rang "Regular" vilket kan uppnås genom 3 timmar inne i spelet (den här kartan) hos Explosive Gaming. -rank-print=__1__ försökte dekonstruera något. diff --git a/old/modules/DeconControl/softmod.json b/old/modules/DeconControl/softmod.json deleted file mode 100644 index 2f33a047..00000000 --- a/old/modules/DeconControl/softmod.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "DeconControl", - "version": "4.0.0", - "description": "Allows control over decon rights, if ExpGamingCore.Role is not installed it will allow admins to instant remove trees and thats it.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Trees", - "Decon", - "Protection", - "Admin", - "Tool", - "Report" - ], - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "dependencies": { - "ExpGamingCore.Server": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingLib": "^4.0.0", - "ExpGamingAdmin.Warnings": "?^4.0.0", - "ExpGamingCore.Role": "?^4.0.0", - "ExpGamingAdmin": "?^4.0.0" - }, - "submodules": {} -} diff --git a/old/modules/ExpGamingCore/Server/control.lua b/old/modules/ExpGamingCore/Server/control.lua deleted file mode 100644 index 4de7da63..00000000 --- a/old/modules/ExpGamingCore/Server/control.lua +++ /dev/null @@ -1,562 +0,0 @@ ---- Adds a thread system and event listening and a admin bypass (recommend to disable /c and use optional /interface) --- @module ExpGamingCore.Server --- @alias Server --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - -local Game = require('FactorioStdLib.Game') -local Color = require('FactorioStdLib.Color') - -local Server = {} -local module_verbose = false --true|false - ---- Global Table --- @table global --- @field all a list of every thread (indexed by uuid) --- @field queue an index for threads which will be resolved (contains uuids) --- @field tick an index for threads which will run every tick (contains uuids) --- @field timeout an index for threads which will timeout (contains uuids) --- @field events an index of threads based on event ids (contains uuids) --- @field paused an index of paused threads (contains uuids) --- @field named a name index for thread uuids --- @field print_to contains players that event details will be printed to --- @field uuid contains the random number generator for the uuid system -local pre_load_uuid = 0 -local global = { - all={_n=0}, - queue={}, - tick={}, - timeout={}, - events={}, - paused={}, - named={}, - print_to={}, - uuid=0 -} -Global.register(global,function(tbl) global = tbl end) - ---- Used to generate a new uuid for the thread system --- @usage local uuid = tostring(Server.uuid) -- calling tostring locks the value --- @treturn string the new uuid -Server.uuid = add_metatable({},function() - -- when it is called as a function - local uuid - if game then - global.uuid=global.uuid+1 - uuid=global.uuid+pre_load_uuid - verbose('Game UUID Increased: '..global.uuid..' ('..uuid..')') - else - pre_load_uuid=pre_load_uuid+1 - uuid=pre_load_uuid - verbose('Load UUID Increased: '..pre_load_uuid..' ('..uuid..')') - end - return add_metatable({uuid},nil,function(tbl) return string.format("%x", tostring(tbl[1])) end) -end,function() - -- when it is treated as a string - return tostring(Server.uuid()) -end) - ---- Redirect to the thread index --- @usage Server.threads -- return #global.all --- @usage Server.threads -- return global.all --- @treturn[1] number the number of threads --- @treturn[2] table table of all threads -Server.threads = setmetatable({},{ - __metatable=false, - __call=function(tbl) return global.all._n end, - __len=function(tbl) return global.all._n end, - __index=function(tbl,key) return rawget(global.all,key) end, - __newindex=function(tbl,key,value) rawset(global.all,key,value) end, - __pairs=function(tbl) - local tbl = global.all - local function next_pair(tbl,key) - local k, v = next(tbl, key) - if type(v) ~= nil and k ~= '_n' then return k,v - else return next(tbl, k) end - end - return next_pair, tbl, nil - end -}) - ---- Generates a new thread object --- @usage Server.new_thread{name='foo',data={}} --- @tparam table obj the attributes to give to the thread --- @treturn Server._thread the new thread created -function Server.new_thread(obj) return Server._thread.create(obj) end - ---- Used to get a thread via uuid or name (if one is assigned) --- @usage Server.get_thread('decon') -- return thread --- @param mixed either a uuid or the name given to a thread --- @treturn[1] Server._thread the thread by that name or uuid --- @treturn[2] boolean if false is returned then no thread exists -function Server.get_thread(mixed) - local threads = global - if threads.named[mixed] then return threads.all[threads.named[mixed]] - elseif threads.paused[mixed] then return threads.all[threads.paused[mixed]] - elseif threads.all[mixed] then return threads.all[mixed] - else return false end -end - ---- Adds a thread into the resolve queue, can be used to lower lag --- @usage Server.queue_thread(thread) -- return true/false --- @tparam Server._thread thread_to_queue the thread to be added to the queue, must be open and have a on_resolve function --- @treturn boolean was it added successfully -function Server.queue_thread(thread_to_queue) - if not thread_to_queue and not thread_to_queue.valid and not thread_to_queue:valid() then return false end - if not thread_to_queue._resolve then return false end - table.insert(global.queue,thread_to_queue.uuid) - return true -end - ---- Closes all active threads, can use force if it causes errors --- @usage Server.close_all_threads() -- asks all threads to close --- @usage Server.close_all_threads(true) -- forcefully close all threads --- @tparam boolean with_force use force when closing -function Server.close_all_threads(with_force) - if not with_force then - for uuid,thread in pairs(Server.threads) do thread:close() end - else global.Server(true) end -- idk why you cant just use global even when global is defined at the top to be overridden -end - ---- Runs all the threads which have opened with an on_tick event --- @usage Server.run_tick_threads() -function Server.run_tick_threads() - table.each(global.tick,function(uuid) - local next_thread = Server.get_thread(uuid) - if next_thread and next_thread:valid() and next_thread._tick then - local success, err = Manager.sandbox(next_thread._tick,next_thread._env,next_thread) - if not success then next_thread:error(err) end - end - end) -end - ---- Checks the timeout on all active timeout threads --- @usage Server.check_timeouts() -function Server.check_timeouts() - table.each(global.timeout,function(uuid) - local next_thread = Server.get_thread(uuid) - if next_thread and next_thread:valid() then - next_thread:check_timeout() - end - end) -end - ---- Used to print event info to a player --- @usage Server._thread_debuger('Cooldude2606','on_player_died',true) -- will output event info to 'Cooldude2606' for 'on_player_died' --- @tparam ?name|index|LuaPlayer player the player that the info will be returned to --- @tparam ?name|index event the event that info will be returned fo --- @tparam[opt=toggle] boolean state will info be returned, nil to toggle current state -function Server._thread_debuger(player,event,state) - player = Game.get_player(player) - event = tonumber(event) or Manager.event.names[event] - local print_to = global.print_to - print_to[player.index] = print_to[player.index] or {} - if state then print_to[player.index][event] = state - elseif print_to[player.index][event] then print_to[player.index][event] = false - else print_to[player.index][event] = true end -end - ---- Calls all threads on a certain game event (used with Event.add) --- @local Server._thread_handler --- @usage Event.add(defines.events,Server._thread_handler) -- adds this handler --- @tparam table event the event that is called -function Server._thread_handler(event) - -- returns to players who have set _thread_debuger to true - table.each(global.print_to,function(print_to,player_index,event) - if event.name == defines.events.on_tick then return true end - if print_to[event.name] then - player_return(event,defines.textcolor.bg,player_index) - end - end,event) - -- gets the thread uuids - local event_id = event.name - local threads = global.events[event_id] - if not threads then return end - -- loops over the uuids - table.each(threads,function(uuid) - local thread = Server.get_thread(uuid) - if thread and thread:valid() then - if is_type(thread._events[event_id],'function') then - -- runs the function in the same env it was created (avoids desyncs) - local success, err = Manager.sandbox(thread._events[event_id],thread._env,thread,event) - -- if there is an error it asks the thread to deal with it - if not success then thread:error(err) end - end - end - end) -end - ---[[ cant be used V ---- Adds a event handler to tell threads about events --- @usage Server.add_thread_handler(defines.event) --- @tparam number event the event to run the thread handler on` --- @treturn boolean if the handler was added -function Server.add_thread_handler(event) - if not is_type(event,'number') then return false end - local threads = global - if not threads.events[event] then - threads.events[event] = {} - Event.add(event,Server._thread_handler) - return true - end - return false -end -]] - ---- Acts as a bypass for running functions, can accept a string --- @usage Server.interface('local x = 1+1 print(x) return x') -- return 2 --- @usage Server.interface('local x = 1+1 print(x)',true) -- will create a thread to run as root (this is the bypass) --- @tparam function ?string|function callback to be ran --- @tparam[opt] ?Server._thread|true use_thread run the command on a pre-made thread or let it make its own --- @tparam[opt] table env run the env to run the command in must have _env key as true to be --- @param[opt] ... any args you want to pass to the function --- @treturn[1] boolean if no thread then it will return a true for the success --- @return[1] if no thread then it will return the value(s) returned by the callback --- @treturn[2] boolean if no thread then it will return a false for the success --- @treturn[2] string if no thread then it will return a an err value -function Server.interface(callback,use_thread,env,...) - if use_thread then - -- if use_thread is true then it makes a new thread - if use_thread == true then use_thread = Server.new_thread{data={callback,env,...}} end - -- creates the resolve function for the thread - use_thread:on_event('resolve',function(thread) - local thread_callback = table.remove(thread.data,1) - thread_callback = is_type(thread_callback,'function') and thread_callback or loadstring(thread_callback) - local thread_env = table.remove(thread.data,1) - if is_type(thread_env,'table') and not is_type(thread_env.__self,'userdata') and thread_env._env == true then - local success, err = Manager.sandbox(thread_callback,thread_env,unpack(thread.data)) - if not success then error(err) end - return err - else - local success, err = Manager.sandbox(thread_callback,{},env,unpack(thread.data)) - if not success then error(err) end - return err - end - end) - -- opens the thread and then queues it - use_thread:open() - Server.queue_thread(use_thread) - else - local _callback = callback - if not is_type(callback,'function') then - local rtn, err = loadstring(callback) - if err then return false, err end - _callback = rtn - end - if is_type(env,'table') and not is_type(env.__self,'userdata') and env._env == true then - local success, err = Manager.sandbox(_callback,env,...) - if not success then return success,err - else return success, unpack(err) end - else - local success, err = Manager.sandbox(_callback,{},env,...) - if not success then return success,err - else return success, unpack(err) end - end - end -end - ---- The class for the server threads, allows ability to run async function --- @type Thread --- @alias Server._thread --- @field name the name that is given to the thread, use for easy later indexing --- @field timeout the time in ticks that the thread will have before it times out --- @field reopen when true the thread will reopen itself until set to false, combine with timeout to create a long on_nth_tick wait --- @field data any data that the thread will be able to access -Server._thread = {} - -local _env_metatable = { - __index=function(tbl,key) if rawget(tbl,'_modules') and tbl._modules[key] then return require(tbl._modules[key]) else return rawget(_G,key) end end -} - ---- Returns a new thread object --- @usage new_thread = thread:create() --- @tparam[opt={}] table obj all values are opt {timeout=int,name=str,data=any} --- @treturn Server._thread the new thread object -function Server._thread.create(obj) - obj = obj or {} - setmetatable(obj,{__index=Server._thread}) - obj.uuid = tostring(Server.uuid) - -- creates a variable containing all upvalus for the thread (stops desyncs) - obj._env = get_upvalues(2) - obj._env._env = true - obj._env._ENV = nil -- prevents infinite recursion - -- removes any modules from the _env to save space in global (less time to serialize) - obj._env._modules = {} - for name,value in pairs(obj._env) do - if is_type(value,'table') and value._moduleName and loaded_modules[value._moduleName] == value then - obj._env._modules[name] = value._moduleName obj._env[name] = nil - end - end - setmetatable(obj._env,_env_metatable) - local name = obj.name or 'Anon' - verbose('Created new thread: '..name..' ('..obj.uuid..')') - return obj -end - ---- Opens and queues a thread --- @usage Server._thread:queue() -- returns true/false --- @treturn boolean was the thread queued successfully --- @see Server.queue_thread -function Server._thread:queue() - self:open() - return Server.queue_thread(self) -end - ---- Test if the thread has all required parts --- @usage if thread:valid() then end -- basic test for valid --- @tparam[opt=false] boolean skip_location_check true to skip the location checking --- @treturn boolean is the thread valid -function Server._thread:valid(skip_location_check) - skip_location_check = skip_location_check or false - if is_type(self.uuid,'string') and - skip_location_check or is_type(self.opened,'number') and - skip_location_check or is_type(global.all[self.uuid],'table') and - is_type(self.timeout) or is_type(self.timeout,'number') and - is_type(self.name) or is_type(self.name,'string') and - is_type(self._close) or is_type(self._close,'function') and - is_type(self._timeout) or is_type(self._timeout,'function') and - is_type(self._tick) or is_type(self._tick,'function') and - is_type(self._resolve) or is_type(self._resolve,'function') and - is_type(self._success) or is_type(self._success,'function') and - is_type(self._error) or is_type(self._error,'function') then - -- all above must be true to be valid, must accept nil and function - return true - end - return false -end - ---- Opens the thread; indexes this thread in the global index --- @usage thread:open() -- return true --- @treturn boolean if the thread was opened successfully -function Server._thread:open() - -- if the thread is valid and not already opened - if not self:valid(true) or self.opened then return false end - local uuid = self.uuid - -- sets the thread to open, this is the tick it was opened - self.opened = game.tick - -- creates the global index - global.all[uuid] = global.all[uuid] or self - global.all._n = global.all._n+1 - -- indexes the thread in other places if it has more function - -- if it was paused before (ie did not run any events) then the index is removed from the paused index - if global.paused[self.name] then global.paused[self.name] = nil end - -- if it has a timeout or on_tick handler then it is indexed in those indexes - if is_type(self.timeout,'number') then table.insert(global.timeout,uuid) end - if is_type(self._tick,'function') then table.insert(global.tick,uuid) end - -- if the thread is given a name then a index from the name to uuid is made - if is_type(self.name,'string') then global.named[self.name] = global.named[self.name] or self.uuid end - -- if there are event handlers then it will loop over them and add them to the event index - if is_type(self._events,'table') then - table.each(self._events,function(callback,event,global,uuid) - -- cant be used V - --Server.add_thread_handler(event) - if not global.events[event] then global.events[event] = {} end - table.insert(global.events[event],uuid) - end,global,self.uuid) - end - local name = self.name or 'Anon' - verbose('Opened thread: '..name..' ('..self.uuid..')') - return true -end - ---- Inverse of thread:open() - Removes all indexes to this thread, most cases this will cause it to become inaccessible --- @usage thread:close() -- return true --- @treturn boolean if the thread had a on_close function -function Server._thread:close() - local uuid = self.uuid - local _return = false - -- if there is a call to the threads on close event, will later return true - if is_type(self._close,'function') then Manager.sandbox(self._close,self._env,self) _return = true end - -- will search every possible location for this thread and remove it - local _,key = table.find(global.queue,function(v,k,uuid) return v == uuid end,uuid) - if key then table.remove(global.queue,key) end -- queue - _,key = table.find(global.timeout,function(v,k,uuid) return v == uuid end,uuid) - if key then table.remove(global.timeout,key) end -- timeouts - _,key = table.find(global.tick,function(v,k,uuid) return v == uuid end,uuid) - if key then table.remove(global.tick,key) end -- on_tick - -- then will look for it in the event handlers and remove it if found - if is_type(self._events,'table') then - table.each(self._events,function(callback,event) - if global.events[event] then - local _,key = table.find(global.events[event],function(v,k,uuid) return v == uuid end,uuid) - if key then table.remove(global.events[event],key) end - -- cant be used V - --if #global.events[event] == 0 then Event.remove(event,Server.game_event) global.events[event] = nil end - end - end) - end - -- sets the thread to closed - self.opened=nil - -- unless the thread has a name or is assigned to be reopened - if self.reopen == true then self:open() else - -- if it has a name but not assigned to reopen then it will become 'paused' - if is_type(self.name,'string') then global.paused[self.name]=self.uuid - -- else it will just be wiped from the global index - else global.all[uuid] = nil global.all._n = global.all._n-1 end - end - local name = self.name or 'Anon' - verbose('Closed thread: '..name..' ('..self.uuid..')') - return _return -end - ---- Trigger the on_resolve function and closes the thread - error and success called based on result of pcall (useful for async) --- @usage thread:resolve(x,y,z) -- return true --- @param[opt] ... any arguments you want to pass to the resolve function --- @treturn boolean true if the thread called on_success or on_error -function Server._thread:resolve(...) - local _return = false - -- checks if the resolve handler is still present - if is_type(self._resolve,'function') then - local success, err = Manager.sandbox(self._resolve,self._env,self,...) - if success then - -- if it was successful then it will attempt to call the success handler - if is_type(self._success,'function') then - -- interface is used as a way to delay the success call till the next tick - Server.interface(function(thread,err) - local _success, _err = Manager.sandbox(thread._success,thread._env,thread,err) - if not _success then thread:error(_err) end - end,true,self,err) - -- later returns true if there was a call to the success handler - _return = true - end - -- if there is an error the thread is asked to deal with it, returns true/false based on result of handler - else _return = self:error(err) end - end - -- closes the thread as it is no longer needed as its command has be ran - self:close() - return _return -end - ---- Checks the timeout on a thread - if timed out then it calls on_timeout and closes --- @usage thread:check_timeout() -- return true --- @treturn boolean if the thread timed out -function Server._thread:check_timeout() - local _return = false - -- makes sure the thread is still valid - if not self:valid() then return false end - -- checks if the thread has been opened longer than its time out period - if is_type(self.timeout,'number') and game.tick >= (self.opened+self.timeout) then - if is_type(self._timeout,'function') then - -- we do not care if the time out has caused an error as it is in most cases an error in its own right - Manager.sandbox(self._timeout,self._env,self) - end - _return = true - -- closes the thread to prevent any further event calls - self:close() - end - return _return -end - ---- Used to check and raise the error handler of the thread, if not present it raises an error --- @usage thread:error(err) -- return true --- @tparam string err the err to be raised --- @treturn boolean did the thread have an error handler -function Server._thread:error(err) - local _return = false - if is_type(self._error,'function') then - Manager.sandbox(self._error,self._env,self,err) - _return = true - else - self:close() -- no matter what happens next this thread will be closed - local name = self.name or self.uuid - error('Thread Error (no handler) on <'..name..'>: '..err) - end - return _return -end - ---- Set function to run then an event is triggered, none of them are 'needed' but you are advised to have at least one --- @usage thread:on_event('close',function) -- if event is not one below then a game event is used --- @usage thread_only_events = ['close','timeout','tick','resolve','success','error'] --- @tparam function ?string|index event the name of the event that the should be called on --- @tparam function function callback the which is called by the event trigger --- @treturn table returns self so that they can be chained together -function Server._thread:on_event(event,callback) - local events = {'close','timeout','tick','resolve','success','error'} - -- searches the above list for the event - local value = table.find(events,function(v,k,find) return v == string.lower(find) end,event) - if value and is_type(callback,'function') then - -- if it is a thread_only_event then it will add it to its core values - self['_'..value] = callback - elseif is_type(event,'number') and is_type(callback,'function') then - -- other wise it is appended to the event index of the thread - if not self._events then self._events = {} end - self._events[event] = callback - end - -- returns self to allowing chaining of on_event():on_event():on_event() etc.. - return self -end - -Event.add(defines.events.on_tick,function(event) - -- uses its own on_tick event so that other actions can be tested for - if event.tick < 10 then return end - if #global.tick > 0 then Server.run_tick_threads() end -- on tick events - if #global.timeout > 0 then Server.check_timeouts() end -- timeout checks - if #global.queue > 0 then -- resolve one thread - local current_thread = global.all[global.queue[1]] - if current_thread and current_thread:valid() then current_thread:resolve() end - end -end) - -script.on_load(function(event) - -- sets up metatable again so that threads continue to work - for uuid,thread in pairs(Server.threads) do - setmetatable(thread,{__index=Server._thread}) - setmetatable(thread._env,_env_metatable) - end -end) - -function Server:on_init() - for name,id in pairs(defines.events) do if not script.get_event_handler(id) then Event.add(id,Server._thread_handler) end end - if loaded_modules['ExpGamingCore.Command'] then verbose('ExpGamingCore.Command is installed; Loading commands src') require(module_path..'/src/commands',{Server=Server}) end -end - -return Server - ---[[ - Thread Example: - - local thread = Server.new_thread{name='tree-decon',data={}} - -- user thread:on_event('tick') rather than thread:on_event(defines.events.on_tick) as it makes less lag - thread:on_event('tick',function(self) - local trees = self.data - if #trees == 0 then return end - local tree = table.remove(trees,1) - if tree.valid then tree.destroy() end - end) - thread:on_event('error',function(self,err) - -- cant see how this can cause an error - -- but this is where error handling goes - -- any event including on_resolve and on_tick can raise this - end) - thread:on_event(defines.events.on_marked_for_deconstruction,function(self,event) - if event.entity.type == 'tree' then - table.insert(self.data,event.entity) - end - end) - thread:open() - - local thread = Server.new_thread{name='print-place',data={}} - thread:on_event(defines.events.on_built_entity,function(self,event) - game.print('Events') - end) - thread:open() - - all on_event functions can be chained from the thread creation rather than use variables eg: - Server.new_thread{ - name='tree-decon', - data={} - }:on_event('tick',function(self) - local trees = self.data - if #trees == 0 then return end - local tree = table.remove(trees,1) - if tree.valid then tree.destroy() end - end):on_event('error',function(self,err) - -- cant see how this can cause an error - -- but this is where error handling goes - -- any event including on_resolve and on_tick can raise this - end):on_event(defines.events.on_marked_for_deconstruction,function(self,event) - if event.entity.type == 'tree' then - table.insert(self.data,event.entity) - end - end):open() -]] \ No newline at end of file diff --git a/old/modules/ExpGamingCore/Server/softmod.json b/old/modules/ExpGamingCore/Server/softmod.json deleted file mode 100644 index 7c0ef190..00000000 --- a/old/modules/ExpGamingCore/Server/softmod.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "ExpGamingCore.Server", - "version": "4.0.0", - "description": "Adds a thread system and event listening and a admin bypass (recommend to disable /c and use optional /interface)", - "location": "FSM_ARCHIVE", - "keywords": [ - "Library", - "Lib", - "ExpGaming", - "Core", - "Server", - "Thread", - "Interface", - "Events" - ], - "dependencies": { - "ExpGamingLib": "^4.0.0", - "FactorioStdLib.Table": "^0.8.0", - "FactorioStdLib.Color": "^0.8.0", - "FactorioStdLib.String": "^0.8.0", - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Command": "?^4.0.0" - }, - "collection": "ExpGamingCore@4.0.0", - "submodules": {} -} diff --git a/old/modules/ExpGamingCore/Server/src/commands.lua b/old/modules/ExpGamingCore/Server/src/commands.lua deleted file mode 100644 index 4a0abf28..00000000 --- a/old/modules/ExpGamingCore/Server/src/commands.lua +++ /dev/null @@ -1,49 +0,0 @@ ---- Adds a thread system and event listening and a admin bypass (recommend to disable /c and use optional /interface) --- @submodule ExpGamingCore.Server --- @alias Server --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - ---- This file will be loaded when ExpGamingCore.Command is present --- @function _comment - -local Server = Server - -Server.interfaceCallbacks = {} -function Server.add_to_interface(loadAs,callback) Server.interfaceCallbacks[loadAs] = callback end - -function Server.add_module_to_interface(loadAs,moduleName) - local moduleName = moduleName or tostring(_G.moduleName) or nil - if not moduleName then error('No module name supplied for: '..loadAs,2) return end - Server.add_to_interface(loadAs,function() return require(moduleName) end) -end -Server.add_module_to_interface('Server','ExpGamingCore.Server') - ---- Runs the given input from the script --- @command interface --- @param code The code that will be ran -commands.add_command('interface','Runs the given input from the script', { - ['code']={true,'string-inf'} -}, function(event,args) - local callback = args.code - -- looks for spaces, if non the it will prefix the command with return - if not string.find(callback,'%s') and not string.find(callback,'return') then callback = 'return '..callback end - -- sets up an env for the command to run in - local env = {_env=true,} - if game.player then - env.player = game.player - env.surface = game.player.surface - env.force = game.player.force - env.position = game.player.position - env.entity = game.player.selected - env.tile = game.player.surface.get_tile(game.player.position) - end - -- adds custom callbacks to the interface - for name,custom_callback in pairs(Server.interfaceCallbacks) do env[name] = custom_callback() end - -- runs the function - local success, err = Server.interface(callback,false,env) - -- if there is an error then it will remove the stacktrace and return the error - if not success and is_type(err,'string') then local _end = string.find(err,':1:') if _end then err = string.sub(err,_end+4) end end - -- if there is a value returned that is not nill then it will return that value - if err or err == false then player_return(err) end -end) \ No newline at end of file diff --git a/old/modules/ExpGamingCore/Sync/control.lua b/old/modules/ExpGamingCore/Sync/control.lua deleted file mode 100644 index d7511518..00000000 --- a/old/modules/ExpGamingCore/Sync/control.lua +++ /dev/null @@ -1,338 +0,0 @@ ---- Allows syncing with an outside server and info panel. --- @module ExpGamingCore.Sync --- @alias Sync --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - -local Game = require('FactorioStdLib.Game') -local Color = require('FactorioStdLib.Color') - -local Sync = {} -local Sync_updates = {} -local module_verbose = false --true|false - ---- Global Table --- @table global --- @field server_name the server name --- @field server_description a short description of the server --- @field reset_time the reset time of the server --- @field time the last known irl time --- @field time_set the last in game time that the time was set --- @field last_update the last time that this info was updated --- @field time_period how often this information is updated --- @field players a list of different player related states --- @field ranks a list of player ranks --- @field rockets the number of rockets launched --- @field mods the mods which are loaded -local global = { - server_name='Factorio Server', - server_description='A factorio server for everyone', - reset_time='On Demand', - time='Day Mth 00 00:00:00 UTC Year', - date='0000/00/00', - time_set={0,'0.00M'}, - last_update={0,'0.00M'}, - time_period={18000,'5.00M'}, - game_speed=1.0, - players={ - online={}, - n_online=0, - all={}, - n_all=0, - admins_online=0, - afk_players={}, - times={} - }, - roles={admin={online={},players={},n_online=0,n_players=0},user={online={},players={},n_online=0,n_players=0}}, - rockets=0, - mods={'Offline'} -} -Global.register(global,function(tbl) global = tbl end) - ---- Player sub-table --- @table global.players --- @field online list of all players online --- @field n_online the number of players online --- @field all list of all player on or offline --- @field n_all the number of players who have joined the server --- @field admins_online the number of admins online --- @field afk_players the number of afk players --- @field times the play times of every player - ---- Used to standardise the tick format for any sync info --- @usage Sync.tick_format(60) -- return {60,'1.00M'} --- @treturn {number,string} table containing both the raw number and clean version of a time -function Sync.tick_format(tick) - if not is_type(tick,'number') then error('Tick was not given to Sync.tick_format',2) end - return {tick,tick_to_display_format(tick)} -end - ---- Prints to chat as if it were a player --- @usage Sync.print('Test','Cooldude2606') --- @tparam string player_message the message to be printed in chat --- @tparam string player_name the name of the player sending the message --- @tparam[opt] string player_tag the tag applied to the player's name --- @tparam[opt] string player_colour the colour of the message, either hex or named colour --- @tparam[opt] string prefix add a prefix before the chat eg [IRC] -function Sync.print(player_message,player_name,player_tag,player_colour,prefix) - if not player_message then error('No message given to Sync.print',2) end - local player = game.player or game.players[player_name] - local tag = player_tag and player_tag ~= '' and ' '..player_tag or '' - local colour = type(player_colour) == 'string' and player_colour or '#FFFFFF' - prefix = prefix and prefix..' ' or '' - -- if it is an in game player it will over ride the given params - if player then - tag = ' '..player.tag - colour = player.chat_color - player_name = player.name - else - -- converts colour into the accepted factorio version - if colour:find('#') then colour = Color.from_hex(colour) - else colour = defines.color[player_colour] end - end - game.print(prefix..player_name..tag..': '..player_message,colour) -end - ---- Outline of the parameters accepted by Sync.emit_embedded --- @table EmitEmbededParamaters --- @field title the tile of the embed --- @field color the color given in hex you can use Color.to_hex{r=0,g=0,b=0} --- @field description the description of the embed --- @field server_detail sting to add onto the pre-set server detail --- @field fieldone the filed to add to the embed (key is name) (value is text) (start value with <<inline>> to make inline) --- @field fieldtwo the filed to add to the embed (key is name) (value is text) (start value with <<inline>> to make inline) - ---- Logs an embed to the json.data we use a js script to add things we cant here --- @usage Sync.emit_embedded{title='BAN',color='0x0',description='A player was banned' ... } --- @tparam table table args a which contains everything that the embedded will use --- @see EmitEmbededParamaters -function Sync.emit_embedded(args) - if not is_type(args,'table') then error('Args table not given to Sync.emit_embedded',2) end - if not game then error('Game has not loaded',2) end - local title = is_type(args.title,'string') and args.title or '' - local color = is_type(args.color,'string') and args.color:find("0x") and args.color or '0x0' - local description = is_type(args.description,'string') and args.description or '' - local server_detail = is_type(args.server_detail,'string') and args.server_detail or '' - local mods_online = 'Mods Online: '..Sync.info.players.admins_online - -- creates the first field given for every emit - local done, fields = {title=true,color=true,description=true,server_detail=true}, {{ - name='Server Details', - value='Server Name: ${serverName} Online Players: '..#game.connected_players..' '..mods_online..' Server Time: '..tick_to_display_format(game.tick)..' '..server_detail - }} - -- for each value given in args it will create a new field for the embed - for key, value in pairs(args) do - if not done[key] then - done[key] = true - local f = {name=key,value='',inline=false} - -- if <> is present then it will cause the field to be inline if the previous - local value, inline = value:gsub("<>",'',1) - if inline > 0 then f.inline = true end - f.value = value - table.insert(fields,f) - end - end - -- forms the data that will be emitted to the file - local log_data = { - title=title, - description=description, - color=color, - fields=fields - } - game.write_file('embedded.json',table.json(log_data)..'\n',true,0) -end - ---- The error handle setup by sync to emit a discord embed for any errors --- @local here --- @function errorHandler --- @tparam string err the error passed by the err control -error.addHandler('Discord Emit',function(err) - if not game then return error(error()) end - local color = Color and Color.to_hex(defines.textcolor.bg) or '0x0' - Sync.emit_embedded{title='SCRIPT ERROR',color=color,description='There was an error in the script @Developers ',Error=err} -end) - ---- Used to get the number of admins currently online --- @usage Sync.count_admins() -- returns number --- @treturn number the number of admins online -function Sync.count_admins() - -- game check - if not game then return 0 end - local _count = 0 - for _,player in pairs(game.connected_players) do - if player.admin then _count=_count+1 end - end - return _count -end - ---- Used to get the number of afk players defined by 2 min by default --- @usage Sync.count_afk_times() --- @tparam[opt=7200] int time in ticks that a player is called afk --- @treturn number the number of afk players -function Sync.count_afk_times(time) - if not game then return 0 end - time = time or 7200 - local rtn = {} - for _,player in pairs(game.connected_players) do - if player.afk_time > time then rtn[player.name] = Sync.tick_format(player.afk_time) end - end - return rtn -end - ---- Used to get the number of players in each rank and currently online --- @usage Sync.count_roles() --- @treturn table contains the ranks and the players in that rank -function Sync.count_roles() - if not game then return {'Offline'} end - local _rtn = {admin={online={},players={}},user={online={},players={}}} - for index,player in pairs(game.players) do - if player.admin then - table.insert(_rtn.admin.players,player.name) - if player.connected then table.insert(_rtn.admin.online,player.name) end - else - table.insert(_rtn.user.players,player.name) - if player.connected then table.insert(_rtn.user.online,player.name) end - end - end - _rtn.admin.n_players,_rtn.admin.n_online=#_rtn.admin.players,#_rtn.admin.online - _rtn.user.n_players,_rtn.user.n_online=#_rtn.user.players,#_rtn.user.online - return _rtn -end - ---- Used to get a list of every player name with the option to limit to only online players --- @usage Sync.count_players() --- @tparam boolean online true will get only the online players --- @treturn table table of player names -function Sync.count_players(online) - if not game then return {'Offline'} end - local _players = {} - local players = {} - if online then _players = game.connected_players else _players = game.players end - for k,player in pairs(_players) do table.insert(players,player.name) end - return players -end - ---- Used to get a list of every player name with the amount of time they have played for --- @usage Sync.count_player_times() --- @treturn table table indexed by player name, each value contains the raw tick and then the clean string -function Sync.count_player_times() - if not game then return {'Offline'} end - local _players = {} - for index,player in pairs(game.players) do - _players[player.name] = Sync.tick_format(player.online_time) - end - return _players -end - ---- used to get the global list that has been defined, also used to set that list --- @usage Sync.info{server_name='Factorio Server 2'} -- returns true --- @usage Sync.info -- table of info --- @tparam[opt=nil] table set keys to be replaced in the server info --- @treturn boolean success was the data set -Sync.info = setmetatable({},{ - __index=global, - __newindex=global, - __call=function(tbl,set) - if not is_type(set,'table') then return false end - for key,value in pairs(set) do global[key] = value end - return true - end, - __pairs=function(tbl) - tbl = global - local function next_pair(tbl,key) - local k, v = next(tbl, key) - if type(v) ~= nil then return k,v end - end - return next_pair, tbl, nil - end, - __ipairs=function(tbl) - tbl = global - local function next_pair(tbl, i) - i = i + 1 - local v = tbl[i] - if v then return i, v end - end - return next_pair, tbl, 0 - end -}) - ---- Called to update values inside of the info --- @usage Sync.update() --- @return all of the new info -function Sync.update() - local info = Sync.info - info.time_period[2] = tick_to_display_format(info.time_period[1]) - info.last_update[1] = game.tick - info.last_update[2] = tick_to_display_format(game.tick) - info.game_speed = game.speed - info.players={ - online=Sync.count_players(true), - n_online=#game.connected_players, - all=Sync.count_players(), - n_all=#game.players, - admins_online=Sync.count_admins(), - afk_players=Sync.count_afk_times(), - times=Sync.count_player_times() - } - info.roles = Sync.count_roles() - info.rockets = game.forces['player'].get_item_launched('satellite') - for key,callback in pairs(Sync_updates) do info[key] = callback() end - return info -end - ---- Adds a callback to be called when the info is updated --- @usage Sync.add_update('players',function() return #game.players end) --- @tparam string key the key that the value will be stored in --- @tparam function function callback the which will return this value -function Sync.add_update(key,callback) - if game then return end - if not is_type(callback,'function') then return end - Sync_updates[key] = callback -end - ---- Outputs the curent server info into a file --- @usage Sync.emit_data() -function Sync.emit_data() - local info = Sync.info - game.write_file('server-info.json',table.json(info),false,0) -end - ---- Updates the info and emits the data to a file --- @usage Sync.emit_update() -function Sync.emit_update() - Sync.update() Sync.emit_data() -end - ---- Used to return and set the current IRL time; not very good need a better way to do this --- @usage Sync.time('Sun Apr 1 18:44:30 UTC 2018') --- @usage Sync.time -- string --- @tparam[opt=nil] string set the date time to be set --- @treturn boolean if the date time set was successful -Sync.time=add_metatable({},function(full,date) - local info = Sync.info - if not is_type(full,'string') then return false end - info.time = full - info.date = date - info.time_set[1] = Sync.tick_format(game.tick) - return true -end,function() local info = Sync.info return info.time..' (+'..(game.tick-info.time_set[1])..' Ticks)' end) - --- will auto replace the file every 5 min by default -Event.add('on_tick',function(event) - local time = Sync.info.time_period[1] - if (event.tick%time)==0 then Sync.emit_update() end -end) - -Event.add('on_player_joined_game',Sync.emit_update) -Event.add('on_pre_player_left_game',Sync.emit_update) -Event.add('on_rocket_launched',Sync.emit_update) - -function Sync:on_init() - if loaded_modules['ExpGamingCore.Gui'] then verbose('ExpGamingCore.Gui is installed; Loading gui src') require(module_path..'/src/gui',{Sync=Sync,module_path=module_path}) end - if loaded_modules['ExpGamingCore.Server'] then require('ExpGamingCore.Server').add_module_to_interface('Sync','ExpGamingCore.Sync') end -end - -function Sync:on_post() - Sync.info{mods=table.keys(loaded_modules)} -end - -return Sync \ No newline at end of file diff --git a/old/modules/ExpGamingCore/Sync/softmod.json b/old/modules/ExpGamingCore/Sync/softmod.json deleted file mode 100644 index c86e56dd..00000000 --- a/old/modules/ExpGamingCore/Sync/softmod.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "ExpGamingCore.Sync", - "version": "4.0.0", - "description": "Allows syncing with an outside server and info panle.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Library", - "Lib", - "ExpGaming", - "Core", - "Info", - "Sync", - "External", - "Discord" - ], - "dependencies": { - "ExpGamingLib": "^4.0.0", - "FactorioStdLib.Color": "^0.8.0", - "FactorioStdLib.Game": "^0.8.0", - "FactorioStdLib.Table": "^0.8.0", - "ExpGamingCore.Role": "?^4.0.0", - "ExpGamingCore.Gui": "?^4.0.0", - "ExpGamingCore.Server": "?^4.0.0" - }, - "collection": "ExpGamingCore@4.0.0", - "submodules": {} -} diff --git a/old/modules/ExpGamingCore/Sync/src/gui.lua b/old/modules/ExpGamingCore/Sync/src/gui.lua deleted file mode 100644 index 72c256dd..00000000 --- a/old/modules/ExpGamingCore/Sync/src/gui.lua +++ /dev/null @@ -1,106 +0,0 @@ ---- Allows syncing with an outside server and info panel. --- @submodule ExpGamingCore.Sync --- @alias Sync --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - ---- This file will be loaded when ExpGamingCore.Gui is present --- @function _comment - -local Gui = require('ExpGamingCore.Gui') -local Sync = Sync -- this is to force sync to remain in the ENV - -local Sync_gui_functions = {} -local logo_sprite_path = 'file'..string.sub(module_path,2)..'/src/logo.png' - ---- Adds a element to the sever info gui --- @usage Sync.add_to_gui('string') -- return true --- @param element see examples before for what can be used, it can also be a return from Gui.inputs.add --- @treturn boolean based on weather it was successful or not -function Sync.add_to_gui(element,...) - if game then return false end - if is_type(element,'function') then - table.insert(Sync_gui_functions,{'function',element,...}) - elseif is_type(element,'table') then - if element.draw then table.insert(Sync_gui_functions,{'gui',element}) - else table.insert(Sync_gui_functions,{'table',element}) end - else table.insert(Sync_gui_functions,{'string',element}) end - return true -end - -Sync.add_to_gui('Welcome to the Explosive Gaming community! This is one of many servers which we host.') -Sync.add_to_gui(function(player,frame) return 'This server\'s next reset: '..Sync.info.reset_time end) - ---- Formats a label to be a certain format --- @local label_format -local function label_format(label,width) - label.style.width = width - label.style.align = 'center' - label.style.single_line = false -end - ---- Creates a center gui that will appear on join --- @gui server-info -Sync.info_gui = Gui.center{ - name='server-info', - caption=logo_sprite_path, - tooltip='Basic info about the current server', - draw=function(self,frame) - frame.caption = '' - local info = Sync.info - frame = frame.add{type='flow',direction='vertical'} - local h_flow = frame.add{type='flow'} - h_flow.add{type='sprite',sprite=logo_sprite_path} - local v_flow = h_flow.add{type='flow',direction='vertical'} - h_flow.add{type='sprite',sprite=logo_sprite_path} - local _flow = v_flow.add{type='flow'} - label_format(v_flow.add{ - type='label', - caption=info.server_description,style='description_label' - },412) - Gui.bar(_flow,110) - label_format(_flow.add{ - type='label', - caption='Welcome To '..info.server_name, - style='caption_label' - },180) - Gui.bar(_flow,110) - Gui.bar(frame,600) - local _frame = frame - frame = frame.add{ - type='frame', - direction='vertical', - style='image_frame' - } - frame.style.width = 600 - local text_flow = frame.add{type='flow',direction='vertical'} - local button_flow = frame.add{type='table',column_count=3} - for _,element in pairs(table.deepcopy(Sync_gui_functions)) do - local _type = table.remove(element,1) - if _type == 'function' then - local success, err = pcall(table.remove(element,1),frame.player_index,frame,unpack(element)) - if not success then error(err) else - if is_type(err,'table') then - if element.draw then element:draw(button_flow).style.width = 195 - else label_format(text_flow.add{type='label',caption=err},585) end - else label_format(text_flow.add{type='label',caption=tostring(err)},585) end - end - elseif _type == 'gui' then element[1]:draw(button_flow).style.width = 195 - elseif _type == 'string' then label_format(text_flow.add{type='label',caption=tostring(element[1])},585) - elseif _type == 'table' then label_format(text_flow.add{type='label',caption=element[1]},585) end - end - _frame.add{ - type='label', - caption='Press Ecs or E to close; this is only visible once!', - style='fake_disabled_label' - }.style.font='default-small' -end} - -Event.add(defines.events.on_gui_click,function(event) - local element = event.element - if element and element.valid and element.caption and element.caption == 'Press Ecs or E to close; this is only visible once!' then - Gui.center.clear(event) - end -end) - -Event.add(defines.events.on_player_joined_game,function(event) Sync.info_gui(event) end) \ No newline at end of file diff --git a/old/modules/ExpGamingCore/Sync/src/logo.png b/old/modules/ExpGamingCore/Sync/src/logo.png deleted file mode 100644 index cef59c4d..00000000 Binary files a/old/modules/ExpGamingCore/Sync/src/logo.png and /dev/null differ diff --git a/old/modules/ExpGamingCore/softmod.json b/old/modules/ExpGamingCore/softmod.json deleted file mode 100644 index 4b2715eb..00000000 --- a/old/modules/ExpGamingCore/softmod.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "ExpGamingCore", - "version": "4.0.0", - "description": "Explosive Gaming Core Files", - "location": "FSM_ARCHIVE", - "keywords": [ - "Library", - "Lib", - "ExpGaming", - "Core" - ], - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "submodules": { - "ExpGamingCore.Gui": "4.0.0", - "ExpGamingCore.Server": "4.0.0", - "ExpGamingCore.Sync": "4.0.0", - "ExpGamingCore.Command": "4.0.0", - "ExpGamingCore.Group": "4.0.0", - "ExpGamingCore.Role": "4.0.0" - }, - "dependencies": {} -} diff --git a/old/modules/ExpGamingInfo/Readme/control.lua b/old/modules/ExpGamingInfo/Readme/control.lua deleted file mode 100644 index 55365037..00000000 --- a/old/modules/ExpGamingInfo/Readme/control.lua +++ /dev/null @@ -1,132 +0,0 @@ ---- Adds a readme gui to the game that contains useful information --- @module ExpGamingInfo.Readme --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Gui = require('ExpGamingCore.Gui') - --- Module Define -local module_verbose = false -local ThisModule = { - on_init=function() - if loaded_modules['ExpGamingCore.Sync'] then require(module_path..'/src/sync') end - end -} - --- Function Define -local function format_label(label) - label.style.maximal_width = 480 - label.style.single_line = false -end - -ThisModule.Gui = Gui.center{ - name='readme', - caption='utility/questionmark', - tooltip={'ExpGamingInfo-Readme.tooltip'} -}:add_tab('guildlines',{'ExpGamingInfo-Readme.guildlines-name'},{'ExpGamingInfo-Readme.guildlines-tooltip'},function(frame) - for i = 1,10 do - local style=nil; if i == 1 then style = 'caption_label' end - format_label(frame.add{ - type='label', - caption={'ExpGamingInfo-Readme.guildlines-line'..tostring(i)}, - style=style - }) - end -end):add_tab('chat',{'ExpGamingInfo-Readme.chat-name'},{'ExpGamingInfo-Readme.chat-tooltip'},function(frame) - format_label(frame.add{ - type='label', - caption={'ExpGamingInfo-Readme.chat-singleline'} - }) -end):add_tab('commands',{'ExpGamingInfo-Readme.commands-name'},{'ExpGamingInfo-Readme.commands-tooltip'},function(frame) - format_label(frame.add{ - type='label', - caption={'ExpGamingInfo-Readme.commands-singleline'} - }) - Gui.bar(frame,480) - local table = frame.add{name='command_table',type='table',column_count=2} - table.add{ - type='label', - caption={'ExpGamingInfo-Readme.commands-col1'}, - style='caption_label' - } - table.add{ - type='label', - caption={'ExpGamingInfo-Readme.commands-col2'}, - style='caption_label' - } - table.style.width = 480 - table.draw_vertical_lines = true - table.draw_horizontal_line_after_headers = true - for _,command in pairs(commands.get_commands(frame.player_index)) do - table.add{ - type='label', - caption='/'..command.name - } - local description = table.add{ - type='label', - caption=command.description, - } - description.style.maximal_width = 400 - description.style.single_line = false - end -end):add_tab('links',{'ExpGamingInfo-Readme.links-name'},{'ExpGamingInfo-Readme.links-tooltip'},function(frame) - local links={ - 'https://discord.explosivegaming.nl', - 'https://explosivegaming.nl', - 'http://steamcommunity.com/groups/tntexplosivegaming', - 'https://www.patreon.com/badgamernl', - 'https://wiki.explosivegaming.nl/' - } - local function format(text_box) - text_box.style.minimal_width=400 - text_box.read_only = true - text_box.word_wrap = true - text_box.selectable = true - end - for i,link in pairs(links) do - frame.add{ - type="label", - caption={'ExpGamingInfo-Readme.links-cap'..tostring(i)}, - style='caption_label' - } - format(frame.add{ - type='text-box', - text=link - }) - end -end):add_tab('servers',{'ExpGamingInfo-Readme.servers-name'},{'ExpGamingInfo-Readme.servers-tooltip'},function(frame) - format_label(frame.add{ - type='label', - caption={'ExpGamingInfo-Readme.servers-singleline'} - }) - Gui.bar(frame,480) - for i = 1,6 do - frame.add{ - type='label', - caption={'ExpGamingInfo-Readme.servers-format',tostring(i),{'ExpGamingInfo-Readme.servers-cap'..tostring(i)}}, - style='caption_label' - } - format_label(frame.add{ - type='label', - caption={'ExpGamingInfo-Readme.servers-des'..tostring(i)} - }) - end -end):add_tab('rules',{'ExpGamingInfo-Readme.rules-name'},{'ExpGamingInfo-Readme.rules-tooltip'},function(frame) - format_label(frame.add{ - type='label', - caption={'ExpGamingInfo-Readme.rules-singleline'} - }) - Gui.bar(frame,480) - for i = 1,20 do - format_label(frame.add{ - type='label', - caption={'ExpGamingInfo-Readme.rules-format',i,{'ExpGamingInfo-Readme.rules-rule'..tostring(i)}} - }) - end -end) - --- Module Return --- when called will open readme for that user -return setmetatable(ThisModule,{__call=function(self,...) self.Gui(...) end}) \ No newline at end of file diff --git a/old/modules/ExpGamingInfo/Readme/locale/de.cfg b/old/modules/ExpGamingInfo/Readme/locale/de.cfg deleted file mode 100644 index 4fc2512b..00000000 --- a/old/modules/ExpGamingInfo/Readme/locale/de.cfg +++ /dev/null @@ -1,68 +0,0 @@ -[ExpGamingInfo-Readme] -tooltip=Open the readme gui that opens when you first join. -guildlines-name=Guild Lines -guildlines-tooltip=These are the guildlines you should follow -guildlines-line1=Welcome to the Explosive Gaming Community! -guildlines-line2= -guildlines-line3=Here are some guidelines to keep this Server fun for everyone: -guildlines-line4=- Hacking / cheating / abusing bugs will not be tolerated. -guildlines-line5=- Be polite and use common sense. -guildlines-line6=- Nobody likes spam. That includes: Chat, Bots, unlimited Chests and Concrete. -guildlines-line7=- Do not remove stuff without even trying to talk / ask about it. -guildlines-line8=- Trains: LHD (Left hand drive), no Loops and use them for long distances. (- Trains are only allowed in LHD (Left Hand Drive). Train loops. UPDATE) -guildlines-line9= -guildlines-line10=If you have any questions about the rules, the server or the game in general, feel free to ask. Have Fun! -chat-name=How To Chat -chat-tooltip=How to chat in factorio with default key config -chat-singleline=Chatting can be difficult for new players because it’s different than other games! It’s very simple, the button you need to press is the “GRAVE/TILDE” key it’s located under the “ESC key”. If you would like to change the key go to your controls tab in options. The key you need to change is “Toggle Lua console” it’s located in the second column 2nd from bottom. -commands-name=Commands -commands-tooltip=These are the commands you can use -commands-singleline=These are the many diffrent custom commands you are able to use, the base game commands are not shown -commands-col1=Command Name -commands-col2=Command Help -links-name=Links -links-tooltip=Helpful links for ways to get in touch -links-cap1=Discord voice and chat server: -links-cap2=Our website: -links-cap3=Steam: -links-cap4=Patreon: -servers-name=Servers -servers-tooltip=Info on our other servers -servers-singleline=Welcome to the Explosive Gaming Community! S1-S3 are staggered resets. -servers-format=S__1__: __2__ -servers-cap1=Public -servers-des1=A place for all players, this map reset every 144H At 16:00 UTC. -servers-cap2=Public -servers-des2=A place for all players, this map reset every 144H At 16:00 UTC. -servers-cap3=Public -servers-des3=A place for all players, this map reset every 144H At 16:00 UTC. -servers-cap4=Modded -servers-des4=A modded server not much to say, just download the mods to play. Link on Discord for members. -servers-cap5=Events -servers-des5=Sometimes we hold events, may require a password, join discord for more info. -servers-cap6=Donator -servers-des6=For those people who have two much money and give us some. Anything goes per request. -rules-name=All Rules -rules-tooltip=A full list of rules for the server -rules-singleline=This is a full list of rules what must be followed, the guildlines will cover most points in here but for those who like to follow the rules word to word then here is the full list. -rules-format=__1__) __2__ -rules-rule1=Hacking/cheating, exploiting and abusing bugs is not allowed. -rules-rule2=Any bugs or exploits found should be reported. (no creative items) -rules-rule3=Do not disrespect any player in the server. -rules-rule4=Do not take every item frmo a belt or via logics request, share resources. -rules-rule5=Do not spam, this includes stuff such as chat spam, item spam, chest spam etc. -rules-rule6=Do not laydown or remove concrete or stone with bots without permission. -rules-rule7=Do not use active provider chests without permission. -rules-rule8=Do not use speakers on global or with alearts without permission. -rules-rule9=Do not remove/move major parts of the factory without permission. -rules-rule10=Do not walk in player random direction for no reason(to save map size). -rules-rule11=Do not remove stuff just because you dont like it, tell people first. -rules-rule12=Do not rotate belts, deactive belts with wires, or cause production to stop. -rules-rule13=Do not make train roundabouts. Or any loops of any kind. -rules-rule14=When using trains use the same size that others have used. -rules-rule15=Trains are Left Hand Drive (LHD) only. -rules-rule16=Do not complain about lag, low fps and low ups or other things like that. -rules-rule17=Do not ask for rank, our ranks are synced with discord, admins cant give ranks. -rules-rule18=Do not advertise other servers unless you are a trusted server owner. -rules-rule19=Report any one who breaks the rules. -rules-rule20=Use common sense and what an admin says goes. diff --git a/old/modules/ExpGamingInfo/Readme/locale/en.cfg b/old/modules/ExpGamingInfo/Readme/locale/en.cfg deleted file mode 100644 index 086261eb..00000000 --- a/old/modules/ExpGamingInfo/Readme/locale/en.cfg +++ /dev/null @@ -1,69 +0,0 @@ -[ExpGamingInfo-Readme] -tooltip=Open the ReadMe if this is your first time joining. -guildlines-name=Guidelines -guildlines-tooltip=These are the guidelines everyone should follow -guildlines-line1=Welcome to the Explosive Gaming Community! -guildlines-line2=Here are some guidelines that everyone is obligated to follow. -guildlines-line3=!!!No rights can be derived from these guidelines as the full list of rules (another tab in this window) is valid / operative!!! -guildlines-line4=- Hacking / cheating / abusing bugs will not be tolerated. -guildlines-line5=- Be polite and use common sense. -guildlines-line6=- Spamming (in the form of chat, bots, unlimited chests and concrete) is not allowed. -guildlines-line7=- Do not remove stuff without asking your fellow players. -guildlines-line8=- Trains are only allowed in LHD (Left Hand Drive). No train loops! -guildlines-line9= -guildlines-line10=If you have any questions about our rules, the server or Factorio in general, feel free to ask your fellow players or our helpful team. Have fun! -chat-name=How To Chat -chat-tooltip=How to chat in Factorio with default key config -chat-singleline=Chatting can be difficult for new players because it’s different than other games! It’s very simple, the button you need to press is the “GRAVE/TILDE” key (which is located under the “ESC key”) - If you would like to change the key, go to your Controls tab in options. The key you need to change is “Toggle LUA console” -commands-name=Commands -commands-tooltip=Commands that you can use in ExplosiveGaming -commands-singleline=Custom commands that you can use. Base commands are not shown here. -commands-col1=Command Name -commands-col2=Command Help -links-name=Links -links-tooltip=Helpful links for ways to get in touch with us -links-cap1=Discord voice and chat server: -links-cap2=Our website: -links-cap3=Steam: -links-cap4=Patreon: -links-cap5=Our wiki: -servers-name=Servers -servers-tooltip=Info on our other servers -servers-singleline=Welcome to the Explosive Gaming Community! S1-S3 are staggered resets. -servers-format=S__1__: __2__ -servers-cap1=Public -servers-des1=A place for all players, this map resets every 144H At 16:00 UTC. -servers-cap2=Public -servers-des2=A place for all players, this map resets every 144H At 16:00 UTC. -servers-cap3=Public -servers-des3=A place for all players, this map resets every 144H At 16:00 UTC. -servers-cap4=Modded -servers-des4=A Modded server for all players. Link on Discord for members. -servers-cap5=Events -servers-des5=Server for events (everyone can join) - May require a password. Join Discord for more info -servers-cap6=Donator -servers-des6=For players who support us financially. Changes can be made per request. -rules-name=Rules -rules-tooltip=The full list of ExplosiveGaming rules. -rules-singleline=Although the guidelines cover most of our rules, the full list always have more priority and override any guideline. It is advised to be familiar with all rules to prevent warnings or bans. -rules-format=__1__) __2__ -rules-rule1=Hacking / cheating / abusing bugs will not be tolerated. -rules-rule2=Any bugs or exploits found should be reported to our team members. (excluding creative items) -rules-rule3=Do not disrespect any player in the server. -rules-rule4=Taking all items from a belt or logistics request is forbidden: sharing resources is mandatory. -rules-rule5=Spamming (in the form of chat, bots, unlimited chests and concrete) is not allowed. -rules-rule6=Do not lay down/remove concrete or stone with bots without permission. -rules-rule7=Do not use active provider chests without permission. -rules-rule8=Do not use speakers on global or with alerts without permission. -rules-rule9=Do not remove/move major parts of the factory without permission. -rules-rule10=Do not walk in random directions for no reason (to save map size and server resources). -rules-rule11=Do not remove stuff without asking your fellow players. -rules-rule12=Do not rotate belts, deactivate belts with wires, or cause production to stop. -rules-rule13=Do not make train roundabouts. Or any loops of any kind. -rules-rule14=When using trains, use the same size other players have used. -rules-rule15=Trains are Left Hand Drive (LHD) only. -rules-rule16=Do not complain about lag, low fps and low ups etc. -rules-rule17=Do not ask for ranks. Our ranks are synchronized with Discord, make sure to join us there. -rules-rule18=Do not advertise other servers unless you are a trusted server owner. -rules-rule19=Report players who break the rules. -rules-rule20=Use common sense and what an Admin says goes. diff --git a/old/modules/ExpGamingInfo/Readme/locale/fr.cfg b/old/modules/ExpGamingInfo/Readme/locale/fr.cfg deleted file mode 100644 index 45c6f9d0..00000000 --- a/old/modules/ExpGamingInfo/Readme/locale/fr.cfg +++ /dev/null @@ -1,68 +0,0 @@ -[ExpGamingInfo-Readme] -tooltip=Open the readme gui that opens when you first join. -guildlines-name=Guild Lines -guildlines-tooltip=These are the guildlines you should follow -guildlines-line1=Welcome to the Explosive Gaming Community! -guildlines-line2= -guildlines-line3=Here are some guidelines to keep this Server fun for everyone: -guildlines-line4=- Hacking / cheating / abusing bugs will not be tolerated. -guildlines-line5=- Be polite and use common sense. -guildlines-line6=- Nobody likes spam. That includes: Chat, Bots, unlimited Chests and Concrete. -guildlines-line7=- Do not remove stuff without even trying to talk / ask about it. -guildlines-line8=- Trains: LHD (Left hand drive), no Loops and use them for long distances. (- Trains are only allowed in LHD (Left Hand Drive). Train loops. UPDATE) -guildlines-line9= -guildlines-line10=If you have any questions about the rules, the server or the game in general, feel free to ask. Have Fun! -chat-name=How To Chat -chat-tooltip=How to chat in factorio with default key config -chat-singleline=Chatting can be difficult for new players because it’s different than other games! It’s very simple, the button you need to press is the “GRAVE/TILDE” key it’s located under the “ESC key”. If you would like to change the key go to your controls tab in options. The key you need to change is “Toggle Lua console” it’s located in the second column 2nd from bottom. -commands-name=Commands -commands-tooltip=These are the commands you can use -commands-singleline=These are the many diffrent custom commands you are able to use, the base game commands are not shown -commands-col1=Command Name -commands-col2=Command Help -links-name=Links -links-tooltip=Helpful links for ways to get in touch -links-cap1=Discord voice and chat server: -links-cap2=Our website: -links-cap3=Steam: -links-cap4=Patreon: -servers-name=Servers -servers-tooltip=Info on our other servers -servers-singleline=Welcome to the Explosive Gaming Community! -servers-format=S__1__: __2__ -servers-cap1=Public -servers-des1=A place for all players, this map reset every 24h. -servers-cap2=Standard -servers-des2=Before you play make sure you understand the game, reset every 48h. -servers-cap3=Pro -servers-des3=A pure mega base server, reset every 7 days and a password is needed to join. -servers-cap4=Modded -servers-des4=A modded server not much to say, just download the mods to play. Link on Discord for members. -servers-cap5=Events -servers-des5=Sometimes we hold events, may require a password, join discord for more info. -servers-cap6=Donator -servers-des6=For those people who have two much money and give us some. Anything goes per request. -rules-name=All Rules -rules-tooltip=A full list of rules for the server -rules-singleline=This is a full list of rules what must be followed, the guildlines will cover most points in here but for those who like to follow the rules word to word then here is the full list. -rules-format=__1__) __2__ -rules-rule1=Hacking/cheating, exploiting and abusing bugs is not allowed. -rules-rule2=Any bugs or exploits found should be reported. (no creative items) -rules-rule3=Do not disrespect any player in the server. -rules-rule4=Do not take every item frmo a belt or via logics request, share resources. -rules-rule5=Do not spam, this includes stuff such as chat spam, item spam, chest spam etc. -rules-rule6=Do not laydown or remove concrete or stone with bots without permission. -rules-rule7=Do not use active provider chests without permission. -rules-rule8=Do not use speakers on global or with alearts without permission. -rules-rule9=Do not remove/move major parts of the factory without permission. -rules-rule10=Do not walk in player random direction for no reason(to save map size). -rules-rule11=Do not remove stuff just because you dont like it, tell people first. -rules-rule12=Do not rotate belts, deactive belts with wires, or cause production to stop. -rules-rule13=Do not make train roundabouts. Or any loops of any kind. -rules-rule14=When using trains use the same size that others have used. -rules-rule15=Trains are Left Hand Drive (LHD) only. -rules-rule16=Do not complain about lag, low fps and low ups or other things like that. -rules-rule17=Do not ask for rank, our ranks are synced with discord, admins cant give ranks. -rules-rule18=Do not advertise other servers unless you are a trusted server owner. -rules-rule19=Report any one who breaks the rules. -rules-rule20=Use common sense and what an admin says goes. \ No newline at end of file diff --git a/old/modules/ExpGamingInfo/Readme/locale/nl.cfg b/old/modules/ExpGamingInfo/Readme/locale/nl.cfg deleted file mode 100644 index cc54dbd3..00000000 --- a/old/modules/ExpGamingInfo/Readme/locale/nl.cfg +++ /dev/null @@ -1,68 +0,0 @@ -[ExpGamingInfo-Readme] -tooltip=Open de ReadMe wanneer je voor het eerst speelt. -guildlines-name=Richtlijnen -guildlines-tooltip=Dit zijn de richtlijnen die je moet volgen. -guildlines-line1=Welkom op de ExplosiveGaming community! -guildlines-line2= -guildlines-line3=Hier zijn een aantal richtlijnen die ieder speler moet volgen. -guildlines-line4=- Hacken / cheaten en bugs misbruiken is niet toegestaan. -guildlines-line5=- Wees aardig en gebruik je gezonde verstand. -guildlines-line6=- Spammen (in de zin van chat, kisten en beton) is niet toegestaan. -guildlines-line7=- Geen spullen verwijderen zonder toestemming van andere spelers. -guildlines-line8=- Treinen (LHD - Left Hand Drive) geen loops. (- Trains are only allowed in LHD (Left Hand Drive). Train loops. UPDATE) -guildlines-line9= -guildlines-line10=Als je vragen hebt over deze regels of over de server in algemeen, aarzel dan niet om contact op te nemen met onze staff. -chat-name=Chatten -chat-tooltip=Chatten in Factorio met standaard instellingen -chat-singleline=Chatten kan moeilijk zijn voor nieuwe spelers omdat de chatmechanisme in Factorio anders is dan andere spellen. Het is simpel: druk op de "GRAVE/TILDE" knop (locatie is onder de ESC knop). Als je deze knop wilt aanpassen, ga naar de Controls tab in Opties. De knop die je moet aanpassen is "Toggle LUA Console" -commands-name=Commands -commands-tooltip=Dit zijn de commands die je kunt gebruiken. -commands-singleline=Er zijn veel verschillende custom commands die je kunt gebruiken. Let er wel op dat basis commands hier niet zichtbaar zijn. -commands-col1=Commando naam -commands-col2=Commando hulp -links-name=Links -links-tooltip=Nuttige links om in contact te komen met de community -links-cap1=Discord server: -links-cap2=Onze website: -links-cap3=Steam: -links-cap4=Patreon: -servers-name=Servers -servers-tooltip=Info over onze andere servers -servers-singleline=Welkom op de ExplosiveGaming community! S1 tot en met S3 heeft geplande resets. -servers-format=S__1__: __2__ -servers-cap1=Openbaar -servers-des1=Server voor alle spelers, deze map reset elke 144 uur om 16:00 UTC. -servers-cap2=Openbaar -servers-des2=A place for all players, deze map reset elke 144 uur om 16:00 UTC. -servers-cap3=Openbaar -servers-des3=A place for all players, deze map reset elke 144 uur om 16:00 UTC. -servers-cap4=Modded -servers-des4=Een modded server voor alle spelers. Links zijn te vinden in de Discord server. -servers-cap5=Events -servers-des5=Server voor events. Links en wachtwoorden zijn te vinden in de Discord server. -servers-cap6=Donator -servers-des6=Voor de spelers die ons financieel ondersteunen. -rules-name=Alle regels -rules-tooltip=Een lijst met regels die van toepassing zijn op alle ExplosiveGaming servers. -rules-singleline=Dit is een lijst met alle regels. De richtlijnen behandelt de meeste punten, maar de volledige lijst is ook van toepassing. -rules-format=__1__) __2__ -rules-rule1=Hacken / cheaten en bugs misbruiken is niet toegestaan. -rules-rule2=Bugs of fouten horen gerapporteerd te worden aan de staff. -rules-rule3=Respecteer iedereen in de server. -rules-rule4=Pak niet alles uit een belt of via logistiekaanvragen: deel je middelen. -rules-rule5=Spammen (in de zin van chat, kisten en beton) is niet toegestaan. -rules-rule6=Bouw geen beton of steen met bots zonder toestemming. -rules-rule7=Gebruik geen actieve providerkist zonder toestemming. -rules-rule8=Gebruik geen speakers (globaal of met alerts) zonder toestemming. -rules-rule9=Verwijder geen grote delen van het fabriek zonder toestemming. -rules-rule10=Loop niet in willekeurige plekken zonder een reden (bespaart mapgrootte en server resources) -rules-rule11=Geen spullen verwijderen zonder toestemming van andere spelers. -rules-rule12=Draai de belts niet, deactiveer belts niet met draden en laat de productie niet stoppen. -rules-rule13=Maak geen treinrotondes of lussen. -rules-rule14=Gebruik de zelfde grootte treinen als andere spelers. -rules-rule15=Treinen zijn alleen LHD (Left Hand Drive) -rules-rule16=Klaag niet over de lag, lage FPS of lage UPS. -rules-rule17=Vraag niet om ranks: ranks zijn synchroon met onze Discord server. -rules-rule18=Maak geen reclame voor andere servers, tenzij je daarvoor bevoegd bent. -rules-rule19=Rapporteer spelers die de regels breken. -rules-rule20=Gebruik gezond verstand. diff --git a/old/modules/ExpGamingInfo/Readme/locale/sv-SE.cfg b/old/modules/ExpGamingInfo/Readme/locale/sv-SE.cfg deleted file mode 100644 index 5299c304..00000000 --- a/old/modules/ExpGamingInfo/Readme/locale/sv-SE.cfg +++ /dev/null @@ -1,69 +0,0 @@ -[ExpGamingInfo-Readme] -tooltip=Öppna ReadMe om det här är första gången du ansluter dig. -guildlines-name=Riktlinjer -guildlines-tooltip=Det här är riktlinjerna som alla bör följa -guildlines-line1=Välkommen till gemenskapen ExplosiveGaming! -guildlines-line2=Här är riktlinjerna som alla är tvingade att följa. -guildlines-line3=!!!No rights can be derived from these guidelines as the full list of rules (another tab in this window) is valid / operative!!! -guildlines-line4=- Dataintrång / fusk / missbruk av buggar kommer inte att tolereras. -guildlines-line5=- Var artig och använd sunt förnuft. -guildlines-line6=- Spam (genom chat, bottar, obegränsade kistor och betong) är inte tillåtet. -guildlines-line7=- Ta inte bort saker utan att fråga dina medspelare. -guildlines-line8=- Tåg är bara tillåtna med vänstertrafik. Inga tågloopar! -guildlines-line9= -guildlines-line10= Om du har frågor om reglerna, servern eller generelt om Factorio, känn dig fri att fråga dina medspelare eller vårat hjälpsamma team. Ha kul! -chat-name=Hur du chattar -chat-tooltip=Hur du chattar i Factorio med standardinställningar -chat-singleline=Att chatta kan vara svårt för nya spelare efterson det är annurlunda från andra spel. Det är väldigt enkelt, tangenten som du behöver trycka på är "ö".Om du vill byta det, gå in till "kontroller" och ändra tangent för "lua konsol". -commands-name=Kommandon -commands-tooltip=Kommandon som du kan använda i ExplosiveGaming -commands-singleline=Anpassade kommandon som du kan använda. Baskommandon visas inte här. -commands-col1=Kommandonamn -commands-col2=kommandohjälp -links-name=Länkar -links-tooltip=Hjälpfulla länkar som visar vägar att komma i kontakt med oss. -links-cap1=Discord röst- och chatserver: -links-cap2=Våran Webbadress : -links-cap3=Steam: -links-cap4=Patreon: -links-cap5=Vår wiki: -servers-name=Servrar -servers-tooltip=Information om våra servrar -servers-singleline=Välkommen till ExplosiveGamings gemenskap! S1-S3 har förskjutna återställningar (resets). -servers-format=S__1__: __2__ -servers-cap1=Offentlig -servers-des1=En plats för alla spelare, then här kartan återställs varje 144H, 16:00 UTC. -servers-cap2=Offentlig -servers-des2=En plats för alla spelare, then här kartan återställs varje 144H, 16:00 UTC. -servers-cap3=Offentlig -servers-des3=En plats för alla spelare, then här kartan återställs varje 144H, 16:00 UTC. -servers-cap4=Modifierad -servers-des4=En modifierad server för alla spelare. Länk i Discord för medlemmar. -servers-cap5=Evenemang -servers-des5=Server för evenemang (alla kan ansluta sig) - Kan kräva lösenord. Anslut dig till Discord för mer info. -servers-cap6=Donator -servers-des6=För spelare som stöder oss finansiellt. Ändringar kan göras på begäran. -rules-name=Regler -rules-tooltip=Den fullla listan över ExplosiveGamings regler. -rules-singleline=Även om riktlinjerna täcker de flesta av reglerna så har den fulla listan alltid prioritet och går alltid före riktlinjerna. Det är välbetänkt att vara bekant med alla reglerna för att förhindra varningar och bannlystningar. -rules-format=__1__) __2__ -rules-rule1=Dataintrång / fusk / missbruk av buggar kommer inte att tolereras. -rules-rule2=Buggar och utnyttjingssätt ska rapporteras till team-medlemmar (exkludera kreativa saker) -rules-rule3=Var inte respektlös mot någon annan spelare i servern. -rules-rule4=Att ta alla saker från ett bälte eller logistikbegäran är förbjudet: att dela med sig av resurserna är obligatoriskt. -rules-rule5=Spam (genom chat, bottar, obegränsade kistor eller betong) är inte tillåtet. -rules-rule6=Gör inga placeringar/borttagningar av betong eller sten med hjälp av bottar utan tillåtelse. -rules-rule7=Använd inte aktiva tillgångskistor utan tillåtelse. -rules-rule8=Använd inte globala högtalare eller varningar utan tillåtelse. -rules-rule9=Ta inte bort eller flytta huvuddelar av fabriken utan tillåtelse. -rules-rule10=Gå inte omkring i slumpvisa riktningar utan anledning (för att spara kartstorlek och serverresurser) -rules-rule11=Ta inte bort saker utan att fråga dina medspelare. -rules-rule12=Rotera inte bälten, deaktivera inte bälten med kabel och orsaka inte produktionsstop. -rules-rule13=Gör inte tågrondeller. Eller någon loop av något slag. -rules-rule14=Vid användning av tåg, använd samma storlek som andra spelare använt sig av. -rules-rule15=Tåg körs endast med vänstertrafik. -rules-rule16=Klaga inte om lag, låg fps, låg ups etc. -rules-rule17=Be inte om högre rang. Våra ranger är synkroniserade med Discord, se till att du ansluter dig till oss där. -rules-rule18=Gör inte reklam för andra servrar om du inte är en betrodd serverägare. -rules-rule19=Rapportera spelare som bryter mot reglerna. -rules-rule20=Använd sunt förnuft och vad en admin säger gäller. diff --git a/old/modules/ExpGamingInfo/Readme/softmod.json b/old/modules/ExpGamingInfo/Readme/softmod.json deleted file mode 100644 index d824408e..00000000 --- a/old/modules/ExpGamingInfo/Readme/softmod.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "ExpGamingInfo.Readme", - "version": "4.0.0", - "description": "Adds a readme gui to the game that contains useful information", - "location": "FSM_ARCHIVE", - "keywords": [ - "Gui", - "Info", - "ExpGaming", - "Readme", - "New Player" - ], - "author": "", - "contact": "", - "license": "", - "dependencies": { - "ExpGamingCore.Gui": "^4.0.0", - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Sync": "?^4.0.0" - }, - "submodules": {}, - "collection": "ExpGamingInfo@4.0.0" -} diff --git a/old/modules/ExpGamingInfo/Readme/src/sync.lua b/old/modules/ExpGamingInfo/Readme/src/sync.lua deleted file mode 100644 index 51c3c8da..00000000 --- a/old/modules/ExpGamingInfo/Readme/src/sync.lua +++ /dev/null @@ -1,14 +0,0 @@ -local Sync = require('ExpGamingCore.Sync') -local Gui = require('ExpGamingCore.Gui') - -Sync.add_to_gui(Gui.inputs.add_button('readme-sync-guildlines','View Guildlines','View the guildlines in the readme',function(player,element) - Gui.center.open_tab(player,'readme','guildlines') -end)) - -Sync.add_to_gui(Gui.inputs.add_button('readme-sync-links','View Other Links','View the links in the readme',function(player,element) - Gui.center.open_tab(player,'readme','links') -end)) - -Sync.add_to_gui(Gui.inputs.add_button('readme-sync-rules','View All Rules','View the all rules in the readme',function(player,element) - Gui.center.open_tab(player,'readme','rules') -end)) \ No newline at end of file diff --git a/old/modules/ExpGamingInfo/softmod.json b/old/modules/ExpGamingInfo/softmod.json deleted file mode 100644 index fda8359b..00000000 --- a/old/modules/ExpGamingInfo/softmod.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "ExpGamingInfo", - "version": "4.0.0", - "description": "Adds info guis to the game for different production areas", - "location": "FSM_ARCHIVE", - "keywords": [ - "Gui", - "Info", - "ExpGaming", - "Production" - ], - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606@5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "submodules": { - "ExpGamingInfo.Readme": "4.0.0", - "ExpGamingInfo.Rockets": "4.0.0", - "ExpGamingInfo.Science": "4.0.0", - "ExpGamingInfo.Tasklist": "4.0.0" - } -} diff --git a/old/modules/ExpGamingPlayer/afkKick/control.lua b/old/modules/ExpGamingPlayer/afkKick/control.lua deleted file mode 100644 index 1add91c9..00000000 --- a/old/modules/ExpGamingPlayer/afkKick/control.lua +++ /dev/null @@ -1,37 +0,0 @@ ---- A full ranking system for factorio. --- @module ExpGamingPlayer.afkKick@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - -local Game = require('FactorioStdLib.Game') -local Role -- ExpGamingCore.Role@^4.0.0 -local Sync -- ExpGamingCore.Sync@^4.0.0 - -local function get_allowed_afk_time(player) - player = Game.get_player(player) - local role = Role and Role.get_highest(player) or {index=1,allow_afk_kick=not player.admin} - local player_count = #game.connected_players - local role_count = Role and Role.meta.count or 1 - local role_index = role.allow_afk_kick and role.index or false - if not role_index then return false end - return (role_count/role_index)*player_count -end - -Event.add(defines.events.on_tick,function(event) - if (game.tick%3600) ~= 0 then return end - for _,player in pairs(game.connected_players) do - local afk = #game.connected_players < 3 and 10 or get_allowed_afk_time(player) - if afk then - if player.afk_time > afk*3600 then game.kick_player(player,'AFK For Too Long ('..math.floor(afk)..' Minutes)') end - end - end -end) - -return setmetatable({ - get_allowed_afk_time=get_allowed_afk_time, - on_init=function(self) - if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end - if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end - if loaded_modules['ExpGamingCore.Server'] then require(module_path..'/src/server',{Sync=Sync,self=self}) end - end -},{__call=function(self,...) return self.get_allowed_afk_time(...) end}) \ No newline at end of file diff --git a/old/modules/ExpGamingPlayer/afkKick/softmod.json b/old/modules/ExpGamingPlayer/afkKick/softmod.json deleted file mode 100644 index bace003d..00000000 --- a/old/modules/ExpGamingPlayer/afkKick/softmod.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "ExpGamingPlayer.afkKick", - "version": "4.0.0", - "description": "Adds a varible amount of time before a user is kicked based on the current player count.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Kick", - "AFK", - "Players", - "Smart", - "Varible" - ], - "dependencies": { - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Gui": "^4.0.0", - "ExpGamingCore.Role": "?^4.0.0", - "ExpGamingCore.Sync": "?^4.0.0", - "ExpGamingCore.Server": "?^4.0.0" - }, - "collection": "ExpGamingPlayer@4.0.0", - "submodules": {} -} diff --git a/old/modules/ExpGamingPlayer/afkKick/src/server.lua b/old/modules/ExpGamingPlayer/afkKick/src/server.lua deleted file mode 100644 index ed6bcf00..00000000 --- a/old/modules/ExpGamingPlayer/afkKick/src/server.lua +++ /dev/null @@ -1,29 +0,0 @@ -local Sync = Sync -local get_allowed_afk_time = self -local Server = require('ExpGamingCore.Server') -local Color = require('FactorioStdLib.Color') -Event[defines.events.on_tick] = nil - -script.on_init(function(event) - Server.new_thread{ - name='afk-kick', - }:on_event('tick',function(self) - if (game.tick%3600) ~= 0 then return end - for _,player in pairs(game.connected_players) do - local afk = #game.connected_players < 3 and 10 or get_allowed_afk_time(player) - if afk then - if player.afk_time > afk*3600 then game.kick_player(player,'AFK For Too Long ('..math.floor(afk)..' Minutes)') end - end - end - end):on_event('error',function(self,err) - if Sync then - Sync.emit_embedded{ - title='Auto Kick Error', - color=Color.to_hex(defines.textcolor.bg), - description='Auto Kick Error - Closed Thread', - Error=err - } - end - self:close() - end):open() -end) diff --git a/old/modules/ExpGamingPlayer/inventorySearch/control.lua b/old/modules/ExpGamingPlayer/inventorySearch/control.lua deleted file mode 100644 index b2313f14..00000000 --- a/old/modules/ExpGamingPlayer/inventorySearch/control.lua +++ /dev/null @@ -1,92 +0,0 @@ ---- Adds an inventory search that is preformed on a random player every 15 seconds --- @module ExpGamingPlayer.inventorySearch@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- Module Require -local Admin = require('ExpGamingAdmin') -local Role -- ExpGamingCore.Role@^4.0.0 - --- Local Variables --- removed from none admin ranks, no further action -local low_items = { - 'loader', - 'fast-loader', - 'express-loader', - 'small-plane', - 'player-port', - 'coin', - 'programmable-speaker', - 'logistic-chest-active-provider' -} - --- removed for admin and non-admin ranks, gives warnings to non-admins -local med_items = { - 'railgun', - 'railgun-dart', - 'belt-immunity-equipment' -} - --- temp-ban for any rank, this is a very hard enforcement, admin ranks lose rank -local high_items = { - 'electric-energy-interface', - 'infinity-chest' -} - --- inventories which are searched -local inventories = { - defines.inventory.player_main, - defines.inventory.player_quickbar, - defines.inventory.player_trash -} - -local _root_tree = {low_items=low_items,med_items=med_items,high_items=high_items} - --- Module Define -local module_verbose = false -local ThisModule = { - on_init=function() - if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end - end -} - --- Function Define -local function take_action(player,item_name,category) - if category == 'low_items' then player_return({'ExpGamingPlayer-inventorySearch.low',item_name},defines.textcolor.med,player) - elseif category == 'med_items' then player_return({'ExpGamingPlayer-inventorySearch.med',item_name},defines.textcolor.high,player) Admin.give_warning(player,'','Found A Banned Item',5) - elseif category == 'high_items' then player_return({'ExpGamingPlayer-inventorySearch.high',item_name},defines.textcolor.crit,player) Admin.temp_ban(player,'','Found A Banned Item') - else return end -end - -function ThisModule.search_player(player) - for category,items in pairs(_root_tree) do - if not Role or category ~= 'low_items' and not Role.allowed(player,'admin-items') then - for _,_inventory in pairs(inventories) do - local inventory = player.get_inventory(_inventory) - if inventory then - for _,item in pairs(items) do - local found = inventory.remove(item) - if found > 0 then take_action(player,item,category) end - end - end - end - end - end -end - --- Event Handlers Define -Event.add(defines.events.on_tick,function(event) - if (game.tick%900) == 0 then - local players = game.connected_players - if #players == 0 then return end - local player = players[math.random(#players)] - if Role and Role.allowed(player,'all-items') then return end - ThisModule.search_player(player) - end -end) - --- Module Return -return setmetatable(ThisModule,{ - __call=function(self,...) self.search_player(...) end -}) \ No newline at end of file diff --git a/old/modules/ExpGamingPlayer/inventorySearch/locale/de.cfg b/old/modules/ExpGamingPlayer/inventorySearch/locale/de.cfg deleted file mode 100644 index 895707f4..00000000 --- a/old/modules/ExpGamingPlayer/inventorySearch/locale/de.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingPlayer-inventorySearch] -low=Dein Inventar wurde durchsucht und __1__ wurde entfernt. -med=Dein Inventar wurde durchsucht und __1__ wurde entfernt. Dir wird hiermit eine Warnung erteilt! Versuche es nicht erneut! -high=Dein inventar wurde durchsucht und __1__ wurde gefunden, dies ist auf GAR KEINEN Fall erlaubt, dein Inventar wurde zum Spawnpunkt transferiert. \ No newline at end of file diff --git a/old/modules/ExpGamingPlayer/inventorySearch/locale/en.cfg b/old/modules/ExpGamingPlayer/inventorySearch/locale/en.cfg deleted file mode 100644 index 0c45c5b1..00000000 --- a/old/modules/ExpGamingPlayer/inventorySearch/locale/en.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingPlayer-inventorySearch] -low=Your inventory was searched and __1__ was removed. -med=Your inventory was searched and __1__ was removed, you have been given a warning as a result. -high=Your inventory was searched and __1__ was removed: this is NOT allowed. You have been temp-banned as a result. \ No newline at end of file diff --git a/old/modules/ExpGamingPlayer/inventorySearch/locale/fr.cfg b/old/modules/ExpGamingPlayer/inventorySearch/locale/fr.cfg deleted file mode 100644 index 4d3eb1e4..00000000 --- a/old/modules/ExpGamingPlayer/inventorySearch/locale/fr.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingPlayer-inventorySearch] -low=Your Inventory Was Search And __1__ was removed. -med=Your Inventory Was Search And __1__ was removed, you have been given a warning. -high=Your Inventory Was Search And __1__ was found, this is not allowed AT ALL, your inventory has been moved to spawn. \ No newline at end of file diff --git a/old/modules/ExpGamingPlayer/inventorySearch/locale/nl.cfg b/old/modules/ExpGamingPlayer/inventorySearch/locale/nl.cfg deleted file mode 100644 index 2c6b6a60..00000000 --- a/old/modules/ExpGamingPlayer/inventorySearch/locale/nl.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingPlayer-inventorySearch] -low=Je inventaris is doorzocht en __1__ is verwijderd. -med=Je inventaris is doorzocht en __1__ is verwijderd, je bent gewaarschuwd. -high=Je inventaris is doorzocht en __1__ is gevonden, dit is ten strengste verboden! Je inventaris is verwijderd. diff --git a/old/modules/ExpGamingPlayer/inventorySearch/locale/sv-SE.cfg b/old/modules/ExpGamingPlayer/inventorySearch/locale/sv-SE.cfg deleted file mode 100644 index ff5995b3..00000000 --- a/old/modules/ExpGamingPlayer/inventorySearch/locale/sv-SE.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[ExpGamingPlayer-inventorySearch] -low=Ditt inventarie blev genomsökt och __1__ togs bort. -med=Ditt inventarie blev genomsökt och __1__ togs bort, du har fått en varning på grund av detta. -high=Ditt inventarie blev genomsökt och __1__ togs bort: Det här är inte tillåtet. Som ett resultat av det har du blivit tillfälligt bannlyst. diff --git a/old/modules/ExpGamingPlayer/inventorySearch/softmod.json b/old/modules/ExpGamingPlayer/inventorySearch/softmod.json deleted file mode 100644 index 17f251c0..00000000 --- a/old/modules/ExpGamingPlayer/inventorySearch/softmod.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "ExpGamingPlayer.inventorySearch", - "version": "4.0.0", - "description": "Adds an inventory search that is proformed on a random player every 15 seconds.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Search", - "ExpGaming", - "Player", - "Inventory" - ], - "dependencies": { - "ExpGamingLib": "^4.0.0", - "ExpGamingAdmin.TempBan": "^4.0.0", - "ExpGamingAdmin.Warnings": "^4.0.0", - "ExpGamingCore.Role": "?^4.0.0", - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingAdmin": "^4.0.0" - }, - "collection": "ExpGamingPlayer@4.0.0", - "submodules": {} -} diff --git a/old/modules/ExpGamingPlayer/playerInfo/control.lua b/old/modules/ExpGamingPlayer/playerInfo/control.lua deleted file mode 100644 index cd68d962..00000000 --- a/old/modules/ExpGamingPlayer/playerInfo/control.lua +++ /dev/null @@ -1,58 +0,0 @@ ---- Used to give so common info on a player as a lua table or a frame. --- @module ExpGamingPlayer.playerInfo@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - -local Game = require('FactorioStdLib.Game') -local Gui = require('ExpGamingCore.Gui') -local Role -- ExpGamingCore.Role@^4.0.0 -local Group -- ExpGamingCore.Group@^4.0.0 - -local function get_player_info(player,frame,add_cam) - player = Game.get_player(player) - if not player then return {} end - local _player = {} - _player.index = player.index - _player.name = player.name - _player.online = player.connected - _player.tag = player.tag - _player.color = player.color - _player.admin = player.admin - _player.online_time = player.online_time - _player.group = player.permission_group.name - if Role then - _player.highest_role = Role.get_highest(player).name - local roles = {}; for _,role in pairs(Role.get(player)) do table.insert(roles,role.name) end - _player.roles = roles - end - if frame then - frame = frame.add{type='frame',direction='vertical',style='image_frame'} - frame.style.width = 200 - if Role then frame.style.height = 300 - else frame.style.height = 260 end - frame.add{type='label',caption={'ExpGamingPlayer-playerInfo.name',_player.index,_player.name},style='caption_label'} - local _online = {'ExpGamingPlayer-playerInfo.no'}; if _player.online then _online = {'ExpGamingPlayer-playerInfo.yes'} end - frame.add{type='label',caption={'ExpGamingPlayer-playerInfo.online',_online,tick_to_display_format(_player.online_time)}} - local _admin = {'ExpGamingPlayer-playerInfo.no'}; if _player.admin then _admin = {'ExpGamingPlayer-playerInfo.yes'} end - frame.add{type='label',caption={'ExpGamingPlayer-playerInfo.admin',_admin}} - if Role then - frame.add{type='label',caption={'ExpGamingPlayer-playerInfo.group',_player.group}} - frame.add{type='label',caption={'ExpGamingPlayer-playerInfo.role',_player.highest_role}} - frame.add{type='label',caption={'ExpGamingPlayer-playerInfo.roles',table.concat(_player.roles,', ')}}.style.single_line = false - end - if add_cam then - Gui.cam_link{entity=player.character,frame=frame,width=200,height=150,zoom=0.5,respawn_open=true} - end - end - return _player -end - -return setmetatable({ - get_player_info=get_player_info, - on_init=function(self) - if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end - if loaded_modules['ExpGamingCore.Group'] then Group = require('ExpGamingCore.Group') end - end -},{ - __call=function(self,...) return self.get_player_info(...) end -}) \ No newline at end of file diff --git a/old/modules/ExpGamingPlayer/playerInfo/locale/de.cfg b/old/modules/ExpGamingPlayer/playerInfo/locale/de.cfg deleted file mode 100644 index 1d52251f..00000000 --- a/old/modules/ExpGamingPlayer/playerInfo/locale/de.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[ExpGamingPlayer-playerInfo] -yes=Ja -no=Nein -name=[__1__] __2__ -online=Ist online: __1__ (__2__) -admin=Hat Admin Rang: __1__ -group=In Benutzer Gruppe: __1__ -role=Hat Rang: __1__ \ No newline at end of file diff --git a/old/modules/ExpGamingPlayer/playerInfo/locale/en.cfg b/old/modules/ExpGamingPlayer/playerInfo/locale/en.cfg deleted file mode 100644 index 4bbc1f12..00000000 --- a/old/modules/ExpGamingPlayer/playerInfo/locale/en.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[ExpGamingPlayer-playerInfo] -yes=Yes -no=No -name=[__1__] __2__ -online=Is Online: __1__ (__2__) -admin=Has Admin: __1__ -group=In User Group: __1__ -role=Highest Role: __1__ -roles=Other Roles: __1__ \ No newline at end of file diff --git a/old/modules/ExpGamingPlayer/playerInfo/locale/fr.cfg b/old/modules/ExpGamingPlayer/playerInfo/locale/fr.cfg deleted file mode 100644 index 257168f7..00000000 --- a/old/modules/ExpGamingPlayer/playerInfo/locale/fr.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[ExpGamingPlayer-playerInfo] -yes=Yes -no=No -name=[__1__] __2__ -online=Is Online: __1__ (__2__) -admin=Has Admin: __1__ -group=In User Group: __1__ -role=Has Rank: __1__ \ No newline at end of file diff --git a/old/modules/ExpGamingPlayer/playerInfo/locale/nl.cfg b/old/modules/ExpGamingPlayer/playerInfo/locale/nl.cfg deleted file mode 100644 index 931736ee..00000000 --- a/old/modules/ExpGamingPlayer/playerInfo/locale/nl.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[ExpGamingPlayer-playerInfo] -yes=Ja -no=Nee -name=[__1__] __2__ -online=Is Online: __1__ (__2__) -admin=Heeft Admin: __1__ -group=In Groep: __1__ -role=Heeft Rank: __1__ diff --git a/old/modules/ExpGamingPlayer/playerInfo/locale/sv-SE.cfg b/old/modules/ExpGamingPlayer/playerInfo/locale/sv-SE.cfg deleted file mode 100644 index 5a4406ae..00000000 --- a/old/modules/ExpGamingPlayer/playerInfo/locale/sv-SE.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[ExpGamingPlayer-playerInfo] -yes=Ja -no=Nej -name=[__1__] __2__ -online=Är Online: __1__ (__2__) -admin=Har Admin: __1__ -group=I användargrupp: __1__ -role=Har rang: __1__ diff --git a/old/modules/ExpGamingPlayer/playerInfo/softmod.json b/old/modules/ExpGamingPlayer/playerInfo/softmod.json deleted file mode 100644 index 2fda8414..00000000 --- a/old/modules/ExpGamingPlayer/playerInfo/softmod.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "ExpGamingPlayer.playerInfo", - "version": "4.0.0", - "description": "Used to give so common info on a player as a lua table or a frame.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Cam", - "Follow", - "Player", - "Info", - "Useful" - ], - "dependencies": { - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Gui": "^4.0.0", - "ExpGamingCore.Role": "?^4.0.0", - "ExpGamingCore.Group": "?^4.0.0" - }, - "collection": "ExpGamingPlayer@4.0.0", - "submodules": {} -} diff --git a/old/modules/ExpGamingPlayer/polls/control.lua b/old/modules/ExpGamingPlayer/polls/control.lua deleted file mode 100644 index fa9ed01e..00000000 --- a/old/modules/ExpGamingPlayer/polls/control.lua +++ /dev/null @@ -1,274 +0,0 @@ ---- Adds a poll gui into the game for quick polls (default 90 seconds) --- @module ExpGamingPlayer.polls@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - --- Module Require -local Server = require('ExpGamingCore.Server') -local Gui = require('ExpGamingCore.Gui') -local Role -- ExpGamingCore.Server@^4.0.0 - --- Local Variables -local poll_time_out = 90 -- In seconds - --- Module Define -local module_verbose = false -local ThisModule = { - on_init=function() - if loaded_modules['ExpGamingCore.Role'] then Role = require('ExpGamingCore.Role') end - end -} - --- Global Define -local global = { - active={}, - old={} -} -Global.register(global,function(tbl) global = tbl end) - --- Function Define -local function _poll_data(question,answers) - local rtn_poll = { - uuid=Server.uuid(), - question=question, - answers=answers or {'None'}, - votes={}, - voted={} - } - Server.new_thread{ - data={poll_uuid=rtn_poll.uuid}, - timeout=poll_time_out*60 - }:on_event('timeout',function(self) - local uuid = tostring(self.data.poll_uuid) - local poll = global.active[uuid] - if not poll then return end - local highest = {nil,-1} - local _votes = {} - for index,answer in pairs(poll.answers) do - local _result = poll.votes[index] or 0 - if _result > highest[2] then highest = {answer,_result} end - _votes[answer] = _result - end - poll.uuid = nil - poll.votes = _votes - poll.answers = nil - poll.voted = nil - table.insert(global.old,poll) - global.active[uuid] = nil - game.print({'ExpGamingPlayer-polls.end',poll.question},defines.textcolor.info) - game.print({'ExpGamingPlayer-polls.winner',highest[1]},defines.textcolor.info) - verbose('Ended Poll: '..poll.question..' ('..uuid..') Highest: '..highest[1]) - end):open() - global.active[tostring(rtn_poll.uuid)]=rtn_poll - verbose('Created Poll: '..question..' ('..rtn_poll.uuid..')') - return rtn_poll.uuid -end - -local function draw_poll(frame) - frame.clear() - local index = tonumber(frame.parent.current_index.caption) - local poll = global.old[index] - if not poll then - frame.add{ - type='label', - caption={'ExpGamingPlayer-polls.no-poll'} - } - return - end - frame.add{ - type='label', - caption='Question: '..poll.question - } - for answer,votes in pairs(poll.votes) do - frame.add{ - type='label', - caption=answer..') '..votes - } - end -end - -local function _options(player,root_frame) - local options = {'Please Select An option'} - local uuid = root_frame.name - local poll = global.active[uuid] - if not poll then return {'Invalid Poll'} end - for _,answer in pairs(poll.answers) do - table.insert(options,answer) - end - return options -end - -local option_drop_down = Gui.inputs.add_drop_down('option-drop-down-polls',_options,1,function(player,selected,items,element) - local uuid = element.parent.name - local poll = global.active[uuid] - if not poll then return end - if poll.voted[player.index] and poll.voted[player.index] > 1 then - local old_vote = poll.voted[player.index] - poll.votes[old_vote-1] = poll.votes[old_vote-1] and poll.votes[old_vote-1]-1 or 0 - end - if element.selected_index > 1 then - poll.votes[element.selected_index-1] = poll.votes[element.selected_index-1] and poll.votes[element.selected_index-1]+1 or 1 - end - poll.voted[player.index]=element.selected_index - element.parent.answer.caption = 'Your Answer: '..selected -end) - -local prev = Gui.inputs{ - type='button', - name='prev-poll', - caption='utility/hint_arrow_left' -}:on_event('click',function(event) - local parent = event.element.parent - local index = parent.parent.current_index.caption - local _index = tonumber(index)-1 - if _index < 1 then _index = #global.old end - parent.parent.current_index.caption = _index - parent.parent.title.title.caption = 'Viewing Poll: '.._index - draw_poll(parent.parent.poll_area) -end) - -local next = Gui.inputs{ - type='button', - name='next-poll', - caption='utility/hint_arrow_right' -}:on_event('click',function(event) - local parent = event.element.parent - local index = parent.parent.current_index.caption - local _index = tonumber(index)+1 - if _index > #global.old then _index = 1 end - parent.parent.current_index.caption = _index - parent.parent.title.title.caption = 'Viewing Poll: '.._index - draw_poll(parent.parent.poll_area) -end) - -local poll_question_input = Gui.inputs.add_text('poll-question-input',true,'Question',function(player,text,element) - local options = element.parent.options - if not options.question then options.add{type='label',name='question',caption=''} - else options.question.caption = text end -end) - -local _self_reference_poll_option_input = nil -local poll_option_input = Gui.inputs.add_text('poll-option-input',true,'Enter Option',function(player,text,element) - local options = element.parent.parent.parent.options - if not options[element.parent.name] then options.add{type='label',name=element.parent.name,caption=text} - else options[element.parent.name].caption = text end - if options.last.caption == element.parent.name then - options.last.caption = tonumber(options.last.caption)+1 - _self_reference_poll_option_input(element.parent.parent.add{type='flow',name=options.last.caption}).style.minimal_width = 200 - end -end) -_self_reference_poll_option_input = poll_option_input - -local function poll_assembler(frame) - frame.clear() - local options = frame.add{type='flow',name='options'} - options.style.visible = false - options.add{type='label',name='last',caption='2'} - poll_question_input(frame).style.minimal_width = 200 - local flow = frame.add{type='flow',direction='vertical'} - poll_option_input(flow.add{type='flow',name='1'}).style.minimal_width = 200 - poll_option_input(flow.add{type='flow',name='2'}).style.minimal_width = 200 -end - -local create_poll = Gui.inputs{ - type='button', - name='create-poll', - caption='utility/add' -}:on_event('click',function(event) - local parent = event.element.parent - if event.element.sprite == 'utility/enter' then - local inputs = parent.parent.poll_area.options - if not inputs then - event.element.sprite = 'utility/add' - draw_poll(parent.parent.poll_area) - return - end - local options = {} - for _,option in pairs(inputs.children) do - if option.name ~= 'question' and option.name ~= 'last' then - if option.caption ~= 'Enter Option' and option.caption ~= '' then table.insert(options,option.caption) end - end - end - if not inputs.question or #options == 0 then - event.element.sprite = 'utility/add' - draw_poll(parent.parent.poll_area) - return - end - local uuid = _poll_data(inputs.question.caption,options) - Gui.popup.open('polls',{uuid=uuid}) - event.element.sprite = 'utility/add' - draw_poll(parent.parent.poll_area) - else - event.element.sprite = 'utility/enter' - poll_assembler(parent.parent.poll_area) - end -end) - -ThisModule.Gui = Gui.popup{ - name='polls', - caption={'ExpGamingPlayer-polls.name'}, - draw=function(self,frame,data) - frame.style.right_padding = 5 - frame.style.bottom_padding = 5 - local uuid = data.uuid - local poll = global.active[tostring(uuid)] - if not poll then return end - local flow = frame.add{ - type='flow', - name=tostring(uuid), - direction='vertical' - } - flow.add{type='label',caption={'ExpGamingPlayer-polls.time-left',poll_time_out}} - flow.add{type='label',caption='Question: '..poll.question} - flow.add{type='label',name='answer',caption='Your Answer: None'} - option_drop_down(flow) - end -}:add_left{ - caption='utility/item_editor_icon', - tooltip={'ExpGamingPlayer-polls.tooltip'}, - draw=function(self,frame) - frame.caption={'ExpGamingPlayer-polls.name'} - frame.add{ - type='label', - name='current_index', - caption=1 - }.style.visible = false - local title = frame.add{ - type='flow', - name='title' - } - local btn = prev:draw(title) - btn.style.width = 20 - btn.style.height = 20 - title.add{ - type='label', - name='title', - caption='Viewing Poll: 1', - style='caption_label' - } - btn = next:draw(title) - btn.style.width = 20 - btn.style.height = 20 - if Role and Role.allowed(frame.player_index,'create-poll') or game.players[frame.player_index].admin then - btn = create_poll:draw(title) - btn.style.width = 20 - btn.style.height = 20 - end - local flow = frame.add{ - type='flow', - name='poll_area', - direction='vertical' - } - draw_poll(flow) - end, - can_open=function(player) - if #global.old > 0 then return true - elseif Role and Role.allowed(player,'create-poll') or player.admin then return true - else return {'ExpGamingPlayer-polls.no-poll'} end - end -} --- Event Handlers Define - --- Module Return --- when called it will toggle the left gui for this player -return setmetatable(ThisModule,{__call=function(self,...) self.Gui(...) end}) \ No newline at end of file diff --git a/old/modules/ExpGamingPlayer/polls/locale/de.cfg b/old/modules/ExpGamingPlayer/polls/locale/de.cfg deleted file mode 100644 index b476a903..00000000 --- a/old/modules/ExpGamingPlayer/polls/locale/de.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[ExpGamingPlayer-polls] -name=Umfragen -tooltip=Alte Umfragen ansehen -no-poll=Keine alten Umfragen -end=Die Umfrage hat gerade geendet: __1__ -winner=__1__ hatte die meisten Stimmen. -time-left=Du hast noch __1__s um deine Wahl zu erfassen. \ No newline at end of file diff --git a/old/modules/ExpGamingPlayer/polls/locale/en.cfg b/old/modules/ExpGamingPlayer/polls/locale/en.cfg deleted file mode 100644 index afd15bf3..00000000 --- a/old/modules/ExpGamingPlayer/polls/locale/en.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[ExpGamingPlayer-polls] -name=Polls -tooltip=View Old Polls -no-poll=No Old Polls -end=Poll Just Ended: __1__ -winner=__1__ had the most votes. -time-left=You will have __1__s to pick. \ No newline at end of file diff --git a/old/modules/ExpGamingPlayer/polls/locale/fr.cfg b/old/modules/ExpGamingPlayer/polls/locale/fr.cfg deleted file mode 100644 index afd15bf3..00000000 --- a/old/modules/ExpGamingPlayer/polls/locale/fr.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[ExpGamingPlayer-polls] -name=Polls -tooltip=View Old Polls -no-poll=No Old Polls -end=Poll Just Ended: __1__ -winner=__1__ had the most votes. -time-left=You will have __1__s to pick. \ No newline at end of file diff --git a/old/modules/ExpGamingPlayer/polls/locale/nl.cfg b/old/modules/ExpGamingPlayer/polls/locale/nl.cfg deleted file mode 100644 index 928ddefb..00000000 --- a/old/modules/ExpGamingPlayer/polls/locale/nl.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[ExpGamingPlayer-polls] -name=Polls -tooltip=Laat oude polls zien -no-poll=Geen oude polls -end=Poll is zojuist beëindigd: __1__ -winner=__1__ had de meeste stemmen. -time-left=Je hebt __1__s om te kiezen. diff --git a/old/modules/ExpGamingPlayer/polls/locale/sv-SE.cfg b/old/modules/ExpGamingPlayer/polls/locale/sv-SE.cfg deleted file mode 100644 index e9050a52..00000000 --- a/old/modules/ExpGamingPlayer/polls/locale/sv-SE.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[ExpGamingPlayer-polls] -name=Undersökningar -tooltip=Se gamla undersökningar -no-poll=Inga gamla undersökningar -end=Röstning slutade nyss: __1__ -winner=__1__ hade flest röster. -time-left=Du kommer att få __1__s på dig att välja. \ No newline at end of file diff --git a/old/modules/ExpGamingPlayer/polls/softmod.json b/old/modules/ExpGamingPlayer/polls/softmod.json deleted file mode 100644 index d5c416b6..00000000 --- a/old/modules/ExpGamingPlayer/polls/softmod.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "ExpGamingPlayer.polls", - "version": "4.0.0", - "description": "Adds a poll gui into the game for quick polls (default 90 seconds)", - "location": "FSM_ARCHIVE", - "keywords": [ - "Polls", - "Poll", - "Question", - "Gui" - ], - "dependencies": { - "ExpGamingCore.Gui": "^4.0.0", - "ExpGamingCore.Server": "^4.0.0", - "ExpGamingCore.Role": "?^4.0.0" - }, - "collection": "ExpGamingPlayer@4.0.0", - "submodules": {} -} diff --git a/old/modules/ExpGamingPlayer/softmod.json b/old/modules/ExpGamingPlayer/softmod.json deleted file mode 100644 index e31dddb6..00000000 --- a/old/modules/ExpGamingPlayer/softmod.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "ExpGamingPlayer", - "version": "4.0.0", - "description": "Useful collection of modules for displaying player infomation.", - "location": "FSM_ARCHIVE", - "keywords": [ - "ExpGaming", - "Player", - "Information", - "AFK" - ], - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "submodules": { - "ExpGamingPlayer.afkKick": "4.0.0", - "ExpGamingPlayer.playerInfo": "4.0.0", - "ExpGamingPlayer.playerList": "4.0.0", - "ExpGamingPlayer.inventorySearch": "4.0.0", - "ExpGamingPlayer.polls": "4.0.0" - }, - "dependencies": {} -} diff --git a/old/modules/GameSettingsGui/control.lua b/old/modules/GameSettingsGui/control.lua deleted file mode 100644 index 2a447482..00000000 --- a/old/modules/GameSettingsGui/control.lua +++ /dev/null @@ -1,193 +0,0 @@ ---- A gui for controlling game settings with sliders as well as some global commands. --- @module GameSettingsGui@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE - --- Module Require -local Server = require('ExpGamingCore.Server') -local Gui = require('ExpGamingCore.Gui') - --- Local Variables ---{type='slider',object='',key='',name='',min=x,max=y} ---{type='function',object='',key='',name='',param={}} -local basic_settings = { - {type='slider',object='force',key='manual_mining_speed_modifier',name='mining-speed',min=0,max=10}, - {type='slider',object='force',key='manual_crafting_speed_modifier',name='craft-speed',min=0,max=10}, - {type='slider',object='force',key='character_running_speed_modifier',name='running-speed',min=0,max=10}, - {type='slider',object='force',key='character_build_distance_bonus',name='build-distance',min=0,max=50}, - {type='slider',object='force',key='character_reach_distance_bonus',name='reach-distance',min=0,max=50}, - {type='slider',object='force',key='worker_robots_speed_modifier',name='bot-speed',min=0,max=10}, - {type='slider',object='force',key='laboratory_speed_modifier',name='lab-speed',min=0,max=10}, - {type='slider',object='force',key='stack_inserter_capacity_bonus',name='stack-bonus',min=1,max=30} -} - -local advanced_settings = { - {type='slider',object='force',key='quickbar_count',name='quickbar-count',min=1,max=5}, - {type='slider',object='force',key='character_inventory_slots_bonus',name='inventory-size',min=0,max=1000}, - {type='slider',object='force',key='mining_drill_productivity_bonus',name='mining-prod',min=0,max=10}, - {type='slider',object='game',key='speed',name='game-speed',min=0.01,max=5}, - {type='function',object='surface',key='clear_pollution',name='clear-pollution'}, - {type='function',object='game',key='server_save',name='save'}, - {type='function',object='force',key='reset_technology_effects',name='reload-effects'}, - {type='function',object='enemy',key='kill_all_units',name='kill-biters'}, - {type='function',object='force',key='rechart',name='reload-map'}, - {type='function',object='game',key='force_crc',name='crc'}, - {type='function',object='force',key='reset',name='reset-force'} -} - -local personal_settings = { - {type='slider',object='player',key='character_mining_speed_modifier',name='mining-speed',min=0,max=10}, - {type='slider',object='player',key='character_crafting_speed_modifier',name='craft-speed',min=0,max=10}, - {type='slider',object='player',key='character_running_speed_modifier',name='running-speed',min=0,max=10}, - {type='slider',object='player',key='character_build_distance_bonus',name='build-distance',min=0,max=50}, - {type='slider',object='player',key='character_reach_distance_bonus',name='reach-distance',min=0,max=50}, - {type='slider',object='player',key='character_inventory_slots_bonus',name='inventory-size',min=0,max=1000}, - {type='slider',object='player',key='quickbar_count_bonus',name='quickbar-count',min=0,max=5} -} - -local _root_list = {basic_settings=basic_settings,advanced_settings=advanced_settings,personal_settings=personal_settings} - --- Module Define -local module_verbose = false -local ThisModule = {} - --- Function Define -local function _get_data(root_frame) - local object = root_frame.name - local key = root_frame.setting_name.caption - for _,setting in pairs(_root_list[object]) do - if key == setting.key then return setting end - end -end - -local function _object_list(player) return {game=game,player=player,force=player.force,enemy=game.forces['enemy'],surface=player.surface} end - -for name,group in pairs(_root_list) do - for key,setting in pairs(group) do - local _added = nil - if setting.type == 'slider' then - _added = Gui.inputs.add_slider('game-settings-'..setting.name,'horizontal',setting.min,setting.max, - function(player,root_frame) - local data = _get_data(root_frame) - local objects = _object_list(player) - local object = objects[data.object] - return object[data.key] or 1 - end, - function(player,value,percent,element) - local data = _get_data(element.parent) - local objects = _object_list(player) - local object = objects[data.object] - local _caption = string.format('%.2f',value); if value > 2 then _caption = string.format('%.2f',math.floor(value)) end - object[data.key] = tonumber(_caption) - element.parent.counter.caption = _caption - end - ) - elseif setting.type == 'function' then - _added = Gui.inputs.add_checkbox('game-settings-'..setting.name,true,nil,false,function(player,element) - local data = _get_data(element.parent.parent) - local objects = _object_list(player) - local object = objects[data.object] - -- if key is a function it will run the function rather than attempt to get a function - if is_type(data.key,'function') then pcall(data.key,object,unpack(data.params)) - else pcall(object[data.key],unpack(data.params)) end - Server.new_thread{ - timeout=60, - data=element - }:on_event('timeout',function(self) - if self.data and self.data.valid then - self.data.parent.parent['game-settings-are-you-sure'].state = false - self.data.parent.style.visible = false - self.data.state = false - end - end):open() - end) - if not setting.params then setting.params = {} end - end - setting._loaded = _added - setting._group = name - end -end - -local are_you_sure = Gui.inputs.add_checkbox('game-settings-are-you-sure',true,nil,false,function(player,element) - element.parent.sure.style.visible = true - Server.new_thread{ - timeout=600, - data=element - }:on_event('timeout',function(self) - if self.data and self.data.valid then - self.data.state = false - self.data.parent.sure.style.visible = false - end - end):open() -end) - -local function _draw_setting(frame,setting) - frame = frame.add{type='flow'}.add{ - type='flow', - name=setting._group - } - frame.add{ - type='label', - caption={'GameSettingsGui.effect-'..setting.name}, - style='caption_label' - } - frame.add{ - type='label', - caption=setting.key, - name='setting_name' - }.style.visible = false - if setting.type == 'slider' then - local slider = setting._loaded(frame) - slider.style.width = 300 - local _caption = string.format('%.2f',slider.slider_value); if slider.slider_value > 2 then _caption = tostring(math.floor(slider.slider_value)) end - frame.add{ - type='label', - name='counter', - caption=_caption - } - elseif setting.type == 'function' then - are_you_sure(frame) - local flow = frame.add{type='flow',name='sure'} - flow.style.visible = false - flow.add{ - type='label', - caption={'GameSettingsGui.sure'}, - style='bold_red_label' - } - setting._loaded(flow) - end -end - -ThisModule.Gui = Gui.center{ - name='game-settings', - caption='utility/no_building_material_icon', - tooltip={'GameSettingsGui.tooltip'} -}:add_tab('basic',{'GameSettingsGui.basic-name'},{'GameSettingsGui.basic-name'},function(frame) - frame.add{ - type='label', - caption={'GameSettingsGui.basic-message'} - }.style.single_line = false - for _,setting in pairs(basic_settings) do - _draw_setting(frame,setting) - end -end):add_tab('advanced',{'GameSettingsGui.advanced-name'},{'GameSettingsGui.advanced-tooltip'},function(frame) - frame.add{ - type='label', - caption={'GameSettingsGui.advanced-message'} - }.style.single_line = false - for _,setting in pairs(advanced_settings) do - _draw_setting(frame,setting) - end -end):add_tab('personal',{'GameSettingsGui.personal-name'},{'GameSettingsGui.personal-tooltip'},function(frame) - frame.add{ - type='label', - caption={'GameSettingsGui.personal-message'} - }.style.single_line = false - for _,setting in pairs(personal_settings) do - _draw_setting(frame,setting) - end -end) - --- Module return --- when called it will open the center gui for the player -return setmetatable(ThisModule,{__call=function(self,...) self.Gui(...) end}) \ No newline at end of file diff --git a/old/modules/GameSettingsGui/locale/de.cfg b/old/modules/GameSettingsGui/locale/de.cfg deleted file mode 100644 index dece78e7..00000000 --- a/old/modules/GameSettingsGui/locale/de.cfg +++ /dev/null @@ -1,31 +0,0 @@ -[GameSettingsGui] -name=Spieleinstellungen -tooltip=Erlaubt das Modifizieren von Spieleinstellungen. Bitte mit Bedacht benutzen. -basic-name=Einfache Einstellungen -basic-tooltip=Diese Einstellungen sind ohne Probleme veränderbar, sie verursachen keine großen Probleme im nachhinein. -basic-message=Dies sind fraktionsweite Einstellungen, welche genutzt werden können um das Spiel zu vereinfachen und es für Alle angenehmer zu machen. -advanced-name=Erweiterte Einstellungen -advanced-tooltip=Diese Einstellungen sollten nicht von Leuten benutzt werden, die nicht wissen was sie tun. -advanced-message=Bitte ändere keine dieser Einstellungen ausser du bist dir 100% sicher was sie tun,lass game.speed allein, da es einen viel größeren Effekt hat als du denkst. -personal-name=Persönliche Einstellungen -personal-tooltip=Diese Einstellungen betreffen nur deinen Spieler. Wenn man dich beim cheaten erwischt bist du auf dich allein gestellt. -personal-message=Diese Einstellungen betreffen nur deinen Spieler, übertreib es nicht ansonsten besteht die Gefahr, dass dich normale Spieler (gierige Kleinkinder) dabei erwischen (und rumheulen). -sure=Bist du dir Sicher?! -effect-mining-speed=Abbaugeschwindigkeit -effect-craft-speed=Herstellgeschwindigkeit -effect-running-speed=Laufgeschwindigkeit -effect-build-distance=Baudistanz -effect-reach-distance=Armreichweite -effect-bot-speed=Robotergeschwindigkeit -effect-lab-speed=Laborgeschwindigkeit -effect-stack-bonus=Stapelnonuss -effect-quickbar-count=Anzahl Schnellleistenelemente -effect-inventory-size=Inventargröße -effect-mining-prod=Abbauproduktivität -effect-game-speed=Spielgeschwindigkeit -effect-save=Spiel speichern -effect-reload-effects=Effekte neu laden -effect-reload-map=Minimap neu laden -effect-kill-biters=Töte alle Beisser -effect-crc=Forciere CRC check -effect-reset-force=Fraktion zurücksetzen \ No newline at end of file diff --git a/old/modules/GameSettingsGui/locale/en.cfg b/old/modules/GameSettingsGui/locale/en.cfg deleted file mode 100644 index 54825990..00000000 --- a/old/modules/GameSettingsGui/locale/en.cfg +++ /dev/null @@ -1,32 +0,0 @@ -[GameSettingsGui] -name=Game Settings -tooltip=Edits Game Settings. Please use responsibly. -basic-name=Basic Settings -basic-tooltip=These settings are safe to edit and have no big impact. -basic-message=Basic Settings can be used to improve game play for players. -advanced-name=Advanced Settings -advanced-tooltip=These settings should be left alone unless you know what you are doing. -advanced-message=Please do not touch the Advanced Settings unless you are 100% sure what you are doing: changes made to these settings might have a bigger impact than you realise. -personal-name=Personal Settings -personal-tooltip=Personal Settings only affect you. -personal-message=Personal Settings only affect your character. If you are spotted as a result of these settings, you are on your own! -sure=Are you sure? -effect-mining-speed=Mining Speed -effect-craft-speed=Crafting Speed -effect-running-speed=Running Speed -effect-build-distance=Build Distance -effect-reach-distance=Reach Distance -effect-bot-speed=Bot Speed -effect-lab-speed=Lab Speed -effect-stack-bonus=Stack Bonus -effect-quickbar-count=Quickbar Count -effect-inventory-size=Inventory Size -effect-mining-prod=Mining Productivity -effect-game-speed=Game Speed -effect-save=Save Game -effect-reload-effects=Reload Effects -effect-reload-map=Reload Minimap -effect-kill-biters=Kill Biters -effect-crc=Force CRC Check -effect-reset-force=Reset Force -effect-clear-pollution=Clear Pollution \ No newline at end of file diff --git a/old/modules/GameSettingsGui/locale/fr.cfg b/old/modules/GameSettingsGui/locale/fr.cfg deleted file mode 100644 index f13485d0..00000000 --- a/old/modules/GameSettingsGui/locale/fr.cfg +++ /dev/null @@ -1,31 +0,0 @@ -[GameSettingsGui] -name=Game Settings -tooltip=Allows for editing of the game settings, please use resposibliy. -basic-name=Basic Settings -basic-tooltip=These settings are safe to change with no large effects. -basic-message=These settings are force wide settings which can be used to inprove gameplay and make it more enjoyible for players. -advanced-name=Advanced Settings -advanced-tooltip=These settings should be left alone unless you know what you are doing. -advanced-message=Please do not touch these settings at all unless you know 100% what they do and the effect of using them, leave game.speed alone it has a bigger effect then you think. -personal-name=Personal Settings -personal-tooltip=These will only effect you, if you are spoted you are on your own. -personal-message=These settings will only effect your player any changes you make are to be resposible ones and dont over do it or you may be caught using them. -sure=Are You Sure! -effect-mining-speed=Mining Speed -effect-craft-speed=Crafting Speed -effect-running-speed=Running Speed -effect-build-distance=Build Distance -effect-reach-distance=Reach Distance -effect-bot-speed=Bot Speed -effect-lab-speed=Lab Speed -effect-stack-bonus=Stack Bonus -effect-quickbar-count=Quickbar Count -effect-inventory-size=Inventory Size -effect-mining-prod=Mining Productivity -effect-game-speed=Game Speed -effect-save=Save Game -effect-reload-effects=Reload Effects -effect-reload-map=Reload Minimap -effect-kill-biters=Kill Biters -effect-crc=Force CRC Check -effect-reset-force=Reset Force \ No newline at end of file diff --git a/old/modules/GameSettingsGui/locale/nl.cfg b/old/modules/GameSettingsGui/locale/nl.cfg deleted file mode 100644 index 19017a6b..00000000 --- a/old/modules/GameSettingsGui/locale/nl.cfg +++ /dev/null @@ -1,31 +0,0 @@ -[GameSettingsGui] -name=Game instellingen -tooltip=Maakt het mogelijk om gameinstellingen te wijzigen. Gebruik het verantwoord! -basic-name=Basis instellingen -basic-tooltip=Deze instellingen kunnen veilig worden gewijzigd. -basic-message=Deze instellingen kunnen worden gebruikt om het spelervaring voor de spelers te verbeteren. -advanced-name=Geavanceerde instellingen -advanced-tooltip=Het is ten zeerste aangeraden om niet aan deze instellingen te zitten, tenzij je weet wat je doet. -advanced-message=Waarschuwing: Niet aan deze instellingen zitten tenzij je honderd procent zeker weet wat je aan het doen bent. Het wijzigen van deze instellingen kunnen een groter effect hebben dan je denkt. -personal-name=Persoonlijke instellingen -personal-tooltip=Deze instellingen hebben alleen effect op jouw speler. -personal-message=Deze instellingen hebben alleen effect op jouw speler: gebruik het verantwoord, aangezien het overmatig gebruik van deze instellingen niet zijn toegestaan. -sure=Weet je het zeker? -effect-mining-speed=Mining Snelheid -effect-craft-speed=Crafting Snelheid -effect-running-speed=Ren Snelheid -effect-build-distance=Bouwafstand -effect-reach-distance=Bereik -effect-bot-speed=Bot Snelheid -effect-lab-speed=Lab Snelheid -effect-stack-bonus=Stack Bonus -effect-quickbar-count=Quickbar Count -effect-inventory-size=Inventory grootte -effect-mining-prod=Mining Productiviteit -effect-game-speed=Gamesnelheid -effect-save=Opslaan -effect-reload-effects=Effecten herladen -effect-reload-map=Minimap herladen -effect-kill-biters=Biters vermoorden -effect-crc=Forceer CRC check -effect-reset-force=Forceren resetten diff --git a/old/modules/GameSettingsGui/locale/sv-SE.cfg b/old/modules/GameSettingsGui/locale/sv-SE.cfg deleted file mode 100644 index 88185c07..00000000 --- a/old/modules/GameSettingsGui/locale/sv-SE.cfg +++ /dev/null @@ -1,31 +0,0 @@ -[GameSettingsGui] -name=Game Settings -tooltip=Edits Game Settings. Please use responsibly. -basic-name=Basic Settings -basic-tooltip=These settings are safe to edit and have no big impact. -basic-message=Basic Settings can be used to improve game play for players. -advanced-name=Advanced Settings -advanced-tooltip=These settings should be left alone unless you know what you are doing. -advanced-message=Please do not touch the Advanced Settings unless you are 100% sure what you are doing: changes made to these settings might have a bigger impact than you realize. -personal-name=Personal Settings -personal-tooltip=Personal Settings only affects you. -personal-message=Personal Settings only affects your character. If you are spotted as a result of these settings, you are on your own! -sure=Are you sure? -effect-mining-speed=Mining Speed -effect-craft-speed=Crafting Speed -effect-running-speed=Running Speed -effect-build-distance=Build Distance -effect-reach-distance=Reach Distance -effect-bot-speed=Bot Speed -effect-lab-speed=Lab Speed -effect-stack-bonus=Stack Bonus -effect-quickbar-count=Quickbar Count -effect-inventory-size=Inventory Size -effect-mining-prod=Mining Productivity -effect-game-speed=Game Speed -effect-save=Save Game -effect-reload-effects=Reload Effects -effect-reload-map=Reload Minimap -effect-kill-biters=Kill Biters -effect-crc=Force CRC Check -effect-reset-force=Reset Force diff --git a/old/modules/GameSettingsGui/softmod.json b/old/modules/GameSettingsGui/softmod.json deleted file mode 100644 index 2e09943f..00000000 --- a/old/modules/GameSettingsGui/softmod.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "GameSettingsGui", - "version": "4.0.0", - "description": "A gui for controlling game settings with sliders as well as some global commands.", - "location": "FSM_ARCHIVE", - "keywords": [ - "Gui", - "Game", - "Game Settings", - "Settings", - "Admin" - ], - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "dependencies": { - "ExpGamingCore.Server": "^4.0.0", - "ExpGamingCore.Gui": "^4.0.0" - }, - "submodules": {} -} diff --git a/old/modules/GuiAnnouncements/control.lua b/old/modules/GuiAnnouncements/control.lua deleted file mode 100644 index d1a434d2..00000000 --- a/old/modules/GuiAnnouncements/control.lua +++ /dev/null @@ -1,110 +0,0 @@ ---- Creates a gui for making and receiving announcements --- @module GuiAnnouncements@4.0.0 --- @author Cooldude2606 --- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE --- @alias ThisModule - --- maybe make this not require Role and have it optional - --- Module Require -local Game = require('FactorioStdLib.Game') -local Gui = require('ExpGamingCore.Gui') -local Role = require('ExpGamingCore.Role') - --- Module Define -local module_verbose = false -local ThisModule = {} - --- Function Define -local function _roles(player) - local roles = {'Select Role'} - local _role = Role.get_highest(player) - for index,role_name in pairs(Role.order) do - if index >= _role.index then - table.insert(roles,role_name) - end - end - return roles -end - -local role_drop_down = Gui.inputs.add_drop_down('rank-drop-down-announcements',_roles,1,function(player,selected,items,element) - element.parent.role.caption = selected - if selected == 'Select Role' then element.parent['send-announcement'].style.visible = false - else element.parent['send-announcement'].style.visible = true end -end) - -local send_popup = Gui.inputs{ - type='button', - name='send-announcement', - caption='utility/export_slot' -}:on_event('click',function(event) - local player = Game.get_player(event) - local role = Role.get_highest(player) - local _role = Role.get(event.element.parent.role.caption); if not _role then return end - local sent_by = {'GuiAnnouncements.sent-by',player.name,role.name} - local role_name = _role.name..'s'; if role_name == Role.meta.default.name..'s' then role_name = 'Everyone' end - local sent_to = {'GuiAnnouncements.sent-to',role_name} - local message = event.element.parent.parent.message.text - local players = _role:get_players(true) - if _role.index == Role.meta.default.index then players = game.connected_players end - Gui.popup.open('announcements',{sent_by=sent_by,sent_to=sent_to,message=message},players) - player_return('Announcement sent to '..#players..' players ('..role_name..')',defines.textcolor.info,player) - verbose('Announcement sent to '..#players..' players ('..role_name..') by '..player.name..'('..role.name..') with message: '..message) - event.element.parent.parent.message.text = '' - Gui.left.close('announcements',player) -end) - -ThisModule.Gui = Gui.popup{ - name='announcements', - caption={'GuiAnnouncements.name'}, - draw=function(self,frame,data) - frame.style.right_padding = 5 - frame.style.bottom_padding = 5 - frame.add{type='label',caption=data.sent_by,style='caption_label'} - frame.add{type='label',caption=data.sent_to,style='caption_label'} - local text_box = frame.add{type='text-box'} - text_box.text = data.message - text_box.style.width = 400 - text_box.read_only = true - text_box.word_wrap = true - text_box.selectable = true - end -}:add_left{ - caption='item/programmable-speaker', - tooltip={'GuiAnnouncements.tooltip'}, - draw=function(self,frame) - frame.caption = {'GuiAnnouncements.name'} - frame = frame.add{ - type='flow', - direction='vertical' - } - local text_box = frame.add{ - type='text-box', - name='message' - } - text_box.style.width = 400 - text_box.style.minimal_height = 100 - text_box.read_only = false - text_box.word_wrap = true - text_box.selectable = true - local flow = frame.add{type='flow'} - flow.add{ - type='label', - caption={'GuiAnnouncements.select-rank'} - } - role_drop_down(flow) - local btn = send_popup(flow) - btn.style.visible = false - btn.style.height = 25 - btn.style.width = 25 - flow.add{ - type='label', - name='role', - caption='' - }.style.visible = false - end -} - --- Module return --- when called it will open the center gui for the player -return setmetatable(ThisModule,{__call=function(self,...) self.Gui(...) end}) \ No newline at end of file diff --git a/old/modules/GuiAnnouncements/locale/de.cfg b/old/modules/GuiAnnouncements/locale/de.cfg deleted file mode 100644 index 9744da36..00000000 --- a/old/modules/GuiAnnouncements/locale/de.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[GuiAnnouncements] -name=Ankündigung -tooltip=Eine Ankündigung an Spieler senden -sent-to=Dies wurde zu __1__ gesendet -sent-by=Dies wurde von __1__ mit Rang __2__ gesendet -select-rank=Diese Nachricht wird gesendet an: \ No newline at end of file diff --git a/old/modules/GuiAnnouncements/locale/en.cfg b/old/modules/GuiAnnouncements/locale/en.cfg deleted file mode 100644 index be1e94da..00000000 --- a/old/modules/GuiAnnouncements/locale/en.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[GuiAnnouncements] -name=Announcements -tooltip=Sends an announcement to all players -sent-to=This announcement is sent to __1__ -sent-by=This announcement was sent by __1__ ( __2__ ) -select-rank=This announcement will be sent to: \ No newline at end of file diff --git a/old/modules/GuiAnnouncements/locale/fr.cfg b/old/modules/GuiAnnouncements/locale/fr.cfg deleted file mode 100644 index 11041b57..00000000 --- a/old/modules/GuiAnnouncements/locale/fr.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[GuiAnnouncements] -name=Announcement -tooltip=Sent an announcement to players -sent-to=This is sent to __1__ -sent-by=This was sent by __1__ of rank __2__ -select-rank=This message will be sent to: \ No newline at end of file diff --git a/old/modules/GuiAnnouncements/locale/nl.cfg b/old/modules/GuiAnnouncements/locale/nl.cfg deleted file mode 100644 index 5c92cc68..00000000 --- a/old/modules/GuiAnnouncements/locale/nl.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[GuiAnnouncements] -name=Mededelingen -tooltip=Verstuurt een mededeling naar iedereen -sent-to=Deze mededeling is gestuurd naar __1__ -sent-by=Deze mededeling is gestuurd door __1__ ( __2__ ) -select-rank=Deze mededeling wordt gestuurd naar: diff --git a/old/modules/GuiAnnouncements/locale/sv-SE.cfg b/old/modules/GuiAnnouncements/locale/sv-SE.cfg deleted file mode 100644 index 2b3a8317..00000000 --- a/old/modules/GuiAnnouncements/locale/sv-SE.cfg +++ /dev/null @@ -1,7 +0,0 @@ - -[GuiAnnouncements] -name=Meddelanden -tooltip=Sänder ett meddelande till alla spelare -sent-to=Det här meddelandet är skickat till __1__ -sent-by=Det här meddelandet är skickat av __1__ ( __2__ ) -select-rank=Det här meddelandet kommer att skickas till: diff --git a/old/modules/GuiAnnouncements/softmod.json b/old/modules/GuiAnnouncements/softmod.json deleted file mode 100644 index 9867fd84..00000000 --- a/old/modules/GuiAnnouncements/softmod.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "GuiAnnouncements", - "version": "4.0.0", - "description": "Creates a gui for making and reciving announcements", - "location": "FSM_ARCHIVE", - "keywords": [ - "Announcements", - "Gui", - "Admin" - ], - "author": "Cooldude2606", - "contact": "Discord: Cooldude2606#5241", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "dependencies": { - "FactorioStdLib.Game": "^0.8.0", - "ExpGamingCore.Role": "^4.0.0", - "ExpGamingCore.Gui": "^4.0.0" - }, - "submodules": {} -} diff --git a/old/modules/index.lua b/old/modules/index.lua deleted file mode 100644 index d48bd875..00000000 --- a/old/modules/index.lua +++ /dev/null @@ -1,67 +0,0 @@ --- not_luadoc=true ---- Used to index the files to be loaded -return { - ['AdvancedStartingItems']={'./modules/AdvancedStartingItems',}, - ['ChatPopup']={'./modules/ChatPopup','FactorioStdLib.Game','FactorioStdLib.Color'}, - ['DamagePopup']={'./modules/DamagePopup','FactorioStdLib.Color'}, - ['DeathMarkers']={'./modules/DeathMarkers',}, - ['DeconControl']={'./modules/DeconControl','ExpGamingCore.Server','FactorioStdLib.Game','ExpGamingLib'}, - ['ExpGamingAdmin']={'./modules/ExpGamingAdmin','FactorioStdLib.Game'}, - ['ExpGamingBot']={'./modules/ExpGamingBot',}, - ['ExpGamingCommands']={'./modules/ExpGamingCommands',}, - ['ExpGamingCore']={'./modules/ExpGamingCore',}, - ['ExpGamingInfo']={'./modules/ExpGamingInfo',}, - ['ExpGamingLib']={'./modules/ExpGamingLib','FactorioStdLib.Game','FactorioStdLib.Color','FactorioStdLib.Table'}, - ['ExpGamingPlayer']={'./modules/ExpGamingPlayer',}, - ['FactorioStdLib']={'./modules/FactorioStdLib',}, - ['GameSettingsGui']={'./modules/GameSettingsGui','ExpGamingCore.Server','ExpGamingCore.Gui'}, - ['GuiAnnouncements']={'./modules/GuiAnnouncements','FactorioStdLib.Game','ExpGamingCore.Role','ExpGamingCore.Gui'}, - ['PlayerAutoColor']={'./modules/PlayerAutoColor','FactorioStdLib.Color'}, - ['SpawnArea']={'./modules/SpawnArea','FactorioStdLib.Game'}, - ['WarpPoints']={'./modules/WarpPoints','FactorioStdLib.Game','ExpGamingCore.Gui'}, - ['WornPaths']={'./modules/WornPaths','FactorioStdLib.Game'}, - ['ExpGamingAdmin.Gui']={'./modules/ExpGamingAdmin/Gui','ExpGamingAdmin.AdminLib','ExpGamingCore.Gui','ExpGamingCore.Role','FactorioStdLib.Game','mod-gui'}, - ['ExpGamingAdmin.Ban']={'./modules/ExpGamingAdmin/Ban','ExpGamingAdmin.AdminLib','ExpGamingAdmin.Gui','ExpGamingCore.Server','FactorioStdLib.Game'}, - ['ExpGamingAdmin.Reports']={'./modules/ExpGamingAdmin/Reports','ExpGamingAdmin.AdminLib','ExpGamingCore.Server','ExpGamingCore.Role','FactorioStdLib.Game','ExpGamingCore.Gui'}, - ['ExpGamingAdmin.ClearInventory']={'./modules/ExpGamingAdmin/ClearInventory','ExpGamingAdmin.AdminLib','FactorioStdLib.Game'}, - ['ExpGamingAdmin.TempBan']={'./modules/ExpGamingAdmin/TempBan','ExpGamingAdmin.AdminLib','ExpGamingCore.Server','ExpGamingCore.Role','FactorioStdLib.Game'}, - ['ExpGamingAdmin.Teleport']={'./modules/ExpGamingAdmin/Teleport','ExpGamingAdmin.AdminLib','ExpGamingAdmin.Gui','FactorioStdLib.Game'}, - ['ExpGamingAdmin.Commands']={'./modules/ExpGamingAdmin/Commands','ExpGamingLib','ExpGamingCore.Command','ExpGamingAdmin.AdminLib'}, - ['ExpGamingAdmin.Jail']={'./modules/ExpGamingAdmin/Jail','ExpGamingAdmin.AdminLib','ExpGamingAdmin.Gui','ExpGamingCore.Server','ExpGamingCore.Role','FactorioStdLib.Game'}, - ['ExpGamingAdmin.Warnings']={'./modules/ExpGamingAdmin/Warnings','ExpGamingAdmin.AdminLib','ExpGamingCore.Server','ExpGamingCore.Role','FactorioStdLib.Game'}, - ['ExpGamingAdmin.Kick']={'./modules/ExpGamingAdmin/Kick','ExpGamingAdmin.AdminLib','ExpGamingAdmin.Gui','ExpGamingCore.Server','FactorioStdLib.Game'}, - ['ExpGamingBot.autoMessage']={'./modules/ExpGamingBot/autoMessage','ExpGamingCore.Server','FactorioStdLib.Game'}, - ['ExpGamingBot.discordAlerts']={'./modules/ExpGamingBot/discordAlerts','ExpGamingCore.Sync','FactorioStdLib.Color','FactorioStdLib.Game'}, - ['ExpGamingBot.autoChat']={'./modules/ExpGamingBot/autoChat','FactorioStdLib.Game','ExpGamingCore.Server'}, - ['ExpGamingCommands.cheatMode']={'./modules/ExpGamingCommands/cheatMode','ExpGamingCore.Command'}, - ['ExpGamingCommands.repair']={'./modules/ExpGamingCommands/repair','ExpGamingLib','FactorioStdLib.Game','ExpGamingCore.Role'}, - ['ExpGamingCommands.tags']={'./modules/ExpGamingCommands/tags','ExpGamingLib','ExpGamingCore.Command','FactorioStdLib.Game'}, - ['ExpGamingCommands.home']={'./modules/ExpGamingCommands/home','FactorioStdLib.Game','ExpGamingCore.Command'}, - ['ExpGamingCore.Command']={'./modules/ExpGamingCore/Command','ExpGamingLib','FactorioStdLib.Table','FactorioStdLib.Color','FactorioStdLib.Game'}, - ['ExpGamingCommands.teleport']={'./modules/ExpGamingCommands/teleport','ExpGamingCore.Command','ExpGamingAdmin.Teleport','ExpGamingAdmin.AdminLib'}, - ['ExpGamingCommands.bonus']={'./modules/ExpGamingCommands/bonus','FactorioStdLib.Game','ExpGamingLib','ExpGamingCore.Command','ExpGamingCore.Role'}, - ['ExpGamingCommands.kill']={'./modules/ExpGamingCommands/kill','ExpGamingCore.Command','ExpGamingCore.Role','FactorioStdLib.Game'}, - ['ExpGamingCore.Server']={'./modules/ExpGamingCore/Server','ExpGamingLib','FactorioStdLib.Table','FactorioStdLib.Color','FactorioStdLib.String','FactorioStdLib.Game'}, - ['ExpGamingCore.Gui']={'./modules/ExpGamingCore/Gui','ExpGamingLib','FactorioStdLib.Table','FactorioStdLib.Color','FactorioStdLib.Game'}, - ['ExpGamingInfo.Science']={'./modules/ExpGamingInfo/Science','ExpGamingCore.Gui','FactorioStdLib.Game'}, - ['ExpGamingPlayer.playerList']={'./modules/ExpGamingPlayer/playerList','FactorioStdLib.Game','ExpGamingCore.Gui'}, - ['ExpGamingCore.Sync']={'./modules/ExpGamingCore/Sync','ExpGamingLib','FactorioStdLib.Color','FactorioStdLib.Game','FactorioStdLib.Table'}, - ['ExpGamingCore.Role']={'./modules/ExpGamingCore/Role','ExpGamingLib','FactorioStdLib.Table','FactorioStdLib.Game','ExpGamingCore.Group'}, - ['ExpGamingInfo.Readme']={'./modules/ExpGamingInfo/Readme','ExpGamingCore.Gui','FactorioStdLib.Game'}, - ['ExpGamingInfo.Rockets']={'./modules/ExpGamingInfo/Rockets','ExpGamingCore.Gui','FactorioStdLib.Game'}, - ['ExpGamingCore.Group']={'./modules/ExpGamingCore/Group','FactorioStdLib','ExpGamingLib','FactorioStdLib.Game'}, - ['ExpGamingInfo.Tasklist']={'./modules/ExpGamingInfo/Tasklist','ExpGamingCore.Gui','ExpGamingCore.Role','FactorioStdLib.Game'}, - ['ExpGamingPlayer.playerInfo']={'./modules/ExpGamingPlayer/playerInfo','FactorioStdLib.Game','ExpGamingCore.Gui'}, - ['ExpGamingPlayer.afkKick']={'./modules/ExpGamingPlayer/afkKick','FactorioStdLib.Game','ExpGamingCore.Gui'}, - ['FactorioStdLib.Table']={'./modules/FactorioStdLib/Table',}, - ['ExpGamingPlayer.polls']={'./modules/ExpGamingPlayer/polls','ExpGamingCore.Gui','ExpGamingCore.Server'}, - ['FactorioStdLib.Color']={'./modules/FactorioStdLib/Color',}, - ['FactorioStdLib.Game']={'./modules/FactorioStdLib/Game',}, - ['FactorioStdLib.String']={'./modules/FactorioStdLib/String',}, - ['ExpGamingPlayer.inventorySearch']={'./modules/ExpGamingPlayer/inventorySearch','ExpGamingLib','ExpGamingAdmin.TempBan','ExpGamingAdmin.Warnings','FactorioStdLib.Game','ExpGamingAdmin.AdminLib'}, - ['ExpGamingCore.Gui.center']={'./modules/ExpGamingCore/Gui/center','mod-gui','FactorioStdLib.Game','FactorioStdLib.Color','ExpGamingCore.Gui','ExpGamingCore.Gui.inputs'}, - ['ExpGamingCore.Gui.popup']={'./modules/ExpGamingCore/Gui/popup','mod-gui','FactorioStdLib.Game','ExpGamingCore.Gui','ExpGamingCore.Gui.inputs'}, - ['ExpGamingCore.Gui.toolbar']={'./modules/ExpGamingCore/Gui/toolbar','mod-gui','FactorioStdLib.Game','ExpGamingCore.Gui','ExpGamingCore.Gui.inputs'}, - ['ExpGamingCore.Gui.left']={'./modules/ExpGamingCore/Gui/left','mod-gui','FactorioStdLib.Game','ExpGamingCore.Server','FactorioStdLib.Color','ExpGamingCore.Gui','ExpGamingCore.Gui.inputs'}, - ['ExpGamingCore.Gui.inputs']={'./modules/ExpGamingCore/Gui/inputs','mod-gui','FactorioStdLib.Color','FactorioStdLib.Game','ExpGamingCore.Gui'}, -} \ No newline at end of file diff --git a/old/modules/softmod.json b/old/modules/softmod.json deleted file mode 100644 index d74c2446..00000000 --- a/old/modules/softmod.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "ExpGamingScenario", - "version": "4.0.0", - "description": "The basic scenario used on ExpGaming public servers", - "author": "ExpGaming", - "contact": "https://explosivegaming.nl", - "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", - "keywords": [ - "ExpGaming", - "Vanila Plus" - ], - "softmods": { - "AdvancedStartingItems": "4.0.0", - "ChatPopup": "4.0.0", - "DamagePopup": "4.0.0", - "DeathMarkers": "4.0.0", - "DeconControl": "4.0.0", - "ExpGamingAdmin": "4.0.0", - "ExpGamingBot": "4.0.0", - "ExpGamingCommands": "4.0.0", - "ExpGamingCore": "4.0.0", - "ExpGamingInfo": "4.0.0", - "ExpGamingLib": "4.0.0", - "ExpGamingPlayer": "4.0.0", - "FactorioStdLib": "0.8.0", - "GameSettingsGui": "4.0.0", - "GuiAnnouncements": "4.0.0", - "PlayerAutoColor": "4.0.0", - "SpawnArea": "4.0.0", - "WarpPoints": "4.0.0", - "WornPaths": "4.0.0" - } -} diff --git a/resources/day_night_cycles.lua b/resources/day_night_cycles.lua deleted file mode 100644 index dd4062bd..00000000 --- a/resources/day_night_cycles.lua +++ /dev/null @@ -1,59 +0,0 @@ -return { - -- ~7 minute cycle, 3m28s of full light, 1m23s light to dark, 42s full dark, 1m23s dark to light - vanilla = { - ticks_per_day = 25000, - dusk = 0.25, - evening = 0.45, - morning = 0.55, - dawn = 0.75 - }, - -- 10 minute cycle, 4m of full light, 4m light to dark, 6s full dark, 2m dark to light - bright = { - ticks_per_day = 36000, - dusk = 0.2, - evening = 0.59, - morning = 0.6, - dawn = 0.8 - }, - -- ~14 minute cycle, 6m56s of full light, 2m46s light to dark, 1m24s full dark, 2m46s dark to light - double_length = { - ticks_per_day = 50000, - dusk = 0.25, - evening = 0.45, - morning = 0.55, - dawn = 0.75 - }, - -- 10 minute cycle, 6s of full light, 2m light to dark, 4m full dark, 4m dark to light - gloomy = { - ticks_per_day = 36000, - dusk = 0, - evening = 0.2, - morning = 0.6, - dawn = 0.99 - }, - -- ~3.5 minute cycle, 1m44s of full light, 42s light to dark, 21s full dark, 42s dark to light - half_length = { - ticks_per_day = 12500, - dusk = 0.25, - evening = 0.45, - morning = 0.55, - dawn = 0.75 - }, - -- 20 minute cycle, 9m of full light, 1m light to dark, 9m full dark, 1m dark to light - long_days_long_nights_fast_transitions = { - ticks_per_day = 72000, - dusk = 0.225, - evening = 0.275, - morning = 0.725, - dawn = 0.775 - }, - -- 6 hour cycle based on Feb 3 London, England for the day/night/twilight times: - -- Day: 2h15m Night: 2h45m Day to night and night to day: 30m each Map starts mid-day - feb3 = { - ticks_per_day = 1296000, - dusk = 4.5 / 24, - evening = 15.5 / 24, - morning = 17.5 / 24, - dawn = 19.5 / 24 - } -} diff --git a/resources/difficulty_settings.lua b/resources/difficulty_settings.lua deleted file mode 100644 index 6a1db0bf..00000000 --- a/resources/difficulty_settings.lua +++ /dev/null @@ -1,72 +0,0 @@ --- technology_difficulty has no effect in vanilla -return { - -- the default table is included as a reference but also to give the option of overwriting all user settings - default = { - recipe_difficulty = defines.difficulty_settings.recipe_difficulty.normal, - technology_difficulty = defines.difficulty_settings.technology_difficulty.normal, - technology_price_multiplier = 1 - }, - -- turns on expensive recipes - expensive_recipe = { - recipe_difficulty = defines.difficulty_settings.recipe_difficulty.expensive - }, - -- the following are tech cost reducers - ['tech_x0.25'] = { - technology_price_multiplier = 0.25 - }, - ['tech_x0.5'] = { - technology_price_multiplier = 0.5 - }, - ['tech_x0.75'] = { - technology_price_multiplier = 0.75 - }, - -- the following are all tech cost multipliers - tech_x2 = { - technology_price_multiplier = 2 - }, - tech_x3 = { - technology_price_multiplier = 3 - }, - tech_x4 = { - technology_price_multiplier = 4 - }, - tech_x5 = { - technology_price_multiplier = 5 - }, - tech_x6 = { - technology_price_multiplier = 6 - }, - tech_x8 = { - technology_price_multiplier = 8 - }, - tech_x10 = { - technology_price_multiplier = 10 - }, - tech_x12 = { - technology_price_multiplier = 12 - }, - tech_x14 = { - technology_price_multiplier = 14 - }, - tech_x16 = { - technology_price_multiplier = 16 - }, - tech_x20 = { - technology_price_multiplier = 20 - }, - tech_x50 = { - technology_price_multiplier = 50 - }, - tech_x100 = { - technology_price_multiplier = 100 - }, - tech_x250 = { - technology_price_multiplier = 250 - }, - tech_x500 = { - technology_price_multiplier = 500 - }, - tech_x1000 = { - technology_price_multiplier = 1000 - } -} diff --git a/resources/donator_perks.lua b/resources/donator_perks.lua deleted file mode 100644 index 1e68bc6d..00000000 --- a/resources/donator_perks.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - rank = 0x1, - train = 0x2 -} diff --git a/resources/fish_messages.lua b/resources/fish_messages.lua deleted file mode 100644 index 7f584da4..00000000 --- a/resources/fish_messages.lua +++ /dev/null @@ -1,56 +0,0 @@ -return { - 'Why don’t fish like basketball? Cause they’re afraid of the net', - 'What do you get when you cross a banker with a fish? A Loan shark!', - 'How do you make an Octupus laugh? With ten-tickles', - 'What do you call a fish that needs help with his or her vocals? Autotuna', - 'What is the difference between a piano and a fish? You can tune a piano but you cannot tuna fish.', - 'What did the blind man say when he passed the fish market? Good morning ladies.', - 'Did you hear about the goldfish who went bankrupt? Now he’s a bronze fish.', - 'What happens when you put nutella on salmon? You get salmonella', - 'What do you call a fish with no eyes?…Fsh', - 'What kind of money do fishermen make?…Net profits', - 'What do you get if you cross a salmon, a bird’s leg and a hand?…Birdsthigh fish fingers', - 'Why is a fish easy to weigh?…Because it has its own scales', - 'Why are gold fish orange?…The water makes them rusty', - 'What was the Tsar of Russia’s favorite fish?…Tsardines', - 'Why did the dog jump into the sea?…He wanted to chase the catfish', - 'Which fish dresses the best?…The Swordfish – It always looks sharp', - 'What do you get if you cross an abbot with a trout?…Monkfish', - 'What do you call a big fish who makes you an offer you can’t refuse?…The Codfather', - 'Why is a swordfish’s nose 11 inches long?…If it were 12 inches long it would be a foot', - 'What do you get if you cross a trout with an apartment?…A flat fish', - 'Why are fish no good at tennis?…They don’t like to get too close to the net', - 'How do the fish get to school?…By octobus', - 'What fish make the best sandwich?…A peanut butter and jellyfish', - 'Man: Can I have a fly rod and reel for my son?…Fishing Shop Owner: Sorry sir we don’t do trades', - 'Where do fish keep their money?…In the river bank', - 'Why do fish like arcade games?…Because they are finball wizards', - 'What is a mermaid?…A deep-she fish', - 'What do you get if you cross a whale with rotten fish?…Moby Sick', - 'Why didn’t the lobster share his toys?…He was too shellfish', - 'What do fish use to make telephone calls?…a Shell phone', - 'Why don’t fish make very good tennis balls?…They keep getting caught in the net', - 'Electric eels and electric rays have enough electricity to kill a horse.', - 'Most fish have taste buds all over their body.', - 'Most brands of lipstick contain fish scales.', - 'A fish does not add new scales as it grows, but the scales it has increase in size. In this way, growth rings are formed and the rings reveal the age of a fish.', - 'An inflated porcupine fish can reach a diameter of up to 35 inches. It puffs up by swallowing water and then storing it in its stomach.', - 'Most fish cannot swim backwards. Those that can are mainly members of one of the eel families.', - 'The fastest fish is the sailfish. It can swim as fast as a car travels on the highway.', - 'Some desert pupfish can live in hot springs that reach temperatures greater than 113° F.', - 'Anableps, four-eyed fish, can see above and below water at the same time.', - 'Catfish have over 27,000 taste buds. Humans have around 7,000.', - 'One hagfish can make enough slime in one minute to fill a bucket.', - 'A female sunfish can lay 300 million eggs each year.', - 'Fish feel pain and suffer stress just like mammals and birds.', - 'The Dwarf Seahorse is so slow you can’t see it move', - 'Some fish are as small as a grain of rice', - "There's a species of fish called 'Slippery Dick'", - 'Herrings communicate through farts.', - 'One Puffer Fish contains enough poison to kill 30 medium-biters.', - 'When Anglerfish mate, they melt into each other and share their bodies forever.', - "A koi fish named 'Hanako' lived for 225 years.", - "What did the fish say when he posted bail? I'm off the hook!", - 'There was a sale at the fish market today. I went to see what was the catch.', - 'There are over 25,000 identified species of fish on the earth.' -} diff --git a/resources/hodor_messages.lua b/resources/hodor_messages.lua deleted file mode 100644 index 45d021ff..00000000 --- a/resources/hodor_messages.lua +++ /dev/null @@ -1,12 +0,0 @@ --- List of hodor's responses and their weights -return { - {'Hodor.', 16}, - {'Hodor?', 16}, - {'Hodor!', 16}, - {'Hodor! Hodor! Hodor! Hodor!', 4}, - {'Hodor :(', 4}, - {'Hodor :)', 4}, - {'HOOOODOOOR!', 4}, - {'( ͡° ͜ʖ ͡°)', 1}, - {'☉ ‿ ⚆', 1} -} diff --git a/resources/join_messages.lua b/resources/join_messages.lua deleted file mode 100644 index 4caceef3..00000000 --- a/resources/join_messages.lua +++ /dev/null @@ -1,9 +0,0 @@ --- List of join messages and their weights. Default is 10. -return { - {'And remember.. Keep Calm And Spaghetti!', 50}, - {'Press F to pay respects to the "Press F to pay respect" message', 3}, - {'Not sure what to do? Ask Newcott.', 1}, - {'Stick and move, stick and move', 10}, - {'Fly like a butterfly, sting like a bee', 10}, - {"These are not the bots you're looking for", 10} -} diff --git a/resources/map_gen_settings.lua b/resources/map_gen_settings.lua deleted file mode 100644 index 400ceefd..00000000 --- a/resources/map_gen_settings.lua +++ /dev/null @@ -1,330 +0,0 @@ ---[[ The easiest way to create a preset to add to this file is to use factorio itself. Create a new world - (vanilla, not scenario) and configure the settings you want. When you launch the game, you can run the following: - /c - local str = serpent.block(game.surfaces.nauvis.map_gen_settings) - game.write_file('map_gen_settings.lua', str) - - This will output a file with a table that you can add to this resources file or into your specific map. - In either case, make sure to set seed to nil unless you want your map to be *exactly* the same each time. - The expectation is that all changes that deviate from default generation are noted. - Water size and frequency is not denoted as such. Instead water size = water and water frequency = terrain_segmentation -]] -return { - -- the default table is included as a reference but also to give the option of overwriting all user settings - default = { - autoplace_controls = { - coal = { - frequency = 'normal', - richness = 'normal', - size = 'normal' - }, - ['copper-ore'] = { - frequency = 'normal', - richness = 'normal', - size = 'normal' - }, - ['crude-oil'] = { - frequency = 'normal', - richness = 'normal', - size = 'normal' - }, - desert = { - frequency = 'normal', - richness = 'normal', - size = 'normal' - }, - dirt = { - frequency = 'normal', - richness = 'normal', - size = 'normal' - }, - ['enemy-base'] = { - frequency = 'normal', - richness = 'normal', - size = 'normal' - }, - grass = { - frequency = 'normal', - richness = 'normal', - size = 'normal' - }, - ['iron-ore'] = { - frequency = 'normal', - richness = 'normal', - size = 'normal' - }, - sand = { - frequency = 'normal', - richness = 'normal', - size = 'normal' - }, - stone = { - frequency = 'normal', - richness = 'normal', - size = 'normal' - }, - trees = { - frequency = 'normal', - richness = 'normal', - size = 'normal' - }, - ['uranium-ore'] = { - frequency = 'normal', - richness = 'normal', - size = 'normal' - } - }, - cliff_settings = { - cliff_elevation_0 = 10, - cliff_elevation_interval = 10, - name = 'cliff' - }, - height = 2000000, - peaceful_mode = false, - starting_area = 'normal', - terrain_segmentation = 'normal', - water = 'normal', - width = 2000000 - }, - -- no enemies - enemy_none = { - autoplace_controls = { - ['enemy-base'] = { - frequency = 'normal', - richness = 'normal', - size = 'none' - } - } - }, - -- high frequency and big size enemies - enemy_high = { - autoplace_controls = { - ['enemy-base'] = { - frequency = 'high', - richness = 'normal', - size = 'high' - } - } - }, - -- very high frequency and very big size enemies - enemy_very_high = { - autoplace_controls = { - ['enemy-base'] = { - frequency = 'very-high', - richness = 'normal', - size = 'very-high' - } - } - }, - -- no ores - ore_none = { - autoplace_controls = { - coal = { - frequency = 'normal', - richness = 'normal', - size = 'none' - }, - ['copper-ore'] = { - frequency = 'normal', - richness = 'normal', - size = 'none' - }, - ['iron-ore'] = { - frequency = 'normal', - richness = 'normal', - size = 'none' - }, - stone = { - frequency = 'normal', - richness = 'normal', - size = 'none' - }, - ['uranium-ore'] = { - frequency = 'normal', - richness = 'normal', - size = 'none' - } - } - }, - -- no oil - oil_none = { - autoplace_controls = { - ['crude-oil'] = { - frequency = 'normal', - richness = 'normal', - size = 'none' - } - } - }, - -- no ores, no oil - ore_oil_none = { - autoplace_controls = { - coal = { - frequency = 'normal', - richness = 'normal', - size = 'none' - }, - ['copper-ore'] = { - frequency = 'normal', - richness = 'normal', - size = 'none' - }, - ['crude-oil'] = { - frequency = 'normal', - richness = 'normal', - size = 'none' - }, - ['iron-ore'] = { - frequency = 'normal', - richness = 'normal', - size = 'none' - }, - stone = { - frequency = 'normal', - richness = 'normal', - size = 'none' - }, - ['uranium-ore'] = { - frequency = 'normal', - richness = 'normal', - size = 'none' - } - } - }, - -- no water - water_none = { - terrain_segmentation = 'very-low', - water = 'none' - }, - -- very low water - water_very_low = { - terrain_segmentation = 'very-low', - water = 'very-low' - }, - -- no cliffs - cliff_none = { - cliff_settings = { - cliff_elevation_0 = 1024, - cliff_elevation_interval = 10, - name = 'cliff' - } - }, - -- normal cliffs - cliff_normal = { - name = 'cliff', - cliff_elevation_0 = 10, - cliff_elevation_interval = 10 - }, - -- cliffs to very high frequency, very big size - cliff_very_high = { - cliff_settings = { - cliff_elevation_0 = 2.5000572204589844, - cliff_elevation_interval = 2.5000572204589844, - name = 'cliff' - } - }, - -- cliffs to very high frequency, very big size - tree_none = { - autoplace_controls = { - trees = { - frequency = 'normal', - richness = 'normal', - size = 'none' - } - } - }, - -- cliffs to very high frequency, very big size - tree_very_high = { - autoplace_controls = { - trees = { - frequency = 'very-high', - richness = 'very-high', - size = 'very-high' - } - } - }, - -- starting area to very low - starting_area_very_low = { - starting_area = 'very-low' - }, - -- peaceful mode on - peaceful_mode_on = { - peaceful_mode = true - }, - -- random seed, in case you need/want the seed to be unique from nauvis - unique_seed = { - seed = nil - }, - -- grass only - grass_only = { - autoplace_controls = { - grass = {frequency = 'normal', size = 'normal', richness = 'normal'}, - desert = {frequency = 'normal', size = 'none', richness = 'normal'}, - dirt = {frequency = 'normal', size = 'none', richness = 'normal'}, - sand = {frequency = 'normal', size = 'none', richness = 'normal'} - } - }, - -- desert only - desert_only = { - autoplace_controls = { - grass = {frequency = 'normal', size = 'none', richness = 'normal'}, - desert = {frequency = 'normal', size = 'normal', richness = 'normal'}, - dirt = {frequency = 'normal', size = 'none', richness = 'normal'}, - sand = {frequency = 'normal', size = 'none', richness = 'normal'} - } - }, - -- dirt only - dirt_only = { - autoplace_controls = { - grass = {frequency = 'normal', size = 'none', richness = 'normal'}, - desert = {frequency = 'normal', size = 'none', richness = 'normal'}, - dirt = {frequency = 'normal', size = 'normal', richness = 'normal'}, - sand = {frequency = 'normal', size = 'none', richness = 'normal'} - } - }, - -- sand only - sand_only = { - autoplace_controls = { - grass = {frequency = 'normal', size = 'none', richness = 'normal'}, - desert = {frequency = 'normal', size = 'none', richness = 'normal'}, - dirt = {frequency = 'normal', size = 'none', richness = 'normal'}, - sand = {frequency = 'normal', size = 'normal', richness = 'normal'} - } - }, - -- will generate a world with only water (useful for maps that want full terrain control and no entities on the surface) - waterworld = { - autoplace_controls = { - desert = { - frequency = 'normal', - richness = 'normal', - size = 'none' - }, - dirt = { - frequency = 'normal', - richness = 'normal', - size = 'none' - }, - grass = { - frequency = 'normal', - richness = 'normal', - size = 'none' - }, - sand = { - frequency = 'normal', - richness = 'normal', - size = 'none' - } - }, - starting_points = { - { - x = 0, - y = 0 - } - } - }, - -- creates a 1x1 world border, this will prevent chunks from being generated - void = { - height = 1, - width = 1 - } -} diff --git a/resources/map_settings.lua b/resources/map_settings.lua deleted file mode 100644 index c18de210..00000000 --- a/resources/map_settings.lua +++ /dev/null @@ -1,186 +0,0 @@ -return { - -- the default table is included as a reference but also to give the option of overwriting all user settings - default = { - pollution = { - enabled = true, - diffusion_ratio = 0.02, - min_to_diffuse = 15, - ageing = 1, - expected_max_per_chunk = 7000, - min_to_show_per_chunk = 700, - min_pollution_to_damage_trees = 3500, - pollution_with_max_forest_damage = 10000, - pollution_per_tree_damage = 2000, - pollution_restored_per_tree_damage = 500, - max_pollution_to_restore_trees = 1000 - }, - enemy_evolution = { - enabled = true, - time_factor = 0.000004, - destroy_factor = 0.002, - pollution_factor = 0.000015 - }, - enemy_expansion = { - enabled = true, - max_expansion_distance = 7, - friendly_base_influence_radius = 2, - enemy_building_influence_radius = 2, - building_coefficient = 0.1, - other_base_coefficient = 2.0, - neighbouring_chunk_coefficient = 0.5, - neighbouring_base_chunk_coefficient = 0.4, - max_colliding_tiles_coefficient = 0.9, - settler_group_min_size = 5, - settler_group_max_size = 20, - min_expansion_cooldown = 4 * 3600, - max_expansion_cooldown = 60 * 3600 - }, - unit_group = { - min_group_gathering_time = 3600, - max_group_gathering_time = 10 * 3600, - max_wait_time_for_late_members = 2 * 3600, - max_group_radius = 30.0, - min_group_radius = 5.0, - max_member_speedup_when_behind = 1.4, - max_member_slowdown_when_ahead = 0.6, - max_group_slowdown_factor = 0.3, - max_group_member_fallback_factor = 3, - member_disown_distance = 10, - tick_tolerance_when_member_arrives = 60, - max_gathering_unit_groups = 30, - max_unit_group_size = 200 - }, - steering = { - default = { - radius = 1.2, - separation_force = 0.005, - separation_factor = 1.2, - force_unit_fuzzy_goto_behavior = false - }, - moving = { - radius = 3, - separation_force = 0.01, - separation_factor = 3, - force_unit_fuzzy_goto_behavior = false - } - }, - path_finder = { - fwd2bwd_ratio = 5, - goal_pressure_ratio = 2, - max_steps_worked_per_tick = 100, - use_path_cache = true, - short_cache_size = 5, - long_cache_size = 25, - short_cache_min_cacheable_distance = 10, - short_cache_min_algo_steps_to_cache = 50, - long_cache_min_cacheable_distance = 30, - cache_max_connect_to_cache_steps_multiplier = 100, - cache_accept_path_start_distance_ratio = 0.2, - cache_accept_path_end_distance_ratio = 0.15, - negative_cache_accept_path_start_distance_ratio = 0.3, - negative_cache_accept_path_end_distance_ratio = 0.3, - cache_path_start_distance_rating_multiplier = 10, - cache_path_end_distance_rating_multiplier = 20, - stale_enemy_with_same_destination_collision_penalty = 30, - ignore_moving_enemy_collision_distance = 5, - enemy_with_different_destination_collision_penalty = 30, - general_entity_collision_penalty = 10, - general_entity_subsequent_collision_penalty = 3, - max_clients_to_accept_any_new_request = 10, - max_clients_to_accept_short_new_request = 100, - direct_distance_to_consider_short_request = 100, - short_request_max_steps = 1000, - short_request_ratio = 0.5, - min_steps_to_check_path_find_termination = 2000, - start_to_goal_cost_multiplier_to_terminate_path_find = 500.0 - }, - max_failed_behavior_count = 3 - }, - -- no pollution - pollution_off = { - pollution = { - enabled = false - } - }, - -- decreases the spread of pollution and increases the absorption per chunk of land - pollution_decreased_per_chunk = { - pollution = { - diffusion_ratio = 0.01, - min_to_diffuse = 30, - ageing = 2 - } - }, - -- tough to spread pollution, pollution rapidly decayse: for venus - pollution_hard_to_spread = { - enabled = true, - diffusion_ratio = 0.01, - min_to_diffuse = 200, - ageing = 5 - }, - -- increases the ability of trees to suck up pollution - pollution_decreased_per_tree = { - pollution = { - pollution_with_max_forest_damage = 20000, - pollution_per_tree_damage = 4000, - max_pollution_to_restore_trees = 2000 - } - }, - -- no enemy evolution - enemy_evolution_off = { - enemy_evolution = { - enabled = false - } - }, - -- evolution from all factors x2 - enemy_evolution_x2 = { - enemy_evolution = { - enabled = true, - time_factor = 0.000008, - destroy_factor = 0.004, - pollution_factor = 0.000030 - } - }, - -- 3x cost for pollution, all else 1x - enemy_evolution_punishes_pollution = { - enemy_evolution = { - enabled = true, - time_factor = 0.000004, - destroy_factor = 0.002, - pollution_factor = 0.000045 - } - }, - -- 3x cost for destroying spawners, all else 1x - enemy_evolution_punishes_destruction = { - enemy_evolution = { - enabled = true, - time_factor = 0.000004, - destroy_factor = 0.006, - pollution_factor = 0.000015 - } - }, - -- no enemy expansion - enemy_expansion_off = { - enemy_expansion = { - enabled = false - } - }, - -- should increase the fequency with which enemies expand - enemy_expansion_frequency_x4 = { - enemy_expansion = { - enabled = true, - min_expansion_cooldown = 1 * 3600, - max_expansion_cooldown = 15 * 3600 - } - }, - -- biters will expand to more chunks and will be more densely packed - enemy_expansion_aggressive = { - enemy_expansion = { - enabled = true, - max_expansion_distance = 21, - friendly_base_influence_radius = 1, - enemy_building_influence_radius = 1, - settler_group_min_size = 1, - settler_group_max_size = 10 - } - } -} diff --git a/resources/market_items.lua b/resources/market_items.lua deleted file mode 100644 index e63da3b4..00000000 --- a/resources/market_items.lua +++ /dev/null @@ -1,81 +0,0 @@ -return { - { - name = 'temporary-running-speed-bonus', - name_label = 'Temporary running speed bonus', - type = 'temporary-buff', - description = 'Increases running speed by one level for a short period', - sprite = 'technology/exoskeleton-equipment', - stack_limit = 1, - price = 10, - }, - { - name = 'temporary-mining-speed-bonus', - name_label = 'Temporary mining speed bonus', - type = 'temporary-buff', - description = 'Increases manual mining speed by one level for a short period', - sprite = 'technology/mining-productivity-1', - stack_limit = 1, - price = 10, - }, - {price = 2, name = 'raw-fish'}, - {price = 0.95, name = 'rail'}, - {price = 2, name = 'rail-signal'}, - {price = 2, name = 'rail-chain-signal'}, - {price = 15, name = 'train-stop'}, - {price = 75, name = 'locomotive'}, - {price = 30, name = 'cargo-wagon'}, - {price = 0.95, name = 'red-wire'}, - {price = 0.95, name = 'green-wire'}, - {price = 3, name = 'decider-combinator'}, - {price = 3, name = 'arithmetic-combinator'}, - {price = 3, name = 'constant-combinator'}, - {price = 7, name = 'programmable-speaker'}, - {price = 15, name = 'steel-axe'}, - {price = 15, name = 'submachine-gun'}, - {price = 15, name = 'shotgun'}, - {price = 250, name = 'combat-shotgun'}, - {price = 25, name = 'railgun'}, - {price = 250, name = 'flamethrower'}, - {price = 175, name = 'rocket-launcher'}, - {price = 250, name = 'tank-cannon'}, - {price = 750, name = 'tank-machine-gun'}, - {price = 75, name = 'tank-flamethrower'}, - {price = 2500, name = 'artillery-wagon-cannon'}, - {price = 1, name = 'firearm-magazine'}, - {price = 5, name = 'piercing-rounds-magazine'}, - {price = 20, name = 'uranium-rounds-magazine'}, - {price = 2, name = 'shotgun-shell'}, - {price = 10, name = 'piercing-shotgun-shell'}, - {price = 5, name = 'railgun-dart'}, - {price = 25, name = 'flamethrower-ammo'}, - {price = 15, name = 'rocket'}, - {price = 25, name = 'explosive-rocket'}, - {price = 2500, name = 'atomic-bomb'}, - {price = 20, name = 'cannon-shell'}, - {price = 30, name = 'explosive-cannon-shell'}, - {price = 75, name = 'explosive-uranium-cannon-shell'}, - {price = 100, name = 'artillery-shell'}, - {price = 3, name = 'land-mine'}, - {price = 5, name = 'grenade'}, - {price = 35, name = 'cluster-grenade'}, - {price = 5, name = 'defender-capsule'}, - {price = 75, name = 'destroyer-capsule'}, - {price = 35, name = 'poison-capsule'}, - {price = 35, name = 'slowdown-capsule'}, - {price = 50, name = 'artillery-targeting-remote'}, - {price = 1000, name = 'artillery-turret'}, - {price = 350, name = 'modular-armor'}, - {price = 875, name = 'power-armor'}, - {price = 40, name = 'solar-panel-equipment'}, - {price = 875, name = 'fusion-reactor-equipment'}, - {price = 100, name = 'battery-equipment'}, - {price = 625, name = 'battery-mk2-equipment'}, - {price = 250, name = 'belt-immunity-equipment'}, - {price = 100, name = 'night-vision-equipment'}, - {price = 150, name = 'exoskeleton-equipment'}, - {price = 250, name = 'personal-roboport-equipment'}, - {price = 25, name = 'construction-robot'}, - {price = 350, name = 'energy-shield-equipment'}, - {price = 750, name = 'personal-laser-defense-equipment'}, - {price = 1, name = 'refined-hazard-concrete'}, -} diff --git a/resources/naming_words.lua b/resources/naming_words.lua deleted file mode 100644 index e36c45d6..00000000 --- a/resources/naming_words.lua +++ /dev/null @@ -1,253 +0,0 @@ --- Currently geared towards the winter holidays but we can always revise if needed. --- (Ex. a table of standard/common words and tables for season-specific words, then combined for specific purposes/use-cases) - -local Module = {} - -Module.adverbs = { - 'Abnormally', - 'Accidentally', - 'Adventurously', - 'Anxiously', - 'Arrogantly', - 'Awkwardly', - 'Bashfully', - 'Beautifully', - 'Blindly', - 'Blissfully', - 'Boastfully', - 'Boldly', - 'Bravely', - 'Calmly', - 'Carefully', - 'Carelessly', - 'Cautiously', - 'Certainly', - 'Cheerfully', - 'Clearly', - 'Closely', - 'Continually', - 'Courageously', - 'Cruelly', - 'Curiously', - 'Dearly', - 'Deeply', - 'Defiantly', - 'Deliberately', - 'Delightfully', - 'Dimly', - 'Doubtfully', - 'Dreamily', - 'Easily', - 'Elegantly', - 'Energetically', - 'Enormously', - 'Enthusiastically', - 'Especially', - 'Eventually', - 'Excitedly', - 'Extremely', - 'Fairly', - 'Faithfully', - 'Famously', - 'Fatally', - 'Ferociously', - 'Fervently', - 'Fiercely', - 'Fondly', - 'Foolishly', - 'Frantically', - 'Frightfully', - 'Furiously', - 'Generally', - 'Generously', - 'Gently', - 'Gladly', - 'Gleefully', - 'Gracefully', - 'Greatly', - 'Happily', - 'Heavily', - 'Helpfully', - 'Helplessly', - 'Honestly', - 'Hopelessly', - 'Hungrily', - 'Innocently', - 'Inquisitively', - 'Intensely', - 'Interestingly', - 'Irritably', - 'Jovially', - 'Joyfully', - 'Kindheartedly', - 'Kindly', - 'Knowingly', - 'Lazily', - 'Lively', - 'Longingly', - 'Loosely', - 'Loudly', - 'Lovingly', - 'Loyally', - 'Madly', - 'Majestically', - 'Merrily', - 'Miserably', - 'Mockingly', - 'Mostly', - 'Mysteriously', - 'Naturally', - 'Nearly', - 'Nicely', - 'Noisily', - 'Obnoxiously', - 'Offensively', - 'Optimistically', - 'Painfully', - 'Patiently', - 'Perfectly', - 'Playfully', - 'Politely', - 'Positively', - 'Powerfully', - 'Questionably', - 'Quickly', - 'Quietly', - 'Randomly', - 'Rapidly', - 'Readily', - 'Reluctantly', - 'Righteously', - 'Safely', - 'Seemingly', - 'Selfishly', - 'Silently', - 'Sleepily', - 'Stealthily', - 'Successfully', - 'Suddenly', - 'Surprisingly', - 'Suspiciously', - 'Sweetly', - 'Tenderly', - 'Thankfully', - 'Unbearably', - 'Unexpectedly', - 'Unfortunately', - 'Unimpressively', - 'Unnecessarily', - 'Urgently', - 'Uselessly', - 'Vaguely', - 'Warmly', - 'Wildly', - 'Wisely', - 'Wrongly', - 'Youthfully', -} - -Module.adjectives = { - 'Amazing', - 'Attractive', - 'Awesome', - 'Beautiful', - 'Big', - 'Blissful', - 'Brave', - 'Breathtaking', - 'Careful', - 'Caroling', - 'Chubby', - 'Clever', - 'Clumsy', - 'Dazzling', - 'Delightful', - 'Eager', - 'Excitable', - 'Fabulous', - 'Faithful', - 'Fancy', - 'Fantastic', - 'Fantastical', - 'Fierce', - 'Gentle', - 'Glamorous', - 'Gorgeous', - 'Great', - 'Grumpy', - 'Happy', - 'Helpful', - 'Interesting', - 'Jolly', - 'Kind', - 'Lazy', - 'Magical', - 'Magnificent', - 'Merry', - 'Muscular', - 'Mystical', - 'Naughty', - 'Nice', - 'Obedient', - 'Peaceful', - 'Plump', - 'Polite', - 'Quaint', - 'Remarkable', - 'Roasting', - 'Scary', - 'Silly', - 'Small', - 'Tender', - 'Thoughtful', - 'White', - 'Witty', - 'Wonderful', -} - -Module.nouns = { - 'Advent', - 'Angel', - 'Bear', - 'Bell', - 'Candy_Cane', - 'Caroler', - 'Chestnut', - 'Christmas_Stocking', - 'Decoration', - 'Elf', - 'Feast', - 'Fruit_Cake', - 'Garland', - 'Gift', - 'Grinch', - 'Ham', - 'Helper', - 'Holiday_Dinner', - 'Holiday_Sweater', - 'Holly', - 'Ice_Skate', - 'Ivy', - 'Menora', - 'Miracle', - 'Mistletoe', - 'Ornament', - 'Package', - 'Party', - 'Present', - 'Reindeer', - 'Ribbon', - 'Scarf', - 'Scrooge', - 'Sleigh', - 'Snowball', - 'Snowflake', - 'Snowman', - 'Sugarplum', - 'Toy', - 'Tree', - 'Turkey', - 'Wreath', -} - -return Module diff --git a/resources/naughty_words.lua b/resources/naughty_words.lua deleted file mode 100644 index b5890bd3..00000000 --- a/resources/naughty_words.lua +++ /dev/null @@ -1,41 +0,0 @@ -return { - ['ass'] = true, - ['bugger'] = true, - ['butt'] = true, - ['bum'] = true, - ['bummer'] = true, - ['christ'] = true, - ['crikey'] = true, - ['darn'] = true, - ['dam'] = true, - ['damn'] = true, - ['dang'] = true, - ['dagnabit'] = true, - ['dagnabbit'] = true, - ['drat'] = true, - ['fart'] = true, - ['feck'] = true, - ['frack'] = true, - ['freaking'] = true, - ['frick'] = true, - ['gay'] = true, - ['gee'] = true, - ['geez'] = true, - ['git'] = true, - ['god'] = true, - ['golly'] = true, - ['gosh'] = true, - ['heavens'] = true, - ['heck'] = true, - ['hell'] = true, - ['holy'] = true, - ['jerk'] = true, - ['jesus'] = true, - ['petes'] = true, - ["pete's"] = true, - ['poo'] = true, - ['satan'] = true, - ['willy'] = true, - ['wee'] = true, - ['yikes'] = true -} diff --git a/resources/player_colors.lua b/resources/player_colors.lua deleted file mode 100644 index 9b56f480..00000000 --- a/resources/player_colors.lua +++ /dev/null @@ -1,50 +0,0 @@ -return { - ['grilledham'] = { - color = {r = 0.9290000202716064, g = 0.3860000739097595, b = 0.51399999856948853, a = 0.5}, - chat_color = {r = 1, g = 0.51999998092651367, b = 0.63300001621246338, a = 0.5} - }, - ['plague006'] = { - color = {r = 64, g = 224, b = 208, a = 0.5}, - chat_color = {r = 175, g = 238, b = 238, a = 0.5} - }, - ['Linaori'] = { - color = {r = 255, g = 255, b = 0, a = 0.5}, - chat_color = {r = 255, g = 255, b = 0, a = 0.5} - }, - ['Jayefuu'] = { - color = {r = 0.559, g = 0.761, b = 0.157, a = 0.5}, - chat_color = {r = 0.708, g = 0.996, b = 0.134, a = 0.5} - }, - ['robertkruijt'] = { - color = {r = 0.275, g = 0.755, b = 0.712, a = 0.5}, - chat_color = {r = 0.335, g = 0.918, b = 0.866, a = 0.5} - }, - ['der-dave.com'] = { - color = {r = 255, g = 162, b = 0, a = 0.5}, - chat_color = {r = 255, g = 162, b = 0, a = 0.5} - }, - ['chromaddict'] = { - color = {r = 0, g = 1, b = 1, a = 0.5}, - chat_color = {r = 0, g = 1, b = 1, a = 0.5} - }, - ['shoghicp'] = { - color = {a = 0, b = 0.50980395078659058, g = 0, r = 0.29411765933036804}, - chat_color = {a = 0, b = 0.50980395078659058, g = 0, r = 0.29411765933036804} - }, - ['aldldl'] = { - color = {r = 0, g = 0, b = 0, a = 0.5}, - chat_color = {r = 0, g = 127, b = 0, a = 0.5} - }, - ['Raiguard'] = { - color = {a = 1, b = 0.50980395078659058, g = 0.54901963472366333, r = 0.13725490868091583}, - chat_color = {a = 1, b = 0.75490200519561768, g = 0.77450978755950928, r = 0.56862747669219971} - }, - ['ferefang'] = { - color = {a = 1, b = 0, g = 0.024000000208616, r = 0.81499999761581}, - chat_color = {a = 1, b = 0.1410000026226, g = 016599999368191, r = 1} - }, - ['Gerkis'] = { - color = {a = 0.5, b = 0.15700000524520874, g = 0.76099997758865356, r = 0.55900001525878906}, - chat_color = {a = 0.5, b = 0.13400000333786011, g = 0.99599999189376831, r = 0.70800000429153442} - }, -} diff --git a/resources/player_sprites.lua b/resources/player_sprites.lua deleted file mode 100644 index 4977d9fb..00000000 --- a/resources/player_sprites.lua +++ /dev/null @@ -1,54 +0,0 @@ -return { - 'item/iron-axe', - 'item/burner-mining-drill', - 'item/burner-inserter', - 'item/stone-furnace', - 'item/light-armor', - 'item/steam-engine', - 'item/inserter', - 'item/transport-belt', - 'item/underground-belt', - 'item/splitter', - 'item/assembling-machine-1', - 'item/long-handed-inserter', - 'item/electronic-circuit', - 'item/electric-mining-drill', - 'item/heavy-armor', - 'item/steel-furnace', - 'item/steel-axe', - 'item/gun-turret', - 'item/fast-transport-belt', - 'item/fast-underground-belt', - 'item/fast-splitter', - 'item/assembling-machine-2', - 'item/fast-inserter', - 'item/radar', - 'item/filter-inserter', - 'item/defender-capsule', - 'item/pumpjack', - 'item/chemical-plant', - 'item/solar-panel', - 'item/advanced-circuit', - 'item/modular-armor', - 'item/accumulator', - 'item/construction-robot', - 'item/distractor-capsule', - 'item/stack-inserter', - 'item/electric-furnace', - 'item/express-transport-belt', - 'item/express-underground-belt', - 'item/express-splitter', - 'item/assembling-machine-3', - 'item/processing-unit', - 'item/power-armor', - 'item/logistic-robot', - 'item/laser-turret', - 'item/stack-filter-inserter', - 'item/destroyer-capsule', - 'item/power-armor-mk2', - 'item/flamethrower-turret', - 'item/beacon', - 'item/steam-turbine', - 'item/centrifuge', - 'item/nuclear-reactor' -} diff --git a/resources/poke_messages.lua b/resources/poke_messages.lua deleted file mode 100644 index 4b7b835c..00000000 --- a/resources/poke_messages.lua +++ /dev/null @@ -1,402 +0,0 @@ -return { - "a stick", - "a leaf", - "a moldy carrot", - "a crispy slice of bacon", - "a french fry", - "a realistic toygun", - "a broomstick", - "a thirteen inch iron stick", - "a mechanical keyboard", - "a fly fishing cane", - "a selfie stick", - "an oversized fidget spinner", - "a thumb extender", - "a dirty straw", - "a green bean", - "a banana", - "an umbrella", - "grandpa's walking stick", - "live firework", - "a toilet brush", - "a fake hand", - "an undercooked hotdog", - "a slice of yesterday's microwaved pizza", - "bubblegum", - "a biter leg", - "grandma's toothbrush", - "charred octopus", - "a dollhouse bathtub", - "a length of copper wire", - "a decommissioned nuke", - "a smelly trout", - "an unopened can of deodorant", - "a stone brick", - "a half full barrel of lube", - "a half empty barrel of lube", - "an unexploded cannon shell", - "a blasting programmable speaker", - "a not so straight rail", - "a mismatched pipe to ground", - "a surplus box of landmines", - "decommissioned yellow rounds", - "an oily pumpjack shaft", - "a melted plastic bar in the shape of the virgin mary", - "a bottle of watermelon vitamin water", - "a slice of watermelon", - "a stegosaurus tibia", - "a basking musician's clarinet", - "a twig", - "an undisclosed pokey item", - "a childhood trophy everyone else got", - "a dead starfish", - "a titanium toothpick", - "a nail file", - "a stamp collection", - "a bucket of lego", - "a rolled up carpet", - "a rolled up WELCOME doormat", - "Bobby's favorite bone", - "an empty bottle of cheap vodka", - "a tattooing needle", - "a peeled cucumber", - "a stack of cotton candy", - "a signed baseball bat", - "that 5 dollar bill grandma sent for christmas", - "a stack of overdue phone bills", - "the 'relax' section of the white pages", - "a bag of gym clothes which never made it to the washing machine", - "a handful of peanut butter", - "a pheasant's feather", - "a rusty pickaxe", - "a diamond sword", - "the bill of rights of a banana republic", - "one of those giant airport Toblerone's", - "a long handed inserter", - "a wiimote", - "an easter chocolate rabbit", - "a ball of yarn the cat threw up", - "a slightly expired but perfectly edible cheese sandwich", - "conclusive proof of lizard people existence", - "a pen drive full of high res wallpapers", - "a pet hamster", - "an oversized goldfish", - "a one foot extension cord", - "a CD from Walmart's 1 dollar bucket", - "a magic wand", - "a list of disappointed people who believed in you", - "murder exhibit no. 3", - "a paperback copy of 'Great Expectations'", - "a baby biter", - "a little biter fang", - "the latest diet fad", - "a belt that no longer fits you", - "an abandoned pet rock", - "a lava lamp", - "some spirit herbs", - "a box of fish sticks found at the back of the freezer", - "a bowl of tofu rice", - "a bowl of ramen noodles", - "a live lobster!", - "a miniature golf cart", - "dunce cap", - "a fully furnished x-mas tree", - "an orphaned power pole", - "an horphaned power pole", - "an box of overpriced girl scout cookies", - "the cheapest item from the yard sale", - "a Sharpie", - "a glowstick", - "a thick unibrow hair", - "a very detailed map of Kazakhstan", - "the official Factorio installation DVD", - "a Liberal Arts degree", - "a pitcher of Kool-Aid", - "a 1/4 pound vegan burrito", - "a bottle of expensive wine", - "a hamster sized gravestone", - "a counterfeit Cuban cigar", - "an old Nokia phone", - "a huge inferiority complex", - "a dead real state agent", - "a deck of tarot cards", - "unreleased Wikileaks documents", - "a mean-looking garden dwarf", - "the actual mythological OBESE cat", - "a telescope used to spy on the MILF next door", - "a fancy candelabra", - "the comic version of the Kama Sutra", - "an inflatable 'Netflix & chill' doll", - "whatever it is redlabel gets high on", - "Obama's birth certificate", - "a deck of Cards Against Humanity", - "a copy of META MEME HUMOR for Dummies", - "an abandoned not-so-young-anymore puppy", - "one of those useless items advertised on TV", - "a genetic blueprint of a Japanese teen idol", - "yesterday’s jam", - "non-stick honey", - "gluten-free gluten", - "a canister of organic petrol", - "the world's tallest midget", - "an inflammable fire extinguisher", - "a chocolate teapot", - "a dvd rewinder", - "an inflatable dart board", - "a copy of ‘How to read for dummies’", - "an English to Spanish dictionary written entirely in Chinese", - "a camouflage high vis jacket", - "soap that has been dropped in the communal showers", - "a portal to the other side", - "", - "a limited offer, one time only poke", - "the poke-o-matic 4000", - "their finger where the sun doesn’t shine", - "a flogged dead horse", - "a chicken that came before the egg", - "a calculator that can divide by zero", - "a dial up internet connection", - "some stuff they found on the underside of the map", - "a proof that the world is flat", - "a radioactive cockroach", - "the second season of Firefly", - "a non-random random number generator", - "last weeks crash report", - "a pair of two left shoes", - "the meaning of life", - "a map of the London underground", - "an oversized foam hand", - "weight loss pills", - "a deconstruction planner that new players can use", - "a fish that is the same size as a grain of rice", - "a videotape of what they did last Summer", - "a love note from the cute girl sitting behind them", - "a cup of dihydrogen monoxide", - "an external combustion engine", - "a profound sense of optimism", - "a yoghurt past its use by date", - "steel beams that can’t be melted with jet fuel", - "a picture of who really shot JFK", - "footage of the faked Apollo landing", - "some of their holiday photos", - "the password for the server mainframe", - "ʇxǝʇ uʍop ǝpısdn ǝɯos", - "their lost jumper", - "a melted ice cube", - "a box where they keep all their secrets", - "a piece of paper that says ‘You are reading this’", - "a book with the answer to every lateral thinking puzzle that hasn’t been made yet", - "a list of cheat codes for Factorio", - "a lemon that looks and taste like a lime", - "a bible for atheists", - "99 red balloons", - "a biter egg", - "what the cat dragged in", - "a straight banana", - "a clock where all the hours say ‘Party time’", - "some overcooked bacon", - "a copy of a copy of a copy of a cloning machine", - "trademark infringement", - "their undying, unquestionable love", - "an old Nintendo cartridge that only works if you blow on it", - "all their hopes and ambitions condensed into a single action", - "their existential crisis", - "a call for their attention", - "an antimatter version of themselves", - "a left handed tin opener", - "a fireplace poker", - "a parallel universe in which the poking happens the other way round", - "a message in a bottle", - "spaghetti bolognese", - "an active proximity mine", - "their fear of rejection", - "all the effort it takes to press a button in a video game", - "a genuine fake Rolex watch", - "the last digit of Pi", - "the 0.17 patch notes", - "a chest full of landfill", - "a Comcast call centre", - "a 3-10-3 train", - "a train deadlock", - "an incorrectly placed rail signal", - "a desync log", - "'error executing command'", - "a stack overflow", - "Trump’s tax return", - "an ego deflating machine", - "the keys to Redlabel’s gentleman's club", - "a used voodoo doll", - "a cheese grater that has seen better days", - "a bowl of swinger’s car keys", - "a student’s cookbook where all the pages are damp", - "a copy of ‘How to start a cult’ covered in Redlabel’s fingerprints", - "a censored copy of 1984", - "the local orphanage’s ice cream delivery", - "a map to the treasure", - "the clothes they use for cross dressing at the weekend", - "their student loans", - "a cattle prod", - "forbidden love", - "an innocent looking poke, but deep down their heart longs for so much more", - "a rough draft of their new rom-com script", - "a finger covered in whipped cream and an expression that says there is plenty more where that came from", - "an empty toilet roll tube and a look of urgent desperation", - "a kitchen sink that does everything except work as a sink", - "teenage angst", - "sexually repressive parents", - "an overdue pregnant women", - "biter pheromones", - "a mail order bride", - "an unoriginal message", - "a subscription to the magazine ‘Identifying wood’", - "their shopping list", - "the monster that lives under their bed", - "a creaky floorboard", - "an ask for forgiveness", - "suspicious intentions", - "all of their childhood nightmares", - "an expired winning lottery ticket", - "all the trash that’s piling up round back", - "The location where they bury the bodies", - "a fear of trains", - "a piece of blu tack that is covered in hairs", - "a life filled with regret", - "a lifejacket for a child", - "a neglected tamagotchi", - "an obese cat", - "a randomly selected predetermined message", - "a copy of the Kamasutra with some of the pages missing", - "the american dream", - "a fluffy pillow", - "the Spanish Inquisition", - "an addiction to Cracktorio", - "a broken mirror", - "a dismembered hooker", - "a popped balloon", - "a hipster breakfast", - "a nintendo cartridge", - "a generic greething card", - "an empty bottle of barbiturics", - "a cleanup on aisle 4", - "the Eiffel Tower", - "an idea for a poke message", - "Hodor's brain", - "a barn full of mice", - "thousands of wooden chests", - "a deconstruction planner for environment only", - "a blueprint that makes a lag machine", - "a poorly setup Miditorio blueprint", - "their chores", - "a random adjective followed by a random noun", - "the Communist Manifesto for capitalists", - "an uncomputable number", - "a decimal in factorio", - "an old redmew fun fact", - "a poke", - "a cheeto that looks like Abraham Lincoln", - "the lack of hope these messages give", - "recursives with no end condition", - "a player poking a player with a player poking a player with...", - "Ebenezer Scrooge's wallet", - "a hundred dollars paid in pennies", - "a game of paintball in a room filled with mirrors", - "a hunted house running away from a rifle shot", - "a breakfast of bleach and nails", - "the time of day", - "the square root of two", - "two plus two minus one", - "a textbook on elementary calculus in group theory", - "a younger version of themself", - "a grabbing claw", - "a missing comma in code", - "a calculator dividing by zero", - "ultrared ultraviolet light", - "the originality in half of these", - "a collection of Sim's patch notes", - "a game of Dwarf Fortress", - "immense eye strain", - "Ctrl + Alt + F4", - "a match box in a boxing glove", - "a goat with a pen inside", - "the amount of iterations before bogosort sorts 100 objects", - "reddit.com/r/redmew", - "a recording of Seeburg background music", - "an ever-expanding trumpet", - "the current number of poke messages: 556", - "the twelve pokes of pokemas", - "a pokey pokemon", - "a spot in the Boston Marathon", - "an eleven-seven", - "an engineer in a car in a rocket", - "the fact that you can landfill over a pump", - "a fish that swims in land", - "an everything bagel without the bagel", - "the three hundred thirty third poke message", - "a fake holiday", - "poke messages that are useful", - "a recorder sonata", - "a real cannon", - "lorem ipsum dolor sit amet consectetuer adipiscing elit sed diam nonummy nibh euismod tincidunt", - "a handle taped on a handlebar mustache", - "a Rick and Morty copypasta", - "a skip button that skips to the next ad", - "a loading screen that doesn't tell you progress", - "the acceleration of earth's gravity", - "a poke repeated twice", - "a poke repeated twice", - "a sentence intentionnaly mispeeled", - "an overly proud committee", - "a narcissitic history book", - "a fruit more intelligent than cows", - "a pig the size of your pinky", - "a schizophrenic sorting algorithm", - "a dye of rhea", - "a stick the dog brought in", - "the yellow paint on a pencil", - "a flag of surrender", - "their private airstrip", - "a well with a hundred frogs", - "syntax errors", - "a ten foot chin", - "a goldfish that plays jazz", - "a free lettuce", - "a hilarious sock", - "jean skirts", - "a fire hydrant that shoots fire", - "a teethbrush", - "a toothsbrush", - "a belief that caboose plural is cabeese", - "an unidentified flying object", - "a bigfoot sighting", - "their determination", - "the steadily declining quality of these poke messages as I run out of ideas", - "a random generator for these messages", - "a hat made for whales", - "an ice cube on fire", - "a ring that wears you", - "an everyday noun", - "a fun fact", - "the fun fact: there are three other fun fact messages", - "the fun fact: most calico cats are female", - "the fun fact: sloths move about 2.564 times faster than snails", - "the fun fact: there are only two actual fun facts", - "a broken clock in prison", - "a wishing well with more money than you", - "a snake in a hole", - "a colossal toad", - "a pair of shoes for a colossal toad", - "an alarm that sounds like the fire alarm", - "a sponge made out of ice", - "a rude key", - "Hodor", - "a moonwalking horse", - "a horn made out of jello", - "a fine wine negative one year old", - "a six running away from seven", - "an island of cannibals that's sinking", - "a respectful insult", - "a highfalutin retort", - "a rabbit in the briar patch", - "a petition to respell poker as poke her", - "the four hundredth poke message", -} diff --git a/resources/ranks.lua b/resources/ranks.lua deleted file mode 100644 index 977bc9e5..00000000 --- a/resources/ranks.lua +++ /dev/null @@ -1,8 +0,0 @@ --- When adding/removing/changing ranks, rank_system has a migrate_data() function you can use to adjust the existing data. -return { - probation = -10, - guest = 0, - auto_trusted = 10, - regular = 20, - admin = 30, -} diff --git a/resources/tag_groups.lua b/resources/tag_groups.lua deleted file mode 100644 index 527a9bf0..00000000 --- a/resources/tag_groups.lua +++ /dev/null @@ -1,53 +0,0 @@ --- A part of band.lua --- Feel free to edit. - -return { - ['Trooper'] = { - path = 'item/tank', - verb = 'strengthened' - }, - ['Mining'] = { - path = 'item/electric-mining-drill', - verb = 'enriched' - }, - ['Smelting'] = { - path = 'item/stone-furnace', - verb = 'fused' - }, - ['Production'] = { - path = 'item/assembling-machine-2', - verb = 'enhanced' - }, - ['Science'] = { - path = 'item/science-pack-3', - verb = 'advanced' - }, - ['Wizard'] = { - path = 'item/green-wire', - verb = 'combinated' - }, - ['Trains'] = { - path = 'item/locomotive', - verb = 'derailed' - }, - ['Oil'] = { - path = 'fluid/crude-oil', - verb = 'lubricated' - }, - ['Powah!'] = { - path = 'item/steam-engine', - verb = 'electrified' - }, - ['Spaceman'] = { - path = 'item/rocket-silo', - verb = 'warped' - }, - ['Cat'] = { - path = 'item/raw-fish', - verb = 'mewed' - }, - ['Dog'] = { - path = 'entity/medium-biter', - verb = 'woofed' - } -} diff --git a/resources/turkey_messages.lua b/resources/turkey_messages.lua deleted file mode 100644 index 86876ec0..00000000 --- a/resources/turkey_messages.lua +++ /dev/null @@ -1,57 +0,0 @@ -return { - 'Benjamin Franklin wanted the turkey to be the national bird, not the eagle.', - 'There was no turkey on the menu at the first Thanksgiving.', - 'Thanksgiving is the reason for TV dinners!', - 'Wild turkeys can run 20 miles per hour when they are scared.', - 'Female turkeys (called hens) do not gobble.', - 'The real first Thanksgiving was held in Texas in 1541.', - 'Baby turkeys are called poults.', - 'The best way to tell if a cranberry is ripe it to see if it bounces.', - 'Benjamin Franklin wanted the turkey to be the national bird, not the eagle.', - 'There was no turkey on the menu at the first Thanksgiving.', - 'Thanksgiving is the reason for TV dinners!', - 'Wild turkeys can run 20 miles per hour when they are scared.', - 'Female turkeys (called hens) do not gobble.', - 'The real first Thanksgiving was held in Texas in 1541.', - 'Baby turkeys are called poults.', - 'The best way to tell if a cranberry is ripe it to see if it bounces.', - 'There were no forks at the first Thanksgiving. ', - 'Thomas Jefferson refused to declare Thanksgiving as a holiday.', - 'About 46 million turkeys are cooked for Thanksgiving each year.', - 'The Butterball Turkey Talk Line answers almost 100,000 calls each season.', - 'There are four places in the US named Turkey.', - 'Black Friday is the busiest day of the year for plumbers.', - 'Jingle Bells was originally a Thanksgiving song.', - 'Turkey-like creatures roamed the Americas 75 million years ago.', - 'Canadian Thanksgiving predates American Thanksgiving by 43 years.', - 'On average, it takes about 7 hours to cook a Thanksgiving dinner. People spend about 16 minutes eating it.', - 'The first Thanksgiving was held in the autumn of 1621', - 'Why did the turkey cross the road? It was Thanksgiving and he wanted to convince people he was a chicken.', - 'What did the turkey say to the computer? "Google, google, google."', - 'Why did the farmer separate the turkey and the chicken? He sensed fowl play.', - 'What music did the Pilgrims listen to? Plymouth rock.', - 'If Pilgrims were alive today what would they be known for? Their age!', - 'What does Miley Cyrus eat for Thanksgiving? Twerky.', - 'If your great-grandmother saw you making boxed mashed potatoes shed turn over in her gravy.', - 'What does a turkey drink from? A gobble-t.', - 'What smells best at Thanksgiving dinner? Your nose.', - 'Thanksgiving is the only holiday where you eat the mascot.', - 'How do you keep a turkey in suspense? Ill tell you later.', - 'My family told me to stop telling bad Thanksgiving jokes, but I couldnt just quit cold turkey.', - 'What kind of music did the Pilgrims like? Plymouth Rock ', - 'If April showers bring May flowers, what do May flowers bring? Pilgrims ', - 'Why cant you take a turkey to church? They use FOWL language. ', - 'Why was the Thanksgiving soup so expensive? It had 24 carrots. ', - 'What happened when the turkey got into a fight? He got the stuffing knocked out of him! ', - 'What do you get when you cross a turkey with a banjo? A turkey that can pluck itself! ', - 'When do you serve tofu turkey? Pranksgiving. ', - 'What did the turkey say to the man who tried to shoot it? Liberty, Equality and Bad aim for all. ', - 'Who doesnt eat on Thanksgiving? A turkey because it is always stuffed. ', - 'Why did the Pilgrims want to sail to America in the spring? Because April showers bring Mayflowers! ', - 'What did baby corn say to mama corn? Wheres popcorn? ', - 'If the Pilgrims were alive today, what would they be most famous for? Their AGE! ', - 'Why do the pants of pilgrims keep falling down? Because their belt buckles are on their hats! ', - 'Why did they let the turkey join the band? Because he had the drumsticks ', - 'What does Miley Cyrus eat for Thanksgiving? Twerk-ey! ', - 'What did the mother turkey say to her disobedient children? "If your father could see you now, hed turn over in his gravy!" ' -} diff --git a/utils/alien_evolution_progress.lua b/utils/alien_evolution_progress.lua index 343aff82..03c97aa0 100644 --- a/utils/alien_evolution_progress.lua +++ b/utils/alien_evolution_progress.lua @@ -4,9 +4,9 @@ ]] -- dependencies -local Global = require 'utils.global' -local Debug = require 'utils.debug' -local table = require 'utils.table' +local Global = require 'utils.global' --- @dep utils.global +local Debug = require 'utils.debug' --- @dep utils.debug +local table = require 'utils.table' --- @dep utils.table -- localized functions local get_random_weighted = table.get_random_weighted @@ -142,8 +142,8 @@ local function calculate_total(count, spawner, evolution) end ---Creates the spawner_request structure required for AlienEvolutionProgress.get_aliens for all ----available spawners. If dividing the total spawners by the total aliens causes a fraction, the ----fraction will decide a chance to spawn. 1 alien for 2 spawners will have 50% on both. +---available spawner's. If dividing the total spawner's by the total aliens causes a fraction, the +---fraction will decide a chance to spawn. 1 alien for 2 spawner's will have 50% on both. ---@param total_aliens table function AlienEvolutionProgress.create_spawner_request(total_aliens) local per_spawner = total_aliens / memory.spawner_specifications_count diff --git a/utils/command.lua b/utils/command.lua index 5f57110a..692eb285 100644 --- a/utils/command.lua +++ b/utils/command.lua @@ -1,11 +1,11 @@ -local Event = require 'utils.event' -local Game = require 'utils.game' -local Utils = require 'utils.core' -local Timestamp = require 'utils.timestamp' -local Rank = require 'features.rank_system' -local Donator = require 'features.donator' -local Server = require 'features.server' -local Ranks = require 'resources.ranks' +local Event = require 'utils.event' --- @dep utils.event +local Game = require 'utils.game' --- @dep utils.game +local Utils = require 'utils.core' --- @dep utils.core +local Timestamp = require 'utils.timestamp' --- @dep utils.timestamp +local Rank = require 'features.rank_system' --- @dep features.rank_system +local Donator = require 'features.donator' --- @dep features.donator +local Server = require 'features.server' --- @dep features.server +local Ranks = require 'resources.ranks' --- @dep resources.ranks local insert = table.insert local format = string.format @@ -27,7 +27,7 @@ local deprecated_command_alternatives = { local notify_on_commands = { ['version'] = 'RedMew has a version as well, accessible via /redmew-version', - ['color'] = 'RedMew allows color saving and a color randomizer: check out /redmew-color', + ['color'] = 'RedMew allows color saving and a color randomiser: check out /redmew-color', ['ban'] = 'In case your forgot: please remember to include a message on how to appeal a ban' } @@ -35,7 +35,7 @@ local option_names = { ['description'] = 'A description of the command', ['arguments'] = 'A table of arguments, example: {"foo", "bar"} would map the first 2 arguments to foo and bar', ['default_values'] = 'A default value for a given argument when omitted, example: {bar = false}', - ['required_rank'] = 'Set this to determins what rank is required to execute a command', + ['required_rank'] = 'Set this to determines what rank is required to execute a command', ['donator_only'] = 'Set this to true if only donators may execute this command', ['debug_only'] = 'Set this to true if it should be registered when _DEBUG is true', ['cheat_only'] = 'Set this to true if it should be registered when _CHEATS is true', diff --git a/utils/core.lua b/utils/core.lua index 92fc031f..744265b7 100644 --- a/utils/core.lua +++ b/utils/core.lua @@ -1,8 +1,8 @@ --- This file contains core utilities used by the redmew scenario. +--- This file contains core utilities used by the redmew scenario. -- Dependencies -local Game = require 'utils.game' -local Color = require 'resources.color_presets' +local Game = require 'utils.game' --- @dep utils.game +local Color = require 'resources.color_presets' --- @dep resources.color_presets -- localized functions local random = math.random @@ -19,7 +19,7 @@ local hours_to_ticks = 60 * 60 * 60 local ticks_to_minutes = 1 / minutes_to_ticks local ticks_to_hours = 1 / hours_to_ticks --- local vars +-- local variables local Module = {} --- Measures distance between pos1 and pos2 diff --git a/utils/debug.lua b/utils/debug.lua index 1c1a3633..98f85a28 100644 --- a/utils/debug.lua +++ b/utils/debug.lua @@ -31,7 +31,7 @@ end ---Shows the given message if debug is enabled. Uses serpent to print non scalars. -- @param message --- @param stack_traceback levels of stack trace to give, defaults to 1 level if nil +-- @param trace_levels levels of stack trace to give, defaults to 1 level if nil function Debug.print(message, trace_levels) if not _DEBUG then return diff --git a/utils/dump_env.lua b/utils/dump_env.lua index b5cbccac..97f92ff0 100644 --- a/utils/dump_env.lua +++ b/utils/dump_env.lua @@ -1,9 +1,9 @@ --- A small debugging tool that writes the contents of _ENV to a file when the game loads. +--- A small debugging tool that writes the contents of _ENV to a file when the game loads. -- Useful for ensuring you get the same information when loading -- the reference and desync levels in desync reports. -- dependencies -local table = require 'utils.table' -local Event = require 'utils.event' +local table = require 'utils.table' --- @dep utils.table +local Event = require 'utils.event' --- @dep utils.event -- localized functions local inspect = table.inspect diff --git a/utils/event.lua b/utils/event.lua index e183bb2c..d4d3bd85 100644 --- a/utils/event.lua +++ b/utils/event.lua @@ -8,7 +8,7 @@ -- Handlers added with Event.add cannot be removed. -- For handlers that need to be removed or added at runtime use Event.add_removable. -- @usage --- local Event = require 'utils.event' +-- local Event = require 'utils.event' --- @dep utils.event -- Event.add( -- defines.events.on_built_entity, -- function(event) @@ -27,8 +27,8 @@ -- Token is used because it's a desync risk to store closures inside the global table. -- -- @usage --- local Token = require 'utils.token' --- local Event = require 'utils.event' +-- local Token = require 'utils.token' --- @dep utils.token +-- local Event = require 'utils.event' --- @dep utils.event -- -- Token.register must not be called inside an event handler. -- local handler = @@ -55,7 +55,7 @@ -- A closure is a function that uses a local variable not defined in the function. -- -- @usage --- local Event = require 'utils.event' +-- local Event = require 'utils.event' --- @dep utils.event -- -- If you want to remove the handler you will need to keep a reference to it. -- global.handler = function(event) @@ -80,7 +80,7 @@ -- -- ** Custom Scenario Events ** -- --- local Event = require 'utils.event' +-- local Event = require 'utils.event' --- @dep utils.event -- -- local event_id = script.generate_event_name() -- @@ -94,10 +94,10 @@ -- The table contains extra information that you want to pass to the handler. -- script.raise_event(event_id, {extra = 'data'}) -local EventCore = require 'utils.event_core' -local Global = require 'utils.global' -local Token = require 'utils.token' -local Debug = require 'utils.debug' +local EventCore = require 'utils.event_core' --- @dep utils.event_core +local Global = require 'utils.global' --- @dep utils.global +local Token = require 'utils.token' --- @dep utils.token +local Debug = require 'utils.debug' --- @dep utils.debug local table_remove = table.remove local core_add = EventCore.add @@ -140,7 +140,7 @@ local function remove(tbl, handler) return end - -- the handler we are looking for is more likly to be at the back of the array. + -- the handler we are looking for is more likely to be at the back of the array. for i = #tbl, 1, -1 do if tbl[i] == handler then table_remove(tbl, i) @@ -272,11 +272,11 @@ function Event.add_removable_function(event_name, func) ) end - local funcs = function_handlers[event_name] - if not funcs then + local functions = function_handlers[event_name] + if not functions then function_handlers[event_name] = {func} else - funcs[#funcs + 1] = func + functions[#functions + 1] = func end if handlers_added then @@ -293,15 +293,15 @@ function Event.remove_removable_function(event_name, func) if _LIFECYCLE == stage_load then error('cannot call during on_load', 2) end - local funcs = function_handlers[event_name] + local functions = function_handlers[event_name] - if not funcs then + if not functions then return end local handlers = event_handlers[event_name] - remove(funcs, func) + remove(functions, func) remove(handlers, func) if #handlers == 0 then @@ -382,11 +382,11 @@ function Event.add_removable_nth_tick_function(tick, func) ) end - local funcs = function_nth_tick_handlers[tick] - if not funcs then + local functions = function_nth_tick_handlers[tick] + if not functions then function_nth_tick_handlers[tick] = {func} else - funcs[#funcs + 1] = func + functions[#functions + 1] = func end if handlers_added then @@ -403,15 +403,15 @@ function Event.remove_removable_nth_tick_function(tick, func) if _LIFECYCLE == stage_load then error('cannot call during on_load', 2) end - local funcs = function_nth_tick_handlers[tick] + local functions = function_nth_tick_handlers[tick] - if not funcs then + if not functions then return end local handlers = on_nth_tick_event_handlers[tick] - remove(funcs, func) + remove(functions, func) remove(handlers, func) if #handlers == 0 then @@ -427,9 +427,9 @@ local function add_handlers() end end - for event_name, funcs in pairs(function_handlers) do - for i = 1, #funcs do - local handler = funcs[i] + for event_name, functions in pairs(function_handlers) do + for i = 1, #functions do + local handler = functions[i] core_add(event_name, handler) end end @@ -441,9 +441,9 @@ local function add_handlers() end end - for tick, funcs in pairs(function_nth_tick_handlers) do - for i = 1, #funcs do - local handler = funcs[i] + for tick, functions in pairs(function_nth_tick_handlers) do + for i = 1, #functions do + local handler = functions[i] core_on_nth_tick(tick, handler) end end diff --git a/utils/event_core.lua b/utils/event_core.lua index 364e3134..b34715e1 100644 --- a/utils/event_core.lua +++ b/utils/event_core.lua @@ -27,7 +27,7 @@ local function call_handlers(handlers, event) local handler = handlers[i] local success, error = pcall(handler, event) if not success then - log(error) + log('\n\t'..error) end end end diff --git a/utils/game.lua b/utils/game.lua index 54cda4da..946d2420 100644 --- a/utils/game.lua +++ b/utils/game.lua @@ -1,5 +1,5 @@ -local Global = require 'utils.global' -local Color = require 'resources.color_presets' +local Global = require 'utils.global' --- @dep utils.global +local Color = require 'resources.color_presets' --- @dep resources.color_presets local pairs = pairs local Game = {} diff --git a/utils/global.lua b/utils/global.lua index a2689e9a..159c3148 100644 --- a/utils/global.lua +++ b/utils/global.lua @@ -1,5 +1,5 @@ -local Event = require 'utils.event_core' -local Token = require 'utils.token' +local Event = require 'utils.event_core' --- @dep utils.event_core +local Token = require 'utils.token' --- @dep utils.token local Global = {} diff --git a/utils/gui.lua b/utils/gui.lua index 8f1427aa..764037e0 100644 --- a/utils/gui.lua +++ b/utils/gui.lua @@ -1,8 +1,8 @@ -local Token = require 'utils.token' -local Event = require 'utils.event' -local Game = require 'utils.game' -local Global = require 'utils.global' -local mod_gui = require 'mod-gui' +local Token = require 'utils.token' --- @dep utils.token +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 mod_gui = require 'mod-gui' --- @dep mod-gui local Gui = {} @@ -193,7 +193,7 @@ end --- Returns the flow where top elements can be added and will be effected by google visibility -- For the toggle to work it must be registed with Gui.allow_player_to_toggle_top_element_visibility(element_name) -- @tparam LuaPlayer player pointer to the player who has the gui --- @treturn LuaGuiEelement the top element flow +-- @treturn LuaGuiElement the top element flow function Gui.get_top_element_flow(player) player = Game.get_player_from_any(player) return mod_gui.get_button_flow(player) diff --git a/utils/math.lua b/utils/math.lua index 3a4e3652..179005c9 100644 --- a/utils/math.lua +++ b/utils/math.lua @@ -31,15 +31,16 @@ math.clamp = function(num, min, max) end --- Takes two points and calculates the slope of a line --- @param x1, y1 numbers - cordinates of a point on a line --- @param x2, y2 numbers - cordinates of a point on a line +-- @param x1, y1 numbers - coordinates of a point on a line +-- @param x2, y2 numbers - coordinates of a point on a line -- @return number - the slope of the line math.calculate_slope = function(x1, y1, x2, y2) return math.abs((y2 - y1) / (x2 - x1)) end --- Calculates the y-intercept of a line --- @param x, y numbers - coordinates of point on line +-- @param x number - coordinates of point on line +-- @param y number - coordinates of point on line -- @param slope number - the slope of a line -- @return number - the y-intercept of a line math.calculate_y_intercept = function(x, y, slope) diff --git a/utils/player_rewards.lua b/utils/player_rewards.lua index 69da941c..dec49ae7 100644 --- a/utils/player_rewards.lua +++ b/utils/player_rewards.lua @@ -1,8 +1,8 @@ -local Global = require 'utils.global' -local Game = require 'utils.game' -local PlayerStats = require 'features.player_stats' -local Command = require 'utils.command' -local Ranks = require 'resources.ranks' +local Global = require 'utils.global' --- @dep utils.global +local Game = require 'utils.game' --- @dep utils.game +local PlayerStats = require 'features.player_stats' --- @dep features.player_stats +local Command = require 'utils.command' --- @dep utils.command +local Ranks = require 'resources.ranks' --- @dep resources.ranks local format = string.format local abs = math.abs diff --git a/utils/recipe_locker.lua b/utils/recipe_locker.lua index ce754b5b..53d6c59c 100644 --- a/utils/recipe_locker.lua +++ b/utils/recipe_locker.lua @@ -1,6 +1,6 @@ --- A module to prevent recipes from being unlocked by research. Accessed via the public functions. -local Event = require 'utils.event' -local Global = require 'utils.global' +--- A module to prevent recipes from being unlocked by research. Accessed via the public functions. +local Event = require 'utils.event' --- @dep utils.event +local Global = require 'utils.global' --- @dep utils.global local Public = {} diff --git a/utils/redmew_settings.lua b/utils/redmew_settings.lua index 9ddc7971..2e4b0404 100644 --- a/utils/redmew_settings.lua +++ b/utils/redmew_settings.lua @@ -1,4 +1,4 @@ -local Global = require 'utils.global' +local Global = require 'utils.global' --- @dep utils.global local type = type local error = error local tonumber = tonumber @@ -6,7 +6,7 @@ local tostring = tostring local pairs = pairs local format = string.format ---- Contains a set of callables that will attempt to sanitize and transform the input +--- Contains a set of callable that will attempt to sanitize and transform the input local settings_type = { fraction = function (input) input = tonumber(input) @@ -163,7 +163,7 @@ function Public.get(player_index, name) return player_setting ~= nil and player_setting or setting.default end ----Returns a table of all settings for a given player in a key => value setup +---Returns a table of all settings for a given player in a key => value set-up ---@param player_index number function Public.all(player_index) local player_settings = memory[player_index] or {} diff --git a/utils/require_override.lua b/utils/require_override.lua new file mode 100644 index 00000000..06779e59 --- /dev/null +++ b/utils/require_override.lua @@ -0,0 +1,8 @@ +local loaded = _G.package.loaded +local raw_require = require + +function require(path) + return loaded[path] or error('Can only require files at runtime that have been required in the control stage.', 2) +end + +return raw_require \ No newline at end of file diff --git a/utils/state_machine.lua b/utils/state_machine.lua index a3295caf..9d298a52 100644 --- a/utils/state_machine.lua +++ b/utils/state_machine.lua @@ -6,7 +6,7 @@ local Module = {} -local Debug = require 'utils.debug' +local Debug = require 'utils.debug' --- @dep utils.debug local in_state_callbacks = {} local transaction_callbacks = {} @@ -87,8 +87,8 @@ end -- You may register multiple handlers for the same transition -- NOTICE: This function will invoke an error if called after init. Dynamic machine changes are currently unsupported -- @param self StateMachine the machine --- @param state number/string exiting state --- @param state number/string entering state +-- @param old number/string exiting state +-- @param new number/string entering state -- @param callback function function Module.register_transition_callback(self, old, new, callback) if _LIFECYCLE ~= control_stage then diff --git a/utils/table.lua b/utils/table.lua index b828f8a6..4b1973e2 100644 --- a/utils/table.lua +++ b/utils/table.lua @@ -49,7 +49,7 @@ end --- Checks if a table contains an element -- @param t

    -- @param e table element --- @returns the index of the element or nil +-- @return the index of the element or nil function table.index_of(t, e) for k, v in pairs(t) do if v == e then @@ -62,7 +62,7 @@ end --- Checks if the arrayed portion of a table contains an element -- @param t
    -- @param e table element --- @returns the index of the element or nil +-- @return the index of the element or nil function table.index_of_in_array(t, e) for i = 1, #t do if t[i] == e then @@ -76,7 +76,7 @@ local index_of = table.index_of --- Checks if a table contains an element -- @param t
    -- @param e table element --- @returns indicating success +-- @return indicating success function table.contains(t, e) return index_of(t, e) and true or false end @@ -85,7 +85,7 @@ local index_of_in_array = table.index_of_in_array --- Checks if the arrayed portion of a table contains an element -- @param t
    -- @param e table element --- @returns indicating success +-- @return indicating success function table.array_contains(t, e) return index_of_in_array(t, e) and true or false end @@ -128,11 +128,10 @@ end --- Chooses a random entry from a weighted table -- because this uses math.random, it cannot be used outside of events --- @param weight_table
    of tables with items and their weights +-- @param weighted_table
    of tables with items and their weights -- @param item_index of the index of items, defaults to 1 -- @param weight_index of the index of the weights, defaults to 2 -- @return table element --- @see features.chat_triggers::hodor function table.get_random_weighted(weighted_table, item_index, weight_index) local total_weight = 0 item_index = item_index or 1 @@ -156,6 +155,7 @@ end -- because this uses math.random, it cannot be used outside of events if no rng is supplied -- from: http://www.sdknews.com/cross-platform/corona/tutorial-how-to-shuffle-table-items -- @param t
    to shuffle +-- @param rng to provide random numbers function table.shuffle_table(t, rng) local rand = rng or math.random local iterations = #t @@ -238,7 +238,7 @@ require 'util' -- process is a function which allow altering the passed object before transforming it into a string. -- A typical way to use it would be to remove certain values so that they don't appear at all. -- return the prettied table -table.inspect = require 'utils.inspect' +table.inspect = require 'utils.inspect' --- @dep utils.inspect --- Takes a table and returns the number of entries in the table. (Slower than #table, faster than iterating via pairs) table.size = table_size diff --git a/utils/task.lua b/utils/task.lua index a43c3174..6579c77e 100644 --- a/utils/task.lua +++ b/utils/task.lua @@ -1,13 +1,13 @@ --- Threading simulation module +--- Threading simulation module -- Task.sleep() -- @author Valansch and Grilledham -- github: https://github.com/Refactorio/RedMew -- ======================================================= -- -local Queue = require 'utils.queue' -local PriorityQueue = require 'utils.priority_queue' -local Event = require 'utils.event' -local Token = require 'utils.token' +local Queue = require 'utils.queue' --- @dep utils.queue +local PriorityQueue = require 'utils.priority_queue' --- @dep utils.priority_queue +local Event = require 'utils.event' --- @dep utils.event +local Token = require 'utils.token' --- @dep utils.token local Task = {} diff --git a/utils/timestamp.lua b/utils/timestamp.lua index 9af76e5d..3c2eb73e 100644 --- a/utils/timestamp.lua +++ b/utils/timestamp.lua @@ -51,11 +51,11 @@ local function month_length(m, y) end local function day_of_year(day, month, year) - local yday = months_to_days_cumulative[month] + local y_day = months_to_days_cumulative[month] if month > 2 and is_leap(year) then - yday = yday + 1 + y_day = y_day + 1 end - return yday + day + return y_day + day end local function leap_years_since(year) @@ -80,7 +80,7 @@ local function normalise(year, month, day, hour, min, sec) -- Propagate out of range values up -- e.g. if `min` is 70, `hour` increments by 1 and `min` becomes 10 - -- This has to happen for all columns after borrowing, as lower radixes may be pushed out of range + -- This has to happen for all columns after borrowing, as lower radix's may be pushed out of range min, sec = carry(min, sec, 60) -- TODO: consider leap seconds? hour, min = carry(hour, min, 60) day, hour = carry(day, hour, 24) @@ -119,10 +119,10 @@ local function normalise(year, month, day, hour, min, sec) end --- Converts unix epoch timestamp into table {year: number, month: number, day: number, hour: number, min: number, sec: number} --- @param sec unix epoch timestamp +-- @param seconds unix epoch timestamp -- @return {year: number, month: number, day: number, hour: number, min: number, sec: number} -function Public.to_timetable(secs) - return normalise(1970, 1, 1, 0, 0, secs) +function Public.to_timetable(seconds) + return normalise(1970, 1, 1, 0, 0, seconds) end --- Converts timetable into unix epoch timestamp @@ -142,10 +142,10 @@ function Public.from_timetable(timetable) end --- Converts unix epoch timestamp into human readable string. --- @param secs unix epoch timestamp +-- @param seconds unix epoch timestamp -- @return string -function Public.to_string(secs) - local tt = normalise(1970, 1, 1, 0, 0, secs) +function Public.to_string(seconds) + local tt = normalise(1970, 1, 1, 0, 0, seconds) return strformat('%04u-%02u-%02u %02u:%02u:%02d', tt.year, tt.month, tt.day, tt.hour, tt.min, tt.sec) end diff --git a/utils/token.lua b/utils/token.lua index dce270b1..1f374521 100644 --- a/utils/token.lua +++ b/utils/token.lua @@ -4,10 +4,10 @@ local tokens = {} local counter = 0 ---- Assigns a unquie id for the given var. +--- Assigns a unique id for the given var. -- This function cannot be called after on_init() or on_load() has run as that is a desync risk. -- Typically this is used to register functions, so the id can be stored in the global table --- instead of the function. This is becasue closures cannot be safely stored in the global table. +-- instead of the function. This is because closures cannot be safely stored in the global table. -- @param var -- @return number the unique token for the variable. function Token.register(var)