Index: /code/branches/modularships/data/levels/emptyLevel.oxw
===================================================================
--- /code/branches/modularships/data/levels/emptyLevel.oxw	(revision 10010)
+++ /code/branches/modularships/data/levels/emptyLevel.oxw	(revision 10011)
@@ -16,4 +16,5 @@
   include("templates/spaceshipPirate.oxt")
   include("templates/spaceshipEscort.oxt")
+  include("templates/HeavyCruiser.oxt")
 ?>
 
@@ -91,4 +92,16 @@
     </Pawn>
     
+    <ModularSpaceShip position="0,-100,-200">
+      <templates>
+        <Template link=spaceshippirate />
+      </templates>
+    </ModularSpaceShip>
+    
+    <ModularSpaceShip position="0,-1000,-200">
+      <templates>
+        <Template link=HeavyCruiser />
+      </templates>
+    </ModularSpaceShip>
+    
   </Scene>
 </Level>
Index: /code/branches/modularships/data/levels/templates/HeavyCruiser.oxt
===================================================================
--- /code/branches/modularships/data/levels/templates/HeavyCruiser.oxt	(revision 10010)
+++ /code/branches/modularships/data/levels/templates/HeavyCruiser.oxt	(revision 10011)
@@ -2,5 +2,7 @@
 
 <Template name=HeavyCruiser>
-  <SpaceShip
+  <ModularSpaceShip
+   name = HeavyCruiser
+   
    hudtemplate            = spaceshiphud
    camerapositiontemplate = heavycruisercameras
@@ -47,15 +49,130 @@
       <MultiStateEngine position="140,0,308" template=HeavyCruiser_sidearmR_engine1 />
     </engines>
+    
+    <parts>
+        <ShipPart name="part0" />
+        <ShipPart name="part1" />
+    </parts>
+    
     <attached>
-
         <Model mesh="HeavyCruiser_body.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
