[Orxonox-commit 1994] r6711 - in code/trunk: . data/gui/layouts data/gui/schemes data/gui/scripts data/levels data/levels/includes data/levels/templates data/overlays src/modules/pickup src/orxonox src/orxonox/interfaces src/orxonox/items src/orxonox/overlays src/orxonox/worldentities/pawns

dafrick at orxonox.net dafrick at orxonox.net
Tue Apr 13 10:16:10 CEST 2010


Author: dafrick
Date: 2010-04-13 10:16:10 +0200 (Tue, 13 Apr 2010)
New Revision: 6711

Modified:
   code/trunk/
   code/trunk/data/gui/layouts/PickupInventory.layout
   code/trunk/data/gui/schemes/OrxonoxGUIScheme.scheme
   code/trunk/data/gui/scripts/InitialiseGUI.lua
   code/trunk/data/gui/scripts/PickupInventory.lua
   code/trunk/data/gui/scripts/QuestGUI.lua
   code/trunk/data/levels/includes/pickups.oxi
   code/trunk/data/levels/pickup.oxw
   code/trunk/data/levels/templates/pickup_representation_templates.oxt
   code/trunk/data/overlays/hudtemplates3.oxo
   code/trunk/src/modules/pickup/CMakeLists.txt
   code/trunk/src/modules/pickup/PickupManager.cc
   code/trunk/src/modules/pickup/PickupManager.h
   code/trunk/src/modules/pickup/PickupPrereqs.h
   code/trunk/src/modules/pickup/PickupRepresentation.cc
   code/trunk/src/modules/pickup/PickupRepresentation.h
   code/trunk/src/modules/pickup/PickupSpawner.cc
   code/trunk/src/orxonox/CMakeLists.txt
   code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc
   code/trunk/src/orxonox/interfaces/PickupCarrier.h
   code/trunk/src/orxonox/items/Engine.cc
   code/trunk/src/orxonox/items/Engine.h
   code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
   code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
   code/trunk/src/orxonox/worldentities/pawns/Pawn.h
   code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc
   code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h
Log:
Merged pickup4 branch back to trunk.



Property changes on: code/trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/console:5941-6104
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/gamestate:6430-6440
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/menu:5941-6146,6148
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network64:2210-2355
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/presentation:2369-2652,2654-2660
/code/branches/presentation2:6106-6416
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/script_trigger:1295-1953,1955
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
   + /code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/console:5941-6104
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/gamestate:6430-6440
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/menu:5941-6146,6148
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network64:2210-2355
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/presentation:2369-2652,2654-2660
/code/branches/presentation2:6106-6416
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/script_trigger:1295-1953,1955
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890

Modified: code/trunk/data/gui/layouts/PickupInventory.layout
===================================================================
--- code/trunk/data/gui/layouts/PickupInventory.layout	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/data/gui/layouts/PickupInventory.layout	2010-04-13 08:16:10 UTC (rev 6711)
@@ -1,32 +1,43 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<GUILayout>
-    <Window Type="TaharezLook/FrameWindow" Name="orxonox/Inventory">
-        <Property Name="UnifiedMinSize" Value="{{0.0,385},{0.0,200}}" />
-        <Property Name="UnifiedMaxSize" Value="{{0.0,385},{0.0,200}}" />
-        <Property Name="UnifiedPosition" Value="{{0.5,-100},{0.5,-85}}" />
-        <Property Name="UnifiedSize" Value="{{0.0,385},{0.0,200}}" />
-        <Property Name="Text" Value="Inventory" />
-        <Property Name="CloseButtonEnabled" Value="False" />
+<?xml version="1.0" encoding="UTF-8"?>
 
-        <Window Type="TaharezLook/TabControl" Name="orxonox/Inventory/TabControl" >
-            <Property Name="Tooltip" Value="Inventory" />
-            <Property Name="TabHeight" Value="{0,-1}" />
+<GUILayout >
+    <Window Type="DefaultWindow" Name="orxonox/PickupInventory/Background" >
+        <Property Name="InheritsAlpha" Value="False" />
+        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+        <Window Type="TaharezLook/StaticText" Name="orxonox/PickupInventory/PickupInventory" >
+            <Property Name="Text" Value="Pickup Inventory" />
+            <Property Name="Alpha" Value="0.8" />
+            <Property Name="InheritsAlpha" Value="False" />
+            <Property Name="HorzFormatting" Value="HorzCentred" />
             <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-            <Property Name="TabPanePosition" Value="Bottom" />
-            <Property Name="UnifiedAreaRect" Value="{{0,10},{0,30},{1,-10},{1,-10}}" />
-
-            <Window Type="TaharezLook/ScrollablePane" Name="orxonox/Inventory/TabControl/TabEquipment">
-                <Property Name="Text" Value="Equipment" />
-                <Property Name="UnifiedPosition" Value="{{0.0,3},{0.0,3}}"/>
-                <Property Name="UnifiedSize" Value="{{1.0,-6},{1.0,-6}}"/>
+            <Property Name="VertFormatting" Value="TopAligned" />
+            <Property Name="UnifiedAreaRect" Value="{{0.15,0},{0.15,0},{0.85,0},{0.8,0}}" />
+            <Window Type="TaharezLook/StaticText" Name="orxonox/PickupInventory/Wrapper" >
+                <Property Name="TextColours" Value="FF4444FF" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="HorzFormatting" Value="HorzCentred" />
+                <Property Name="VertFormatting" Value="TopAligned" />
+                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.92,0}}" />
+                <Window Type="TaharezLook/ScrollablePane" Name="orxonox/PickupInventory/Inventory" >
+                    <Property Name="ContentArea" Value="l:0 t:0 r:0 b:0" />
+                    <Property Name="HorzStepSize" Value="0.005" />
+                    <Property Name="VertStepSize" Value="0.005" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="HorzOverlapSize" Value="0.01" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.005,0},{0.01,0},{0.995,0},{0.99,0}}" />
+                    <Property Name="VertOverlapSize" Value="0.01" />
+                    <Property Name="HorzScrollPosition" Value="0" />
+                    <Property Name="VertScrollPosition" Value="0" />
+                </Window>
             </Window>
-            <Window Type="TaharezLook/ScrollablePane" Name="orxonox/Inventory/TabControl/TabUsable">
-                <Property Name="Text" Value="Usable" />
-                <Property Name="UnifiedPosition" Value="{{0.0,3},{0.0,3}}"/>
-                <Property Name="UnifiedSize" Value="{{1.0,-6},{1.0,-6}}"/>
-            </Window>
         </Window>
