[Orxonox-commit 4648] r9319 - in code/branches/presentation2012merge: data/levels data/levels/templates src/modules/pickup src/orxonox/interfaces

landauf at orxonox.net landauf at orxonox.net
Sat Jul 21 15:34:46 CEST 2012


Author: landauf
Date: 2012-07-21 15:34:45 +0200 (Sat, 21 Jul 2012)
New Revision: 9319

Removed:
   code/branches/presentation2012merge/src/modules/pickup/DroppedPickup.cc
   code/branches/presentation2012merge/src/modules/pickup/DroppedPickup.h
Modified:
   code/branches/presentation2012merge/data/levels/SurfaceRacePresentation.oxw
   code/branches/presentation2012merge/data/levels/lastManStanding.oxw
   code/branches/presentation2012merge/data/levels/lastTeamStanding.oxw
   code/branches/presentation2012merge/data/levels/missionOne.oxw
   code/branches/presentation2012merge/data/levels/pickups.oxw
   code/branches/presentation2012merge/data/levels/portals.oxw
   code/branches/presentation2012merge/data/levels/presentation09b.oxw
   code/branches/presentation2012merge/data/levels/presentationFS10.oxw
   code/branches/presentation2012merge/data/levels/presentationFS11.oxw
   code/branches/presentation2012merge/data/levels/presentationHS09.oxw
   code/branches/presentation2012merge/data/levels/surfaceRace.oxw
   code/branches/presentation2012merge/data/levels/templates/pickupRepresentationTemplates.oxt
   code/branches/presentation2012merge/src/modules/pickup/CMakeLists.txt
   code/branches/presentation2012merge/src/modules/pickup/Pickup.cc
   code/branches/presentation2012merge/src/modules/pickup/PickupCollection.cc
   code/branches/presentation2012merge/src/modules/pickup/PickupPrereqs.h
   code/branches/presentation2012merge/src/modules/pickup/PickupSpawner.cc
   code/branches/presentation2012merge/src/modules/pickup/PickupSpawner.h
   code/branches/presentation2012merge/src/orxonox/interfaces/Pickupable.h
Log:
refactored PickupSpawner - it doesn't clone a sample-pickup anymore, it creates new pickups from a template.
removed DroppedPickup because it is not needed anymore, PickupSpawner has now the same functionality.
the representation of the pickup spawner is now destroyed if the pickup is taken and re-created if it spawns again (instead of changing the visibility). makes it easier to change the pickup in a spawner during the game.
adjusted all level files accordingly

Modified: code/branches/presentation2012merge/data/levels/SurfaceRacePresentation.oxw
===================================================================
--- code/branches/presentation2012merge/data/levels/SurfaceRacePresentation.oxw	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/data/levels/SurfaceRacePresentation.oxw	2012-07-21 13:34:45 UTC (rev 9319)
@@ -323,27 +323,13 @@
 <!-- ---------------------PickUp---------------------- -->
 
 
- <PickupSpawner position="4000,8050,0" triggerDistance="40" respawnTime="10" maxSpawnedItems="99" scale="8">
-      <pickup>
-        <SpeedPickup template=smallspeedpickup />
-      </pickup>
-    </PickupSpawner>
+   <PickupSpawner pickup=smallspeedpickup position="4000,8050,0" triggerDistance="40" respawnTime="10" maxSpawnedItems="99" scale="8" />
+   <PickupSpawner pickup=mediumspeedpickup position="5500,8100,2000" triggerDistance="40" respawnTime="10" maxSpawnedItems="99" scale="8" />
+   <PickupSpawner pickup="mediumshrinkpickup" position="3000,8050,-4000" triggerDistance="40" respawnTime="60"  maxSpawnedItems="5" scale="8" />
 
-   <PickupSpawner position="5500,8100,2000" triggerDistance="40" respawnTime="10" maxSpawnedItems="99" scale="8">
-      <pickup>
-        <SpeedPickup template=mediumspeedpickup />
-      </pickup>
-    </PickupSpawner>
 
-    <PickupSpawner position="3000,8050,-4000" triggerDistance="40" respawnTime="60"  maxSpawnedItems="5" scale="8">
-      <pickup>
-        <ShrinkPickup template ="mediumshrinkpickup"/>
-      </pickup>
-    </PickupSpawner>>
 
 
-
-
  <!-- ---------------asteroid ellipse----------------- -->
 
  <?lua

Modified: code/branches/presentation2012merge/data/levels/lastManStanding.oxw
===================================================================
--- code/branches/presentation2012merge/data/levels/lastManStanding.oxw	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/data/levels/lastManStanding.oxw	2012-07-21 13:34:45 UTC (rev 9319)
@@ -49,11 +49,7 @@
                 <attached>
                     <Model position="0,0,0" scale=140 mesh="asteroid_UV.mesh" shadow=true />
                     <Model position="-160,40,28.4" scale=1 mesh="sphere.mesh" /><!--EasterEgg indicator-->
-                    <PickupSpawner position="-160,40,17" triggerDistance="20" respawnTime="5" maxSpawnedItems="15"><!--EasterEgg : invisible pickup is hidden inside the asteroid -->
-                        <pickup>
-                            <InvisiblePickup template=hugeinvisiblepickup />
-                        </pickup>
-                    </PickupSpawner>
+                    <PickupSpawner pickup=hugeinvisiblepickup position="-160,40,17" triggerDistance="20" respawnTime="5" maxSpawnedItems="15" /><!--EasterEgg : invisible pickup is hidden inside the asteroid -->
                 </attached>
             </MovableEntity>
         </attached>

Modified: code/branches/presentation2012merge/data/levels/lastTeamStanding.oxw
===================================================================
--- code/branches/presentation2012merge/data/levels/lastTeamStanding.oxw	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/data/levels/lastTeamStanding.oxw	2012-07-21 13:34:45 UTC (rev 9319)
@@ -47,11 +47,7 @@
       </collisionShapes>
     </StaticEntity>
 
-    <PickupSpawner position="-160,60,17" triggerDistance="20" respawnTime="5" maxSpawnedItems="10"><!--EasterEgg-->
-      <pickup>
-        <InvisiblePickup template=hugeinvisiblepickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=hugeinvisiblepickup position="-160,60,17" triggerDistance="20" respawnTime="5" maxSpawnedItems="10" /><!--EasterEgg-->
     <StaticEntity position="-160,60,28.4"><!--EasterEgg-Indicator-->
       <attached>
         <Model position="0,0,0" scale=1 mesh="sphere.mesh" />

Modified: code/branches/presentation2012merge/data/levels/missionOne.oxw
===================================================================
--- code/branches/presentation2012merge/data/levels/missionOne.oxw	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/data/levels/missionOne.oxw	2012-07-21 13:34:45 UTC (rev 9319)
@@ -1152,11 +1152,7 @@
 
 
 <!-- @Objects: Pickup - find better place !! -->
