Index: code/branches/spacerace/data/levels/spaceRace.oxw
===================================================================
--- code/branches/spacerace/data/levels/spaceRace.oxw	(revision 8494)
+++ code/branches/spacerace/data/levels/spaceRace.oxw	(revision 8548)
@@ -37,72 +37,211 @@
   >
 
-    <?lua math.randomseed(99) ?>
+    <?lua math.randomseed(98) ?>
 
     <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 team=0 position="0,-2500,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
-
+
+    <!-- ------------------SpawnPoint----------------- -->
+    <SpawnPoint team=0 position="0,-2100,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="true" >
+      <events>
+        <activity>
+          <EventListener event="trigger1" />
+        </activity>
+      </events>
+    </SpawnPoint>
+    
     <!-- ------------------CheckPoints----------------- -->
-    <RaceCheckPoint name=checkpoint1 position="0,-2000,1000" scale=1 distance=20 checkpointindex=0 islast=false>
-    <attached>
-      <Model mass="100" scale="100" mesh="checkPoint.mesh" />
-    </attached>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name=checkpoint2 position="0,-1400,1400" scale=1 distance=20 checkpointindex=1 islast=false>
-    <attached>
-      <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
-    </attached>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name=checkpoint3 position="0,500,2500" scale=1 distance=20 checkpointindex=2 islast=false>
-    <attached>
-      <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
-    </attached>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name=checkpoint4 position="0,1500,1700" scale=1 distance=20 checkpointindex=3 islast=false>
-    <attached>
-      <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
-    </attached>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name=checkpoint5 position="0,2200,500" scale=1 distance=20 checkpointindex=4 islast=false>
-    <attached>
-      <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
-    </attached>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name=checkpoint6 position="0,1500,-800" scale=1 distance=20 checkpointindex=5 islast=false>
-    <attached>
-      <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
-    </attached>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name=checkpoint7 position="0,200,-1900" scale=1 distance=20 checkpointindex=6 islast=false>
-    <attached>
-      <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
-    </attached>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name=checkpoint8 position="0,-500,-1500" scale=1 distance=20 checkpointindex=7 islast=false>
-    <attached>
-      <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
-    </attached>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name=checkpoint9 position="0,-1300,-800" scale=1 distance=20 checkpointindex=8 islast=false>
-    <attached>
-      <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
-    </attached>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name=checkpoint10 position="0,-2500,0" scale=1 distance=20 checkpointindex=9 islast=true>
-    <attached>
-      <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
-    </attached>
-    </RaceCheckPoint>
-
-    <!-- ------------------Planet needs gravity----------------- -->
-    <Planet position="0,0,0" scale=400 pitch=-90 mesh="iceplanet.mesh" atmosphere="atmosphere1" rotationaxis="8,1,0" rotationrate="1" atmospheresize=224.0f imagesize=1024.0f />
+    <RaceCheckPoint name=checkpoint1 position="0,-2000,1000" direction="0,-1,1" collisionType="static" scale=1 distance=40 checkpointindex=0 islast=false>
+    <attached>
+      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
+    </attached>
+    <collisionShapes>
+      <BoxCollisionShape position="0,0,55"      halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="0,0,-55"     halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
+      <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
+    </collisionShapes>
+    </RaceCheckPoint>
+
+    <RaceCheckPoint name=checkpoint2 position="0,-900,2300" collisionType="static" scale=1 distance=40 checkpointindex=1 islast=false>
+    <attached>
+      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
+      <DistanceTrigger name="trigger1" position="0,0,0" distance=40 stayActive="true" />
+      <SpawnPoint team=0 position="0,0,0" lookat="0,700,2700" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+	<events>
+	  <activity>
+	    <EventListener event="trigger1" />
+	    <EventListener event="trigger2" />
+	  </activity>
+	</events>
+      </SpawnPoint>
+    </attached>
+    <collisionShapes>
+      <BoxCollisionShape position="0,0,55"      halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="0,0,-55"     halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
+      <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
+    </collisionShapes>
+    </RaceCheckPoint>
+
+    <RaceCheckPoint name=checkpoint3 position="0,700,2700" direction="0,0,1" collisionType="static" scale=1 distance=40 checkpointindex=2 islast=false>
+    <attached>
+      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
+      <DistanceTrigger name="trigger2" position="0,0,0" distance=40 stayActive="true" />
+      <SpawnPoint team=0 position="0,0,0" lookat="0,2100,2300" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+	<events>
+	  <activity>
+	    <EventListener event="trigger2" />
+	    <EventListener event="trigger3" />
+	  </activity>
+	</events>
+      </SpawnPoint>
+    </attached>
+     <collisionShapes>
+      <BoxCollisionShape position="0,0,55"      halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="0,0,-55"     halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
+      <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
+    </collisionShapes>
+    </RaceCheckPoint>
+
+    <RaceCheckPoint name=checkpoint4 position="0,2100,2300" direction="0,1,1" collisionType="static" scale=1 distance=40 checkpointindex=3 islast=false>
+   <attached>
+      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
+      <DistanceTrigger name="trigger3" position="0,0,0" distance=40 stayActive="true" />
+      <SpawnPoint team=0 position="0,0,0" lookat="0,2200,500" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+	<events>
+	  <activity>
+	    <EventListener event="trigger3" />
+	    <EventListener event="trigger4" />
+	  </activity>
+	</events>
+      </SpawnPoint>
+    </attached>
+     <collisionShapes>
+      <BoxCollisionShape position="0,0,55"      halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="0,0,-55"     halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
+      <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
+    </collisionShapes>
+    </RaceCheckPoint>
+
+    <RaceCheckPoint name=checkpoint5 position="0,2200,500" direction="0,1,0" collisionType="static" scale=1 distance=40 checkpointindex=4 islast=false>
+    <attached>
+      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
+      <DistanceTrigger name="trigger4" position="0,0,0" distance=40 stayActive="true" />
+      <SpawnPoint team=0 position="0,0,0" lookat="0,1500,-800" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+	<events>
+	  <activity>
+	    <EventListener event="trigger4" />
+	    <EventListener event="trigger5" />
+	  </activity>
+	</events>
+      </SpawnPoint>
+    </attached>
+     <collisionShapes>
+      <BoxCollisionShape position="0,0,55"      halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="0,0,-55"     halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
+      <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
+    </collisionShapes>
+    </RaceCheckPoint>
+
+    <RaceCheckPoint name=checkpoint6 position="0,1500,-800" direction="0,1,-1" collisionType="static" scale=1 distance=40 checkpointindex=5 islast=false>
+    <attached>
+      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
+      <DistanceTrigger name="trigger5" position="0,0,0" distance=40 stayActive="true" />
+      <SpawnPoint team=0 position="0,0,0" lookat="0,200,-1900" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+	<events>
+	  <activity>
+	    <EventListener event="trigger5" />
+	    <EventListener event="trigger6" />
+	  </activity>
+	</events>
+      </SpawnPoint>
+    </attached>
+     <collisionShapes>
+      <BoxCollisionShape position="0,0,55"      halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="0,0,-55"     halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
+      <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
+    </collisionShapes>
+    </RaceCheckPoint>
+
+    <RaceCheckPoint name=checkpoint7 position="0,200,-1900" collisionType="static" scale=1 distance=40 checkpointindex=6 islast=false>
+    <attached>
+      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
+      <DistanceTrigger name="trigger6" position="0,0,0" distance=40 stayActive="true" />
+      <SpawnPoint team=0 position="0,0,0" lookat="0,-700,-1400" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+	<events>
+	  <activity>
+	    <EventListener event="trigger6" />
+	    <EventListener event="trigger7" />
+	  </activity>
+	</events>
+      </SpawnPoint>
+    </attached>
+     <collisionShapes>
+      <BoxCollisionShape position="0,0,55"      halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="0,0,-55"     halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
+      <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
+    </collisionShapes>
+    </RaceCheckPoint>
+
+    <RaceCheckPoint name=checkpoint8 position="0,-700,-1400" direction="0,-1,-1" collisionType="static" scale=1 distance=40 checkpointindex=7 islast=false>
+    <attached>
+      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
+      <DistanceTrigger name="trigger7" position="0,0,0" distance=40 stayActive="true" />
+      <SpawnPoint team=0 position="0,0,0" lookat="0,-1300,-800" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+	<events>
+	  <activity>
+	    <EventListener event="trigger7" />
+	    <EventListener event="trigger8" />
+	  </activity>
+	</events>
+      </SpawnPoint>
+    </attached>
+     <collisionShapes>
+      <BoxCollisionShape position="0,0,55"      halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="0,0,-55"     halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
+      <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
+    </collisionShapes>
+    </RaceCheckPoint>
+
+    <RaceCheckPoint name=checkpoint9 position="0,-1300,-800" collisionType="static" scale=1 distance=40 checkpointindex=8 islast=false>
+    <attached>
+      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
+      <DistanceTrigger name="trigger8" position="0,0,0" distance=40 stayActive="true" />
+      <SpawnPoint team=0 position="0,0,0" lookat="0,-2400,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+	<events>
+	  <activity>
+	    <EventListener event="trigger8" />
+	  </activity>
+	</events>
+      </SpawnPoint>
+    </attached>
+     <collisionShapes>
+      <BoxCollisionShape position="0,0,55"      halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="0,0,-55"     halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
+      <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
+    </collisionShapes>
+    </RaceCheckPoint>
+
+    <RaceCheckPoint name=checkpoint10 position="0,-2100,0" collisionType="static" scale=1 distance=40 checkpointindex=9 islast=true>
+    <attached>
+      <Model mass="50" scale="50" mesh="checkPoint.mesh" />
+    </attached>
+     <collisionShapes>
+      <BoxCollisionShape position="0,0,55"      halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="0,0,-55"     halfExtents="55, 10, 10" />
+      <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
+      <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
+    </collisionShapes>
+    </RaceCheckPoint>
+
+    <!-- ------------------Planet----------------- -->
+    <Planet position="0,0,0" scale=300 pitch=-90 mesh="iceplanet.mesh" atmosphere="atmosphere1" rotationaxis="8,1,0" rotationrate="1" atmospheresize=224.0f imagesize=1024.0f />
     <StaticEntity position="0,0,0" collisionType=static>
 	<collisionShapes>
