feat: unify authored activity commands

This commit is contained in:
Rijad Zuzo
2026-08-13 00:08:30 +02:00
parent e5aecee0de
commit b3b98c6456
36 changed files with 3013 additions and 96 deletions
+26 -1
View File
@@ -9,7 +9,8 @@ state, systems, world adapters, scenes, tests, and save migrations.
IDs. `SimulationContentPack` is the no-code authoring manifest and
`ContentCatalog` transactionally validates and publishes typed definitions in
stable-ID order. The current core pack contains actions, professions,
capability tags, items, resources, storage policies, and enemies. A failed pack
capability tags, items, resources, storage policies, enemies, animals,
situations, dialogue, event types, and social consequences. A failed pack
publishes nothing: duplicate IDs, unknown references, unsupported handlers, or
missing presentation cues are authoring errors rather than silent overrides.
@@ -57,6 +58,30 @@ are copy-only values. `ActionCommandService` is the authority boundary and must
revalidate range, capabilities, reservation, permission, cost, and target state
at execution time for either a player or NPC caller.
`activity_metric_delta` is the first concrete shared command handler. Patrol
and study targets publish capabilities through the context-owned
`WorldTargetRegistry`; player offers carry the current state revision, target
generation, context ID, and registry-instance identity. The command revalidates
all four, the live provider, actor availability, target kind, capability, and
interaction range, then atomically consumes the authored cost, applies the
bounded real metric delta, and records one `activity_completed` fact. Registry
identity prevents an old offer from matching a replacement target whose local
generation restarted. NPC completion submits the same command and must match
the NPC's authoritative current action, target, and work state. Unloaded NPC
work may use an explicitly registered simulation-owned activity target, but it
never invents a missing target or treats presentation position as travel
authority. A failed cost check records and returns the exact ordinary
`task_blocked` fact; a capped metric consumes nothing and records no false
completion. The completion fact keeps the first event ID while synchronous
situation or commitment consequences may append a deterministic causal suffix;
the command result reports the final revision rather than misclassifying that
valid event chain as failure.
The catalog validates this handler as a closed typed contract: an activity
target, exactly one positive `metric_delta` effect for safety or knowledge,
typed optional player/NPC modifiers, a known completion event, and a cost item
with an authored storage route. A malformed additive pack publishes nothing.
The current actions are gather food, gather wood, feed animal, deposit food,
deposit wood, withdraw food, patrol, study, eat, rest, sleep, wander, and
defend. Idle and dead are state sentinels, not executable definitions. The