-        <Model mesh="HeavyCruiser_frontL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
-        <Model mesh="HeavyCruiser_frontR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
-        <Model mesh="HeavyCruiser_partL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
-        <Model mesh="HeavyCruiser_partR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
-        <Model mesh="HeavyCruiser_sidearmL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
-        <Model mesh="HeavyCruiser_sidearmLfront.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
-        <Model mesh="HeavyCruiser_sidearmR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
-        <Model mesh="HeavyCruiser_sidearmRfront.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>       
+        
+        <StaticEntity name="frontL" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+            <attached> 
+                <Model mesh="HeavyCruiser_frontL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+            </attached> 
+            <collisionShapes> 
+                <BoxCollisionShape position="-80,33,-320" halfExtents="7,11,54" info="frontL"/>
+                <BoxCollisionShape position="-79,31,-399" halfExtents="3,6,26" info="frontL"/>
+            </collisionShapes> 
+        </StaticEntity>
+        
+        <StaticEntity name="frontR" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+            <attached> 
+                <Model mesh="HeavyCruiser_frontR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+            </attached> 
+            <collisionShapes> 
+                <BoxCollisionShape position="80,33,-320" halfExtents="7,11,54" info="frontR"/>
+                <BoxCollisionShape position="79,31,-399" halfExtents="3,6,26" info="frontR"/>
+            </collisionShapes> 
+        </StaticEntity>
+        
+        <StaticEntity name="partL" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+            <attached> 
+                <Model mesh="HeavyCruiser_partL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+            </attached> 
+            <collisionShapes> 
+                <BoxCollisionShape position="-94,33,-179" halfExtents="11,13,45" info="partL"/>
+                <BoxCollisionShape position="-96,33,-230" halfExtents="13,17,22" info="partL"/>
+            </collisionShapes> 
+        </StaticEntity>
+        
+        <StaticEntity name="partR" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+            <attached> 
+                <Model mesh="HeavyCruiser_partR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+            </attached> 
+            <collisionShapes> 
+                <BoxCollisionShape position="94,33,-179" halfExtents="11,13,45" info="partR"/>
+                <BoxCollisionShape position="96,33,-230" halfExtents="13,17,22" info="partR"/>
+            </collisionShapes> 
+        </StaticEntity>
+        
+                <StaticEntity name="sidearmL" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+            <attached> 
+                <Model mesh="HeavyCruiser_sidearmL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+            </attached> 
+            <collisionShapes> 
+                <BoxCollisionShape position="-109,47,87" halfExtents="29,8,26" info="sidearmL, upper connection"/>
+                <BoxCollisionShape position="-99,-1,79" roll="15" halfExtents="40,4,9" info="sidearmL, lower connection"/>
+                <BoxCollisionShape position="-145,21,115" roll="15" halfExtents="19,31,105" info="sidearmL, front"/>
+                <BoxCollisionShape position="-140,12,261" roll="15" halfExtents="22,41,43" info="sidearmL, back"/>
+                <BoxCollisionShape position="-145,25,5" roll="15" halfExtents="10,18,5" info="sidearmL, front break"/>
+                <BoxCollisionShape position="-133,-13,29" roll="15" halfExtents="12,6,17" info="sidearmL, bottom cylinder"/>
+                <BoxCollisionShape position="-165,-4,31" roll="15" halfExtents="7,21,13" info="sidearmL, box"/>
+                <BoxCollisionShape position="-153,59,96" roll="15" halfExtents="6,7,60" info="sidearmL, upper beam"/>
+                <BoxCollisionShape position="-143,57,119" roll="15" halfExtents="3,4,85" info="sidearmL, upper inner beam"/>
+                <BoxCollisionShape position="-142,53,212" pitch="21" yaw="5" roll="15" halfExtents="3,4,10" info="sidearmL, upper inner beam"/>
+                <BoxCollisionShape position="-160,52,119" roll="15" halfExtents="3,4,85" info="sidearmL, upper outer beam"/>
+                <BoxCollisionShape position="-159,48,212" pitch="21" yaw="5" roll="15" halfExtents="3,4,10" info="sidearmL, upper outer beam"/>
+                <BoxCollisionShape position="-152,54,34" pitch="-46" yaw="-14" roll="15" halfExtents="6,7,10" info="sidearmL, upper beam front"/>
+                <BoxCollisionShape position="-152,54,162" pitch="30" yaw="9" roll="15" halfExtents="6,7,12" info="sidearmL, upper beam back"/>
+                <BoxCollisionShape position="-168,21,119" roll="15" halfExtents="3,5,109" info="sidearmL, outer beam"/>
+                <BoxCollisionShape position="-134,-10,169" roll="15" halfExtents="6,4,55" info="sidearmL, lower beam front"/>
+                <BoxCollisionShape position="-131,-20,217" pitch="-20" roll="15" yaw="-5" halfExtents="6,12,3" info="sidearmL, lower beam middle"/>
+                <BoxCollisionShape position="-130,-29,233" roll="15" halfExtents="6,3,15" info="sidearmL, lower beam back"/>
+            </collisionShapes> 
+        </StaticEntity>
+        
+        <StaticEntity name="sidearmLfront" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+            <attached> 
+                <Model mesh="HeavyCruiser_sidearmLfront.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+            </attached> 
+            <collisionShapes> 
+                <BoxCollisionShape position="-141,15,-53" roll="15" halfExtents="27,44,62" info="sidearmLfront"/>
+                <BoxCollisionShape position="-153,59,-30" roll="15" halfExtents="4,2,38" info="sidearmLfront, top"/>
+                <BoxCollisionShape position="-153,61,-41" roll="15" halfExtents="4,4,11" info="sidearmLfront, top"/>
+                <BoxCollisionShape position="-153,60,-65" roll="15" halfExtents="4,3,4" info="sidearmLfront, top"/>
+                <BoxCollisionShape position="-153,59,-41" roll="15" halfExtents="8,2,11" info="sidearmLfront, top"/>
+            </collisionShapes> 
+        </StaticEntity>
+        
+        <StaticEntity name="sidearmR" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+            <attached> 
+                <Model mesh="HeavyCruiser_sidearmR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+            </attached> 
+            <collisionShapes> 
+                <BoxCollisionShape position="109,47,87" halfExtents="29,8,26" info="sidearmR, upper connection"/>
+                <BoxCollisionShape position="99,-1,79" roll="-15" halfExtents="40,4,9" info="sidearmR, lower connection"/>
+                <BoxCollisionShape position="145,21,115" roll="-15" halfExtents="19,31,105" info="sidearmR, front"/>
+                <BoxCollisionShape position="140,12,261" roll="-15" halfExtents="22,41,43" info="sidearmR, back"/>
+                <BoxCollisionShape position="145,25,5" roll="-15" halfExtents="10,18,5" info="sidearmR, front break"/>
+                <BoxCollisionShape position="133,-13,29" roll="-15" halfExtents="12,6,17" info="sidearmR, bottom cylinder"/>
+                <BoxCollisionShape position="165,-4,31" roll="-15" halfExtents="7,21,13" info="sidearmR, box"/>
+                <BoxCollisionShape position="153,59,96" roll="-15" halfExtents="6,7,60" info="sidearmR, upper beam"/>
+                <BoxCollisionShape position="143,57,119" roll="-15" halfExtents="3,4,85" info="sidearmR, upper inner beam"/>
+                <BoxCollisionShape position="142,53,212" pitch="21" yaw="-5" roll="-15" halfExtents="3,4,10" info="sidearmR, upper inner beam"/>
+                <BoxCollisionShape position="160,52,119" roll="-15" halfExtents="3,4,85" info="sidearmR, upper outer beam"/>
+                <BoxCollisionShape position="159,48,212" pitch="21" yaw="-5" roll="-15" halfExtents="3,4,10" info="sidearmR, upper outer beam"/>
+                <BoxCollisionShape position="152,54,34" pitch="-46" yaw="14" roll="-15" halfExtents="6,7,10" info="sidearmR, upper beam front"/>
+                <BoxCollisionShape position="152,54,162" pitch="30" yaw="-9" roll="-15" halfExtents="6,7,12" info="sidearmR, upper beam back"/>
+                <BoxCollisionShape position="168,21,119" roll="-15" halfExtents="3,5,109" info="sidearmR, outer beam"/>
+                <BoxCollisionShape position="134,-10,169" roll="-15" halfExtents="6,4,55" info="sidearmR, lower beam front"/>
+                <BoxCollisionShape position="131,-20,217" pitch="-20" roll="-15" yaw="5" halfExtents="6,12,3" info="sidearmR, lower beam middle"/>
+                <BoxCollisionShape position="130,-29,233" roll="-15" halfExtents="6,3,15" info="sidearmR, lower beam back"/>
+            </collisionShapes> 
+        </StaticEntity>
+        
+        <StaticEntity name="sidearmRfront" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+            <attached> 
+                <Model mesh="HeavyCruiser_sidearmRfront.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+            </attached> 
+            <collisionShapes> 
+                <BoxCollisionShape position="141,15,-53" roll="-15" halfExtents="27,44,62" info="sidearmRfront"/>
+                <BoxCollisionShape position="153,59,-30" roll="-15" halfExtents="4,2,38" info="sidearmRfront, top"/>
+                <BoxCollisionShape position="153,61,-41" roll="-15" halfExtents="4,4,11" info="sidearmRfront, top"/>
+                <BoxCollisionShape position="153,60,-65" roll="-15" halfExtents="4,3,4" info="sidearmRfront, top"/>
+                <BoxCollisionShape position="153,59,-41" roll="-15" halfExtents="8,2,11" info="sidearmRfront, top"/>
+            </collisionShapes> 
+        </StaticEntity>   
 
             <!-- bay1 lights -->
@@ -79,74 +196,4 @@
     </attached>
     <collisionShapes>