@@ -120,11 +259,18 @@
     x = 0
     ?>
-<?lua
-for k = 1, 20, 1
-do
-j = math.random()
-?>
-
-    <StaticEntity position="<?lua print(x + math.random() * 500) ?>,<?lua print(y + math.random() * 500) ?>,<?lua print(z + math.random() * 1000) ?>" scale="<?lua print(j * 5) ?>" >
+    <?lua
+    for k = 1, 15, 1
+    do
+    j = math.random()
+    ?>
+
+    <MovableEntity
+      position = "<?lua print(x + math.random() * 500) ?>,<?lua print(y + math.random() * 500) ?>,<?lua print(z + math.random() * 1000) ?>"
+      collisionType = "dynamic"
+      linearDamping = "0.5"
+      angularDamping = "0.01"
+      collisiondamage = "0.01"
+      enablecollisiondamage = "true"
+      scale="<?lua print(j * 5) ?>" >
       <attached>
         <Model position="0,0,0" scale="<?lua print(j * 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh">
@@ -134,35 +280,68 @@
 	</Model>
       </attached>
-      <?lua if i == 5 then ?><collisionShapes>
-        <SphereCollisionShape radius="<?lua print(j * 70) ?>" />
-      </collisionShapes> <?lua end ?>
-    </StaticEntity>
-<?lua
-end
-?>
-<?lua end ?>
-
-    <ForceField position="9000,9000,0" direction="-1,-1,0" diameter=500 velocity=5000 length=5000 />
-        <MovableEntity position="9000,9000,0">
+      <collisionShapes>
+        <SphereCollisionShape radius="<?lua print(j * 80) ?>" />
+      </collisionShapes>
+    </MovableEntity>
+    <?lua
+    end
+    ?>
+    <?lua end ?>
+
+    <!-- ---------------ForceFields----------------- -->
+    <ForceField position="0,-700,2700" direction="0,1,0" diameter=500 velocity=2000 length=600 />
+        <MovableEntity position="0,-400,2700">
+            <attached>
+                <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
+                <?lua for i=0,15,1 do ?>
+                    <Billboard position="-200,<?lua print(i*40) ?>,0" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+                    <Billboard position="200,<?lua print(i*40) ?>,0" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+                <?lua end ?>
+                </attached>
+        </MovableEntity>
+
+     <ForceField position="0,2500,2000" direction="0,0,-1" diameter=250 velocity=2000 length=600 />
+        <MovableEntity position="0,2500,2000">
+            <attached>
+                <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
+                <?lua for i=0,15,1 do ?>
+                    <Billboard position="-100,0,-<?lua print(i*40) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+                    <Billboard position="100,0,-<?lua print(i*40) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+                <?lua end ?>
+                </attached>
+        </MovableEntity>
+
+    <ForceField position="0,1300,-800" direction="0,-1,-1" diameter=250 velocity=2000 length=800 />
+        <MovableEntity position="0,1300,-800">
             <attached>
                 <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
                 <?lua for i=0,20,1 do ?>
