diff --git a/config/action_buttons.lua b/config/action_buttons.lua index f48606d3..5230d5f5 100644 --- a/config/action_buttons.lua +++ b/config/action_buttons.lua @@ -8,7 +8,7 @@ local Roles = require 'expcore.roles' local Store = require 'expcore.store' local Game = require 'utils.game' local Reports = require 'modules.control.reports' -local Warnings = require 'modules.addons.warnings' +local Warnings = require 'modules.control.warnings' local Jail = require 'modules.control.jail' local Colors = require 'resources.color_presets' local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') diff --git a/config/science.lua b/config/science.lua index 3cd3ce5f..f3ee8939 100644 --- a/config/science.lua +++ b/config/science.lua @@ -1,8 +1,8 @@ -- config file for the science info gui 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 + color_clamp=5, -- the amount required for the text to show as green or red + color_flux=0.1, -- the ammount of flucuation allowed in production before icon change 'automation-science-pack', 'logistic-science-pack', 'military-science-pack', diff --git a/doc/config.ld b/doc/config.ld index fdaec597..79ac9eed 100644 --- a/doc/config.ld +++ b/doc/config.ld @@ -5,15 +5,25 @@ title = 'ExpGaming Scenario' description = 'Explosive Gaming\'s server scenario for 0.17' convert_opt = true -sort = true +sort = false not_luadoc = true no_lua_ref = true template_escape = ">" topics = {"../README.md", "../LICENSE"} style = '../doc' template = '../doc' +no_space_before_args = true +new_type("core", "Core", true) +new_type("addon", "Addons", true) +new_type("commands", "Commands", true) +new_type("control", "Control", true) +new_type("gui", "Guis", true) +new_type("config", "Configs", true) + +new_type("dep", "Dependencies", false) 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" diff --git a/doc/control/Jail.html b/doc/control/Jail.html new file mode 100644 index 00000000..d9623087 --- /dev/null +++ b/doc/control/Jail.html @@ -0,0 +1,1169 @@ + + + + +
+ + +Control Module - Jail + - Adds a way to jail players and temp ban players.
+ + + + + + + +
+ -- 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')
+
+
+
+
+
+ | 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 | +
| on_player_jailed | +When a player is assigned to jail | +
| on_player_unjailed | +When a player is unassigned from jail | +
| on_player_temp_banned | +When a player is temp banned | +
| on_player_untemp_banned | +When a temp ban is removed from a player | +
| 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 | +
| 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 | +
Allows moving players into the jail role
+ + + + + + + + + + + + + + + + +Allows accessing a player from any value
+ + + + + + + + + + + + + + + + +Allows storing data in the global table
+ + + + + + + + + + + + + + + + +Use of move_items to clear inventroies
+ + + + + + + + + + + + + + + + + +When a player is assigned to jail
+ + + + Event Parameters: + +When a player is unassigned from jail
+ + + + Event Parameters: + +When a player is temp banned
+ + + + Event Parameters: + +When a temp ban is removed from a player
+ + + + Event Parameters: + +Checks if the player is currently in jail
+ + + + Parameters: + +Moves a player to jail and removes all other roles
+ + + + Parameters: + +Moves a player out of jail and restores all roles previously removed
+ + + + Parameters: + +Checks if a player is temp banned
+ + + + Parameters: + +Temp bans a player by moving them to jail, clearing all other roles, storing the reason, and moving their items to spawn
+ + + + Parameters: + +Rrmoves a player from temp ban by clearing the stored reason, removing them from jail, and restoring previous roles
+ + + + Parameters: + +Control Module - Production + - Common functions used to track production of items
+ + + + + + + +
+ -- 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)
+
+
+
+
+
+ | resources.color_presets | +Provides colors for Production.get_color | +
| util | +Provides format_number function to add surfixs | +
| 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 | +
| 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 | +
| 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 | +
Provides colors for Production.get_color
+ + + + + + + + + + + + + + + + +Provides format_number function to add surfixs
+ + + + + + + + + + + + + + + + + +Gets the next lesser precision index value, eg 1 second -> 1 minute
+ + + + Parameters: + +Gets the next greater precision index value, eg 1 minute -> 1 second
+ + + + Parameters: + +Gets the number of tick that precision is given over, eg 1 minute -> 60 ticks
+ + + + Parameters: + +Returns the production data for the whole game time
+ + + + Parameters: + +Returns the production data for the given precision game time
+ + + + Parameters: + +Returns the current fluctuation from the average
+ + + + Parameters: + +Returns the amount of ticks required to produce a certain amount
+ + + + Parameters: + +Returns the amount of ticks required to consume a certain amount
+ + + + Parameters: + +Returns the amount of ticks required to produce but not consume a certain amount
+ + + + Parameters: + +Returns a color value bassed on the value that was given
+ + + + Parameters: + +Control Module - Reports + - Adds a way to report players and store report messages.
+ + + + + + + +
+ -- 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
+
+
+
+
+
+
+ | utils.game | +Allows getting player from any value | +
| utils.global | +Allows storing of data in global table | +
| on_player_reported | +When a player is reported | +
| on_report_removed | +When a report is removed from a player | +
| 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 | +
| 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 | +
Allows getting player from any value
+ + + + + + + + + + + + + + + + +Allows storing of data in global table
+ + + + + + + + + + + + + + + + + +When a player is reported
+ + + + Event Parameters: + +When a report is removed from a player
+ + + + Event Parameters: + +Gets a list of all reports that a player has against them
+ + + + Parameters: + +Gets a single report against a player given the name of the player who made the report
+ + + + Parameters: + +Checks if a player is reported, option to get if reported by a certain player
+ + + + Parameters: + +Counts the number of reports that a player has aganist them
+ + + + Parameters: + +Adds a report to a player, each player can only report another player once
+ + + + Parameters: + +Removes a report from a player
+ + + + Parameters: + +Control Module - Warnings + - Adds a way to give and remove warnings to players.
+ + + + + + + +
+ -- import the module from the control modules
+ local Warnings = require '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')
+
+
+
+
+
+ | 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 | +
| on_warning_added | +When a warning is added to a player | +
| on_warning_removed | +When a warning is removed from a player | +
| on_script_warning_added | +When a warning is added to a player, by the script | +
| on_script_warning_removed | +When a warning is remnoved from a player, by the script | +
| 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 | +
Allows registering of custom events
+ + + + + + + + + + + + + + + + +Allows getting player from any value
+ + + + + + + + + + + + + + + + +Allows storing in the global table
+ + + + + + + + + + + + + + + + +Config file for this module
+ + + + + + + + + + + + + + + + + +When a warning is added to a player
+ + + + Event Parameters: + +When a warning is removed from a player
+ + + + Event Parameters: + +When a warning is added to a player, by the script
+ + + + Event Parameters: + +When a warning is remnoved from a player, by the script
+ + + + Event Parameters: + +Gets an array of warnings that the player has, always returns a list even if emtpy
+ + + + Parameters: + +Gets the number of warnings that a player has on them
+ + + + Parameters: + +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: + +Removes a warning from a player, always removes the earlyist warning, fifo
+ + + + Parameters: + +Removes all warnings from a player, will trigger remove event for each warning
+ + + + Parameters: + +Gets an array of all the script warnings that a player has
+ + + + Parameters: + +Gets the number of script warnings that a player has on them
+ + + + Parameters: + +Adds a script warning to a player, this may add a full warning if max script warnings is met
+ + + + Parameters: + +Removes a script warning from a player
+ + + + Parameters: + +Removes all script warnings from a player, emits event for each warning removed
+ + + + Parameters: + +| Jail | +Control Module - Jail + - Adds a way to jail players and temp ban players. | +
| Production | +Control Module - Production + - Common functions used to track production of items | +
| Reports | +Control Module - Reports + - Adds a way to report players and store report messages. | +
| Warnings | +Control Module - Warnings + - Adds a way to give and remove warnings to players. | +
| modules.addons.damage-popups | Displays the amount of dmg that is done by players to entities also shows player health when a player is attacked | -
| Jail | -Control Module - Jail - - Adds a way to jail players and temp ban players. | -
| Reports | -Control Module - Reports - - Adds a way to report players and store report messages. | -
| Warnings | -Control Module - Warnings - - Adds a way to give and remove warnings to players. |
| modules.gui.player-list | @@ -380,7 +386,7 @@ generated by LDoc diff --git a/doc/ldoc.ltp b/doc/ldoc.ltp index ca3fc3d2..539ab547 100644 --- a/doc/ldoc.ltp +++ b/doc/ldoc.ltp @@ -73,7 +73,22 @@ > if module then - + + +> if module and module.type ~= "topic" then +> if module and not ldoc.no_summary and #module.items > 0 then + +> end +> end > if not ldoc.no_summary then > local this_mod = module and module.name > for kind, mods, type in ldoc.kinds() do @@ -111,13 +126,15 @@ > end > end - + +> if module and module.type ~= "topic" then +
| 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 | -||
| 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 | -||
| clear_script_warnings (player) | -Removes all script warnings from a player, emits event for each warning removed | -||
| clear_warnings (player, by_player_name) | -Removes all warnings from a player, will trigger remove event for each warning | -||
| count_script_warnings (player) | -Gets the number of script warnings that a player has on them | +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 | ||
| get_warnings (player) | -Gets an array of warnings that the player has, always returns a list even if emtpy | +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 | ||
| remove_warning (player, by_player_name) | -Removes a warning from a player, always removes the earlyist warning, fifo | +clear_script_warnings (player) | +Removes all script warnings from a player, emits event for each warning removed |
When a warning is added to a player, by the script
- - - - Event Parameters: - -When a warning is remnoved from a player, by the script
- - - - Event Parameters: - -When a warning is added to a player, by the script
+ + + + Event Parameters: + +When a warning is remnoved from a player, by the script
+ + + + Event Parameters: + +Adds a script warning to a player, this may add a full warning if max script warnings is met
+Gets an array of warnings that the player has, always returns a list even if emtpy
@@ -631,25 +641,65 @@ (LuaPlayer) - the player to add a script warning to + the player to get the warning for + + + + + + Returns: +Gets the number of warnings that a player has on them
+ + + + Parameters: + +Removes all script warnings from a player, emits event for each warning removed
+Removes a warning from a player, always removes the earlyist warning, fifo
@@ -795,7 +845,23 @@ (LuaPlayer) - the player to clear the script warnings from + the player to remove a warning from + + + + + + + +Gets the number of script warnings that a player has on them
- - - - Parameters: - -Gets the number of warnings that a player has on them
- - - - Parameters: - -Gets an array of warnings that the player has, always returns a list even if emtpy
+Gets the number of script warnings that a player has on them
@@ -1089,7 +1048,7 @@ (LuaPlayer) - the player to get the warning for + the player to count the script warnings of @@ -1102,8 +1061,82 @@ Returns:Adds a script warning to a player, this may add a full warning if max script warnings is met
+ + + + Parameters: + +Removes a warning from a player, always removes the earlyist warning, fifo
+Removes all script warnings from a player, emits event for each warning removed
@@ -1203,23 +1236,7 @@ (LuaPlayer) - the player to remove a warning from - - - - - - - -