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

+41 -2
View File
@@ -1,8 +1,9 @@
/**
* The scenario features which can be configured from the web interface.
*
* Defaults must match module/config/<name>.lua, test/features.test.js checks
* this. Only list settings which the lua side reads at runtime.
* Defaults must match the Features.config call in the lua module,
* test/features.test.js checks this. Only list settings which the lua side
* reads at runtime.
*/
export type FeatureValue = boolean | number | string;
@@ -71,8 +72,23 @@ export const features: Feature[] = [
min: 0,
unit: "minutes",
},
{
name: "update_seconds",
title: "Check every",
description: "How often to check for active players",
type: "number",
default: 1800,
min: 1,
unit: "seconds",
},
],
},
{
name: "autofill",
title: "Autofill",
description: "Fill ammo and fuel into entities when they are built, configured by each player from the toolbar",
fields: [],
},
{
name: "chat_auto_reply",
title: "Chat Auto Reply",
@@ -141,6 +157,29 @@ export const features: Feature[] = [
type: "boolean",
default: true,
},
{
name: "check_map_tags_seconds",
title: "Check map markers every",
description: "How often to replace map markers which were removed",
type: "number",
default: 300,
min: 1,
unit: "seconds",
},
],
},
{
name: "lawnmower",
title: "Lawnmower",
description: "The /lawnmower command which clears corpses and nuclear ground",
fields: [
{
name: "destroy_decoratives",
title: "Clear decoratives when building",
description: "Remove decoratives under entities when they are built",
type: "boolean",
default: false,
},
],
},
{