[Orxonox-commit 5348] r10011 - in code/branches/modularships: data/levels data/levels/templates src/modules/weapons/projectiles src/orxonox src/orxonox/worldentities src/orxonox/worldentities/pawns

noep at orxonox.net noep at orxonox.net
Wed Apr 2 20:38:08 CEST 2014


Author: noep
Date: 2014-04-02 20:38:07 +0200 (Wed, 02 Apr 2014)
New Revision: 10011

Added:
   code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
   code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h
Modified:
   code/branches/modularships/data/levels/emptyLevel.oxw
   code/branches/modularships/data/levels/templates/HeavyCruiser.oxt
   code/branches/modularships/src/modules/weapons/projectiles/BasicProjectile.cc
   code/branches/modularships/src/modules/weapons/projectiles/BasicProjectile.h
   code/branches/modularships/src/modules/weapons/projectiles/Projectile.cc
   code/branches/modularships/src/modules/weapons/projectiles/Projectile.h
   code/branches/modularships/src/modules/weapons/projectiles/Rocket.cc
   code/branches/modularships/src/modules/weapons/projectiles/Rocket.h
   code/branches/modularships/src/modules/weapons/projectiles/SimpleRocket.cc
   code/branches/modularships/src/modules/weapons/projectiles/SimpleRocket.h
   code/branches/modularships/src/orxonox/CMakeLists.txt
   code/branches/modularships/src/orxonox/Scene.cc
   code/branches/modularships/src/orxonox/ShipPart.cc
   code/branches/modularships/src/orxonox/ShipPart.h
   code/branches/modularships/src/orxonox/worldentities/MovableEntity.cc
   code/branches/modularships/src/orxonox/worldentities/MovableEntity.h
   code/branches/modularships/src/orxonox/worldentities/WorldEntity.h
   code/branches/modularships/src/orxonox/worldentities/pawns/CMakeLists.txt
   code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc
   code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h
Log:
Cleaned up the process passing the collisionshape which was hit to the Pawn. Started implementation of ModularSpaceShip and ShipPart.

Modified: code/branches/modularships/data/levels/emptyLevel.oxw
===================================================================
--- code/branches/modularships/data/levels/emptyLevel.oxw	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/data/levels/emptyLevel.oxw	2014-04-02 18:38:07 UTC (rev 10011)
@@ -15,6 +15,7 @@
   include("templates/spaceshipAssff2.oxt")
   include("templates/spaceshipPirate.oxt")
   include("templates/spaceshipEscort.oxt")
+  include("templates/HeavyCruiser.oxt")
 ?>
 
 <Level>
@@ -90,6 +91,18 @@
         </collisionShapes>
     </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>
 

Modified: code/branches/modularships/data/levels/templates/HeavyCruiser.oxt
===================================================================
--- code/branches/modularships/data/levels/templates/HeavyCruiser.oxt	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/data/levels/templates/HeavyCruiser.oxt	2014-04-02 18:38:07 UTC (rev 10011)
@@ -1,7 +1,9 @@
 <!-- This template includes HeavyCruiser with all its parts (not individually destructible) -->
 
 <Template name=HeavyCruiser>
-  <SpaceShip
+  <ModularSpaceShip
+   name = HeavyCruiser
+   
    hudtemplate            = spaceshiphud
    camerapositiontemplate = heavycruisercameras
    spawnparticlesource    = "Orxonox/fairytwirl"
@@ -46,17 +48,132 @@
       <MultiStateEngine position="-140,0,308" template=HeavyCruiser_sidearmL_engine1 />
       <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 -->
         <BlinkingBillboard position="75,30,-416" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.05 frequency=0.3 phase=240 quadratic=1 />
@@ -78,76 +195,6 @@
 
     </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"/> 
         <BoxCollisionShape position="0,56,-310" halfExtents="65,6,60" info="body, bay1, Twall"/> 
@@ -292,7 +339,7 @@
 <?lua
   include("../includes/weaponSettingsHeavyCruiser.oxi")
 ?>
-  </SpaceShip>
+  </ModularSpaceShip>
 
 </Template>
 