-        <BoxCollisionShape position="80,33,-320" halfExtents="7,11,54" info="frontR"/>
-        <BoxCollisionShape position="79,31,-399" halfExtents="3,6,26" info="frontR"/>
-
-
-        <BoxCollisionShape position="-80,33,-320" halfExtents="7,11,54" info="frontL"/>
-        <BoxCollisionShape position="-79,31,-399" halfExtents="3,6,26" info="frontL"/>
-
-
-        <BoxCollisionShape position="94,33,-179" halfExtents="11,13,45" info="partR"/>
-        <BoxCollisionShape position="96,33,-230" halfExtents="13,17,22" info="partR"/>
-
-
-        <BoxCollisionShape position="-94,33,-179" halfExtents="11,13,45" info="partL"/>
-        <BoxCollisionShape position="-96,33,-230" halfExtents="13,17,22" info="partL"/>
-
-
-        <BoxCollisionShape position="109,47,87" halfExtents="29,8,26" info="sidearmR, upper connection"/>
-        <BoxCollisionShape position="99,-1,79" roll="-15" halfExtents="40,4,9" info="sidearmR, lower connection"/>
-        <BoxCollisionShape position="145,21,115" roll="-15" halfExtents="19,31,105" info="sidearmR, front"/>
-        <BoxCollisionShape position="140,12,261" roll="-15" halfExtents="22,41,43" info="sidearmR, back"/>
-        <BoxCollisionShape position="145,25,5" roll="-15" halfExtents="10,18,5" info="sidearmR, front break"/>
-        <BoxCollisionShape position="133,-13,29" roll="-15" halfExtents="12,6,17" info="sidearmR, bottom cylinder"/>
-        <BoxCollisionShape position="165,-4,31" roll="-15" halfExtents="7,21,13" info="sidearmR, box"/>
-        <BoxCollisionShape position="153,59,96" roll="-15" halfExtents="6,7,60" info="sidearmR, upper beam"/>
-        <BoxCollisionShape position="143,57,119" roll="-15" halfExtents="3,4,85" info="sidearmR, upper inner beam"/>
-        <BoxCollisionShape position="142,53,212" pitch="21" yaw="-5" roll="-15" halfExtents="3,4,10" info="sidearmR, upper inner beam"/>
-        <BoxCollisionShape position="160,52,119" roll="-15" halfExtents="3,4,85" info="sidearmR, upper outer beam"/>
-        <BoxCollisionShape position="159,48,212" pitch="21" yaw="-5" roll="-15" halfExtents="3,4,10" info="sidearmR, upper outer beam"/>
-        <BoxCollisionShape position="152,54,34" pitch="-46" yaw="14" roll="-15" halfExtents="6,7,10" info="sidearmR, upper beam front"/>
-        <BoxCollisionShape position="152,54,162" pitch="30" yaw="-9" roll="-15" halfExtents="6,7,12" info="sidearmR, upper beam back"/>
-        <BoxCollisionShape position="168,21,119" roll="-15" halfExtents="3,5,109" info="sidearmR, outer beam"/>
-        <BoxCollisionShape position="134,-10,169" roll="-15" halfExtents="6,4,55" info="sidearmR, lower beam front"/>
-        <BoxCollisionShape position="131,-20,217" pitch="-20" roll="-15" yaw="5" halfExtents="6,12,3" info="sidearmR, lower beam middle"/>
-        <BoxCollisionShape position="130,-29,233" roll="-15" halfExtents="6,3,15" info="sidearmR, lower beam back"/>
-
-
-        <BoxCollisionShape position="141,15,-53" roll="-15" halfExtents="27,44,62" info="sidearmRfront"/>
-        <BoxCollisionShape position="153,59,-30" roll="-15" halfExtents="4,2,38" info="sidearmRfront, top"/>
-        <BoxCollisionShape position="153,61,-41" roll="-15" halfExtents="4,4,11" info="sidearmRfront, top"/>
-        <BoxCollisionShape position="153,60,-65" roll="-15" halfExtents="4,3,4" info="sidearmRfront, top"/>
-        <BoxCollisionShape position="153,59,-41" roll="-15" halfExtents="8,2,11" info="sidearmRfront, top"/>
-
-
-        <BoxCollisionShape position="-109,47,87" halfExtents="29,8,26" info="sidearmL, upper connection"/>
-        <BoxCollisionShape position="-99,-1,79" roll="15" halfExtents="40,4,9" info="sidearmL, lower connection"/>
-        <BoxCollisionShape position="-145,21,115" roll="15" halfExtents="19,31,105" info="sidearmL, front"/>
-        <BoxCollisionShape position="-140,12,261" roll="15" halfExtents="22,41,43" info="sidearmL, back"/>
-        <BoxCollisionShape position="-145,25,5" roll="15" halfExtents="10,18,5" info="sidearmL, front break"/>
-        <BoxCollisionShape position="-133,-13,29" roll="15" halfExtents="12,6,17" info="sidearmL, bottom cylinder"/>
-        <BoxCollisionShape position="-165,-4,31" roll="15" halfExtents="7,21,13" info="sidearmL, box"/>
-        <BoxCollisionShape position="-153,59,96" roll="15" halfExtents="6,7,60" info="sidearmL, upper beam"/>
-        <BoxCollisionShape position="-143,57,119" roll="15" halfExtents="3,4,85" info="sidearmL, upper inner beam"/>
-        <BoxCollisionShape position="-142,53,212" pitch="21" yaw="5" roll="15" halfExtents="3,4,10" info="sidearmL, upper inner beam"/>
-        <BoxCollisionShape position="-160,52,119" roll="15" halfExtents="3,4,85" info="sidearmL, upper outer beam"/>
-        <BoxCollisionShape position="-159,48,212" pitch="21" yaw="5" roll="15" halfExtents="3,4,10" info="sidearmL, upper outer beam"/>
-        <BoxCollisionShape position="-152,54,34" pitch="-46" yaw="-14" roll="15" halfExtents="6,7,10" info="sidearmL, upper beam front"/>
-        <BoxCollisionShape position="-152,54,162" pitch="30" yaw="9" roll="15" halfExtents="6,7,12" info="sidearmL, upper beam back"/>
-        <BoxCollisionShape position="-168,21,119" roll="15" halfExtents="3,5,109" info="sidearmL, outer beam"/>
-        <BoxCollisionShape position="-134,-10,169" roll="15" halfExtents="6,4,55" info="sidearmL, lower beam front"/>
-        <BoxCollisionShape position="-131,-20,217" pitch="-20" roll="15" yaw="-5" halfExtents="6,12,3" info="sidearmL, lower beam middle"/>
-        <BoxCollisionShape position="-130,-29,233" roll="15" halfExtents="6,3,15" info="sidearmL, lower beam back"/>
-
-
-        <BoxCollisionShape position="-141,15,-53" roll="15" halfExtents="27,44,62" info="sidearmLfront"/>
-        <BoxCollisionShape position="-153,59,-30" roll="15" halfExtents="4,2,38" info="sidearmLfront, top"/>
-        <BoxCollisionShape position="-153,61,-41" roll="15" halfExtents="4,4,11" info="sidearmLfront, top"/>
-        <BoxCollisionShape position="-153,60,-65" roll="15" halfExtents="4,3,4" info="sidearmLfront, top"/>
-        <BoxCollisionShape position="-153,59,-41" roll="15" halfExtents="8,2,11" info="sidearmLfront, top"/>
-
-
         <BoxCollisionShape position="60,35,-310" halfExtents="13,28,60" info="body, bay1, Rwall"/> 
         <BoxCollisionShape position="-60,35,-310" halfExtents="13,28,60" info="body, bay1, Lwall"/> 
@@ -293,5 +340,5 @@
   include("../includes/weaponSettingsHeavyCruiser.oxi")
 ?>
-  </SpaceShip>
+  </ModularSpaceShip>
 
 </Template>
Index: /code/branches/modularships/src/modules/weapons/projectiles/BasicProjectile.cc
===================================================================
--- /code/branches/modularships/src/modules/weapons/projectiles/BasicProjectile.cc	(revision 10010)
+++ /code/branches/modularships/src/modules/weapons/projectiles/BasicProjectile.cc	(revision 10011)
@@ -78,5 +78,5 @@
     @see Pawn.h
     */