-
-        <Event Name="WindowUpdate" Function="PickupInventory.update" />
+        <Window Type="TaharezLook/Button" Name="orxonox/PickupInventory/InventoryBackButton" >
+            <Property Name="Text" Value="Back" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.8350,0},{0.6,0},{0.8800,0}}" />
+            <Event Name="Clicked" Function="PickupInventory.InventoryBackButton_clicked"/>
+        </Window>
     </Window>
 </GUILayout>

Modified: code/trunk/data/gui/schemes/OrxonoxGUIScheme.scheme
===================================================================
--- code/trunk/data/gui/schemes/OrxonoxGUIScheme.scheme	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/data/gui/schemes/OrxonoxGUIScheme.scheme	2010-04-13 08:16:10 UTC (rev 6711)
@@ -1,4 +1,5 @@
 <?xml version="1.0" ?>
 <GUIScheme Name="OrxonoxGUI">
     <Imageset Name="MainMenuBackground" Filename="MainMenuBackground.imageset"/>
+    <Imageset Name="PickupInventory" Filename="PickupInventory.imageset"/>
 </GUIScheme>

Modified: code/trunk/data/gui/scripts/InitialiseGUI.lua
===================================================================
--- code/trunk/data/gui/scripts/InitialiseGUI.lua	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/data/gui/scripts/InitialiseGUI.lua	2010-04-13 08:16:10 UTC (rev 6711)
@@ -222,6 +222,7 @@
     return nil
 end
 
+--TODO: Needed?
 function test(e)
     debug(0, "Blubb")
 end

Modified: code/trunk/data/gui/scripts/PickupInventory.lua
===================================================================
--- code/trunk/data/gui/scripts/PickupInventory.lua	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/data/gui/scripts/PickupInventory.lua	2010-04-13 08:16:10 UTC (rev 6711)
@@ -2,6 +2,7 @@
 
 BasicGUI = require("BasicGUI")
 local P = BasicGUI:new() --inherit everything from the gui package
+
 if _REQUIREDNAME == nil then
     PickupInventory = P
 else
@@ -11,58 +12,288 @@
 P.filename = "PickupInventory"
 P.layoutString = "PickupInventory.layout"
 
-P.lastEquipmentCount_ = 0
-P.lastUsableCount_ = 0
-P.currentUsableID_ = 0
+P.carrierList = {}
+P.wrapper = nil
+P.detailsWindows = {}
 
--- events
-function P:frmUpdate(e)
-    local equipCount = orxonox.PickupInventory:getEquipmentCount()
-    local usableCount = orxonox.PickupInventory:getUsableCount()
+function P.init()
+    carrierList = {}
+end
 
-    if equipCount ~= self.lastEquipmentCount_ or usableCount ~= self.lastUsableCount_ then
-        self:updateTabs()
-    end
+function P.show()
+    P.window:show() -- TODO: Do this through parent...
+    P.visible = true 
+    
+    P.createInventory()
+
 end
 
-function P.update(e)
-    loadedGUIs["PickupInventory"]:frmUpdate(e)
+function P.hide()
+    P.cleanup()
+    
 end
 
-function P.itemClicked(e)
-    loadedGUIs["PickupInventory"]:mItemClicked(e)
+function P.update()
+    P.cleanup()
+    
+    P.createInventory()
 end
 
-function P:mItemClicked(e)
-    local w = CEGUI.toWindowEventArgs(e).window
-    local name = w:getName()
-    local t = name:sub(25, 27)
-    local i = name:sub(29)
+function P.createInventory()
+    local pickupManager = orxonox.PickupManager:getInstance()
+    local carrier = pickupManager:getPawn()
+    
+    local root = winMgr:getWindow("orxonox/PickupInventory/Inventory")
+    P.wrapper = winMgr:createWindow("TaharezLook/ScrollablePane", "orxonox/PickupInventory/Inventory/Wrapper")
+    P.wrapper:setSize(CEGUI.UVector2(CEGUI.UDim(1,0),CEGUI.UDim(1,0)))
+    root:addChildWindow(P.wrapper)
+    
+    P.carrierList = {}
+    
+    --Design parameters:
+    local space = 15
+    
+    P.getCarrierList(carrier)
+    local offset = 0
+    for k,v in pairs(P.carrierList) do
+        local window = P.createCarrierBox(v,k)
+        window:setYPosition(CEGUI.UDim(0,offset))
+        offset = offset + window:getHeight():asAbsolute(1) + space
+        P.wrapper:addChildWindow(window)
+    end
+end
 
-    if t == "equ" then
+function P.getCarrierList(carrier)
 
+    -- TODO: Test for nil or 0?
+    if carrier == nil then
+        return
     end
+    
+    table.insert(P.carrierList, carrier)
+    
+    local numCarriers = orxonox.PickupManager:getInstance():getNumCarrierChildren(carrier)
+    if numCarriers == 0 then
+        return
+    end
+    
+    for i=0,numCarriers-1,1 do
+        local child = orxonox.PickupManager:getInstance():getCarrierChild(i, carrier)
+        if child ~= nil then
+            P.getCarrierList(child)
+        end
+    end
+end
 