Modified: code/branches/modularships/src/modules/weapons/projectiles/BasicProjectile.cc
===================================================================
--- code/branches/modularships/src/modules/weapons/projectiles/BasicProjectile.cc	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/modules/weapons/projectiles/BasicProjectile.cc	2014-04-02 18:38:07 UTC (rev 10011)
@@ -77,7 +77,7 @@
         Returns true if the collision resulted in a successful hit.
     @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())
         {
@@ -95,7 +95,7 @@
             // If visual effects after destruction cause problems, put this block below the effects code block
             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();
             }
 
@@ -140,69 +140,7 @@
         return false;
     }
 
-    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;
-        }
-
     /**
     @brief
         Check whether the projectile needs to be destroyed and destroys it if so.

Modified: code/branches/modularships/src/modules/weapons/projectiles/BasicProjectile.h
===================================================================
--- code/branches/modularships/src/modules/weapons/projectiles/BasicProjectile.h	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/modules/weapons/projectiles/BasicProjectile.h	2014-04-02 18:38:07 UTC (rev 10011)
@@ -118,8 +118,7 @@
             virtual void destroyObject(void);
 
         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);
 
         private:

Modified: code/branches/modularships/src/modules/weapons/projectiles/Projectile.cc
===================================================================
--- code/branches/modularships/src/modules/weapons/projectiles/Projectile.cc	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/modules/weapons/projectiles/Projectile.cc	2014-04-02 18:38:07 UTC (rev 10011)
@@ -87,14 +87,9 @@
         this->destroyCheck();
     }
 
-    bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+    bool Projectile::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
     {
-        return this->processCollision(otherObject, contactPoint);
+        return this->processCollision(otherObject, contactPoint, cs);
     }
 
-    bool Projectile::customCollidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
-    {
-        return this->customProcessCollision(otherObject, contactPoint, cs);
-    }
-
 }

Modified: code/branches/modularships/src/modules/weapons/projectiles/Projectile.h
===================================================================
--- code/branches/modularships/src/modules/weapons/projectiles/Projectile.h	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/modules/weapons/projectiles/Projectile.h	2014-04-02 18:38:07 UTC (rev 10011)
@@ -63,8 +63,7 @@
             void setConfigValues();
 
             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:
             float lifetime_; //!< The time the projectile exists.

Modified: code/branches/modularships/src/modules/weapons/projectiles/Rocket.cc
===================================================================
--- code/branches/modularships/src/modules/weapons/projectiles/Rocket.cc	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/modules/weapons/projectiles/Rocket.cc	2014-04-02 18:38:07 UTC (rev 10011)
@@ -190,16 +190,11 @@
        this->destroyCheck();
     }
 
-    bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+    bool Rocket::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
     {
-        return this->processCollision(otherObject, contactPoint);
+        return this->processCollision(otherObject, contactPoint, cs);
     }
 
-    bool Rocket::customCollidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
-    {
-        return this->customProcessCollision(otherObject, contactPoint, cs);
-    }
-
     /**
     @brief
         Destroys the Rocket and stops the sound,

Modified: code/branches/modularships/src/modules/weapons/projectiles/Rocket.h
===================================================================
--- code/branches/modularships/src/modules/weapons/projectiles/Rocket.h	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/modules/weapons/projectiles/Rocket.h	2014-04-02 18:38:07 UTC (rev 10011)
@@ -63,8 +63,7 @@
 
             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();
 

Modified: code/branches/modularships/src/modules/weapons/projectiles/SimpleRocket.cc
===================================================================
--- code/branches/modularships/src/modules/weapons/projectiles/SimpleRocket.cc	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/modules/weapons/projectiles/SimpleRocket.cc	2014-04-02 18:38:07 UTC (rev 10011)
@@ -171,16 +171,11 @@
         this->player_ = this->getShooter()->getPlayer();
     }
 
-    bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+    bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
     {
-        return this->processCollision(otherObject, contactPoint);
+        return this->processCollision(otherObject, contactPoint, cs);
     }
 
-    bool SimpleRocket::customCollidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
-    {
-        return this->customProcessCollision(otherObject, contactPoint, cs);
-    }
-
     /**
     @brief
         Rotates the SimpleRocket around the y-axis by the amount specified by the first component of the input 2-dim vector.

Modified: code/branches/modularships/src/modules/weapons/projectiles/SimpleRocket.h
===================================================================
--- code/branches/modularships/src/modules/weapons/projectiles/SimpleRocket.h	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/modules/weapons/projectiles/SimpleRocket.h	2014-04-02 18:38:07 UTC (rev 10011)
@@ -63,8 +63,7 @@
             virtual ~SimpleRocket();
             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
 

Modified: code/branches/modularships/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/modularships/src/orxonox/CMakeLists.txt	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/orxonox/CMakeLists.txt	2014-04-02 18:38:07 UTC (rev 10011)
@@ -31,6 +31,7 @@
   PawnManager.cc
   PlayerManager.cc
   Radar.cc
+  ShipPart.cc
 #  Test.cc
 
 BUILD_UNIT SceneBuildUnit.cc

Modified: code/branches/modularships/src/orxonox/Scene.cc
===================================================================
--- code/branches/modularships/src/orxonox/Scene.cc	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/orxonox/Scene.cc	2014-04-02 18:38:07 UTC (rev 10011)
@@ -200,7 +200,7 @@
             // also set the collision callback variable.
             // 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())
         {
@@ -348,23 +348,6 @@
         SmartPtr<WorldEntity> object0 = static_cast<WorldEntity*>(colObj0->getUserPointer());
         SmartPtr<WorldEntity> object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
 
-        // false means that bullet will assume we didn't modify the contact
-        bool modified = false;
-        if (object0->isCollisionCallbackActive())
-            modified |= object0->collidesAgainst(object1, cp);
-        if (object1->isCollisionCallbackActive())
-            modified |= object1->collidesAgainst(object0, 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();
@@ -372,9 +355,9 @@
         // false means that bullet will assume we didn't modify the contact
         bool modified = false;
         if (object0->isCollisionCallbackActive())
-            modified |= object0->customCollidesAgainst(object1, cs1, cp);
+            modified |= object0->collidesAgainst(object1, cs1, cp);
         if (object1->isCollisionCallbackActive())
-            modified |= object1->customCollidesAgainst(object0, cs0, cp);
+            modified |= object1->collidesAgainst(object0, cs0, cp);
 
         return modified;
     }

Modified: code/branches/modularships/src/orxonox/ShipPart.cc
===================================================================
--- code/branches/modularships/src/orxonox/ShipPart.cc	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/orxonox/ShipPart.cc	2014-04-02 18:38:07 UTC (rev 10011)
@@ -34,6 +34,10 @@
 #include "core/GameMode.h"
 #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"
 
 
 namespace orxonox
@@ -41,8 +45,9 @@
     RegisterClass(ShipPart);
 
     ShipPart::ShipPart(Context* context)
+        : Item(context)
     {
-        //RegisterObject(ShipPart);
+        RegisterObject(ShipPart);
     }
 
     ShipPart::~ShipPart()
@@ -50,4 +55,95 @@
 
     }
 
+
+    /**
+    @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);
+        }
+    }*/
+
 }