-    bool BasicProjectile::processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+    bool BasicProjectile::processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs)
     {
         if (!this->bDestroy_ && GameMode::isMaster())
@@ -96,5 +96,5 @@
             if (victim)
             {
-                victim->hit(this->getShooter(), contactPoint, this->getDamage(), this->getHealthDamage(), this->getShieldDamage());
+                victim->hit(this->getShooter(), contactPoint, cs, this->getDamage(), this->getHealthDamage(), this->getShieldDamage());
                 victim->startReloadCountdown();
             }
@@ -141,66 +141,4 @@
     }
 
-    bool BasicProjectile::customProcessCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs)
-        {
-            if (!this->bDestroy_ && GameMode::isMaster())
-            {
-                if (otherObject == this->getShooter()) // Prevents you from shooting yourself
-                    return false;
-
-                this->bDestroy_ = true; // If something is hit, the object is destroyed and can't hit something else.
-                                        // The projectile is destroyed by its tick()-function (in the following tick).
-
-                Pawn* victim = orxonox_cast<Pawn*>(otherObject); // If otherObject isn't a Pawn, then victim is NULL
-
-                WorldEntity* entity = orxonox_cast<WorldEntity*>(this);
-                assert(entity); // The projectile must not be a WorldEntity.
-
-                // If visual effects after destruction cause problems, put this block below the effects code block
-                if (victim)
-                {
-                    victim->customHit(this->getShooter(), contactPoint, cs, this->getDamage(), this->getHealthDamage(), this->getShieldDamage());
-                    victim->startReloadCountdown();
-                }
-
-                // Visual effects for being hit, depending on whether the shield is hit or not
-                if (this->getShooter()) // If the owner does not exist (anymore?), no effects are displayed.
-                {
-                    // Damping and explosion effect is only played if the victim is no Pawn (see cast above)
-                    // or if the victim is a Pawn, has no shield left, is still alive and any damage goes to the health
-                    if (!victim || (victim && !victim->hasShield() && victim->getHealth() > 0.0f && (this->getDamage() > 0.0f || this->getHealthDamage() > 0.0f)))
-                    {
-                        {
-                            ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getContext());
-                            effect->setPosition(entity->getPosition());
-                            effect->setOrientation(entity->getOrientation());
-                            effect->setDestroyAfterLife(true);
-                            effect->setSource("Orxonox/explosion3");
-                            effect->setLifetime(2.0f);
-                        }
-                        // Second effect with same condition
-                        {
-                            ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getContext());
-                            effect->setPosition(entity->getPosition());
-                            effect->setOrientation(entity->getOrientation());
-                            effect->setDestroyAfterLife(true);
-                            effect->setSource("Orxonox/smoke4");
-                            effect->setLifetime(3.0f);
-                        }
-                    }
-
-                    // victim->isAlive() is not false until the next tick, so getHealth() > 0 is used instead
-                    if (victim && victim->hasShield() && (this->getDamage() > 0.0f || this->getShieldDamage() > 0.0f) && victim->getHealth() > 0.0f)
-                    {
-                        ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getContext());
-                        effect->setDestroyAfterLife(true);
-                        effect->setSource("Orxonox/Shield");
-                        effect->setLifetime(0.5f);
-                        victim->attach(effect);
-                    }
-                }
-                return true;
-            }
-            return false;
-        }
 
     /**
Index: /code/branches/modularships/src/modules/weapons/projectiles/BasicProjectile.h
===================================================================
--- /code/branches/modularships/src/modules/weapons/projectiles/BasicProjectile.h	(revision 10010)
+++ /code/branches/modularships/src/modules/weapons/projectiles/BasicProjectile.h	(revision 10011)
@@ -119,6 +119,5 @@
 
         protected:
-            bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint);
-            bool customProcessCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs);
+            bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs);
             void destroyCheck(void);
 
Index: /code/branches/modularships/src/modules/weapons/projectiles/Projectile.cc
===================================================================
--- /code/branches/modularships/src/modules/weapons/projectiles/Projectile.cc	(revision 10010)
+++ /code/branches/modularships/src/modules/weapons/projectiles/Projectile.cc	(revision 10011)
@@ -88,12 +88,7 @@
     }
 
-    bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+    bool Projectile::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
     {
-        return this->processCollision(otherObject, contactPoint);
-    }
-
-    bool Projectile::customCollidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
-    {
-        return this->customProcessCollision(otherObject, contactPoint, cs);
+        return this->processCollision(otherObject, contactPoint, cs);
     }
 
Index: /code/branches/modularships/src/modules/weapons/projectiles/Projectile.h
===================================================================
--- /code/branches/modularships/src/modules/weapons/projectiles/Projectile.h	(revision 10010)
+++ /code/branches/modularships/src/modules/weapons/projectiles/Projectile.h	(revision 10011)
@@ -64,6 +64,5 @@
 
             virtual void tick(float dt);
-            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
-            virtual bool customCollidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
+            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
 
         private:
Index: /code/branches/modularships/src/modules/weapons/projectiles/Rocket.cc
===================================================================
--- /code/branches/modularships/src/modules/weapons/projectiles/Rocket.cc	(revision 10010)
+++ /code/branches/modularships/src/modules/weapons/projectiles/Rocket.cc	(revision 10011)
@@ -191,12 +191,7 @@
     }
 
-    bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
-    {
-        return this->processCollision(otherObject, contactPoint);
-    }
-
-    bool Rocket::customCollidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
-    {
-        return this->customProcessCollision(otherObject, contactPoint, cs);
+    bool Rocket::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
+    {
+        return this->processCollision(otherObject, contactPoint, cs);
     }
 
Index: /code/branches/modularships/src/modules/weapons/projectiles/Rocket.h
===================================================================
--- /code/branches/modularships/src/modules/weapons/projectiles/Rocket.h	(revision 10010)
+++ /code/branches/modularships/src/modules/weapons/projectiles/Rocket.h	(revision 10011)
@@ -64,6 +64,5 @@
             virtual void tick(float dt); //!< Defines which actions the Rocket has to take in each tick.
 
-            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
-            virtual bool customCollidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
+            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
             virtual void destroyObject(void);
             void destructionEffect();
Index: /code/branches/modularships/src/modules/weapons/projectiles/SimpleRocket.cc
===================================================================
--- /code/branches/modularships/src/modules/weapons/projectiles/SimpleRocket.cc	(revision 10010)
+++ /code/branches/modularships/src/modules/weapons/projectiles/SimpleRocket.cc	(revision 10011)
@@ -172,12 +172,7 @@
     }
 
-    bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
-    {
-        return this->processCollision(otherObject, contactPoint);
-    }
-
-    bool SimpleRocket::customCollidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
-    {
-        return this->customProcessCollision(otherObject, contactPoint, cs);
+    bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
+    {
+        return this->processCollision(otherObject, contactPoint, cs);
     }
 
Index: /code/branches/modularships/src/modules/weapons/projectiles/SimpleRocket.h
===================================================================
--- /code/branches/modularships/src/modules/weapons/projectiles/SimpleRocket.h	(revision 10010)
+++ /code/branches/modularships/src/modules/weapons/projectiles/SimpleRocket.h	(revision 10011)
@@ -64,6 +64,5 @@
             virtual void tick(float dt);
 
-            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
-            virtual bool customCollidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
+            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
 
             void disableFire(); //!< Method to disable the fire and stop all acceleration
Index: /code/branches/modularships/src/orxonox/CMakeLists.txt
===================================================================
--- /code/branches/modularships/src/orxonox/CMakeLists.txt	(revision 10010)
+++ /code/branches/modularships/src/orxonox/CMakeLists.txt	(revision 10011)
@@ -32,4 +32,5 @@
   PlayerManager.cc
   Radar.cc
+  ShipPart.cc
 #  Test.cc
 
Index: /code/branches/modularships/src/orxonox/Scene.cc
===================================================================
--- /code/branches/modularships/src/orxonox/Scene.cc	(revision 10010)
+++ /code/branches/modularships/src/orxonox/Scene.cc	(revision 10011)
@@ -201,5 +201,5 @@
             // Note: This is a global variable which we assign a static function.
             // TODO: Check whether this (or anything about Bullet) works with multiple physics engine instances.
-            gContactAddedCallback = &Scene::customCollisionCallback;
+            gContactAddedCallback = &Scene::collisionCallback;
         }
         else if (!wantPhysics && hasPhysics())
@@ -349,33 +349,16 @@
         SmartPtr<WorldEntity> object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
 
+        // get the CollisionShape pointers
+        const btCollisionShape* cs0 = colObj0->getCollisionShape();
+        const btCollisionShape* cs1 = colObj1->getCollisionShape();
+
         // false means that bullet will assume we didn't modify the contact
         bool modified = false;
         if (object0->isCollisionCallbackActive())
-            modified |= object0->collidesAgainst(object1, cp);
+            modified |= object0->collidesAgainst(object1, cs1, cp);
         if (object1->isCollisionCallbackActive())
-            modified |= object1->collidesAgainst(object0, cp);
+            modified |= object1->collidesAgainst(object0, cs0, cp);
 
         return modified;
     }
-
-    /* ADDED static*/ bool Scene::customCollisionCallback(btManifoldPoint& cp, const btCollisionObject* colObj0, int partId0,
-                                             int index0, const btCollisionObject* colObj1, int partId1, int index1)
-    {
-        // get the WorldEntity pointers
-        SmartPtr<WorldEntity> object0 = static_cast<WorldEntity*>(colObj0->getUserPointer());
-        SmartPtr<WorldEntity> object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
-
-        // get the CollisionShape pointers
-        const btCollisionShape* cs0 = colObj0->getCollisionShape();
-        const btCollisionShape* cs1 = colObj1->getCollisionShape();
-
-        // false means that bullet will assume we didn't modify the contact
-        bool modified = false;
-        if (object0->isCollisionCallbackActive())
-            modified |= object0->customCollidesAgainst(object1, cs1, cp);
-        if (object1->isCollisionCallbackActive())
-            modified |= object1->customCollidesAgainst(object0, cs0, cp);
-
-        return modified;
-    }
 }
