mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Reduce creature flee speed
This commit is contained in:
parent
0ec5ea87d7
commit
4732d28e24
@ -574,6 +574,9 @@ impl<'a> AgentData<'a> {
|
|||||||
read_data: &ReadData,
|
read_data: &ReadData,
|
||||||
tgt_pos: &Pos,
|
tgt_pos: &Pos,
|
||||||
) {
|
) {
|
||||||
|
// Proportion of full speed
|
||||||
|
const MAX_FLEE_SPEED: f32 = 0.65;
|
||||||
|
|
||||||
if read_data.is_riders.contains(*self.entity) {
|
if read_data.is_riders.contains(*self.entity) {
|
||||||
controller.push_event(ControlEvent::Unmount);
|
controller.push_event(ControlEvent::Unmount);
|
||||||
}
|
}
|
||||||
@ -599,8 +602,8 @@ impl<'a> AgentData<'a> {
|
|||||||
..self.traversal_config
|
..self.traversal_config
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
controller.inputs.move_dir =
|
controller.inputs.move_dir = bearing.xy().try_normalized().unwrap_or_else(Vec2::zero)
|
||||||
bearing.xy().try_normalized().unwrap_or_else(Vec2::zero) * speed;
|
* speed.min(MAX_FLEE_SPEED);
|
||||||
self.jump_if(bearing.z > 1.5, controller);
|
self.jump_if(bearing.z > 1.5, controller);
|
||||||
controller.inputs.move_z = bearing.z;
|
controller.inputs.move_z = bearing.z;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user