Index: code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc	(revision 11618)
+++ code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc	(revision 11640)
@@ -43,20 +43,8 @@
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
-FRAGEN:
-* Zeilen-Loeschung beim output
-* orxout()-Problem
-* dokumentieren mit @brief? 
-* Warnumg aus Asteroidenzerstoerung
-
 
 KNACKPUNKTE: 
 
-
 OFFEN: 
-
-o Mass distribution -> weird for bigger asteroids
---> more testing
-
-o SpicedAsteroidField fertigstellen, Mineraldichten-Parameter
 
 o Add custom pickup 'resources'. Weird template stuff -> Problems setting 'size' and other properties? setNumber of Resources. 
@@ -65,11 +53,17 @@
 ----> im MineralsPickup die isPickedUp()-Methode überschreiben? 
 --> data_extern/images/effects: PNG's für die Pickups und GUI-Dinger. 
-
-o inherit parent velocity
+--> https://www.orxonox.net/jenkins/view/Management/job/orxonox_doxygen_trunk/javadoc/group___pickup.html
+
+o Anfangsgeschwindigkeit fuers Asteroidenfeld
+o Density doesn't add up to 1...
 o set collisionDamage? Just for static entities?
+o AsteroidBelt?
+
 o Dokumentieren mit @brief?
-
+o unregister -empty- asteroids from radar. (or turn them green or whatever)
+o Add sound effect (crunching etc. ) (No sound in space...)
 o Explosion parts
 o custom HUD
+
 
 HANDBUCH:
@@ -85,5 +79,5 @@
 o Pawn.h: Attribut acceptsPickups_ inklusive get/set. 
 
-ERLEGT:
+ERLEGTE FEHLER:
 o Rand() geht bis zu riesigen Nummern! 
 o Pickupgenerierung: vgl. Fremdanpassungen. 
@@ -158,13 +152,12 @@
     RegisterClass(AsteroidMinable);
 
-
-    // This constructor is for XML access only.
+    // @brief Standard constructor
     AsteroidMinable::AsteroidMinable(Context* context) : Pawn(context){
 
-        // Da auch noetig? Wegen set in XML-Code?
         RegisterObject(AsteroidMinable);
 
         this->context = context;
         this->initialised = false;
+        this->dropStuff = true; // Default
 
         //Noetig, damit nicht sofort zerstoert?
@@ -178,25 +171,31 @@
     }
 
-    // Call this one from other C-files. Takes arguments. 
-    AsteroidMinable::AsteroidMinable(Context* c, float size, Vector3 position) : Pawn(c){
+    // @brief Use this constructor with care. Mainly used internally, arguments are passed directly. 
+    AsteroidMinable::AsteroidMinable(Context* c, float size, Vector3 position, Vector3 v, bool dropStuff) : Pawn(c){
 
         RegisterObject(AsteroidMinable);
 
-        // Old stuff from pawn
-        this->setRadarObjectColour(ColourValue(1.0f, 1.0f, 0.0f, 1.0f));
-        this->setRadarObjectShape(RadarViewable::Shape::Dot);
+        // The radar is able to detect whether an asteroid contains resources....
+        if(dropStuff){
+            this->setRadarObjectColour(ColourValue(1.0f, 1.0f, 0.0f, 1.0f));
+            this->setRadarObjectShape(RadarViewable::Shape::Dot);
+        }else{
+            // Somehow remove from radar?
+        }
+
         this->setCollisionType(WorldEntity::CollisionType::Dynamic);
-
         this->enableCollisionCallback();
 
         // Default Values
-        this->generateSmaller = true; 
         this->context = c;
         this->size = size;
         this->health_ = 15*size; 
         this->maxHealth_ = this->health_;
-        this->acceptsPickups_ = false;
+        this->acceptsPickups_ = false; 
+        this->generateSmaller = true; 
+        this->dropStuff = dropStuff; 
 
         this->setPosition(position);
+        this->setVelocity(v); // velocity = v; // The right one? 
         //this->roll = rand()*5; //etwas Drehung. richtige Variable
 
@@ -228,11 +227,13 @@
 
     }
-
+    // @brief Helper method. Create a new asteroid to have an appropriate size for the collision shape etc. 
     void AsteroidMinable::putStuff(){
 
         // Just create a new asteroid to avoid Collision shape scale problems etc. 
-        AsteroidMinable* reborn = new AsteroidMinable(this->context, this->size, this->getPosition());
+        AsteroidMinable* reborn = new AsteroidMinable(this->context, this->size, this->getPosition(), this->getVelocity(), this->dropStuff);
         reborn->toggleShattering(true); // mainly here to avoid 'unused' warning. 
-        this->~AsteroidMinable(); // seems dangerous, yields warning.  Necessary for efficiency? 
+        this->bAlive_ = false;
+        this->destroyLater();
+        //this->~AsteroidMinable(); // seems dangerous, yields warning.  Necessary for efficiency? 
 
     }
@@ -276,15 +277,5 @@
     }
 