Index: /code/branches/modularships/src/orxonox/ShipPart.cc
===================================================================
--- /code/branches/modularships/src/orxonox/ShipPart.cc	(revision 10010)
+++ /code/branches/modularships/src/orxonox/ShipPart.cc	(revision 10011)
@@ -35,4 +35,8 @@
 #include "core/XMLPort.h"
 #include "network/NetworkFunction.h"
+#include "items/Item.h"
+#include "worldentities/pawns/Pawn.h"
+#include "gametypes/Gametype.h"
+#include "worldentities/pawns/ModularSpaceShip.h"
 
 
@@ -42,6 +46,7 @@
 
     ShipPart::ShipPart(Context* context)
+        : Item(context)
     {
-        //RegisterObject(ShipPart);
+        RegisterObject(ShipPart);
     }
 
@@ -51,3 +56,94 @@
     }
 
+
+    /**
+    @brief
+        Add a StaticEntity to the ShipPart.
+    @param engine
+        A pointer to the StaticEntity to be added.
+    */
+    void ShipPart::addEntity(StaticEntity* entity)
+    {
+        OrxAssert(entity != NULL, "The Entity cannot be NULL.");
+        this->entityList_.push_back(entity);
+        //part->addToSpaceShip(this); //FIXME: (noep) add
+    }
+
+    /**
+    @brief
+        Get the i-th StaticEntity of the ShipPart.
+    @return
+        Returns a pointer to the i-the StaticEntity. NULL if there is no StaticEntity with that index.
+    */
+    StaticEntity* ShipPart::getEntity(unsigned int index)
+    {
+        if(this->entityList_.size() >= index)
+            return NULL;
+        else
+            return this->entityList_[index];
+    }
+
+    void ShipPart::setDamageAbsorption(float value)
+    {
+        this->damageAbsorption_ = value;
+    }
+
+    /**
+    @brief
+        Sets the health of the ShipPart.
+    */
+    void ShipPart::setHealth(float health)
+    {
+        this->health_ = health;
+    }
+
+    /**
+    @brief
+        Handles a received hit.
+    */
+    void ShipPart::handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator)
+    {
+        if (parent_->getGametype() && parent_->getGametype()->allowPawnDamage(parent_, originator))
+        {
+            if (shielddamage >= parent_->getShieldHealth())
+            {
+                parent_->setShieldHealth(0);
+                this->setHealth(this->health_ - (healthdamage + damage) * this->damageAbsorption_);
+                parent_->setHealth(parent_->getHealth() - (healthdamage + damage) * (1 - this->damageAbsorption_));
+            }
+            else
+            {
+                parent_->setShieldHealth(parent_->getShieldHealth() - shielddamage);
+
+                // remove remaining shieldAbsorpton-Part of damage from shield
+                shielddamage = damage * parent_->getShieldAbsorption();
+                shielddamage = std::min(parent_->getShieldHealth(),shielddamage);
+                parent_->setShieldHealth(parent_->getShieldHealth() - shielddamage);
+
+                // set remaining damage to health
+                this->setHealth(this->health_ - ((damage - shielddamage) - healthdamage) * this->damageAbsorption_);
+                parent_->setHealth(parent_->getHealth() - ((damage - shielddamage) - healthdamage) * (1- this->damageAbsorption_));
+            }
+        }
+    }
+
+
+    /**
+    @brief
+        Adds the ShipPart to the input SpaceShip.
+    @param ship
+        A pointer to the SpaceShip to which the ShipPart is added.
+    */
+    /*void ShipPart::addToSpaceShip(ModularSpaceShip* ship)
+    {
+        this->parent_ = ship;
+
+        if (ship)
+        {
+            this->parentID_ = ship->getObjectID();
+            if (!ship->hasShipPart(this))
+                ship->addShipPart(this);
+        }
+    }*/
+
 }
