Skip to content

Generated reference. This page mirrors Code/Crime/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.

Crime

Purpose. Warrants and arrest — the mechanism half of the justice system, built to be policed by whatever module plugs into its gate events. See 17_CRIME_FRAMEWORK.md.

Responsibilities. - WarrantClassSearch/Arrest. - WarrantIssuing / CharacterArresting — the gate events (CancellableEvent), published before acting. No default subscriber is registered — see 17_CRIME_FRAMEWORK.md §1. - ICrimeService / CrimeStore — the mechanism itself: IssueWarrantAsync, RevokeWarrantAsync, GetActiveWarrant, ArrestAsync, IsCurrentlyArrested. CrimeStore is the one implementation. - Persisted absolute expiry for both warrants and arrest — the direct fix for legacy's "warrants die on restart" and "arrest restarts its full duration on reconnect" defects. - Weapon confiscation on arrest, via IInventoryService/IItemRegistry — the one place this module reaches into Inventory.

Not responsible for. - Non-lethal force (knockout, tying), bleeding — need ragdoll/pawn physics or a Health system, neither of which exists in this codebase. - Incapacitate's speed effect, StripAmmo, the flashlight, jail teleport, auto-release Spawn() — need Movement, a held-weapon/ammo system, a flashlight system, or a Transform/position system. - A command entry point for /warrant//unwarrant//arrest. Every one targets another connected player, and there is no way anywhere in this codebase to resolve "the connected character named X" without the wrong side effects. See 17_CRIME_FRAMEWORK.md §4. - Lockpicking, contraband — need a lockable door (World) or a world-entity type, neither built. - The policy layer ("who may police whom") — the gate events exist; nothing subscribes to them yet. Deliberately.

Dependencies. Core (IServiceRegistry, IServiceResolver, IEventBus, IGameLog, IClock, IPersistenceBackend, ISchemaRegistry), Character (CharacterId, Character), Items (ItemCategory, for identifying weapons), Inventory (CharacterInventoryHolder, IInventoryService, for confiscation).

Public API. - ICrimeServiceLoadOrCreateAsync(CharacterId), GetActiveWarrant(CharacterId), IssueWarrantAsync(Character, CharacterId, WarrantClass, TimeSpan), RevokeWarrantAsync(Character, CharacterId), IsCurrentlyArrested(CharacterId), ArrestAsync(Character, Character, TimeSpan). - WarrantClass, WarrantIssuing, CharacterArresting.

Events published. WarrantIssuing, CharacterArresting (both cancellable).

Persistence. CrimeDocument { CharacterId, WarrantClass?, WarrantExpiresAtUtc?, IsArrested, ArrestReleaseAtUtc? } under crime/{characterId}, schema version 1.

Future improvements. - A policy module subscribing to WarrantIssuing/CharacterArresting (an "officials" equivalent, checking a job or permission). - A command entry point, once target-resolution-by-name exists anywhere in this codebase. - Non-lethal force, bleeding, jail teleport, ammo/flashlight confiscation, once Movement and Health exist. - Lockpicking, once World's locks exist. Contraband, once a world-entity type for it exists.