Index: code/branches/objecthierarchy/src/core/BaseObject.cc
===================================================================
--- code/branches/objecthierarchy/src/core/BaseObject.cc	(revision 2064)
+++ code/branches/objecthierarchy/src/core/BaseObject.cc	(revision 2065)
@@ -35,4 +35,5 @@
 #include "tinyxml/tinyxml.h"
 #include "CoreIncludes.h"
+#include "EventIncludes.h"
 #include "XMLPort.h"
 #include "XMLFile.h"
@@ -79,4 +80,6 @@
     BaseObject::~BaseObject()
     {
+        for (std::list<BaseObject*>::const_iterator it = this->events_.begin(); it != this->events_.end(); ++it)
+            (*it)->eventListeners_.erase(this);
     }
 
@@ -184,5 +187,6 @@
     void BaseObject::addEvent(BaseObject* event, const std::string& sectionname)
     {
-        this->eventListeners_.insert(std::pair<std::string, BaseObject*>(sectionname, event));
+        event->eventListeners_[this] = sectionname;
+        this->events_.push_back(event);
     }
 
@@ -190,8 +194,8 @@
     {
         unsigned int i = 0;
-        for (std::set<std::pair<std::string, BaseObject*> >::const_iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
+        for (std::list<BaseObject*>::const_iterator it = this->events_.begin(); it != this->events_.end(); ++it)
         {
             if (i == index)
-                return (*it).second;
+                return (*it);
             ++i;
         }
@@ -230,8 +234,8 @@
         Event event(activate, this);
 
-        for (std::set<std::pair<std::string, BaseObject*> >::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
-        {
-            event.sectionname_ = (*it).first;
-            (*it).second->processEvent(event);
+        for (std::map<BaseObject*, std::string>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
+        {
+            event.sectionname_ = it->second;
+            it->first->processEvent(event);
         }
     }
Index: code/branches/objecthierarchy/src/core/BaseObject.h
===================================================================
--- code/branches/objecthierarchy/src/core/BaseObject.h	(revision 2064)
+++ code/branches/objecthierarchy/src/core/BaseObject.h	(revision 2065)
@@ -36,4 +36,6 @@
 #ifndef _BaseObject_H__
 #define _BaseObject_H__
+
+#include <map>
 
 #include "CorePrereqs.h"
@@ -145,5 +147,6 @@
             Gametype*             oldGametype_;
             std::set<Template*>   templates_;
-            std::set<std::pair<std::string, BaseObject*> > eventListeners_;
+            std::map<BaseObject*, std::string> eventListeners_;
+            std::list<BaseObject*> events_;
             std::map<std::string, EventContainer*> eventContainers_;
     };
Index: code/branches/objecthierarchy/src/core/Event.cc
===================================================================
--- code/branches/objecthierarchy/src/core/Event.cc	(revision 2064)
+++ code/branches/objecthierarchy/src/core/Event.cc	(revision 2065)
@@ -29,7 +29,13 @@
 #include "Event.h"
 #include "BaseObject.h"
+#include "Executor.h"
 
 namespace orxonox
 {
+    EventContainer::~EventContainer()
+    {
+        delete this->eventfunction_;
+    }
+
     void EventContainer::process(BaseObject* object, const Event& event)
     {
Index: code/branches/objecthierarchy/src/core/Event.h
===================================================================
--- code/branches/objecthierarchy/src/core/Event.h	(revision 2064)
+++ code/branches/objecthierarchy/src/core/Event.h	(revision 2065)
@@ -31,28 +31,4 @@
 
 #include "CorePrereqs.h"
-#include "Executor.h"
-
-#define SetEvent(classname, eventname, functionname, event) \
-    SetEventGeneric(eventcontainer##classname##functionname, classname, eventname, orxonox::createExecutor(orxonox::createFunctor(&classname::functionname), std::string( #classname ) + "::" + #functionname), event, BaseObject)
-
-#define SetEventTemplate(classname, eventname, functionname, event, ...) \
-    SetEventGeneric(eventcontainer##classname##functionname, classname, eventname, orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::functionname), std::string( #classname ) + "::" + #functionname), event, BaseObject)
-
-#define SetSubclassEvent(classname, eventname, functionname, event, subclassname) \
-    SetEventGeneric(eventcontainer##classname##functionname, classname, eventname, orxonox::createExecutor(orxonox::createFunctor(&classname::functionname), std::string( #classname ) + "::" + #functionname), event, subclassname)
-
-#define SetSubclassEventTemplate(classname, eventname, functionname, event, subclassname, ...) \
-    SetEventGeneric(eventcontainer##classname##functionname, classname, eventname, orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::functionname), std::string( #classname ) + "::" + #functionname), event, subclassname)
-
-#define SetEventGeneric(containername, classname, eventname, executor, event, subclassname) \
-    orxonox::EventContainer* containername = this->getEventContainer(eventname); \
-    if (!containername) \
-    { \
-        containername = new orxonox::EventContainer(std::string(eventname), executor, orxonox::ClassIdentifier<subclassname>::getIdentifier()); \
-        this->addEventContainer(eventname, containername); \
-    } \
-    event.castedOriginator_ = dynamic_cast<subclassname*>(event.originator_); \
-    containername->process(this, event)
-
 
 namespace orxonox
@@ -72,6 +48,5 @@
         public:
             EventContainer(const std::string& eventname, Executor* eventfunction, Identifier* subclass) : eventname_(eventname), eventfunction_(eventfunction), subclass_(subclass), activeEvents_(0) {}
-            ~EventContainer()
-                { delete this->eventfunction_; }
+            ~EventContainer();
 
             void process(BaseObject* object, const Event& event);
Index: code/branches/objecthierarchy/src/core/XMLPort.h
===================================================================
--- code/branches/objecthierarchy/src/core/XMLPort.h	(revision 2064)
+++ code/branches/objecthierarchy/src/core/XMLPort.h	(revision 2065)
@@ -480,7 +480,9 @@
 
                                                 BaseObject* newObject = identifier->fabricate((BaseObject*)object);
+                                                assert(newObject);
                                                 newObject->setLoaderIndentation(((BaseObject*)object)->getLoaderIndentation() + "  ");
-//                                                newObject->setFile(((BaseObject*)object)->getFile());
-//                                                newObject->setNamespace(((BaseObject*)object)->getNamespace());
+
+                                                O* castedObject = dynamic_cast<O*>(newObject);
+                                                assert(castedObject);
 
                                                 if (this->bLoadBefore_)
@@ -495,5 +497,5 @@
 
                                                 COUT(5) << ((BaseObject*)object)->getLoaderIndentation();
-                                                (*this->loadexecutor_)(object, newObject);
+                                                (*this->loadexecutor_)(object, castedObject);
 
                                                 if (!this->bLoadBefore_)
Index: code/branches/objecthierarchy/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/objecthierarchy/src/orxonox/CMakeLists.txt	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/CMakeLists.txt	(revision 2065)
@@ -62,6 +62,7 @@
   objects/worldentities/CameraPosition.cc
   objects/worldentities/SpawnPoint.cc
+  objects/worldentities/ParticleEmitter.cc
+  objects/worldentities/ParticleSpawner.cc
 #  objects/worldentities/Backlight.cc
-#  objects/worldentities/ParticleSpawner.cc
 
   objects/worldentities/triggers/Trigger.cc
Index: code/branches/objecthierarchy/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/objecthierarchy/src/orxonox/OrxonoxPrereqs.h	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/OrxonoxPrereqs.h	(revision 2065)
@@ -96,4 +96,7 @@
     class BlinkingBillboard;
     class Light;
+    class Backlight;
+    class ParticleEmitter;
+    class ParticleSpawner;
 
     class Camera;
@@ -107,7 +110,4 @@
     class Controller;
     class HumanController;
-
-    class Backlight;
-    class ParticleSpawner;
 
     class Info;
Index: code/branches/objecthierarchy/src/orxonox/objects/worldentities/Billboard.cc
===================================================================
--- code/branches/objecthierarchy/src/orxonox/objects/worldentities/Billboard.cc	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/objects/worldentities/Billboard.cc	(revision 2065)
@@ -76,4 +76,5 @@
                 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
                 this->getNode()->attachObject(this->billboard_.getBillboardSet());
+                this->billboard_.setVisible(this->isVisible());
             }
         }
@@ -90,4 +91,5 @@
                 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
                 this->getNode()->attachObject(this->billboard_.getBillboardSet());
+                this->billboard_.setVisible(this->isVisible());
             }
         }
Index: code/branches/objecthierarchy/src/orxonox/objects/worldentities/BlinkingBillboard.cc
===================================================================
--- code/branches/objecthierarchy/src/orxonox/objects/worldentities/BlinkingBillboard.cc	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/objects/worldentities/BlinkingBillboard.cc	(revision 2065)
@@ -30,6 +30,8 @@
 #include "BlinkingBillboard.h"
 
+#include "core/Core.h"
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
+#include "util/Math.h"
 
 namespace orxonox
@@ -44,4 +46,5 @@
         this->frequency_ = 1.0f;
         this->phase_ = 0;
+        this->bQuadratic_ = false;
         this->time_ = 0;
 
@@ -60,17 +63,24 @@
         XMLPortParam(BlinkingBillboard, "frequency", setFrequency, getFrequency, xmlelement, mode).defaultValues(1.0f);
         XMLPortParam(BlinkingBillboard, "phase",     setPhase,     getPhase,     xmlelement, mode).defaultValues(Degree(0));
+        XMLPortParam(BlinkingBillboard, "quadratic", setQuadratic, isQuadratic,  xmlelement, mode).defaultValues(false);
     }
 
     void BlinkingBillboard::registerVariables()
     {
-        REGISTERDATA(this->amplitude_, network::direction::toclient);
-        REGISTERDATA(this->frequency_, network::direction::toclient);
-        REGISTERDATA(this->phase_,     network::direction::toclient);
+//        REGISTERDATA(this->amplitude_, network::direction::toclient);
+//        REGISTERDATA(this->frequency_, network::direction::toclient);
+//        REGISTERDATA(this->phase_,     network::direction::toclient);
     }
 
     void BlinkingBillboard::tick(float dt)
     {
-        this->time_ += dt;
-        this->setScale(this->amplitude_ * sin((6.2831853 * this->time_ + this->phase_.valueRadians()) * this->frequency_));
+        if (Core::isMaster())
+        {
+            this->time_ += dt;
+            if (this->bQuadratic_)
+                this->setScale(this->amplitude_ * square(sin((6.2831853 * this->time_ + this->phase_.valueRadians()) * this->frequency_)));
+            else
+                this->setScale(this->amplitude_ * sin((6.2831853 * this->time_ + this->phase_.valueRadians()) * this->frequency_));
+        }
     }
 }
Index: code/branches/objecthierarchy/src/orxonox/objects/worldentities/BlinkingBillboard.h
===================================================================
--- code/branches/objecthierarchy/src/orxonox/objects/worldentities/BlinkingBillboard.h	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/objects/worldentities/BlinkingBillboard.h	(revision 2065)
@@ -62,8 +62,14 @@
                 { return this->phase_; }
 
+            inline void setQuadratic(bool bQuadratic)
+                { this->bQuadratic_ = bQuadratic; }
+            inline bool isQuadratic() const
+                { return this->bQuadratic_; }
+
         private:
             float amplitude_;
             float frequency_;
             Degree phase_;
+            bool bQuadratic_;
             long double time_;
     };
Index: code/branches/objecthierarchy/src/orxonox/objects/worldentities/ControllableEntity.cc
===================================================================
--- code/branches/objecthierarchy/src/orxonox/objects/worldentities/ControllableEntity.cc	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/objects/worldentities/ControllableEntity.cc	(revision 2065)
@@ -95,5 +95,5 @@
         XMLPortParam(ControllableEntity, "camerapositiontemplate", setCameraPositionTemplate, getCameraPositionTemkplate, xmlelement, mode);
 
-        XMLPortObject(ControllableEntity, WorldEntity, "camerapositions", addCameraPosition, getCameraPosition, xmlelement, mode);
+        XMLPortObject(ControllableEntity, CameraPosition, "camerapositions", addCameraPosition, getCameraPosition, xmlelement, mode);
     }
 
@@ -239,5 +239,5 @@
             else if (this->bControlled_)
             {
-                COUT(2) << "setting client position" << endl;
+//                COUT(2) << "setting client position" << endl;
                 this->client_velocity_ = this->velocity_;
                 this->client_position_ = this->node_->getPosition();
@@ -249,8 +249,4 @@
     {
         REGISTERSTRING(this->cameraPositionTemplate_, network::direction::toclient);
-        
-        
-        REGISTERDATA(this->client_overwrite_,   network::direction::toserver);
-        REGISTERDATA(this->server_overwrite_,   network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));
 
         REGISTERDATA(this->server_position_,    network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition));
@@ -258,4 +254,6 @@
         REGISTERDATA(this->server_orientation_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation));
 
