From c8c0bba86084dc5de471d937ba2c6990fd4c14e7 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 21 Jun 2019 22:54:12 +0100 Subject: [PATCH] Moved jail to control --- config/action_buttons.lua | 8 +- doc/index.html | 7 +- doc/modules/Jail.html | 1010 +++++++++++++++++ doc/modules/Reports.html | 9 +- doc/modules/config._file_loader.html | 3 +- doc/modules/config.action_buttons.html | 3 +- doc/modules/config.advanced_start.html | 3 +- doc/modules/config.bonuses.html | 3 +- doc/modules/config.chat_reply.html | 3 +- doc/modules/config.death_logger.html | 3 +- doc/modules/config.discord_alerts.html | 3 +- .../config.expcore-commands.auth_admin.html | 3 +- .../config.expcore-commands.auth_roles.html | 3 +- ...expcore-commands.auth_runtime_disable.html | 3 +- ...config.expcore-commands.parse_general.html | 3 +- .../config.expcore-commands.parse_roles.html | 3 +- doc/modules/config.permission_groups.html | 3 +- doc/modules/config.popup_messages.html | 3 +- doc/modules/config.rockets.html | 3 +- doc/modules/config.roles.html | 3 +- doc/modules/config.scorched_earth.html | 3 +- doc/modules/config.spawn_area.html | 3 +- doc/modules/config.warnings.html | 3 +- doc/modules/config.warps.html | 3 +- doc/modules/control.html | 3 +- doc/modules/expcore.commands.html | 3 +- doc/modules/expcore.common.html | 3 +- doc/modules/expcore.gui.concepts.center.html | 3 +- doc/modules/expcore.gui.concepts.left.html | 3 +- doc/modules/expcore.gui.concepts.popups.html | 3 +- doc/modules/expcore.gui.concepts.toolbar.html | 3 +- doc/modules/expcore.gui.core.html | 3 +- doc/modules/expcore.gui.elements.buttons.html | 3 +- .../expcore.gui.elements.checkboxs.html | 3 +- .../expcore.gui.elements.dropdown.html | 3 +- .../expcore.gui.elements.elem-button.html | 3 +- .../expcore.gui.elements.progress-bar.html | 3 +- doc/modules/expcore.gui.elements.slider.html | 3 +- doc/modules/expcore.gui.elements.text.html | 3 +- doc/modules/expcore.gui.html | 3 +- doc/modules/expcore.gui.instances.html | 3 +- doc/modules/expcore.gui.prototype.html | 3 +- doc/modules/expcore.gui.test.html | 3 +- doc/modules/expcore.permission_groups.html | 3 +- doc/modules/expcore.roles.html | 3 +- doc/modules/expcore.store.html | 3 +- doc/modules/expcore.sudo.html | 3 +- .../modules.addons.advanced-start.html | 3 +- doc/modules/modules.addons.chat-popups.html | 3 +- doc/modules/modules.addons.damage-popups.html | 3 +- doc/modules/modules.gui.player-list.html | 3 +- doc/modules/modules.gui.rocket-info.html | 3 +- doc/modules/modules.gui.science-info.html | 3 +- doc/modules/modules.gui.task-list.html | 3 +- .../utils.alien_evolution_progress.html | 3 +- doc/modules/utils.core.html | 3 +- doc/modules/utils.debug.html | 3 +- doc/modules/utils.event.html | 3 +- doc/modules/utils.event_core.html | 3 +- doc/modules/utils.math.html | 3 +- doc/modules/utils.recipe_locker.html | 3 +- doc/modules/utils.state_machine.html | 3 +- doc/modules/utils.table.html | 3 +- doc/modules/utils.task.html | 3 +- doc/modules/utils.timestamp.html | 3 +- doc/topics/license.html | 3 +- doc/topics/readme.md.html | 3 +- modules/commands/jail.lua | 10 +- modules/control/jail.lua | 209 ++++ modules/control/reports.lua | 4 +- 70 files changed, 1367 insertions(+), 79 deletions(-) create mode 100644 doc/modules/Jail.html create mode 100644 modules/control/jail.lua diff --git a/config/action_buttons.lua b/config/action_buttons.lua index 9bf8de57..4e821e1f 100644 --- a/config/action_buttons.lua +++ b/config/action_buttons.lua @@ -9,7 +9,7 @@ local Store = require 'expcore.store' local Game = require 'utils.game' local Reports = require 'modules.control.reports' local Warnings = require 'modules.addons.warnings-control' -local Jail = require 'modules.addons.jail-control' +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') @@ -146,7 +146,7 @@ Gui.new_button() :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 + if Jail.is_jailed(action_player_name) then player.print({'expcom-jail.already-jailed',action_player_name_color},Colors.orange_red) else Store.set(action_name_store,player.name,'command/jail') @@ -157,7 +157,7 @@ local function jail_player_callback(player,reason) local action_player_name,action_player_name_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) + Jail.jail_player(action_player_name,player.name,reason) end -- temp bans the action player, requires a reason @@ -168,7 +168,7 @@ Gui.new_button() :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 + if Jail.is_jailed(action_player_name) then player.print({'expcom-jail.already-banned',action_player_name_color},Colors.orange_red) else Store.set(action_name_store,player.name,'command/temp-ban') diff --git a/doc/index.html b/doc/index.html index 36d76e1a..13ec6e62 100644 --- a/doc/index.html +++ b/doc/index.html @@ -274,6 +274,11 @@ 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 @@ -370,7 +375,7 @@ generated by LDoc diff --git a/doc/modules/Jail.html b/doc/modules/Jail.html new file mode 100644 index 00000000..5af00326 --- /dev/null +++ b/doc/modules/Jail.html @@ -0,0 +1,1010 @@ + + + + + + + + Jail module + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Jail module

+

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

+

+ + + + + + +

Usage

+

+    -- 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')
+ + + + + + + +

Events

+ + + + + + + + + + + + + + + + + + + + +
on_player_jailedWhen a player is assigned to jail
on_player_temp_bannedWhen a player is temp banned
on_player_unjailedWhen a player is unassigned from jail
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
+ + +
+ + +

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_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_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_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/doc/modules/Reports.html b/doc/modules/Reports.html index f22beb2f..291c812f 100644 --- a/doc/modules/Reports.html +++ b/doc/modules/Reports.html @@ -40,6 +40,7 @@