Index: code/trunk/src/orxonox/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/CMakeLists.txt	(revision 10197)
+++ code/trunk/src/orxonox/CMakeLists.txt	(revision 10216)
@@ -31,4 +31,5 @@
   PawnManager.cc
   PlayerManager.cc
+  ShipPartManager.cc
   Radar.cc
 #  Test.cc
@@ -64,4 +65,5 @@
     infos/PlayerInfo.h
     sound/SoundManager.h
+    controllers/ScriptController.h
   PCH_FILE
     OrxonoxPrecompiledHeaders.h
Index: code/trunk/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 10197)
+++ code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 10216)
@@ -142,4 +142,6 @@
 
     // items
+    class ShipPart;
+    class PartDestructionEvent;
     class Engine;
     class Item;
@@ -189,4 +191,5 @@
     class Pawn;
     class SpaceShip;
+    class ModularSpaceShip;
     class Spectator;
     class TeamBaseMatchBase;
Index: code/trunk/src/orxonox/Scene.cc
===================================================================
--- code/trunk/src/orxonox/Scene.cc	(revision 10197)
+++ code/trunk/src/orxonox/Scene.cc	(revision 10216)
@@ -363,10 +363,14 @@
         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;
Index: code/trunk/src/orxonox/ShipPartManager.cc
===================================================================
--- code/trunk/src/orxonox/ShipPartManager.cc	(revision 10216)
+++ code/trunk/src/orxonox/ShipPartManager.cc	(revision 10216)
@@ -0,0 +1,61 @@
+/*
+ *   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:
+ *      ...
+ *
+ */
+
+#include "ShipPartManager.h"
+
+#include "util/ScopedSingletonManager.h"
+#include "core/CoreIncludes.h"
+#include "items/ShipPart.h"
+
+namespace orxonox
+{
+    ManageScopedSingleton(ShipPartManager, ScopeID::Root, false);
+
+    ShipPartManager::ShipPartManager()
+    {
+        RegisterObject(ShipPartManager);
+    }
+
+    ShipPartManager::~ShipPartManager()
+    {
+        // Be sure to delete all the pawns
+        for (ObjectList<ShipPart>::iterator it = ObjectList<ShipPart>::begin(); it != ObjectList<ShipPart>::end(); )
+            (it++)->death();
+    }
+
+    void ShipPartManager::preUpdate(const Clock& time)
+    {
+        for (ObjectList<ShipPart>::iterator it = ObjectList<ShipPart>::begin(); it != ObjectList<ShipPart>::end(); )
+        {
+            if (!it->isAlive())
+                (it++)->death();
+            else
+                ++it;
+        }
+    }
+}
Index: code/trunk/src/orxonox/ShipPartManager.h
===================================================================
--- code/trunk/src/orxonox/ShipPartManager.h	(revision 10216)
+++ code/trunk/src/orxonox/ShipPartManager.h	(revision 10216)
@@ -0,0 +1,54 @@
+/*
+ *   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:
+ *      ...
+ *
+ */
+
+#ifndef _ShipPartManager_H__
+#define _ShipPartManager_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "util/Singleton.h"
+#include "tools/interfaces/Tickable.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport ShipPartManager : public Singleton<ShipPartManager>, public Tickable
+    {
+            friend class Singleton<ShipPartManager>;
+        public:
+            ShipPartManager();
+            virtual ~ShipPartManager();
+
+            virtual void preUpdate(const Clock& time);
+
+        private:
+
+            static ShipPartManager* singletonPtr_s;
+    };
+}
+
+#endif /* _ShipPartManager_H__ */
Index: code/trunk/src/orxonox/collisionshapes/CollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/collisionshapes/CollisionShape.cc	(revision 10197)
+++ code/trunk/src/orxonox/collisionshapes/CollisionShape.cc	(revision 10216)
@@ -121,8 +121,17 @@
         WorldEntityCollisionShape* parentWECCS = orxonox_cast<WorldEntityCollisionShape*>(newParent);
         if (parentWECCS)
+        {
             this->parentID_ = parentWECCS->getWorldEntityOwner()->getObjectID();
-        // Else it is set to the objectID of the CompoundCollisionShape.
+
+            // If this shape is not a CompoundCollisionShape (thus an actual physical shape) & the parent is a WorldEntity's CollisionShape,
+            // set it's userPointer to the WorldEntity this CompoundCollisionShape belongs to.
+            if (!orxonox_cast<CompoundCollisionShape*>(this))
+                this->getCollisionShape()->setUserPointer(parentWECCS->getWorldEntityOwner());
+        }
         else
+        {
+            // Else it is set to the objectID of the CompoundCollisionShape.
             this->parentID_ = newParent->getObjectID();
+        }
 
         return true;
Index: code/trunk/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/ArtificialController.cc	(revision 10197)
+++ code/trunk/src/orxonox/controllers/ArtificialController.cc	(revision 10216)
@@ -94,5 +94,5 @@
         static const float hardcoded_projectile_speed = 1250;
 
-        this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(), hardcoded_projectile_speed, this->target_->getPosition(), this->target_->getVelocity());
+        this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getWorldPosition(), hardcoded_projectile_speed, this->target_->getWorldPosition(), this->target_->getVelocity());
         this->bHasTargetPosition_ = (this->targetPosition_ != Vector3::ZERO);
 
Index: code/trunk/src/orxonox/controllers/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/controllers/CMakeLists.txt	(revision 10197)
+++ code/trunk/src/orxonox/controllers/CMakeLists.txt	(revision 10216)
@@ -10,3 +10,4 @@
   DroneController.cc
   FormationController.cc
+  ControllerDirector.cc
 )
