fix(simulation): address PR #55 review — stale comment, range, duplication, docs

- Fix protocol version comment (12 → 13) in ObserverSnapshot doc
- Widen Want intensity range from 3..=9 to 1..=10 to match spec and test
- Replace duplicated pool selection in trigger_recognition_monologue with
  call to select_pool_line helper (~50 lines removed)
- Document NaiveSpatialIndex migration cost for grid/quadtree swap
- Remove misleading Default derive from TellCategory (Nervous is not a
  sensible default for neutral NPCs)
- Add caller invariant doc on generate_npc (no TilePosition spawned)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-21 14:55:21 +01:00
co-authored by Claude Opus 4.6
parent c0fb316a0a
commit 67cadddaf2
5 changed files with 21 additions and 51 deletions
+6 -1
View File
@@ -149,7 +149,7 @@ fn pick_combat_style(idx: usize) -> CombatStyle {
fn gen_want(rng: &mut SimRng, role: &RoleDefinition) -> Want {
let kind_idx = rng.rng.random_range(0..9_usize);
let intensity = rng.rng.random_range(3_u8..=9);
let intensity = rng.rng.random_range(1_u8..=10);
Want {
primary: pick_want_kind(kind_idx),
intensity,
@@ -421,6 +421,11 @@ fn gen_skills(rng: &mut SimRng, role: &RoleDefinition) -> (SkillSet, Option<Comb
/// Spawns the entity into `world` with all 10 D-024 axis components.
/// All randomness flows through `rng` — deterministic for a fixed seed (D-010).
///
/// **Caller invariant:** The spawned entity does NOT include `TilePosition`
/// or `ActiveSim`. The caller must place the NPC in the world (add
/// `TilePosition`, register in `EntityRegistry`, and assign a simulation
/// tier) after generation.
///
/// Returns the newly spawned `Entity` ID.
pub fn generate_npc(role: &RoleDefinition, world: &mut World, rng: &mut SimRng) -> Entity {
// Generate all axes before spawning to keep the borrow checker happy.
+1 -2
View File
@@ -35,10 +35,9 @@ use crate::simulation::tier::ActiveSim;
///
/// Derived each tick from NPC simulation state — not authored per NPC.
/// Five categories correspond to the D-024 tell taxonomy.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum TellCategory {
/// NPC exhibits nervous behaviour: Major secret + stress exceeds half of threshold.
#[default]
Nervous,
/// NPC exhibits angry behaviour: low contentment and Hostile mood.
Angry,