-    <PickupSpawner position="-48650,700,100" triggerDistance="70" respawnTime="30" maxSpawnedItems="1">
-      <pickup>
-        <ShieldPickup template=hugeshieldpickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=hugeshieldpickup position="-48650,700,100" triggerDistance="70" respawnTime="30" maxSpawnedItems="1" />
 
 
     <DistanceTrigger name="pickup" position="-48650,700,100" target="Pawn" distance=60 stayActive="true" delay=0 />

Modified: code/branches/presentation2012merge/data/levels/pickups.oxw
===================================================================
--- code/branches/presentation2012merge/data/levels/pickups.oxw	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/data/levels/pickups.oxw	2012-07-21 13:34:45 UTC (rev 9319)
@@ -36,159 +36,67 @@
 
     <!-- Shield pickups -->
 
-    <PickupSpawner position="-25,-25,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
-      <pickup>
-        <ShieldPickup template=smallshieldpickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=smallshieldpickup position="-25,-25,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
+    <PickupSpawner pickup=mediumshieldpickup position="0,-25,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
+    <PickupSpawner pickup=hugeshieldpickup position="25,-25,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
 
-    <PickupSpawner position="0,-25,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
-      <pickup>
-        <ShieldPickup template=mediumshieldpickup />
-      </pickup>
-    </PickupSpawner>
-
-    <PickupSpawner position="25,-25,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
-      <pickup>
-        <ShieldPickup template=hugeshieldpickup />
-      </pickup>
-    </PickupSpawner>
-
     <!-- Health pickups -->
 
-    <PickupSpawner position="-25,0,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
-      <pickup>
-        <HealthPickup template=smallhealthpickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=smallhealthpickup position="-25,0,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" />
+    <PickupSpawner pickup=mediumhealthpickup position="0,0,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" />
+    <PickupSpawner pickup=hugehealthpickup position="25,0,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" />
+    <PickupSpawner pickup=crazyhealthpickup position="50,0,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" />
 
-    <PickupSpawner position="0,0,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
-      <pickup>
-        <HealthPickup template=mediumhealthpickup />
-      </pickup>
-    </PickupSpawner>
-
-    <PickupSpawner position="25,0,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
-      <pickup>
-        <HealthPickup template=hugehealthpickup />
-      </pickup>
-    </PickupSpawner>
-
-    <PickupSpawner position="50,0,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
-      <pickup>
-        <HealthPickup template=crazyhealthpickup />
-      </pickup>
-    </PickupSpawner>
-
     <!-- Speed pickups -->
 
-    <PickupSpawner position="-25,25,-125" triggerDistance="10" respawnTime="10" maxSpawnedItems="99">
-      <pickup>
-        <SpeedPickup template=smallspeedpickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=smallspeedpickup position="-25,25,-125" triggerDistance="10" respawnTime="10" maxSpawnedItems="99" />
+    <PickupSpawner pickup=mediumspeedpickup position="0,25,-125" triggerDistance="10" respawnTime="10" maxSpawnedItems="99" />
+    <PickupSpawner pickup=hugespeedpickup position="25,25,-125" triggerDistance="10" respawnTime="10" maxSpawnedItems="99" />
+    <PickupSpawner pickup=smalljumppickup position="50,25,-125" triggerDistance="10" respawnTime="10" maxSpawnedItems="99" />
 
-    <PickupSpawner position="0,25,-125" triggerDistance="10" respawnTime="10" maxSpawnedItems="99">
-      <pickup>
-        <SpeedPickup template=mediumspeedpickup />
-      </pickup>
-    </PickupSpawner>
-
-    <PickupSpawner position="25,25,-125" triggerDistance="10" respawnTime="10" maxSpawnedItems="99">
-      <pickup>
-        <SpeedPickup template=hugespeedpickup />
-      </pickup>
-    </PickupSpawner>
-
-    <PickupSpawner position="50,25,-125" triggerDistance="10" respawnTime="10" maxSpawnedItems="99">
-      <pickup>
-        <SpeedPickup template=smalljumppickup />
-      </pickup>
-    </PickupSpawner>
-
     <!-- Invisible pickups -->
 
-    <PickupSpawner position="-25,50,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
-      <pickup>
-        <InvisiblePickup template=smallinvisiblepickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=smallinvisiblepickup position="-25,50,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
+    <PickupSpawner pickup=mediuminvisiblepickup position="0,50,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
+    <PickupSpawner pickup=hugeinvisiblepickup position="25,50,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
 
-    <PickupSpawner position="0,50,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
-      <pickup>
-        <InvisiblePickup template=mediuminvisiblepickup />
-      </pickup>
-    </PickupSpawner>
-
-    <PickupSpawner position="25,50,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
-      <pickup>
-        <InvisiblePickup template=hugeinvisiblepickup />
-      </pickup>
-    </PickupSpawner>
-
     <!-- Meta pickups -->
 
-    <PickupSpawner position="-25,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
-      <pickup>
-        <MetaPickup representation="use" metaType="use" />
-      </pickup>
-    </PickupSpawner>
+    <Template name=usemetapickup baseclass=MetaPickup>
+      <MetaPickup representation="use" metaType="use" />
+    </Template>
+    
+    <Template name=dropmetapickup baseclass=MetaPickup>
+      <MetaPickup representation="drop" metaType="drop" />
+    </Template>
+    
+    <Template name=destroymetapickup baseclass=MetaPickup>
+      <MetaPickup metaType="destroy" />
+    </Template>
+    
+    <Template name=destroycarriermetapickup baseclass=MetaPickup>
+      <MetaPickup metaType="destroyCarrier" />
+    </Template>
+    
+    <PickupSpawner pickup=usemetapickup position="-25,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
+    <PickupSpawner pickup=dropmetapickup position="0,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
+    <PickupSpawner pickup=destroymetapickup position="25,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
+    <PickupSpawner pickup=destroycarriermetapickup position="50,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
 
-    <PickupSpawner position="0,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
-      <pickup>
-        <MetaPickup representation="drop" metaType="drop" />
-      </pickup>
-    </PickupSpawner>
-
-    <PickupSpawner position="25,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
-      <pickup>
-        <MetaPickup metaType="destroy" />
-      </pickup>
-    </PickupSpawner>
-
-    <PickupSpawner position="50,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
-      <pickup>
-        <MetaPickup metaType="destroyCarrier" />
-      </pickup>
-    </PickupSpawner>
-
     <!-- Pickup Collection pickups -->
 
