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
/// orientation
pub look_dir: Option<Dir>,
/// If the character is using a Helm, this is set to Some, with the y
/// direction we're steering.
pub steer_dir: Option<f32>,
/// 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,

View File

@ -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) => {

View File

@ -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);
}