Index: code/branches/pickup3/src/modules/pickup/CMakeLists.txt
===================================================================
--- code/branches/pickup3/src/modules/pickup/CMakeLists.txt	(revision 6474)
+++ code/branches/pickup3/src/modules/pickup/CMakeLists.txt	(revision 6475)
@@ -1,4 +1,4 @@
 SET_SOURCE_FILES(PICKUP_SRC_FILES
-  DroppedItem.cc
+  DroppedPickup.cc
   Pickup.cc
   PickupCollection.cc
Index: code/branches/pickup3/src/modules/pickup/DroppedItem.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/DroppedItem.cc	(revision 6474)
+++ 	(revision )
@@ -1,122 +1,0 @@
-/*
- *   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:
- *      Daniel 'Huty' Haggenmueller
- *   Co-authors:
- *      ...
- *
- */
-
-#include "DroppedItem.h"
-
-#include "core/CoreIncludes.h"
-#include "interfaces/Pickupable.h"
-#include "graphics/Model.h"
-
-namespace orxonox
-{
-    /**
-    @brief
-        Constructor. Registers object and sets default values.
-    */
-    DroppedItem::DroppedItem(BaseObject* creator) : PickupSpawner(creator)
-    {
-        this->initialize();
-    }
-
-    DroppedItem::DroppedItem(BaseObject* creator, Pickupable* item, const Vector3& position, float triggerDistance) : PickupSpawner(creator, item, triggerDistance, 0, 1)
-    {   
-        this->initialize();
-        
-        this->createDrop(position);
-    }
-    
-    void DroppedItem::initialize(void)
-    {
-        RegisterObject(DroppedItem);
-        
-        this->gotPickedUp_ = false;
-    }
-
-    /**
-    @brief
-        Default destructor.
-    */
-    DroppedItem::~DroppedItem()
-    {
-        if(this->gotPickedUp_ && this->pickup_ != NULL)
-        {
-            this->pickup_ = NULL;
-        }
-    }
-
-    Pickupable* DroppedItem::getPickup(void)
-    {
-        return this->pickup_;
-    }
-    
-    //TODO; Doesn't seem to be needed anymore, just put setPosition in the constructor.
-    void DroppedItem::createDrop(const Vector3& position)
-    {
-        this->setPosition(position);
-        
-        //TODO: Make this work.
-        //const Model& model = PickupManager::getModel(item->getPickupIdentifier());
-        //this->attach(model);
-    }
-
-//TODO: Remove.
-    //TODO: Comment.
-    //Each pickup should have a XML template where the Model and Billboard, and so on, is specified.
-//    /*static*/ DroppedItem* DroppedItem::createDefaultDrop(BaseItem* item, const Vector3& position, const ColourValue& flareColour, float timeToLive)
-//     {
-//         //TODO: triggerDistance?
-//         float triggerDistance = 20.0;
-//         DroppedItem* droppedItem = new DroppedItem(item, item, triggerDistance, 0, 1);
-//         
-//         //TODO: Do this somehwere else?
-//         Model* model = new Model(item);
-//         Billboard* billboard = new Billboard(item);
-// 
-//         model->setMeshSource("sphere.mesh");
-//         model->setScale(3.0f);
-// 
-//         billboard->setMaterial("Examples/Flare");
-//         billboard->setColour(flareColour);
-//         billboard->setScale(0.5f);
-// 
-//         droppedItem->setPosition(position);
-//         droppedItem->attach(model);
-//         droppedItem->attach(billboard);
-// 
-//         COUT(3) << "Created DroppedItem for '" << item->getPickupIdentifier() << "' at (" << position.x << "," << position.y << "," << position.z << ")." << std::endl;
-// 
-//         return droppedItem;
-//     }
-
-    //TODO: See one function above.
-//     DroppedItem* DroppedItem::createDefaultDrop(BaseItem* item, Pawn* pawn, const ColourValue& flareColour, float timeToLive)
-//     {
-//         Vector3 after = pawn->getPosition() + pawn->getOrientation() * Vector3(0.0f, 0.0f, 50.0f);
-//         return DroppedItem::createDefaultDrop(item, after, flareColour, timeToLive);
-//     }
-}
Index: code/branches/pickup3/src/modules/pickup/DroppedItem.h
===================================================================
--- code/branches/pickup3/src/modules/pickup/DroppedItem.h	(revision 6474)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- *   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:
- *      Daniel 'Huty' Haggenmueller
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-    @file
-    @brief Definition of DroppedItem
-*/
-
-#ifndef _DroppedItem_H__
-#define _DroppedItem_H__
-
-#include "PickupPrereqs.h"
-
-#include "PickupSpawner.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport DroppedItem : public PickupSpawner
-    {
-        public:
-            DroppedItem(BaseObject* creator);
-            DroppedItem(BaseObject* creator, Pickupable* item, const Vector3& position, float triggerDistance);
-            virtual ~DroppedItem();
-
-        protected:
-            virtual Pickupable* getPickup(void);
-            
-        private:
-            void initialize(void);
-            void createDrop(const Vector3& position);
-            
-            bool gotPickedUp_;
-
-    };
-}
-
-#endif /* _DroppedItem_H__ */
Index: code/branches/pickup3/src/modules/pickup/DroppedPickup.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/DroppedPickup.cc	(revision 6475)
+++ code/branches/pickup3/src/modules/pickup/DroppedPickup.cc	(revision 6475)
@@ -0,0 +1,105 @@
+/*
+ *   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:
+ *      Daniel 'Huty' Haggenmueller
+ *   Co-authors:
+ *      Damian 'Mozork' Frick
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the DroppedPickup class.
+*/
+
+#include "DroppedPickup.h"
+
+#include "core/CoreIncludes.h"
+#include "interfaces/Pickupable.h"
+#include "graphics/Model.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Default constructor. Registers object and sets default values.
+    */
+    DroppedPickup::DroppedPickup(BaseObject* creator) : PickupSpawner(creator)
+    {
+        RegisterObject(DroppedPickup);
+        
+        this->initialize();
+    }
+
+    /**
+    @brief
+        Constructor. Registers the object and sets values.
+    @param creator
+        The creator of the DroppedPickup.
+    @param pickup
+        The Pickupable that was dropped.
+    @param position
+        The position at which the DroppedPickup should be created.
+    @param triggerDistance
+        The distance at which the PickupSpawner triggers. Default is 10.
+    */
+    DroppedPickup::DroppedPickup(BaseObject* creator, Pickupable* pickup, const Vector3& position, float triggerDistance) : PickupSpawner(creator, pickup, triggerDistance, 0, 1)
+    {   
+        RegisterObject(DroppedPickup);
+        
+        this->initialize();
+        
+        this->setPosition(position);
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    DroppedPickup::~DroppedPickup()
+    {
+        if(this->gotPickedUp_ && this->pickup_ != NULL)
+        {
+            this->pickup_ = NULL;
+        }
+    }
+    
+    /**
+    @brief
+        Initializes the member variables of the object.
+    */
+    void DroppedPickup::initialize(void)
+    {
+        this->gotPickedUp_ = false;
+    }
+
+    /**
+    @brief
+        Creates the Pickupable that is going to get picked up.
+        In the case of the DroppedItem it is the one and only Pickupable that was dropped. No additional Pickupables of the same type are created.
+    */
+    Pickupable* DroppedPickup::getPickup(void)
+    {
+        return this->pickup_;
+    }
+
+}
Index: code/branches/pickup3/src/modules/pickup/DroppedPickup.h
===================================================================
--- code/branches/pickup3/src/modules/pickup/DroppedPickup.h	(revision 6475)
+++ code/branches/pickup3/src/modules/pickup/DroppedPickup.h	(revision 6475)
@@ -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:
+ *      Daniel 'Huty' Haggenmueller
+ *   Co-authors:
+ *      Damian 'Mozork' Frick
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the DroppedPickup class.
+*/
+
+#ifndef _DroppedPickup_H__
+#define _DroppedPickup_H__
+
+#include "PickupPrereqs.h"
+
+#include "PickupSpawner.h"
+
+namespace orxonox
+{
+    
+    /**
+    @brief
+        Special PickupSpawner that is created whe a Pickupable is dropped. It just spawns one pickup, the one that was dropped.
+    @author
+        Daniel 'Huty' Haggenmueller
+        Damian 'Mozork' Frick
+    */
+    class _OrxonoxExport DroppedPickup : public PickupSpawner
+    {
+        public:
+            DroppedPickup(BaseObject* creator); //!< Default constructor.
+            DroppedPickup(BaseObject* creator, Pickupable* pickup, const Vector3& position, float triggerDistance = 10.0); //!< Constructor.
+            virtual ~DroppedPickup(); //!< Destructor.
+
+        protected:
+            virtual Pickupable* getPickup(void); //!< Creates the Pickupable that is going to get picked up.
+            
+        private:
+            void initialize(void); //!< Initializes the member variables of the object.
+            
+            bool gotPickedUp_; //!< Whether the pickup got picked up or not.
+
+    };
+}
+
+#endif /* _DroppedPickup_H__ */
Index: code/branches/pickup3/src/modules/pickup/Pickup.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/Pickup.cc	(revision 6474)
+++ code/branches/pickup3/src/modules/pickup/Pickup.cc	(revision 6475)
@@ -30,4 +30,7 @@
 
 #include "core/CoreIncludes.h"