-    <PickupSpawner position="-50,25,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
-      <pickup>
-        <PickupCollection template=triplehealthspeedinvisibilitypickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=triplehealthspeedinvisibilitypickup position="-50,25,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" />
     
     <!-- Drone pickup -->
     
-    <PickupSpawner position="-50,50,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
-      <pickup>
-        <DronePickup template=dronepickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=dronepickup position="-50,50,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" />
     
     <!-- DamageBoost pickup -->
     
-    <PickupSpawner position="-50,75,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
-      <pickup>
-        <DamageBoostPickup template=smalldamageboostpickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=smalldamageboostpickup position="-50,75,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" />
+    <PickupSpawner pickup=mediumdamageboostpickup position="-50,100,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" />
+    <PickupSpawner pickup=largedamageboostpickup position="-50,125,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" />
     
-      <PickupSpawner position="-50,100,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
-      <pickup>
-        <DamageBoostPickup template=mediumdamageboostpickup />
-      </pickup>
-    </PickupSpawner>
-    
-      <PickupSpawner position="-50,125,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
-      <pickup>
-        <DamageBoostPickup template=largedamageboostpickup />
-      </pickup>
-    </PickupSpawner>
-    
-    
     <!-- Other pickups -->
 
     <!-- PickupRepresentation for the pickup below, since it is not a standard pickup provided by pickups.oxi -->
@@ -200,29 +108,15 @@
       inventoryRepresentation = "MediumHealth"
     />
 
-    <PickupSpawner position="-50,0,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
-      <pickup>
-        <HealthPickup representation="MediumHealth" health=500 activationType=immediate healthRate=10 durationType=continuous />
-      </pickup>
-    </PickupSpawner>
+    <Template name=continuoushealthpickup baseclass=HealthPickup>
+      <HealthPickup representation="MediumHealth" health=500 activationType=immediate healthRate=10 durationType=continuous />
+    </Template>
+    
+    <PickupSpawner pickup=continuoushealthpickup position="-50,0,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" />
 
-    <PickupSpawner position="-25,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
-      <pickup>
-        <ShrinkPickup template ="smallshrinkpickup"/>
-      </pickup>
-    </PickupSpawner>
-
-    <PickupSpawner position="0,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
-      <pickup>
-        <ShrinkPickup template ="mediumshrinkpickup"/>
-      </pickup>
-    </PickupSpawner>
-
-    <PickupSpawner position="25,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
-      <pickup>
-        <ShrinkPickup template ="hugeshrinkpickup"/>
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup="smallshrinkpickup" position="-25,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" />
+    <PickupSpawner pickup="mediumshrinkpickup" position="0,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" />
+    <PickupSpawner pickup="hugeshrinkpickup" position="25,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" />
     
     <!-- @Objects: 4 boxes (uncontrolled pawns) -->
     <Pawn team=1 health=30 position="0,100,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box RVName = "Box 4" >

Modified: code/branches/presentation2012merge/data/levels/portals.oxw
===================================================================
--- code/branches/presentation2012merge/data/levels/portals.oxw	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/data/levels/portals.oxw	2012-07-21 13:34:45 UTC (rev 9319)
@@ -38,11 +38,7 @@
     <PortalLink fromID="1" toID="2" />
     <PortalLink fromID="2" toID="1" />
 
-    <!--PickupSpawner position="-200,0,0" triggerDistance="10" respawnTime="10" maxSpawnedItems="10">
-      <pickup>
-        <DronePickup template=dronepickup />
-      </pickup>
-    </PickupSpawner-->
+    <!--PickupSpawner pickup=dronepickup position="-200,0,0" triggerDistance="10" respawnTime="10" maxSpawnedItems="10" /-->
 
     <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" />
 

Modified: code/branches/presentation2012merge/data/levels/presentation09b.oxw
===================================================================
--- code/branches/presentation2012merge/data/levels/presentation09b.oxw	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/data/levels/presentation09b.oxw	2012-07-21 13:34:45 UTC (rev 9319)
@@ -93,11 +93,7 @@
       </controller>
     </SpaceShip>
 
-    <PickupSpawner position="-3800, 2500, 1500" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
-      <pickup>
-        <SpeedPickup template=smalljumppickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=smalljumppickup position="-3800, 2500, 1500" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" />
 
     <!-- PickupRepresentation for the pickup below, since it is not a standard pickup provided by pickups.oxi -->
     <PickupRepresentation
@@ -108,18 +104,14 @@
       inventoryRepresentation = "MediumHealth"
     />
 
-    <PickupSpawner position="-4150,2750,1550" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
-      <pickup>
-        <HealthPickup representation="MediumHealth" health=100 activationType=onUse durationType=once />
-      </pickup>
-    </PickupSpawner>
+    <Template name=onusehealthpickup baseclass=HealthPickup>
+      <HealthPickup representation="MediumHealth" health=100 activationType=onUse durationType=once />
+    </Template>
 
-    <PickupSpawner position="2300, 4300, 2400" respawnTime="5" triggerDistance="20">
-      <pickup>
-        <HealthPickup template=mediumhealthpickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=onusehealthpickup position="-4150,2750,1550" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" />
 
+    <PickupSpawner pickup=mediumhealthpickup position="2300, 4300, 2400" respawnTime="5" triggerDistance="20" />
+
     <Billboard position="-2500, 2400, 1500" material="Examples/Flare" />
     <EventDispatcher>
       <targets>

Modified: code/branches/presentation2012merge/data/levels/presentationFS10.oxw
===================================================================
--- code/branches/presentation2012merge/data/levels/presentationFS10.oxw	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/data/levels/presentationFS10.oxw	2012-07-21 13:34:45 UTC (rev 9319)
@@ -101,49 +101,24 @@
       </SpaceShip>
     <?lua end ?>
 
-    <PickupSpawner position="500,-50,-500" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
-      <pickup>
-        <DronePickup template=dronepickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=dronepickup position="500,-50,-500" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
 
     <!-- Shield pickups -->
 
-    <PickupSpawner position="-25,-50,-500" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
-      <pickup>
-        <ShieldPickup template=hugeshieldpickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=hugeshieldpickup position="-25,-50,-500" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
 
     <!-- Health pickups -->
 
-    <PickupSpawner position="0,-75,-500" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
-      <pickup>
-        <HealthPickup template=hugehealthpickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=hugehealthpickup position="0,-75,-500" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" />
 
     <!-- Speed pickups -->
 
-    <PickupSpawner position="25,-50,-500" triggerDistance="10" respawnTime="10" maxSpawnedItems="99">
-      <pickup>
-        <SpeedPickup template=hugespeedpickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=hugespeedpickup position="25,-50,-500" triggerDistance="10" respawnTime="10" maxSpawnedItems="99" />
+    <PickupSpawner pickup=smalljumppickup position="50,-50,-500" triggerDistance="10" respawnTime="10" maxSpawnedItems="99" />
 