-    void AsteroidMinable::setSize(float s){
-        this->size = s;
-    }
-
-    float AsteroidMinable::getSize(){
-        return this->size;
-    }
-
-    void AsteroidMinable::toggleShattering(bool b){
-        this->generateSmaller = b;
-    }
+
 
 
@@ -304,20 +295,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(1); // Would be default anyways
-        thingy->setRespawnTime(0.2f);
-
+        // Pickups which can be harvested. 
+        if(dropStuff){
+            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;
 
@@ -339,5 +331,5 @@
     if(num > 10){num = 10;} // no max function in C!
     int masses[num]; // Masses of the asteroids, at least one. 
-    orxout() << "SpawnChildren(): Passed basic stuff. num = " << num << "; massRem(total) = "<< massRem << endl;
+    //orxout() << "SpawnChildren(): Passed basic stuff. num = " << num << "; massRem(total) = "<< massRem << endl;
 
     massRem = massRem-num; // mass is at least one, add again below. 
@@ -346,5 +338,5 @@
     float phi[num] = {0.0}; // assuming that it gets initialised to 0. Add (= {0.0})?
     float theta[num] = {0.0};
-    float piG = pi; // ist statisch oder so. 
+    float piG = 3.1415927410125732421875; //pi; // Math.pi ist statisch oder so. 
 
     float d_p = 2*piG/num;
@@ -380,7 +372,7 @@
     //orxout() << "SpawnChildren(): Phi: "; printArrayString(phi);
     //orxout() << "SpawnChildren(): Theta: "; printArrayString(theta);
-    orxout() << "SpawnChildren(): Passed angle stuff. " << endl;
-
-    // 'Triangular', discrete probability density with max at the expected value massRem/num at a. a+b = c
+    //orxout() << "SpawnChildren(): Passed angle stuff. " << endl;
+
+    // 'Triangular', discrete probability "density" with max at the expected value massRem/num at a. a+b = c
     if(massRem>0){ // Required to avoid array of size 0 or access problems
         int c = massRem;
@@ -397,8 +389,11 @@
         for(z = 0; z<b; ++z){probDensity[c-z] = (z+1)*dProbB;} // falling part
     
-        // Testing
-        for(int globi = 0; globi<c; ++globi){
-            orxout() << "pDensity at [" << globi << "] is: " << probDensity[globi] << endl;
-        }
+        // // Just for testing:
+        // float sum = 0.0;
+        // for(int globi = 0; globi<c; ++globi){
+        //     orxout() << "pDensity at [" << globi << "] is: " << probDensity[globi] << endl;
+        //     sum = sum+ probDensity[globi];
+        // }
+        // orxout() << "Sum of densities should b 1, it is: " << sum << endl;
 
         // Distributing the mass to individual asteroids
@@ -409,17 +404,17 @@
             result = 0;// reset
             rVal = rnd();// between 0 and 1
-            orxout() << "Random Value picked: " << rVal << endl;
+            // orxout() << "Random Value picked: " << rVal << endl;
             probSum = probDensity[0]; 
             //orxout() << "Sum at start: " << probSum << endl;
 
             while(rVal>probSum && result<massRem){// Not yet found && there-s smth to distribute (Incrementing once inside!)
-                if(result<(num-2)){probSum = probSum+probDensity[result+1];} // avoid logical/acess error
+                if(result<(massRem-2)){probSum = probSum + probDensity[result+1];} // avoid logical/acess error
                 ++result;
-                //orxout() << "Sum so far: " << probSum << endl;
+                // orxout() << "Sum so far: " << probSum << ". Just added " << probDensity[result+1] <<  endl;
             }
 
             massRem = massRem-result;
             masses[trav] = 1 +result; // at least one 
-            orxout() << "Mass chosen for child " << trav << " is: " << masses[trav] << endl;
+            // orxout() << "Mass chosen for child " << trav << " is: " << masses[trav] << endl;
 
         }
@@ -430,6 +425,6 @@
     }
 
