Index: /code/branches/objecthierarchy/src/core/BaseObject.cc
===================================================================
--- /code/branches/objecthierarchy/src/core/BaseObject.cc	(revision 2073)
+++ /code/branches/objecthierarchy/src/core/BaseObject.cc	(revision 2074)
@@ -38,4 +38,5 @@
 #include "XMLPort.h"
 #include "XMLFile.h"
+#include "XMLNameListener.h"
 #include "Template.h"
 #include "util/String.h"
@@ -81,5 +82,8 @@
     {
         for (std::list<BaseObject*>::const_iterator it = this->events_.begin(); it != this->events_.end(); ++it)
-            (*it)->eventListeners_.erase(this);
+            (*it)->unregisterEventListener(this);
+
+        for (std::map<BaseObject*, std::string>::const_iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
+            it->first->removeEvent(this);
     }
 
@@ -92,5 +96,5 @@
     void BaseObject::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
-        XMLPortParam(BaseObject, "name", setName, getName, xmlelement, mode);
+        XMLPortParam(BaseObject, "name", setXMLName, getName, xmlelement, mode);
         XMLPortParam(BaseObject, "visible", setVisible, isVisible, xmlelement, mode);
         XMLPortParam(BaseObject, "active", setActive, isActive, xmlelement, mode);
@@ -135,4 +139,16 @@
 
     /**
+        @brief Loads the name of the object through XML and calls all XMLNameListener.
+        @param name The name of the object
+    */
+    void BaseObject::setXMLName(const std::string& name)
+    {
+        this->setName(name);
+
+        for (ObjectList<XMLNameListener>::iterator it = ObjectList<XMLNameListener>::begin(); it != ObjectList<XMLNameListener>::end(); ++it)
+            it->loadedNewXMLName(this);
+    }
+
+    /**
         @brief Returns the levelfile that loaded this object.
         @return The levelfile
@@ -187,6 +203,11 @@
     void BaseObject::addEvent(BaseObject* event, const std::string& sectionname)
     {
-        event->eventListeners_[this] = sectionname;
+        event->registerEventListener(this, sectionname);
         this->events_.push_back(event);
+    }
+
+    void BaseObject::removeEvent(BaseObject* event)
+    {
+        this->events_.remove(event);
     }
 
@@ -232,5 +253,10 @@
     void BaseObject::fireEvent(bool activate)
     {
-        Event event(activate, this);
+        this->fireEvent(activate, this);
+    }
+
+    void BaseObject::fireEvent(bool activate, BaseObject* originator)
+    {
+        Event event(activate, originator);
 
         for (std::map<BaseObject*, std::string>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
@@ -241,4 +267,10 @@
     }
 
+    void BaseObject::fireEvent(Event& event)
+    {
+        for (std::map<BaseObject*, std::string>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
+            it->first->processEvent(event);
+    }
+
     void BaseObject::processEvent(Event& event)
     {
Index: /code/branches/objecthierarchy/src/core/BaseObject.h
===================================================================
--- /code/branches/objecthierarchy/src/core/BaseObject.h	(revision 2073)
+++ /code/branches/objecthierarchy/src/core/BaseObject.h	(revision 2074)
@@ -115,8 +115,16 @@
             void fireEvent();
             void fireEvent(bool activate);
+            void fireEvent(bool activate, BaseObject* originator);
+            void fireEvent(Event& event);
 
             virtual void processEvent(Event& event);
 
+            inline void registerEventListener(BaseObject* object, const std::string& sectionname)
+                { this->eventListeners_[object] = sectionname; }
+            inline void unregisterEventListener(BaseObject* object)
+                { this->eventListeners_.erase(object); }
+
             void addEvent(BaseObject* event, const std::string& sectionname);
+            void removeEvent(BaseObject* event);
             BaseObject* getEvent(unsigned int index) const;
 
@@ -136,4 +144,5 @@
 
         private:
+            void setXMLName(const std::string& name);
             Template* getTemplate(unsigned int index) const;
 
Index: /code/branches/objecthierarchy/src/core/CMakeLists.txt
===================================================================
--- /code/branches/objecthierarchy/src/core/CMakeLists.txt	(revision 2073)
+++ /code/branches/objecthierarchy/src/core/CMakeLists.txt	(revision 2074)
@@ -34,4 +34,5 @@
   Template.cc
   XMLPort.cc
+  XMLNameListener.cc
 
   # shell
Index: /code/branches/objecthierarchy/src/core/CorePrereqs.h
===================================================================
--- /code/branches/objecthierarchy/src/core/CorePrereqs.h	(revision 2073)
+++ /code/branches/objecthierarchy/src/core/CorePrereqs.h	(revision 2074)
@@ -155,4 +155,5 @@
   class Tickable;
   class XMLFile;
+  class XMLNameListener;
   template <class T, class O>
   class XMLPortClassObjectContainer;
Index: /code/branches/objecthierarchy/src/core/XMLNameListener.cc
===================================================================
--- /code/branches/objecthierarchy/src/core/XMLNameListener.cc	(revision 2074)
+++ /code/branches/objecthierarchy/src/core/XMLNameListener.cc	(revision 2074)
@@ -0,0 +1,38 @@
+/*
+ *   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:
+ *      ...
+ *
+ */
+
+#include "XMLNameListener.h"
+#include "CoreIncludes.h"
+
+namespace orxonox
+{
+    XMLNameListener::XMLNameListener()
+    {
+        RegisterRootObject(XMLNameListener);
+    }
+}
Index: /code/branches/objecthierarchy/src/core/XMLNameListener.h
===================================================================
--- /code/branches/objecthierarchy/src/core/XMLNameListener.h	(revision 2074)
+++ /code/branches/objecthierarchy/src/core/XMLNameListener.h	(revision 2074)
@@ -0,0 +1,47 @@
+/*
+ *   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 _XMLNameListener_H__
+#define _XMLNameListener_H__
+
+#include "CorePrereqs.h"
+#include "OrxonoxClass.h"
+
+namespace orxonox
+{
+    class _CoreExport XMLNameListener : virtual public OrxonoxClass
+    {
+        public:
+            XMLNameListener();
+            virtual ~XMLNameListener() {}
+
+            virtual void loadedNewXMLName(BaseObject* object) = 0;
+    };
+}
+
+#endif /* _XMLNameListener_H__ */
Index: /code/branches/objecthierarchy/src/orxonox/CMakeLists.txt
===================================================================
--- /code/branches/objecthierarchy/src/orxonox/CMakeLists.txt	(revision 2073)
+++ /code/branches/objecthierarchy/src/orxonox/CMakeLists.txt	(revision 2074)
@@ -43,4 +43,7 @@
   tools/WindowEventListener.cc
 
+  objects/EventListener.cc
+  objects/EventDispatcher.cc
+  objects/EventTarget.cc
   objects/Radar.cc
   objects/RadarListener.cc
Index: /code/branches/objecthierarchy/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- /code/branches/objecthierarchy/src/orxonox/OrxonoxPrereqs.h	(revision 2073)
+++ /code/branches/objecthierarchy/src/orxonox/OrxonoxPrereqs.h	(revision 2074)
@@ -112,4 +112,8 @@
     class EventTrigger;
 
+    class EventListener;
+    class EventDispatcher;
+    class EventTarget;
+
     class Controller;
     class HumanController;
Index: /code/branches/objecthierarchy/src/orxonox/objects/EventDispatcher.cc
===================================================================
--- /code/branches/objecthierarchy/src/orxonox/objects/EventDispatcher.cc	(revision 2074)
+++ /code/branches/objecthierarchy/src/orxonox/objects/EventDispatcher.cc	(revision 2074)
@@ -0,0 +1,83 @@
+/*
+ *   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:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "EventDispatcher.h"
+
+#include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
+#include "core/XMLPort.h"
+#include "core/EventIncludes.h"
+#include "EventTarget.h"
+
+namespace orxonox
+{
+    CreateFactory(EventDispatcher);
+
+    EventDispatcher::EventDispatcher(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(EventDispatcher);
+    }
+
+    EventDispatcher::~EventDispatcher()
+    {
+        if (this->isInitialized())
+            for (std::list<EventTarget*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
+                delete (*it);
+    }
+
+    void EventDispatcher::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(EventDispatcher, XMLPort, xmlelement, mode);
+
+        XMLPortObject(EventDispatcher, EventTarget, "targets", addTarget, getTarget, xmlelement, mode);
+    }
+
+    void EventDispatcher::processEvent(Event& event)
+    {
+        for (std::list<EventTarget*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
+            (*it)->fireEvent(event);
+    }
+
+    void EventDispatcher::addTarget(EventTarget* target)
+    {
+        this->targets_.push_back(target);
+    }
+
+    EventTarget* EventDispatcher::getTarget(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::list<EventTarget*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
+        {
+            if (i == index)
+                return (*it);
+            ++i;
+        }
+        return 0;
+    }
+}
Index: /code/branches/objecthierarchy/src/orxonox/objects/EventDispatcher.h
===================================================================
--- /code/branches/objecthierarchy/src/orxonox/objects/EventDispatcher.h	(revision 2074)
+++ /code/branches/objecthierarchy/src/orxonox/objects/EventDispatcher.h	(revision 2074)
@@ -0,0 +1,55 @@
+/*
+ *   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 _EventDispatcher_H__
+#define _EventDispatcher_H__
+
+#include "OrxonoxPrereqs.h"
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport EventDispatcher : public BaseObject
+    {
+        public:
+            EventDispatcher(BaseObject* creator);
+            virtual ~EventDispatcher();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            virtual void processEvent(Event& event);
+
+            void addTarget(EventTarget* target);
+            EventTarget* getTarget(unsigned int index) const;
+
+        private:
+            std::list<EventTarget*> targets_;
+    };
+}
+
+#endif /* _EventDispatcher_H__ */
Index: /code/branches/objecthierarchy/src/orxonox/objects/EventListener.cc
===================================================================
--- /code/branches/objecthierarchy/src/orxonox/objects/EventListener.cc	(revision 2074)
+++ /code/branches/objecthierarchy/src/orxonox/objects/EventListener.cc	(revision 2074)
@@ -0,0 +1,86 @@
+/*
+ *   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:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "EventListener.h"
+
+#include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+    CreateFactory(EventListener);
+
+    EventListener::EventListener(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(EventListener);
+    }
+
+    EventListener::~EventListener()
+    {
+    }
+
+    void EventListener::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(EventListener, XMLPort, xmlelement, mode);
+
+        XMLPortParam(EventListener, "event", setEventName, getEventName, xmlelement, mode);
+    }
+
+    void EventListener::processEvent(Event& event)
+    {
+        this->fireEvent(event.activate_, event.originator_);
+    }
+
+    void EventListener::setEventName(const std::string& eventname)
+    {
+        this->eventName_ = eventname;
+
+        if (this->eventName_ == "")
+            return;
+
+        for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
+            if (it->getName() == this->eventName_)
+                this->registerAsListener(*it);
+    }
+
+    void EventListener::loadedNewXMLName(BaseObject* object)
+    {
+        if (this->eventName_ == "")
+            return;
+
+        if (object->getName() == this->eventName_)
+            this->registerAsListener(object);
+    }
+
+    void EventListener::registerAsListener(BaseObject* object)
+    {
+        object->registerEventListener(this, "");
+    }
+}
Index: /code/branches/objecthierarchy/src/orxonox/objects/EventListener.h
===================================================================
--- /code/branches/objecthierarchy/src/orxonox/objects/EventListener.h	(revision 2074)
+++ /code/branches/objecthierarchy/src/orxonox/objects/EventListener.h	(revision 2074)
@@ -0,0 +1,60 @@
+/*
+ *   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 _EventListener_H__
+#define _EventListener_H__
+
+#include "OrxonoxPrereqs.h"
+#include "core/BaseObject.h"
+#include "core/XMLNameListener.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport EventListener : public BaseObject, public XMLNameListener
+    {
+        public:
+            EventListener(BaseObject* creator);
+            virtual ~EventListener();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            virtual void processEvent(Event& event);
+
+            void setEventName(const std::string& eventname);
+            inline const std::string& getEventName() const
+                { return this->eventName_; }
+
+        private:
+            virtual void loadedNewXMLName(BaseObject* object);
+            void registerAsListener(BaseObject* object);
+
+            std::string eventName_;
+    };
+}
+
+#endif /* _EventListener_H__ */
Index: /code/branches/objecthierarchy/src/orxonox/objects/EventTarget.cc
===================================================================
--- /code/branches/objecthierarchy/src/orxonox/objects/EventTarget.cc	(revision 2074)
+++ /code/branches/objecthierarchy/src/orxonox/objects/EventTarget.cc	(revision 2074)
@@ -0,0 +1,68 @@
+/*
+ *   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:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "EventTarget.h"
+
+#include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
+
+namespace orxonox
+{
+    CreateFactory(EventTarget);
+
+    EventTarget::EventTarget(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(EventTarget);
+    }
+
+    EventTarget::~EventTarget()
+    {
+    }
+
+    void EventTarget::changedName()
+    {
+        for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
+            if (it->getName() == this->getName())
+                this->addAsEvent(*it);
+    }
+
+    void EventTarget::loadedNewXMLName(BaseObject* object)
+    {
+        if (this->getName() == "")
+            return;
+
+        if (object->getName() == this->getName())
+            this->addAsEvent(object);
+    }
+
+    void EventTarget::addAsEvent(BaseObject* object)
+    {
+        object->addEvent(this, "");
+    }
+}
Index: /code/branches/objecthierarchy/src/orxonox/objects/EventTarget.h
===================================================================
--- /code/branches/objecthierarchy/src/orxonox/objects/EventTarget.h	(revision 2074)
+++ /code/branches/objecthierarchy/src/orxonox/objects/EventTarget.h	(revision 2074)
@@ -0,0 +1,52 @@
+/*
+ *   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 _EventTarget_H__
+#define _EventTarget_H__
+
+#include "OrxonoxPrereqs.h"
+#include "core/BaseObject.h"
+#include "core/XMLNameListener.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport EventTarget : public BaseObject, public XMLNameListener
+    {
+        public:
+            EventTarget(BaseObject* creator);
+            virtual ~EventTarget();
+
+            virtual void changedName();
+
+        private:
+            virtual void loadedNewXMLName(BaseObject* object);
+            void addAsEvent(BaseObject* object);
+    };
+}
+
+#endif /* _EventTarget_H__ */