-    if t == "use" then
-        if self.currentUsableID_ >= 0 then
-            winMgr:getWindow("orxonox/Inventory/Title/use/" .. self.currentUsableID_):setProperty("TextColours", "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF")
+function P.createCarrierBox(carrier, index)
+
+    local name = "orxonox/PickupInventory/Carrier" .. index
+        
+    --Design parameters:
+    local imageHeight = 50
+    local textHeight = 30
+    local horizontalOffset = 20
+    local buttonWidth = 85
+    
+    local offset = 0
+
+    local box = winMgr:createWindow("TaharezLook/ScrollablePane", name .. "/Box")
+    box:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horizontalOffset), CEGUI.UDim(0, 0)))
+    box:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -horizontalOffset), CEGUI.UDim(1, 0)))
+    
+    offset = offset+textHeight
+    local title = winMgr:createWindow("TaharezLook/StaticText", name .. "/Title")
+    title:setText(carrier:getCarrierName())
+    title:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0), CEGUI.UDim(0, offset)))
+    title:setProperty("FrameEnabled", "set:False")
+    box:addChildWindow(title)
+    
+    local numPickups = orxonox.PickupManager:getInstance():getNumPickups(carrier)
+    for i=0,numPickups-1,1 do
+        local pickup = orxonox.PickupManager:getInstance():getPickupRepresentation(i, carrier)
+        
+        local item = winMgr:createWindow("TaharezLook/StaticText", name .. "/Box/Pickup" .. i)
+        item:setSize(CEGUI.UVector2(CEGUI.UDim(1, -horizontalOffset), CEGUI.UDim(0, imageHeight)))
+        item:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horizontalOffset), CEGUI.UDim(0, offset)))
+        box:addChildWindow(item)
+        offset = offset + imageHeight+5
+        
+        local image = winMgr:createWindow("TaharezLook/StaticImage", name .. "/Box/Pickup" .. i .. "/Image")
+        image:setProperty("Image", "set:PickupInventory image:" .. pickup:getInventoryRepresentation())
+        image:setProperty("BackgroundEnabled", "set:False")
+        image:setProperty("FrameEnabled", "set:True")
+        image:setSize(CEGUI.UVector2(CEGUI.UDim(0, imageHeight), CEGUI.UDim(0, imageHeight)))
+        item:addChildWindow(image)
+        
+        local title = winMgr:createWindow("TaharezLook/StaticText", name .. "/Box/Pickup" .. i .. "/Title")
+        title:setPosition(CEGUI.UVector2(CEGUI.UDim(0, imageHeight+5), CEGUI.UDim(0, (imageHeight-textHeight)/2)))
+        title:setSize(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0, textHeight)))
+        title:setText(pickup:getPickupName())
+        title:setProperty("FrameEnabled", "set:False")
+        item:addChildWindow(title)
+        
+        local useButton = winMgr:createWindow("TaharezLook/Button", name .. "/Box/Pickup" .. i .. "/UseButton")
+        useButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, imageHeight+10),CEGUI.UDim(0, (imageHeight-textHeight)/2)))
+        useButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0, textHeight)))
+        useButton:setText("use")
+        orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.filename .. ".InventoryUseButton_clicked")
+        item:addChildWindow(useButton)
+        
+        local dropButton = winMgr:createWindow("TaharezLook/Button", name .. "/Box/Pickup" .. i .. "/DropButton")
+        dropButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, imageHeight+15+buttonWidth),CEGUI.UDim(0, (imageHeight-textHeight)/2)))
+        dropButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0, textHeight)))
+        dropButton:setText("drop")
+        orxonox.GUIManager:subscribeEventHelper(dropButton, "Clicked", P.filename .. ".InventoryDropButton_clicked")
+        item:addChildWindow(dropButton)
+        
+        local detailsButton = winMgr:createWindow("TaharezLook/Button", name .. "/Box/Pickup" .. i .. "/DetailsButton")
+        detailsButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, imageHeight+20+2*buttonWidth),CEGUI.UDim(0, (imageHeight-textHeight)/2)))
+        detailsButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0, textHeight)))
+        detailsButton:setText("details")
+        orxonox.GUIManager:subscribeEventHelper(detailsButton, "Clicked", P.filename .. ".InventoryDetailsButton_clicked")
+        item:addChildWindow(detailsButton)
+    end
+    
+    box:setHeight(CEGUI.UDim(0,offset))
+    
+    return box
+end
+
+function P.cleanup()
+    if P.wrapper ~= nil then
+        winMgr:destroyWindow(P.wrapper)
+    end
+    
+    --Destroy details windows.
+    for k,v in pairs(P.detailsWindows) do
+        if v ~= nil then
+            winMgr:destroyWindow(v)
         end
-        orxonox.PickupInventory:selectUsable(tonumber(i))
-        self.currentUsableID_ = tonumber(i)
-        winMgr:getWindow("orxonox/Inventory/Title/use/" .. i):setProperty("TextColours", "tl:FFFF4444 tr:FFFF4444 bl:FFFF4444 br:FFFF4444")
     end
 end
 
--- methods
-function P:updateTabs()
-    local eqWin = winMgr:getWindow("orxonox/Inventory/TabControl/TabEquipment")
-    local usWin = winMgr:getWindow("orxonox/Inventory/TabControl/TabUsable")
-    orxonox.PickupInventory:getSingleton():clearInventory(winMgr, eqWin, usWin)
-    orxonox.PickupInventory:getSingleton():updateTabs(winMgr, eqWin, usWin)
+function P.windowToCarrierHelper(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
 
-    self.currentUsableID_ = orxonox.PickupInventory:getCurrentUsableIndex()
-    self.lastEquipmentCount_ = orxonox.PickupInventory:getEquipmentCount()
-    self.lastUsableCount_ = orxonox.PickupInventory:getUsableCount()
+    local match = string.gmatch(name, "%d+")
+    local carrierNr = tonumber(match())
+    local pickupNr = tonumber(match())
+
+    local arguments = {}
+    arguments[1] = carrierNr
+    arguments[2] = pickupNr
+    return arguments
 end
 
+function P.createDetailsWindow(pickupIndex, carrierIndex)
+    local carrier = P.carrierList[carrierIndex]
+    local pickup = orxonox.PickupManager:getInstance():getPickupRepresentation(pickupIndex, carrier)
+    
+    local headerOffset = 35
+    --Design parameters
+    local titleHeight = 30
+    local imageSize = 100
+    local buttonWidth = 85
+    
+    local name = "orxonox/PickupInventory/Carrier" .. carrierIndex .. "/Pickup" .. pickupIndex .. "/Details" .. P.getNewDetailNumber()
+    
+    local window = winMgr:createWindow("TaharezLook/FrameWindow", name)
+    window:setSize(CEGUI.UVector2(CEGUI.UDim(0.5,0),CEGUI.UDim(0.4,0)))
+    orxonox.GUIManager:subscribeEventHelper(window, "CloseClicked", P.filename .. ".closeDetailWindow")
+    
+    local root = winMgr:getWindow("orxonox/PickupInventory/Background")
+    root:addChildWindow(window)
+    
+    local wrapper = winMgr:createWindow("DefaultWindow", name .. "/Wrapper")
+    wrapper:setSize(CEGUI.UVector2(CEGUI.UDim(1, -20),CEGUI.UDim(1, -50)))
+    wrapper:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 10),CEGUI.UDim(0, 40)))
+    window:addChildWindow(wrapper)
+    
+    local title = winMgr:createWindow("TaharezLook/StaticText", name .. "/Title")
+    title:setText(pickup:getPickupName())
+    title:setHeight(CEGUI.UDim(0, titleHeight))
+    title:setProperty("FrameEnabled", "set:False")
+    title:setProperty("BackgroundEnabled", "set:False")
+    wrapper:addChildWindow(title)
+    
+    local image = winMgr:createWindow("TaharezLook/StaticImage", name .. "/Image")
+    image:setProperty("Image", "set:PickupInventory image:" .. pickup:getInventoryRepresentation())
+    image:setProperty("BackgroundEnabled", "set:False")
+    image:setProperty("FrameEnabled", "set:True")
+    image:setSize(CEGUI.UVector2(CEGUI.UDim(0, imageSize), CEGUI.UDim(0, imageSize)))
+    image:setYPosition(CEGUI.UDim(0, titleHeight + 5))
+    wrapper:addChildWindow(image)
+    
+    local box = winMgr:createWindow("TaharezLook/ScrollablePane", name .. "/Description")
+    box:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -1*(imageSize + 10)),CEGUI.UDim(1, -(titleHeight + 5 + titleHeight + 20))))
+    box:setPosition(CEGUI.UVector2(CEGUI.UDim(0, imageSize + 10),CEGUI.UDim(0, titleHeight + 5)))
+    local description = winMgr:createWindow("TaharezLook/StaticText", name .. "/Description/Text")
+    description:setText(pickup:getPickupDescription())
+    description:setProperty("HorzFormatting", "WordWrapLeftAligned")
+    description:setProperty("VertFormatting", "TopAligned")
+    box:addChildWindow(description)
+    wrapper:addChildWindow(box)
+    
+    local useButton = winMgr:createWindow("TaharezLook/Button", name .. "/UseButton")
+    useButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0, imageSize+10),CEGUI.UDim(1, -40)))
+    useButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0, titleHeight)))
+    useButton:setText("use")
+    orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.filename .. ".InventoryUseButton_clicked")
+    wrapper:addChildWindow(useButton)
+    
+    local dropButton = winMgr:createWindow("TaharezLook/Button", name .. "/DropButton")
+    dropButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0, imageSize+10+buttonWidth+10),CEGUI.UDim(1, -40)))
+    dropButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0, titleHeight)))
+    dropButton:setText("drop")
+    orxonox.GUIManager:subscribeEventHelper(dropButton, "Clicked", P.filename .. ".InventoryDropButton_clicked")
+    wrapper:addChildWindow(dropButton)
+    
+    table.insert(P.detailsWindows, window)
+    
+end
+
+function P.getNewDetailNumber()
+    local number = table.getn(P.detailsWindows)
+    for k,v in pairs(P.detailsWindows) do
+        if v == nil then
+            number = k-1
+        end
+    end
+    return number
+end
+
+function P.InventoryUseButton_clicked(e)
+    local arguments = P.windowToCarrierHelper(e)
+    orxonox.PickupManager:getInstance():usePickup(arguments[2], P.carrierList[arguments[1]], true)
+end
+
+function P.InventoryDropButton_clicked(e)
+    local arguments = P.windowToCarrierHelper(e)
+    orxonox.PickupManager:getInstance():dropPickup(arguments[2], P.carrierList[arguments[1]])
+end
+
+function P.InventoryDetailsButton_clicked(e)
+    local arguments = P.windowToCarrierHelper(e)
+    P.createDetailsWindow(arguments[2], arguments[1])
+end
+
+function P.closeDetailWindow(e)
+    --Get some numbers from the window
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+    local match = string.gmatch(name, "%d+")
+    local carrierNr = tonumber(match())
+    local pickupNr = tonumber(match())
+    local detailNr = tonumber(match())
+    
+    local window = P.detailsWindows[detailNr+1]
+    winMgr:destroyWindow(window)
+    P.detailsWindows[detailNr+1] = nil
+end
+
+function P.InventoryBackButton_clicked(e)
+    hideGUI("PickupInventory")
+end
+
 return P

