Index: code/trunk/src/orxonox/interfaces/Pickupable.h
===================================================================
--- code/trunk/src/orxonox/interfaces/Pickupable.h	(revision 6901)
+++ code/trunk/src/orxonox/interfaces/Pickupable.h	(revision 7163)
@@ -41,8 +41,9 @@
 
 #include "core/OrxonoxClass.h"
+#include "Rewardable.h"
 
-namespace orxonox
-{
-    
+namespace orxonox // tolua_export
+{ // tolua_export
+
     /**
     @brief
@@ -51,18 +52,18 @@
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport Pickupable : virtual public OrxonoxClass
-    {
+    class _OrxonoxExport Pickupable  // tolua_export
+        : virtual public OrxonoxClass, public Rewardable
+    {  // tolua_export
         protected:
             Pickupable(); //!< Default constructor.
-        
+
         public:
             virtual ~Pickupable(); //!< Default destructor.
-            
+
             /**
             @brief Get whether the pickup is currently in use or not.
             @return Returns true if the pickup is currently in use.
             */
-            inline bool isUsed(void)
-                { return this->used_; }
+            inline bool isUsed(void) { return this->used_; }  // tolua_export
             /**
             @brief  Should be called when the pickup has transited from used to unused or the other way around.
@@ -70,5 +71,5 @@
             */
             virtual void changedUsed(void) {}
-            
+
             /**
             @brief Get the carrier of the pickup.
@@ -82,11 +83,10 @@
             */
             virtual void changedCarrier(void) {}
-            
+
             /**
             @brief Returns whether the Pickupable is currently picked up.
             @return Returns true if the Pickupable is currently picked up, false if not.
             */
-            inline bool isPickedUp(void)
-                { return this->pickedUp_; }
+            inline bool isPickedUp(void) { return this->pickedUp_; }  // tolua_export
             /**
             @brief  Should be called when the pickup has transited from picked up to dropped or the other way around.
@@ -94,16 +94,36 @@
             */
             virtual void changedPickedUp(void) {}
+
+            /**
+            @brief Returns whether the Pickupable can be used.
+            @return Returns true if it can be used.
+            */
+            inline bool isUsable(void) { return this->enabled_; } // tolua_export
             
-            bool pickedUp(PickupCarrier* carrier); //!< Sets the Pickupable to picked up.
-            bool dropped(void); //!< Sets the Pickupable to not picked up or dropped.
-            
+            /**
+            @brief Returns whether the Pickupable can be unused.
+            @return Returns true if it can be unused.
+            */
+            inline bool isUnusable(void) { return this->enabled_; } // tolua_export
+
+            /**
+            @brief Returns whether the Pickupable is enabled.
+                   Once a Pickupable is disabled it cannot be enabled again. A Pickupable that is disabled can neither be used nor unused.
+            @return Returns true if the Pickupable is enabled.
+            */
+            inline bool isEnabled(void)
+                { return this->enabled_; }
+
+            bool pickup(PickupCarrier* carrier); //!< Can be called to pick up a Pickupable.
+            bool drop(bool createSpawner = true); //!< Can be called to drop a Pickupable.
+
             virtual bool isTarget(PickupCarrier* carrier) const; //!< Get whether the given PickupCarrier is a target of this pickup.
             bool isTarget(const Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this Pickupable.
             bool addTarget(PickupCarrier* target); //!< Add a PickupCarrier as target of this pickup.
             bool addTarget(Identifier* identifier); //!< Add a class, representetd by the input Identifier, as target of this pickup.
-            
+
             Pickupable* clone(void); //!< Creates a duplicate of the Pickupable.
             virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
-            
+
             /**
             @brief Get the PickupIdentifier of this Pickupable.
@@ -112,9 +132,15 @@
             virtual const PickupIdentifier* getPickupIdentifier(void)
                 { return this->pickupIdentifier_; }
-                
+
             bool setUsed(bool used); //!< Sets the Pickupable to used or unused, depending on the input.
             bool setPickedUp(bool pickedUp); //!< Helper method to set the Pickupable to either picked up or not picked up.
-            bool setCarrier(PickupCarrier* carrier); //!< Sets the carrier of the pickup.
-            
+            //TODO: private?
+            bool setCarrier(PickupCarrier* carrier, bool tell = true); //!< Sets the carrier of the pickup.
+
+            //TODO: private?
+            virtual void carrierDestroyed(void); //!< Is called by the PickupCarrier when it is being destroyed.
+
+            void destroy(void); //!< Is called internally within the pickup module to destroy pickups.
+
         protected:
             /**
@@ -122,5 +148,14 @@
             */
             void initializeIdentifier(void) {}
-            
+
+            virtual void preDestroy(void); //!< A method that is called by OrxonoxClass::destroy() before the object is actually destroyed.
+            virtual void destroyPickup(void); //!< Destroys a Pickupable.
+
+            /**
+            @brief Sets the Pickuapble to disabled.
+            */
+            inline void setDisabled(void)
+                { this->enabled_ = false; }
+
             /**
             @brief Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
@@ -131,21 +166,29 @@
             */
             virtual bool createSpawner(void) = 0;
-            
+
             PickupIdentifier* pickupIdentifier_; //!< The PickupIdentifier of this Pickupable.
-            
+
         private:
-            
-            bool used_; //!< Whether the pickup is currently in use or not.
-            bool pickedUp_; //!< Whether the pickup is currently picked up or not.
-            
-            PickupCarrier* carrier_; //!< The carrier of the pickup.
-            std::list<Identifier*> targets_; //!< The possible targets of this pickup.
 
-    };
-    
+            bool used_; //!< Whether the Pickupable is currently in use or not.
+            bool pickedUp_; //!< Whether the Pickupable is currently picked up or not.
+
+            bool enabled_; //!< Whether the Pickupable is enabled or not.
+
+            PickupCarrier* carrier_; //!< The PickupCarrier of the Pickupable.
+            std::list<Identifier*> targets_; //!< The possible targets of this Pickupable.
+
+            bool beingDestroyed_; //!< Is true if the Pickupable is in the process of being destroyed.
+
+        // For implementing the Rewardable interface:
+        public:
+            virtual bool reward(PlayerInfo* player); //!< Method to transcribe a Pickupable as a Rewardable to the player.
+
+    };  // tolua_export
+
     SUPER_FUNCTION(10, Pickupable, changedUsed, false);
     SUPER_FUNCTION(12, Pickupable, changedCarrier, false);
     SUPER_FUNCTION(13, Pickupable, changedPickedUp, false);
-}
+}  // tolua_export
 
 #endif /* _Pickupable_H__ */
