diff options
| author | Valentin Popov <valentin@popov.link> | 2026-11-14 08:43:49 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-11-14 08:43:49 +0300 |
| commit | 176b377c8d4406161ff206a8cb5ac8c8359877cf (patch) | |
| tree | 99394195838de49cd8c820d7efc6fa7936217131 /crates/fparkan-world/src | |
| parent | acc5af7cc79a5ee2132c5d10528ca1cf06186832 (diff) | |
| download | fparkan-176b377c8d4406161ff206a8cb5ac8c8359877cf.tar.xz fparkan-176b377c8d4406161ff206a8cb5ac8c8359877cf.zip | |
feat(runtime): engage hostile robots in AutoDemo
Diffstat (limited to 'crates/fparkan-world/src')
| -rw-r--r-- | crates/fparkan-world/src/lib.rs | 20 |
1 files changed, 13 insertions, 7 deletions
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<WorldEvent>) -> 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 { |