+#include "util/StringUtils.h"
+#include "pickup/PickupIdentifier.h"
+#include "DroppedPickup.h"
 
 namespace orxonox
@@ -38,7 +41,6 @@
     /*static*/ const std::string Pickup::durationTypeOnce_s = "once";
     /*static*/ const std::string Pickup::durationTypeContinuous_s = "continuous";
-    /*static*/ const std::string Pickup::blankString_s = "";
-    
-    //TODO: Should this bee here? Does it work without?
+    
+    //TODO: Should this be here? Does it work without?
     CreateFactory(Pickup);
     
@@ -47,4 +49,5 @@
         RegisterObject(Pickup);
         
+        this->initialize();
     }
     
@@ -54,18 +57,37 @@
     }
     
+    /**
+    @brief
+        Initializes the member variables.
+    */
+    void Pickup::initialize(void)
+    {
+        this->activationType_ = pickupActivationType::immediate;
+        this->durationType_ = pickupDurationType::once;
+    }
+    
+    /**
+    @brief
+        Initializes the PickupIdentififer of this Pickup.
+    */
     void Pickup::initializeIdentifier(void)
     {
-        this->pickupIdentifier_.addClass(this->getIdentifier());
+        //TODO: Check whether this could not be done in the Constructor if Pickupable. Would be much more convenient.
+        this->pickupIdentifier_->addClass(this->getIdentifier());
         
         //TODO: Works?
         std::string val1 = this->getActivationType();
         std::string type1 = "activationType";
-        this->pickupIdentifier_.addParameter(type1, val1);
+        this->pickupIdentifier_->addParameter(type1, val1);
         
         std::string val2 = this->getDurationType();
         std::string type2 = "durationType";
-        this->pickupIdentifier_.addParameter(type2, val2);
-    }
-    
+        this->pickupIdentifier_->addParameter(type2, val2);
+    }
+    
+    /**
+    @brief
+        Method for creating a Pickup object through XML.
+    */
     void Pickup::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
@@ -81,6 +103,6 @@
     @brief
         Get the activation type of the pickup.
-    @param buffer
-        The buffer to store the activation type as string in.
+    @return
+        Returns a string containing the activation type.
     */
     const std::string& Pickup::getActivationType(void)
@@ -93,5 +115,5 @@
                 return activationTypeOnUse_s;
             default:
-                return blankString_s;
+                return BLANKSTRING;
         }
     }
@@ -100,6 +122,6 @@
     @brief
         Get the duration type of the pickup.
-    @param buffer
-        The buffer to store the duration type as string in.
+    @return
+        Returns a string containing the duration type.
     */
     const std::string& Pickup::getDurationType(void)
@@ -112,5 +134,5 @@
                 return durationTypeContinuous_s;
             default:
-                return blankString_s;
+                return BLANKSTRING;
         }
     }
@@ -162,5 +184,21 @@
     /**
     @brief
-        Creates a duplicate of the pickup.
+        Should be called when the pickup has transited from picked up to dropped or the other way around.
+        Any Class overwriting this method must call its SUPER function by adding SUPER(Classname, changedCarrier); to their changedCarrier method.
+    */
+    void Pickup::changedCarrier(void)
+    {
+        SUPER(Pickup, changedCarrier);
+        
+        //! Sets the Pickup to used if the Pickup has activation type 'immediate' and gets picked up.
+        if(this->isPickedUp() && this->isImmediate())
+        {
+            this->setUsed(true);
+        }
+    }
+    
+    /**
+    @brief
+        Creates a duplicate of the Pickup.
     @return
         Returns the clone of this pickup as a pointer to a Pickupable.
@@ -179,13 +217,19 @@
         pickup->initializeIdentifier();
     }
-    
-    void Pickup::changedCarrier(void)
-    {
-        SUPER(Pickup, changedCarrier);
-        
-        if(this->isPickedUp() && this->isImmediate())
-        {
-            this->setUsed(true);
-        }
+        
+    /**
+    @brief
+        Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
+        This method must be implemented by any class directly inheriting from Pickupable. It is most easily done by just creating a new DroppedPickup, e.g.:
+        DroppedPickup(BaseObject* creator, Pickupable* pickup, const Vector3& position);
+    @param position
+        The position at which the PickupSpawner should be placed.
+    @return
+        Returns true if a spawner was created, false if not.
+    */
+    bool Pickup::createSpawner(const Vector3& position)
+    {
+        DroppedPickup::DroppedPickup(this, this, position);
+        return true;
     }
     