Modified: code/trunk/data/gui/scripts/QuestGUI.lua
===================================================================
--- code/trunk/data/gui/scripts/QuestGUI.lua	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/data/gui/scripts/QuestGUI.lua	2010-04-13 08:16:10 UTC (rev 6711)
@@ -10,7 +10,7 @@
 P.layoutString = "QuestGUI.layout"
 
 function P:show()
-    self.window:show() -- TDO: Do this through parent...
+    self.window:show() -- TODO: Do this through parent...
     self.visible = true
 
     local questManager = orxonox.QuestManager:getInstance()

Modified: code/trunk/data/levels/includes/pickups.oxi
===================================================================
--- code/trunk/data/levels/includes/pickups.oxi	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/data/levels/includes/pickups.oxi	2010-04-13 08:16:10 UTC (rev 6711)
@@ -1,6 +1,7 @@
 <PickupRepresentation
-    name = "Small Health Boost"
-    description = "Adds a small amout of health to the ship."
+    pickupName = "Small Health Boost"
+    pickupDescription = "Adds a small amout of health to the ship."
+    inventoryRepresentation = "SmallHealth"
     spawnerTemplate = "smallhealthpickupRepresentation"
 >
     <pickup>
@@ -9,9 +10,10 @@
 </PickupRepresentation>
 
 <PickupRepresentation
-    name = "Medium Health Boost"
-    description = "Adds a medium amout of health to the ship."
+    pickupName = "Medium Health Boost"
+    pickupDescription = "Adds a medium amout of health to the ship."
     spawnerTemplate = "mediumhealthpickupRepresentation"
+    inventoryRepresentation = "MediumHealth"
 >
     <pickup>
         <HealthPickup template=mediumhealthpickup />
@@ -19,9 +21,10 @@
 </PickupRepresentation>
 
 <PickupRepresentation
-    name = "Huge Health Boost"
-    description = "Adds a huge amout of health to the ship."
+    pickupName = "Huge Health Boost"
+    pickupDescription = "Adds a huge amout of health to the ship."
     spawnerTemplate = "hugehealthpickupRepresentation"
+    inventoryRepresentation = "HugeHealth"
 >
     <pickup>
         <HealthPickup template=hugehealthpickup />
@@ -29,9 +32,10 @@
 </PickupRepresentation>
 
 <PickupRepresentation
-    name = "Crazy Madness Health Boost"
-    description = "Adds a crazy amout of health to the ship."
+    pickupName = "Crazy Madness Health Boost"
+    pickupDescription = "Adds a crazy amout of health to the ship."
     spawnerTemplate = "crazyhealthpickupRepresentation"
+    inventoryRepresentation = "CrazyMadnessHealth"
 >
     <pickup>
         <HealthPickup template=crazyhealthpickup />
@@ -39,11 +43,49 @@
 </PickupRepresentation>
 
 <PickupRepresentation
-    name = "Double Pickup"
-    description = "Does stuff."
+    pickupName = "Double Pickup"
+    pickupDescription = "Does stuff."
     spawnerTemplate = "crazyhealthpickupRepresentation"
 >
     <pickup>
         <PickupCollection template=doublepickup />
     </pickup>
 </PickupRepresentation>