+        REGISTERDATA(this->server_overwrite_,   network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));
+        REGISTERDATA(this->client_overwrite_,   network::direction::toserver);
 
         REGISTERDATA(this->client_position_,    network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition));
@@ -301,10 +299,10 @@
         if (this->server_overwrite_ == this->client_overwrite_)
         {
-            COUT(2) << "callback: setting client position" << endl;
+//            COUT(2) << "callback: setting client position" << endl;
             this->node_->setPosition(this->client_position_);
             this->server_position_ = this->client_position_;
         }
-        else
-          COUT(2) << "callback: not setting client position" << endl;
+//        else
+//          COUT(2) << "callback: not setting client position" << endl;
     }
 
@@ -458,5 +456,5 @@
         else if (this->bControlled_)
         {
-//             this->node_->lookAt(target, relativeTo, localDirectionVector);
+            this->node_->lookAt(target, relativeTo, localDirectionVector);
             this->client_orientation_ = this->node_->getOrientation();
         }
Index: code/branches/objecthierarchy/src/orxonox/objects/worldentities/Light.cc
===================================================================
--- code/branches/objecthierarchy/src/orxonox/objects/worldentities/Light.cc	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/objects/worldentities/Light.cc	(revision 2065)
@@ -165,3 +165,10 @@
         this->light_->setType(this->type_);
     }
