mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix terrain not loading
Former-commit-id: f9279878ab051c6083c4a1f5125531fe79151fb8
This commit is contained in:
parent
36e890bbd8
commit
f5751d65b1
@ -184,6 +184,11 @@ impl State {
|
||||
self.ecs.read_resource::<TerrainMap>()
|
||||
}
|
||||
|
||||
/// Get a writable reference to this state's terrain.
|
||||
pub fn terrain_mut(&self) -> FetchMut<TerrainMap> {
|
||||
self.ecs.write_resource::<TerrainMap>()
|
||||
}
|
||||
|
||||
/// Insert the provided chunk into this state's terrain.
|
||||
pub fn insert_chunk(&mut self, key: Vec2<i32>, chunk: TerrainChunk) {
|
||||
if self
|
||||
|
@ -145,6 +145,10 @@ impl<V: BaseVol, S: VolSize> VolMap2d<V, S> {
|
||||
self.chunks.get(&key)
|
||||
}
|
||||
|
||||
pub fn clear(&mut self) {
|
||||
self.chunks.clear();
|
||||
}
|
||||
|
||||
pub fn remove(&mut self, key: Vec2<i32>) -> Option<Arc<V>> {
|
||||
self.chunks.remove(&key)
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ impl PlayState for CharSelectionState {
|
||||
fn play(&mut self, _: Direction, global_state: &mut GlobalState) -> PlayStateResult {
|
||||
// Set up an fps clock.
|
||||
let mut clock = Clock::new();
|
||||
self.client.borrow_mut().state_mut().terrain_mut().clear();
|
||||
|
||||
while self.client.borrow().is_request_pending()
|
||||
|| self.client.borrow().get_client_state() == Some(ClientState::Registered)
|
||||
|
@ -205,4 +205,8 @@ impl Terrain {
|
||||
renderer.render_terrain_chunk(&chunk.model, globals, &chunk.locals);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clear(&mut self) {
|
||||
self.chunks.clear();
|
||||
}
|
||||
}
|
||||
|
@ -115,6 +115,7 @@ impl PlayState for SessionState {
|
||||
|
||||
// Set up an fps clock.
|
||||
let mut clock = Clock::new();
|
||||
self.client.borrow_mut().state_mut().terrain_mut().clear();
|
||||
|
||||
// Load a few chunks. TODO: Remove this.
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user