From 176b377c8d4406161ff206a8cb5ac8c8359877cf Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sat, 14 Nov 2026 09:43:49 +0400 Subject: feat(runtime): engage hostile robots in AutoDemo --- crates/fparkan-world/src/lib.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'crates/fparkan-world/src') diff --git a/crates/fparkan-world/src/lib.rs b/crates/fparkan-world/src/lib.rs index 41c20389..4d0319fd 100644 --- a/crates/fparkan-world/src/lib.rs +++ b/crates/fparkan-world/src/lib.rs @@ -456,13 +456,7 @@ where } world.tick.0 = world.tick.0.saturating_add(1); world.phase = WorldPhase::PublishingSnapshot; - let snapshot = WorldSnapshot { - tick: world.tick, - objects: live_registered(world), - transforms: live_registered_with_transforms(world), - events, - hash: canonical_state_hash(world), - }; + let snapshot = world_snapshot(world, events); world.phase = WorldPhase::Idle; Ok(snapshot) })(); @@ -474,6 +468,18 @@ where result } +/// Publishes the current live objects, transforms and hash with the given step events. +#[must_use] +pub fn world_snapshot(world: &World, events: Vec) -> WorldSnapshot { + WorldSnapshot { + tick: world.tick, + objects: live_registered(world), + transforms: live_registered_with_transforms(world), + events, + hash: canonical_state_hash(world), + } +} + /// Computes canonical state hash. #[must_use] pub fn canonical_state_hash(world: &World) -> StateHash { -- cgit v1.2.3