+
+    void Light::changedVisibility()
+    {
+        SUPER(Light, changedVisibility);
+
+        this->light_->setVisible(this->isVisible());
+    }
 }
Index: code/branches/objecthierarchy/src/orxonox/objects/worldentities/Light.h
===================================================================
--- code/branches/objecthierarchy/src/orxonox/objects/worldentities/Light.h	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/objects/worldentities/Light.h	(revision 2065)
@@ -49,4 +49,6 @@
             void registerVariables();
 
+            virtual void changedVisibility();
+
             inline Ogre::Light* getLight()
                 { return this->light_; }
Index: code/branches/objecthierarchy/src/orxonox/objects/worldentities/Model.cc
===================================================================
--- code/branches/objecthierarchy/src/orxonox/objects/worldentities/Model.cc	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/objects/worldentities/Model.cc	(revision 2065)
@@ -76,4 +76,5 @@
             this->getNode()->attachObject(this->mesh_.getEntity());
             this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
+            this->mesh_.setVisible(this->isVisible());
         }
     }
Index: code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleEmitter.cc
===================================================================
--- code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleEmitter.cc	(revision 2065)
+++ code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleEmitter.cc	(revision 2065)
@@ -0,0 +1,125 @@
+/*
+ *   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:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+* @file ParticleInterface.cc
+* @brief class to control praticle effects
+*/
+
+#include "OrxonoxStableHeaders.h"
+
+#include "ParticleEmitter.h"
+
+#include "tools/ParticleInterface.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/Scene.h"
+
+namespace orxonox
+{
+    CreateFactory(ParticleEmitter);
+
+    ParticleEmitter::ParticleEmitter(BaseObject* creator) : PositionableEntity(creator)
+    {
+        RegisterObject(ParticleEmitter);
+
+        assert(this->getScene());
+        assert(this->getScene()->getSceneManager());
+
+        this->particles_ = 0;
+        this->LOD_ = LODParticle::normal;
+
+        this->registerVariables();
+    }
+
+    ParticleEmitter::~ParticleEmitter()
+    {
+        if (this->isInitialized() && this->particles_)
+            delete this->particles_;
+    }
+
+    void ParticleEmitter::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(ParticleEmitter, XMLPort, xmlelement, mode);
+
+        XMLPortParam(ParticleEmitter, "lod",    setLODxml, getLODxml, xmlelement, mode).defaultValues(LODParticle::normal);
+        XMLPortParam(ParticleEmitter, "source", setSource, getSource, xmlelement, mode);
+    }
+
+    void ParticleEmitter::registerVariables()
+    {
+        REGISTERSTRING(this->source_, network::direction::toclient, new network::NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::sourceChanged));
+        REGISTERDATA  (this->LOD_,    network::direction::toclient, new network::NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::LODchanged));
+    }
+
+    void ParticleEmitter::changedVisibility()
+    {
+        SUPER(ParticleEmitter, changedVisibility);
+
+        if (this->particles_)
+            this->particles_->setVisible(this->isVisible());
+    }
+
+    void ParticleEmitter::changedActivity()
+    {
+        SUPER(ParticleEmitter, changedActivity);
+
+        if (this->particles_)
+            this->particles_->setEnabled(this->isActive());
+    }
+
+    void ParticleEmitter::sourceChanged()
+    {
+        if (this->particles_)
+            delete this->particles_;
+
+        if (this->getScene() && this->getScene()->getSceneManager())
+        {
+            try
+            {
+                this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), this->source_, this->LOD_);
+                this->particles_->addToSceneNode(this->getNode());
+                this->particles_->setVisible(this->isVisible());
+                this->particles_->setEnabled(this->isActive());
+            }
+            catch (...)
+            {
+                COUT(1) << "Error: Couln't load particle effect \"" << this->source_ << "\"" << std::endl;
+                this->particles_ = 0;
+            }
+        }
+        else
+            this->particles_ = 0;
+    }
+
+    void ParticleEmitter::LODchanged()
+    {
+        if (this->particles_)
+            this->particles_->setDetailLevel(this->LOD_);
+    }
+}
Index: code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleEmitter.h
===================================================================
--- code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleEmitter.h	(revision 2065)
+++ code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleEmitter.h	(revision 2065)
@@ -0,0 +1,77 @@
+/*
+ *   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:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _ParticleEmitter_H__
+#define _ParticleEmitter_H__
+
+#include "OrxonoxPrereqs.h"
+#include "PositionableEntity.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport ParticleEmitter : public PositionableEntity
+    {
+        public:
+            ParticleEmitter(BaseObject* creator);
+            ~ParticleEmitter();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+
+            virtual void changedVisibility();
+            virtual void changedActivity();
+
+            inline ParticleInterface* getParticleInterface() const
+                { return this->particles_; }
+
+            inline void setSource(const std::string& source)
+                { this->source_ = source; this->sourceChanged(); }
+            inline const std::string& getSource() const
+                { return this->source_; }
+
+            inline void setLOD(LODParticle::LOD level)
+                { this->LOD_ = level; this->LODchanged(); }
+            inline LODParticle::LOD getLOD() const
+                { return this->LOD_; }
+
+        protected:
+            inline void setLODxml(unsigned int level)
+                { this->LOD_ = (LODParticle::LOD)level; this->LODchanged(); }
+            inline unsigned int getLODxml() const
+                { return (unsigned int)this->LOD_; }
+
+            void sourceChanged();
+            void LODchanged();
+
+            ParticleInterface* particles_;
+            std::string        source_;
+            LODParticle::LOD   LOD_;
+    };
+}
+
+#endif /* _ParticleEmitter_H__ */
Index: code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleSpawner.cc
===================================================================
--- code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleSpawner.cc	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleSpawner.cc	(revision 2065)
@@ -30,9 +30,9 @@
 #include "ParticleSpawner.h"
 
