mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Run terrain persistence before /reload_chunks
This commit is contained in:
parent
3605e49a00
commit
0da10c1dfc
@ -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(())
|
||||
|
@ -380,12 +380,14 @@ 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);
|
||||
chunk
|
||||
// The rtsim hook to unload the chunks is later called in
|
||||
// the main server tick function
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
Loading…
Reference in New Issue
Block a user