mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Update code quality
This commit is contained in:
parent
62d998252d
commit
2cb8e2ca84
@ -139,7 +139,8 @@ pub fn handle_mount(server: &mut Server, rider: EcsEntity, mount: EcsEntity) {
|
|||||||
.and_then(|x| x.stay_pos)
|
.and_then(|x| x.stay_pos)
|
||||||
.is_some();
|
.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);
|
drop(uids);
|
||||||
let _ = state.link(Mounting {
|
let _ = state.link(Mounting {
|
||||||
mount: mount_uid,
|
mount: mount_uid,
|
||||||
|
@ -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);
|
let distance_from_stay = stay_pos.0.distance_squared(bdata.agent_data.pos.0);
|
||||||
|
|
||||||
if distance_from_stay > (MAX_STAY_DISTANCE).powi(2) {
|
if distance_from_stay > (MAX_STAY_DISTANCE).powi(2) {
|
||||||
bdata
|
bdata.agent_data.follow(
|
||||||
.agent_data
|
bdata.agent,
|
||||||
.follow(bdata.agent, bdata.controller, bdata.read_data, &stay_pos);
|
bdata.controller,
|
||||||
|
bdata.read_data,
|
||||||
|
&stay_pos,
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let dist_sqrd = bdata.agent_data.pos.0.distance_squared(tgt_pos.0);
|
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) {
|
if dist_sqrd > (MAX_PATROL_DIST * bdata.agent.psyche.idle_wander_factor).powi(2) {
|
||||||
bdata
|
bdata.agent_data.follow(
|
||||||
.agent_data
|
bdata.agent,
|
||||||
.follow(bdata.agent, bdata.controller, bdata.read_data, tgt_pos);
|
bdata.controller,
|
||||||
|
bdata.read_data,
|
||||||
|
tgt_pos,
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user