fix(simulation): PR #66 review — dedup vision, spawn components, doc fixes

- vision.rs: deduplicate own-tile entity iteration, add same-tile test
- spawn.rs: add NpcVisionState, NpcMemory, PlayerAwareness to content-
  spawned NPCs (matching generate_npc)
- pressure.rs: update who_knows_full_scan doc to reflect actual call
  frequency, document O(N) acceptability at call site
- types.rs: fix stale protocol version comment (13→14)
- generate.rs: format!() → .to_string() (clippy)
- vision.rs: hardcoded 10 → TICKS_PER_GAME_MINUTE
- relationships.rs: fix comment "15%" → "20%" to match code
- pressure.rs: document total() floor-truncation
- save_state.rs: document NpcMemory exclusion as intentional

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-25 10:04:18 +01:00
co-authored by Claude Opus 4.6
parent abd1657d94
commit 768a431c38
8 changed files with 81 additions and 13 deletions
+3 -3
View File
@@ -141,7 +141,8 @@ impl RelationshipGraph {
}
/// Get all entities who have feelings about a target.
/// O(N) full scan of all edges — use for event detection, not per-tick queries.
/// O(N) full scan of all edges. Called once per game-minute (every 10 ticks)
/// by the pressure system — acceptable at v0.1 NPC counts.
pub fn who_knows_full_scan(&self, target: &StableId) -> Vec<(&StableId, &RelationshipEdge)> {
self.edges
.iter()
@@ -292,8 +293,7 @@ impl DelayedTrustQueue {
/// (D-010: integer-only determinism). Returns 0 when the scaled value would
/// round to zero — small deltas naturally attenuate to nothing.
///
/// Factor is expressed in tenths (e.g. 4 = 40%, 2 = 15%... using 2/10=20%
/// as closest deterministic integer approximation of 15%).
/// Factor is expressed in tenths (e.g. 4 = 40%, 2 = 20%).
///
/// Rounding: away from zero (ceiling of abs value, preserving sign).
fn scale_delta(delta: i8, factor_tenths: i8) -> i8 {