Index: code/branches/AsteroidMining_HS17/data/levels/AsteroidFarming.oxw
===================================================================
--- code/branches/AsteroidMining_HS17/data/levels/AsteroidFarming.oxw	(revision 11560)
+++ code/branches/AsteroidMining_HS17/data/levels/AsteroidFarming.oxw	(revision 11561)
@@ -3,5 +3,5 @@
  description = "Testing the Asteroid Mining Project, PPS HS 17"
  tags = "test"
- screenshot = "mytestlevel.png"
+ screenshot = "AsteroidFarming.png"
 />
 
@@ -24,8 +24,13 @@
   <?lua include("includes/notifications.oxi") ?>
 
+
   <Scene
     ambientlight = "0.8, 0.8, 0.8"
     skybox       = "Orxonox/Starbox"
   >
+
+  <?lua
+      include("includes/pickups.oxi")
+  ?>
 
     <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"/>
Index: code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc	(revision 11560)
+++ code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc	(revision 11561)
@@ -41,30 +41,35 @@
 /*
 Veraenderungstagebuch
-- Dynamische Definition von Argumenten funktioniert nicht (Immer auf default Values gesetzt)
----> Was tut registerVariable? Wann werden die Argumente im XML-File angewendet?
-    (Fall Konstruktor -> Methoden: Beim ersten Tick initialisieren?)
----> Mesh-Teil klappt, Hitbox noch nicht. 
----> Maximale Hitpunkte = 200?
----> Meshgroesse passt, aber Hitbox wird iwieso nicht mehr generiert. 
-
-- Neue Asteroiden generieren -> Absturz
-- Pickup spawning -> Absturz
-
-o hat's mit den Context-Eingenschaften zu tun? Je einen Neuen/Aktuellen besorgen? 
-
-Nicht Pointer uebergeben?
-- Manchmal: Absturz bei Zerstoerung eines Asteroiden
-- Was tut 'Register Variables'?
-
-o Error messages: change context::pickups to something else
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+KNACKPUNKTE:
+o Collision Shape-Problem (Funktioniert nur, wenn im Konstruktor)
+o Maximale Hitpunkte = 200?
+
+o Neue Asteroiden generieren -> Absturz
+---> Weil Elterndings zerstoert wird? 
+---> Nicht moeglich, zur Laufzeit zu generieren?
+
+o Pickups: setMaxSpawned funktioniert nicht
 
 
 OFFEN: 
-o Add custom pickup 'resources' 
-
-
-
-Erlegt:
-o Rand() geht bis zu riesigen Nummern!
+o Add custom pickup 'resources'. Weird template stuff -> Problems setting 'size' and other properties? setNumber of Resources. 
+o Explosion parts
+o custom HUD
+
+HANDBUCH:
+o im Level-File includes/pickups.oxi importieren. 
+
+Anpassungen Pickup-Zeug: 
+o Pickup.h: Zugriffsänderung createSpawner
+o PickupSpawner.h: Zugriffsrechte setPickupTemplateName() und setMaxSpawnedItems()
+
+ERLEGT:
+o Rand() geht bis zu riesigen Nummern! 
+o Pickupgenerierung: vgl. Anpassungen. 
+o Dummes fisch-- statt fisch++ , Endlosschleife! 
+o Dynamische Definition -> putStuff-Methode, Werte noch nicht durchgesickert. 
+o Error-Nachricht: Einfach Argumente leer lassen. 
 */
 
@@ -120,18 +125,10 @@
         this->bVulnerable_ = true;
 
-
-
         // Default Values
         this->generateSmaller = true;
-        //this->size = this->getSize(); // Value doesn-t get accepted. Weird. 
-        this->size = 10;
+        this->size = 10; // customSize
         this->context = context;
         this->initialised = false;
         //this->roll = rand()*5; //etwas Drehung. richtige Variable
