Index: code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc	(revision 11587)
+++ code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc	(revision 11609)
@@ -44,16 +44,20 @@
 
 KNACKPUNKTE:
-o Der neu erscheinende Asteroid versucht, das Pickup aufzusammeln. 
---> Mathematisch genuegend Abstand?
---> Kollisions-Ausnahme richtig, mit Hit-Methode oder so, auch bei Pickup anpassen?
---> Den Fall im eigenen Pickup behandeln? 
---> Nur ein Pickup generieren, wenn die Groesse sowieso eins ist? -> Loest Kollisionsproblem nicht. 
-
 
 OFFEN: 
 o Add custom pickup 'resources'. Weird template stuff -> Problems setting 'size' and other properties? setNumber of Resources. 
+--> PickupTemplateName_ in PickupSpawner ist ein string. Wird via getBaseClassIdentifier ausgelesen, daraus wird ein Pickupable fabriziert. 
+--> MunitionPickup erbt von Pickup erbt von collectiblePickup erbt von Pickupable
+----> im MineralsPickup die isPickedUp()-Methode überschreiben? 
+--> data_extern/images/effects: PNG's für die Pickups und GUI-Dinger. 
+
 o Explosion parts
 o custom HUD
 o asteroidField.lua anpassen, mit 'Mineraliendichten-Parameter'. 
+
+o Dokumentieren mit @brief?
+
+o replace ugly random stuff with math.rnd()
+o set collisionDamage? Just for static entities?
 
 HANDBUCH:
@@ -62,12 +66,15 @@
   damit die Groesse der Collision Shape korrekt initialisiert wird. 
 
-Anpassungen Pickup-Zeug: 
+FREMDANPASSUNGEN: 
+Pickup-Zeug: 
 o Pickup.h: Zugriffsänderung createSpawner
 o PickupSpawner.h: Zugriffsrechte setPickupTemplateName() und setMaxSpawnedItems()
+o PickupSpawner.h: In Tick() zwei Testbedingungen eingefuegt. 
+o Pawn.h: Attribut acceptsPickups_ inklusive get/set. 
 
 ERLEGT:
 o Rand() geht bis zu riesigen Nummern! 
-o Pickupgenerierung: vgl. Anpassungen. 
-o Dummes fisch-- statt fisch++ , Endlosschleife! 
+o Pickupgenerierung: vgl. Fremdanpassungen. 
+o Minimalbegrenzung fuer Masse vergessen. 
 o Dynamische Definition -> putStuff-Methode, Werte noch nicht durchgesickert. 
 o Error-Nachricht: Einfach Argumente leer lassen. 
@@ -79,7 +86,13 @@
 o Groessenabhaengige Collison shape: Umweg ueber zweiten Konstruktor. 
 o Absturz beim Asteroidengenerieren: Health war auf 0 gesetzt! Wurde nur bei der xml-Variante definiert. 
+o Asteroiden fressen Pickups: Argument in Pawn, Test darauf in Tick() von PickupSpawner. 
 
 NOTIZEN:
 o SUPER entspricht ueberladen, andere Argumente der Methode. 
+o Warnungsverhinderung anderswo: (void)pickedUp; // To avoid compiler warning.
+
+Was ist das?         friend class Pickupable;
+
+
 
 */
@@ -164,4 +177,6 @@
         this->health_ = 15*size;// capped at 200 in pawn or smth?
         this->maxHealth_ = this->health_;
+        this->acceptsPickups_ = false;
+
         this->setPosition(position);
         //this->roll = rand()*5; //etwas Drehung. richtige Variable
@@ -273,5 +288,5 @@
     {
 
-        orxout() << "AsteroidMinable::Death() aufgerufen." << endl;
+        // orxout() << "AsteroidMinable::Death() aufgerufen." << endl;
 
         // OFFEN: Sauber kapputten
@@ -285,23 +300,21 @@
 
 
-        // // 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");
-        // }
-        // thingy->setPickupTemplateName(tname);
-        // thingy->setPosition(this->getPosition());
-        // thingy->setMaxSpawnedItems(2); // The first somehow gets destroyed immediately. 
-        // thingy->setRespawnTime(0.5f);
+        // 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");
+        }
+        thingy->setPickupTemplateName(tname);
+        thingy->setPosition(this->getPosition());
+        thingy->setMaxSpawnedItems(1); // Would be default anyways
+        thingy->setRespawnTime(0.2f);
 
         // orxout() << "AsteroidMining::Death(): Passed Pickup stuff!" << endl;
-
 
         // Smaller Parts = 'Children'
@@ -310,22 +323,6 @@
         }
 
-
-
-
-
-
-
-
-        orxout() << "Wieder retour in death() geschafft. " << endl;
-
-        // if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_))
-        // {
-        //     // Set bAlive_ to false and wait for destroyLater() to do the destruction
-        //     this->bAlive_ = false;
-        //     this->destroyLater();
-
-        //     this->setDestroyWhenPlayerLeft(false);
-
-        // }
+        // orxout() << "Wieder retour in death() geschafft. " << endl;
+
     }
 