+
+<PickupRepresentation
+    pickupName = "Use Pickup"
+    pickupDescription = "Uses all pickups you have."
+    spawnerTemplate = "usepickupRepresentation"
+    inventoryRepresentation = "usePickup"
+>
+    <pickup>
+        <MetaPickup metaType="use" />
+    </pickup>
+</PickupRepresentation>
+
+<PickupRepresentation
+    pickupName = "Drop Pickup"
+    pickupDescription = "Drops all pickups you have."
+    spawnerTemplate = "droppickupRepresentation"
+    inventoryRepresentation = "dropPickup"
+>
+    <pickup>
+        <MetaPickup metaType="drop" />
+    </pickup>
+</PickupRepresentation>
+
+<PickupRepresentation
+    pickupName = "Huge Health Boost"
+    pickupDescription = "Adds a huge amout of health to the ship."
+    spawnerTemplate = "hugehealthpickupRepresentation"
+    inventoryRepresentation = "HugeHealth"
+>
+    <pickup>
+          <HealthPickup
+    health = 100
+    healthType = "limited"
+    activationType = "onUse"
+    durationType = "once"
+  />
+    </pickup>
+</PickupRepresentation>
\ No newline at end of file

Modified: code/trunk/data/levels/pickup.oxw
===================================================================
--- code/trunk/data/levels/pickup.oxw	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/data/levels/pickup.oxw	2010-04-13 08:16:10 UTC (rev 6711)
@@ -36,7 +36,7 @@
 
     <PickupSpawner position="-50,0,-100" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
         <pickup>
-            <HealthPickup health=50 healthRate=5 durationType=continuous activationType=immediate healthType=permanent />
+            <HealthPickup health=50 healthRate=5 durationType=continuous activationType=onUse healthType=permanent />
         </pickup>
     </PickupSpawner>
     
@@ -70,11 +70,16 @@
         </pickup>
     </PickupSpawner>
 
-    <!--PickupSpawner position="100,100,100" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
+    <PickupSpawner position="100,0,-100" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
         <pickup>
-            <HealthPickup health=50 healthRate=5 durationType=continuous activationType=immediate healthType=limited />
+              <HealthPickup
+    health = 100
+    healthType = "limited"
+    activationType = "onUse"
+    durationType = "once"
+  />
         </pickup>
-    </PickupSpawner-->
+    </PickupSpawner>
 
     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
     <SpawnPoint position="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />

Modified: code/trunk/data/levels/templates/pickup_representation_templates.oxt
===================================================================
--- code/trunk/data/levels/templates/pickup_representation_templates.oxt	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/data/levels/templates/pickup_representation_templates.oxt	2010-04-13 08:16:10 UTC (rev 6711)
@@ -106,4 +106,36 @@
         </pickupables>
     </PickupCollection>
 </Template>
+
+<Template name=usepickupRepresentation>
+    <PickupRepresentation>
+        <spawner-representation>
+            <StaticEntity>
+                <attached>
+                    <Billboard position="0,0,0" colour="0.60,0.97,0.23" material="Sphere2" scale=0.1>
+                        <attached>
+                            <Billboard position="0,0,0" colour="0.40,0.81,0.10" material="Arrow" scale=0.65 />
+                        </attached>
+                    </Billboard>
+                </attached>
+            </StaticEntity>
+        </spawner-representation>
+    </PickupRepresentation>
+</Template>
+
+<Template name=droppickupRepresentation>
+    <PickupRepresentation>
+        <spawner-representation>
+            <StaticEntity>
+                <attached>
+                    <Billboard position="0,0,0" colour="0.95,0.10,0.05" material="Sphere2" scale=0.1>
+                        <attached>
+                            <Billboard position="0,0,0" colour="0.95,0.20,0.10" material="Arrow" scale=0.65 />
+                        </attached>
+                    </Billboard>
+                </attached>
+            </StaticEntity>
+        </spawner-representation>
+    </PickupRepresentation>
+</Template>
     
\ No newline at end of file

Modified: code/trunk/data/overlays/hudtemplates3.oxo
===================================================================
--- code/trunk/data/overlays/hudtemplates3.oxo	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/data/overlays/hudtemplates3.oxo	2010-04-13 08:16:10 UTC (rev 6711)
@@ -100,6 +100,12 @@
       guiname = "QuestGUI"
       visible = "false"
     />
+    
+    <GUIOverlay
+      name = "PickupInventory"
+      guiname = "PickupInventory"
+      visible = "false"
+    />
 
   </OverlayGroup>
 </Template>

Modified: code/trunk/src/modules/pickup/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/pickup/CMakeLists.txt	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/modules/pickup/CMakeLists.txt	2010-04-13 08:16:10 UTC (rev 6711)
@@ -14,6 +14,8 @@
   MODULE
   FIND_HEADER_FILES
   TOLUA_FILES
+    PickupManager.h
+    PickupRepresentation.h
   DEFINE_SYMBOL
     "PICKUP_SHARED_BUILD"
   PCH_FILE

Modified: code/trunk/src/modules/pickup/PickupManager.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupManager.cc	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/modules/pickup/PickupManager.cc	2010-04-13 08:16:10 UTC (rev 6711)
@@ -34,17 +34,26 @@
 #include "PickupManager.h"
 
 #include "core/CoreIncludes.h"
+#include "core/LuaState.h"
+#include "core/GUIManager.h"
 #include "core/ScopedSingletonManager.h"
 #include "core/Identifier.h"
 #include "interfaces/PickupCarrier.h"
+#include "infos/PlayerInfo.h"
 #include "worldentities/pawns/Pawn.h"
 #include "PickupRepresentation.h"
 
