Index: code/trunk/src/orxonox/weaponsystem/WeaponMode.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponMode.cc	(revision 5929)
+++ code/trunk/src/orxonox/weaponsystem/WeaponMode.cc	(revision 6417)
@@ -32,4 +32,6 @@
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
+#include "controllers/Controller.h"
+#include "worldentities/pawns/Pawn.h"
 
 #include "Munition.h"
@@ -37,4 +39,7 @@
 #include "WeaponPack.h"
 #include "WeaponSystem.h"
+#include "WeaponSlot.h"
+
+#include "sound/WorldSound.h"
 
 namespace orxonox
@@ -61,9 +66,26 @@
 
         this->damage_ = 0;
+
         this->muzzleOffset_ = Vector3::ZERO;
+        this->muzzlePosition_ = Vector3::ZERO;
+        this->muzzleOrientation_ = Quaternion::IDENTITY;
+
+        if( GameMode::isMaster() )
+        {
+            this->defSndWpnFire_ = new WorldSound(this);
+            this->defSndWpnFire_->setLooping(false);
+            this->bSoundAttached_ = false;
+        }
+        else
+            this->defSndWpnFire_ = 0;
     }
 
     WeaponMode::~WeaponMode()
     {
+        if (this->isInitialized())
+        {
+            if (this->defSndWpnFire_)
+                this->defSndWpnFire_->destroy();
+        }
     }
 
@@ -90,4 +112,10 @@
     {
         (*reloadTime) = this->reloadTime_;
+        if( !this->bSoundAttached_ && GameMode::isMaster() )
+        {
+            assert(this->getWeapon());
+            this->getWeapon()->attach(this->defSndWpnFire_);
+            this->bSoundAttached_ = true;
+        }
 
         if (!this->bReloading_ && this->munition_ && this->munition_->takeMunition(this->munitionPerShot_, this))
@@ -108,4 +136,9 @@
             this->reloadTimer_.startTimer();
 
+            if( this->defSndWpnFire_ && !(this->defSndWpnFire_->isPlaying()))
+            {
+                this->defSndWpnFire_->play();
+            }
+
             this->fire();
 
@@ -145,5 +178,9 @@
     {
         this->munitionname_ = munitionname;
-        this->munitiontype_ = ClassByString(this->munitionname_);
+        Identifier* identifier = ClassByString(this->munitionname_);
+        if (identifier)
+            this->munitiontype_ = identifier;
+        else
+            COUT(2) << "Warning: No munition class defined in WeaponMode " << this->getName() << std::endl;
         this->updateMunition();
     }
@@ -191,29 +228,49 @@
     void WeaponMode::reloaded()
     {
+        if( this->defSndWpnFire_ && this->defSndWpnFire_->isPlaying())
+        {
+            this->defSndWpnFire_->stop();
+        }
         this->bReloading_ = false;
     }
 
-    Vector3 WeaponMode::getMuzzlePosition() const
+    void WeaponMode::computeMuzzleParameters(const Vector3& target)
     {
         if (this->weapon_)
-            return (this->weapon_->getWorldPosition() + this->weapon_->getWorldOrientation() * this->muzzleOffset_);
-        else
-            return this->muzzleOffset_;
-    }
-
-    const Quaternion& WeaponMode::getMuzzleOrientation() const
+        {
+            this->muzzlePosition_ = this->weapon_->getWorldPosition() + this->weapon_->getWorldOrientation() * this->muzzleOffset_;
+
+            Vector3 muzzleDirection;
+            muzzleDirection = target - this->muzzlePosition_;
+//             COUT(0) << "muzzleDirection " << muzzleDirection << endl;
+            this->muzzleOrientation_ = (this->weapon_->getWorldOrientation() * WorldEntity::FRONT).getRotationTo(muzzleDirection) * this->weapon_->getWorldOrientation();
+        }
+        else
+        {
+            this->muzzlePosition_ = this->muzzleOffset_;
+            this->muzzleOrientation_ = Quaternion::IDENTITY;
+        }
+    }
+
+    Vector3 WeaponMode::getMuzzleDirection() const
     {
         if (this->weapon_)
-            return this->weapon_->getWorldOrientation();
-        else
-            return Quaternion::IDENTITY;
-    }
-
-    Vector3 WeaponMode::getMuzzleDirection() const
-    {
-        if (this->weapon_)
-            return (this->weapon_->getWorldOrientation() * WorldEntity::FRONT);
+            return (this->getMuzzleOrientation() * WorldEntity::FRONT);
         else
             return WorldEntity::FRONT;
     }
+
+    void WeaponMode::setDefaultSound(const std::string& soundPath)
+    {
+        if( this->defSndWpnFire_ )
+            this->defSndWpnFire_->setSource(soundPath);
+    }
+
+    const std::string& WeaponMode::getDefaultSound()
+    {
+        if( this->defSndWpnFire_ )
+            return this->defSndWpnFire_->getSource();
+        else
+            return BLANKSTRING;
+    }
 }
Index: code/trunk/src/orxonox/weaponsystem/WeaponMode.h
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponMode.h	(revision 5929)
+++ code/trunk/src/orxonox/weaponsystem/WeaponMode.h	(revision 6417)
@@ -51,4 +51,8 @@
             bool fire(float* reloadTime);
             bool reload();