-    <PickupSpawner position="50,-50,-500" triggerDistance="10" respawnTime="10" maxSpawnedItems="99">
-      <pickup>
-        <SpeedPickup template=smalljumppickup />
-      </pickup>
-    </PickupSpawner>
-
     <!-- Invisible pickups -->
 
-    <PickupSpawner position="0,-50,-500" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
-      <pickup>
-        <InvisiblePickup template=hugeinvisiblepickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=hugeinvisiblepickup position="0,-50,-500" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
 
     <!-- PickupRepresentation for the pickup below, since it is not a standard pickup provided by pickups.oxi -->
     <PickupRepresentation
@@ -154,11 +129,11 @@
       inventoryRepresentation = "MediumHealth"
     />
 
-    <PickupSpawner position="25,-75,-500" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
-      <pickup>
-        <HealthPickup representation="MediumHealth" health=50 activationType=onUse durationType=once />
-      </pickup>
-    </PickupSpawner>
+    <Template name=onusehealthpickup baseclass=HealthPickup>
+      <HealthPickup representation="MediumHealth" health=50 activationType=onUse durationType=once />
+    </Template>
 
+    <PickupSpawner pickup=onusehealthpickup position="25,-75,-500" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" />
+
   </Scene>
 </Level>

Modified: code/branches/presentation2012merge/data/levels/presentationFS11.oxw
===================================================================
--- code/branches/presentation2012merge/data/levels/presentationFS11.oxw	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/data/levels/presentationFS11.oxw	2012-07-21 13:34:45 UTC (rev 9319)
@@ -421,10 +421,7 @@
         </events>
     </SimpleNotification>
 
-    <PickupSpawner position="-72487,420,-63" respawnTime="10" triggerDistance="20" maxSpawnedItems="5" active="false">
-      <pickup>
-        <ShrinkPickup template ="smallshrinkpickup"/>
-      </pickup>
+    <PickupSpawner pickup="smallshrinkpickup" position="-72487,420,-63" respawnTime="10" triggerDistance="20" maxSpawnedItems="5" active="false">
       <events>
         <activity>
             <EventListener event=portaldelaytrigger3 />

Modified: code/branches/presentation2012merge/data/levels/presentationHS09.oxw
===================================================================
--- code/branches/presentation2012merge/data/levels/presentationHS09.oxw	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/data/levels/presentationHS09.oxw	2012-07-21 13:34:45 UTC (rev 9319)
@@ -96,11 +96,7 @@
 
     <Billboard material="Test/Fog" position="-3800, 2500, 1500" alpha="0.1" color="1, 1, 1, 0.1" scale="0.5" />
 
-    <PickupSpawner position="-3800, 2500, 1500" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
-      <pickup>
-        <SpeedPickup template=smalljumppickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=smalljumppickup position="-3800, 2500, 1500" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" />
 
     <!-- PickupRepresentation for the pickup below, since it is not a standard pickup provided by pickups.oxi -->
     <PickupRepresentation
@@ -111,18 +107,14 @@
       inventoryRepresentation = "MediumHealth"
     />
 
-    <PickupSpawner position="-4150,2750,1550" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
-      <pickup>
-        <HealthPickup representation="MediumHealth" health=100 activationType=onUse durationType=once />
-      </pickup>
-    </PickupSpawner>
+    <Template name=onusehealthpickup baseclass=HealthPickup>
+      <HealthPickup representation="MediumHealth" health=100 activationType=onUse durationType=once />
+    </Template>
 
-    <PickupSpawner position="2300, 4300, 2400" respawnTime="5" triggerDistance="20">
-      <pickup>
-        <HealthPickup template=mediumhealthpickup />
-      </pickup>
-    </PickupSpawner>
+    <PickupSpawner pickup=onusehealthpickup position="-4150,2750,1550" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" />
 
+    <PickupSpawner pickup=mediumhealthpickup position="2300, 4300, 2400" respawnTime="5" triggerDistance="20" />
+
     <Billboard position="-2500, 2400, 1500" material="Examples/Flare" />
     <EventDispatcher>
       <targets>

Modified: code/branches/presentation2012merge/data/levels/surfaceRace.oxw
===================================================================
--- code/branches/presentation2012merge/data/levels/surfaceRace.oxw	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/data/levels/surfaceRace.oxw	2012-07-21 13:34:45 UTC (rev 9319)
@@ -398,27 +398,13 @@
 <!-- ---------------------PickUp---------------------- -->
 
 
- <PickupSpawner position="4000,8050,0" triggerDistance="40" respawnTime="10" maxSpawnedItems="99" scale="8">
-      <pickup>
-        <SpeedPickup template=smallspeedpickup />
-      </pickup>
-    </PickupSpawner>
+   <PickupSpawner pickup=smallspeedpickup position="4000,8050,0" triggerDistance="40" respawnTime="10" maxSpawnedItems="99" scale="8" />
+   <PickupSpawner pickup=mediumspeedpickup position="5500,8100,2000" triggerDistance="40" respawnTime="10" maxSpawnedItems="99" scale="8" />
+   <PickupSpawner pickup="mediumshrinkpickup" position="3000,8050,-4000" triggerDistance="40" respawnTime="60"  maxSpawnedItems="5" scale="8" />
 
-   <PickupSpawner position="5500,8100,2000" triggerDistance="40" respawnTime="10" maxSpawnedItems="99" scale="8">
-      <pickup>
-        <SpeedPickup template=mediumspeedpickup />
-      </pickup>
-    </PickupSpawner>
 
-    <PickupSpawner position="3000,8050,-4000" triggerDistance="40" respawnTime="60"  maxSpawnedItems="5" scale="8">
-      <pickup>
-        <ShrinkPickup template ="mediumshrinkpickup"/>
-      </pickup>
-    </PickupSpawner>>
 
 
-
-
  <!-- ---------------asteroid ellipse----------------- -->
 
  <?lua

Modified: code/branches/presentation2012merge/data/levels/templates/pickupRepresentationTemplates.oxt
===================================================================
--- code/branches/presentation2012merge/data/levels/templates/pickupRepresentationTemplates.oxt	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/data/levels/templates/pickupRepresentationTemplates.oxt	2012-07-21 13:34:45 UTC (rev 9319)
@@ -16,7 +16,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=smallshieldpickup>
+<Template name=smallshieldpickup baseclass=ShieldPickup>
   <ShieldPickup
     representation = "smallshieldpickup"
     duration = 10
@@ -43,7 +43,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=mediumshieldpickup>
+<Template name=mediumshieldpickup baseclass=ShieldPickup>
   <ShieldPickup
     representation = "mediumshieldpickup"
     duration = 30