+#include "ToluaBindPickup.h"
+
 namespace orxonox
 {
-
+    // Register tolua_open function when loading the library
+    DeclareToluaInterface(Pickup);
+    
     ManageScopedSingleton(PickupManager, ScopeID::Root, false);
     
+    /*static*/ const std::string PickupManager::guiName_s = "PickupInventory";
+    
     /**
     @brief
         Constructor. Registers the PickupManager and creates the default PickupRepresentation.
@@ -109,4 +118,61 @@
         return it->second;
     }
     
+    PickupCarrier* PickupManager::getPawn(void)
+    {
+        Pawn* pawn = dynamic_cast<Pawn*>(GUIManager::getInstancePtr()->getPlayer(PickupManager::guiName_s)->getControllableEntity());
+        if(pawn == NULL)
+            return NULL;
+        return dynamic_cast<PickupCarrier*>(pawn);
+    }
+    
+    int PickupManager::getNumCarrierChildren(PickupCarrier* carrier)
+    {
+        if(carrier == NULL)
+            return 0;
+        return carrier->getNumCarrierChildren();
+    }
+            
+    PickupCarrier* PickupManager::getCarrierChild(int index, PickupCarrier* carrier)
+    {
+        if(carrier == NULL)
+            return NULL;
+        return carrier->getCarrierChild(index);
+    }
+    
+    const std::string& PickupManager::getCarrierName(orxonox::PickupCarrier* carrier)
+    {
+        if(carrier == NULL)
+            return BLANKSTRING;
+        return carrier->getCarrierName();
+    }
+    
+    PickupRepresentation* PickupManager::getPickupRepresentation(int index, PickupCarrier* carrier)
+    {
+        Pickupable* pickup = carrier->getPickup(index);
+        if(pickup == NULL)
+            return NULL;
+        
+        return this->getRepresentation(pickup->getPickupIdentifier());
+    }
+    
+    int PickupManager::getNumPickups(PickupCarrier* carrier)
+    {
+        if(carrier == NULL)
+            return 0;
+        return carrier->getNumPickups();
+    }
+    
+    void PickupManager::dropPickup(int index, PickupCarrier* carrier)
+    {
+        Pickupable* pickup = carrier->getPickup(index);
+        carrier->drop(pickup);
+    }
+    
+    void PickupManager::usePickup(int index, PickupCarrier* carrier, bool use)
+    {
+        Pickupable* pickup = carrier->getPickup(index);
+        pickup->setUsed(use);
+    }
+    
 }

Modified: code/trunk/src/modules/pickup/PickupManager.h
===================================================================
--- code/trunk/src/modules/pickup/PickupManager.h	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/modules/pickup/PickupManager.h	2010-04-13 08:16:10 UTC (rev 6711)
@@ -43,38 +43,54 @@
 
 #include "core/OrxonoxClass.h"
 
-namespace orxonox
-{
+namespace orxonox // tolua_export
+{ // tolua_export
 
     /**
     @brief
         Manages Pickupables.
-        In essence has two tasks to fulfill. Firstly it must link Pickupables (through their PickupIdentifiers) and their PickupRepresentations. Secondly it manages the Pickup GUI.
+        In essence has two tasks to fulfill. Firstly it must link Pickupables (through their PickupIdentifiers) and their PickupRepresentations. Secondly it manages the PickupInventory.
         //TODO: Manage Pickup GUI.
     @author
         Damian 'Mozork' Frick
     */
-    class _PickupExport PickupManager : public Singleton<PickupManager>, public OrxonoxClass
-    {
+    class _PickupExport PickupManager // tolua_export
+        : public Singleton<PickupManager>, public OrxonoxClass
+    { // tolua_export
         friend class Singleton<PickupManager>;
         
         public:
             PickupManager();
             virtual ~PickupManager();
             
-            static PickupManager& getInstance() { return Singleton<PickupManager>::getInstance(); }
+            static PickupManager& getInstance() { return Singleton<PickupManager>::getInstance(); } // tolua_export
             
             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.
             
+            // tolua_begin
+            orxonox::PickupCarrier* getPawn(void);
+            
+            int getNumCarrierChildren(orxonox::PickupCarrier* carrier);
+            orxonox::PickupCarrier* getCarrierChild(int index, orxonox::PickupCarrier* carrier);
+            
+            const std::string& getCarrierName(orxonox::PickupCarrier* carrier);
+            
+            int getNumPickups(orxonox::PickupCarrier* carrier);
+            PickupRepresentation* getPickupRepresentation(int index, orxonox::PickupCarrier* carrier);
+            void dropPickup(int index, orxonox::PickupCarrier* carrier);
+            void usePickup(int index, orxonox::PickupCarrier* carrier, bool use);
+            // tolua_end
+            
         private:
             static PickupManager* singletonPtr_s;
+            static const std::string guiName_s;
             
             PickupRepresentation* defaultRepresentation_; //!< The default PickupRepresentation.
             std::map<const PickupIdentifier*, PickupRepresentation*, PickupIdentifierCompare> representations_; //!< Map linking PickupIdentifiers (representing types if Pickupables) and PickupRepresentations.
         
-    };
+    }; // tolua_export
     
-}
+} // tolua_export
 
 #endif // _PickupManager_H__

Modified: code/trunk/src/modules/pickup/PickupPrereqs.h
===================================================================
--- code/trunk/src/modules/pickup/PickupPrereqs.h	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/modules/pickup/PickupPrereqs.h	2010-04-13 08:16:10 UTC (rev 6711)
@@ -64,7 +64,7 @@
 
 namespace orxonox
 {
-
+    
     class DroppedPickup;
     class Pickup;
     class PickupCollection;

Modified: code/trunk/src/modules/pickup/PickupRepresentation.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupRepresentation.cc	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/modules/pickup/PickupRepresentation.cc	2010-04-13 08:16:10 UTC (rev 6711)
@@ -85,6 +85,7 @@
         this->description_ = "This is a pickup.";
         this->name_ = "Pickup";
         this->spawnerTemplate_ = "";
+        this->inventoryRepresentation_ = "Default";
         this->pickup_ = NULL;
     }
     
