mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'timo-fix-hostile' into 'master'
Fix hostile npc's new target selection See merge request veloren/veloren!392
This commit is contained in:
commit
595f2bf1f1
@ -14,7 +14,7 @@ impl<'a> System<'a> for Sys {
|
||||
);
|
||||
|
||||
fn run(&mut self, (entities, mut agents, positions, mut controllers): Self::SystemData) {
|
||||
for (_entity, agent, pos, controller) in
|
||||
for (entity, agent, pos, controller) in
|
||||
(&entities, &mut agents, &positions, &mut controllers).join()
|
||||
{
|
||||
match agent {
|
||||
@ -88,8 +88,9 @@ impl<'a> System<'a> for Sys {
|
||||
if choose_new {
|
||||
let entities = (&entities, &positions)
|
||||
.join()
|
||||
.filter(|(_, e_pos)| {
|
||||
.filter(|(e, e_pos)| {
|
||||
Vec2::<f32>::from(e_pos.0 - pos.0).magnitude() < 30.0
|
||||
&& *e != entity
|
||||
})
|
||||
.map(|(e, _)| e)
|
||||
.collect::<Vec<_>>();
|
||||
|
Loading…
Reference in New Issue
Block a user