Index: code/branches/pickup3/src/modules/pickup/Pickup.h
===================================================================
--- code/branches/pickup3/src/modules/pickup/Pickup.h	(revision 6474)
+++ code/branches/pickup3/src/modules/pickup/Pickup.h	(revision 6475)
@@ -28,11 +28,12 @@
 
 #ifndef _Pickup_H__
-#define Pickup_H__
+#define _Pickup_H__
 
 #include "pickup/PickupPrereqs.h"
 
-#include "interfaces/Pickupable.h"
 #include "core/BaseObject.h"
 #include "core/XMLPort.h"
+
+#include "interfaces/Pickupable.h"
 
 namespace orxonox
@@ -59,11 +60,17 @@
     }
     
+    /**
+    @brief
+        Pickup class. Offers base functionality for a wide range of pickups.
+        Pickups ingeriting from this class cann choose an activation type and a duration type.
+    @author
+        Damian 'Mozork' Frick
+    */
     class _PickupExport Pickup : public Pickupable, public BaseObject
     {
         
         public:
-            
-            Pickup(BaseObject* creator);
-            virtual ~Pickup();
+            Pickup(BaseObject* creator); //!< Constructor.
+            virtual ~Pickup(); //!< Destructor.
             
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
@@ -85,19 +92,37 @@
             const std::string& getDurationType(void); //!< Get the duration type of the pickup.
             
+            /**
+            @brief Get whether the activation type is 'immediate'.
+            @return Returns true if the activation type is 'immediate'.
+            */
             inline bool isImmediate(void)
                 { return this->getActivationTypeDirect() == pickupActivationType::immediate; }
+            /**
+            @brief Get whether the activation type is 'onUse'.
+            @return Returns true if the activation type is 'onUse'.
+            */
             inline bool isOnUse(void)
                 { return this->getActivationTypeDirect() == pickupActivationType::onUse; }
+            /**
+            @brief Get whether the duration type is 'once'.
+            @return Returns true if the duration type is 'once'.
+            */
             inline bool isOnce(void)
                 { return this->getDurationTypeDirect() == pickupDurationType::once; }
+            /**
+            @brief Get whether the duration type is 'continuous'.
+            @return Returns true if the duration type is 'continuous'.
+            */
             inline bool isContinuous(void)
                 { return this->getDurationTypeDirect() == pickupDurationType::continuous; }
-                        
-            virtual void clone(OrxonoxClass* item);
             
-            virtual void changedCarrier(void);
+            virtual void changedCarrier(void); //!< Should be called when the pickup has transited from picked up to dropped or the other way around.
+                                    
+            virtual void clone(OrxonoxClass* item); //!< Creates a duplicate of the Pickup.
                 
         protected:
             void initializeIdentifier(void);
+            
+            virtual bool createSpawner(const Vector3& position); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
             
             /**
@@ -118,4 +143,6 @@
                 
         private:
+            void initialize(void); //!< Initializes the member variables.
+            
             pickupActivationType::Value activationType_; //!< The activation type of the Pickup.
             pickupDurationType::Value durationType_; //!< The duration type of the pickup.
@@ -125,5 +152,4 @@
             static const std::string durationTypeOnce_s;
             static const std::string durationTypeContinuous_s;
-            static const std::string blankString_s; //TODO: Maybe already implemented somewhere?
         
     };
Index: code/branches/pickup3/src/modules/pickup/PickupCollection.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupCollection.cc	(revision 6474)
+++ code/branches/pickup3/src/modules/pickup/PickupCollection.cc	(revision 6475)
@@ -38,4 +38,7 @@
 #include "core/XMLPort.h"
 #include "interfaces/PickupCarrier.h"
+#include "DroppedPickup.h"
+
+#include "PickupCollectionIdentifier.h"
 
 namespace orxonox
@@ -49,4 +52,6 @@
     {
         RegisterObject(PickupCollection);
+        
+        this->pickupCollectionIdentifier_ = new PickupCollectionIdentifier();
     }
     
@@ -60,5 +65,5 @@
         for(std::vector<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
         {
-            delete *it;
+            (*it)->destroy();
         }
     }
@@ -80,10 +85,26 @@
     void PickupCollection::initializeIdentifier(void)
     {
-        this->pickupCollectionIdentifier_.addClass(this->getIdentifier());
+        this->pickupCollectionIdentifier_->addClass(this->getIdentifier());
         
         for(std::vector<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
         {
-            this->pickupCollectionIdentifier_.addPickup((*it)->getPickupIdentifier());
+            this->pickupCollectionIdentifier_->addPickup((*it)->getPickupIdentifier());
         }
+    }
+    
+    /**
+    @brief
+        Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
+        This method must be implemented by any class directly inheriting from Pickupable. It is most easily done by just creating a new DroppedPickup, e.g.:
+        DroppedPickup(BaseObject* creator, Pickupable* pickup, const Vector3& position);
+    @param position
+        The position at which the PickupSpawner should be placed.
+    @return
+        Returns true if a spawner was created, false if not.
+    */
+    bool PickupCollection::createSpawner(const Vector3& position)
+    {
+        DroppedPickup::DroppedPickup(this, this, position);
+        return true;
     }
     
@@ -159,3 +180,8 @@
     }
     
+    const PickupIdentifier* PickupCollection::getPickupIdentifier(void)
+    {
+        return this->pickupCollectionIdentifier_;
+    }
+    
 }
Index: code/branches/pickup3/src/modules/pickup/PickupCollection.h
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupCollection.h	(revision 6474)
+++ code/branches/pickup3/src/modules/pickup/PickupCollection.h	(revision 6475)
@@ -36,6 +36,4 @@
 #include "core/XMLPort.h"
 
-#include "PickupCollectionIdentifier.h"
-
 #include <list>
 
@@ -66,6 +64,5 @@
             virtual void clone(OrxonoxClass* item);
             
-            virtual const PickupIdentifier* getPickupIdentifier(void)
-                { return &this->pickupCollectionIdentifier_; }
+            virtual const PickupIdentifier* getPickupIdentifier(void);
             
             bool addPickupable(Pickupable* pickup);
