Regenerate world site mapping on setup

This commit is contained in:
Joshua Barretto 2023-04-01 18:36:26 +01:00
parent 57efd24573
commit f911e6e5b6
3 changed files with 3 additions and 3 deletions

View File

@ -352,7 +352,7 @@ fn travel_to_point(wpos: Vec2<f32>) -> impl Action {
let diff = wpos - start;
let n = (diff.magnitude() / WAYPOINT).max(1.0);
let mut points = (1..n as usize + 1).map(move |i| start + diff * (i as f32 / n));
traverse_points(move |_| points.next()).boxed()
traverse_points(move |_| points.next())
})
.debug(|| "travel to point")
}

View File

@ -11,7 +11,7 @@ impl Rule for Setup {
rtstate.bind::<Self, OnSetup>(|ctx| {
let data = &mut *ctx.state.data_mut();
// Delete rtsim sites that don't correspond to a world site
data.sites.retain(|site_id, site| {
data.sites.sites.retain(|site_id, site| {
if let Some((world_site_id, _)) = ctx
.index
.sites
@ -19,6 +19,7 @@ impl Rule for Setup {
.find(|(_, world_site)| world_site.get_origin() == site.wpos)
{
site.world_site = Some(world_site_id);
data.sites.world_site_map.insert(world_site_id, site_id);
true
} else {
warn!(

View File

@ -146,7 +146,6 @@ impl Rule for SimulateNpcs {
cell.vehicles.push(vehicle_id);
}
}
}
for (npc_id, npc) in data.npcs.npcs.iter_mut() {
// Update the NPC's current site, if any