Files
factorio-scenario-ExpCluster/exp_legacy/module/config/warnings.lua
T
bbassieandClaude Opus 5 f39da0c585 Type the last of the forward declarations
Locals declared ahead of an assignment inside a callback were inferred
as nil at every use site.

The role event handlers are given a class so the table is not unified
with the other module handler tables.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:18 +00:00

39 lines
2.2 KiB
Lua

--- 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 {
--- @type (LocalisedString[] | fun(player: LuaPlayer, by_player_name: string, number_of_warnings: number))[]
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", "" },
{ "warnings.received", { "warnings.pre-kick" } },
function(player, by_player_name, number_of_warnings)
local str = {
"You received a warning from ",
by_player_name,
". You have ",
number_of_warnings,
" warnings. You were kicked for having too many warnings; you may rejoin if you wish.",
}
game.kick_player(player, table.concat(str, "")) -- Does not support locale strings
-- game.kick_player(player, { "warnings.received", by_player_name, number_of_warnings, { "warnings.kick" } })
end,
{ "warnings.received", { "warnings.pre-pre-ban" } },
{ "warnings.received", { "warnings.pre-ban" } },
function(player, by_player_name, number_of_warnings)
local str = {
"You received a warning from ",
by_player_name,
". You have ",
number_of_warnings,
" warnings. You were banned for having too many warnings; visit https://www.explosivegaming.nl to request a ban appeal.",
}
game.kick_player(player, table.concat(str, "")) -- Does not support locale strings
-- game.ban_player(player, { "warnings.received", by_player_name, number_of_warnings, { "warnings.ban", { "links.website" } } })
end,
},
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
}