Index: code/branches/AsteroidMining_HS17/data/levels/AsteroidFarming.oxw
===================================================================
--- code/branches/AsteroidMining_HS17/data/levels/AsteroidFarming.oxw	(revision 11580)
+++ code/branches/AsteroidMining_HS17/data/levels/AsteroidFarming.oxw	(revision 11581)
@@ -97,4 +97,5 @@
     <AsteroidMinable size=15 position="0,-500,0" />
     <AsteroidMinable size=5 position="100,-500,100" />
+    <AsteroidMinable size=50 position="500,-500, 500" />
 
     
Index: code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc	(revision 11580)
+++ code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc	(revision 11581)
@@ -44,12 +44,12 @@
 
 KNACKPUNKTE:
-o Collision Shape-Problem (Funktioniert nur, wenn im Konstruktor)
+o Collision Shape-Problem (Funktioniert nur, wenn im Konstruktor) -> Mit Factory-Methode oder so basteln. 
 o Maximale Hitpunkte = 200?
 
 o Neue Asteroiden generieren -> Absturz
----> Weil Elterndings zerstoert wird? 
----> Nicht moeglich, zur Laufzeit zu generieren?
-
-o Pickups: setMaxSpawned funktioniert nicht
+--> Kollidiert sofort mit irgendetwas, death() wird mehrfach aufgerufen. 
+--> Funktioniert der Test in den hit()-Methoden?
+--> Welcher Aufruf loest die death()-Methode auf?
+
 
 
@@ -72,4 +72,5 @@
 o Dynamische Definition -> putStuff-Methode, Werte noch nicht durchgesickert. 
 o Error-Nachricht: Einfach Argumente leer lassen. 
+o Pickups: setMaxSpawned funktioniert nicht -> Bastelloesung: Auf 2 statt eins setzen, erstes wird wohl direkt zerstoert. 
 */
 
@@ -123,13 +124,16 @@
         this->setCollisionType(WorldEntity::CollisionType::Dynamic);
         this->bAlive_ = true;
+
         this->bVulnerable_ = true;
+        this->enableCollisionCallback();
 
         // Default Values
-        this->generateSmaller = true;
+        this->generateSmaller = true; 
+        //this->setHealth(50);
         this->size = 10; // customSize
         this->context = context;
         this->initialised = false;
         //this->roll = rand()*5; //etwas Drehung. richtige Variable
-
+//this = new AsteroidMinable()
 
 
@@ -145,4 +149,6 @@
         // Old from Pawn
         this->registerVariables();
+
+        orxout() << "AsteroidMining:: Konstruktor passiert!" << endl;
 
     }
@@ -171,5 +177,8 @@
 
 
-        this->initialised=true;
+        this->initialised=true; 
+
+        orxout() << "AsteroidMining:: Initialisierung abgeschlosssssen." << endl;
+
     }
 
@@ -232,26 +241,34 @@
     {
 
-        // 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");
-        }
-        //orxout() << "Zeugsname:" << tname << endl;
-        thingy->setPickupTemplateName(tname);
-        thingy->setPosition(this->getPosition());
-        //thingy->setMaxSpawnedItems(1); // Somehow doesn-t work yet. 
-        thingy->setRespawnTime(0.1f);// instantly
-        
-        orxout() << "AsteroidMining::Death(): Passed Pickup stuff!" << endl;
-
-
-
+        orxout() << "AsteroidMinable::Death() aufgerufen." << endl;
+
+        // OFFEN: Sauber kapputten
+        // just copied other stuff:
+        // this->setHealth(1);
+        this->bAlive_ = false;
+        this->destroyLater();
+        this->setDestroyWhenPlayerLeft(false);
+        // pawn -> addExplosionPart
+        // this->goWithStyle();
+
+
+        // // 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);
+
+        // orxout() << "AsteroidMining::Death(): Passed Pickup stuff!" << endl;
 
 
@@ -265,14 +282,7 @@
 
 
-        // OFFEN: Sauber kapputten
-        // just copied other stuff:
-        this->setHealth(1);
-        this->bAlive_ = false;
-        this->destroyLater();
-        this->setDestroyWhenPlayerLeft(false);
-
-
-        // pawn -> addExplosionPart
-        // this->goWithStyle();
+
+
+
         orxout() << "Wieder retour in death() geschafft. " << endl;
 
