mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'timo-warnings-client' into 'master'
Timo warnings client See merge request veloren/veloren!291
This commit is contained in:
commit
d280126d1f
@ -85,7 +85,7 @@ impl Client {
|
||||
thread_pool.set_num_threads((thread_pool.max_count() - 1).max(1));
|
||||
|
||||
// Set client-only components
|
||||
state
|
||||
let _ = state
|
||||
.ecs_mut()
|
||||
.write_storage()
|
||||
.insert(entity, comp::AnimationInfo::default());
|
||||
@ -236,7 +236,7 @@ impl Client {
|
||||
// Remove chunks that are too far from the player.
|
||||
let mut chunks_to_remove = Vec::new();
|
||||
self.state.terrain().iter().for_each(|(key, _)| {
|
||||
if (Vec2::from(chunk_pos) - Vec2::from(key))
|
||||
if (chunk_pos - key)
|
||||
.map(|e: i32| (e.abs() as u32).checked_sub(2).unwrap_or(0))
|
||||
.magnitude_squared()
|
||||
> view_distance.pow(2)
|
||||
@ -311,16 +311,13 @@ impl Client {
|
||||
|
||||
// 6) Update the server about the player's physics attributes.
|
||||
if let ClientState::Character = self.client_state {
|
||||
match (
|
||||
if let (Some(pos), Some(vel), Some(ori)) = (
|
||||
self.state.read_storage().get(self.entity).cloned(),
|
||||
self.state.read_storage().get(self.entity).cloned(),
|
||||
self.state.read_storage().get(self.entity).cloned(),
|
||||
) {
|
||||
(Some(pos), Some(vel), Some(ori)) => {
|
||||
self.postbox
|
||||
.send_message(ClientMsg::PlayerPhysics { pos, vel, ori });
|
||||
}
|
||||
_ => {}
|
||||
self.postbox
|
||||
.send_message(ClientMsg::PlayerPhysics { pos, vel, ori });
|
||||
}
|
||||
}
|
||||
|
||||
@ -377,15 +374,14 @@ impl Client {
|
||||
vel,
|
||||
ori,
|
||||
action_state,
|
||||
} => match self.state.ecs().entity_from_uid(entity) {
|
||||
Some(entity) => {
|
||||
} => {
|
||||
if let Some(entity) = self.state.ecs().entity_from_uid(entity) {
|
||||
self.state.write_component(entity, pos);
|
||||
self.state.write_component(entity, vel);
|
||||
self.state.write_component(entity, ori);
|
||||
self.state.write_component(entity, action_state);
|
||||
}
|
||||
None => {}
|
||||
},
|
||||
}
|
||||
ServerMsg::TerrainChunkUpdate { key, chunk } => {
|
||||
self.state.insert_chunk(key, *chunk);
|
||||
self.pending_chunks.remove(&key);
|
||||
@ -394,7 +390,10 @@ impl Client {
|
||||
self.client_state = state;
|
||||
}
|
||||
ServerMsg::StateAnswer(Err((error, state))) => {
|
||||
warn!("StateAnswer: {:?}", error);
|
||||
warn!(
|
||||
"StateAnswer: {:?}. Server thinks client is in state {:?}.",
|
||||
error, state
|
||||
);
|
||||
}
|
||||
ServerMsg::ForceState(state) => {
|
||||
self.client_state = state;
|
||||
@ -463,7 +462,7 @@ impl Client {
|
||||
.ecs()
|
||||
.read_storage::<comp::Player>()
|
||||
.join()
|
||||
.map(|p| p.clone())
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user