@@ -71,7 +71,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=hugeshieldpickup>
+<Template name=hugeshieldpickup baseclass=ShieldPickup>
   <ShieldPickup
     representation = "hugeshieldpickup"
     duration = 60
@@ -100,7 +100,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=smallhealthpickup>
+<Template name=smallhealthpickup baseclass=HealthPickup>
   <HealthPickup
     representation = "smallhealthpickup"
     health = 10
@@ -126,7 +126,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=mediumhealthpickup>
+<Template name=mediumhealthpickup baseclass=HealthPickup>
   <HealthPickup
     representation = "mediumhealthpickup"
     health = 50
@@ -152,7 +152,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=hugehealthpickup>
+<Template name=hugehealthpickup baseclass=HealthPickup>
   <HealthPickup
     representation = "hugehealthpickup"
     health = 100
@@ -178,7 +178,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=crazyhealthpickup>
+<Template name=crazyhealthpickup baseclass=HealthPickup>
   <HealthPickup
     representation = "crazyhealthpickup"
     health = 1000
@@ -240,7 +240,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=smalldamageboostpickup>
+<Template name=smalldamageboostpickup baseclass=DamageBoostPickup>
   <DamageBoostPickup
     representation = "smalldamageboostpickup"
     duration = 10.0
@@ -266,7 +266,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=mediumdamageboostpickup>
+<Template name=mediumdamageboostpickup baseclass=DamageBoostPickup>
   <DamageBoostPickup
     representation = "mediumdamageboostpickup"
     duration = 10.0
@@ -292,7 +292,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=largedamageboostpickup>
+<Template name=largedamageboostpickup baseclass=DamageBoostPickup>
   <DamageBoostPickup
     representation = "largedamageboostpickup"
     duration = 10.0
@@ -321,7 +321,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=smallspeedpickup>
+<Template name=smallspeedpickup baseclass=SpeedPickup>
   <SpeedPickup
     representation = "smallspeedpickup"
     duration = 10.0
@@ -348,7 +348,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=mediumspeedpickup>
+<Template name=mediumspeedpickup baseclass=SpeedPickup>
   <SpeedPickup
     representation = "mediumspeedpickup"
     duration = 10.0
@@ -375,7 +375,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=hugespeedpickup>
+<Template name=hugespeedpickup baseclass=SpeedPickup>
   <SpeedPickup
     representation = "hugespeedpickup"
     duration = 10.0
@@ -402,7 +402,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=smalljumppickup>
+<Template name=smalljumppickup baseclass=SpeedPickup>
   <SpeedPickup
     representation = "smalljumppickup"
     duration = 0.7
@@ -431,7 +431,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=smallinvisiblepickup>
+<Template name=smallinvisiblepickup baseclass=InvisiblePickup>
   <InvisiblePickup 
     representation = "smallinvisiblepickup"
     duration = 5.0
@@ -456,7 +456,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=mediuminvisiblepickup>
+<Template name=mediuminvisiblepickup baseclass=InvisiblePickup>
   <InvisiblePickup 
     representation = "mediuminvisiblepickup"
     duration = 10.0
@@ -481,7 +481,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=hugeinvisiblepickup>
+<Template name=hugeinvisiblepickup baseclass=InvisiblePickup>
   <InvisiblePickup 
     representation = "hugeinvisiblepickup"
     duration = 20.0
@@ -506,7 +506,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=smallshrinkpickup>
+<Template name=smallshrinkpickup baseclass=ShrinkPickup>
   <ShrinkPickup 
     representation = "smallshrinkpickup"
     duration = 10.0
@@ -532,7 +532,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=mediumshrinkpickup>
+<Template name=mediumshrinkpickup baseclass=ShrinkPickup>
   <ShrinkPickup 
     representation = "mediumshrinkpickup"
     duration = 30.0
@@ -558,7 +558,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=hugeshrinkpickup>
+<Template name=hugeshrinkpickup baseclass=ShrinkPickup>
   <ShrinkPickup 
     representation = "hugeshrinkpickup"
     duration = 60.0
@@ -588,7 +588,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=triplehealthspeedinvisibilitypickup>
+<Template name=triplehealthspeedinvisibilitypickup baseclass=PickupCollection>
     <PickupCollection
         representation = "triplehealthspeedinvisibilitypickup"
     >
@@ -650,7 +650,7 @@
     </PickupRepresentation>
 </Template>
 
-<Template name=dronepickup>
+<Template name=dronepickup baseclass=DronePickup>
     <DronePickup representation=dronepickup droneTemplate=droneTemplate />
 </Template>
 