@@ -75,5 +72,7 @@
             void initializeIdentifier(void);
             
-            PickupCollectionIdentifier pickupCollectionIdentifier_;
+            virtual bool createSpawner(const Vector3& position); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
+            
+            PickupCollectionIdentifier* pickupCollectionIdentifier_;
             
         private:
Index: code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.cc	(revision 6474)
+++ code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.cc	(revision 6475)
@@ -44,7 +44,7 @@
     }
 
-    int PickupCollectionIdentifier::compare(const PickupIdentifier& identifier) const
+    int PickupCollectionIdentifier::compare(const PickupIdentifier* identifier) const
     {
-        PickupIdentifier* temp = const_cast<PickupIdentifier*>(&identifier);
+        PickupIdentifier* temp = const_cast<PickupIdentifier*>(identifier);
         const PickupCollectionIdentifier* collectionIdentifier = dynamic_cast<PickupCollectionIdentifier*>(temp);
         if(collectionIdentifier == NULL)
@@ -60,7 +60,7 @@
         {
             
-            if((*it)->compare(**it2) < 0)
+            if((*it)->compare(*it2) < 0)
                 return -1;
-            if((*it2)->compare(**it) < 0)
+            if((*it2)->compare(*it) < 0)
                 return 1;
         }
Index: code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.h
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.h	(revision 6474)
+++ code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.h	(revision 6475)
@@ -45,10 +45,10 @@
             ~PickupCollectionIdentifier();
             
-            virtual int compare(const PickupIdentifier& identifier) const;
+            virtual int compare(const PickupIdentifier* identifier) const;
             
             void addPickup(const PickupIdentifier* identifier);
             
         private:
-            std::set<const PickupIdentifier*, PickupIdentifierPtrCompare> identifiers_;
+            std::set<const PickupIdentifier*, PickupIdentifierCompare> identifiers_;
             
     };
Index: code/branches/pickup3/src/modules/pickup/PickupManager.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupManager.cc	(revision 6474)
+++ code/branches/pickup3/src/modules/pickup/PickupManager.cc	(revision 6475)
@@ -83,5 +83,5 @@
     */
     //TODO: Make sure that either the PickupRepresentation is destroyed upon destruction of the PickupManager if the representation wasn't created with XMLPort.