-                    <Billboard position="<?lua print(-i*200*1.414/2) ?>,<?lua print(-i*200*1.414/2) ?>,-100" material="Examples/Flare" colour="0.5,0,0" scale=1/>
-                    <Billboard position="<?lua print(-i*200*1.414/2) ?>,<?lua print(-i*200*1.414/2) ?>,100" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+                    <Billboard position="-100,<?lua print(-i*40*0.7071) ?>,<?lua print(-i*40*0.7071) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+                    <Billboard position="100,<?lua print(-i*40*0.7071) ?>,<?lua print(-i*40*0.7071) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
                 <?lua end ?>
                 </attached>
         </MovableEntity>
 
-    <ForceField position="0,500,-2500" direction="1,1,0" diameter=500 velocity=5000 length=5000 />
-        <MovableEntity position="9000,9000,0">
+    <ForceField position="0,-1400,-700" direction="0,-1,1" diameter=250 velocity=2000 length=600 />
+        <MovableEntity position="0,-1400,-700">
             <attached>
                 <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
-                <?lua for i=0,20,1 do ?>
-                    <Billboard position="<?lua print(i*200*1.414/2) ?>,<?lua print(i*200*1.414/2) ?>,-100" material="Examples/Flare" colour="0.5,0,0" scale=1/>
-                    <Billboard position="<?lua print(i*200*1.414/2) ?>,<?lua print(i*200*1.414/2) ?>,100" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+                <?lua for i=0,15,1 do ?>
+                    <Billboard position="-100,<?lua print(-i*40*0.7071) ?>,<?lua print(i*40*0.7071) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+                    <Billboard position="100,<?lua print(-i*40*0.7071) ?>,<?lua print(i*40*0.7071) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
                 <?lua end ?>
                 </attached>
         </MovableEntity>
 
+    <!-- ---------------SpaceShips----------------- -->
+    <SpaceShip position="0,2000,2000" lookat="0,0,0" >
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <AIController />
+      </controller>
+    </SpaceShip>
+
   </Scene>
 </Level>
