review fixes

This commit is contained in:
Isse 2023-12-12 19:41:40 +01:00
parent 850112bd72
commit 8569f30336
3 changed files with 14 additions and 22 deletions

View File

@ -986,9 +986,10 @@ pub struct CharacterActivity {
/// `None` means that the look direction should be derived from the /// `None` means that the look direction should be derived from the
/// orientation /// orientation
pub look_dir: Option<Dir>, pub look_dir: Option<Dir>,
/// If the character is using a Helm, this is set to Some, with the y /// If the character is using a Helm, this is the y direction the
/// direction we're steering. /// character steering. If the character is not steering this is
pub steer_dir: Option<f32>, /// a stale value.
pub steer_dir: f32,
/// If true, the owner has set this pet to stay at a fixed location and /// If true, the owner has set this pet to stay at a fixed location and
/// to not engage in combat /// to not engage in combat
pub is_pet_staying: bool, pub is_pet_staying: bool,

View File

@ -179,8 +179,11 @@ impl<'a> System<'a> for Sys {
if is_volume_rider.block.is_controller() { if is_volume_rider.block.is_controller() {
if let Some((actions, inputs)) = inputs { if let Some((actions, inputs)) = inputs {
if let Some(mut character_activity) = character_activity.get_mut(entity) { if let Some(mut character_activity) = character_activity
character_activity.steer_dir = Some(inputs.move_dir.y); .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 { match is_volume_rider.pos.kind {
common::mounting::Volume::Entity(uid) => { common::mounting::Volume::Entity(uid) => {

View File

@ -237,13 +237,8 @@ impl<'a> AgentData<'a> {
'activity: { 'activity: {
match agent.rtsim_controller.activity { match agent.rtsim_controller.activity {
Some(NpcActivity::Goto(travel_to, speed_factor)) => { Some(NpcActivity::Goto(travel_to, speed_factor)) => {
if !read_data self.dismount(controller, read_data);
.is_volume_riders
.get(*self.entity)
.map_or(false, |r| r.is_steering_entity())
{
controller.push_event(ControlEvent::Unmount);
}
// If it has an rtsim destination and can fly, then it should. // 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 it is flying and bumps something above it, then it should move down.
if self.traversal_config.can_fly if self.traversal_config.can_fly
@ -1008,14 +1003,7 @@ impl<'a> AgentData<'a> {
#[cfg(feature = "be-dyn-lib")] #[cfg(feature = "be-dyn-lib")]
let rng = &mut thread_rng(); let rng = &mut thread_rng();
if read_data.is_riders.contains(*self.entity) self.dismount(controller, read_data);
|| !read_data
.is_volume_riders
.get(*self.entity)
.map_or(false, |r| r.is_steering_entity())
{
controller.push_event(ControlEvent::Unmount);
}
let tool_tactic = |tool_kind| match tool_kind { let tool_tactic = |tool_kind| match tool_kind {
ToolKind::Bow => Tactic::Bow, ToolKind::Bow => Tactic::Bow,
@ -2022,10 +2010,10 @@ impl<'a> AgentData<'a> {
pub fn dismount(&self, controller: &mut Controller, read_data: &ReadData) { pub fn dismount(&self, controller: &mut Controller, read_data: &ReadData) {
if read_data.is_riders.contains(*self.entity) if read_data.is_riders.contains(*self.entity)
|| !read_data || read_data
.is_volume_riders .is_volume_riders
.get(*self.entity) .get(*self.entity)
.map_or(false, |r| r.is_steering_entity()) .map_or(false, |r| !r.is_steering_entity())
{ {
controller.push_event(ControlEvent::Unmount); controller.push_event(ControlEvent::Unmount);
} }