-    bool PickupManager::registerRepresentation(const PickupIdentifier& identifier, PickupRepresentation* representation)
+    bool PickupManager::registerRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation)
     {
         if(this->representations_.find(identifier) == this->representations_.end()) //!< If the Pickupable already has a RepresentationRegistered.
@@ -104,5 +104,5 @@
     PickupRepresentation* PickupManager::getRepresentation(const PickupIdentifier* identifier)
     {
-        std::map<const PickupIdentifier, PickupRepresentation*, PickupIdentifierCompare>::iterator it = this->representations_.find(*identifier);
+        std::map<const PickupIdentifier*, PickupRepresentation*, PickupIdentifierCompare>::iterator it = this->representations_.find(identifier);
         if(it == this->representations_.end())
         {
Index: code/branches/pickup3/src/modules/pickup/PickupManager.h
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupManager.h	(revision 6474)
+++ code/branches/pickup3/src/modules/pickup/PickupManager.h	(revision 6475)
@@ -71,5 +71,5 @@
             static PickupManager& getInstance() { return Singleton<PickupManager>::getInstance(); }
             
-            bool registerRepresentation(const PickupIdentifier& identifier, PickupRepresentation* representation); //!< Registers a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents.
+            bool registerRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation); //!< Registers a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents.
             PickupRepresentation* getRepresentation(const PickupIdentifier* identifier); //!< Get the PickupRepresentation representing the Pickupable with the input PickupIdentifier.
             
@@ -81,5 +81,5 @@
             
             PickupRepresentation* defaultRepresentation_; //!< The default PickupRepresentation.
-            std::map<const PickupIdentifier, PickupRepresentation*, PickupIdentifierCompare> representations_; //!< Map linking PickupIdentifiers (representing types if Pickupables) and PickupRepresentations.
+            std::map<const PickupIdentifier*, PickupRepresentation*, PickupIdentifierCompare> representations_; //!< Map linking PickupIdentifiers (representing types if Pickupables) and PickupRepresentations.
             
             //TODO: Delete or utilize this.
Index: code/branches/pickup3/src/modules/pickup/PickupPrereqs.h
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupPrereqs.h	(revision 6474)
+++ code/branches/pickup3/src/modules/pickup/PickupPrereqs.h	(revision 6475)
@@ -66,5 +66,5 @@
 {
 
-    class DroppedItem;
+    class DroppedPickup;
     class Pickup;
     class PickupCollection;
Index: code/branches/pickup3/src/modules/pickup/PickupRepresentation.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupRepresentation.cc	(revision 6474)
+++ code/branches/pickup3/src/modules/pickup/PickupRepresentation.cc	(revision 6475)
@@ -30,6 +30,7 @@
 
 #include "core/CoreIncludes.h"
+#include "graphics/Billboard.h"
+#include "util/StringUtils.h"
 #include "PickupManager.h"
-#include "graphics/Billboard.h"
 
 namespace orxonox
@@ -38,4 +39,9 @@
     CreateFactory(PickupRepresentation);
     
+    /**
+    @brief
+        Constructor. Registers the object and initializes its member variables.
+        This is primarily for use of the PickupManager in creating a default PickupRepresentation.
+    */
     PickupRepresentation::PickupRepresentation() : BaseObject(this)
     {
@@ -45,4 +51,8 @@
     }
     
+    /**
+    @brief
+        Default Constructor. Registers the object and initializes its member variables.
+    */
     PickupRepresentation::PickupRepresentation(BaseObject* creator) : BaseObject(creator)
     {
@@ -52,9 +62,18 @@
     }
     
+    /**
+    @brief
+        Destructor.
+    */
     PickupRepresentation::~PickupRepresentation()
     {
-        
+        if(this->spawnerRepresentation_ != NULL)
+            this->spawnerRepresentation_->destroy();
     }
     
+    /**
+    @brief
+        Initializes the member variables of this PickupRepresentation.
+    */
     void PickupRepresentation::initialize(void)
     {
@@ -66,4 +85,8 @@
     }
     
+    /**
+    @brief
+        Method for creating a PickupRepresentation object through XML.
+    */
     void PickupRepresentation::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
@@ -76,7 +99,15 @@
         XMLPortObject(PickupRepresentation, StaticEntity, "spawner-representation", setSpawnerRepresentation, getSpawnerRepresentationIndex, xmlelement, mode);
         
-        PickupManager::getInstance().registerRepresentation(*this->pickup_->getPickupIdentifier(), this);
+        PickupManager::getInstance().registerRepresentation(this->pickup_->getPickupIdentifier(), this); //!< Registers the PickupRepresentation with the PickupManager through the PickupIdentifier of the Pickupable it represents.
     }
     
+    /**
+    @brief
+        Get a spawnerRepresentation for a specific PickupSpawner.
+    @param spawner
+        A pointer to the PickupSpawner.
+    @return
+        Returns a pointer to the StaticEntity.
+    */
     StaticEntity* PickupRepresentation::getSpawnerRepresentation(PickupSpawner* spawner)
     {
@@ -84,11 +115,13 @@
         {
             COUT(4) << "PickupRepresentation: No spawner representation found." << std::endl;
-            if(this->spawnerTemplate_ == "")
+            if(this->spawnerTemplate_ == BLANKSTRING)
             {
                 COUT(4) << "PickupRepresentation: Spawner template is empty." << std::endl;
+                //!< If neither spawnerRepresentation nor spawnerTemplate was specified
                 return this->getDefaultSpawnerRepresentation(spawner);
             }
             this->addTemplate(this->spawnerTemplate_);
         }
+        
         StaticEntity* representation = this->spawnerRepresentation_;
         
@@ -98,4 +131,14 @@
     }
     
+    /**
+    @brief
+        Get the default spawnerRepresentation for a specific PickupSpawner.
+        Helper method of internal use.
+    @param spawner
+        A pointer to the PickupSpawner.
+    @return
+        Returns a pointer to the StaticEntity.
+    */
+    //TODO: Think of more elegant solution.
     StaticEntity* PickupRepresentation::getDefaultSpawnerRepresentation(PickupSpawner* spawner)
     {
Index: code/branches/pickup3/src/modules/pickup/PickupRepresentation.h
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupRepresentation.h	(revision 6474)
+++ code/branches/pickup3/src/modules/pickup/PickupRepresentation.h	(revision 6475)
@@ -32,60 +32,108 @@
 #include "PickupPrereqs.h"
 
+#include "core/XMLPort.h"
+#include "interfaces/Pickupable.h"
+#include "pickup/PickupIdentifier.h"
+#include "worldentities/StaticEntity.h"
+#include "PickupSpawner.h"
+
 #include "core/BaseObject.h"
-
-#include "core/XMLPort.h"
-#include "pickup/PickupIdentifier.h"
-#include "interfaces/Pickupable.h"
-#include "pickup/PickupSpawner.h"
-#include "worldentities/StaticEntity.h"
 
 namespace orxonox
 {
 
+    /**
+    @brief
+        The PickupRepresentation class represents a specific pickup type (identified by its PickupIdentifier). It defines the information displayed in the GUI and how PickupSpawners that spawn the pickup type look like.
+        They are created through XML and are registered with the PickupManager.
+    */
     class _PickupExport PickupRepresentation : public BaseObject
     {
         
         public:
-            PickupRepresentation();
-            PickupRepresentation(BaseObject* creator);
-            virtual ~PickupRepresentation();
+            PickupRepresentation(); //!< Constructor
+            PickupRepresentation(BaseObject* creator); //!< Default constructor.
+            virtual ~PickupRepresentation(); //!< Destructor.
             
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
             
+            /**
+            @brief Set the name of the Pickupable represented by this PickupRepresentation.
+            @param name The name.
+            */
             inline void setName(const std::string& name)
                 { this->name_ = name; }
+            /**
+            @brief Set the description of the Pickupable represented by this PickupRepresentation.
+            @param description The Description.
+            */
             inline void setDescription(const std::string& description)
                 { this->description_ = description; }
+            /**
+            @brief Set the spawnerTemplate of the Pickupable represented by this PickupRepresentation.
+                   The spawnerTemplate is a name of a template defined in XML that defines the StaticEntity that is the spawnerRepresentation of this PickupRepresentation.
+            @param spawnerTemplate The name of the template.
+            */
             inline void setSpawnerTemplate(const std::string& spawnerTemplate)
                 { this->spawnerTemplate_ = spawnerTemplate; }
+            /**
+            @brief Set the StaticEntity that defines how the PickupSpawner of the Pickupable represented by this PickupRepresentation looks like.
+                   This will be set by the spawnerTemplate. Setting it when creating the PickupRepresentation without creating a template and specifying its name will be futile, because through the course of the game many PickupSpawners for one specific pickup type may have to be created, thus the StaticEntity that is the spawnerRepresentation has to be generated (with the template) for every new PickupSpawner spawning the Pickupable represented by this PickupRepresentation. The spawnerRepresentation that is set here, however can only be used once.
+            @param representation A pointer to the StaticEntity that is the spawnerRepresentation of this PickupRepresentation.
+            */
             inline void setSpawnerRepresentation(StaticEntity* representation)
                 { this->spawnerRepresentation_ = representation; }
+            /**
+            @brief Set the Pickupable that is represented by this PickupRepresentation.
+            @param pickup A pointer to the Pickupable.
+            */
             inline void setPickup(Pickupable* pickup)
                 { this->pickup_ = pickup; }
                 
+            /**
+            @brief Get the name of the Pickupable represented by this PickupRepresentation.
+            @return Returns the name.
+            */
             inline const std::string& getName(void)
                 { return this->name_; }
+            /**
+            @brief Get the description of the Pickupable represented by this PickupRepresentation.
+            @return Returns the description.
+            */
             inline const std::string& getDescription(void)
                 { return this->description_; }
+            /**
+            @brief Get the name of spawnerTemplate the Pickupable represented by this PickupRepresentation.
+            @return Returns the name of the spawnerTemplate.
+            */
             inline const std::string& getSpawnerTemplate(void)
                 { return this->spawnerTemplate_; }
+            /**
+            @brief Get the StaticEntity that defines how the PickupSpawner of the Pickupable represented by this PickupRepresentation looks like.
+            @param index The index.
+            @return Returns (for index = 0) a pointer to the StaticEntity. For index > 0 it returns NULL.
+            */
             inline const StaticEntity* getSpawnerRepresentationIndex(unsigned int index)
                 { if(index == 0) return this->spawnerRepresentation_; return NULL; }
+            /**
+            @brief Get the Pickupable represented by this PickupRepresentation.
+            @param index The index.
+            @return Returns (for index = 0) a pointer to the Pickupable. For index > 0 it returns NULL.
+            */
             inline const Pickupable* getPickup(unsigned int index)
                 { if(index == 0) return this->pickup_; return NULL; }
                 
-            StaticEntity* getSpawnerRepresentation(PickupSpawner* spawner);
+            StaticEntity* getSpawnerRepresentation(PickupSpawner* spawner); //!< Get a spawnerRepresentation for a specific PickupSpawner.
         
         private:
-            void initialize(void);
-            StaticEntity* getDefaultSpawnerRepresentation(PickupSpawner* spawner);
+            void initialize(void); //!< Initializes the member variables of this PickupRepresentation.
+            StaticEntity* getDefaultSpawnerRepresentation(PickupSpawner* spawner); //!< Get the default spawnerRepresentation for a specific PickupSpawner.
             
-            std::string name_;
-            std::string description_;
-            std::string spawnerTemplate_;
-            StaticEntity* spawnerRepresentation_;
+            std::string name_; //!< The name of the Pickupable represented by this PickupRepresentation.
+            std::string description_; //!< The description of the Pickupable represented by this PickupRepresentation.
+            std::string spawnerTemplate_; //!<  The name of the template of this PickupRepresentation.
+            StaticEntity* spawnerRepresentation_; //!< The spawnerRepresentation of this PickupRepresentation.
             
-            Pickupable* pickup_;
-            
+            Pickupable* pickup_; //!< The Pickupable that is represented by this PickupRepresentation.
             
     };
Index: code/branches/pickup3/src/modules/pickup/PickupSpawner.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupSpawner.cc	(revision 6474)
+++ code/branches/pickup3/src/modules/pickup/PickupSpawner.cc	(revision 6475)
@@ -35,5 +35,4 @@
 
 #include "core/CoreIncludes.h"
-//#include "core/GUIManager.h"     // HACK; see below
 #include "core/Template.h"
 #include "core/XMLPort.h"
@@ -41,13 +40,7 @@
 #include "PickupManager.h"
 #include "PickupRepresentation.h"
-//#include "PickupInventory.h"    // HACK; Only for hack, remove later
-
 
 namespace orxonox
 {
-
-//     const float PickupSpawner::bounceSpeed_s = 6.0f;
-//     const float PickupSpawner::rotationSpeed_s = 1.0f;
-//     const float PickupSpawner::bounceDistance_s = 4.0f;
 
     CreateFactory(PickupSpawner);
@@ -64,7 +57,4 @@
         
         this->initialize();
-        
-        PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(NULL);
-        this->attach(representation->getSpawnerRepresentation(this));
     }
 
@@ -95,6 +85,14 @@
         this->setMaxSpawnedItems(maxSpawnedItems);
         
-        PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(this->pickup_->getPickupIdentifier());
-        this->attach(representation->getSpawnerRepresentation(this));
+        if(this->pickup_ == NULL)
+        {
+            COUT(2) << "A PickupSpawner was created without a valid Pickupable. This won't work." << std::endl;
+            this->setActive(false);
+        }
+        else
+        {
+            PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(this->pickup_->getPickupIdentifier());
+            this->attach(representation->getSpawnerRepresentation(this));
+        }
     }
 
@@ -109,5 +107,4 @@
         this->triggerDistance_ = 20;
         this->respawnTime_ = 0;
-        this->tickSum_ = 0;
         this->maxSpawnedItems_ = INF;
         this->spawnsRemaining_ = INF;
@@ -141,23 +138,94 @@
         XMLPortParam(PickupSpawner, "respawnTime", setRespawnTime, getRespawnTime, xmlelement, mode);
         XMLPortParam(PickupSpawner, "maxSpawnedItems", setMaxSpawnedItems, getMaxSpawnedItems, xmlelement, mode);
-
-        //TODO: Kill hack.
-        // HACKs
-        // Load the GUI image as soon as the PickupSpawner gets loaded
-        //  = less delays while running
-//         BaseObject* newObject = this->itemTemplate_->getBaseclassIdentifier()->fabricate(this);
-//         BaseItem* asItem = orxonox_cast<BaseItem*>(newObject);
-//         if (asItem)
-//         {
-//             asItem->addTemplate(this->itemTemplate_);
-//             PickupInventory::getImageForItem(asItem);
-//             newObject->destroy();
-//         }
-
-        //  & load the GUI itself too, along with some empty windows
-        //   = even less delays
-//         GUIManager::getInstance().showGUI("PickupInventory");
-//         GUIManager::getInstance().executeCode("hideGUI(\"PickupInventory\")");
-//         PickupInventory::getSingleton();
+        
+        if(this->pickup_ == NULL)
+        {
+            COUT(2) << "A PickupSpawner was created without a valid Pickupable. This won't work." << std::endl;
+            this->setActive(false);
+        }
+        else
+        {
+            PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(this->pickup_->getPickupIdentifier());
+            this->attach(representation->getSpawnerRepresentation(this));
+        }
+    }
+    
+    /**
+    @brief
+        Invoked when the activity has changed. Sets visibility of attached objects.
+    */
+    void PickupSpawner::changedActivity()
+    {
+        SUPER(PickupSpawner, changedActivity);
+
+        for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
+        {
+            (*it)->setVisible(this->isActive());
+        }
+    }
+     
+    /**
+    @brief
+        Tick, checks if any Pawn is close enough to trigger.
+    @param dt
+        Time since last tick.
+    */
+    //TODO: Replace this with a real DistanceTrigger? Or better with collisions?
+    void PickupSpawner::tick(float dt)
+    {
+        //! If the PickupSpawner is active.
+        if (this->isActive())
+        {
+            //! Iterate trough all Pawns.
+            for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
+            {
+                Vector3 distance = it->getWorldPosition() - this->getWorldPosition();
+                //! If a Pawn, that fits the target-range of the item spawned by this Pickup, is in trigger-distance.
+                if (distance.length() < this->triggerDistance_ && this->pickup_->isTarget(*it))
+                {
+                    this->trigger(*it);
+                }
+            }
+        }
+    }
+    
+    /**
+    @brief
+        Sets the maximum number of spawned items.
+    @param items
+        The maximum number of spawned items to be set.
+    */
+    void PickupSpawner::setMaxSpawnedItems(int items)
+    {
+        this->maxSpawnedItems_ = items;
+        this->spawnsRemaining_ = items;
+    }
+    
+    /**
+    @brief
+        Decrements the number of remaining spawns.
+        Sets the PickupSpawner to inactive for the duration of the respawnTime.
+        Destroys the PickupSpawner if the number of remaining spawns has reached zero.
+    */
+    void PickupSpawner::decrementSpawnsRemaining(void)
+    {
+        if(this->spawnsRemaining_ != INF)
+        {
+            this->spawnsRemaining_--;
+        }
+        if(this->spawnsRemaining_ != 0 && this->respawnTime_ > 0)
+        {
+            //TODO: Nicer? Does this even work?
+            this->respawnTimer_.setTimer(this->respawnTime_, false, createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback, this)));
+
+            this->setActive(false);
+            this->fireEvent();
+        }
+        else
+        {
+            COUT(3) << "PickupSpawner empty, selfdestruct initialized." << std::endl;
+            this->setActive(false);
+            this->destroy();
+        }
     }
     