Modified: code/branches/modularships/src/orxonox/ShipPart.h
===================================================================
--- code/branches/modularships/src/orxonox/ShipPart.h	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/orxonox/ShipPart.h	2014-04-02 18:38:07 UTC (rev 10011)
@@ -30,6 +30,7 @@
 #define _ShipPart_H__
 
 #include "OrxonoxPrereqs.h"
+#include "items/Item.h"
 
 #include <string>
 
@@ -37,18 +38,48 @@
 namespace orxonox // tolua_export
 { // tolua_export
     class _OrxonoxExport ShipPart // tolua_export
+        : public Item
     { // tolua_export
 
         public:
             ShipPart(Context* context);
             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
 } // tolua_export
 

Modified: code/branches/modularships/src/orxonox/worldentities/MovableEntity.cc
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/MovableEntity.cc	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/orxonox/worldentities/MovableEntity.cc	2014-04-02 18:38:07 UTC (rev 10011)
@@ -71,7 +71,7 @@
         XMLPortParam(MovableEntity, "collisiondamage", setCollisionDamage, getCollisionDamage, xmlelement, mode).defaultValues(1);
     }
 
-    bool MovableEntity::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+    bool MovableEntity::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
     {
         if (GameMode::isMaster() && enableCollisionDamage_)
         {
@@ -79,29 +79,13 @@
             if (victim)
             {
                 float damage = this->collisionDamage_ * (victim->getVelocity() - this->getVelocity()).length();
-                victim->hit(0, contactPoint, damage);
+                victim->hit(0, contactPoint, ownCollisionShape, damage);
             }
         }
 
         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()
     {
         registerVariable(this->linearVelocity_,        VariableDirection::ToClient, new NetworkCallback<MovableEntity>(this, &MovableEntity::processLinearVelocity));

Modified: code/branches/modularships/src/orxonox/worldentities/MovableEntity.h
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/MovableEntity.h	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/orxonox/worldentities/MovableEntity.h	2014-04-02 18:38:07 UTC (rev 10011)
@@ -46,8 +46,7 @@
             virtual ~MovableEntity();
 
             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;
             using WorldEntity::setOrientation;

Modified: code/branches/modularships/src/orxonox/worldentities/WorldEntity.h
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/WorldEntity.h	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/orxonox/worldentities/WorldEntity.h	2014-04-02 18:38:07 UTC (rev 10011)
@@ -373,12 +373,9 @@
             @note
                 Condition is that enableCollisionCallback() was called.
             */
-            virtual inline bool collidesAgainst(WorldEntity* otherObject, 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. */
 
-            virtual inline bool customCollidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
-                { return false; } /* With false, Bullet assumes no modification to the collision objects. */
-
             //! Enables the collidesAgainst(.) function. The object doesn't respond to collision otherwise!
             inline void enableCollisionCallback()
                 { this->bCollisionCallbackActive_ = true; this->collisionCallbackActivityChanged(); }

Modified: code/branches/modularships/src/orxonox/worldentities/pawns/CMakeLists.txt
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/CMakeLists.txt	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/CMakeLists.txt	2014-04-02 18:38:07 UTC (rev 10011)
@@ -3,6 +3,7 @@
   Spectator.cc
   Pawn.cc
   SpaceShip.cc
+  ModularSpaceShip.cc
   TeamBaseMatchBase.cc
   Destroyer.cc
 )

Added: code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc	                        (rev 0)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc	2014-04-02 18:38:07 UTC (rev 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;
+    }
+
+}

Added: code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h	                        (rev 0)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h	2014-04-02 18:38:07 UTC (rev 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__ */

Modified: code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc	2014-04-02 18:38:07 UTC (rev 10011)
@@ -249,40 +249,10 @@
         this->reloadWaitCountdown_ -= dt;
     }
 
-    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)
     {
-        // Applies multiplier given by the DamageBoost Pickup.
-        if (originator)
-            damage *= originator->getDamageMultiplier();
+        orxout() << "damage(): Collision detected on " << this->getName() << ", btCS*: " << cs << endl;
 
-        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;
-        }
-    }
-
-    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;
 
