diff --git a/common/src/comp/character_state.rs b/common/src/comp/character_state.rs index 82c1930b9d..1854ed5c00 100644 --- a/common/src/comp/character_state.rs +++ b/common/src/comp/character_state.rs @@ -986,9 +986,10 @@ pub struct CharacterActivity { /// `None` means that the look direction should be derived from the /// orientation pub look_dir: Option, - /// If the character is using a Helm, this is set to Some, with the y - /// direction we're steering. - pub steer_dir: Option, + /// If the character is using a Helm, this is the y direction the + /// character steering. If the character is not steering this is + /// a stale value. + pub steer_dir: f32, /// If true, the owner has set this pet to stay at a fixed location and /// to not engage in combat pub is_pet_staying: bool, diff --git a/common/systems/src/mount.rs b/common/systems/src/mount.rs index c4a160efeb..ed1b7f3c46 100644 --- a/common/systems/src/mount.rs +++ b/common/systems/src/mount.rs @@ -179,8 +179,11 @@ impl<'a> System<'a> for Sys { if is_volume_rider.block.is_controller() { if let Some((actions, inputs)) = inputs { - if let Some(mut character_activity) = character_activity.get_mut(entity) { - character_activity.steer_dir = Some(inputs.move_dir.y); + if let Some(mut character_activity) = character_activity + .get_mut(entity) + .filter(|c| c.steer_dir != inputs.move_dir.y) + { + character_activity.steer_dir = inputs.move_dir.y; } match is_volume_rider.pos.kind { common::mounting::Volume::Entity(uid) => { diff --git a/server/agent/src/action_nodes.rs b/server/agent/src/action_nodes.rs index 2bd3fd5f00..6189744136 100644 --- a/server/agent/src/action_nodes.rs +++ b/server/agent/src/action_nodes.rs @@ -237,13 +237,8 @@ impl<'a> AgentData<'a> { 'activity: { match agent.rtsim_controller.activity { Some(NpcActivity::Goto(travel_to, speed_factor)) => { - if !read_data - .is_volume_riders - .get(*self.entity) - .map_or(false, |r| r.is_steering_entity()) - { - controller.push_event(ControlEvent::Unmount); - } + self.dismount(controller, read_data); + // If it has an rtsim destination and can fly, then it should. // If it is flying and bumps something above it, then it should move down. if self.traversal_config.can_fly @@ -1008,14 +1003,7 @@ impl<'a> AgentData<'a> { #[cfg(feature = "be-dyn-lib")] let rng = &mut thread_rng(); - if read_data.is_riders.contains(*self.entity) - || !read_data - .is_volume_riders - .get(*self.entity) - .map_or(false, |r| r.is_steering_entity()) - { - controller.push_event(ControlEvent::Unmount); - } + self.dismount(controller, read_data); let tool_tactic = |tool_kind| match tool_kind { ToolKind::Bow => Tactic::Bow, @@ -2022,10 +2010,10 @@ impl<'a> AgentData<'a> { pub fn dismount(&self, controller: &mut Controller, read_data: &ReadData) { if read_data.is_riders.contains(*self.entity) - || !read_data + || read_data .is_volume_riders .get(*self.entity) - .map_or(false, |r| r.is_steering_entity()) + .map_or(false, |r| !r.is_steering_entity()) { controller.push_event(ControlEvent::Unmount); }