From cffa980f24e7931e3de81d2fc489c360e909986d Mon Sep 17 00:00:00 2001 From: Plright Date: Sat, 16 Apr 2022 16:56:47 +0000 Subject: [PATCH] Fixed being able to sneak on mount --- common/src/states/behavior.rs | 13 ++++++++++++- common/systems/src/character_behavior.rs | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/common/src/states/behavior.rs b/common/src/states/behavior.rs index bb59414af2..cfde4af106 100644 --- a/common/src/states/behavior.rs +++ b/common/src/states/behavior.rs @@ -5,6 +5,8 @@ use crate::{ Health, InputAttr, InputKind, Inventory, InventoryAction, Mass, Melee, Ori, PhysicsState, Pos, SkillSet, StateUpdate, Stats, Vel, }, + link::Is, + mounting::Rider, resources::DeltaTime, terrain::TerrainGrid, uid::Uid, @@ -89,7 +91,13 @@ pub trait CharacterBehavior { ControlAction::Unwield => self.unwield(data, output_events), ControlAction::Sit => self.sit(data, output_events), ControlAction::Dance => self.dance(data, output_events), - ControlAction::Sneak => self.sneak(data, output_events), + ControlAction::Sneak => { + if data.mount_data.is_none() { + self.sneak(data, output_events) + } else { + self.stand(data, output_events) + } + }, ControlAction::Stand => self.stand(data, output_events), ControlAction::Talk => self.talk(data, output_events), ControlAction::StartInput { @@ -129,6 +137,7 @@ pub struct JoinData<'a> { pub combo: Option<&'a Combo>, pub alignment: Option<&'a comp::Alignment>, pub terrain: &'a TerrainGrid, + pub mount_data: Option<&'a Is>, } pub struct JoinStruct<'a> { @@ -154,6 +163,7 @@ pub struct JoinStruct<'a> { pub combo: Option<&'a Combo>, pub alignment: Option<&'a comp::Alignment>, pub terrain: &'a TerrainGrid, + pub mount_data: Option<&'a Is>, } impl<'a> JoinData<'a> { @@ -189,6 +199,7 @@ impl<'a> JoinData<'a> { alignment: j.alignment, terrain: j.terrain, active_abilities: j.active_abilities, + mount_data: j.mount_data, } } } diff --git a/common/systems/src/character_behavior.rs b/common/systems/src/character_behavior.rs index d2015a903b..7efd8fdc83 100644 --- a/common/systems/src/character_behavior.rs +++ b/common/systems/src/character_behavior.rs @@ -194,6 +194,7 @@ impl<'a> System<'a> for Sys { combo, alignment: read_data.alignments.get(entity), terrain: &read_data.terrain, + mount_data: read_data.is_riders.get(entity), }; for action in actions {