+
+            // Interacting with the default Firing sound
+            void setDefaultSound(const std::string& soundPath);
+            const std::string& getDefaultSound();
 
 
@@ -109,6 +113,9 @@
                 { return this->muzzleOffset_; }
 
-            Vector3 getMuzzlePosition() const;
-            const Quaternion& getMuzzleOrientation() const;
+            void computeMuzzleParameters(const Vector3& target);
+            const Vector3& getMuzzlePosition() const
+                { return this->muzzlePosition_; }
+            const Quaternion& getMuzzleOrientation() const
+                { return this->muzzleOrientation_; }
             Vector3 getMuzzleDirection() const;
 
@@ -124,4 +131,6 @@
             inline unsigned int getMode() const
                 { return this->mode_; }
+
+            Vector3 getTarget();
 
         protected:
@@ -152,4 +161,10 @@
             Timer reloadTimer_;
             bool bReloading_;
+
+            Vector3 muzzlePosition_;
+            Quaternion muzzleOrientation_;
+
+            WorldSound* defSndWpnFire_;
+            bool        bSoundAttached_;
     };
 }
Index: code/trunk/src/orxonox/weaponsystem/WeaponPack.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponPack.cc	(revision 5929)
+++ code/trunk/src/orxonox/weaponsystem/WeaponPack.cc	(revision 6417)
@@ -49,7 +49,8 @@
     WeaponPack::~WeaponPack()
     {
-        if (this->isInitialized() && this->weaponSystem_)
+        if (this->isInitialized())
         {
-            this->weaponSystem_->removeWeaponPack(this);
+            if( this->weaponSystem_ )
+                this->weaponSystem_->removeWeaponPack(this);
 
             while (!this->weapons_.empty())
@@ -71,5 +72,5 @@
     void WeaponPack::fire(unsigned int weaponmode)
     {
-        for (std::set<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
+        for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
             (*it)->fire(weaponmode);
     }
@@ -77,5 +78,5 @@
     void WeaponPack::reload()
     {
-        for (std::set<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
+        for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
             (*it)->reload();
     }
@@ -86,5 +87,5 @@
             return;
 
-        this->weapons_.insert(weapon);
+        this->weapons_.push_back(weapon);
         weapon->setWeaponPack(this);
     }
@@ -95,5 +96,7 @@
             return;
 
-        this->weapons_.erase(weapon);
+        std::vector<Weapon*>::iterator it = std::find(this->weapons_.begin(), this->weapons_.end(), weapon);
+        assert(it != this->weapons_.end());
+        this->weapons_.erase(it);
         weapon->setWeaponPack(0);
     }
@@ -103,5 +106,5 @@
         unsigned int i = 0;
 
-        for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
+        for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
         {
             if (i == index)
@@ -142,5 +145,5 @@
     void WeaponPack::notifyWeapons()
     {
-        for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
+        for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
             (*it)->setWeaponPack(this);
     }
Index: code/trunk/src/orxonox/weaponsystem/WeaponPack.h
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponPack.h	(revision 5929)
+++ code/trunk/src/orxonox/weaponsystem/WeaponPack.h	(revision 6417)
@@ -69,5 +69,5 @@
             void notifyWeapons();
 
-            std::set<Weapon *> weapons_;
+            std::vector<Weapon *> weapons_;
             std::set<DefaultWeaponmodeLink *> links_;
             WeaponSystem * weaponSystem_;
Index: code/trunk/src/orxonox/weaponsystem/WeaponSystem.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponSystem.cc	(revision 5929)
+++ code/trunk/src/orxonox/weaponsystem/WeaponSystem.cc	(revision 6417)
@@ -202,5 +202,5 @@
         }
 
-        this->weaponPacks_.insert(wPack);
+        this->weaponPacks_.push_back(wPack);
         wPack->setWeaponSystem(this);
 
@@ -221,5 +221,7 @@
 
         // Remove the WeaponPack from the WeaponSystem
-        this->weaponPacks_.erase(wPack);
+        std::vector<WeaponPack*>::iterator it = std::find(this->weaponPacks_.begin(),this->weaponPacks_.end(), wPack);
+        assert(it !=this->weaponPacks_.end());
+        this->weaponPacks_.erase(it);
     }
 
@@ -227,5 +229,5 @@
     {
         unsigned int i = 0;
-        for (std::set<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
+        for (std::vector<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
         {
             ++i;
@@ -258,5 +260,5 @@
 
         // Check if the WeaponPack belongs to this WeaponSystem
-        std::set<WeaponPack *>::iterator it1 = this->weaponPacks_.find(wPack);
+        std::vector<WeaponPack *>::iterator it1 = std::find( this->weaponPacks_.begin(), this->weaponPacks_.end(), wPack );
         if (it1 == this->weaponPacks_.end())
             return;
Index: code/trunk/src/orxonox/weaponsystem/WeaponSystem.h
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponSystem.h	(revision 5929)
+++ code/trunk/src/orxonox/weaponsystem/WeaponSystem.h	(revision 6417)
@@ -92,5 +92,5 @@
             std::map<unsigned int, WeaponSet *> weaponSets_;
             std::vector<WeaponSlot *> weaponSlots_;
-            std::set<WeaponPack *> weaponPacks_;
+            std::vector<WeaponPack *> weaponPacks_;
             std::map<Identifier *, Munition *> munitions_;
             Pawn * pawn_;
