cargo fmt

This commit is contained in:
Avi Weinstock 2021-07-15 15:52:10 -04:00
parent 171113ea74
commit 9e9cbd290b
2 changed files with 28 additions and 17 deletions

View File

@ -413,24 +413,26 @@ impl Body {
} }
// How far away other entities should try to be. Will be added uppon the other // How far away other entities should try to be. Will be added uppon the other
// entitys spacing_radius. So an entity with 2.0 and an entity with 3.0 will lead // entitys spacing_radius. So an entity with 2.0 and an entity with 3.0 will
// to that both entities will try to keep 5.0 units away from each other. // lead to that both entities will try to keep 5.0 units away from each
// other.
pub fn spacing_radius(&self) -> f32 { pub fn spacing_radius(&self) -> f32 {
self.radius() + match self { self.radius()
Body::QuadrupedSmall(body) => match body.species { + match self {
quadruped_small::Species::Rat => 0.0, Body::QuadrupedSmall(body) => match body.species {
_ => 2.0, quadruped_small::Species::Rat => 0.0,
}, _ => 2.0,
Body::QuadrupedLow(body) => match body.species { },
quadruped_low::Species::Hakulaq => 0.0, Body::QuadrupedLow(body) => match body.species {
quadruped_low::Species::Hakulaq => 0.0,
_ => 2.0,
},
Body::BipedSmall(body) => match body.species {
biped_small::Species::Husk => 3.0,
_ => 2.0,
},
_ => 2.0, _ => 2.0,
} }
Body::BipedSmall(body) => match body.species {
biped_small::Species::Husk => 3.0,
_ => 2.0,
}
_ => 2.0,
}
} }
pub fn height(&self) -> f32 { self.dimensions().z } pub fn height(&self) -> f32 { self.dimensions().z }

View File

@ -3478,7 +3478,15 @@ impl<'a> AgentData<'a> {
.actions .actions
.push(ControlAction::basic_input(InputKind::Ability(0))); .push(ControlAction::basic_input(InputKind::Ability(0)));
// Move towards the target slowly // Move towards the target slowly
self.path_toward_target(agent, controller, tgt_data, read_data, true, false, Some(0.5)); self.path_toward_target(
agent,
controller,
tgt_data,
read_data,
true,
false,
Some(0.5),
);
agent.action_state.timer += read_data.dt.0; agent.action_state.timer += read_data.dt.0;
} else if agent.action_state.timer < 6.0 } else if agent.action_state.timer < 6.0
&& attack_data.angle < 90.0 && attack_data.angle < 90.0
@ -4094,7 +4102,8 @@ impl<'a> AgentData<'a> {
} }
self.pos.0 self.pos.0
+ PARTIAL_PATH_DIST + PARTIAL_PATH_DIST
* (sep_vec * SEPARATION_BIAS + (tgt_data.pos.0 - self.pos.0) * (1.0 - SEPARATION_BIAS)) * (sep_vec * SEPARATION_BIAS
+ (tgt_data.pos.0 - self.pos.0) * (1.0 - SEPARATION_BIAS))
.try_normalized() .try_normalized()
.unwrap_or_else(Vec3::zero) .unwrap_or_else(Vec3::zero)
} else if full_path { } else if full_path {