Modified: code/branches/presentation2012merge/src/modules/pickup/CMakeLists.txt
===================================================================
--- code/branches/presentation2012merge/src/modules/pickup/CMakeLists.txt	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/src/modules/pickup/CMakeLists.txt	2012-07-21 13:34:45 UTC (rev 9319)
@@ -1,6 +1,5 @@
 SET_SOURCE_FILES(PICKUP_SRC_FILES
   CollectiblePickup.cc
-  DroppedPickup.cc
   Pickup.cc
   PickupCollection.cc
   PickupManager.cc

Deleted: code/branches/presentation2012merge/src/modules/pickup/DroppedPickup.cc
===================================================================
--- code/branches/presentation2012merge/src/modules/pickup/DroppedPickup.cc	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/src/modules/pickup/DroppedPickup.cc	2012-07-21 13:34:45 UTC (rev 9319)
@@ -1,96 +0,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:
- *      Damian 'Mozork' Frick
- *
- */
-
-/**
-    @file DroppedPickup.cc
-    @brief Implementation of the DroppedPickup class.
-*/
-
-#include "DroppedPickup.h"
-
-#include "core/CoreIncludes.h"
-
-#include "interfaces/Pickupable.h"
-#include "interfaces/PickupCarrier.h"
-
-namespace orxonox
-{
-
-    CreateFactory(DroppedPickup);
-
-    /**
-    @brief
-        Default constructor. Registers object and sets default values.
-    */
-    DroppedPickup::DroppedPickup(BaseObject* creator) : PickupSpawner(creator)
-    {
-        RegisterObject(DroppedPickup);
-    }
-
-    /**
-    @brief
-        Constructor. Registers the object and sets values.
-    @param creator
-        The creator of the DroppedPickup.
-    @param pickup
-        The Pickupable that was dropped.
-    @param carrier
-        The PickupCarrier that carried the input pickup before it was dropped.
-    @param triggerDistance
-        The distance at which the PickupSpawner triggers. Default is 10.
-    */
-    DroppedPickup::DroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance) : PickupSpawner(creator, pickup, triggerDistance, 5, 1)
-    {
-        RegisterObject(DroppedPickup);
-
-        this->setPosition(carrier->getCarrierPosition());
-        this->block(carrier, DEFAULT_BLOCKED_TIME);
-    }
-
-    /**
-    @brief
-        Destructor.
-    */
-    DroppedPickup::~DroppedPickup()
-    {
-
-    }
-
-    /**
-    @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)
-    {
-        Pickupable* pickup = this->pickup_;
-        this->pickup_ = NULL;
-        return pickup;
-    }
-
-}

Deleted: code/branches/presentation2012merge/src/modules/pickup/DroppedPickup.h
===================================================================
--- code/branches/presentation2012merge/src/modules/pickup/DroppedPickup.h	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/src/modules/pickup/DroppedPickup.h	2012-07-21 13:34:45 UTC (rev 9319)
@@ -1,72 +0,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:
- *      Damian 'Mozork' Frick
- *
- */
-
-/**
-    @file DroppedPickup.h
-    @brief Definition of the DroppedPickup class.
-    @ingroup Pickup
-*/
-
-#ifndef _DroppedPickup_H__
-#define _DroppedPickup_H__
-
-#include "PickupPrereqs.h"
-
-#include "PickupSpawner.h"
-
-namespace orxonox
-{
-
-    /**
-    @brief
-        Special PickupSpawner that is created when a @ref orxonox::Pickupable "Pickupable" is dropped. It just spawns one pickup, the one that was dropped.
-
-    @author
-        Daniel 'Huty' Haggenmueller
-    @author
-        Damian 'Mozork' Frick
-
-    @ingroup Pickup
-    */
-    class _PickupExport DroppedPickup : public PickupSpawner
-    {
-        public:
-            DroppedPickup(BaseObject* creator);
-            DroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance = 10.0); //!< Constructor.
-            virtual ~DroppedPickup();
-
-        protected:
-            virtual Pickupable* getPickup(void); //!< Creates the Pickupable that is going to get picked up.
-
-        private:
-            static const unsigned int DEFAULT_BLOCKED_TIME = 10; //!< The default time a PickupCarrier is blocked from picking up the pickupable again, after it has dropped it.
-
-    };
-}
-
-#endif /* _DroppedPickup_H__ */

Modified: code/branches/presentation2012merge/src/modules/pickup/Pickup.cc
===================================================================
--- code/branches/presentation2012merge/src/modules/pickup/Pickup.cc	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/src/modules/pickup/Pickup.cc	2012-07-21 13:34:45 UTC (rev 9319)
@@ -36,7 +36,7 @@
 #include "core/CoreIncludes.h"
 #include "util/StringUtils.h"
 
