Index: code/branches/dockingsystem2/src/modules/CMakeLists.txt
===================================================================
--- code/branches/dockingsystem2/src/modules/CMakeLists.txt	(revision 8195)
+++ code/branches/dockingsystem2/src/modules/CMakeLists.txt	(revision 8196)
@@ -34,2 +34,3 @@
 ADD_SUBDIRECTORY(questsystem)
 ADD_SUBDIRECTORY(weapons)
+ADD_SUBDIRECTORY(docking)
Index: code/branches/dockingsystem2/src/modules/docking/CMakeLists.txt
===================================================================
--- code/branches/dockingsystem2/src/modules/docking/CMakeLists.txt	(revision 8196)
+++ code/branches/dockingsystem2/src/modules/docking/CMakeLists.txt	(revision 8196)
@@ -0,0 +1,16 @@
+SET_SOURCE_FILES(DOCKING_SRC_FILES
+  DockingEffect.cc
+  DockToShip.cc
+  Dock.cc
+)
+
+ORXONOX_ADD_LIBRARY(docking
+  MODULE
+  FIND_HEADER_FILES
+  TOLUA_FILES
+  PCH_FILE
+    DockingPrecompiledHeaders.h
+  LINK_LIBRARIES
+    orxonox
+  SOURCE_FILES ${DOCKING_SRC_FILES}
+)
Index: code/branches/dockingsystem2/src/modules/docking/Dock.cc
===================================================================
--- code/branches/dockingsystem2/src/modules/docking/Dock.cc	(revision 8196)
+++ code/branches/dockingsystem2/src/modules/docking/Dock.cc	(revision 8196)
@@ -0,0 +1,146 @@
+/*
+ *   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:
+ *      Sven Stucki
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file Dock.cc
+	@brief Docking system main class
+*/
+
+#include "Dock.h"
+#include "infos/HumanPlayer.h"
+#include "worldentities/pawns/Pawn.h"
+#include "interfaces/PlayerTrigger.h"
+
+
+namespace orxonox
+{
+    CreateFactory(Dock);
+
+    Dock::Dock(BaseObject* creator) : StaticEntity(creator)
+    {
+        RegisterObject(Dock);
+        COUT(0) << "Registering dock..." << std::endl;
+    }
+
+    Dock::~Dock()
+    {
+    }
+
+
+    void Dock::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Dock, XMLPort, xmlelement, mode);
+
+        XMLPortObject(Dock, DockingEffect, "effects", addEffect, getEffect, xmlelement, mode);
+        XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode);
+
+        COUT(0) << "Dock created.." << std::endl;
+    }
+
+    void Dock::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Dock, XMLEventPort, xmlelement, mode);
+
+        XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode);
+    }
+
+
+    bool Dock::execute(bool bTriggered, BaseObject* trigger)
+    {
+        //TODO: Handle DistanceMultiTrigger
+
+        PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger);
+        Pawn* pawn = NULL;
+
+        // Check whether it is a player trigger and extract pawn from it
+        if(pTrigger != NULL)
+        {
+            if(!pTrigger->isForPlayer()) {  // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
+                COUT(0) << "Docking:execute PlayerTrigger was not triggered by a player.." << std::endl;
+                return false;
+            }
+            pawn = pTrigger->getTriggeringPlayer();
+        } else {
+            COUT(0) << "Docking::execute Not a player trigger, can't extract pawn from it.." << std::endl;
+            return false;
+        }
+        if(pawn == NULL)
+        {
+            COUT(0) << "Docking::execute Can't retrieve Pawn from Trigger. (" << trigger->getIdentifier()->getName() << ")" << std::endl;
+            return false;
+        }
+
+        // Extract the PlayerInfo from the Pawn.
+        PlayerInfo* player = pawn->getPlayer();
+        if(player == NULL)
+        {
+            COUT(0) << "The PlayerInfo* is NULL." << std::endl;
+            return false;
+        }
+
+        // Try to get HumanPlayer
+        if(!player->isHumanPlayer()) {
+            COUT(0) << "Docking::execute Not triggered by a human." << std::endl;
+            return false;
+        }
+        HumanPlayer* human = orxonox_cast<HumanPlayer*>(player);
+        if(human == NULL) {
+            COUT(0) << "Docking::execute Player was not as human as expected.." << std::endl;
+        }
+        COUT(0) << "Dock triggered by player: " << human->getNick() << ".." << std::endl;
+
+        //TODO: This is waaay too oversimplified
+        if(bTriggered) {
+            DockingEffect::invokeEffect(docking::DOCKING, player, effects_);
+            //DockingEffect::invokeEffect(docking::ATTACH, player, effects_);
+        } else {
+            DockingEffect::invokeEffect(docking::RELEASE, player, effects_);
+        }
+
+        return true;
+    }
+
+
+    bool Dock::addEffect(DockingEffect* effect) {
+        assert(effect);
+        effects_.push_back(effect);
+        return true;
+    }
+
+    const DockingEffect* Dock::getEffect(unsigned int index) const {
+        int i = index;
+        for (std::list<DockingEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect)
+        {
+            if(i == 0)
+               return *effect;
+
+            i--;
+        }
+        return NULL;
+    }
+}
Index: code/branches/dockingsystem2/src/modules/docking/Dock.h
===================================================================
--- code/branches/dockingsystem2/src/modules/docking/Dock.h	(revision 8196)
+++ code/branches/dockingsystem2/src/modules/docking/Dock.h	(revision 8196)
@@ -0,0 +1,69 @@
+/*
+ *   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:
+ *      Sven Stucki
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file Dock.h
+    @brief Definition of Dock class
+    @ingroup Docking
+*/
+
+#ifndef _Dock_H__
+#define _Dock_H__
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "core/EventIncludes.h"
+
+#include "worldentities/StaticEntity.h"
+#include "DockingEffect.h"
+#include "DockingPrereqs.h"
+
+namespace orxonox { 
+
+
+    class _DockingExport Dock : public StaticEntity {
+    public:
+        Dock(BaseObject* creator);
+        virtual ~Dock();
+
+        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+        virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
+
+        bool execute(bool bTriggered, BaseObject* trigger);
+
+        bool addEffect(DockingEffect* effect); //!< Add a DockingEffect to the Dock.
+        const DockingEffect* getEffect(unsigned int index) const; //!< Get the DockingEffect at a given index.
+
+    private:
+        std::list<DockingEffect*> effects_; //!< The list of DockingEffects to be executed when a player docks.
+    };
+
+
+}
+
+#endif /* _Dock_H__ */
Index: code/branches/dockingsystem2/src/modules/docking/DockToShip.cc
===================================================================
--- code/branches/dockingsystem2/src/modules/docking/DockToShip.cc	(revision 8196)
+++ code/branches/dockingsystem2/src/modules/docking/DockToShip.cc	(revision 8196)
@@ -0,0 +1,70 @@
+/*
+ *   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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file DockToShip.cc
+    @brief Implementation of the DockToShip class.
+*/
+
+#include "DockingEffect.h"
+#include "DockToShip.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    CreateFactory(DockToShip);
+
+    DockToShip::DockToShip(BaseObject* creator) : DockingEffect(creator)
+    {
+        RegisterObject(DockToShip);
+        COUT(0) << "DockToShip instance created.." << endl;
+    }
+
+    DockToShip::~DockToShip()
+    {
+
+    }
+
+    bool DockToShip::docking(PlayerInfo* player)
+    {
+        COUT(0) << "DockToShip::docking" << endl;
+        return true;
+    }
+
+    bool DockToShip::attach(PlayerInfo* player)
+    {
+        COUT(0) << "DockToShip::attach" << endl;
+        return true;
+    }
+
+    bool DockToShip::release(PlayerInfo* player)
+    {
+        COUT(0) << "DockToShip::release" << endl;
+        return true;
+    }
+}
Index: code/branches/dockingsystem2/src/modules/docking/DockToShip.h
===================================================================
--- code/branches/dockingsystem2/src/modules/docking/DockToShip.h	(revision 8196)
+++ code/branches/dockingsystem2/src/modules/docking/DockToShip.h	(revision 8196)
@@ -0,0 +1,67 @@
+/*
+ *   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:
+ *      Sven Stucki
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file DockToShip.h
+    @brief DockingEffect which transfers control from spaceship to docked ship ASDF
+    @ingroup Docking
+*/
+
+#ifndef _DockToShip_H__
+#define _DockToShip_H__
+
+#include "DockingPrereqs.h"
+#include "DockToShip.h"
+
+
+namespace orxonox
+{
+
+    /**
+    @brief
+        Allows players to dock onto a ship
+
+    @author
+        Sven Stucki
+
+    @ingroup Docking
+    */
+    class _DockingExport DockToShip : public DockingEffect
+    {
+        public:
+            DockToShip(BaseObject* creator);
+            virtual ~DockToShip();
+
+            virtual bool docking(PlayerInfo* player); //!< Called when docking starts
+            virtual bool attach(PlayerInfo* player); //!< Called after docking animation
+            virtual bool release(PlayerInfo* player); //!< Called when player wants undock
+    };
+
+}
+
+#endif /* _DockToShip_H__ */
Index: code/branches/dockingsystem2/src/modules/docking/DockingEffect.cc
===================================================================
--- code/branches/dockingsystem2/src/modules/docking/DockingEffect.cc	(revision 8196)
+++ code/branches/dockingsystem2/src/modules/docking/DockingEffect.cc	(revision 8196)
@@ -0,0 +1,73 @@
+/*
+ *   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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file DockingEffect.cc
+    @brief Implementation of the DockingEffect class.
+*/
+
+#include "DockingEffect.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    DockingEffect::DockingEffect(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(DockingEffect);
+    }
+
+    DockingEffect::~DockingEffect()
+    {
+
+    }
+
+    bool DockingEffect::invokeEffect(docking::event event, PlayerInfo* player, std::list<DockingEffect*> & effects)
+    {
+        bool check = true;
+
+        COUT(4) << "Invoking DockingEffects on player: " << player << " ."  << std::endl;
+
+        for (std::list<DockingEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++) {
+            switch(event) {
+                case docking::DOCKING:
+                    check &= (*effect)->docking(player);
+                    break;
+                case docking::ATTACH:
+                    check &= (*effect)->attach(player);
+                    break;
+                case docking::RELEASE:
+                    check &= (*effect)->release(player);
+                    break;
+                default:
+                    assert(0);
+            }
+        }
+
+        return check;
+    }
+}
Index: code/branches/dockingsystem2/src/modules/docking/DockingEffect.h
===================================================================
--- code/branches/dockingsystem2/src/modules/docking/DockingEffect.h	(revision 8196)
+++ code/branches/dockingsystem2/src/modules/docking/DockingEffect.h	(revision 8196)
@@ -0,0 +1,77 @@
+/*
+ *   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:
+ *      Sven Stucki 
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file DockingEffect.h
+    @brief Definition of the DockingEffect class.
+    @ingroup Docking
+*/
+
+#ifndef _DockingEffect_H__
+#define _DockingEffect_H__
+
+#include "DockingPrereqs.h"
+
+#include <list>
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+    namespace docking {
+        enum event {
+            DOCKING,
+            ATTACH,
+            RELEASE
+        };
+    }
+
+    /**
+    @brief
+        Handles DockingEffects for @ref orxonox::Docking "Docks".
+
+    @author
+        Sven Stucki
+
+    @ingroup Docking
+    */
+    class _DockingExport DockingEffect : public BaseObject
+    {
+        public:
+            DockingEffect(BaseObject* creator);
+            virtual ~DockingEffect();
+
+            virtual bool docking(PlayerInfo* player) = 0; //!< Called when docking starts
+            virtual bool attach(PlayerInfo* player) = 0; //!< Called after docking animation
+            virtual bool release(PlayerInfo* player) = 0; //!< Called when player wants undock
+
+            static bool invokeEffect(docking::event event, PlayerInfo* player, std::list<DockingEffect*> & effects); //!< Invokes the event specific method of all DockingEffects in the list
+    };
+
+}
+
+#endif /* _DockingEffect_H__ */
Index: code/branches/dockingsystem2/src/modules/docking/DockingPrecompiledHeaders.h
===================================================================
--- code/branches/dockingsystem2/src/modules/docking/DockingPrecompiledHeaders.h	(revision 8196)
+++ code/branches/dockingsystem2/src/modules/docking/DockingPrecompiledHeaders.h	(revision 8196)
@@ -0,0 +1,53 @@
+/*
+ *   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:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+*/
+
+#include "OrxonoxConfig.h"
+
+///////////////////////////////////////////
+/////          Stable Headers         /////
+///////////////////////////////////////////
+
+#include <LinearMath/btTransform.h>
+
+///////////////////////////////////////////
+/////       All Rebuild Headers       /////
+///////////////////////////////////////////
+
+#include "core/BaseObject.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+
+// Just in case some header included windows.h
+#undef min
+#undef max
Index: code/branches/dockingsystem2/src/modules/docking/DockingPrereqs.h
===================================================================
--- code/branches/dockingsystem2/src/modules/docking/DockingPrereqs.h	(revision 8196)
+++ code/branches/dockingsystem2/src/modules/docking/DockingPrereqs.h	(revision 8196)
@@ -0,0 +1,72 @@
+/*
+ *   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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    Shared library macros, enums, constants and forward declarations for the questsystem module
+*/
+
+#ifndef _DockingPrereqs_H__
+#define _DockingPrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(Docking_STATIC_BUILD)
+#  ifdef Docking_SHARED_BUILD
+#    define _DockingExport __declspec(dllexport)
+#  else
+#    if defined( __MINGW32__ )
+#      define _DockingExport
+#    else
+#      define _DockingExport __declspec(dllimport)
+#    endif
+#  endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+#  define _DockingExport  __attribute__ ((visibility("default")))
+#else
+#  define _DockingExport
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+    class Dock;
+    class DockingEffect;
+    class DockToShip;
+}
+
+#endif /* _DockingPrereqs_H__ */