@@ -291,4 +301,8 @@
 void AsteroidMinable::spawnChildren(){
     
+    if (this->size <=1){return;} // Absicherung trivialer Fall
+
+
+
     // Spawn smaller Children 
     int massRem = this->size-1; //some mass is lost
@@ -300,9 +314,12 @@
 
 
-    orxout() << "Number of Children: " << num << endl;
-
-
-    for(int fisch=num; fisch>=1; fisch--){
+    //orxout() << "Number of Children: " << num << endl;
+
+
+    for(int fisch=num; fisch>=1; --fisch){
         // to distribute remaining mass
+
+        //orxout() << "AsteroidMining::spawnChildren(): Fisch-Variable: " << fisch << endl;
+
         if(fisch==1){ 
             extra = massRem;
@@ -313,7 +330,7 @@
         }
 
-        orxout() << "Mass chosen: " << extra+1 << endl;
-
-        orxout() << "AsteroidMining::spawnChildren(): Inside for-loop." << endl;
+        //orxout() << "Mass chosen: " << extra+1 << endl;
+
+        //orxout() << "AsteroidMining::spawnChildren(): Inside for-loop." << endl;
 
         //Spawn this child  Game crashes!
@@ -323,9 +340,9 @@
         // Position zu spaet gesetzt? Tick nicht atomar -> falsche Groesse evtl?
 
-            if(child == nullptr){
-                orxout(internal_error, context::pickups) << "Weird, can't create new AsteroidMinable." << endl;
-            }
-
-            child->setSize(extra + 1);
+        if(child == nullptr){
+            orxout(internal_error, context::pickups) << "Weird, can't create new AsteroidMinable." << endl;
+        }
+
+        child->setSize(extra + 1);
                 
             //OFFEN:Kollision der Kinder verhindern
@@ -333,8 +350,8 @@
             //Typ position:rand()*Vektoriwas?
             //pawn->getWorldPosition() + Vector3(30,0,-30);
-            child->setPosition(this->getPosition() + Vector3(num*5, 0, 0));
-
-
-        orxout() << "Done: Creating new Asteroid" << endl;
+        child->setPosition(this->getPosition() + Vector3(num*5, 0, 0));
+        //child->setPosition(Vector3(0,0,0));
+
+        //orxout() << "Done: Creating new Asteroid" << endl;
 
         // }
@@ -355,4 +372,120 @@
 
 
+    void AsteroidMinable::hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage){
+
+        orxout() << "AsteroidMining::Hit(Variante 1) 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;}
+        this->damage(damage, healthdamage, shielddamage, originator, cs);
+        this->setVelocity(this->getVelocity() + force);
+
+
+
+        // if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator))// && (!this->getController() || !this->getController()->getGodMode()) )
+        // {
+        //     this->damage(damage, healthdamage, shielddamage, originator, cs);
+        //     this->setVelocity(this->getVelocity() + force);
+        // }
+    }
+
+    void AsteroidMinable::hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage){
+
+        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;}
+
+
+
+        this->damage(damage, healthdamage, shielddamage, originator, cs);
+
+
+
+
+        // if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator))// && (!this->getController() || !this->getController()->getGodMode()) )
+        // {
+        //     this->damage(damage, healthdamage, shielddamage, originator, cs);
+
+        //     //if ( this->getController() )
+        //     //    this->getController()->hit(originator, contactpoint, damage); // changed to damage, why shielddamage?
+        // }
+    }
+
+
+
+
+            // Cast-Test aus movableEntity():
+            // Pawn* victim = orxonox_cast<Pawn*>(otherObject);
+            // if (victim)
+
+
+
+
+//Pawn:
+    // void Pawn::hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage)
+    // {
+    //     if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
+    //     {
+    //         this->damage(damage, healthdamage, shielddamage, originator, cs);
+    //         this->setVelocity(this->getVelocity() + force);
+    //     }
+    // }
+
+    // void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage)
+    // {
+    //     if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
+    //     {
+    //         this->damage(damage, healthdamage, shielddamage, originator, cs);
+
+    //         if ( this->getController() )
+    //             this->getController()->hit(originator, contactpoint, damage); // changed to damage, why shielddamage?
+    //     }
+    // }
+
+
+
+
+            // /**
+            // @brief
+            //     Virtual function that gets called when this object collides with another.
+            // @param otherObject
+            //     The object this one has collided into.
+            // @param ownCollisionShape
+            //     The collision shape of the other object
+            // @param contactPoint
+            //     Contact point provided by Bullet. Holds more information and can me modified. See return value.
+            // @return
+            //     Returning false means that no modification to the contactPoint has been made. Return true otherwise!
+            // @note
+            //     Condition is that enableCollisionCallback() was called.
+            // */
+            // virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
+            //     { return false; } /* With false, Bullet assumes no modification to the collision objects. */
+
+            // //! Enables the collidesAgainst(.) function. The object doesn't respond to collision otherwise!
+            // inline void enableCollisionCallback()
+            //     { this->bCollisionCallbackActive_ = true; this->collisionCallbackActivityChanged(); }
+
+
+
+            // //! Disables the collidesAgainst(.) function. @see enableCollisionCallback()
+            // inline void disableCollisionCallback()
+            //     { this->bCollisionCallbackActive_ = false; this->collisionCallbackActivityChanged(); }
+
+
+            // //! Tells whether there could be a collision callback via collidesAgainst(.)
+            // inline bool isCollisionCallbackActive() const
+            //     { return this->bCollisionCallbackActive_; }
+
+            // //! Enables or disables collision response (default is of course on)
+            // inline void setCollisionResponse(bool value)
+            //     { this->bCollisionResponseActive_ = value; this->collisionResponseActivityChanged(); }
+
+
+            // //! Tells whether there could be a collision response
+            // inline bool hasCollisionResponse()
+            //     { return this->bCollisionResponseActive_; }
 
 
Index: code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.h
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.h	(revision 11580)
+++ code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.h	(revision 11581)
@@ -56,6 +56,15 @@
             virtual void tick(float dt) override;
 
+            // Overwrite to prevet 'self-collision' of generated stuff
+            virtual void hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
+            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
+
+
+
             virtual void setSize(float f);
             virtual float getSize();
+
+
+
 
 
