Address the second inline review of the features framework

- Feature.register returns the config as a second value, so files
  write `local feature, config = Feature.register(...)`.
- The lib is ExpScenario.Features and the instance class with its
  fields sits on Feature._prototype, which is the __index, the same
  shape as exp_commands.
- update_config only looks at values whose override was added,
  removed, or replaced. _apply_field sets one value and returns it, so
  the comparison happens while applying and the second loop only
  raises. Overrides dropped from the previous set count as candidates
  because the value reverts to its default.
- The `@setting name` tags are gone from the config comments.
- Protection is guarded as a whole instead of checking config.enabled
  in one handler. The handlers also forget mined entities, so
  get_entities and is_entity_protected now drop invalid references,
  which also covers entities destroyed without an event. The list
  getters are gone, the selection overlay builds its lists from
  Protection.config.
- Chat and damage popups are one feature in control/popups.lua.
- ignore_admins and command_admin_only are removed, roles cover them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Fable 5.1 committed 2026-10-03 07:35:58 +00:00
1 parent bff6a1c612
commit f90b8fcee1
21 files changed
+289 -286

No files matched your search

+7 -8
View File
@@ -6,15 +6,14 @@ local Async = require("modules/exp_util/async")
local Feature = require("modules/exp_scenario/features")
local Roles = require("modules/exp_roles")
local Storage = require("modules/exp_util/storage")
local feature = Feature.register("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
active_role_id = Feature.optional("number"), --- @setting active_role_id Players with this role or higher are 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
local feature, config = Feature.register("afk_kick", {
admin_as_active = true, -- When true admins will be treated as active regardless of afk time
trust_as_active = true, -- When true trusted players (by playtime) will be treated as active regardless of afk time
active_role_id = Feature.optional("number"), -- Players with this role or higher are treated as active regardless of afk time
afk_minutes = 10, -- The time in minutes that must pass for a player to be considered afk
kick_minutes = 30, -- The time in minutes that must pass without any active players for all players to be kicked
trust_minutes = 600, -- The time in minutes that a player must be online for to count as trusted
})
local config = feature.config
local ticks_per_minute = 3600