@@ -96,9 +97,10 @@
     {
         SUPER(PickupRepresentation, XMLPort, xmlelement, mode);
         
-        XMLPortParam(PickupRepresentation, "name", setName, getName, xmlelement, mode);
-        XMLPortParam(PickupRepresentation, "description", setDescription, getDescription, xmlelement, mode);
+        XMLPortParam(PickupRepresentation, "pickupName", setPickupName, getPickupName, xmlelement, mode);
+        XMLPortParam(PickupRepresentation, "pickupDescription", setPickupDescription, getPickupDescription, xmlelement, mode);
         XMLPortParam(PickupRepresentation, "spawnerTemplate", setSpawnerTemplate, getSpawnerTemplate, xmlelement, mode);
+        XMLPortParam(PickupRepresentation, "inventoryRepresentation", setInventoryRepresentation, getInventoryRepresentation, xmlelement, mode);
         XMLPortObject(PickupRepresentation, Pickupable, "pickup", setPickup, getPickup, xmlelement, mode);
         XMLPortObject(PickupRepresentation, StaticEntity, "spawner-representation", setSpawnerRepresentation, getSpawnerRepresentationIndex, xmlelement, mode);
         

Modified: code/trunk/src/modules/pickup/PickupRepresentation.h
===================================================================
--- code/trunk/src/modules/pickup/PickupRepresentation.h	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/modules/pickup/PickupRepresentation.h	2010-04-13 08:16:10 UTC (rev 6711)
@@ -44,16 +44,17 @@
 
 #include "core/BaseObject.h"
 
-namespace orxonox
-{
+namespace orxonox // tolua_export
+{ // tolua_export
 
     /**
     @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
-    {
+    class _PickupExport PickupRepresentation // tolua_export
+        : public BaseObject
+    { // tolua_export
         
         public:
             PickupRepresentation(); //!< Constructor
@@ -66,13 +67,13 @@
             @brief Set the name of the Pickupable represented by this PickupRepresentation.
             @param name The name.
             */
-            inline void setName(const std::string& name)
+            inline void setPickupName(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)
+            inline void setPickupDescription(const std::string& description)
                 { this->description_ = description; }
             /**
             @brief Set the spawnerTemplate of the Pickupable represented by this PickupRepresentation.
@@ -89,6 +90,12 @@
             inline void setSpawnerRepresentation(StaticEntity* representation)
                 { this->spawnerRepresentation_ = representation; }
             /**
+            @brief Set the image representing the pickup in the PickupInventory.
+            @param image A string with the name of the image representing the pickup.
+            */
+            inline void setInventoryRepresentation(const std::string& image)
+                { this->inventoryRepresentation_ = image; }
+            /**
             @brief Set the Pickupable that is represented by this PickupRepresentation.
             @param pickup A pointer to the Pickupable.
             */
@@ -99,14 +106,12 @@
             @brief Get the name of the Pickupable represented by this PickupRepresentation.
             @return Returns the name.
             */
-            inline const std::string& getName(void)
-                { return this->name_; }
+            inline const std::string& getPickupName(void) { return this->name_; } // tolua_export
             /**
             @brief Get the description of the Pickupable represented by this PickupRepresentation.
             @return Returns the description.
             */
-            inline const std::string& getDescription(void)
-                { return this->description_; }
+            inline const std::string& getPickupDescription(void) { return this->description_; } // tolua_export
             /**
             @brief Get the name of spawnerTemplate the Pickupable represented by this PickupRepresentation.
             @return Returns the name of the spawnerTemplate.
@@ -121,6 +126,11 @@
             inline const StaticEntity* getSpawnerRepresentationIndex(unsigned int index)
                 { if(index == 0) return this->spawnerRepresentation_; return NULL; }
             /**
+            @brief Get the name of the image representing the pickup in the PickupInventory.
+            @return Returns the name of the image as a string.
+            */
+            inline const std::string& getInventoryRepresentation(void) { return this->inventoryRepresentation_; } // tolua_export
+            /**
             @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.
@@ -138,11 +148,12 @@
             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.
+            std::string inventoryRepresentation_; //!< The name of an image representing the pickup in the PickupInventory. TODO: Exact format and placement of image?
             
             Pickupable* pickup_; //!< The Pickupable that is represented by this PickupRepresentation.
             
-    };
+    }; // tolua_export
 
-}
+} // tolua_export
     
 #endif // _PickupRepresentation_H__

Modified: code/trunk/src/modules/pickup/PickupSpawner.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupSpawner.cc	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/modules/pickup/PickupSpawner.cc	2010-04-13 08:16:10 UTC (rev 6711)
@@ -179,8 +179,9 @@
             for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
             {
                 Vector3 distance = it->getWorldPosition() - this->getWorldPosition();
+                PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(*it);
                 //! 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))
+                if (distance.length() < this->triggerDistance_ && carrier != NULL && carrier->isTarget(this->pickup_))
                 {
                     this->trigger(*it);
                 }

Modified: code/trunk/src/orxonox/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/CMakeLists.txt	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/orxonox/CMakeLists.txt	2010-04-13 08:16:10 UTC (rev 6711)
@@ -57,6 +57,7 @@
     LevelManager.h
     MoodManager.h
     controllers/HumanController.h
+    interfaces/PickupCarrier.h
     sound/SoundManager.h
   DEFINE_SYMBOL
     "ORXONOX_SHARED_BUILD"

Modified: code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc	2010-04-13 08:16:10 UTC (rev 6711)
@@ -59,6 +59,7 @@
     {
         RegisterRootObject(PickupCarrier);
         
+        this->setCarrierName("PickupCarrier");
     }
     
     PickupCarrier::~PickupCarrier()

Modified: code/trunk/src/orxonox/interfaces/PickupCarrier.h
===================================================================
--- code/trunk/src/orxonox/interfaces/PickupCarrier.h	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/orxonox/interfaces/PickupCarrier.h	2010-04-13 08:16:10 UTC (rev 6711)
@@ -44,10 +44,11 @@
 
 #include "core/OrxonoxClass.h"
 
-namespace orxonox
-{
+namespace orxonox // tolua_export
+{ // tolua_export
 
     //! Forward-declarations.
+    class PickupManager;
     class Pickup;
     class HealthPickup;
     class InvisiblePickup;
@@ -60,11 +61,13 @@
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport PickupCarrier : virtual public OrxonoxClass
-    {
+    class _OrxonoxExport PickupCarrier  // tolua_export
+        : virtual public OrxonoxClass
+    { // tolua_export
         //! So that the different Pickupables have full access to their PickupCarrier.
+        friend class Pickupable;
+        friend class PickupManager;
         //! Friends. 
-        friend class Pickupable;
         friend class Pickup;
         friend class HealthPickup;
         friend class InvisiblePickup;
@@ -119,8 +122,8 @@
                         return true;
 
                     //! Go recursively through all children to check whether they are a target.
-                    std::list<PickupCarrier*>* children = this->getCarrierChildren();
-                    for(std::list<PickupCarrier*>::const_iterator it = children->begin(); it != children->end(); it++)
+                    std::vector<PickupCarrier*>* children = this->getCarrierChildren();
+                    for(std::vector<PickupCarrier*>::const_iterator it = children->begin(); it != children->end(); it++)
                     {
                         if((*it)->isTarget(pickup))
                             return true;
@@ -146,8 +149,8 @@
                         return this;
 
                     //! Go recursively through all children to check whether they are the target.
-                    std::list<PickupCarrier*>* children = this->getCarrierChildren();
-                    for(std::list<PickupCarrier*>::iterator it = children->begin(); it != children->end(); it++)
+                    std::vector<PickupCarrier*>* children = this->getCarrierChildren();
+                    for(std::vector<PickupCarrier*>::iterator it = children->begin(); it != children->end(); it++)
                     {
                         if(pickup->isTarget(*it))
                             return *it;
@@ -165,15 +168,21 @@
             @return Returns the position as a Vector3.
             */
             virtual const Vector3& getCarrierPosition(void) = 0;
-
-        protected:
+            
             /**
+            @brief Get the name of this PickupCarrier.
+            @return Returns the name as a string.
+            */
+            const std::string& getCarrierName(void) { return this->carrierName_; } // tolua_export
+            
+        protected:        
+            /**
             @brief Get all direct children of this PickupSpawner.
                    This method needs to be implemented by any direct derivative class of PickupCarrier.
                    The returned list will be deleted by the methods calling this function.
             @return Returns a pointer to a list of all direct children.
             */
-            virtual std::list<PickupCarrier*>* getCarrierChildren(void) = 0;
+            virtual std::vector<PickupCarrier*>* getCarrierChildren(void) = 0;
             /**
             @brief Get the parent of this PickupSpawner
                    This method needs to be implemented by any direct derivative class of PickupCarrier.
@@ -187,11 +196,69 @@
             */
             std::set<Pickupable*>& getPickups(void)
                 { return this->pickups_; }
-
+                
+            /**
+            @brief Set the name of this PickupCarrier.
+                   The name needs to be set in the constructor of every class inheriting from PickupCarrier, by calling setCarrierName().
+            @param name The name to be set.
+            */
+            void setCarrierName(const std::string& name)
+                { this->carrierName_ = name; }
+        
         private:
             std::set<Pickupable*> pickups_; //!< The list of Pickupables carried by this PickupCarrier.
+            std::string carrierName_; //!< The name of the PickupCarrier, as displayed in the PickupInventory.
+            
+            /**
+            @brief Get the number of carrier children this PickupCarrier has.
+            @return Returns the number of carrier children.
+            */
+            unsigned int getNumCarrierChildren(void)
+                {
+                    std::vector<PickupCarrier*>* list = this->getCarrierChildren();
+                    unsigned int size = list->size();
+                    delete list;
+                    return size;
+                }
+            
+            /**
+            @brief Get the index-th child of this PickupCarrier.
+            @param index The index of the child to return.
+            @return Returns the index-th child.
+            */
+            PickupCarrier* getCarrierChild(unsigned int index)
+                {
+                    std::vector<PickupCarrier*>* list = this->getCarrierChildren();
+                    if(list->size() < index)
+                        return NULL;
+                    PickupCarrier* carrier = (*list)[index];
+                    delete list;
+                    return carrier;
+                }
+            
+            /**
+            @brief Get the number of Pickupables this PickupCarrier carries.
+            @return returns the number of pickups.
+            */
+            unsigned int getNumPickups(void)
+                { return this->pickups_.size(); }
+            
+            /**
+            @brief Get the index-th Pickupable of this PickupCarrier.
+            @param index The index of the Pickupable to return.
+            @return Returns the index-th pickup.
+            */
+            Pickupable* getPickup(unsigned int index)
+                {
+                    std::set<Pickupable*>::iterator it;
+                    for(it = this->pickups_.begin(); index != 0 && it != this->pickups_.end(); it++)
+                        index--;
+                    if(it == this->pickups_.end())
+                        return NULL;
+                    return *it;
+                }
+            
+    }; // tolua_export
+} // tolua_export
 
-    };
-}
-
 #endif /* _PickupCarrier_H__ */