@@ -319,47 +289,27 @@
     Die hit-Funktionen muessen auch in src/orxonox/controllers/Controller.h angepasst werden! (Visuelle Effekte)
 
 */
-    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);
-        }
-    }
+            this->damage(damage, healthdamage, shielddamage, originator, cs);
 
-    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);
 
-            if ( this->getController() )
-                this->getController()->hit(originator, contactpoint, damage); // changed to damage, why shielddamage?
-        }
-    }
-
-
     void Pawn::kill()
     {
         this->damage(this->health_);
@@ -619,45 +569,42 @@
         return BLANKSTRING;
     }
 
-    // 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)
     {
         // This entities WECS
         WorldEntityCollisionShape* ownWECS = this->getWorldEntityCollisionShape();
 
         // 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)";
             orxout() << endl;
         }
 
-        if (this->health_ < 800)
-            this->detach(this->getAttachedObject(2));
 
         // print child shapes of this WECS
         printBtChildShapes((btCompoundShape*)(ownWECS->getCollisionShape()), 2, 0);
 
         int temp = entityOfCollisionShape(cs);
         if (temp==0)
-            orxout() << this->getRadarName() << " has been hit on it's main body." << endl;
+            orxout() << this->getName() << " 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 the attached entity no. " << temp << endl;
 
         // end
         return -1;
@@ -679,7 +626,7 @@
                 printSpaces(indent+2);  orxout() << "btCollisionShape*: " << cs->getChildShape(i) << endl;
 
                 // 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;
             }
 
             // if the childshape is a CompoundCollisionShape, print its children.

Modified: code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h	2014-03-27 15:15:55 UTC (rev 10010)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h	2014-04-02 18:38:07 UTC (rev 10011)
@@ -125,10 +125,8 @@
 
             //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();
 
@@ -197,8 +195,7 @@
             virtual void spawneffect();
 
             //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_;
 




More information about the Orxonox-commit mailing list