-#include "DroppedPickup.h"
+#include "PickupSpawner.h"
 
 namespace orxonox
 {
@@ -200,14 +200,12 @@
     /**
     @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);
     @return
         Returns true if a spawner was created, false if not.
     */
     bool Pickup::createSpawner(void)
     {
-        new DroppedPickup(this, this, this->getCarrier());
+        PickupSpawner::createDroppedPickup(this, this, this->getCarrier());
         return true;
     }
 

Modified: code/branches/presentation2012merge/src/modules/pickup/PickupCollection.cc
===================================================================
--- code/branches/presentation2012merge/src/modules/pickup/PickupCollection.cc	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/src/modules/pickup/PickupCollection.cc	2012-07-21 13:34:45 UTC (rev 9319)
@@ -37,7 +37,7 @@
 #include "interfaces/PickupCarrier.h"
 
 #include "CollectiblePickup.h"
-#include "DroppedPickup.h"
+#include "PickupSpawner.h"
 
 #include "PickupCollection.h"
 
@@ -347,14 +347,12 @@
     /**
     @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);
     @return
         Returns true if a spawner was created, false if not.
     */
     bool PickupCollection::createSpawner(void)
     {
-        new DroppedPickup(this, this, this->getCarrier());
+        PickupSpawner::createDroppedPickup(this, this, this->getCarrier());
         return true;
     }
 

Modified: code/branches/presentation2012merge/src/modules/pickup/PickupPrereqs.h
===================================================================
--- code/branches/presentation2012merge/src/modules/pickup/PickupPrereqs.h	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/src/modules/pickup/PickupPrereqs.h	2012-07-21 13:34:45 UTC (rev 9319)
@@ -69,7 +69,6 @@
 {
 
     class CollectiblePickup;
-    class DroppedPickup;
     class Pickup;
     class PickupCollection;
     class PickupManager;

Modified: code/branches/presentation2012merge/src/modules/pickup/PickupSpawner.cc
===================================================================
--- code/branches/presentation2012merge/src/modules/pickup/PickupSpawner.cc	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/src/modules/pickup/PickupSpawner.cc	2012-07-21 13:34:45 UTC (rev 9319)
@@ -54,7 +54,7 @@
     @param creator
         Pointer to the object which created this item.
     */
-    PickupSpawner::PickupSpawner(BaseObject* creator) : StaticEntity(creator), pickup_(NULL)
+    PickupSpawner::PickupSpawner(BaseObject* creator) : StaticEntity(creator), pickup_(NULL), representation_(NULL), pickupTemplate_(NULL)
     {
         RegisterObject(PickupSpawner);
 
@@ -63,45 +63,6 @@
 
     /**
     @brief
-        Constructor, Creates a fully functional PickupSpawner.
-    @param creator
-        The creator of this PickupSpawner.
-    @param pickup
-        The Pickupable to be spawned by this PickupSpawner.
-    @param triggerDistance
-        The distance at which the PickupSpawner will trigger.
-    @param respawnTime
-        The minimum time between two spawns.
-    @param maxSpawnedItems
-        The maximum number of items spawned by this PickupSpawner.
-    */
-    PickupSpawner::PickupSpawner(BaseObject* creator, Pickupable* pickup, float triggerDistance, float respawnTime, int maxSpawnedItems) : StaticEntity(creator), pickup_(NULL)
-    {
-        RegisterObject(PickupSpawner);
-
-        this->initialize();
-
-        this->pickup_ = pickup;
-
-        this->triggerDistance_ = triggerDistance;
-        this->respawnTime_ = respawnTime;
-        this->setMaxSpawnedItems(maxSpawnedItems);
-
-        if(this->pickup_ == NULL)
-        {
-            orxout(internal_warning, context::pickups) << "A PickupSpawner was created without a valid Pickupable. This won't work." << endl;
-            this->setActive(false);
-        }
-        else
-        {
-            PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(this->pickup_->getRepresentationName());
-            this->attach(representation->createSpawnerRepresentation(this));
-            this->setActive(true);
-        }
-    }
-
-    /**
-    @brief
         Registers the object and sets some default values.
     */
     void PickupSpawner::initialize(void)
@@ -111,6 +72,8 @@
         this->maxSpawnedItems_ = INF;
         this->spawnsRemaining_ = INF;
         this->selfDestruct_ = false;
+
+        this->setPickupable(NULL);
     }
 
     /**
@@ -125,6 +88,32 @@
 
     /**
     @brief
+        Factory method, Creates a fully functional PickupSpawner.
+    @param creator
+        The creator of this PickupSpawner.
+    @param pickup
+        The Pickupable to be spawned by this PickupSpawner.
+    @param carrier
+        The PickupCarrier that carried the input pickup before it was dropped.
+    @param triggerDistance
+        The distance at which the PickupSpawner will trigger.
+    */
+    /*static*/ PickupSpawner* PickupSpawner::createDroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance)
+    {
+        PickupSpawner* spawner = new PickupSpawner(creator);
+
+        spawner->setPickupable(pickup);
+        spawner->setTriggerDistance(triggerDistance);
+        spawner->setMaxSpawnedItems(1);
+
+        spawner->setPosition(carrier->getCarrierPosition());
+        spawner->block(carrier);
+
+        return spawner;
+    }
+
+    /**
+    @brief
         Method for creating a PickupSpawner through XML.
     @param xmlelement
         XML element which contains the PickupSpawner.
@@ -135,39 +124,14 @@
     {
         SUPER(PickupSpawner, XMLPort, xmlelement, mode);
 
-        XMLPortObject(PickupSpawner, Pickupable, "pickup", setPickupable, getPickupable, xmlelement, mode);
-
+        XMLPortParam(PickupSpawner, "pickup", setPickupTemplateName, getPickupTemplateName, xmlelement, mode);
         XMLPortParam(PickupSpawner, "triggerDistance", setTriggerDistance, getTriggerDistance, xmlelement, mode);
         XMLPortParam(PickupSpawner, "respawnTime", setRespawnTime, getRespawnTime, xmlelement, mode);
         XMLPortParam(PickupSpawner, "maxSpawnedItems", setMaxSpawnedItems, getMaxSpawnedItems, xmlelement, mode);
-
-        if(this->pickup_ == NULL)
-        {
-            orxout(internal_warning, context::pickups) << "A PickupSpawner was created without a valid Pickupable. This won't work." << endl;
-            this->setActive(false);
-        }
-        else
-        {
-            PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(this->pickup_->getRepresentationName());
-            this->attach(representation->createSpawnerRepresentation(this));
-            this->setActive(true);
-        }
     }
 
     /**
     @brief
-        Invoked when the activity has changed. Sets visibility of attached objects.
-    */
-    void PickupSpawner::changedActivity()
-    {
-        SUPER(PickupSpawner, changedActivity);
-
-        if(GameMode::isMaster())
-            this->setVisible(this->isActive());
-    }
-
-    /**
-    @brief
         Tick, checks if any Pawn is close enough to trigger.
     @param dt
         Time since last tick.
@@ -198,7 +162,7 @@
                     break;
 
                 Vector3 distance = it->getWorldPosition() - this->getWorldPosition();
-                PickupCarrier* carrier = orxonox_cast<PickupCarrier*>(*it);
+                PickupCarrier* carrier = static_cast<PickupCarrier*>(*it);
                 // If a PickupCarrier, that fits the target-range of the Pickupable spawned by this PickupSpawner, is in trigger-distance and the carrier is not blocked.
                 if(distance.length() < this->triggerDistance_ && carrier != NULL && this->blocked_.find(carrier) == this->blocked_.end())
                 {
@@ -211,6 +175,45 @@
 
     /**
     @brief
+        Trigger the PickupSpawner.
+        Adds the pickup to the Pawn that triggered, sets the timer to re-activate and deactives the PickupSpawner.
+    @param carrier
+        Carrier which triggered the PickupSpawner.
+    */
+    void PickupSpawner::trigger(PickupCarrier* carrier)
+    {
+        orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") triggered and active." << endl;
+
+        PickupCarrier* target = carrier->getTarget(this->pickup_);
+
+        this->block(carrier);
+
+        assert(target);
+        bool pickedUp = this->pickup_->pickup(target);
+        assert(pickedUp);
+        pickedUp = false; // To avoid compiler warning.
+
+        this->setPickupable(NULL);
+        this->decrementSpawnsRemaining();
+    }
+
+    void PickupSpawner::setPickupTemplateName(const std::string& name)
+    {
+        Template* temp = Template::getTemplate(name);
+        if (temp)
+            this->setPickupTemplate(temp);
+    }
+
+    void PickupSpawner::setPickupTemplate(Template* temp)
+    {
+        this->pickupTemplate_ = temp;
+        this->pickupTemplateName_ = temp->getName();
+
+        this->setPickupable(this->createPickup());
+    }
+
+    /**
+    @brief
         Sets the maximum number of spawned items.
     @param items
         The maximum number of spawned items to be set.
@@ -232,17 +235,16 @@
         if(this->spawnsRemaining_ != INF)
             this->spawnsRemaining_--;
 
+        this->setActive(false);
+
         if(this->spawnsRemaining_ != 0 && this->respawnTime_ > 0)
         {
             this->startRespawnTimer();
-
-            this->setActive(false);
             this->fireEvent();
         }
         else
         {
             orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") empty, selfdestruct initialized." << endl;
-            this->setActive(false);
             this->destroy();
         }
     }
@@ -258,101 +260,74 @@
 
     /**
     @brief
-        Sets a Pickupable for the PickupSpawner to spawn.
-    @param pickup
-        The Pickupable to be set.
+        Invoked by the timer, re-activates the PickupSpawner.
     */
-    void PickupSpawner::setPickupable(Pickupable* pickup)
+    void PickupSpawner::respawnTimerCallback()
     {
-        if(this->pickup_ != NULL)
-        {
-            orxout(internal_error, context::pickups) << "In PickupSpawner (&" << this << "): setPickupable called, with this->pickup_ already set." << endl;
-            return;
-        }
-        if(pickup == NULL)
-        {
-            orxout(internal_error, context::pickups) << "In PickupSpawner (&" << this << "): Argument of setPickupable is NULL." << endl;
-            return;
-        }
+        orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") reactivated." << endl;
 
-        this->pickup_ = pickup;
+        this->setPickupable(this->createPickup());
     }
 
     /**
     @brief
-        Get the Pickupable that is spawned by this PickupSpawner.
+        Creates a new Pickupable.
     @return
-        Returns the Pickupable that is spawned by this PickupSpawner.
+        The Pickupable created.
     */
-    const Pickupable* PickupSpawner::getPickupable(void) const
+    Pickupable* PickupSpawner::createPickup(void)
     {
-        return this->pickup_;
-    }
-
-    /**
-    @brief
-        Trigger 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.
-    */
-    void PickupSpawner::trigger(Pawn* pawn)
-    {
-        if(this->isActive()) // Checks whether PickupSpawner is active.
+        if(this->spawnsRemaining_ == 0)
         {
-            orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") triggered and active." << endl;
+            orxout(internal_error, context::pickups) << "Massive Error: PickupSpawner still alive until having spawned last item." << endl;
+            return NULL;
+        }
 
-            PickupCarrier* carrier = orxonox_cast<PickupCarrier*>(pawn);
-            assert(carrier);
-
-            // If the Pawn isn't a target of the Pickupable.
-            if(!carrier->isTarget(this->pickup_))
+        if (this->pickupTemplate_ != NULL)
+        {
+            Identifier* identifier = this->pickupTemplate_->getBaseclassIdentifier();
+            if (identifier != NULL)
             {
-                orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") triggered but Pawn wasn't a target of the Pickupable." << endl;
-                return;
+                Pickupable* pickup = orxonox_cast<Pickupable*>(identifier->fabricate(this));
+                orxonox_cast<BaseObject*>(pickup)->addTemplate(this->pickupTemplate_);
+                return pickup;
             }
-
-            PickupCarrier* target = carrier->getTarget(this->pickup_);
-            Pickupable* pickup = this->getPickup();
-
-            this->block(carrier);
-
-            assert(pickup);
-            assert(target);
-            bool pickedUp = pickup->pickup(target);
-            assert(pickedUp);
-            pickedUp = false; // To avoid compiler warning.
-
-            this->decrementSpawnsRemaining();
+            else
+                orxout(internal_error, context::pickups) << "No base class defined in pickup-template " << this->pickupTemplateName_ << endl;
         }
+
+        return NULL;
     }
 
     /**
     @brief
-        Creates a new Pickupable.
-    @return
-        The Pickupable created.
+        Sets a Pickupable for the PickupSpawner to spawn.
+    @param pickup
+        The Pickupable to be set.
     */
-    Pickupable* PickupSpawner::getPickup(void)
+    void PickupSpawner::setPickupable(Pickupable* pickup)
     {
-        if(this->spawnsRemaining_ == 0)
+        if (this->representation_ != NULL)
         {
-            orxout(internal_error, context::pickups) << "Massive Error: PickupSpawner still alive until having spawned last item." << endl;
-            return NULL;
+            this->representation_->destroy();
+            this->representation_ = NULL;
         }
 
-        Pickupable* pickup = this->pickup_->clone();
-        return pickup;
-    }
+        if (pickup != NULL)
+        {
+            if (this->pickup_ != NULL)
+                this->pickup_->destroy();
 
-    /**
-    @brief
-        Invoked by the timer, re-activates the PickupSpawner.
-    */
-    void PickupSpawner::respawnTimerCallback()
-    {
-        orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") reactivated." << endl;
+            PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(pickup->getRepresentationName());
+            this->representation_ = representation->createSpawnerRepresentation(this);
+            this->attach(this->representation_);
+            this->setActive(true);
+        }
+        else
+        {
+            this->setActive(false);
+        }
 
-        this->setActive(true);
+        this->pickup_ = pickup;
     }
 }