-#include <OgreSceneManager.h>
 #include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
 #include "core/Executor.h"
+#include "core/XMLPort.h"
 #include "tools/ParticleInterface.h"
-#include "GraphicsEngine.h"
 
 namespace orxonox
@@ -40,56 +40,87 @@
     CreateFactory(ParticleSpawner);
 
-    ParticleSpawner::ParticleSpawner()
+    ParticleSpawner::ParticleSpawner(BaseObject* creator) : ParticleEmitter(creator)
     {
         RegisterObject(ParticleSpawner);
-        this->particle_ = 0;
-    }
 
-    ParticleSpawner::ParticleSpawner(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime, float startdelay, float destroydelay, const Vector3& direction)
-    {
-        RegisterObject(ParticleSpawner);
-        this->setParticle(templateName, detaillevel, lifetime, startdelay, destroydelay, direction);
-    }
+        this->bAutostart_ = true;
+        this->bSuppressStart_ = false;
+        this->bAutoDestroy_ = true;
+        this->bForceDestroy_ = false;
+        this->bLoop_ = false;
+        this->startdelay_ = 0;
+        this->lifetime_ = 0;
+        this->destroydelay_ = 0;
 
-    void ParticleSpawner::setParticle(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime, float startdelay, float destroydelay, const Vector3& direction)
-    {
-        ExecutorMember<ParticleSpawner>* executor = createExecutor(createFunctor(&ParticleSpawner::createParticleSpawner));
-        this->destroydelay_ = destroydelay;
-        executor->setDefaultValues(lifetime);
-        this->timer_.setTimer(startdelay, false, this, executor);
-        this->particle_ = new ParticleInterface(templateName, detaillevel);
-        this->particle_->addToSceneNode(this->getNode());
-        this->particle_->setEnabled(false);
-        if (direction != Vector3::ZERO)
-        {
-            this->particle_->getAllEmitters()->setDirection(direction);
-        }
+        this->startParticleSpawner();
     }
 
     ParticleSpawner::~ParticleSpawner()
     {
-        if (this->isInitialized() && this->particle_)
-        {
-            this->particle_->detachFromSceneNode();
-            delete this->particle_;
-        }
-    };
-
-    void ParticleSpawner::destroy()
-    {
-        this->setPosition(this->getNode()->getParent()->getPosition());
-        this->getNode()->getParent()->removeChild(this->getNode());
-        this->detachFromParent();
-        if (this->particle_)
-            this->particle_->setEnabled(false);
-        if (!this->timer_.isActive() || this->timer_.getRemainingTime() > this->destroydelay_)
-            this->timer_.setTimer(this->destroydelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::destroyParticleSpawner)));
     }
 