Index: /code/branches/modularships/src/orxonox/ShipPart.h
===================================================================
--- /code/branches/modularships/src/orxonox/ShipPart.h	(revision 10010)
+++ /code/branches/modularships/src/orxonox/ShipPart.h	(revision 10011)
@@ -31,4 +31,5 @@
 
 #include "OrxonoxPrereqs.h"
+#include "items/Item.h"
 
 #include <string>
@@ -38,4 +39,5 @@
 { // tolua_export
     class _OrxonoxExport ShipPart // tolua_export
+        : public Item
     { // tolua_export
 
@@ -44,9 +46,38 @@
             virtual ~ShipPart();
 
+            //virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            virtual void handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator);
+
+            //virtual void attachTo(Pawn* newParent);
+            //virtual void detach();
+
+            void addEntity(StaticEntity* entity);
+            StaticEntity* getEntity(unsigned int index);
+
+            virtual void setDamageAbsorption(float value);
+            inline float getDamageAbsorption()
+                { return this->damageAbsorption_; }
+
+            virtual void setHealth(float health);
+            inline void addHealth(float health)
+                { this->setHealth(this->health_ + health); }
+            inline void removeHealth(float health)
+                { this->setHealth(this->health_ - health); }
+            inline float getHealth() const
+                { return this->health_; }
+
+            // FIXME: (noep) Why doesn't this work? Works fine in Engine.h
+            //void addToSpaceShip(ModularSpaceShip* ship);
+
         protected:
+            Pawn* parent_;
+            unsigned int parentID_; // Object ID of the SpaceShip the Part is mounted on.
 
+            float damageAbsorption_;
+            float health_;
 
         private:
-
+            std::vector<StaticEntity*> entityList_; // list of all entities which belong to this part
 
     }; // tolua_export
Index: /code/branches/modularships/src/orxonox/worldentities/MovableEntity.cc
===================================================================
--- /code/branches/modularships/src/orxonox/worldentities/MovableEntity.cc	(revision 10010)
+++ /code/branches/modularships/src/orxonox/worldentities/MovableEntity.cc	(revision 10011)
@@ -72,5 +72,5 @@
     }
 
-    bool MovableEntity::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+    bool MovableEntity::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
     {
         if (GameMode::isMaster() && enableCollisionDamage_)
@@ -80,5 +80,5 @@
             {
                 float damage = this->collisionDamage_ * (victim->getVelocity() - this->getVelocity()).length();
-                victim->hit(0, contactPoint, damage);
+                victim->hit(0, contactPoint, ownCollisionShape, damage);
             }
         }
@@ -86,20 +86,4 @@
         return false;
     }
-
-    bool MovableEntity::customCollidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
-    {
-        if (GameMode::isMaster() && enableCollisionDamage_)
-        {
-            Pawn* victim = orxonox_cast<Pawn*>(otherObject);
-            if (victim)
-            {
-                float damage = this->collisionDamage_ * (victim->getVelocity() - this->getVelocity()).length();
-                victim->customHit(0, contactPoint, ownCollisionShape, damage);
-            }
-        }
-
-        return false;
-    }
-
 
     void MovableEntity::registerVariables()
Index: /code/branches/modularships/src/orxonox/worldentities/MovableEntity.h
===================================================================
--- /code/branches/modularships/src/orxonox/worldentities/MovableEntity.h	(revision 10010)
+++ /code/branches/modularships/src/orxonox/worldentities/MovableEntity.h	(revision 10011)
@@ -47,6 +47,5 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
-            virtual bool customCollidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
+            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
 
             using WorldEntity::setPosition;
Index: /code/branches/modularships/src/orxonox/worldentities/WorldEntity.h
===================================================================
--- /code/branches/modularships/src/orxonox/worldentities/WorldEntity.h	(revision 10010)
+++ /code/branches/modularships/src/orxonox/worldentities/WorldEntity.h	(revision 10011)
@@ -374,8 +374,5 @@
                 Condition is that enableCollisionCallback() was called.
             */
-            virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
-                { return false; } /* With false, Bullet assumes no modification to the collision objects. */
-
-            virtual inline bool customCollidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
+            virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
                 { return false; } /* With false, Bullet assumes no modification to the collision objects. */
 
Index: /code/branches/modularships/src/orxonox/worldentities/pawns/CMakeLists.txt
===================================================================
--- /code/branches/modularships/src/orxonox/worldentities/pawns/CMakeLists.txt	(revision 10010)
+++ /code/branches/modularships/src/orxonox/worldentities/pawns/CMakeLists.txt	(revision 10011)
@@ -4,4 +4,5 @@
   Pawn.cc
   SpaceShip.cc
+  ModularSpaceShip.cc
   TeamBaseMatchBase.cc
   Destroyer.cc
