Move jail into exp_scenario

With the role system finished the jail module has nothing legacy left in
it, so it moves to exp_scenario/module/control/jail.lua and the copy in
exp_legacy is removed. The module takes LuaPlayer only, requires a reason,
returns false rather than nil when there is nothing to do, and exposes its
event ids as Jail.on_player_jailed and Jail.on_player_unjailed in the same
shape as exp_util's selection events.
This commit is contained in:
bbassie
2026-09-05 19:18:04 +00:00
parent 810269971b
commit 2e53e4668d
7 changed files with 98 additions and 128 deletions
@@ -10,7 +10,7 @@ local Gui = require("modules/exp_gui")
local Roles = require("modules/exp_roles")
local Reports = require("modules.exp_legacy.modules.control.reports") --- @dep modules.control.reports
local Warnings = require("modules.exp_legacy.modules.control.warnings") --- @dep modules.control.warnings
local Jail = require("modules.exp_legacy.modules.control.jail") --- @dep modules.control.jail
local Jail = require("modules/exp_scenario/control/jail")
local Colors = require("modules/exp_util/include/color")
local format_player_name = ExpUtil.format_player_name_locale
@@ -119,7 +119,7 @@ end
local jail_player = new_button("utility/multiplayer_waiting_icon", { "exp-gui_player-list.jail-player" })
:on_click(function(def, player, element)
local selected_player, selected_player_color = get_action_player(player)
if Jail.is_jailed(selected_player.name) then
if Jail.is_jailed(selected_player) then
player.print({ "exp-commands_jail.already-jailed", selected_player_color }, Colors.orange_red)
else
set_selected_action(player, "exp_scenario.command.jail")
@@ -130,7 +130,7 @@ local function jail_player_callback(player, reason)
local selected_player, selected_player_color = get_action_player(player)
local by_player_name_color = format_player_name(player)
game.print{ "exp-commands_jail.jailed", selected_player_color, by_player_name_color, reason }
Jail.jail_player(selected_player.name, player.name, reason)
Jail.jail_player(selected_player, player.name, reason)
end
--- Kicks the action player, requires a reason