diff --git a/assets/common/abilities/axe/doublestrike.ron b/assets/common/abilities/axe/doublestrike.ron index 6100e01208..2864244cb9 100644 --- a/assets/common/abilities/axe/doublestrike.ron +++ b/assets/common/abilities/axe/doublestrike.ron @@ -3,7 +3,7 @@ ComboMelee( ( stage: 1, base_damage: 90, - base_poise_damage: 20, + base_poise_damage: 15, damage_increase: 10, poise_damage_increase: 0, knockback: 8.0, diff --git a/client/src/lib.rs b/client/src/lib.rs index a7505d79fe..fb41f7bc77 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -1644,15 +1644,6 @@ impl Client { impulse, }); }, - ServerGeneral::PositionUpdate(pos) => { - self.state - .ecs() - .read_resource::>() - .emit_now(LocalEvent::PositionUpdate { - entity: self.entity(), - pos, - }); - }, ServerGeneral::UpdatePendingTrade(id, trade, pricing) => { tracing::trace!("UpdatePendingTrade {:?} {:?}", id, trade); self.pending_trade = Some((id, trade, pricing)); diff --git a/common/net/src/msg/server.rs b/common/net/src/msg/server.rs index 958fbb8be7..b16a10dbfa 100644 --- a/common/net/src/msg/server.rs +++ b/common/net/src/msg/server.rs @@ -104,7 +104,6 @@ pub enum ServerGeneral { SetViewDistance(u32), Outcomes(Vec), Knockback(Vec3), - PositionUpdate(comp::Pos), // Ingame related AND terrain stream TerrainChunkUpdate { key: Vec2, @@ -236,7 +235,6 @@ impl ServerMsg { | ServerGeneral::SetViewDistance(_) | ServerGeneral::Outcomes(_) | ServerGeneral::Knockback(_) - | ServerGeneral::PositionUpdate(_) | ServerGeneral::UpdatePendingTrade(_, _, _) | ServerGeneral::FinishedTrade(_) | ServerGeneral::SiteEconomy(_) => { diff --git a/common/src/comp/phys.rs b/common/src/comp/phys.rs index de3ec7cfa3..fb16b9e615 100644 --- a/common/src/comp/phys.rs +++ b/common/src/comp/phys.rs @@ -154,7 +154,8 @@ impl Component for PhysicsState { type Storage = IdvStorage; } -// ForceUpdate +/// Used to forcefully update the position, velocity, and orientation of the +/// client #[derive(Copy, Clone, Debug, Default, PartialEq, Serialize, Deserialize)] pub struct ForceUpdate; diff --git a/common/src/event.rs b/common/src/event.rs index bb78f6b15c..db2e7e1a40 100644 --- a/common/src/event.rs +++ b/common/src/event.rs @@ -29,8 +29,6 @@ pub enum LocalEvent { }, /// Applies `vel` velocity to `entity` Boost { entity: EcsEntity, vel: Vec3 }, - /// Updates the position of the entity - PositionUpdate { entity: EcsEntity, pos: Pos }, /// Creates an outcome CreateOutcome(Outcome), } diff --git a/common/sys/src/state.rs b/common/sys/src/state.rs index b598b578de..ca31775284 100644 --- a/common/sys/src/state.rs +++ b/common/sys/src/state.rs @@ -490,7 +490,6 @@ impl State { let events = self.ecs.read_resource::>().recv_all(); for event in events { let mut velocities = self.ecs.write_storage::(); - let mut positions = self.ecs.write_storage::(); let physics = self.ecs.read_storage::(); match event { LocalEvent::Jump(entity, impulse) => { @@ -511,11 +510,6 @@ impl State { vel.0 += extra_vel; } }, - LocalEvent::PositionUpdate { entity, pos } => { - if let Some(position) = positions.get_mut(entity) { - *position = pos; - } - }, LocalEvent::CreateOutcome(outcome) => { self.ecs.write_resource::>().push(outcome); }, diff --git a/server/src/client.rs b/server/src/client.rs index 7f3495cd1d..9e03187278 100644 --- a/server/src/client.rs +++ b/server/src/client.rs @@ -110,7 +110,6 @@ impl Client { | ServerGeneral::SiteEconomy(_) | ServerGeneral::Outcomes(_) | ServerGeneral::Knockback(_) - | ServerGeneral::PositionUpdate(_) | ServerGeneral::UpdatePendingTrade(_, _, _) | ServerGeneral::FinishedTrade(_) => { self.in_game_stream.lock().unwrap().send(g) @@ -181,7 +180,6 @@ impl Client { | ServerGeneral::SetViewDistance(_) | ServerGeneral::Outcomes(_) | ServerGeneral::Knockback(_) - | ServerGeneral::PositionUpdate(_) | ServerGeneral::SiteEconomy(_) | ServerGeneral::UpdatePendingTrade(_, _, _) | ServerGeneral::FinishedTrade(_) => { diff --git a/server/src/events/entity_manipulation.rs b/server/src/events/entity_manipulation.rs index 527e0fa914..1cbb08b29c 100644 --- a/server/src/events/entity_manipulation.rs +++ b/server/src/events/entity_manipulation.rs @@ -952,11 +952,8 @@ pub fn handle_combo_change(server: &Server, entity: EcsEntity, change: i32) { pub fn handle_teleport_to(server: &Server, entity: EcsEntity, target: Uid, max_range: Option) { let ecs = &server.state.ecs(); let mut positions = ecs.write_storage::(); - let clients = ecs.read_storage::(); - let target_pos = server - .state - .ecs() + let target_pos = ecs .entity_from_uid(target.into()) .and_then(|e| positions.get(e)) .copied(); @@ -964,9 +961,15 @@ pub fn handle_teleport_to(server: &Server, entity: EcsEntity, target: Uid, max_r if let (Some(pos), Some(target_pos)) = (positions.get_mut(entity), target_pos) { if max_range.map_or(true, |r| pos.0.distance_squared(target_pos.0) < r.powi(2)) { *pos = target_pos; - if let Some(client) = clients.get(entity) { - client.send_fallible(ServerGeneral::PositionUpdate(target_pos)); - } + ecs.write_storage() + .insert(entity, comp::ForceUpdate) + .err() + .map(|e| { + error!( + ?e, + "Error inserting ForceUpdate component when teleporting client" + ) + }); } } }