Index: /code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
===================================================================
--- /code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc	(revision 10011)
+++ /code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc	(revision 10011)
@@ -0,0 +1,167 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      Noe Pedrazzini
+ *
+ */
+
+#include "ModularSpaceShip.h"
+
+#include <BulletDynamics/Dynamics/btRigidBody.h>
+
+#include "core/CoreIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
+#include "core/Template.h"
+#include "core/XMLPort.h"
+#include "util/Math.h"
+#include "gametypes/Gametype.h"
+
+#include "ShipPart.h"
+
+
+
+namespace orxonox
+{
+    RegisterClass(ModularSpaceShip);
+
+    ModularSpaceShip::ModularSpaceShip(Context* context) : SpaceShip(context)
+    {
+        RegisterObject(ModularSpaceShip);
+
+        this->registerVariables();
+
+    }
+
+    ModularSpaceShip::~ModularSpaceShip()
+    {
+        if (this->isInitialized())
+        {
+
+        }
+    }
+
+    void ModularSpaceShip::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(ModularSpaceShip, XMLPort, xmlelement, mode);
+        XMLPortObject(ModularSpaceShip, ShipPart, "parts", addShipPart, getShipPart, xmlelement, mode);
+    }
+
+    void ModularSpaceShip::registerVariables()
+    {
+        return;
+    }
+
+    void ModularSpaceShip::updatePartAssignment()
+    {
+
+    }
+
+    //FIXME: (noep) finish
+    // void ModularSpaceShip::attach
+
+    void ModularSpaceShip::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
+    {
+        orxout() << "Mdamage(): Collision detected on " << this->getRadarName() << ", btCS*: " << cs << endl;
+        orxout() << "Attached parts:" << endl;
+        for(unsigned int i=0; i < this->partList_.size(); i++)
+        {
+            orxout() << "  " << i << ": " << this->partList_[i] << " (" << this->partList_[i]->getName() << ")" << endl;
+        }
+
+        int collisionShapeIndex = this->isMyCollisionShape(cs);
+        orxout() << collisionShapeIndex << endl;
+
+        // Applies multiplier given by the DamageBoost Pickup.
+        if (originator)
+            damage *= originator->getDamageMultiplier();
+
+        if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
+        {
+            if (shielddamage >= this->getShieldHealth())
+            {
+                this->setShieldHealth(0);
+                this->setHealth(this->health_ - (healthdamage + damage));
+            }
+            else
+            {
+                this->setShieldHealth(this->shieldHealth_ - shielddamage);
+
+                // remove remaining shieldAbsorpton-Part of damage from shield
+                shielddamage = damage * this->shieldAbsorption_;
+                shielddamage = std::min(this->getShieldHealth(),shielddamage);
+                this->setShieldHealth(this->shieldHealth_ - shielddamage);
+
+                // set remaining damage to health
+                this->setHealth(this->health_ - (damage - shielddamage) - healthdamage);
+            }
+
+            this->lastHitOriginator_ = originator;
+        }
+    }
+
+    /**
+    @brief
+        Add a ShipPart to the SpaceShip.
+    @param engine
+        A pointer to the ShipPart to be added.
+    */
+    void ModularSpaceShip::addShipPart(ShipPart* part)
+    {
+        OrxAssert(part != NULL, "The ShipPart cannot be NULL.");
+        this->partList_.push_back(part);
+        //part->addToSpaceShip(this); //FIXME: (noep) add
+        this->updatePartAssignment();
+    }
+
+    /**
+    @brief
+        Get the i-th ShipPart of the SpaceShip.
+    @return
+        Returns a pointer to the i-the ShipPart. NULL if there is no ShipPart with that index.
+    */
+    ShipPart* ModularSpaceShip::getShipPart(unsigned int index)
+    {
+        if(this->partList_.size() >= index)
+            return NULL;
+        else
+            return this->partList_[index];
+    }
+
+    /**
+    @brief
+        Check whether the SpaceShip has a particular Engine.
+    @param engine
+        A pointer to the Engine to be checked.
+    */
+    bool ModularSpaceShip::hasShipPart(ShipPart* part) const
+    {
+        for(unsigned int i = 0; i < this->partList_.size(); i++)
+        {
+            if(this->partList_[i] == part)
+                return true;
+        }
+        return false;
+    }
+
+}
Index: /code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h
===================================================================
--- /code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h	(revision 10011)
+++ /code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h	(revision 10011)
@@ -0,0 +1,114 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      Noe Pedrazzini
+ *
+ */
+
+#ifndef _ModularSpaceShip_H__
+#define _ModularSpaceShip_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include <LinearMath/btVector3.h>
+
+#include "tools/Timer.h"
+#include "util/Math.h"
+#include "util/OrxAssert.h"
+
+#include "SpaceShip.h"
+#include "ShipPart.h"
+
+namespace orxonox
+{
+
+    /**
+    @brief
+        The ModularSpaceShip is the principal entity through which the player interacts with the game. Its main function is to fly, however many things, such as @ref orxonox::Engine Engines or @ref orxonox::Weapon Weapons, can be attached to it.
+
+        There are several parameters that define the behavior of the ModularSpaceShip>
+        - The <b>rotationThrust</b>, specifies the force with which the ModularSpaceShip rotates.
+        - The <b>boost</b>, there are quite some parameters pertaining to boosting. The boost is a special move of the ModularSpaceShip, where, for a limited amount of time, it can fly considerably faster than usual. The <b>boostPower</b> is the amount of power available for boosting. The <b>boostPowerRate</b> is the rate at which the boost power is replenished. The <b>boostRate</b> is the rate at which boosting uses power. And the <b>boostCooldownDuration</b> is the time the ModularSpaceShip cannot boost, once all the boost power has been used up. Naturally all of these parameters must be non-negative.
+        - The <b>boost shaking</b>, when the ModularSpaceShip boosts, the camera shakes to create a more immersive effect. Two parameters can be used to adjust the effect. The <b>shakeFrequency</b> is the frequency with which the camera shakes. And the <b>shakeAmplitude</b> is the amount with which the camera shakes. Again these parameters must bee non-negative.
+        - The <b>lift</b> creates a more natural flight feeling through the addition of a lift force. There are again tow parameters that can be specified. The <b>lift</b> which is the lift force that is applied. And the <b>stallSpeed</b> which is the forward speed after which no more lift is generated.
+
+        As mentioned @ref orxonox::Engine Engines can be mounted on the ModularSpaceShip. Here is a (primitive) example of a ModularSpaceShip defined in XML:
+        @code
+        <ModularSpaceShip
+            rotationThrust    = 50
+
+            lift = 1;
+            stallSpeed = 220;
+
+            boostPower            = 15
+            boostPowerRate        = 1
+            boostRate             = 5
+            boostCooldownDuration = 10
+
+            shakeFrequency = 15
+            shakeAmplitude = 9
+
+            collisionType     = "dynamic"
+            mass              = 100
+            linearDamping     = 0.7
+            angularDamping    = 0.9999999
+            >
+                <engines>
+                    <Engine />
+                    <Engine />
+                </engines>
+            </ModularSpaceShip>
+        @endcode
+
+    @author
+        Fabian 'x3n' Landau
+    */
+    class _OrxonoxExport ModularSpaceShip : public SpaceShip
+    {
+        public:
+            ModularSpaceShip(Context* context);
+            virtual ~ModularSpaceShip();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
+
+            void addShipPart(ShipPart* part);
+            ShipPart* getShipPart(unsigned int index);
+            bool hasShipPart(ShipPart* part) const;
+
+            virtual void updatePartAssignment();
+
+        protected:
+
+
+        private:
+            void registerVariables();
+            std::vector<ShipPart*> partList_;  // The list of all Parts mounted on this ModularSpaceShip.
+        
+    };
+}
+
+#endif /* _ModularSpaceShip_H__ */
Index: /code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- /code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc	(revision 10010)
+++ /code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc	(revision 10011)
@@ -250,6 +250,11 @@
     }
 
