contrib/tinks: do not publish TankMoveEvents for dead tanks
authorAlexis Laferrière <alexis.laf@xymus.net>
Fri, 1 Jan 2016 23:06:34 +0000 (18:06 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Mon, 25 Jan 2016 19:10:43 +0000 (14:10 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

contrib/tinks/src/game/tanks.nit

index 9d82965..1289415 100644 (file)
@@ -94,7 +94,9 @@ class Tank
 
                turret.do_turn turn
 
-               turn.add new TankMoveEvent(self, pos, direction_heading, direction_forwards, heading, turret.relative_heading)
+               if health > 0 then
+                       turn.add new TankMoveEvent(self, pos, direction_heading, direction_forwards, heading, turret.relative_heading)
+               end
        end
 
        # What would be the next position if not blocked by terrain features?