# - type: nitro
# loc: [325,475]
+ autotest:
+ name: Automated AI Test
+ desc: AI test level.
+ width: 500
+ height: 500
+ bounds:
+ - [-50,-50, 600,50]
+ - [-50,0, 50,500]
+ - [501,0, 50,500]
+ - [-50,501, 600,50]
+ walls:
+ - type: wall
+ args: [300,50, 50,200] # [x,y, w,h]
+ - type: wall
+ args: [300,350, 50,100]
+ - type: wall
+ args: [100,100, 50,50]
+
+ - type: fence
+ args: [360,210, 30,30]
+ - type: rock
+ args: [400,200, 25,25]
+ - type: rock
+ args: [425,225, 25,25]
+ - type: fence
+ args: [460,210, 30,30]
+
+ - type: fence
+ args: [10,210, 30,30]
+ - type: fence
+ args: [110,210, 30,30]
+ - type: fence
+ args: [210,210, 30,30]
+
+ - type: rock
+ args: [50,350, 50,50]
+ - type: rock
+ args: [100,350, 50,50]
+ - type: rock
+ args: [50,400, 50,50]
+ - type: rock
+ args: [100,400, 50,50]
+ - type: rock
+ args: [150,300, 50,50]
+ units:
+ - type: blue
+ align: 1
+ loc: [425,425]
+ - type: blue
+ align: 1
+ loc: [125,475]
+ - type: blue
+ align: 1
+ loc: [175,425]
+ - type: green
+ align: 2
+ loc: [75,25]
+ - type: green
+ align: 2
+ loc: [175,25]
+ - type: green
+ align: 2
+ loc: [425,125]
+ # items:
+ # - type: nitro
+ # loc: [325,475]
+
los_test:
name: Line-of-Sight Test
desc: LOS test level.
var d = evt.data
, self = this;
+ this.pathsThisTick = 0;
NOW = this.NOW = d.now;
ELAPSED = this.ELAPSED = d.elapsed;
TICKS = this.TICKS = d.ticks;
SECONDTH = this.SECONDTH = ELAPSED / 1000;
- SQUARETH = this.SQUARETH = REF_SIZE * SECONDTH
+ SQUARETH = this.SQUARETH = REF_SIZE * SECONDTH;
this.active.invoke('updateCooldowns', ELAPSED, NOW);
this.active.invoke('act', ELAPSED, NOW);
this['continueMove'] =
function continueMove(){
- if ( !this.currentMove || this.ai.path.ready ){
+ if ( (!this.currentMove || this.ai.path.ready) && this.game.pathsThisTick < 1 ){
var target = this.game.map.findNearEnemies(this, 10000).shift();
if (target)
this.calculatePath(target.loc);
this['calculatePath'] =
function calculatePath(end){
- if ( !end || !this.ai.path.activate() ) return;
+ if ( !end || this.game.pathsThisTick >= 1 || !this.ai.path.activate() ) return;
// this.currentMove = null;
this.forceCurrentMove = false;
this.currentMoveLimit = -1;
+ this.game.pathsThisTick++;
var pm = this.game.map
, start = this.loc