@@ -172,10 +240,10 @@
         if(this->pickup_ != NULL)
         {
-            COUT(1) << "addPickupable called, with this->pickup_ already set." << std::endl;
+            COUT(1) << "In PickupSpawner: setPickupable called, with this->pickup_ already set." << std::endl;
             return;
         }
         if(pickup == NULL)
         {
-            COUT(1) << "Argument of addPickupable is NULL." << std::endl;
+            COUT(1) << "In PickupSpawner: Argument of setPickupable is NULL." << std::endl;
             return;
         }
@@ -197,89 +265,50 @@
     /**
     @brief
-        Invoked when the activity has changed. Sets visibility of attached objects.
-    */
-//     void PickupSpawner::changedActivity()
-//     {
-//         SUPER(PickupSpawner, changedActivity);
-// 
-//         for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
-//             (*it)->setVisible(this->isActive());
-//     }
-
-    /**
-    @brief
-        Sets the maximum number of spawned items.
-    @param items
-        The maximum number of spawned items to be set.
-    */
-    void PickupSpawner::setMaxSpawnedItems(int items)
-    {
-        this->maxSpawnedItems_ = items;
-        this->spawnsRemaining_ = items;
-    }
-
-    /**
-    @brief
-        Tick, checks if any Pawn is close enough to trigger.
-    @param dt
-        Time since last tick.
-    */
-    //TODO: Replace this with a real DistanceTrigger? Or better with collisions?
-    void PickupSpawner::tick(float dt)
-    {
-        //! If the PickupSpawner is active.
-        if (this->isActive())
-        {
-            //! Iterate trough all Pawns.
-            for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
-            {
-                Vector3 distance = it->getWorldPosition() - this->getWorldPosition();
-                //! If a Pawn, that fits the target-range of the item spawned by this Pickup, is in trigger-distance.
-                if (distance.length() < this->triggerDistance_ && this->pickup_->isTarget(*it))
-                {
-                    this->trigger(*it);
-                }
-            }
-
-            //! Animation.
-//             this->yaw(Radian(rotationSpeed_s*dt));
-//             this->tickSum_ += bounceSpeed_s*dt;
-//             this->translate(Vector3(0,bounceDistance_s*dt*sin(this->tickSum_),0));
-//             if (this->tickSum_ > 2*Ogre::Math::PI)
-//                 this->tickSum_ -= 2*Ogre::Math::PI;
-        }
-    }
-
-    /**
-    @brief
         Trigger the PickupSpawner.
-
-        Adds the pickup to the Pawn that triggered,
-        sets the timer to re-activate and deactives the PickupSpawner.
-
+        Adds the pickup to the Pawn that triggered, sets the timer to re-activate and deactives the PickupSpawner.
     @param pawn
         Pawn which triggered the PickupSpawner.
     */
