From 0149ce70cd4bef729b57f7ac388b022f881b1720 Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sun, 13 Jul 2014 23:19:17 -0700 Subject: [PATCH] Close #56 : AI now only plan paths around things that are not moving at the time of pathfinding, they will walk through locations where AI are currently moving --- moonlight/src/Util.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/moonlight/src/Util.js b/moonlight/src/Util.js index cd103de..c4c1f20 100644 --- a/moonlight/src/Util.js +++ b/moonlight/src/Util.js @@ -300,10 +300,12 @@ function gridWithAISprites() // --- We have to normalize the (x,y) because this may be // called before the sprites are rebounded back inside the map, // and these references will go out of bounds - var normx = Math.max(parseInt(spr.x/32), 0); - var normy = Math.max(parseInt(spr.y/32), 0); - grid.nodes[normy][normx].walkable = false; - grid.nodes[normy][normx].isAISprite = true; + if ( getMoveState(spr) == false ) { + var normx = Math.max(parseInt(spr.x/32), 0); + var normy = Math.max(parseInt(spr.y/32), 0); + grid.nodes[normy][normx].walkable = false; + grid.nodes[normy][normx].isAISprite = true; + } } return grid; }