-    void ParticleSpawner::createParticleSpawner(float lifetime)
+    void ParticleSpawner::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
-        this->particle_->setEnabled(true);
-        if (lifetime != 0)
-            this->timer_.setTimer(lifetime, false, this, createExecutor(createFunctor(&ParticleSpawner::destroyParticleSpawner)));
+        SUPER(ParticleSpawner, XMLPort, xmlelement, mode);
+
+        XMLPortParam(ParticleSpawner, "autostart",    setAutoStart,        getAutoStart,        xmlelement, mode).defaultValues(true);
+        XMLPortParam(ParticleSpawner, "autodestroy",  setDestroyAfterLife, getDestroyAfterLife, xmlelement, mode).defaultValues(false);
+        XMLPortParam(ParticleSpawner, "loop",         setLoop,             getLoop,             xmlelement, mode).defaultValues(false);
+        XMLPortParam(ParticleSpawner, "lifetime",     setLifetime,         getLifetime,         xmlelement, mode).defaultValues(0.0f);
+        XMLPortParam(ParticleSpawner, "startdelay",   setStartdelay,       getStartdelay,       xmlelement, mode).defaultValues(0.0f);
+        XMLPortParam(ParticleSpawner, "destroydelay", setDestroydelay,     getDestroydelay,     xmlelement, mode).defaultValues(0.0f);
+    }
+
+    void ParticleSpawner::processEvent(Event& event)
+    {
+        SUPER(ParticleSpawner, processEvent, event);
+
+        SetEvent(ParticleSpawner, "spawn", spawn, event);
+    }
+
+    void ParticleSpawner::configure(float lifetime, float startdelay, float destroydelay, bool autodestroy)
+    {
+        this->bAutoDestroy_ = autodestroy;
+        this->startdelay_ = startdelay;
+        this->lifetime_ = lifetime;
+        this->destroydelay_ = destroydelay;
+    }
+
+    void ParticleSpawner::startParticleSpawner()
+    {
+        if (!this->particles_)
+            return;
+
+        this->particles_->setEnabled(false);
+
+        if (this->bForceDestroy_ || this->bSuppressStart_)
+            return;
+
+        this->timer_.setTimer(this->startdelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::fireParticleSpawner)));
+    }
+
+    void ParticleSpawner::fireParticleSpawner()
+    {
+        this->particles_->setEnabled(true);
+        if (this->lifetime_ != 0)
+            this->timer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&ParticleSpawner::stopParticleSpawner)));
+    }
+
+    void ParticleSpawner::stopParticleSpawner()
+    {
+        this->particles_->setEnabled(false);
+
+        if (this->bAutoDestroy_ || this->bForceDestroy_)
+        {
+            this->setPosition(this->getWorldPosition());
+            this->detachFromParent();
+
+            if (!this->timer_.isActive() || this->timer_.getRemainingTime() > this->destroydelay_)
+                this->timer_.setTimer(this->destroydelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::destroyParticleSpawner)));
+        }
+        else if (this->bLoop_)
+        {
+            this->timer_.setTimer(this->destroydelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::startParticleSpawner)));
+        }
     }
 
@@ -98,9 +129,3 @@
         delete this;
     }
-
-    void ParticleSpawner::setVisible(bool visible)
-    {
-        if (this->particle_)
-            this->particle_->setEnabled(visible);
-    }
 }
Index: code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleSpawner.h
===================================================================
--- code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleSpawner.h	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleSpawner.h	(revision 2065)
@@ -32,29 +32,70 @@
 #include "OrxonoxPrereqs.h"
 
-#include "PositionableEntity.h"
+#include "ParticleEmitter.h"
 #include "tools/Timer.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport ParticleSpawner : public PositionableEntity
+    class _OrxonoxExport ParticleSpawner : public ParticleEmitter
     {
         public:
-            ParticleSpawner();
-            ParticleSpawner(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime = 0, float startdelay = 0, float destroydelay = 0, const Vector3& direction = Vector3::ZERO);
+            ParticleSpawner(BaseObject* creator);
             virtual ~ParticleSpawner();
-            void destroy();
 
-            void setParticle(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime = 0, float startdelay = 0, float destroydelay = 0, const Vector3& direction = Vector3::ZERO);
-            inline ParticleInterface* getParticleInterface() const
-                { return this->particle_; }
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void processEvent(Event& event);
 
-            void setVisible(bool visible);
+            inline void destroy()
+                { this->bForceDestroy_ = true; this->stopParticleSpawner(); }
+            inline void spawn()
+                { this->bSuppressStart_ = false; this->startParticleSpawner(); }
+
+            void configure(float lifetime = 0, float startdelay = 0, float destroydelay = 0, bool autodestroy = true);
+
+            inline void setAutoStart(bool autostart)
+                { this->bAutostart_ = autostart; this->bSuppressStart_ = !autostart; }
+            inline bool getAutoStart() const
+                { return this->bAutostart_; }
+
+            inline void setDestroyAfterLife(bool destroy)
+                { this->bAutoDestroy_ = destroy; }
+            inline bool getDestroyAfterLife() const
+                { return this->bAutoDestroy_; }
+
+            inline void setLoop(bool loop)
+                { this->bLoop_ = loop; }
+            inline bool getLoop() const
+                { return this->bLoop_; }
+
+            inline void setLifetime(float lifetime)
+                { this->lifetime_ = lifetime; this->startParticleSpawner(); }
+            inline float getLifetime() const
+                { return this->lifetime_; }
+
+            inline void setStartdelay(float startdelay)
+                { this->startdelay_ = startdelay; this->startParticleSpawner(); }
+            inline float getStartdelay() const
+                { return this->startdelay_; }
+
+            inline void setDestroydelay(float destroydelay)
+                { this->destroydelay_ = destroydelay; this->startParticleSpawner(); }
+            inline float getDestroydelay() const
+                { return this->destroydelay_; }
 
         private:
-            void createParticleSpawner(float lifetime);
+            void startParticleSpawner();
+            void fireParticleSpawner();
+            void stopParticleSpawner();
             void destroyParticleSpawner();
 
             Timer<ParticleSpawner> timer_;
-            ParticleInterface* particle_;
+
+            bool  bSuppressStart_;
+            bool  bAutostart_;
+            bool  bForceDestroy_;
+            bool  bAutoDestroy_;
+            bool  bLoop_;
+            float startdelay_;
+            float lifetime_;
             float destroydelay_;
     };
Index: code/branches/objecthierarchy/src/orxonox/objects/worldentities/SpawnPoint.cc
===================================================================
--- code/branches/objecthierarchy/src/orxonox/objects/worldentities/SpawnPoint.cc	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/objects/worldentities/SpawnPoint.cc	(revision 2065)
@@ -78,9 +78,15 @@
         {
             this->getGametype()->pawnPreSpawn(entity);
+
             this->spawn(entity);
+
             if (this->template_)
                 entity->addTemplate(this->template_);
+
             entity->postSpawn();
+
             this->getGametype()->pawnPostSpawn(entity);
+
+            this->fireEvent();
         }
         return entity;
