Update code quality

This commit is contained in:
TelepathicWalrus 2023-05-13 15:02:55 +01:00 committed by Maxicarlos08
parent 62d998252d
commit 2cb8e2ca84
No known key found for this signature in database
2 changed files with 14 additions and 7 deletions

View File

@ -139,7 +139,8 @@ pub fn handle_mount(server: &mut Server, rider: EcsEntity, mount: EcsEntity) {
.and_then(|x| x.stay_pos)
.is_some();
if (is_pet_of(mount, rider_uid) || is_pet_of(rider, mount_uid)) && can_ride && !is_stay {
if (is_pet_of(mount, rider_uid) || is_pet_of(rider, mount_uid)) && can_ride && !is_stay
{
drop(uids);
let _ = state.link(Mounting {
mount: mount_uid,

View File

@ -412,17 +412,23 @@ fn follow_if_far_away(bdata: &mut BehaviorData) -> bool {
let distance_from_stay = stay_pos.0.distance_squared(bdata.agent_data.pos.0);
if distance_from_stay > (MAX_STAY_DISTANCE).powi(2) {
bdata
.agent_data
.follow(bdata.agent, bdata.controller, bdata.read_data, &stay_pos);
bdata.agent_data.follow(
bdata.agent,
bdata.controller,
bdata.read_data,
&stay_pos,
);
return true;
}
} else {
let dist_sqrd = bdata.agent_data.pos.0.distance_squared(tgt_pos.0);
if dist_sqrd > (MAX_PATROL_DIST * bdata.agent.psyche.idle_wander_factor).powi(2) {
bdata
.agent_data
.follow(bdata.agent, bdata.controller, bdata.read_data, tgt_pos);
bdata.agent_data.follow(
bdata.agent,
bdata.controller,
bdata.read_data,
tgt_pos,
);
return true;
}
}