diff --git a/client/src/lib.rs b/client/src/lib.rs index 655e7179be..0d50cb51a6 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -292,19 +292,6 @@ impl Client { _ => {} } - // Update the server about the player's current animation. - if let Some(animation_info) = self - .state - .ecs_mut() - .write_storage::() - .get_mut(self.entity) - { - if animation_info.changed { - self.postbox - .send_message(ClientMsg::PlayerAnimation(animation_info.clone())); - } - } - // Output debug metrics if log_enabled!(log::Level::Info) && self.tick % 600 == 0 { let metrics = self diff --git a/common/src/comp/inputs.rs b/common/src/comp/inputs.rs index 0e021094f7..66c51d634b 100644 --- a/common/src/comp/inputs.rs +++ b/common/src/comp/inputs.rs @@ -71,5 +71,5 @@ impl Component for Jumping { } impl Component for Gliding { - type Storage = NullStorage; + type Storage = FlaggedStorage>; } diff --git a/common/src/msg/client.rs b/common/src/msg/client.rs index 47ec6fae5b..db1c40d4c7 100644 --- a/common/src/msg/client.rs +++ b/common/src/msg/client.rs @@ -17,7 +17,6 @@ pub enum ClientMsg { Ping, Pong, Chat(String), - PlayerAnimation(comp::AnimationInfo), PlayerPhysics { pos: comp::Pos, vel: comp::Vel, diff --git a/common/src/msg/ecs_packet.rs b/common/src/msg/ecs_packet.rs index 899579b8c3..841b0d5a8e 100644 --- a/common/src/msg/ecs_packet.rs +++ b/common/src/msg/ecs_packet.rs @@ -25,7 +25,7 @@ sphynx::sum_type! { Stats(comp::Stats), Attacking(comp::Attacking), Rolling(comp::Rolling), - + Gliding(comp::Gliding), } } // Automatically derive From for EcsCompPhantom @@ -41,7 +41,7 @@ sphynx::sum_type! { Stats(PhantomData), Attacking(PhantomData), Rolling(PhantomData), - + Gliding(PhantomData), } } impl sphynx::CompPacket for EcsCompPacket { diff --git a/common/src/state.rs b/common/src/state.rs index 6e1f2dde1e..974c841258 100644 --- a/common/src/state.rs +++ b/common/src/state.rs @@ -98,13 +98,13 @@ impl State { // Create a new Sphynx ECS world. fn setup_sphynx_world(ecs: &mut sphynx::World) { - // Register synced components. + // Register server->client synced components. ecs.register_synced::(); ecs.register_synced::(); ecs.register_synced::(); - ecs.register_synced::(); // TODO: Don't send this to the client? - ecs.register_synced::(); // TODO: Don't send this to the client? - ecs.register::(); + ecs.register_synced::(); + ecs.register_synced::(); + ecs.register_synced::(); // Register components synced by other means ecs.register::(); @@ -121,8 +121,8 @@ impl State { // Register server-local components ecs.register::(); ecs.register::(); - ecs.register::(); ecs.register::(); + ecs.register::(); ecs.register::(); // Register synced resources used by the ECS. diff --git a/common/src/sys/controller.rs b/common/src/sys/controller.rs index dc65eed02b..d643b960fe 100644 --- a/common/src/sys/controller.rs +++ b/common/src/sys/controller.rs @@ -99,13 +99,10 @@ impl<'a> System<'a> for Sys { // Jump if controller.jump - && jumpings.get(entity).is_none() && on_ground.is_some() && vel.0.z <= 0.0 { jumpings.insert(entity, Jumping); - } else { - jumpings.remove(entity); } // Roll diff --git a/common/src/sys/phys.rs b/common/src/sys/phys.rs index 09d0b7a794..44dfdeecd3 100644 --- a/common/src/sys/phys.rs +++ b/common/src/sys/phys.rs @@ -51,9 +51,9 @@ impl<'a> System<'a> for Sys { ReadExpect<'a, TerrainMap>, Read<'a, DeltaTime>, ReadStorage<'a, MoveDir>, - ReadStorage<'a, Jumping>, ReadStorage<'a, Gliding>, ReadStorage<'a, Stats>, + WriteStorage<'a, Jumping>, WriteStorage<'a, Rolling>, WriteStorage<'a, OnGround>, WriteStorage<'a, Pos>, @@ -68,9 +68,9 @@ impl<'a> System<'a> for Sys { terrain, dt, move_dirs, - jumpings, glidings, stats, + mut jumpings, mut rollings, mut on_grounds, mut positions, @@ -79,11 +79,10 @@ impl<'a> System<'a> for Sys { ): Self::SystemData, ) { // Apply movement inputs - for (entity, stats, move_dir, jumping, gliding, mut pos, mut vel, mut ori) in ( + for (entity, stats, move_dir, gliding, mut pos, mut vel, mut ori) in ( &entities, &stats, move_dirs.maybe(), - jumpings.maybe(), glidings.maybe(), &mut positions, &mut velocities, @@ -119,8 +118,9 @@ impl<'a> System<'a> for Sys { } // Jump - if jumping.is_some() { + if jumpings.get(entity).is_some() { vel.0.z = HUMANOID_JUMP_ACCEL; + jumpings.remove(entity); } // Glide diff --git a/server/src/lib.rs b/server/src/lib.rs index 194fa2b908..79a382feae 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -512,15 +512,6 @@ impl Server { | ClientState::Character => new_chat_msgs.push((Some(entity), msg)), ClientState::Pending => {} }, - ClientMsg::PlayerAnimation(animation_info) => { - match client.client_state { - ClientState::Character => { - state.write_component(entity, animation_info) - } - // Only characters can send animations. - _ => client.error_state(RequestStateError::Impossible), - } - } ClientMsg::PlayerPhysics { pos, vel, ori } => match client.client_state { ClientState::Character => { state.write_component(entity, pos);