Index: code/branches/objecthierarchy/src/orxonox/objects/worldentities/WorldEntity.h
===================================================================
--- code/branches/objecthierarchy/src/orxonox/objects/worldentities/WorldEntity.h	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/objects/worldentities/WorldEntity.h	(revision 2065)
@@ -134,5 +134,5 @@
                 { parent->attach(this); }
             inline void detachFromParent()
-                { this->parent_->detach(this); }
+                { if (this->parent_) { this->parent_->detach(this); } }
             inline WorldEntity* getParent() const
                 { return this->parent_; }
Index: code/branches/objecthierarchy/src/orxonox/objects/worldentities/triggers/Trigger.cc
===================================================================
--- code/branches/objecthierarchy/src/orxonox/objects/worldentities/triggers/Trigger.cc	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/objects/worldentities/triggers/Trigger.cc	(revision 2065)
@@ -128,4 +128,5 @@
       this->bTriggered_ = (newState & 0x1);
       this->bActive_ = newState & 2;
+      this->fireEvent(this->bActive_);
       this->stateChanges_.pop();
       if (this->stateChanges_.size() != 0)
Index: code/branches/objecthierarchy/src/orxonox/tools/Mesh.h
===================================================================
--- code/branches/objecthierarchy/src/orxonox/tools/Mesh.h	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/tools/Mesh.h	(revision 2065)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      ...
+ *      Fabian 'x3n' Landau
  *   Co-authors:
  *      ...