+    //TODO: Make more generic -> without pawn.
     void PickupSpawner::trigger(Pawn* pawn)
     {
-        //TODO: If private, isActive doesn't need to be tested anymore.
         if (this->isActive()) //!< Checks whether PickupItem is active.
         {
+            PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(pawn);
+            if(carrier == NULL)
+            {
+                COUT(1) << "This is bad. Pawn isn't PickupCarrier." << std::endl;
+                return;
+            }
+            
+            if(!carrier->isTarget(this->pickup_))
+            {
+                COUT(4) << "PickupSpawner triggered but Pawn wasn't a target of the Pickupable." << std::endl;
+                return;
+            }
+            
+            PickupCarrier* target = carrier->getTarget(this->pickup_);
             Pickupable* pickup = this->getPickup();
-            if (pickup != NULL) //!< If everything went ok, and pickup is not NULL.
-            {
-                //TODO: Not correct anymore.
-                PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(pawn);
-                if(carrier == NULL)
-                {
-                    COUT(1) << "This is bad. Pawn isn't PickupCarrier." << std::endl;
-                    return;
-                }
+            
+            if(target != NULL || pickup != NULL)
+            {
+                if(carrier->pickup(pickup))
+                {
+                    this->decrementSpawnsRemaining();
+                }
+                else
+                {
+                    pickup->destroy();
+                }
+            }
+            else
+            {
+                //TODO: Really that severe?
+                if(target == NULL)
+                    COUT(1) << "PickupSpawner: Pickupable has no target." << std::endl;
                 
-                if(carrier->pickup(pickup))
-                {
-                    COUT(3) << "Pickup got picked up." << std::endl;
-
-                    this->decrementSpawnsRemaining();
+                if(pickup == NULL)
+                {
+                    COUT(1) << "PickupSpawner: getPickup produced an error, no Pickupable created." << std::endl;
                 }
                 else
@@ -288,33 +317,4 @@
                 }
             }
-        }
-    }
-    
-    /**
-    @brief
-        Decrements the number of remaining spawns.
-        Sets the PickupSpawner to inactive for the duration of the respawnTime.
-        Destroys the PickupSpawner if the number of remaining spawns has reached zero.
-        
-    */
-    void PickupSpawner::decrementSpawnsRemaining(void)
-    {
-        if(this->spawnsRemaining_ != INF)
-        {
-            this->spawnsRemaining_--;
-        }
-        if(this->spawnsRemaining_ != 0 && this->respawnTime_ > 0)
-        {
-            //TODO: Nicer? Does this even work?
-            this->respawnTimer_.setTimer(this->respawnTime_, false, createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback, this)));
-
-            this->setActive(false);
-            this->fireEvent();
-        }
-        else
-        {
-            COUT(3) << "PickupSpawner empty, selfdistruct initialized." << std::endl;
-            this->setActive(false);
-            this->destroy(); //TODO: Implement destroy().
         }
     }
Index: code/branches/pickup3/src/modules/pickup/PickupSpawner.h
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupSpawner.h	(revision 6474)
+++ code/branches/pickup3/src/modules/pickup/PickupSpawner.h	(revision 6475)
@@ -23,5 +23,5 @@
  *      Daniel 'Huty' Haggenmueller
  *   Co-authors:
- *      ...
+ *      Damian 'Mozork' Frick
  *
  */
@@ -38,36 +38,40 @@
 
 #include <string>
+#include "interfaces/Pickupable.h"
 #include "tools/Timer.h"
+
 #include "tools/interfaces/Tickable.h"
 #include "worldentities/StaticEntity.h"
