<?lua
  include("overlay/hudtemplates3.oxo")
  include("overlay/stats.oxo")
  include("levels/templates/spaceship_assff.oxt")
  include("levels/templates/spaceship_H2.oxt")
  include("levels/templates/spaceship_pirate.oxt")
?>

<Level
 name         = "Waypoints"
 description  = "Testing waypoings for AI controlled spaceships."
>
  <Scene
   ambientlight = "0.5, 0.5, 0.5"
   skybox       = "Orxonox/skypanoramagen1"
  >
    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />

    <SpawnPoint position="0,0,0" direction="1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />

    <SpaceShip position="0,2000,200" lookat="0,0,0">
      <templates>
        <Template link=spaceshipassff />
      </templates>
      <controller>
        <WaypointPatrolController alertnessradius=1000 team=10>
          <waypoints>
            <Model mesh="cube.mesh" scale=8 position="  0,2000,-200" />
            <Model mesh="cube.mesh" scale=8 position="  0,2000,-700" />
            <Model mesh="cube.mesh" scale=8 position="500,2000,-700" />
            <Model mesh="cube.mesh" scale=8 position="500,2000,-200" />
          </waypoints>
        </WaypointPatrolController>
      </controller>
    </SpaceShip>
    <SpaceShip position="0,2000,400" lookat="0,0,0">
      <templates>
        <Template link=spaceshipassff />
      </templates>
      <controller>
        <WaypointPatrolController alertnessradius=1000 team=10>
          <waypoints>
            <Model mesh="cube.mesh" scale=8 position="  0,2000,-200" />
            <Model mesh="cube.mesh" scale=8 position="  0,2000,-700" />
            <Model mesh="cube.mesh" scale=8 position="500,2000,-700" />
            <Model mesh="cube.mesh" scale=8 position="500,2000,-200" />
          </waypoints>
        </WaypointPatrolController>
      </controller>
    </SpaceShip>

    <SpaceShip position="1500,2000,200" lookat="0,0,0">
      <templates>
        <Template link=spaceshipassff />
      </templates>
      <controller>
        <WaypointPatrolController alertnessradius=1000 team=11>
          <waypoints>
            <Model mesh="cube.mesh" scale=8 position="1500,2000,-200" />
            <Model mesh="cube.mesh" scale=8 position="1500,2000,-700" />
            <Model mesh="cube.mesh" scale=8 position="1000,2000,-700" />
            <Model mesh="cube.mesh" scale=8 position="1000,2000,-200" />
          </waypoints>
        </WaypointPatrolController>
      </controller>
    </SpaceShip>

    <SpaceShip position="1500,-2000,200" lookat="0,0,0" name=polonaise1>
      <templates>
        <Template link=spaceshipassff />
      </templates>
      <controller>
        <WaypointPatrolController alertnessradius=1000 team=12>
          <waypoints>
            <Model mesh="cube.mesh" scale=8 position="1500,-2000,-200" />
<!--
            <Attacher target=polonaise6 deletewithparent=false />
            <Model mesh="cube.mesh" scale=8 position="1500,-2000,-700" />
            <Model mesh="cube.mesh" scale=8 position="1000,-2000,-700" />
            <Model mesh="cube.mesh" scale=8 position="1000,-2000,-200" />
-->
          </waypoints>
        </WaypointPatrolController>
      </controller>
    </SpaceShip>

<?lua
for i = 1, 5, 1
do ?>
    <SpaceShip position="1500,<?lua print(-2000 + 50*i) ?>,200" lookat="0,0,0" name=polonaise<?lua print(i+1) ?> >
      <templates>
        <Template link=spaceshipassff />
      </templates>
      <controller>
        <WaypointPatrolController alertnessradius=1000 team=12>
          <waypoints>
            <Attacher target=polonaise<?lua print(i) ?> deletewithparent=false />
          </waypoints>
        </WaypointPatrolController>
      </controller>
    </SpaceShip>
<?lua
end
?>


    <SpaceShip position="-1500,-2000,200" lookat="0,0,0" name=attack1>
      <templates>
        <Template link=spaceshipassff />
      </templates>
      <controller>
        <WaypointPatrolController alertnessradius=1000 team=13>
          <waypoints>
            <Model mesh="cube.mesh" scale=8 position="1500,-2000,-200" />
          </waypoints>
        </WaypointPatrolController>
      </controller>
    </SpaceShip>

<?lua
for i = 1, 5, 1
do ?>
    <SpaceShip position="-1500,<?lua print(-2000 + 50*i) ?>,200" lookat="0,0,0" name=attack<?lua print(i+1) ?> >
      <templates>
        <Template link=spaceshipassff />
      </templates>
      <controller>
        <WaypointPatrolController alertnessradius=1000 team=13>
          <waypoints>
            <Attacher target=attack<?lua print(i) ?> deletewithparent=false />
          </waypoints>
        </WaypointPatrolController>
      </controller>
    </SpaceShip>
<?lua
end
?>

<!--
<?lua
for i = 1, 50, 1
do ?>
    <SpaceShip position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" >
      <templates>
        <Template link=spaceshipassff />
      </templates>
      <controller>
        <AIController />
      </controller>
    </SpaceShip>
<?lua
end
?>
-->

  </Scene>
</Level>