Index: code/trunk/src/orxonox/controllers/ControllerDirector.cc
===================================================================
--- code/trunk/src/orxonox/controllers/ControllerDirector.cc	(revision 10216)
+++ code/trunk/src/orxonox/controllers/ControllerDirector.cc	(revision 10216)
@@ -0,0 +1,157 @@
+/*
+ * First try of a ControllerDirector. Target: An event occurs in the levelTry.oxw
+ * file, which is "heard" by an object of the type of this class. It then SHOULD
+ * (because it is not working) execute the party function.
+ */
+
+#include "ControllerDirector.h"
+#include "ScriptController.h"
+#include "core/CoreIncludes.h"
+
+//#include "network/NetworkFunction.h"
+
+#include "infos/HumanPlayer.h"
+#include "interfaces/PlayerTrigger.h"
+#include "worldentities/pawns/Pawn.h"
+#include "core/LuaState.h"
+
+
+namespace orxonox
+{
+    RegisterClass(ControllerDirector);
+
+    ControllerDirector::ControllerDirector(Context* context) : ArtificialController(context)
+    {
+        // Register the object with the framework
+        RegisterObject(ControllerDirector);
+
+        // output a message to ensure we know the constructor was run
+        orxout(verbose)<<"hello universe constructor blablub"<< endl;
+
+
+
+        // Initialize member variables
+        this->player_ = NULL;
+        this->entity_ = NULL;
+        this->pTrigger_ = NULL;
+        this->context_ = context;
+    }
+
+    void ControllerDirector::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(ControllerDirector, XMLPort, xmlelement, mode);
+
+        orxout(verbose)<< "ControllerDirector::XMLPort " 
+          << "An instance of ControllerDirector has been created." << endl;
+    }
+
+    void ControllerDirector::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        // Call the xmleventport functions of the classes we derive from
+        SUPER(ControllerDirector, XMLEventPort, xmlelement, mode);
+
+        // Add an event sink for a "takeControl" event, which leads to the
+        // function takeControl() being called.
+        XMLPortEventSink(ControllerDirector, BaseObject, "takeControl", 
+          takeControl, xmlelement, mode);
+    }
+
+
+
+
+    void ControllerDirector::takeControl(Controller * controller, BaseObject * trigger) 
+    {
+       /* Output a message confirming that the function was called */
+       orxout(verbose)<<"test takecontrol."<< endl;
+
+       /* First, we set up a new controller to attach to the unit that
+        * triggered our event. 
+        */
+       static int ctrlid = 1;
+       bool prepok = preparationToTakeControl(trigger);
+       if( prepok == true) 
+       {
+         /* Create a scriptcontroller object */
+         ScriptController *newctrl = new ScriptController(this->context_);
+
+         /* Make the player we were given its slave */
+         newctrl->setPlayer(this->player_);
+
+         /* Start controlling that object */
+         newctrl->takeControl(ctrlid);
+       }
+       else
+         return;
+       
+       /* Set up a luastate to use for running the scripts */
+       LuaState * ls = new LuaState();
+       
+       /* Assemble a string to define a controller id variable in lua space */
+       std::stringstream tmp;
+       tmp << "newctrlid = " << ctrlid << endl;
+       std::string todo = tmp.str();
+       
+       /* Run the string using the luastate created earlier */
+       ls->doString(todo);
+
+       /* Now run the script on this controller. This will still have the above
+        * variable "newctrlid" defined, which means it can make use of it.
+        */
+
+       ls->doFile("testscript.lua");
+
+       /* Increase the controller ID so we have a different one for
+        * the next time it is triggered */
+       ctrlid += 1;
+    } 
+
+    bool ControllerDirector::preparationToTakeControl(BaseObject * trigger) 
+    {
+        this->pTrigger_ = orxonox_cast<PlayerTrigger*>(trigger);
+        this->player_ = NULL;
+
+        orxout(verbose) << "Preparation to take Control!" << endl; 
+
+        // Check whether it is a player trigger and extract pawn from it
+        if(this->pTrigger_ != NULL)
+        {
+            // Get the object which triggered the event.
+            this->player_ = this->pTrigger_->getTriggeringPlayer();  
+
+            // Check if there actually was a player returned.
+            if( this->player_ == NULL) return false;
+        }
+        else
+        {
+            orxout(verbose) << "ControllerDirector::preparationToTakeControl " 
+              << "Not a player trigger, can't extract pawn from it.." << endl;
+            return false;
+        }
+
+        this->entity_ = this->player_->getControllableEntity();
+        assert(this->entity_);
+
+        return true;
+    }
+
+    /* // Currently unused
+    void ControllerDirector::setNewController(Controller * controller) {
+
+
+        orxout() << "New Controller is going to be set!" << endl;
+
+        this->entity_->setDestroyWhenPlayerLeft(false);
+        this->player_->pauseControl();
+        this->entity_->setController(controller);
+        this->player_->startControl(this->entity_);
+        //this->setControllableEntity(this->entity_);
+    }
+    */
+       
+    
+
+}
+
+
+
+
Index: code/trunk/src/orxonox/controllers/ControllerDirector.h
===================================================================
--- code/trunk/src/orxonox/controllers/ControllerDirector.h	(revision 10216)
+++ code/trunk/src/orxonox/controllers/ControllerDirector.h	(revision 10216)
@@ -0,0 +1,65 @@
+/*
+ *   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:
+ *      ...
+ *
+ */
+
+#ifndef _ControllerDirector_H__
+#define _ControllerDirector_H__
+
+#include "OrxonoxPrereqs.h"
+#include "ArtificialController.h"
+#include "core/EventIncludes.h"
+
+
+namespace orxonox
+{
+    class _OrxonoxExport ControllerDirector : public ArtificialController
+    {
+        public:
+            ControllerDirector(Context* context);
+            virtual ~ControllerDirector() { }
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            bool party(bool bTriggered, BaseObject* trigger);
+            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
+
+
+            /* Take over control of a given object */
+            void takeControl(Controller * controller, BaseObject * trigger);
+            bool preparationToTakeControl(BaseObject * trigger);
+
+            // currently unused
+            //void setNewController(Controller * controller);
+
+        private:
+            PlayerInfo* player_;
+            ControllableEntity* entity_; 
+            PlayerTrigger * pTrigger_;
+            Context* context_;
+    };
+}
+
+#endif /* _ControllerDirector_H__ */
Index: code/trunk/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/NewHumanController.cc	(revision 10197)
+++ code/trunk/src/orxonox/controllers/NewHumanController.cc	(revision 10216)
@@ -220,5 +220,5 @@
                 if (!controlPaused_ )
                 {
-                    if (this->getControllableEntity() && (this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
+                    if (this->getControllableEntity() && ((this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || (this->getControllableEntity()->isExactlyA(ClassByString("ModularSpaceShip")))) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
                         this->showOverlays();
                     else if (this->getControllableEntity() &&  this->getControllableEntity()->isExactlyA(ClassByString("FpsPlayer")))
@@ -498,5 +498,5 @@
         this->controlMode_ = 0;
         this->centerCursor();
-        if (this->getControllableEntity() && (this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
+        if (this->getControllableEntity() && ((this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || (this->getControllableEntity()->isExactlyA(ClassByString("ModularSpaceShip")))) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
         {
             this->showOverlays_ = true;
Index: code/trunk/src/orxonox/controllers/ScriptController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/ScriptController.cc	(revision 10197)
+++ code/trunk/src/orxonox/controllers/ScriptController.cc	(revision 10216)
@@ -28,5 +28,9 @@
 
 #include "ScriptController.h"
+#include "infos/PlayerInfo.h"
 #include "core/CoreIncludes.h"
+#include "worldentities/ControllableEntity.h"
+#include "core/LuaState.h"
+#include <cmath>
 
 namespace orxonox
@@ -37,4 +41,222 @@
     {
         RegisterObject(ScriptController);
+
+        /* By default, this controller has ID 0, which means it is not assigned
+         * to anything yet. 
+         */
+        this->ctrlid_ = 0;
+
+        /* Set default values for all variables */
+        /* - pointers to zero */
+        this->player_ = NULL;
+        this->entity_ = NULL;
+
+        /* - times */
+        this->scTime = 0.0f;
+        this->eventTime = 0.0f;
+
+        /* - Points in space */
+        this->startpos = Vector3(0,0,0);
+        //this->lookAtPosition = Vector3(0,0,0);
+
+        /* - Processing flag */
+        this->processing = false;
+
+        /* - Counters */
+        this->eventno = 0;
+
+    }
+
+    void ScriptController::takeControl(int ctrlid)
+    {
+        /* Output some debugging information */
+        orxout(verbose) << "ScriptController: Taking control" << endl;
+        orxout(verbose) << "This-pointer: " << this << endl;
+
+        /* Set the controller ID (the argument here should be nonzero) */
+        this->ctrlid_ = ctrlid;
+
+        /* Store the entity pointer in a private variable */
+        this->entity_ = this->player_->getControllableEntity();
+        assert(this->entity_);
+         
+        /* Add the controller here to this entity. Apparently this still leaves
+         * any preexisting human controllers in place. 
+         */
+        this->entity_->setDestroyWhenPlayerLeft(false);
+        this->player_->pauseControl();
+        this->entity_->setController(this);
+        this->setControllableEntity(this->entity_);
+        this->entity_->mouseLook();
+        this->entity_->setVisible(false);
+    }
+
+    const Vector3& ScriptController::getPosition()
+    {
+      return this->entity_->getPosition();
+    }
+
+    ScriptController* ScriptController::getScriptController()
+    {
+      /* Output a message that confirms this function was called */
+      orxout(verbose) << "Great success!" << std::endl;
+
+      /* Debugging: print all the scriptcontroller object pointers */
+      for(ObjectList<ScriptController>::iterator it = 
+        ObjectList<ScriptController>::begin(); 
+        it != ObjectList<ScriptController>::end(); ++it)
+      { orxout(verbose) << "Have object in list: " << *it << endl; }
+
+      /* Find the first one with a nonzero ID */
+      for(ObjectList<ScriptController>::iterator it = 
+        ObjectList<ScriptController>::begin(); 
+        it != ObjectList<ScriptController>::end(); ++it)
+      { 
+        // TODO: do some selection here. Currently just returns the first one
+        if( (*it)->getID() > 0 )
+        { orxout(verbose) << "Controller to return: " << *it << endl;
+          return *it; 
+        }
+      
+      }
+      return NULL;
+    }
+
+    void ScriptController::execute(event ev)
+    {
+        /* Debugging output */
+        //orxout() << "Executing event " << ev.fctName 
+          //<< " with parameters:\n " 
+          //<< ev.x1 << " " << ev.y1 << " " << ev.z1 << "\n"
+          //<< ev.x2 << " " << ev.y2 << " " << ev.z2 << "\n"
+          //<< ev.duration << endl;
+
+        /* Event is starting, hence set the time to 0 */
+        this->eventTime = 0.0f;
+        this->processing = true;
+
+        /* Copy the event into the currentEvent holder */
+        this->currentEvent = ev;
+
+        /* Store starting position */
+        this->startpos = this->entity_->getPosition();
+    }
+
+
+    void ScriptController::tick(float dt)
+    {
+        /* Call the tick function of the classes we derive from */
+        SUPER(ScriptController, tick, dt);
+
+        /* If this controller has no entity entry, do nothing */
+        if( !(this->entity_) ) return;
+
+        /* See if time has come for the next event to be run */
+        if(this->eventList.size() > 0 && this->eventList[0].eventTime <= scTime)
+        { /* Execute the next event on the list */
+          this->execute(this->eventList[0]);
+          this->eventList.erase(this->eventList.begin());
+          this->eventno -= 1;
+        }
+
+        /* Update the local timers in this object */
+        scTime += dt; eventTime += dt;
+
+        /* If we've arrived at the target, stop processing */
+        if( eventTime > currentEvent.duration && this->processing == true)
+        { this->processing = false;
+
+          /* If we reached the last event, also reenable the normal movement
+           * and make the model visible again
+           */
+          if( this->eventno == 0 )
+          {
+            this->entity_->mouseLook();
+            this->entity_->setVisible(true);
+          }
+        }
+
+        /* Get a variable that specifies how far along the trajectory
+         * we are 
+         */
+        float dl = eventTime / currentEvent.duration; 
+
+        /* Depending  */
+        /* Do some moving */
+        if( this->processing )
+        { 
+          if( this->currentEvent.fctName == "mal" )
+          {
+            /* Set the position to the correct place in the trajectory */
+            this->entity_->setPosition( (1-dl)*startpos + dl * this->currentEvent.v1);
+
+            /* Look at the specified position */
+            this->entity_->lookAt(this->currentEvent.v2);
+
+            /* Update look at position */
+            //this->lookAtPosition = this->currentEvent.v2;
+          }
+          else if( this->currentEvent.fctName == "chl" )
+          {
+            /* Sweep the look from v1 to v2 */
+            this->entity_->lookAt( (1-dl)*this->currentEvent.v1 + 
+              dl * this->currentEvent.v2 );
+          }
+
+
+          /* Force mouse look */
+          if( this->entity_->isInMouseLook() == false )
+            this->entity_->mouseLook();
+        }
+    }
+
+    void ScriptController::eventScheduler(std::string instruction, 
+      float x1, float y1, float z1, 
+      float x2, float y2, float z2, 
+      float duration, float executionTime)
+    {
+      /* put data (from LUA) into time-sorted eventList*/ 
+      /* Nimmt den befehl und die argumente aus luascript und ertellt einen
+       * struct pro event, diese structs werden sortiert nach eventTime
+       */
+      struct event tmp;
+
+      /* Fill the structure with all the provided information */
+      tmp.fctName = instruction;
+      //tmp.x1 = x1; tmp.y1 = y1; tmp.z1 = z1;
+      //tmp.x2 = x2; tmp.y2 = y2; tmp.z2 = z2;
+      tmp.v1 = Vector3(x1,y1,z1);
+      tmp.v2 = Vector3(x2,y2,z2);
+      tmp.duration = duration;
+      tmp.eventTime = executionTime;
+
+      orxout(verbose) << tmp.fctName << endl;
+
+      /* Add the created event to the event list */
+      if(eventList.size()==0)
+      { /* The list is still empty, just add it */
+        orxout(verbose) << "eventList empty (01)" << endl;
+        eventList.insert(eventList.begin(), tmp);
+        this->eventno += 1;
+        return; /* Nothing more to do, the event was added */
+      }
+
+      /* Event was not added yet since the list was not empty. Walk through
+       * the list of events and add it so that the events are correctly in
+       * order.
+       */
+      for (std::vector<event>::iterator it=eventList.begin(); it<eventList.end(); it++)
+      { if(tmp.eventTime < it->eventTime)
+        { eventList.insert(it,tmp);
+          this->eventno += 1;
+          //orxout()<<"new event added"<<endl;
+          return;
+        }
+      }
+
+      /* If the event was still not added here, it belongs in the end of the list */
+      eventList.insert(eventList.end(), tmp);
+      this->eventno += 1;
+
     }
 }
Index: code/trunk/src/orxonox/controllers/ScriptController.h
===================================================================
--- code/trunk/src/orxonox/controllers/ScriptController.h	(revision 10197)
+++ code/trunk/src/orxonox/controllers/ScriptController.h	(revision 10216)
@@ -30,18 +30,95 @@
 #define _ScriptController_H__
 
-#include "OrxonoxPrereqs.h"
+#include "OrxonoxPrereqs.h"                 /* die ganzen tolua, kopiert aus Dock.h*/
 #include "ArtificialController.h"
+#include "core/EventIncludes.h"
 
-namespace orxonox
-{
-    class _OrxonoxExport ScriptController : public ArtificialController
-    {
+
+
+namespace orxonox  // tolua_export
+{  // tolua_export
+
+    /** Structure to describe a single event */
+    struct event 
+    {   
+        /** Instruction for this event */
+        std::string fctName;
+
+        Vector3 v1;
+        Vector3 v2;
+
+        /** Time span of the event */
+        float duration;
+
+        /** Start point in time of the event */
+        float eventTime;
+    }; 
+
+    class _OrxonoxExport ScriptController // tolua_export 
+       : public ArtificialController, public Tickable
+    {  // tolua_export
         public:
             ScriptController(Context* context);
             virtual ~ScriptController() { }
 
+            void takeControl(int ctrlid);
+            void setPlayer(PlayerInfo* player) { this->player_ = player; }
+           
+            virtual void tick(float dt);
+
+            // LUA interface
+            // tolua_begin 
+            void eventScheduler(std::string instruction, 
+              float x1, float y1, float z1, 
+              float x2, float y2, float z2, 
+              float duration, float executionTime);
+
+            static ScriptController* getScriptController();
+
+            int getID() { return ctrlid_; }
+
+            // tolua_end
+            const Vector3& getPosition();
+
+            void execute(event ev);
+
         private:
-    };
-}
+            /* Information about the player that this ScriptController will
+             * control */
+            /* - Player pointer */
+            PlayerInfo* player_;
+
+            /* - Entity pointer, this is for convenience and will be the same as 
+             *   player_->getControllableEntity() 
+             */
+            ControllableEntity* entity_;
+
+            /* Controller ID, defaults to 0 and is set using takeControl() */
+            int ctrlid_;
+
+            /* List of events to walk through */
+            std::vector<event> eventList;
+            unsigned int eventno;
+
+            /* Time since the creation of this ScriptController object */
+            float scTime;  
+
+            /* Boolean that specifies whether we're processing an event right
+             * now */
+            bool processing;
+
+            /* Data about the event currently being processed */
+            /* - The event itself */
+            event currentEvent;
+
+            /* - Time this event has been going on for */
+            float eventTime;
+            Vector3 startpos;
+
+            /* - Position to look at during that transition */
+            //Vector3 lookAtPosition;
+
+    };// tolua_export
+} // tolua_export
 
 #endif /* _ScriptController_H__ */
Index: code/trunk/src/orxonox/controllers/testscript.lua
===================================================================
--- code/trunk/src/orxonox/controllers/testscript.lua	(revision 10216)
+++ code/trunk/src/orxonox/controllers/testscript.lua	(revision 10216)
@@ -0,0 +1,1 @@
+print	('1: Hello World')
Index: code/trunk/src/orxonox/items/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/items/CMakeLists.txt	(revision 10197)
+++ code/trunk/src/orxonox/items/CMakeLists.txt	(revision 10216)
@@ -3,3 +3,5 @@
   Engine.cc
   MultiStateEngine.cc
+  ShipPart.cc
+  PartDestructionEvent.cc
 )
Index: code/trunk/src/orxonox/items/PartDestructionEvent.cc
===================================================================
--- code/trunk/src/orxonox/items/PartDestructionEvent.cc	(revision 10216)
+++ code/trunk/src/orxonox/items/PartDestructionEvent.cc	(revision 10216)
@@ -0,0 +1,352 @@
+/*
+ *   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:
+ *      Noe Pedrazzini
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "PartDestructionEvent.h"
+
+#include <algorithm>
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+#include "network/NetworkFunction.h"
+#include "Item.h"
+#include "worldentities/pawns/Pawn.h"
+#include "worldentities/pawns/ModularSpaceShip.h"
+#include "items/Engine.h"
+#include "gametypes/Gametype.h"
+#include "chat/ChatManager.h"
+
+
+namespace orxonox
+{
+    RegisterClass(PartDestructionEvent);
+
+    PartDestructionEvent::PartDestructionEvent(Context* context)
+        : Item(context)
+    {
+        RegisterObject(PartDestructionEvent);
+        this->setValid(true);
+    }
+
+    PartDestructionEvent::~PartDestructionEvent()
+    {
+
+    }
+
+    void PartDestructionEvent::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(PartDestructionEvent, XMLPort, xmlelement, mode);
+
+        XMLPortParam(PartDestructionEvent, "targetType", setTargetType, getTargetType, xmlelement, mode).defaultValues("NULL");
+        XMLPortParam(PartDestructionEvent, "targetName", setTargetName, getTargetName, xmlelement, mode).defaultValues("NULL");
+        XMLPortParam(PartDestructionEvent, "operation", setOperation, getOperation, xmlelement, mode).defaultValues("NULL");
+        XMLPortParam(PartDestructionEvent, "targetParam", setTargetParam, getTargetParam, xmlelement, mode).defaultValues("NULL");
+        XMLPortParam(PartDestructionEvent, "value", setEventValue, getEventValue, xmlelement, mode).defaultValues(0);
+        XMLPortParam(PartDestructionEvent, "message", setMessage, getMessage, xmlelement, mode).defaultValues("NULL");
+
+        /*
+        XMLPortParam(PartDestructionEvent, "health", setHealth, getHealth, xmlelement, mode).defaultValues(100);
+        XMLPortParam(PartDestructionEvent, "maxhealth", setMaxHealth, getMaxHealth, xmlelement, mode).defaultValues(200);
+        XMLPortParam(PartDestructionEvent, "initialhealth", setInitialHealth, getInitialHealth, xmlelement, mode).defaultValues(100);
+        */
+    }
+
+    /**
+    @brief
+        Executes this event.
+    */
+    void PartDestructionEvent::execute()
+    {
+        // Do not execute if this event is invalid
+        if(!isValid())
+        {
+            orxout(internal_warning) << "Attempted to execute an invalid PartDestructionEvent!" << endl;
+            return;
+        }
+
+        // Output the destruction-message to the chat
+        if(this->message_ != "NULL")
+            ChatManager::message(this->message_);
+
+        // Modify parameters as configured for all cases
+        if (this->targetType_ == "ship")
+        {
+            switch (this->targetParam_) {
+            case shieldhealth:
+                this->parent_->getParent()->setShieldHealth(operate(this->parent_->getParent()->getShieldHealth()));
+                break;
+            case boostpower:
+                this->parent_->getParent()->setInitialBoostPower(operate(this->parent_->getParent()->getInitialBoostPower()));
+                break;
+            case boostpowerrate:
+                this->parent_->getParent()->setBoostPowerRate(operate(this->parent_->getParent()->getBoostPowerRate()));
+                break;
+            case rotationthrust:
+                this->parent_->getParent()->setRotationThrust(operate(this->parent_->getParent()->getRotationThrust()));
+                break;
+            default:
+                break;
+            }
+            this->setValid(false);
+            return;
+        }
+
+        if (this->targetType_ == "engine")
+        {
+            switch (this->targetParam_) {
+            case null:
+                this->parent_->getParent()->getEngineByName(targetName_)->destroy();
+                break;
+            case boostfactor:
+                this->parent_->getParent()->getEngineByName(targetName_)->setBoostFactor(operate(this->parent_->getParent()->getEngineByName(targetName_)->getBoostFactor()));
+                break;
+            case speedfront:
+                this->parent_->getParent()->getEngineByName(targetName_)->setMaxSpeedFront(operate(this->parent_->getParent()->getEngineByName(targetName_)->getMaxSpeedFront()));
+                break;
+            case accelerationfront:
+                this->parent_->getParent()->getEngineByName(targetName_)->setAccelerationFront(operate(this->parent_->getParent()->getEngineByName(targetName_)->getAccelerationFront()));
+                break;
+            default:
+                break;
+            }
+            this->setValid(false);
+            return;
+        }
+
+        if (this->targetType_ == "part")
+        {
+            switch (this->targetParam_) {
+            case null:
+                if (!this->parent_->getParent()->getShipPartByName(targetName_))
+                    return;
+                this->parent_->getParent()->getShipPartByName(targetName_)->setEventExecution(false);
+                this->parent_->getParent()->killShipPart(targetName_);
+                break;
+            default:
+                break;
+            }
+            this->setValid(false);
+            return;
+        }
+    }
+
+    void PartDestructionEvent::setParent(ShipPart* part)
+    {
+        this->parent_ = part;
+    }
+
+    /**
+    @brief
+        Set type of the target
+    @param param
+        The desired target-type as string. Valid target-types: ship engine weapon
+    */
+    void PartDestructionEvent::setTargetType(std::string type)
+    {
+        if ((type == "ship") || (type == "engine") || (type == "weapon") || (type == "part"))
+        {
+            this->targetType_ = type;
+            return;
+        }
+
+        // Error, if invalid target-type was entered.
+        orxout(internal_warning) << "\"" << type << "\" is not a valid target-type for a PartDestructionEvent. Valid types are: ship engine weapon part" << endl;
+        this->setValid(false);
+        return;
+    }
+
+    void PartDestructionEvent::setTargetName(std::string name)
+    {
+        // Error, if the target-type is "weapon" or "engine", but the name of said target was not defined.
+        if (((this->targetType_ == "weapon") || (this->targetType_ == "engine")) && (name == "NULL"))
+        {
+            orxout(internal_warning) << "The target-name of a PartDestructionEvent with target-type \"" << this->targetType_ << "\" needs to be defined!" << endl;
+            return;
+        }
+
+        this->targetName_ = name;
+    }
+
+    /**
+    @brief
+        Set the operation to be applied.
+    @param param
+        The desired parameter as string. Valid parameters: c.f. @ref orxnox::PartDestructionEvent::TargetParam
+    */
+    void PartDestructionEvent::setTargetParam(std::string param)
+    {
+        // A target-type needs to be defined in order to choose a parameter.
+        if (this->targetType_ == "NULL")
+        {
+            orxout(internal_warning) << "No valid target-type defined. Cannot set target-param for this PartDestructionEvent." << endl;
+            this->setValid(false);
+            return;
+        }
+
+        // engine: NULL boostfactor speedfront accelerationfront
+        if (this->targetType_ == "engine")
+        {
+            if (param == "NULL")
+            {
+                this->targetParam_ = null;
+                return;
+            }
+            if (param == "boostfactor")
+            {
+                this->targetParam_ = boostfactor;
+                return;
+            }
+            if (param == "speedfront")
+            {
+                this->targetParam_ = speedfront;
+                return;
+            }
+            if (param == "accelerationfront")
+            {
+                this->targetParam_ = accelerationfront;
+                return;
+            }
+
+            orxout(internal_warning) << "\"" << param << "\" is not a valid target-param for a PartDestructionEvent with target-type \"engine\". Valid types are: boostfactor speedfront accelerationfront" << endl;
+            return;
+        }
+
+        // weapon:
+
+        // ship: shieldhealth (maxshieldhealth shieldabsorption shieldrechargerate) boostpower boostpowerrate rotationthrust
+        if (this->targetType_ == "ship")
+        {
+            if (param == "shieldhealth")
+            {
+                this->targetParam_ = shieldhealth;
+                return;
+            }
+            if (param == "boostpower")
+            {
+                this->targetParam_ = boostpower;
+                return;
+            }
+            if (param == "boostpowerrate")
+            {
+                this->targetParam_ = boostpowerrate;
+                return;
+            }
+            if (param == "rotationthrust")
+            {
+                this->targetParam_ = rotationthrust;
+                return;
+            }
+
+            orxout(internal_warning) << "\"" << param << "\" is not a valid target-param for a PartDestructionEvent with target-type \"ship\". Valid types are: shieldhealth maxshieldhealth shieldabsorption shieldrechargerate boostpower boostpowerrate rotationthrust" << endl;
+            return;
+        }
+
+        if (this->targetType_ == "part")
+        {
+            if (param == "NULL")
+            {
+                this->targetParam_ = null;
+                return;
+            }
+
+            orxout(internal_warning) << "\"" << param << "\" is not a valid target-param for a PartDestructionEvent with target-type \"part\". Valid types are: NULL (set operation to \"destroy\")" << endl;
+            return;
+        }
+
+        orxout(internal_warning) << "No valid target-param defined. The chosen param is either invalid or not available for this target-type." << endl;
+        this->setValid(false);
+    }
+
+    /**
+    @brief
+        Set the operation to be applied.
+    @param operation
+        The desired operator as string. Valid operators: * + - destroy
+    */
+    void PartDestructionEvent::setOperation(std::string operation)
+    {
+        // * + - destroy
+        if ((operation == "*") || (operation == "+") || (operation == "-") || (operation == "set") || (operation == "destroy"))
+        {
+            this->operation_ = operation;
+            return;
+        }
+        this->operation_ = "NULL";
+        orxout(internal_warning) << "\"" << operation << "\" is not a valid operation for a PartDestructionEvent. Valid operations are: * + - set destroy" << endl;
+    }
+
+    /**
+    @brief
+        Set the message to be shown upon execution of the vent.
+    @param msg
+        The desired message as string.
+    */
+    void PartDestructionEvent::setMessage(std::string msg)
+    {
+        this->message_ = msg;
+    }
+
+
+    /**
+    @brief
+        Apply the configured operation and value to an input.
+    @param input
+        The value which should be modified
+    @return
+        Returns the product / sum / difference of input and configured value,
+        the configured value if the operation is "set",
+        or 0 if the operation is "destroy"
+    */
+    float PartDestructionEvent::operate(float input)
+    {
+        if (this->operation_ == "*")
+            return input * this->value_;
+        if (this->operation_ == "+")
+            return input + this->value_;
+        if (this->operation_ == "-")
+            return input - this->value_;
+        if (this->operation_ == "set")
+            return this->value_;
+        if (this->operation_ == "destroy")
+        {
+            return 0;
+        }
+        return 0;
+    }
+
+    /**
+    @brief
+        Sets the value applied with the chosen operation.
+    @param value
+        The value as float.
+    */
+    void PartDestructionEvent::setEventValue(float value)
+    {
+        this->value_ = value;
+    }
+}
Index: code/trunk/src/orxonox/items/PartDestructionEvent.h
===================================================================
--- code/trunk/src/orxonox/items/PartDestructionEvent.h	(revision 10216)
+++ code/trunk/src/orxonox/items/PartDestructionEvent.h	(revision 10216)
@@ -0,0 +1,160 @@
+/*
+ *   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:
+ *      Noe Pedrazzini
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _PartDestructionEvent_H__
+#define _PartDestructionEvent_H__
+
+#include "OrxonoxPrereqs.h"
+#include "Item.h"
+
+#include <string>
+
+
+namespace orxonox // tolua_export
+{ // tolua_export
+    /**
+        @brief
+            In order to assign attached entities to a ShipPart, a ShipPart with the same name as the corresponding entity needs to be created in the <parts> tag.
+            Here is a (primitive) example of a ModularSpaceShip with ShipParts and PartDestructionEvents defined in XML:
+            @code
+            <ModularSpaceShip
+                ...
+                >
+                    <attached>
+                        <StaticEntity name="generator"  . . .  />
+                        <StaticEntity name="tail" . . . />
+                    </attached>
+                    <parts>
+                        <ShipPart name="generator" . . . >
+                            <destructionevents>
+                                <PartDestructionEvent targetType="ship" targetParam="boostpowerrate" operation="-" value="0.5" message="Your boost-regeneration is reduced!" />
+                            </destructionevents>
+                        </ShipPart>
+                        <ShipPart name="tail" . . . >
+                            <destructionevents>
+                                <PartDestructionEvent ... />
+                            </destructionevents>
+                        </ShipPart>
+                    </parts>
+                    <engines>
+                        <Engine />
+                        <Engine />
+                    </engines>
+                </ModularSpaceShip>
+            @endcode
+
+        @author
+            Fabian 'x3n' Landau, Noe Pedrazzini
+        */
+    class _OrxonoxExport PartDestructionEvent // tolua_export
+        : public Item
+    { // tolua_export
+
+        public:
+
+            /**
+                @brief
+                    List of all allowed parameters.
+                */
+            enum TargetParam
+            {
+                shieldhealth,
+                maxshieldhealth,
+                shieldabsorption,
+                shieldrechargerate,
+                boostpower,         // Amount of available boost
+                boostpowerrate,     // Recharge-rate of boost
+                rotationthrust,
+                boostfactor,
+                speedfront,
+                accelerationfront,
+                null
+            };
+
+            PartDestructionEvent(Context* context);
+            virtual ~PartDestructionEvent();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            void execute();
+
+            inline void setValid(bool valid)
+                { this->valid_ = valid; }
+            inline bool isValid()
+                { return this->valid_; }
+
+            void setParent(ShipPart* parent);
+            inline ShipPart* getParent()
+                { return this->parent_; }
+
+            void setTargetType(std::string type);
+            inline std::string getTargetType()
+                { return this->targetType_; }
+
+            void setTargetName(std::string name);
+            inline std::string getTargetName()
+                { return this->targetName_; }
+
+            void setTargetParam(std::string param);
+            inline std::string getTargetParam()
+                { return this->targetName_; }
+
+            void setOperation(std::string operation);
+            inline std::string getOperation()
+                { return this->operation_; }
+
+            void setMessage(std::string msg);
+            inline std::string getMessage()
+                { return this->message_; }
+
+            float operate(float input);
+
+            void setEventValue(float value);
+            inline float getEventValue()
+                { return this->value_; }
+
+        protected:
+
+        private:
+
+            ShipPart* parent_;          //!< Pointer to the ShipPart this event belongs to
+            bool valid_;                //!< Whether this event is valid or not.
+
+            std::string targetType_;    //!< The type of the target. (ship weapon engine)
+            std::string targetName_;    //!< The name of the target.
+            TargetParam targetParam_;   //!< The parameter to be modified
+            std::string operation_;     //!< The operation to be applied
+            float value_;               //!< The value used to do the operation
+            std::string message_;       //!< The message which is shown in chat when the event is executed.
+
+
+
+    }; // tolua_export
+} // tolua_export
+
+#endif /* _PartDestructionEvent_H__ */
Index: code/trunk/src/orxonox/items/ShipPart.cc
===================================================================
--- code/trunk/src/orxonox/items/ShipPart.cc	(revision 10216)
+++ code/trunk/src/orxonox/items/ShipPart.cc	(revision 10216)
@@ -0,0 +1,291 @@
+/*
+ *   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:
+ *      Noe Pedrazzini
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "ShipPart.h"
+
+#include <algorithm>
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+#include "network/NetworkFunction.h"
+#include "Item.h"
+#include "worldentities/pawns/Pawn.h"
+#include "worldentities/pawns/ModularSpaceShip.h"
+#include "gametypes/Gametype.h"
+#include "worldentities/StaticEntity.h"
+#include "items/PartDestructionEvent.h"
+#include "worldentities/BigExplosion.h"
+#include "chat/ChatManager.h"
+
+
+namespace orxonox
+{
+    RegisterClass(ShipPart);
+
+    ShipPart::ShipPart(Context* context)
+        : Item(context)
+    {
+        RegisterObject(ShipPart);
+        this->setAlive(true);
+        this->setEventExecution(true);
+        this->healthMem_ = 100;
+    }
+
+    ShipPart::~ShipPart()
+    {
+
+    }
+
+    void ShipPart::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(ShipPart, XMLPort, xmlelement, mode);
+
+        XMLPortParam(ShipPart, "health", setHealth, getHealth, xmlelement, mode).defaultValues(100);
+        XMLPortParam(ShipPart, "maxhealth", setMaxHealth, getMaxHealth, xmlelement, mode).defaultValues(200);
+        XMLPortParam(ShipPart, "initialhealth", setInitialHealth, getInitialHealth, xmlelement, mode).defaultValues(100);
+
+        XMLPortParam(ShipPart, "damageabsorption", setDamageAbsorption, getDamageAbsorption, xmlelement, mode).defaultValues(0.5);
+
+        XMLPortParamTemplate(ShipPart, "explosionposition", setExplosionPosition, getExplosionPosition, xmlelement, mode, Vector3);
+
+        XMLPortObject(ShipPart, PartDestructionEvent, "destructionevents", addDestructionEvent, getDestructionEvent, xmlelement, mode);
+    }
+
+    /**
+    @brief
+        Is called when the ShipPart dies.
+        Executes PartDestructionEvents.
+        Tells the ModularSpaceShip to remove this ShipPart.
+    */
+    void ShipPart::death()
+    {
+        //if (!(this->isAlive()))
+            //return;
+
+        this->explode();
+        this->setAlive(false);
+
+        if(eventExecution_)
+        {
+            // Execute all destruction events
+            for (unsigned int i = 0; i < this->eventList_.size(); i++)
+            {
+                this->getDestructionEvent(i)->execute();
+            }
+        }
+
+        // Remove this ShipPart from the parent.
+        this->parent_->removeShipPart(this);
+        delete this;
+    }
+
+    void ShipPart::explode()
+    {
+        BigExplosion* chunk = new BigExplosion(this->getContext());
+        chunk->setPosition(this->parent_->getPosition() + this->parent_->getOrientation() * (this->explosionPosition_));
+        //chunk->setPosition(this->parent_->getPosition() + this->parent_->getOrientation() * Vector3(this->entityList_[0]->getLocalInertia()));
+        chunk->setVelocity(this->parent_->getVelocity());
+
+        // this->explosionSound_->setPosition(this->parent_->getPosition());
+        // this->explosionSound_->play();
+    }
+
+    /**
+    @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);
+    }
+
+    /**
+    @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];
+    }
+
+    /**
+    @brief
+        Check whether the ShipPart has a particular Entity.
+    @param engine
+        A pointer to the Entity to be checked.
+    */
+    bool ShipPart::hasEntity(StaticEntity* entity) const
+    {
+        for(unsigned int i = 0; i < this->entityList_.size(); i++)
+        {
+            if(this->entityList_[i] == entity)
+                return true;
+        }
+        return false;
+    }
+
+    /**
+    @brief
+        Add a PartDestructionEvent to the ShipPart.
+    @param engine
+        A pointer to the PartDestructionEvent to be added.
+    */
+    void ShipPart::addDestructionEvent(PartDestructionEvent* event)
+    {
+        OrxAssert(event != NULL, "The PartDestructionEvent cannot be NULL.");
+        event->setParent(this);
+        this->eventList_.push_back(event);
+    }
+
+    /**
+    @brief
+        Get the i-th PartDestructionEvent of the ShipPart.
+    @return
+        Returns a pointer to the i-the PartDestructionEvent. NULL if there is no PartDestructionEvent with that index.
+    */
+    PartDestructionEvent* ShipPart::getDestructionEvent(unsigned int index)
+    {
+        if(this->eventList_.size() <= index)
+            return NULL;
+        else
+            return this->eventList_[index];
+    }
+
+    void ShipPart::setDamageAbsorption(float value)
+    {
+        this->damageAbsorption_ = value;
+    }
+
+    void ShipPart::setParent(ModularSpaceShip* ship)
+    {
+        this->parent_ = ship;
+    }
+
+    /**
+    @brief
+        Sets the health of the ShipPart.
+    */
+    void ShipPart::setHealth(float health)
+    {
+        this->health_ = health;
+    }
+
+    void ShipPart::setAlive(bool var)
+    {
+        this->alive_ = var;
+        orxout() << "ShipPart " << this->getName() << " alive_: " << this->alive_ << endl;
+    }
+
+    /**
+    @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_));
+            }
+        }
+        if (this->health_ < 0)
+            this->alive_ = false;
+            //this->death();
+
+        // (Ugly) Chatoutput of health, until a GUI for modularspaceships-shipparts is implemented.
+        if ((this->health_ < 0.2 * this->maxHealth_) && (this->healthMem_ == 40))
+        {
+            this->healthMem_ = 20;
+            ChatManager::message("ShipPart " + this->getName() + " remaining health is 20%!");
+            return;
+        }
+        if ((this->health_ < 0.4 * this->maxHealth_) && (this->healthMem_ == 60))
+        {
+            this->healthMem_ = 40;
+            ChatManager::message("ShipPart " + this->getName() + " remaining health is 40%!");
+            return;
+        }
+        if ((this->health_ < 0.6 * this->maxHealth_) && (this->healthMem_ == 80))
+        {
+            this->healthMem_ = 60;
+            ChatManager::message("ShipPart " + this->getName() + " remaining health is 60%!");
+            return;
+        }
+        if ((this->health_ < 0.8 * this->maxHealth_) && (this->healthMem_ == 100))
+        {
+            this->healthMem_ = 80;
+            ChatManager::message("ShipPart " + this->getName() + " remaining health is 80%!");
+            return;
+        }
+    }
+
+
+    /**
+    @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/trunk/src/orxonox/items/ShipPart.h
===================================================================
--- code/trunk/src/orxonox/items/ShipPart.h	(revision 10216)
+++ code/trunk/src/orxonox/items/ShipPart.h	(revision 10216)
@@ -0,0 +1,134 @@
+/*
+ *   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:
+ *      Noe Pedrazzini
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _ShipPart_H__
+#define _ShipPart_H__
+
+#include "OrxonoxPrereqs.h"
+#include "Item.h"
+#include "items/PartDestructionEvent.h"
+
+#include <string>
+
+
+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 death();
+            virtual void explode();
+
+            //virtual void attachTo(Pawn* newParent);
+            //virtual void detach();
+
+            void addEntity(StaticEntity* entity);
+            StaticEntity* getEntity(unsigned int index);
+            bool hasEntity(StaticEntity* entity) const;
+
+            void addDestructionEvent(PartDestructionEvent* event);
+            PartDestructionEvent* getDestructionEvent(unsigned int index);
+
+            virtual void setDamageAbsorption(float value);
+            inline float getDamageAbsorption()
+                { return this->damageAbsorption_; }
+
+            void setParent(ModularSpaceShip* ship);
+            inline ModularSpaceShip* getParent()
+                { return this->parent_; }
+
+            void setAlive(bool var);
+            inline bool isAlive()
+                { return this->alive_; }
+
+            inline void setEventExecution(bool var)
+                { this->eventExecution_ = var; }
+            inline bool isEventExecution()
+                { return this->eventExecution_; }
+
+            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_; }
+
+            inline void setMaxHealth(float maxhealth)
+                { this->maxHealth_ = maxhealth; this->setHealth(this->health_); }
+            inline float getMaxHealth() const
+                { return this->maxHealth_; }
+
+            inline void setInitialHealth(float initialhealth)
+                { this->initialHealth_ = initialhealth; this->setHealth(initialhealth); }
+            inline float getInitialHealth() const
+                { return this->initialHealth_; }
+
+            inline void setExplosionPosition(Vector3 pos)
+                { this->explosionPosition_ = pos; }
+            inline Vector3 getExplosionPosition()
+                { return this->explosionPosition_; }
+
+
+            // FIXME: (noep) Why doesn't this work? Works fine in Engine.h
+            //void addToSpaceShip(ModularSpaceShip* ship);
+
+        protected:
+            ModularSpaceShip* parent_;
+            unsigned int parentID_;     // Object ID of the SpaceShip the Part is mounted on.
+
+            float damageAbsorption_;
+            float health_;
+            float maxHealth_;
+            float initialHealth_;
+
+        private:
+            std::vector<StaticEntity*> entityList_;         // List of all entities which belong to this part
+            std::vector<PartDestructionEvent*> eventList_;  // The list of all PartDestructionEvent assigned to this ShipPart.
+
+            bool alive_;
+            bool eventExecution_;
+
+            float healthMem_;
+
+            Vector3 explosionPosition_;
+
+
+    }; // tolua_export
+} // tolua_export
+
+#endif /* _ShipPart_H__ */
Index: code/trunk/src/orxonox/worldentities/MovableEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/MovableEntity.cc	(revision 10197)
+++ code/trunk/src/orxonox/worldentities/MovableEntity.cc	(revision 10216)
@@ -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,5 +86,4 @@
         return false;
     }
-
 
     void MovableEntity::registerVariables()
Index: code/trunk/src/orxonox/worldentities/MovableEntity.h
===================================================================
--- code/trunk/src/orxonox/worldentities/MovableEntity.h	(revision 10197)
+++ code/trunk/src/orxonox/worldentities/MovableEntity.h	(revision 10216)
@@ -47,5 +47,5 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
+            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
 
             using WorldEntity::setPosition;
Index: code/trunk/src/orxonox/worldentities/WorldEntity.h
===================================================================
--- code/trunk/src/orxonox/worldentities/WorldEntity.h	(revision 10197)
+++ code/trunk/src/orxonox/worldentities/WorldEntity.h	(revision 10216)
@@ -374,5 +374,5 @@
                 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. */
 
Index: code/trunk/src/orxonox/worldentities/pawns/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/CMakeLists.txt	(revision 10197)
+++ code/trunk/src/orxonox/worldentities/pawns/CMakeLists.txt	(revision 10216)
@@ -4,4 +4,5 @@
   Pawn.cc
   SpaceShip.cc
+  ModularSpaceShip.cc
   TeamBaseMatchBase.cc
   Destroyer.cc
Index: code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc	(revision 10216)
+++ code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc	(revision 10216)
@@ -0,0 +1,308 @@
+/*
+ *   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 "core/command/ConsoleCommand.h"
+
+#include "items/ShipPart.h"
+#include "items/Engine.h"
+#include "worldentities/StaticEntity.h"
+#include <BulletCollision/CollisionShapes/btCollisionShape.h>
+#include <BulletCollision/CollisionShapes/btCompoundShape.h>
+
+
+
+namespace orxonox
+{
+    SetConsoleCommand("ModularSpaceShip", "killshippart", &ModularSpaceShip::killShipPartStatic);
+
+    RegisterClass(ModularSpaceShip);
+
+    std::map<StaticEntity*, ShipPart*>* ModularSpaceShip::partMap_s = 0;
+
+    ModularSpaceShip::ModularSpaceShip(Context* context) : SpaceShip(context)
+    {
+        RegisterObject(ModularSpaceShip);
+
+        this->registerVariables();
+
+        ModularSpaceShip::partMap_s = &(this->partMap_);
+
+    }
+
+    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;
+    }
+
+    /**
+    @brief
+        Searches for ShipParts matching to StaticEntities.
+    */
+    void ModularSpaceShip::updatePartAssignment()
+    {
+        // iterate through all attached objects
+        for (unsigned int i=0; i < this->getAttachedObjects().size(); i++)
+        {
+            if (this->getAttachedObject(i) == NULL)
+            {
+                break;
+            }
+            // iterate through all attached parts
+            for(unsigned int j = 0; j < this->partList_.size(); j++)
+            {
+                // if the name of the part matches the name of the object, add the object to that parts entitylist (unless it was already done).
+                if((this->partList_[j]->getName() == this->getAttachedObject(i)->getName()) && !this->partList_[j]->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))
+                {
+                    // The Entity is added to the part's entityList_
+                    this->partList_[j]->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)));
+                    // An entry in the partMap_ is created, assigning the part to the entity.
+                    this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), this->partList_[j]);
+                }
+            }
+        }
+    }
+
+    /**
+    @brief
+        Creates a new assignment for the given StaticEntity and ShipPart in the partMap_
+    @param entity
+        A pointer to the StaticEntity
+    @param part
+        A pointer to the ShipPart.
+    */
+    void ModularSpaceShip::addPartEntityAssignment(StaticEntity* entity, ShipPart* part)
+    {
+        if (!entity || !part)
+            return;
+
+        if (this->partMap_.find(entity) != this->partMap_.end())
+                {
+                    orxout(internal_warning) << "Assigning an Entity to multiple parts is not yet supported." << endl;
+                    return;
+                }
+
+        this->partMap_[entity] = part;
+    }
+
+
+    /**
+    @brief
+        Get the ShipPart an attached entity belongs to.
+    @param entity
+        The entity to be searched.
+    @return
+        Returns a pointer to the ShipPart the entity belongs to.
+    */
+    ShipPart* ModularSpaceShip::getPartOfEntity(StaticEntity* entity) const
+    {
+        for (std::map<StaticEntity*, ShipPart*>::const_iterator it = this->partMap_.begin(); it != this->partMap_.end(); ++it)
+        {
+            if (it->first == entity)
+                return it->second;
+        }
+        return NULL;
+    }
+
+    /**
+    @brief
+        If the damage occurred on an attached StaticEntity, the damage is given to the corresponding ShipPart to handle.
+    */
+    void ModularSpaceShip::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
+    {
+        if (this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) != NULL)
+            this->getPartOfEntity((StaticEntity*)(cs->getUserPointer()))->handleHit(damage, healthdamage, shielddamage, originator);
+        else
+            SpaceShip::damage(damage, healthdamage, shielddamage, originator, cs);
+    }
+
+    /**
+    @brief
+        STATIC: Needed for consolecommand. Kills the ShipPart with the given name. Used from the console-command "ModularSpaceShip killshippart [string]".
+    @param name
+        The name of the part to be killed.
+    */
+    void ModularSpaceShip::killShipPartStatic(std::string name)
+    {
+        for (std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_s->begin(); it != ModularSpaceShip::partMap_s->end(); ++it)
+        {
+            if (it->second->getName() == name)
+            {
+                it->second->setAlive(false);
+                return;
+            }
+        }
+        orxout(internal_warning) << "Could not apply damage to ShipPart \"" << name << "\". Part not found." << endl;
+    }
+
+    /**
+    @brief
+        Kills the ShipPart with the given name. Used from the console-command "ModularSpaceShip killshippart [string]".
+    @param name
+        The name of the part to be killed.
+    */
+    void ModularSpaceShip::killShipPart(std::string name)
+    {
+        for (std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_.begin(); it != ModularSpaceShip::partMap_.end(); ++it)
+        {
+            if (it->second->getName() == name)
+            {
+                it->second->setAlive(false);
+                return;
+            }
+        }
+        orxout(internal_warning) << "Could not apply damage to ShipPart \"" << name << "\". Part not found." << endl;
+    }
+
+    /**
+    @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->setParent(this);
+        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
+        Looks for an attached ShipPart with a certain name.
+    @param name
+        The name of the ShipPart to be returned.
+    @return
+        Pointer to the ShipPart with the given name, or NULL if not found.
+    */
+    ShipPart* ModularSpaceShip::getShipPartByName(std::string name)
+    {
+        for(std::vector<ShipPart*>::iterator it = this->partList_.begin(); it != this->partList_.end(); ++it)
+        {
+            if(orxonox_cast<ShipPart*>(*it)->getName() == name)
+            {
+                return orxonox_cast<ShipPart*>(*it);
+            }
+        }
+        orxout(internal_warning) << "Couldn't find ShipPart with name \"" << name << "\"." << endl;
+        return NULL;
+    }
+
+    /**
+    @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;
+    }
+
+
+    /**
+    @brief
+        Removes a ShipPart from the SpaceShip, destroying the corresponding StaticEntity
+    @param part
+        The ShipPart to be removed.
+    */
+    void ModularSpaceShip::removeShipPart(ShipPart* part)
+    {
+        // Remove the part from the partList_
+        std::vector<ShipPart*>::iterator it = this->partList_.begin();
+        for(unsigned int i = 0; i < this->partList_.size(); i++)
+        {
+            if(this->partList_[i] == part)
+            {
+                this->partList_.erase(it);
+                break;
+            }
+            it++;
+        }
+        // Remove the part-entity assignment and detach the Entity of this ShipPart
+        for (std::map<StaticEntity*, ShipPart*>::iterator itt = this->partMap_.begin(); itt != this->partMap_.end(); )
+        {
+            if (itt->second == part)
+            {
+                this->detach(itt->first);
+                itt->first->destroy();
+                //itt->first->setActive(false);
+                //itt->first->setVisible(false);
+                //itt->first->setCollisionResponse(false);
+                //itt->first->setCollisionType(None);
+                //itt->first->deactivatePhysics();
+                this->partMap_.erase(itt++);
+            } else {
+                ++itt;
+            }
+        }
+    }
+}
Index: code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.h	(revision 10216)
+++ code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.h	(revision 10216)
@@ -0,0 +1,141 @@
+/*
+ *   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 "items/ShipPart.h"
+#include <map>
+
+namespace orxonox
+{
+
+    /**
+    @brief
+        The SpaceShip 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.
+        The ModularSpaceShip is an extension of a @ref orxonox::SpaceShip SpaceShip, which uses @ref orxonox::ShipPart ShipParts to allow entities attached to it to be destroyed individually.
+
+        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.
+        In order to assign attached entities to a ShipPart, a ShipPart with the same name as the corresponding entity needs to be created in the <parts> tag.
+        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
+            >
+                <attached>
+                    <StaticEntity name="wing"  . . .  />
+                    <StaticEntity name="tail" . . . />
+                </attached>
+                <parts>
+                    <ShipPart name="wing" . . . />
+                    <ShipPart name="tail" . . . />
+                </parts>
+                <engines>
+                    <Engine />
+                    <Engine />
+                </engines>
+            </ModularSpaceShip>
+        @endcode
+
+    @author
+        Fabian 'x3n' Landau, Noe Pedrazzini
+    */
+    class _OrxonoxExport ModularSpaceShip : public SpaceShip
+    {
+        public:
+            ModularSpaceShip(Context* context);
+            virtual ~ModularSpaceShip();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            void addPartEntityAssignment(StaticEntity* entity, ShipPart* part);
+            ShipPart* getPartOfEntity(StaticEntity* entity) const;
+
+            virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
+
+            static void killShipPartStatic(std::string name);
+            void killShipPart(std::string name);
+
+            void addShipPart(ShipPart* part);
+            ShipPart* getShipPart(unsigned int index);
+            ShipPart* getShipPartByName(std::string name);
+            bool hasShipPart(ShipPart* part) const;
+            void removeShipPart(ShipPart* part);
+
+            inline void setRotationThrust(float val)
+                { this->rotationThrust_ = val; }
+            inline float getRotationThrust()
+                { return this->rotationThrust_; }
+
+            virtual void updatePartAssignment();
+
+        protected:
+
+
+        private:
+            void registerVariables();
+            std::vector<ShipPart*> partList_;                       // The list of all Parts mounted on this ModularSpaceShip.
+            std::map<StaticEntity*, ShipPart*> partMap_;            // Map of Part-Entity-assignments
+            static std::map<StaticEntity*, ShipPart*>* partMap_s;
+        
+    };
+}
+
+#endif /* _ModularSpaceShip_H__ */
Index: code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.cc	(revision 10197)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.cc	(revision 10216)
@@ -244,5 +244,5 @@
     }
 
