mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Improved aggro system to reduce hyper-focused enemies
This commit is contained in:
parent
5e7e560c10
commit
87851293c2
@ -495,9 +495,19 @@ impl<'a> System<'a> for Sys {
|
|||||||
if let Some(old_tgt_pos) =
|
if let Some(old_tgt_pos) =
|
||||||
read_data.positions.get(old_tgt.target)
|
read_data.positions.get(old_tgt.target)
|
||||||
{
|
{
|
||||||
!old_tgt.aggro_on
|
// Fuzzy factor that makes it harder for
|
||||||
|| old_tgt_pos.0.distance_squared(pos.0)
|
// players to cheese enemies by making them
|
||||||
< tgt_pos.0.distance_squared(pos.0)
|
// quickly flip aggro between two players.
|
||||||
|
// It
|
||||||
|
// does this by only switching aggro if the
|
||||||
|
// new target is closer to the enemy by a
|
||||||
|
// specific proportional threshold.
|
||||||
|
const FUZZY_DIST_COMPARISON: f32 = 0.8;
|
||||||
|
// Only switch to new target if it is closer
|
||||||
|
// than the old target
|
||||||
|
tgt_pos.0.distance(pos.0)
|
||||||
|
< old_tgt_pos.0.distance(pos.0)
|
||||||
|
* FUZZY_DIST_COMPARISON
|
||||||
} else {
|
} else {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user