Cover guis, commands, and intervals in the features framework

Review feedback from Cooldude on the first version.

Features.register is renamed to Features.config, and guard also takes a
feature name so a feature without settings needs no config call.
Autofill uses this. Small configs now live at the top of the file that
uses them: death markers, mine depletion, station auto name, and
lawnmower. AFK kick and chat auto reply keep separate files because
they contain functions.

Periods no longer need a restart. A lib can list intervals, which map a
config key to a handler that runs every config[key] seconds. They are
checked once a second with a stateless tick check. AFK kick and death
markers use this and expose their periods on the page.

Guis: receive_update raises on_feature_changed, and control/features.lua
refreshes every player's gui when it fires. Autofill's toolbar button
checks Features.is_enabled, and hiding the button also hides its left
element. Quick actions refresh on the event too.

Commands: add_flags{ feature = ... } ties a command to a feature, and a
new authority denies it while the feature is disabled. The custom help
and quick actions already leave out denied commands. Lawnmower uses this
and is now added as a lib, so its destroy_decoratives handlers are
actually registered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-09-28 18:43:31 +00:00
1 parent 88358b23b9
commit 69e9f172a3
21 files changed
+304 -116

No files matched your search

+2 -2
View File
@@ -4,13 +4,13 @@
local Features = require("modules/exp_scenario/features")
local Roles = require("modules/exp_roles")
return Features.register("afk_kick", {
return Features.config("afk_kick", {
admin_as_active = true, --- @setting admin_as_active When true admins will be treated as active regardless of afk time
trust_as_active = true, --- @setting trust_as_active When true trusted players (by playtime) will be treated as active regardless of afk time
afk_minutes = 10, --- @setting afk_minutes The time in minutes that must pass for a player to be considered afk
kick_minutes = 30, --- @setting kick_minutes The time in minutes that must pass without any active players for all players to be kicked
trust_minutes = 600, --- @setting trust_minutes The time in minutes that a player must be online for to count as trusted
update_time = 3600 * 30, --- @setting update_time How often in ticks the script checks for active players, needs a restart to change
update_seconds = 1800, --- @setting update_seconds How often in seconds the script checks for active players
custom_active_check = function(player)
local veteran = Roles.get_role_by_name("Veteran")
return veteran ~= nil and not Roles.get_player_highest_role(player):is_lower_than(veteran)
@@ -25,7 +25,7 @@ local afk_time_units = {
seconds = true,
}
return Features.register("chat_auto_reply", {
return Features.config("chat_auto_reply", {
--- @type table<string, LocalisedString | fun(player: LuaPlayer, is_command: boolean): LocalisedString>
messages = { --- @setting messages will trigger when ever the word is said
["discord"] = { "info.discord", config_server_detail["discord"] },
@@ -1,15 +0,0 @@
--- This config controls what happens when a player dies mostly about map markers and item collection
-- @config Death-Markers
local Features = require("modules/exp_scenario/features")
return Features.register("death_markers", {
collect_corpses = true, --- @setting collect_corpses 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
clean_map_markers = false, --- @setting clean_map_markers removes the map marker once the body is gone
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
show_light_at_corpse = true, --- @setting show_light_at_corpse if a light should be rendered at the corpse
show_line_to_corpse = true, --- @setting show_line_to_corpse if a line should be rendered from you to your corpse
period_check_map_tags = 60 * 60 * 5, --- @setting period_check_map_tags ticks between checks for missing map markers, needs a restart to change
})
@@ -1,10 +0,0 @@
--- Settings for mine depletion
-- @config Mine-Depletion
local Features = require("modules/exp_scenario/features")
return Features.register("mine_depletion", {
fluid = true, --- @setting fluid When true, checks for for fluid pipes when removing miners
chest = true, --- @setting chest When true, checks for for chest when removing miners
beacon = true, --- @setting beacon When true, checks for for beacon when removing miners
})
@@ -1,16 +0,0 @@
--- Settings for naming train stations when they are built
-- @config Station-Auto-Name
local Features = require("modules/exp_scenario/features")
return Features.register("station_auto_name", {
--[[
__icon__
__item_name__
__backer_name__
__direction__
__x__
__y__
]]
station_name = "[L] __icon__", --- @setting station_name the name given to new stations, uses the placeholders above
})