airship fix attempt #521

This commit is contained in:
Maxicarlos08 2023-10-16 16:53:33 +02:00
parent b862a7aa22
commit c8350d0654
No known key found for this signature in database
2 changed files with 11 additions and 2 deletions

View File

@ -811,6 +811,15 @@ impl Server {
run_now::<terrain::Sys>(self.state.ecs_mut());
}
// Hook rtsim chunk unloads
#[cfg(feature = "worldgen")]
{
let mut rtsim = self.state.ecs().write_resource::<rtsim::RtSim>();
for chunk in &self.state.terrain_changes().removed_chunks {
rtsim.hook_unload_chunk(*chunk);
}
}
// Prevent anchor entity chains which are not currently supported
let anchors = self.state.ecs().read_storage::<Anchor>();
let anchored_anchor_entities: Vec<Entity> = (

View File

@ -383,9 +383,9 @@ impl<'a> System<'a> for Sys {
// TODO: code duplication for chunk insertion between here and state.rs
terrain.remove(key).map(|chunk| {
terrain_changes.removed_chunks.insert(key);
#[cfg(feature = "worldgen")]
rtsim.hook_unload_chunk(key);
chunk
// The rtsim hook to unload the chunks is later called in
// the main server tick function
})
})
.collect::<Vec<_>>();