Index: code/branches/objecthierarchy/src/orxonox/tools/ParticleInterface.cc
===================================================================
--- code/branches/objecthierarchy/src/orxonox/tools/ParticleInterface.cc	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/tools/ParticleInterface.cc	(revision 2065)
@@ -1,28 +1,29 @@
 /*
-*   ORXONOX - the hottest 3D action shooter ever to exist
-*
-*
-*   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:
-*      ...
-*   Co-authors:
-*      ...
-*
-*/
+ *   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:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
 
 /**
@@ -45,150 +46,164 @@
 namespace orxonox
 {
-  unsigned int ParticleInterface::counter_s = 0;
-  ParticleInterface* ParticleInterface::currentParticleInterface_s = 0;
-
-  ParticleInterface::ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::LOD detaillevel)
-  {
-    RegisterRootObject(ParticleInterface);
-
-    assert(scenemanager);
-
-    this->scenemanager_ = scenemanager;
-    this->sceneNode_ = 0;
-    this->bEnabled_ = true;
-    this->detaillevel_ = (unsigned int)detaillevel;
-    this->particleSystem_ = this->scenemanager_->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName);
-    //this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor());
-    this->particleSystem_->setSpeedFactor(1.0f);
-
-    if (GraphicsEngine::getInstance().getDetailLevelParticle() < (unsigned int)this->detaillevel_)
-    {
-      this->bVisible_ = false;
-      this->updateVisibility();
-    }
-    else
-    {
-      this->bVisible_ = true;
-    }
-  }
-
-  ParticleInterface::~ParticleInterface()
-  {
-    this->particleSystem_->removeAllEmitters();
-    this->scenemanager_->destroyParticleSystem(particleSystem_);
-  }
-
-  void ParticleInterface::addToSceneNode(Ogre::SceneNode* sceneNode)
-  {
-    this->sceneNode_ = sceneNode;
-    this->sceneNode_->attachObject(this->particleSystem_);
-  }
-
-  void ParticleInterface::detachFromSceneNode()
-  {
-    if (this->sceneNode_)
-    {
-      this->sceneNode_->detachObject(this->particleSystem_);
-      this->sceneNode_ = 0;
-    }
-  }
-
-  Ogre::ParticleEmitter* ParticleInterface::createNewEmitter()
-  {
-    if (this->particleSystem_->getNumEmitters() > 0)
-    {
-      Ogre::ParticleEmitter* newemitter = this->particleSystem_->addEmitter(this->particleSystem_->getEmitter(0)->getType());
-      this->particleSystem_->getEmitter(0)->copyParametersTo(newemitter);
-      return newemitter;
-    }
-    else
-      return 0;
-  }
-  Ogre::ParticleEmitter* ParticleInterface::getEmitter(unsigned int emitterNr) const
-  {
-    if (emitterNr < this->particleSystem_->getNumEmitters())
-      return this->particleSystem_->getEmitter(emitterNr);
-    else
-      return 0;
-  }
-  void ParticleInterface::removeEmitter(unsigned int emitterNr)
-  {
-    if (emitterNr < this->particleSystem_->getNumEmitters())
-      this->particleSystem_->removeEmitter(emitterNr);
-  }
-  void ParticleInterface::removeAllEmitters()
-  {
-    this->particleSystem_->removeAllEmitters();
-  }
-  unsigned int ParticleInterface::getNumEmitters() const
-  {
-    return this->particleSystem_->getNumEmitters();
-  }
-
-  Ogre::ParticleAffector* ParticleInterface::addAffector(const std::string& name)
-  {
-    return this->particleSystem_->addAffector(name);
-  }
-  Ogre::ParticleAffector* ParticleInterface::getAffector(unsigned int affectorNr) const
-  {
-    if (affectorNr < this->particleSystem_->getNumAffectors())
-      return this->particleSystem_->getAffector(affectorNr);
-    else
-      return 0;
-  }
-  void ParticleInterface::removeAffector(unsigned int affectorNr)
-  {
-    if (affectorNr < this->particleSystem_->getNumAffectors())
-      this->particleSystem_->removeAffector(affectorNr);
-  }
-  void ParticleInterface::removeAllAffectors()
-  {
-    this->particleSystem_->removeAllAffectors();
-  }
-  unsigned int ParticleInterface::getNumAffectors() const
-  {
-    return this->particleSystem_->getNumAffectors();
-  }
-
-  void ParticleInterface::setEnabled(bool enable)
-  {
-    this->bEnabled_ = enable;
-    this->updateVisibility();
-  }
-
-  void ParticleInterface::detailLevelChanged(unsigned int newlevel)
-  {
-    if (newlevel >= (unsigned int)this->detaillevel_)
-      this->bVisible_ = true;
-    else
-      this->bVisible_ = false;
-
-    this->updateVisibility();
-  }
-
-  void ParticleInterface::updateVisibility()
-  {
-    for (unsigned int i = 0; i < this->particleSystem_->getNumEmitters(); i++)
-      this->particleSystem_->getEmitter(i)->setEnabled(this->bEnabled_ && this->bVisible_);
-  }
-
-  void ParticleInterface::setSpeedFactor(float factor)
-  {
-    //this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor() * factor);
-    this->particleSystem_->setSpeedFactor(1.0f * factor);
-  }
-  float ParticleInterface::getSpeedFactor() const
-  {
-    //return (this->particleSystem_->getSpeedFactor() / Orxonox::getInstance().getTimeFactor());
-    return (this->particleSystem_->getSpeedFactor() / 1.0f);
-  }
-
-  bool ParticleInterface::getKeepParticlesInLocalSpace() const
-  {
-    return this->particleSystem_->getKeepParticlesInLocalSpace();
-  }
-  void ParticleInterface::setKeepParticlesInLocalSpace(bool keep)
-  {
-    this->particleSystem_->setKeepParticlesInLocalSpace(keep);
-  }
+    unsigned int ParticleInterface::counter_s = 0;
+    ParticleInterface* ParticleInterface::currentParticleInterface_s = 0;
+
+    ParticleInterface::ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::LOD detaillevel)
+    {
+        RegisterRootObject(ParticleInterface);
+
+        assert(scenemanager);
+
+        this->scenemanager_ = scenemanager;
+        this->sceneNode_ = 0;
+
+        this->bEnabled_ = true;
+        this->bVisible_ = true;
+        this->bAllowedByLOD_ = true;
+
+        this->particleSystem_ = this->scenemanager_->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName);
+        this->particleSystem_->setSpeedFactor(1.0f);
+        //this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor());
+
+        this->setDetailLevel((unsigned int)detaillevel);
+    }
+
+    ParticleInterface::~ParticleInterface()
+    {
+        this->particleSystem_->removeAllEmitters();
+        this->detachFromSceneNode();
+        this->scenemanager_->destroyParticleSystem(particleSystem_);
+    }
+
+    void ParticleInterface::addToSceneNode(Ogre::SceneNode* sceneNode)
+    {
+        if (this->sceneNode_)
+            this->detachFromSceneNode();
+
+        this->sceneNode_ = sceneNode;
+        this->sceneNode_->attachObject(this->particleSystem_);
+    }
+
+    void ParticleInterface::detachFromSceneNode()
+    {
+        if (this->sceneNode_)
+        {
+            this->sceneNode_->detachObject(this->particleSystem_);
+            this->sceneNode_ = 0;
+        }
+    }
+
+    Ogre::ParticleEmitter* ParticleInterface::createNewEmitter()
+    {
+        if (this->particleSystem_->getNumEmitters() > 0)
+        {
+            Ogre::ParticleEmitter* newemitter = this->particleSystem_->addEmitter(this->particleSystem_->getEmitter(0)->getType());
+            this->particleSystem_->getEmitter(0)->copyParametersTo(newemitter);
+            return newemitter;
+        }
+        else
+            return 0;
+    }
+    Ogre::ParticleEmitter* ParticleInterface::getEmitter(unsigned int emitterNr) const
+    {
+        if (emitterNr < this->particleSystem_->getNumEmitters())
+            return this->particleSystem_->getEmitter(emitterNr);
+        else
+            return 0;
+    }
+    void ParticleInterface::removeEmitter(unsigned int emitterNr)
+    {
+        if (emitterNr < this->particleSystem_->getNumEmitters())
+            this->particleSystem_->removeEmitter(emitterNr);
+    }
+    void ParticleInterface::removeAllEmitters()
+    {
+        this->particleSystem_->removeAllEmitters();
+    }
+    unsigned int ParticleInterface::getNumEmitters() const
+    {
+        return this->particleSystem_->getNumEmitters();
+    }
+
+    Ogre::ParticleAffector* ParticleInterface::addAffector(const std::string& name)
+    {
+        return this->particleSystem_->addAffector(name);
+    }
+    Ogre::ParticleAffector* ParticleInterface::getAffector(unsigned int affectorNr) const
+    {
+        if (affectorNr < this->particleSystem_->getNumAffectors())
+            return this->particleSystem_->getAffector(affectorNr);
+        else
+            return 0;
+    }
+    void ParticleInterface::removeAffector(unsigned int affectorNr)
+    {
+        if (affectorNr < this->particleSystem_->getNumAffectors())
+            this->particleSystem_->removeAffector(affectorNr);
+    }
+    void ParticleInterface::removeAllAffectors()
+    {
+        this->particleSystem_->removeAllAffectors();
+    }
+    unsigned int ParticleInterface::getNumAffectors() const
+    {
+        return this->particleSystem_->getNumAffectors();
+    }
+
+    void ParticleInterface::setEnabled(bool enable)
+    {
+        this->bEnabled_ = enable;
+
+        for (unsigned int i = 0; i < this->particleSystem_->getNumEmitters(); i++)
+            this->particleSystem_->getEmitter(i)->setEnabled(this->bEnabled_ && this->bAllowedByLOD_);
+    }
+
+    void ParticleInterface::setVisible(bool visible)
+    {
+        this->bVisible_ = visible;
+
+        this->particleSystem_->setVisible(this->bVisible_ && this->bAllowedByLOD_);
+    }
+
+    void ParticleInterface::setDetailLevel(unsigned int level)
+    {
+        this->detaillevel_ = level;
+        this->detailLevelChanged(GraphicsEngine::getInstance().getDetailLevelParticle());
+    }
+
+    void ParticleInterface::detailLevelChanged(unsigned int newlevel)
+    {
+        if (newlevel >= (unsigned int)this->detaillevel_)
+            this->bAllowedByLOD_ = true;
+        else
+            this->bAllowedByLOD_ = false;
+
+        this->updateVisibility();
+    }
+
+    void ParticleInterface::updateVisibility()
+    {
+        this->setEnabled(this->isEnabled());
+        this->setVisible(this->isVisible());
+    }
+
+    void ParticleInterface::setSpeedFactor(float factor)
+    {
+        //this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor() * factor);
+        this->particleSystem_->setSpeedFactor(1.0f * factor);
+    }
+    float ParticleInterface::getSpeedFactor() const
+    {
+        //return (this->particleSystem_->getSpeedFactor() / Orxonox::getInstance().getTimeFactor());
+        return (this->particleSystem_->getSpeedFactor() / 1.0f);
+    }
+
+    bool ParticleInterface::getKeepParticlesInLocalSpace() const
+    {
+        return this->particleSystem_->getKeepParticlesInLocalSpace();
+    }
+    void ParticleInterface::setKeepParticlesInLocalSpace(bool keep)
+    {
+        this->particleSystem_->setKeepParticlesInLocalSpace(keep);
+    }
 }
Index: code/branches/objecthierarchy/src/orxonox/tools/ParticleInterface.h
===================================================================
--- code/branches/objecthierarchy/src/orxonox/tools/ParticleInterface.h	(revision 2064)
+++ code/branches/objecthierarchy/src/orxonox/tools/ParticleInterface.h	(revision 2065)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      ...
+ *      Fabian 'x3n' Landau
  *   Co-authors:
  *      ...
@@ -45,53 +45,63 @@
 namespace orxonox
 {
-  class _OrxonoxExport ParticleInterface : public OrxonoxClass
-  {
-    public:
-      ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::LOD detaillevel);
-      ~ParticleInterface();
+    class _OrxonoxExport ParticleInterface : public OrxonoxClass
+    {
+        public:
+            ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::LOD detaillevel);
+            virtual ~ParticleInterface();
 
-      inline Ogre::ParticleSystem* getParticleSystem() const
-        { return this->particleSystem_; }
+            inline Ogre::ParticleSystem* getParticleSystem() const
+                { return this->particleSystem_; }
 
-      void addToSceneNode(Ogre::SceneNode* sceneNode);
-      void detachFromSceneNode();
+            void addToSceneNode(Ogre::SceneNode* sceneNode);
+            void detachFromSceneNode();
 
-      Ogre::ParticleEmitter* createNewEmitter();
-      Ogre::ParticleEmitter* getEmitter(unsigned int emitterNr) const;
-      void removeEmitter(unsigned int emitterNr);
-      void removeAllEmitters();
-      unsigned int getNumEmitters() const;
+            Ogre::ParticleEmitter* createNewEmitter();
+            Ogre::ParticleEmitter* getEmitter(unsigned int emitterNr) const;
+            void removeEmitter(unsigned int emitterNr);
+            void removeAllEmitters();
+            unsigned int getNumEmitters() const;
 
-      Ogre::ParticleAffector* addAffector(const std::string& name);
-      Ogre::ParticleAffector* getAffector(unsigned int affectorNr) const;
-      void removeAffector(unsigned int affectorNr);
-      void removeAllAffectors();
-      unsigned int getNumAffectors() const;
+            Ogre::ParticleAffector* addAffector(const std::string& name);
+            Ogre::ParticleAffector* getAffector(unsigned int affectorNr) const;
+            void removeAffector(unsigned int affectorNr);
+            void removeAllAffectors();
+            unsigned int getNumAffectors() const;
 
-      float getSpeedFactor() const;
-      void setSpeedFactor(float factor);
-      bool getKeepParticlesInLocalSpace() const;
-      void setKeepParticlesInLocalSpace(bool keep);
+            float getSpeedFactor() const;
+            void setSpeedFactor(float factor);
+            bool getKeepParticlesInLocalSpace() const;
+            void setKeepParticlesInLocalSpace(bool keep);
 
-      void setEnabled(bool enable);
-      void detailLevelChanged(unsigned int newlevel);
+            void setEnabled(bool enable);
+            inline bool isEnabled() const
+                { return this->bEnabled_; }
 
-      inline void storeThisAsCurrentParticleInterface()
-        { ParticleInterface::currentParticleInterface_s = this; }
-      inline static ParticleInterface* getCurrentParticleInterface()
-        { return ParticleInterface::currentParticleInterface_s; }
+            void setVisible(bool visible);
+            inline bool isVisible() const
+                { return this->bVisible_; }
 
-    private:
-      void updateVisibility();
+            void detailLevelChanged(unsigned int newlevel);
+            void setDetailLevel(unsigned int level);
 
-      static ParticleInterface* currentParticleInterface_s;
-      static unsigned int counter_s;
-      Ogre::SceneNode* sceneNode_;
-      Ogre::ParticleSystem* particleSystem_;
-      bool bVisible_;
-      bool bEnabled_;
-      unsigned int detaillevel_;                            //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high)
-      Ogre::SceneManager* scenemanager_;
-  };
+            inline void storeThisAsCurrentParticleInterface()
+                { ParticleInterface::currentParticleInterface_s = this; }
+            inline static ParticleInterface* getCurrentParticleInterface()
+                { return ParticleInterface::currentParticleInterface_s; }
+
+        private:
+            void updateVisibility();
+
+            static ParticleInterface* currentParticleInterface_s;
+            static unsigned int       counter_s;
+
+            Ogre::SceneNode*          sceneNode_;
+            Ogre::ParticleSystem*     particleSystem_;
+            bool                      bVisible_;
+            bool                      bEnabled_;
+            bool                      bAllowedByLOD_;
+            unsigned int              detaillevel_;     //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high)
+            Ogre::SceneManager*       scenemanager_;
+    };
 }
 