Modified: code/trunk/src/orxonox/items/Engine.cc
===================================================================
--- code/trunk/src/orxonox/items/Engine.cc	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/orxonox/items/Engine.cc	2010-04-13 08:16:10 UTC (rev 6711)
@@ -63,6 +63,7 @@
 
         this->boostBlur_ = 0;
 
+        this->setCarrierName("Engine");
         this->speedAdd_ = 0.0;
         this->speedMultiply_ = 1.0;
 

Modified: code/trunk/src/orxonox/items/Engine.h
===================================================================
--- code/trunk/src/orxonox/items/Engine.h	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/orxonox/items/Engine.h	2010-04-13 08:16:10 UTC (rev 6711)
@@ -121,8 +121,8 @@
                 { this->speedMultiply_=speedMultiply; }
 
         protected:
-            virtual std::list<PickupCarrier*>* getCarrierChildren(void)
-                { return new std::list<PickupCarrier*>(); }
+            virtual std::vector<PickupCarrier*>* getCarrierChildren(void)
+                { return new std::vector<PickupCarrier*>(); }
             virtual PickupCarrier* getCarrierParent(void);
 
         private:

Modified: code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc	2010-04-13 08:16:10 UTC (rev 6711)
@@ -326,10 +326,17 @@
         if (it != overlays_s.end())
         {
             OrxonoxOverlay* overlay= it->second;
+            COUT(1) << "MUP" << std::endl;
             if(overlay->isVisible())
+            {
                 overlay->hide();
+                COUT(1) << "HIDE " << name << std::endl;
+            }
             else
+            {
                 overlay->show();
+                COUT(1) << "SHOW " << name << std::endl;
+            }
         }
     }
 

Modified: code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.cc	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.cc	2010-04-13 08:16:10 UTC (rev 6711)
@@ -77,6 +77,8 @@
         }
         else
             this->weaponSystem_ = 0;
+        
+        this->setCarrierName("Pawn");
 
         this->setRadarObjectColour(ColourValue::Red);
         this->setRadarObjectShape(RadarViewable::Dot);

Modified: code/trunk/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.h	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.h	2010-04-13 08:16:10 UTC (rev 6711)
@@ -36,10 +36,11 @@
 #include "interfaces/RadarViewable.h"
 #include "worldentities/ControllableEntity.h"
 
-namespace orxonox
-{
-    class _OrxonoxExport Pawn : public ControllableEntity, public RadarViewable, public PickupCarrier
-    {
+namespace orxonox // tolua_export
+{ // tolua_export
+    class _OrxonoxExport Pawn // tolua_export
+        : public ControllableEntity, public RadarViewable, public PickupCarrier
+    { // tolua_export
         friend class WeaponSystem;
 
         public:
@@ -131,8 +132,8 @@
 
             bool bAlive_;
 
-            virtual std::list<PickupCarrier*>* getCarrierChildren(void)
-                { return new std::list<PickupCarrier*>(); }
+            virtual std::vector<PickupCarrier*>* getCarrierChildren(void)
+                { return new std::vector<PickupCarrier*>(); }
             virtual PickupCarrier* getCarrierParent(void)
                 { return NULL; }
 
@@ -154,7 +155,7 @@
                 { this->weaponSystem_ = weaponsystem; }
 
             Vector3 aimPosition_;
-    };
-}
+    }; // tolua_export
+} // tolua_export
 
 #endif /* _Pawn_H__ */

Modified: code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc	2010-04-13 08:16:10 UTC (rev 6711)
@@ -220,10 +220,10 @@
             engine->addToSpaceShip(this);
     }
 
-    std::list<PickupCarrier*>* SpaceShip::getCarrierChildren(void)
+    std::vector<PickupCarrier*>* SpaceShip::getCarrierChildren(void)
     {
-        std::list<PickupCarrier*>* list = new std::list<PickupCarrier*>();
-        list->push_front(this->engine_);
+        std::vector<PickupCarrier*>* list = new std::vector<PickupCarrier*>();
+        list->push_back(this->engine_);
         return list;
     }
 }

Modified: code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h	2010-04-13 07:50:11 UTC (rev 6710)
+++ code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h	2010-04-13 08:16:10 UTC (rev 6711)
@@ -85,7 +85,7 @@
                 { return this->bPermanentBoost_; }
 
         protected:
-            virtual std::list<PickupCarrier*>* getCarrierChildren(void);
+            virtual std::vector<PickupCarrier*>* getCarrierChildren(void);
             bool bInvertYAxis_;
 
             bool bBoost_;




More information about the Orxonox-commit mailing list