@@ -335,14 +332,33 @@
     if (this->size <=1){return;} // Absicherung trivialer Fall
 
-
-
     // 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 // Tweak towards bigger junks?
+    if(num > 10){num = 10;} // no max function in C!
+
     // num = 1; // zum Testen mal nur einen generieren. 
-    
+
+    // // TODO: Check this draft for edge cases etc. 
+    // // 'Triangular', discrete probability density with max at massRem/num 
+    // // Max at a, value 1, subintervals a+b = c
+    // int c = massRem-num;
+    // float probDensity = [c]
+    // int a = round(massRem/num);
+    // int b = c-a;
+    // for(int z = 0; z<=a; z++){probDensity[z] = m*z/a; } // rising part
+    // for(z = a+1; z<c; z++){probDensity[z] = m - m*(z-a)/b;} // falling part
+
+    // double rand = (double)rand() / (double)RAND_MAX; // between 0 and 1
+    // double probSum = 0;
+    // int result = 0;
+    // while(rand>probSum){
+    //     probSum = probSum+probDensity[result];
+    //     result++:
+    // }
+
+
     massRem = massRem-num;    
+
     int extra = 0;
-
 
     //orxout() << "Number of Children: " << num << endl;
@@ -404,5 +420,5 @@
 
     }
-    orxout() << "Leaving spawnChildren() method. " << endl;
+    // orxout() << "Leaving spawnChildren() method. " << endl;
 }
 
@@ -429,10 +445,10 @@
     void AsteroidMinable::hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage){
 
-        orxout() << "AsteroidMining::Hit(Variante 2) Dings aufgerufen. " << endl;
+        //orxout() << "AsteroidMining::Hit(Variante 2) Dings aufgerufen. " << endl;
         // Kollision mit anderem Asteroid oder Pickup (OFFEN: evtl. Spawner oder irgendwas?) verhindern. In diesem Fall einfach nichts tun. 
         // Wird staending aufgerufen -> Rechenleistung?
         if(orxonox_cast<AsteroidMinable*>(originator) || orxonox_cast<Pickup*>(originator)){return;}
 
-        orxout() << "Schaden. HP: " << this->health_ << " Dmg: " << damage << " hDmg: " << healthdamage << " sDmg: " << shielddamage << endl;
+        //orxout() << "Schaden. HP: " << this->health_ << " Dmg: " << damage << " hDmg: " << healthdamage << " sDmg: " << shielddamage << endl;
 
         this->damage(damage, healthdamage, shielddamage, originator, cs);
@@ -451,9 +467,4 @@
 
 
-
-
-            // Cast-Test aus movableEntity():
-            // Pawn* victim = orxonox_cast<Pawn*>(otherObject);
-            // if (victim)
 
 
Index: code/branches/AsteroidMining_HS17/src/modules/pickup/PickupSpawner.cc
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/pickup/PickupSpawner.cc	(revision 11587)
+++ code/branches/AsteroidMining_HS17/src/modules/pickup/PickupSpawner.cc	(revision 11609)
@@ -158,6 +158,9 @@
             for(Pawn* pawn : ObjectList<Pawn>())
             {
-                if(spawner == nullptr) // Stop if the PickupSpawner has been deleted (e.g. because it has run out of pickups to distribute).
+                // Stop if the PickupSpawner has been deleted (e.g. because it has run out of pickups to distribute). 2nd condition prevents a possible error in isTarget(...) below. 
+                if(spawner == nullptr || this->pickup_ == nullptr) 
                     break;
+
+                if(!(pawn->doesAcceptPickups())){continue;} // skip those pawns, e.g. AsteroidMinables. 
 
                 Vector3 distance = pawn->getWorldPosition() - this->getWorldPosition();
Index: code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/Pawn.cc	(revision 11587)
+++ code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/Pawn.cc	(revision 11609)
@@ -84,4 +84,5 @@
         // set damage multiplier to default value 1, meaning nominal damage
         this->damageMultiplier_ = 1;
+        this->acceptsPickups_ = true;
 
         this->spawnparticleduration_ = 3.0f;
Index: code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/Pawn.h	(revision 11587)
+++ code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/Pawn.h	(revision 11609)
@@ -199,4 +199,9 @@
                 { return this->damageMultiplier_; }
 
+            // Some pawns can-t harvest pickups (e.g. AsteroidMinables). Checked in PickupSpawner. 
+            inline void setPickupAcceptance(bool b)
+                { this->acceptsPickups_ = b; }
+            inline bool doesAcceptPickups()
+                { return this->acceptsPickups_;}
 
             virtual void startLocalHumanControl() override;
@@ -218,5 +223,7 @@
                 { return this->weaponSystem_; }
 
-            static void consoleCommand_debugDrawWeapons(bool bDraw);
+            static void consoleCommand_debugDrawWeapons(bool bDraw); 
+
+
 
         protected:
@@ -256,4 +263,5 @@
 
             float damageMultiplier_; ///< Used by the Damage Boost Pickup.
+            bool acceptsPickups_; // Added for the asteroidMinable class, avoid that they attempt to grab the resources
 
             WeakPtr<Pawn> lastHitOriginator_;