-    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.
@@ -279,19 +279,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::hit(Pawn* originator, btManifoldPoint& contactpoint, 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->damage(damage, healthdamage, shielddamage, originator);
+            this->damage(damage, healthdamage, shielddamage, originator, cs);
 
             if ( this->getController() )
@@ -559,5 +558,3 @@
         return BLANKSTRING;
     }
-
-
 }
Index: code/trunk/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.h	(revision 10197)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.h	(revision 10216)
@@ -126,6 +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 hit(Pawn* originator, btManifoldPoint& contactpoint, 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();
@@ -196,5 +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 damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
 
             bool bAlive_;
Index: code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc	(revision 10197)
+++ code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc	(revision 10216)
@@ -342,4 +342,22 @@
     /**
     @brief
+        Looks for an attached Engine with a certain name.
+    @param name
+        The name of the engine to be returned.
+    @return
+        Pointer to the engine with the given name, or NULL if not found.
+    */
+    Engine* SpaceShip::getEngineByName(const std::string& name)
+    {
+        for(size_t i = 0; i < this->engineList_.size(); ++i)
+            if(this->engineList_[i]->getName() == name)
+                return this->engineList_[i];
+
+        orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl;
+        return NULL;
+    }
+
+    /**
+    @brief
         Remove and destroy all Engines of the SpaceShip.
     */
@@ -355,4 +373,6 @@
     @param engine
         A pointer to the Engine to be removed.
+    @note
+        Don't forget to reset the Engine's ship pointer after it was removed (or destroy the engine).
     */
     void SpaceShip::removeEngine(Engine* engine)
Index: code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h	(revision 10197)
+++ code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h	(revision 10216)
@@ -124,4 +124,5 @@
             bool hasEngine(Engine* engine) const; // Check whether the SpaceShip has a particular Engine.
             Engine* getEngine(unsigned int i); // Get the i-th Engine of the SpaceShip.
+            Engine* getEngineByName(const std::string& name);
             /**
             @brief Get the list of all Engines that are mounted on the SpaceShip.
