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:
@@ -33,6 +33,16 @@ pub trait SpatialIndex: Send + Sync {
|
||||
/// Replace with grid or quadtree when profiling shows this is a bottleneck.
|
||||
/// Deterministic iteration: entries stored in insertion order, but callers
|
||||
/// should not depend on ordering (sort by Entity::to_bits() if needed).
|
||||
///
|
||||
/// ## Migration cost for grid/quadtree swap
|
||||
///
|
||||
/// `sync_spatial_index` takes `ResMut<NaiveSpatialIndex>` directly because
|
||||
/// bevy_ecs cannot store `dyn SpatialIndex` as a Resource. A swap to Grid or
|
||||
/// BVH requires changing the concrete type in: (1) `sync_spatial_index` system
|
||||
/// parameter, (2) `SimulationPlugin` resource registration, (3) any system
|
||||
/// that queries `Res<NaiveSpatialIndex>` (currently: `update_follow_state`).
|
||||
/// The `SpatialIndex` trait ensures the API surface stays identical — only the
|
||||
/// type name changes at call sites. Estimated: ~5 lines per caller.
|
||||
#[derive(Resource, Debug, Default)]
|
||||
pub struct NaiveSpatialIndex {
|
||||
entries: Vec<(Entity, TilePosition)>,
|
||||
|
||||
Reference in New Issue
Block a user