feat: index loaded resource discovery

This commit is contained in:
Rijad Zuzo
2026-07-17 00:34:30 +02:00
parent 2c88ed6ea8
commit 5356c34fd7
21 changed files with 1392 additions and 69 deletions
+19 -12
View File
@@ -47,6 +47,10 @@ SimulationManager tick
- reads target metadata from ActionDefinition;
- consumes active-world facts through ActiveWorldAdapter;
- expands resource queries through nearby grid ranges and prunes farther cells
only when authoritative risk/comfort/priority bounds prove they cannot win;
- preserves the former registration-order tie behavior and keeps a linear
compatibility path for isolated adapters;
- checks simulation-owned ResourceStateRecord availability;
- reserves and returns stable resource target IDs;
- skips full-capacity activity sites based on authoritative NPC target claims;
@@ -55,7 +59,10 @@ SimulationManager tick
### ActiveWorldAdapter
- exposes loaded resource interaction positions;
- owns the disposable `LoadedResourceSpatialIndex` of loaded stable-ID resource
interaction positions;
- refreshes the index as ResourceNodes enter, leave, rebind authoritative
state, or move;
- exposes loaded storage and activity-site interaction positions;
- exposes activity-site capacity as an active-world fact;
- contains active-world query facts, not persistent mutable authority;
@@ -77,17 +84,17 @@ targets, and translates presentation callbacks into simulation transitions.
It also owns one disposable `SimulationPopulationView`, rebuilt at tick start
and refreshed after each NPC advances so interleaved decision semantics remain
unchanged.
The manager publishes the latest `ActionSelectionResult` for presentation; the UI
does not recompute decisions. Each idle selection re-derives the capable helper
instead of consulting persisted assignment state. At completion it atomically
pays any definition-backed stored-resource cost before applying the action
effect. A late shortfall suppresses the effect and records a `task_blocked`
fact. The manager also captures actor/nearby knowledge before forwarding newly
recorded events into `RelationshipSystem`. When an NPC arrives beside a worker
at the same non-storage activity site, the manager may transfer one direct
known fact and applies its consequence only to that newly informed listener. An
open opportunity's exact trigger receives bounded priority in that conversation
before normal lasting/recent ranking. It exposes
The manager publishes the latest `ActionSelectionResult` for presentation; the
UI does not recompute decisions. Each idle selection re-derives the capable
helper instead of consulting persisted assignment state. At completion it
atomically pays any definition-backed stored-resource cost before applying the
action effect. A late shortfall suppresses the effect and records a
`task_blocked` fact. The manager also captures actor/nearby knowledge before
forwarding newly recorded events into `RelationshipSystem`. When an NPC arrives
beside a worker at the same non-storage activity site, the manager may transfer
one direct known fact and applies its consequence only to that newly informed
listener. An open opportunity's exact trigger receives bounded priority in
that conversation before normal lasting/recent ranking. It exposes
knowledge, provenance, relationship, and cause queries without moving social
authority into UI. After consequences are known, it protects current causal
facts, enforces the recent-memory cap, and runs age review from authoritative