Modified: code/branches/presentation2012merge/src/modules/pickup/PickupSpawner.h
===================================================================
--- code/branches/presentation2012merge/src/modules/pickup/PickupSpawner.h	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/src/modules/pickup/PickupSpawner.h	2012-07-21 13:34:45 UTC (rev 9319)
@@ -77,11 +77,11 @@
     {
         public:
             PickupSpawner(BaseObject* creator); //!< Default Constructor.
-            PickupSpawner(BaseObject* creator, Pickupable* pickup, float triggerDistance, float respawnTime, int maxSpawnedItems); //!< Constructor.
             virtual ~PickupSpawner(); //!< Destructor.
 
+            static PickupSpawner* createDroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance = 10.0);
+
             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); //!< Tick, checks if any Pawn is close enough to trigger.
 
             /**
@@ -102,8 +102,23 @@
             */
             inline int getMaxSpawnedItems(void) const
                 { return this->maxSpawnedItems_; }
+            /**
+            @brief Returns the name of the template which is used to create a pickup for this spawner.
+            */
+            inline const std::string& getPickupTemplateName() const
+                { return this->pickupTemplateName_; }
+            /**
+            @brief Returns the template which is used to create a pickup for this spawner.
+            */
+            inline Template* getPickupTemplate() const
+                {return this->pickupTemplate_; }
 
-        protected:
+        private:
+            void initialize(void);
+
+            void trigger(PickupCarrier* carrier); //!< Method called when a carrier is close enough.
+            void respawnTimerCallback(); //!< Method called when the timer runs out.
+
             void decrementSpawnsRemaining(void); //!< Decrements the number of remaining spawns.
             void startRespawnTimer(void); //!< Invoked by the timer, re-activates the PickupSpawner.
 
@@ -127,21 +142,20 @@
             */
             inline void setRespawnTime(float time)
                 { this->respawnTime_ = time; }
+
             void setMaxSpawnedItems(int items); //!< Sets the maximum number of spawned items.
 
-            virtual Pickupable* getPickup(void); //!< Creates a new Pickupable.
+            void setPickupTemplateName(const std::string& name);
+            void setPickupTemplate(Template* temp);
 
+            Pickupable* createPickup(void); //!< Creates a new Pickupable.
             void setPickupable(Pickupable* pickup); //!< Sets a Pickupable for the PickupSpawner to spawn.
-            const Pickupable* getPickupable(void) const; //!< Get the Pickupable that is spawned by this PickupSpawner.
 
             Pickupable* pickup_; //!< The pickup to be spawned.
+            StaticEntity* representation_; //!< The active representation of the spawner.
+            std::string pickupTemplateName_; //!< The name of the pickup template.
+            Template* pickupTemplate_; //!< The template to be used to create a pickupable.
 
-        private:
-            void initialize(void);
-
-            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.
 

Modified: code/branches/presentation2012merge/src/orxonox/interfaces/Pickupable.h
===================================================================
--- code/branches/presentation2012merge/src/orxonox/interfaces/Pickupable.h	2012-07-18 20:36:24 UTC (rev 9318)
+++ code/branches/presentation2012merge/src/orxonox/interfaces/Pickupable.h	2012-07-21 13:34:45 UTC (rev 9319)
@@ -170,8 +170,7 @@
 
             /**
             @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, PickupCarrier* carrier, float triggerDistance);
+                   This method must be implemented by any class directly inheriting from Pickupable.
             @return Returns true if a spawner was created, false if not.
             */
             virtual bool createSpawner(void) = 0;




More information about the Orxonox-commit mailing list