Remove animation syncing (does not fix any known bug)

This commit is contained in:
timokoesters 2019-06-29 17:00:23 +02:00
parent 5a41a58c0a
commit b0ea959f67
No known key found for this signature in database
GPG Key ID: CD80BE9AAEE78097
3 changed files with 7 additions and 50 deletions

View File

@ -60,7 +60,7 @@ impl Client {
let mut postbox = PostBox::to(addr)?;
// Wait for initial sync
let (state, entity, server_info) = match postbox.next_message() {
let (mut state, entity, server_info) = match postbox.next_message() {
Some(ServerMsg::InitialSync {
ecs_state,
entity_uid,
@ -84,6 +84,12 @@ impl Client {
// We reduce the thread count by 1 to keep rendering smooth
thread_pool.set_num_threads((thread_pool.max_count() - 1).max(1));
// Set client-only components
state
.ecs_mut()
.write_storage()
.insert(entity, comp::AnimationInfo::default());
Ok(Self {
client_state,
thread_pool,
@ -376,15 +382,6 @@ impl Client {
}
None => {}
},
ServerMsg::EntityAnimation {
entity,
animation_info,
} => match self.state.ecs().entity_from_uid(entity) {
Some(entity) => {
self.state.write_component(entity, animation_info);
}
None => {}
},
ServerMsg::TerrainChunkUpdate { key, chunk } => {
self.state.insert_chunk(key, *chunk);
self.pending_chunks.remove(&key);

View File

@ -36,10 +36,6 @@ pub enum ServerMsg {
vel: comp::Vel,
ori: comp::Ori,
},
EntityAnimation {
entity: u64,
animation_info: comp::AnimationInfo,
},
TerrainChunkUpdate {
key: Vec2<i32>,
chunk: Box<TerrainChunk>,

View File

@ -146,7 +146,6 @@ impl Server {
.with(comp::Vel(Vec3::zero()))
.with(comp::Ori(Vec3::unit_y()))
.with(comp::Controller::default())
.with(comp::AnimationInfo::default())
.with(comp::Actor::Character { name, body })
.with(comp::Stats::default())
.with(comp::ForceUpdate)
@ -163,7 +162,6 @@ impl Server {
state.write_component(entity, comp::Actor::Character { name, body });
state.write_component(entity, comp::Stats::default());
state.write_component(entity, comp::AnimationInfo::default());
state.write_component(entity, comp::Controller::default());
state.write_component(entity, comp::Pos(spawn_point));
state.write_component(entity, comp::Vel(Vec3::zero()));
@ -636,19 +634,6 @@ impl Server {
});
}
// Sync animations
for (&uid, &animation_info) in (
&state.ecs().read_storage::<Uid>(),
&state.ecs().read_storage::<comp::AnimationInfo>(),
)
.join()
{
client.notify(ServerMsg::EntityAnimation {
entity: uid.into(),
animation_info: animation_info.clone(),
});
}
// Tell the client its request was successful.
client.allow_state(ClientState::Registered);
}
@ -709,27 +694,6 @@ impl Server {
}
}
// Sync animations
for (entity, &uid, &animation_info, force_update) in (
&self.state.ecs().entities(),
&self.state.ecs().read_storage::<Uid>(),
&self.state.ecs().read_storage::<comp::AnimationInfo>(),
self.state.ecs().read_storage::<comp::ForceUpdate>().maybe(),
)
.join()
{
if animation_info.changed || force_update.is_some() {
let msg = ServerMsg::EntityAnimation {
entity: uid.into(),
animation_info: animation_info.clone(),
};
match force_update {
Some(_) => self.clients.notify_ingame(msg),
None => self.clients.notify_ingame_except(entity, msg),
}
}
}
// Remove all force flags.
self.state
.ecs_mut()