Merge branch 'crabman/airship-fix2' into 'master'

Airship fix attempt #5

See merge request veloren/veloren!4142
This commit is contained in:
Joshua Barretto 2023-10-16 17:52:57 +00:00
commit 2842d6fef8
4 changed files with 20 additions and 2 deletions

View File

@ -71,6 +71,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Location names are now also correct after editing and creating characters
- NPC's wont pick up recently dropped items (if not hostile towards you)
- Fixed "low fps" of different shaders caused by low floating point precision when using time.
- Fixed bug where airship captains would mass generate after using /reload_chunks
## [0.15.0] - 2023-07-01

View File

@ -3489,6 +3489,12 @@ fn handle_reload_chunks(
_args: Vec<String>,
_action: &ServerChatCommand,
) -> CmdResult<()> {
#[cfg(feature = "persistent_world")]
server
.state
.ecs()
.write_resource::<crate::terrain_persistence::TerrainPersistence>()
.unload_all();
server.state.clear_terrain();
Ok(())

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

@ -380,11 +380,13 @@ impl<'a> System<'a> for Sys {
chunk_generator.cancel_if_pending(key);
// If you want to trigger any behaivour on unload, do it in `Server::tick` by
// reading `TerrainChanges::removed_chunks` since chunks can also be removed
// using eg. /reload_chunks
// 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
})
})