-
-
-
-
-
 
 
@@ -142,6 +139,4 @@
         cs->setRadius((this->size)*2); //OFFEN: Feinabstimmung der Radien 
         this->attachCollisionShape(cs); 
-
-
 
 
@@ -165,11 +160,8 @@
         // random one of the 6 shapes
         char meshThingy[] = "";
-        sprintf(meshThingy, "ast%.0f.mesh", (round((5*(double)rand()/(double)RAND_MAX))+1));
-        //    sprintf(str, "Value of Pi = %f", M_PI);
-        //char meshThingy[] = "ast5.mesh";
+        sprintf(meshThingy, "ast%.0f.mesh", (round((5*(double)rand()/(double)RAND_MAX))+1)); //    sprintf(str, "Value of Pi = %f", M_PI);
         hull->setMeshSource(meshThingy);
         hull->setScale(this->size);
         this->attach(hull);
-        //hull->setPosition(this->getPosition());
 
         // Collision shape
@@ -240,46 +232,35 @@
     {
 
-
-        //Spawn Pickup // Create at start already? ( Hidden in CollisionShape)
-        HealthPickup* hP = new HealthPickup(this->context);
-        if(hP == nullptr){
-            orxout(internal_error, context::pickups) << "Weird, can't create new HealthPickup." << endl;
+        // Stuff that can be harvested. 
+        PickupSpawner* thingy = new PickupSpawner(this->context);
+
+        // OFFEN: more precise size relation in custom resource pickup. 
+        char tname[] = ""; // can-t overwrite strings easily in C (strcat etc.)
+        if(this->size <= 5){
+            strcat(tname, "smallmunitionpickup");
+        }else if(this->size <= 20){
+            strcat(tname, "mediummunitionpickup");
+        }else{
+            strcat(tname, "hugemunitionpickup");
         }
-        // hP->setPosition(this->getPosition()); // Does not have a member named 'setPosition' (Inherits from Pickup//BAse Object)
-
-        // invoke spawnPickup on the pikcup itself? (returns bool, creates the hideous thing)
-        // HealthPickup inherits from Pickup. 
-        // createSpawner is protected ->can be used as well in inheriting classes, but not here!
-        // bool unnecessary = hP->createSpawner();
-        // hP->setPosition(this->getPosition());
-        //OFFEN: Add custom pickup 'resources' 
-
-        // createPickup is private, hP is of type Pickup!
-        // CreateDroppedPickup returns a PickupSpawner! 
-        // PickupSpawner don't have public set methods, just that ugly 'factory method' which returns another PickupSpawner
-        // PickupSpawner* thingy = new PickupSpawner(this->context); 
-        // What is Pickupable? says: Interface, no way to set type. Why do I even need the spawner? Trigger Distance?
+        //orxout() << "Zeugsname:" << tname << endl;
+        thingy->setPickupTemplateName(tname);
+        thingy->setPosition(this->getPosition());
+        //thingy->setMaxSpawnedItems(1); // Somehow doesn-t work yet. 
+        thingy->setRespawnTime(0.1f);// instantly
         
-
-        // Plan: Solve the Pickupable mystery, try to adapt the spawner somehow. Ask to modify it if that fails. (Change method types)
-
-
-        // PickupSpawner* thingy = (new PickupSpawner(this->context))->createDroppedPickup(this->context, hP, nullptr, 10);
-//    /*static*/ PickupSpawner* PickupSpawner::createDroppedPickup(Context* context, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance)
-
-
-
-        // if(thingy == nullptr){
-        //     orxout(internal_error, context::pickups) << "Weird, can't create new PickupSpawner." << endl;
-        // }
-        // thingy->setPosition(this->getPosition());
-        // thingy->setMaxSpawnedItems(1);//Default is 1 already, private anyways
-        
-   
-
-        // // Smaller Parts
-        // if(this->generateSmaller){
-        //     this->spawnChildren();
-        // }
+        orxout() << "AsteroidMining::Death(): Passed Pickup stuff!" << endl;
+
+
+
+
+
+        // Smaller Parts = 'Children'
+        if(this->generateSmaller){
+            this->spawnChildren();
+        }
+
+
+
 
 
@@ -290,7 +271,9 @@
         this->destroyLater();
         this->setDestroyWhenPlayerLeft(false);
+
+
         // pawn -> addExplosionPart
         // this->goWithStyle();
-
+        orxout() << "Wieder retour in death() geschafft. " << endl;
 
         // if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_))
@@ -310,8 +293,15 @@
     // Spawn smaller Children 
     int massRem = this->size-1; //some mass is lost
-    int num = round((massRem-1)*(double)rand() / (double)RAND_MAX)+1; // random number of children, at least one
-    massRem = massRem-num;
+    int num = round((massRem-1)*(double)rand() / (double)RAND_MAX)+1; // random number of children, at least one // Tweak towards bigger junks?
+    num = 1; // zum Testen mal nur einen generieren. 
+    
+    massRem = massRem-num;    
     int extra = 0;
-    for(int fisch=num; fisch>=1; fisch++){
+
+
+    orxout() << "Number of Children: " << num << endl;
+
+
+    for(int fisch=num; fisch>=1; fisch--){
         // to distribute remaining mass
         if(fisch==1){ 
@@ -320,7 +310,10 @@
             extra = round(massRem*(double)rand() / (double)RAND_MAX);
             massRem = massRem-extra;
+
         }
 
-
+        orxout() << "Mass chosen: " << extra+1 << endl;
+
+        orxout() << "AsteroidMining::spawnChildren(): Inside for-loop." << endl;
 
         //Spawn this child  Game crashes!
@@ -328,5 +321,5 @@
         // if(!(child == nullptr)){//Errorgebastel
 
-
+        // Position zu spaet gesetzt? Tick nicht atomar -> falsche Groesse evtl?
 
             if(child == nullptr){
@@ -342,4 +335,7 @@
             child->setPosition(this->getPosition() + Vector3(num*5, 0, 0));
 
+
+        orxout() << "Done: Creating new Asteroid" << endl;
+
         // }
 
@@ -355,4 +351,5 @@
 
     }
+    orxout() << "Leaving spawnChildren() method. " << endl;
 }
 
Index: code/branches/AsteroidMining_HS17/src/modules/pickup/Pickup.h
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/pickup/Pickup.h	(revision 11560)
+++ code/branches/AsteroidMining_HS17/src/modules/pickup/Pickup.h	(revision 11561)
@@ -145,6 +145,9 @@
             virtual void changedPickedUp(void) override; //!< Should be called when the pickup has transited from picked up to dropped or the other way around.
 
+
+            virtual bool createSpawner(void) override; //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
+
+
         protected:
-            virtual bool createSpawner(void) override; //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
 
             /**
Index: code/branches/AsteroidMining_HS17/src/modules/pickup/PickupSpawner.h
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/pickup/PickupSpawner.h	(revision 11560)
+++ code/branches/AsteroidMining_HS17/src/modules/pickup/PickupSpawner.h	(revision 11561)
@@ -114,4 +114,12 @@
                 {return this->pickupTemplate_; }
 
+
+            void setPickupTemplateName(const std::string& name);
+            void setMaxSpawnedItems(int items); //!< Sets the maximum number of spawned items.
+
+            inline void setRespawnTime(float time)
+                { this->respawnTime_ = time; }
+
+
         private:
             void initialize(void);
@@ -141,10 +149,7 @@
             @param time New time after which this gets re-actived.
             */
-            inline void setRespawnTime(float time)
-                { this->respawnTime_ = time; }
 
-            void setMaxSpawnedItems(int items); //!< Sets the maximum number of spawned items.
 
-            void setPickupTemplateName(const std::string& name);
+
             void setPickupTemplate(Template* temp);
 