-    //orxout() << "SpawnChildren(): Masses: "; printArrayString(masses);
-    orxout() << "SpawnChildren(): Passed mass stuff. " << endl;
+    // orxout() << "SpawnChildren(): Masses: "; printArrayString(masses);
+    // orxout() << "SpawnChildren(): Passed mass stuff. " << endl;
 
     // Creating the 'chlidren':
@@ -442,6 +437,6 @@
         }
         
-        //orxout() << "Creating asteroid with mass " << masses[fisch] << " at relative postition " << *pos << endl;
-        AsteroidMinable* child = new AsteroidMinable(this->context, masses[fisch], this->getPosition() + *pos);
+        // orxout() << "Creating asteroid with mass " << masses[fisch] << " at relative postition " << *pos << endl;
+        AsteroidMinable* child = new AsteroidMinable(this->context, masses[fisch], this->getPosition() + *pos, this->getVelocity(), this->dropStuff);
 
         if(child == nullptr){
@@ -450,5 +445,5 @@
 
     }
-    orxout() << "Leaving spawnChildren() method. " << endl;
+    // orxout() << "Leaving spawnChildren() method. " << endl;
 }
 
@@ -458,5 +453,5 @@
         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. 
+        // Kollision mit anderem Asteroid oder Pickup verhindern. In diesem Fall einfach nichts tun. 
         // Wird staending aufgerufen -> Rechenleistung?
         if(orxonox_cast<AsteroidMinable*>(originator) || orxonox_cast<Pickup*>(originator)){return;}
@@ -496,4 +491,5 @@
     }
 
+    // @brief Just for testing. Don-t work anyways. 
     void AsteroidMinable::printArrayString(float thingy[]){ // Don-t work!
 
@@ -509,4 +505,5 @@
     }
 
+    // @brief Just for testing. Don-t work anyways. 
     void AsteroidMinable::printArrayString(int thingy[]){
 
@@ -524,7 +521,5 @@
     }
 
-
     // void AsteroidMinable::printArrayString(int thingy[]){
-
     //     char res[] = "[";
     //     //strcat(res, "[");
@@ -547,116 +542,3 @@
     // }
 
-
-
-//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_; }
-
-
 }
-
-
-
-
-
-/*
-    void DronePickup::changedUsed(void)
-    {
-        SUPER(DronePickup, changedUsed);
-
-        // If the pickup has transited to used.
-        if(this->isUsed())
-        {
-
-                Pawn* pawn = this->carrierToPawnHelper();
-                if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
-                    this->Pickupable::destroy();
-
-                //Attach to pawn
-                Drone* drone = new Drone(pawn->getContext()); // this is neccessary because the projectiles fired need a valid creator for the particlespawner (when colliding against something)
-                drone->addTemplate(this->getDroneTemplate());
-
-                Controller* controller = drone->getController();
-                DroneController* droneController = orxonox_cast<DroneController*>(controller);
-                if(droneController != nullptr)
-                {
-                    droneController->setOwner(pawn);
-                }
-
-                Vector3 spawnPosition = pawn->getWorldPosition() + Vector3(30,0,-30);
-                drone->setPosition(spawnPosition);
-
-                // The pickup has been used up.
-                this->setUsed(false);
-        }
-        else
-        {
-            // If either the pickup can only be used once or it is continuous and used up, it is destroyed upon setting it to unused.
-            if(this->isOnce() || (this->isContinuous() ))
-            {
-                this->Pickupable::destroy();
-            }
-        }
-    }
-*/
Index: code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.h
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.h	(revision 11618)
+++ code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.h	(revision 11640)
@@ -41,15 +41,13 @@
 #include "../../orxonox/worldentities/pawns/Pawn.h"
 
