Begin spawn test reads the player's place through WorldSnapshot::standing_place

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-12-03 00:21:31 +01:00
commit 8c4bffdbba
2 changed files with 9 additions and 4 deletions

View file

@ -849,12 +849,10 @@ pub(crate) mod tests {
(world.phase == WorldPhase::Active && rig.status(&begun.timeline).await.is_none()).then_some(world)
})
.await;
let hall = world.places.iter().find(|place| place.label == "Hall").unwrap().id;
let player = world.subjects.iter().find(|subject| subject.label == "Deru").unwrap();
assert_eq!(player.position, Some(hall), "the player stands in the hall");
let others = world.subjects.iter().filter(|s| s.id != player.id && s.position == Some(hall)).count();
assert_eq!(world.standing_place(player.id), Some("Hall"), "the player stands in the hall");
let others = world.subjects.iter().filter(|s| s.id != player.id && world.standing_place(s.id) == Some("Hall")).count();
assert_eq!(others, 2, "with the two people placed there");
assert!(world.routes.iter().all(|route| !route.open), "no open way back to the empty commons");
}
/// Spec test: a seed fault reads Failed with a category and no endpoint

View file

@ -1296,6 +1296,13 @@ pub struct WorldSnapshot {
}
impl WorldSnapshot {
/// The label of the place a subject stands in, for the owner's own
/// surfaces and tests; no subject-facing lane reads this.
pub fn standing_place(&self, subject: SubjectId) -> Option<&str> {
let position = self.subjects.iter().find(|candidate| candidate.id == subject)?.position?;
self.places.iter().find(|place| place.id == position).map(|place| place.label.as_str())
}
/// What every lane reads as the world's guidance: the era line, then the
/// owner's brief verbatim, either omitted when empty. Derived on every
/// read; no prompt reads `brief` directly.