-    void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
-    {
+    void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
+    {
+        orxout() << "damage(): Collision detected on " << this->getName() << ", btCS*: " << cs << endl;
+
+        int collisionShapeIndex = this->isMyCollisionShape(cs);
+        orxout() << collisionShapeIndex << endl;
+
         // Applies multiplier given by the DamageBoost Pickup.
         if (originator)
@@ -280,39 +285,4 @@
     }
 
-    void Pawn::customDamage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
-    {
-        orxout() << "damage(): Collision detected on " << this->getRadarName() << ", btCS*: " << cs << endl;
-
-        int collisionShapeIndex = this->isMyCollisionShape(cs);
-        orxout() << collisionShapeIndex << endl;
-
-        // Applies multiplier given by the DamageBoost Pickup.
-        if (originator)
-            damage *= originator->getDamageMultiplier();
-
-        if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
-        {
-            if (shielddamage >= this->getShieldHealth())
-            {
-                this->setShieldHealth(0);
-                this->setHealth(this->health_ - (healthdamage + damage));
-            }
-            else
-            {
-                this->setShieldHealth(this->shieldHealth_ - shielddamage);
-
-                // remove remaining shieldAbsorpton-Part of damage from shield
-                shielddamage = damage * this->shieldAbsorption_;
-                shielddamage = std::min(this->getShieldHealth(),shielddamage);
-                this->setShieldHealth(this->shieldHealth_ - shielddamage);
-
-                // set remaining damage to health
-                this->setHealth(this->health_ - (damage - shielddamage) - healthdamage);
-            }
-
-            this->lastHitOriginator_ = originator;
-        }
-    }
-
 // TODO: Still valid?
 /* HIT-Funktionen
@@ -320,38 +290,18 @@
 
 */
-    void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage)
+    void Pawn::hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage)
     {
         if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
         {
-            this->damage(damage, healthdamage, shielddamage, originator);
+            this->damage(damage, healthdamage, shielddamage, originator, cs);
             this->setVelocity(this->getVelocity() + force);
         }
     }
 
-    void Pawn::customHit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage)
+    void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage)
     {
         if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
         {
-            this->customDamage(damage, healthdamage, shielddamage, originator, cs);
-            this->setVelocity(this->getVelocity() + force);
-        }
-    }
-
-    void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage)
-    {
-        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
-        {
-            this->damage(damage, healthdamage, shielddamage, originator);
-
-            if ( this->getController() )
-                this->getController()->hit(originator, contactpoint, damage); // changed to damage, why shielddamage?
-        }
-    }
-
-    void Pawn::customHit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage)
-    {
-        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
-        {
-            this->customDamage(damage, healthdamage, shielddamage, originator, cs);
+            this->damage(damage, healthdamage, shielddamage, originator, cs);
 
             if ( this->getController() )
@@ -620,6 +570,5 @@
     }
 
-    // WIP function that (once I get it working) determines to which attached entity a collisionshape belongs.
-    // Shame that this doesn't seem to work as intended. It behaves differently (different number of childshapes) every reload. D:
+
     int Pawn::isMyCollisionShape(const btCollisionShape* cs)
     {
@@ -628,19 +577,19 @@
 
         // e.g. "Box 4: Searching for CS 0x1ad49200"
-        orxout() << this->getRadarName() << ": Searching for btCS* " << cs << endl;
+        orxout() << this->getName() << ": Searching for btCS* " << cs << endl;
         // e.g. "Box 4 is WorldEntityCollisionShape 0x126dd060"
-        orxout() << "  " << this->getRadarName() << " is WorldEntityCollisionShape* " << ownWECS << endl;
+        orxout() << "  " << this->getName() << " is WorldEntityCollisionShape* " << ownWECS << endl;
         // e.g. "Box 4 is WorldEntity 0x126dd060"
-        orxout() << "  " << this->getRadarName() << " is WorldEntity* " << this << endl;
+        orxout() << "  " << this->getName() << " is WorldEntity* " << this << endl;
         // e.g. "Box 4 is objectID 943"
-        orxout() << "  " << this->getRadarName() << " is objectID " << this->getObjectID() << endl;
+        orxout() << "  " << this->getName() << " is objectID " << this->getObjectID() << endl;
 
         // List all attached Objects
-        orxout() << "  " << this->getRadarName() << " has the following Objects attached:" << endl;
+        orxout() << "  " << this->getName() << " has the following Objects attached:" << endl;
         for (int i=0; i<10; i++)
         {
             if (this->getAttachedObject(i)==NULL)
                 break;
-            orxout() << " " << i << ": " << this->getAttachedObject(i);
+            orxout() << " " << i << ": " << this->getAttachedObject(i) << " (" << this->getAttachedObject(i)->getName() << ")";
             if(!orxonox_cast<Model*>(this->getAttachedObject(i)))
                 orxout() << " (SE)";
@@ -648,6 +597,4 @@
         }
 
-        if (this->health_ < 800)
-            this->detach(this->getAttachedObject(2));
 
         // print child shapes of this WECS
@@ -656,7 +603,7 @@
         int temp = entityOfCollisionShape(cs);
         if (temp==0)
-            orxout() << this->getRadarName() << " has been hit on it's main body." << endl;
-        else
-            orxout() << this->getRadarName() << " has been hit on the attached entity no. " << temp << endl;
+            orxout() << this->getName() << " has been hit on it's main body." << endl;
+        else
+            orxout() << this->getName() << " has been hit on the attached entity no. " << temp << endl;
 
         // end
@@ -680,5 +627,5 @@
 
                 // pointer to the btCollisionShape
-                printSpaces(indent+2);  orxout() << "m_userPointer*: " << cs->getChildShape(i)->getUserPointer() << endl;
+                printSpaces(indent+2);  orxout() << "m_userPointer*: " << cs->getChildShape(i)->getUserPointer() << " (name_: " << ((BaseObject*)(cs->getChildShape(i)->getUserPointer()))->getName() << ")" << endl;
             }
 
Index: /code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- /code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h	(revision 10010)
+++ /code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h	(revision 10011)
@@ -126,8 +126,6 @@
             //virtual void hit(Pawn* originator, const Vector3& force, float damage);
             //virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
-            virtual void hit(Pawn* originator, const Vector3& force, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
-            virtual void customHit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
-            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
-            virtual void customHit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
+            virtual void hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
+            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
 
             virtual void kill();
@@ -198,6 +196,5 @@
 
             //virtual void damage(float damage, Pawn* originator = 0);
-            virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL);
-            virtual void customDamage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
+            virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
 
             bool bAlive_;