-namespace orxonox // tolua_export
+namespace orxonox
 {
 
 
-    // tolua_export
-    class _OrxonoxExport AsteroidMinable : public Pawn
-    { // tolua_export
+    class _OrxonoxExport AsteroidMinable : public Pawn{ 
 
         public:
             AsteroidMinable(Context* context);// This constructor is for XML access only!
-            AsteroidMinable(Context* c, float size, Vector3 position);// Call this Constructor from other C-files.
+            AsteroidMinable(Context* c, float size, Vector3 position, Vector3 velocity, bool dS);// Call this Constructor from other C-files.
 
             virtual ~AsteroidMinable();
@@ -62,27 +60,21 @@
             virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
 
+            inline void setSize(int s){this->size = s;}
+            inline int getSize(){return this->size;}
 
-
-            virtual void setSize(float f);
-            virtual float getSize();
-
-            virtual void toggleShattering(bool b);
-
-
-
+            inline void toggleShattering(bool b){this->generateSmaller = b;}
+            inline void toggleDropStuff(bool b){this->dropStuff = b;}
 
 
         protected:
-            // Da neue Argumente reinstellen
-            //float asteroidVersion; // Bodenstrich-Konvention?, 
-            // Wert zwischen 1 und 6 (Spezialdinger?), die Mesh-Form
-            float size;
-            bool generateSmaller;
-            bool initialised;
 
             Context* context;
 
+            int size;
+            bool generateSmaller;
+            bool dropStuff;
+            bool initialised;
+
             virtual void death(); 
-            virtual void putStuff();
 
 
@@ -91,6 +83,9 @@
             void registerVariables();
             virtual void spawnChildren();
+            virtual void putStuff();
 
-            void printArrayString(float thingy[]);// Just for testing
+            // @brief Just for testing. Don-t work anyways. 
+            void printArrayString(float thingy[]);
+            // @brief Just for testing. Don-t work anyways. 
             void printArrayString(int thingy[]);// Just for testing
 
Index: code/branches/AsteroidMining_HS17/src/modules/asteroidmining/CMakeLists.txt
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/asteroidmining/CMakeLists.txt	(revision 11618)
+++ code/branches/AsteroidMining_HS17/src/modules/asteroidmining/CMakeLists.txt	(revision 11640)
@@ -1,4 +1,5 @@
 SET_SOURCE_FILES(PICKUP_SRC_FILES
   AsteroidMinable.cc
+  SpicedAsteroidField.cc
 )
 
Index: code/branches/AsteroidMining_HS17/src/modules/asteroidmining/SpicedAsteroidField.cc
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/asteroidmining/SpicedAsteroidField.cc	(revision 11618)
+++ code/branches/AsteroidMining_HS17/src/modules/asteroidmining/SpicedAsteroidField.cc	(revision 11640)
@@ -31,7 +31,14 @@
 *
 *
-*<OFFEN Describe
+*<OFFEN Describe 
+Math from asteroidField.lua used. 
 *
 *
+
+
+DESCRIPTION
+o Andere: Simpel wie in asteroidField.lua, oder einfach Asteroiden, die nichts abwerfen?
+--> Letzteres scheint passender, simpler. 
+
 
 */
@@ -77,5 +84,5 @@
     RegisterClass(SpicedAsteroidField);
 
-    SpicedAsteroidField::SpicedAsteroidField(Context* context) {
+    SpicedAsteroidField::SpicedAsteroidField(Context* context) : Pawn(context) {
 
         // Da auch noetig? Wegen set in XML-Code?
@@ -83,14 +90,14 @@
 
         this->context = context;
-        this->initialised = false;
-
-        //Noetig, damit nicht sofort zerstoert?
-        this->setCollisionType(WorldEntity::CollisionType::Dynamic);
+        this->foggy = true; 
+        this->fogDensity = 0.5;
 
         // Old from Pawn
         this->registerVariables();
 
-        orxout() << "AsteroidMining:: Pseudo-Konstruktor passiert!" << endl;
-
+
+        // this->create();
+        this->bAlive_ = false;
+        this->destroyLater();
     }
 
@@ -101,12 +108,57 @@
     void SpicedAsteroidField::create(){
 
-
-
-
+        int size;
+        int pX;
+        int pY;
+        int pZ;
+
+        Vector3* relPos; 
+
+        for(int gertrud = 0; gertrud<count; ++gertrud){
+
+            AsteroidMinable* a = new AsteroidMinable(this->context);
+
+            size = round(rnd()*(this->maxSize - this->minSize)) + this->minSize;
+            a->setSize(size);
+
+            pX = round(rnd()*2*this->radius) - radius;
+            pY = round(rnd()*2*this->radius) - radius;
+            pZ = round(rnd()*2*this->radius) - radius;
+            relPos = new Vector3(pX, pY, pZ);
+            a->setPosition(this->position + *relPos);
+
+            bool spiced = (rnd() < (this->mDensity)); // does drop pickups etc. 
+            a->toggleDropStuff(spiced);
+
+            // @TODO: Fox Fog stuff, error due to billbord
+
+//             Billboard* bb;
+//             if(this->foggy && mod(gertrud, 5) == 0){
+//                 bb = new Billboard(this->context);
+//                 bb->setPosition(this-position + *relPos);
+//                 bb->setMaterial("Smoke/Smoke");
+//                 bb->setScale(size); // tricky?
+
+//                 bb->setColour(ColourValue(this-fogDensity, this->fogDensity, this->fogDensity)); // 4rd argument = transparency?
+                
+// //     print("<Billboard ")
+// //         print("position = \"")
+// //             print(posX) print(",")
+// //             print(posY) print(",")
+// //             print(posZ) print("\" ")
+// //         print("colour=\"")
+// //             print(brightness) print(",")
+// //             print(brightness) print(",")
+// //             print(brightness) print("\" ")
+// //         print("material=\"Smoke/Smoke\" scale=")
+// //         print(size)
+// //     print(" />")
+//             }
+        }
     }
 
     void SpicedAsteroidField::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
-        SUPER(SpicedAsteroidField, XMLPort, xmlelement, mode);
+        // SUPER(SpicedAsteroidField, XMLPort, xmlelement, mode);
         //        XMLPortParam(PickupSpawner, "pickup", setPickupTemplateName, getPickupTemplateName, xmlelement, mode);
         XMLPortParam(SpicedAsteroidField, "count", setCount, getCount, xmlelement, mode);
@@ -117,5 +169,5 @@
         XMLPortParam(SpicedAsteroidField, "radius", setRadius, getRadius, xmlelement, mode);
         XMLPortParam(SpicedAsteroidField, "foggy", setFog, isFoggy, xmlelement, mode);
-
+        XMLPortParam(SpicedAsteroidField, "fogDensity", setFogDensity, getFogDensity, xmlelement, mode);
 
     }
@@ -126,5 +178,5 @@
     void SpicedAsteroidField::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
     {
-        SUPER(SpicedAsteroidField, XMLEventPort, xmlelement, mode);
+        // SUPER(SpicedAsteroidField, XMLEventPort, xmlelement, mode);
 
         XMLPortEventState(SpicedAsteroidField, BaseObject, "vulnerability", setVulnerable, xmlelement, mode);
@@ -133,30 +185,22 @@
     void SpicedAsteroidField::registerVariables()
     {
-        // registerVariable(this->bAlive_,            VariableDirection::ToClient);
-        // registerVariable(this->bVulnerable_,       VariableDirection::ToClient);
-        // registerVariable(this->health_,            VariableDirection::ToClient);
-        // registerVariable(this->maxHealth_,         VariableDirection::ToClient);
-
-        registerVariable(this->size, VariableDirection::ToClient);
-        registerVariable(this->generateSmaller, VariableDirection::ToClient);
-
-        registerVariable(this->initialised, VariableDirection::ToClient);
-        //registerVariable(this->context, VariableDirection::ToClient); // can't link that since it's a context
-
-
-            //         float size;
-            // bool generateSmaller;
-            // bool initialised;
-
-            // Context* context;
-    }
-
-    void SpicedAsteroidField::tick(float dt)
-    {
+
+        registerVariable(this->count, VariableDirection::ToClient);
+        registerVariable(this->mDensity, VariableDirection::ToClient);
+        registerVariable(this->position, VariableDirection::ToClient);
+        registerVariable(this->maxSize, VariableDirection::ToClient);
+        registerVariable(this->minSize, VariableDirection::ToClient);
+        registerVariable(this->radius, VariableDirection::ToClient);
+        registerVariable(this->foggy, VariableDirection::ToClient);
+        registerVariable(this->fogDensity, VariableDirection::ToClient);
+
+
+    }
+
+    void SpicedAsteroidField::tick(float dt){
 
         this->create();
-        this->~SpicedAsteroidField(); // seems dangerous. Necessary for efficiency? 
-
-
+        this->bAlive_ = false;
+        this->destroyLater();
     }
 
@@ -166,2 +210,104 @@
 
 }
+
+// --[[ fog generator
+// generates fog
+//     posX, posY, posZ - position in space
+//     size - size of billboard
+//     brightness - [0,1] fog brightness
+// --]]
+// function generateFog(posX, posY, posZ, size, brightness)
+//     print("<Billboard ")
+//         print("position = \"")
+//             print(posX) print(",")
+//             print(posY) print(",")
+//             print(posZ) print("\" ")
+//         print("colour=\"")
+//             print(brightness) print(",")
+//             print(brightness) print(",")
+//             print(brightness) print("\" ")
+//         print("material=\"Smoke/Smoke\" scale=")
+//         print(size)
+//     print(" />")
+// end
+
+// --[[ asteroid field generator
+// generates asteroid field
+//     posX, posY, posZ - position in space
+//     minSize, maxSize - size boundaries of each asteroid
+//     radius - size of the cube around position in space
+//     count - number of asteroids
+//     fog - enable fog 0/1
+// --]]
+// function asteroidField(posX, posY, posZ, minSize, maxSize, radius, count, fog)
+//     for i = 1, count, 1 do
+//         size = (math.random() * (maxSize - minSize)) + minSize
+//         pX = (2 * math.random() * radius) - radius + posX
+//         pY = (2 * math.random() * radius) - radius + posY
+//         pZ = (2 * math.random() * radius) - radius + posZ
+//         print("<StaticEntity ")
+
+//         print("position = \"")
+//         print(pX) print(",")
+//         print(pY) print(",")
+//         print(pZ) print("\" ")
+
+//         print("scale = \"") print(size) print("\" ")
+
+//         print("collisionType = static linearDamping = 0.8 angularDamping = 1 ")
+//         print("collisiondamage = 1000 enablecollisiondamage = true>")
+
+//         print("<attached>")
+//             print("<Model mass=\"") print(size * 10) print("\" ")
+//             print("mesh=\"ast") print(math.mod(i,6) + 1) print(".mesh\" />")
+//         print("</attached>")
+
+//         print("<collisionShapes> ")
+//             print("<SphereCollisionShape radius=\"")
+//             print(size * 2.5) print("\" />")
+//         print("</collisionShapes>")
+
+//         print("</StaticEntity>")
+
+//         if fog == 1 and i % 5 == 0 then
+//             generateFog(pX, pY, pZ, radius*0.04, 0.2)
+//         end
+//     end
+// end
+
+
+// --[[ asteroid belt generator
+// generates asteroid belt
+//     posX, posY, posZ - position in space
+//     yaw, pitch - rotation
+//     minSize, maxSize - size boundaries of each asteroid
+//     radius0, radius1 - inner/outer radius
+//     count - number of asteroids
+//     fog - enable fog 0/1
+// --]]
+// function asteroidBelt(centerX, centerY, centerZ, yaw, pitch, segments, minSize, maxSize, radius0, radius1, count, fog)
+//     dPhi = (2 * math.pi) / segments
+//     width = math.abs(radius1 - radius0)
+//     radius = (radius1 + radius0) / 2
+//     segmentCount = count / segments
+
+//     print("<StaticEntity collisionType=static yaw=") print(yaw)
+//     print(" pitch=") print(pitch)
+
+//     print(" position = \"")
+//         print(centerX) print(",")
+//         print(centerY) print(",")
+//         print(centerZ) print("\"")
+//     print(">")
+
+//     print("<attached>")
+
+//     for i = 0, segments - 1, 1 do
+//         asteroidField((radius * math.cos(i * dPhi)),
+//                     (radius * math.sin(i * dPhi)),
+//                     0, minSize, maxSize, width, segmentCount, fog)
+//     end
+
+//     print("</attached>")
+//     print("</StaticEntity>")
+// end
Index: code/branches/AsteroidMining_HS17/src/modules/asteroidmining/SpicedAsteroidField.h
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/asteroidmining/SpicedAsteroidField.h	(revision 11618)
+++ code/branches/AsteroidMining_HS17/src/modules/asteroidmining/SpicedAsteroidField.h	(revision 11640)
@@ -46,5 +46,5 @@
 
     // tolua_export
-    class _OrxonoxExport SpicedAsteroidField
+    class _OrxonoxExport SpicedAsteroidField : public Pawn // need pawn to get tick for clean argument passing
     { // tolua_export
 
@@ -65,5 +65,5 @@
 
             inline void setPosition(Vector3 v){this->position = v;}
-            inline Vector3 getPosition(){returrn this->position;}
+            inline Vector3 getPosition(){return this->position;}
 
             inline void setMaxSize(int i){this->maxSize = i;}
@@ -79,4 +79,7 @@
             inline bool isFoggy(){return this->foggy;}
 
+            inline void setFogDensity(float fd){this->fogDensity = fd;}
+            inline float getFogDensity(){return this->fogDensity;}
+
         protected:
             // Da neue Argumente reinstellen
@@ -87,6 +90,6 @@
 
             Vector3 position;
-            bool initialised;
             Context* context;
+            
             int maxSize;
             int minSize;
@@ -94,4 +97,5 @@
             float radius; 
             bool foggy;
+            float fogDensity; 
 
             virtual void create();