-#include "interfaces/Pickupable.h"
 
 namespace orxonox
 {
     /**
-        @brief PickupSpawner.
-        @author Daniel 'Huty' Haggenmueller
+        @brief
+            The PickupSpawner class is responsible for spawning pickups of a specific type.
+            Forthermore it can be specified how long the time interval between spawning two items is and how many pickups are spawned at maximum, amongst other things.
+        @author
+            Daniel 'Huty' Haggenmueller
+            Damian 'Mozork' Frick
     */
     class _OrxonoxExport PickupSpawner : public StaticEntity, public Tickable
     {
         public:
-            //TODO: Add limit of items spawned here.
-            PickupSpawner(BaseObject* creator);
-            PickupSpawner(BaseObject* creator, Pickupable* pickup, float triggerDistance, float respawnTime, int maxSpawnedItems);
-            virtual ~PickupSpawner();
+            PickupSpawner(BaseObject* creator); //!< Default Constructor.
+            PickupSpawner(BaseObject* creator, Pickupable* pickup, float triggerDistance, float respawnTime, int maxSpawnedItems); //!< Constructor.
+            virtual ~PickupSpawner(); //!< Destructor.
 
-            //virtual void changedActivity();                                 //!< Invoked when activity has changed (set visibilty).
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< Method for creating a PickupSpawner through XML.
+            virtual void changedActivity(); //!< Invoked when activity has changed (set visibilty).
             virtual void tick(float dt);
 
             /**
-                @brief Get the distance in which to trigger.
-                @return Returns the distance in which this gets triggered.
+            @brief Get the distance in which to trigger.
+            @return Returns the distance in which this gets triggered.
             */
             inline float getTriggerDistance() const
                 { return this->triggerDistance_; }
             /**
-                @brief Set the distance in which to trigger.
-                @param value The new distance in which to trigger.
+            @brief Set the distance in which to trigger.
+            @param value The new distance in which to trigger.
             */
             inline void setTriggerDistance(float value)
@@ -75,12 +79,12 @@
 
             /**
-                @brief Get the time to respawn.
-                @returns Returns the time after which this gets re-actived.
+            @brief Get the time to respawn.
+            @returns Returns the time after which this gets re-actived.
             */
             inline float getRespawnTime() const
                 { return this->respawnTime_; }
             /**
-                @brief Set the time to respawn.
-                @param time New time after which this gets re-actived.
+            @brief Set the time to respawn.
+            @param time New time after which this gets re-actived.
             */
             inline void setRespawnTime(float time)
@@ -88,18 +92,18 @@
 
             /**
-                @brief Get the maximum number of items that will be spawned by this PickupSpawner.
-                @return Returns the maximum number of items spawned by this PickupSpawner.
+            @brief Get the maximum number of items that will be spawned by this PickupSpawner.
+            @return Returns the maximum number of items spawned by this PickupSpawner.
             */
             inline int getMaxSpawnedItems(void)
                 { return this->maxSpawnedItems_; }
-            void setMaxSpawnedItems(int items);
+            void setMaxSpawnedItems(int items); //!< Sets the maximum number of spawned items.
 
         protected:
-            virtual Pickupable* getPickup(void);
+            void decrementSpawnsRemaining(void); //!< Decrements the number of remaining spawns.
             
-            void setPickupable(Pickupable* pickup);
-            const Pickupable* getPickupable(void);
+            virtual Pickupable* getPickup(void); //!< Creates a new Pickupable.
             
-            void decrementSpawnsRemaining(void);
+            void setPickupable(Pickupable* pickup); //!< Sets a Pickupable for the PickupSpawner to spawn.
+            const Pickupable* getPickupable(void); //!< Get the Pickupable that is spawned by this PickupSpawner.
             
             Pickupable* pickup_; //!< The pickup to be spawned.
@@ -108,22 +112,16 @@
             void initialize(void);
             
-            void trigger(Pawn* pawn);                                       //!< Method called when a Pawn is close enough.
-            void respawnTimerCallback();                                    //!< Method called when the timer runs out.
+            void trigger(Pawn* pawn); //!< Method called when a Pawn is close enough.
+            void respawnTimerCallback(); //!< Method called when the timer runs out.
 
-            int maxSpawnedItems_;                   //!< Maximum number of items spawned by this PickupSpawner.
-            int spawnsRemaining_;                   //!< Number of items that can be spawned by this PickupSpawner until it selfdestructs.
+            int maxSpawnedItems_; //!< Maximum number of items spawned by this PickupSpawner.
+            int spawnsRemaining_; //!< Number of items that can be spawned by this PickupSpawner until it selfdestructs.
 
-            float triggerDistance_;                 //!< Distance in which this gets triggered.
+            float triggerDistance_; //!< Distance in which this gets triggered.
 
-            /* Pickup animation */
-            float tickSum_;                         //!< Adds up tick to use in sine movement
-            static const float bounceSpeed_s;       //!< Speed of pickup to bounce up and down
-            static const float bounceDistance_s;    //!< Distance the pickup bounces up and down
-            static const float rotationSpeed_s;     //!< Rotation speed of pickup
+            float respawnTime_; //!< Time after which this gets re-actived.
+            Timer respawnTimer_; //!< Timer used for re-activating.
 
-            float respawnTime_;                     //!< Time after which this gets re-actived.
-            Timer respawnTimer_;                    //!< Timer used for re-activating.
-
-            static const int INF = -1;             //!< Constant for infinity.
+            static const int INF = -1; //!< Constant for infinity.
     };
 }
Index: code/branches/pickup3/src/modules/pickup/items/HealthPickup.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/items/HealthPickup.cc	(revision 6474)
+++ code/branches/pickup3/src/modules/pickup/items/HealthPickup.cc	(revision 6475)
@@ -33,4 +33,5 @@
 
 #include "worldentities/pawns/Pawn.h"
+#include "pickup/PickupIdentifier.h"
 
 #include <sstream>
@@ -70,5 +71,5 @@
     void HealthPickup::initializeIdentifier(void)
     {
-        this->pickupIdentifier_.addClass(this->getIdentifier());
+        this->pickupIdentifier_->addClass(this->getIdentifier());
         
         std::stringstream stream;
@@ -76,10 +77,10 @@
         std::string type1 = "health";
         std::string val1 = stream.str();
-        this->pickupIdentifier_.addParameter(type1, val1);
+        this->pickupIdentifier_->addParameter(type1, val1);
         
         //TODO: Does this work, is val valid outside the function scope?
         std::string val2 = this->getHealthType();
         std::string type2 = "healthType";
-        this->pickupIdentifier_.addParameter(type2, val2);
+        this->pickupIdentifier_->addParameter(type2, val2);
     }
     
