Skip to content

Generated reference. This page mirrors Code/Law/README.md, this module's source-of-truth documentation (Standards/02_DOCUMENTATION_STANDARDS.md §1). Edit it there, not here -- this file is regenerated on every docs build and any local edit is silently overwritten.

Law

Purpose. The ten-laws noticeboard — deliberately, provably inert. See 18_LAW_FRAMEWORK.md.

Responsibilities. - ILawService / LawStore — ten fixed text slots, one global document (not per-character): GetLaws, SetLawAsync. LawStore is the one implementation. - Access via PermissionSet ("law.edit"), not a job-specific check. - A 120-second cooldown between edits, via IClock and an absolute timestamp. - /laws (view) and /setlaw <index> <text...> (edit) — Law's own first real commands. - LawsTab (Code/Law/Ui/LawsTab.razor, Milestone 11) — the player menu's Laws tab (24_PLAYER_MENU.md §6). Reads GetLaws() directly, host-side only, and fires the existing /setlaw through CommandDispatchComponent (resolved via Applejack.Movement.LocalPawn, same as CharacterNetworkComponent) — no new backend surface. NOT registered against IMenuRegistry -- it's a PanelComponent, and that registry only accepts TPanel : Panel, new(). Its composition into PlayerMenu is a still-open question — see Code/Ui/README.md's "Panel-vs-PanelComponent" entry.

Not responsible for. - Enforcing a law's text as a mechanism. Nothing reads the laws at runtime; they exist for players to point at and argue about, per Legacy/06_CRIME_AND_POLICE.md §7. If a rule needs enforcing, that's a permission check or an event subscriber written directly against it — never a string comparison against noticeboard text. - Deciding who "the Mayor" is. Editing is gated by a plain permission, not a job lookup — Law does not depend on Jobs.

Dependencies. Core (IServiceRegistry, IServiceResolver, IGameLog, IClock, IPersistenceBackend, ISchemaRegistry), Character (Character.HasPermission), Commands (ICommandRegistry, for /laws//setlaw's registration). LawsTab.razor itself depends on Movement (LocalPawn), not LawModule.

Public API. - ILawServiceLoadOrCreateAsync(), GetLaws(), SetLawAsync(Character, int, string). - LawsTab — the player menu tab; not called directly by anything outside IMenuRegistry's own instantiation.

Events published. None — the laws are read data, not a trigger for anything.

Persistence. LawsDocument { Laws: string?[10], NextEditAllowedAtUtc } under law/server, schema version 1 — one document per server, following Code/Bulletin/README.md's identical single-document precedent.

Future improvements. - None currently named — this module is deliberately as small as its own specification.