define(["lib/astar"],function(e){var t=Class.extend({init:function(e,t){this.width=e,this.height=t,this.grid=null,this.blankGrid=[],this.initBlankGrid_(),this.ignored=[]},initBlankGrid_:function(){for(var e=0;e<this.height;e+=1){this.blankGrid[e]=[];for(var t=0;t<this.width;t+=1)this.blankGrid[e][t]=0}},findPath:function(t,n,r,i,s){var o=[n.gridX,n.gridY],u=[r,i],a;return this.grid=t,this.applyIgnoreList_(!0),a=e(this.grid,o,u),a.length===0&&s===!0&&(a=this.findIncompletePath_(o,u)),a},findIncompletePath_:function(t,n){var r,i,s,o=[];r=e(this.blankGrid,t,n);for(var u=r.length-1;u>0;u-=1){i=r[u][0],s=r[u][1];if(this.grid[s][i]===0){o=e(this.grid,t,[i,s]);break}}return o},ignoreEntity:function(e){e&&this.ignored.push(e)},applyIgnoreList_:function(e){var t=this,n,r,i;_.each(this.ignored,function(i){n=i.isMoving()?i.nextGridX:i.gridX,r=i.isMoving()?i.nextGridY:i.gridY,n>=0&&r>=0&&(t.grid[r][n]=e?0:1)})},clearIgnoreList:function(){this.applyIgnoreList_(!1),this.ignored=[]}});return t});