Index: code/branches/weapons/src/orxonox/objects/weaponSystem/Weapon.cc
===================================================================
--- code/branches/weapons/src/orxonox/objects/weaponSystem/Weapon.cc	(revision 2913)
+++ code/branches/weapons/src/orxonox/objects/weaponSystem/Weapon.cc	(revision 2914)
@@ -47,5 +47,6 @@
         this->magazineReadyToShoot_ = true;
         this->weaponSystem_ = 0;
-        this->attachedToWeaponSlot_ = 0;
+        this->weaponPack_ = 0;
+        this->weaponSlot_ = 0;
         this->bulletLoadingTime_ = 0;
         this->magazineLoadingTime_ = 0;
Index: code/branches/weapons/src/orxonox/objects/weaponSystem/Weapon.h
===================================================================
--- code/branches/weapons/src/orxonox/objects/weaponSystem/Weapon.h	(revision 2913)
+++ code/branches/weapons/src/orxonox/objects/weaponSystem/Weapon.h	(revision 2914)
@@ -86,8 +86,13 @@
                 { return this->weaponSystem_; };
 
-            inline void setAttachedToWeaponSlot(WeaponSlot * wSlot)
-                { this->attachedToWeaponSlot_ = wSlot; }
-            inline WeaponSlot * getAttachedToWeaponSlot() const
-                { return this->attachedToWeaponSlot_; }
+            inline void setWeaponPack(WeaponPack *weaponPack)
+                { this->weaponPack_ = weaponPack; };
+            inline WeaponPack * getWeaponPack() const
+                { return this->weaponPack_; };
+
+            inline void setWeaponSlot(WeaponSlot * wSlot)
+                { this->weaponSlot_ = wSlot; }
+            inline WeaponSlot * getWeaponSlot() const
+                { return this->weaponSlot_; }
 
         protected:
@@ -102,7 +107,8 @@
             std::string munitionType_;
 
-            WeaponSlot * attachedToWeaponSlot_;
+            WeaponSlot * weaponSlot_;
             Munition * munition_;
             WeaponSystem * weaponSystem_;
+            WeaponPack* weaponPack_;
 
             SubclassIdentifier<Munition> munitionIdentifier_;
Index: code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponPack.cc
===================================================================
--- code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponPack.cc	(revision 2913)
+++ code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponPack.cc	(revision 2914)
@@ -35,4 +35,5 @@
 #include "Weapon.h"
 #include "WeaponSlot.h"
+#include "WeaponSystem.h"
 
 namespace orxonox
@@ -45,5 +46,4 @@
 
         this->weaponSystem_ = 0;
-        this->firemode_ = 0;
 
 COUT(0) << "+WeaponPack" << std::endl;
@@ -53,4 +53,7 @@
     {
 COUT(0) << "~WeaponPack" << std::endl;
+
+        if (this->isInitialized() && this->weaponSystem_)
+            this->weaponSystem_->removeWeaponPack(this);
     }
 
@@ -60,57 +63,47 @@
 
         XMLPortObject(WeaponPack, Weapon, "", addWeapon, getWeapon, xmlelement, mode);
-        XMLPortParam(WeaponPack, "firemode", setFireMode, getFireMode, xmlelement, mode);
     }
 
-    int WeaponPack::getSize() const
+    void WeaponPack::fire(unsigned int weaponmode)
     {
-        return this->weapons_.size();
-    }
-
-    void WeaponPack::fire()
-    {
-        for (int i=0; i < (int) this->weapons_.size(); i++)
-        {
-            this->weapons_[i]->getAttachedToWeaponSlot()->fire();
-        }
-    }
-
-    Weapon * WeaponPack::getWeaponPointer(unsigned int n) const
-    {
-        return this->weapons_[n];
-    }
-
-    void WeaponPack::setFireMode(unsigned int firemode)
-    {
-        this->firemode_ = firemode;
-    }
-
-    unsigned int WeaponPack::getFireMode() const
-    {
-        return this->firemode_;
+        for (std::set<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
+            (*it)->fire();
     }
 
     void WeaponPack::addWeapon(Weapon * weapon)
     {
-        this->weapons_.push_back(weapon);
+        if (!weapon)
+            return;
+
+        this->weapons_.insert(weapon);
+        weapon->setWeaponPack(this);
     }
 
-    const Weapon * WeaponPack::getWeapon(unsigned int index) const
+    Weapon * WeaponPack::getWeapon(unsigned int index) const
     {
-        return weapons_[index];
+        unsigned int i = 0;
+
+        for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
+        {
+            if (i == index)
+                return (*it);
+            ++i;
+        }
+
+        return 0;
     }
 
     void WeaponPack::setWeaponSystemToAllWeapons(WeaponSystem * weaponSystem)
     {
-        for (size_t i = 0; i < this->weapons_.size(); i++)
-            this->weapons_[i]->setWeaponSystem(weaponSystem);
+        for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
+            (*it)->setWeaponSystem(weaponSystem);
     }
 
     void WeaponPack::attachNeededMunitionToAllWeapons()
     {
-        for (size_t i = 0; i < this->weapons_.size(); i++)
+        for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
         {
-            this->weapons_[i]->attachNeededMunition(weapons_[i]->getMunitionType());
-            this->weapons_[i]->setWeapon();
+            (*it)->attachNeededMunition((*it)->getMunitionType());
+            (*it)->setWeapon();
         }
     }
Index: code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponPack.h
===================================================================
--- code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponPack.h	(revision 2913)
+++ code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponPack.h	(revision 2914)
@@ -33,5 +33,5 @@
 #include "OrxonoxPrereqs.h"
 
-#include <vector>
+#include <set>
 
 #include "core/BaseObject.h"
@@ -47,19 +47,16 @@
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
-            void fire();
-
-            Weapon * getWeaponPointer(unsigned int n) const;
-            int getSize() const;
-
-            void setFireMode(unsigned int firemode);
-            unsigned int getFireMode() const;
+            void fire(unsigned int weaponmode);
 
             void addWeapon(Weapon * weapon);
-            const Weapon * getWeapon(unsigned int index) const;
+            Weapon * getWeapon(unsigned int index) const;
+
+            inline size_t getNumWeapons() const
+                { return this->weapons_.size(); }
+
+            unsigned int getDesiredWeaponmode(unsigned int firemode) { return 0; } // TODO
 
             void attachNeededMunitionToAllWeapons();
 
-            //functions with effect to all weapons of the weaponPack
-            //functions needed for creating Pointer to the right objects (-->Pawn.cc)
             inline void setWeaponSystem(WeaponSystem *weaponSystem)
                 { this->weaponSystem_ = weaponSystem; this->setWeaponSystemToAllWeapons(weaponSystem); }
@@ -70,7 +67,6 @@
             void setWeaponSystemToAllWeapons(WeaponSystem * weaponSystem);
 
-            std::vector<Weapon *> weapons_;
-            WeaponSystem *weaponSystem_;
-            unsigned int firemode_;
+            std::set<Weapon *> weapons_;
+            WeaponSystem * weaponSystem_;
     };
 }
Index: code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSet.cc
===================================================================
--- code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSet.cc	(revision 2913)
+++ code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSet.cc	(revision 2914)
@@ -31,10 +31,7 @@
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
-#include "objects/worldentities/pawns/Pawn.h"
 
-#include "Weapon.h"
-#include "WeaponSlot.h"
+#include "WeaponSystem.h"
 #include "WeaponPack.h"
-#include "WeaponSystem.h"
 
 namespace orxonox
@@ -42,10 +39,10 @@
     CreateFactory(WeaponSet);
 
-    WeaponSet::WeaponSet(BaseObject* creator, int k) : BaseObject(creator)
+    WeaponSet::WeaponSet(BaseObject* creator) : BaseObject(creator)
     {
         RegisterObject(WeaponSet);
 
         this->weaponSystem_ = 0;
-        this->attachedWeaponPack_ = 0;
+        this->desiredFiremode_ = WeaponSystem::FIRE_MODE_UNASSIGNED;
 
 COUT(0) << "+WeaponSet" << std::endl;
@@ -55,4 +52,7 @@
     {
 COUT(0) << "~WeaponSet" << std::endl;
+
+        if (this->isInitialized() && this->weaponSystem_)
+            this->weaponSystem_->removeWeaponSet(this);
     }
 
@@ -61,7 +61,7 @@
         SUPER(WeaponSet, XMLPort, xmlelement, mode);
 
-        XMLPortParam(WeaponSet, "firemode", setFireMode, getFireMode, xmlelement, mode);
+        XMLPortParam(WeaponSet, "firemode", setDesiredFiremode, getDesiredFiremode, xmlelement, mode);
     }
-
+/*
     void WeaponSet::attachWeaponPack(WeaponPack *wPack)
     {
@@ -100,11 +100,31 @@
         }
     }
-
+*/
 
     void WeaponSet::fire()
     {
-        //fires all WeaponSlots available for this weaponSet attached from the WeaponPack
-        if (this->attachedWeaponPack_)
-            this->attachedWeaponPack_->fire();
+        // fire all WeaponPacks with their defined weaponmode
+        for (std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.begin(); it != this->weaponpacks_.end(); ++it)
+            if (it->second != WeaponSystem::WEAPON_MODE_UNASSIGNED)
+                it->first->fire(it->second);
+    }
+
+    void WeaponSet::setWeaponmodeLink(WeaponPack* weaponpack, unsigned int weaponmode)
+    {
+        this->weaponpacks_[weaponpack] = weaponmode;
+    }
+
+    void WeaponSet::removeWeaponmodeLink(WeaponPack* weaponpack)
+    {
+        this->weaponpacks_.erase(weaponpack);
+    }
+
+    unsigned int WeaponSet::getWeaponmodeLink(WeaponPack* weaponpack)
+    {
+        std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.find(weaponpack);
+        if (it != this->weaponpacks_.end())
+            return it->second;
+        else
+            return WeaponSystem::WEAPON_MODE_UNASSIGNED;
     }
 }
Index: code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSet.h
===================================================================
--- code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSet.h	(revision 2913)
+++ code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSet.h	(revision 2914)
@@ -33,5 +33,5 @@
 #include "OrxonoxPrereqs.h"
 
-#include <vector>
+#include <map>
 
 #include "core/BaseObject.h"
@@ -42,16 +42,21 @@
     {
         public:
-            WeaponSet(BaseObject* creator, int k = 0);
+            WeaponSet(BaseObject* creator);
             virtual ~WeaponSet();
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
-            void attachWeaponPack(WeaponPack *wPack);
+//            void attachWeaponPack(WeaponPack *wPack);
+
             void fire();
 
-            inline void setFireMode(const unsigned int firemode)
-                { this->firemode_ = firemode; }
-            inline unsigned int getFireMode() const
-                { return this->firemode_; }
+            void setWeaponmodeLink(WeaponPack* weaponpack, unsigned int weaponmode);
+            void removeWeaponmodeLink(WeaponPack* weaponpack);
+            unsigned int getWeaponmodeLink(WeaponPack* weaponpack);
+
+            inline void setDesiredFiremode(const unsigned int firemode)
+                { this->desiredFiremode_ = firemode; }
+            inline unsigned int getDesiredFiremode() const
+                { return this->desiredFiremode_; }
 
             inline void setWeaponSystem(WeaponSystem *weaponSystem)
@@ -62,7 +67,6 @@
         private:
             WeaponSystem *weaponSystem_;
-            std::vector<WeaponSlot *> setWeaponSlots_;
-            unsigned int firemode_;
-            WeaponPack * attachedWeaponPack_;
+            unsigned int desiredFiremode_;
+            std::map<WeaponPack*, unsigned int> weaponpacks_;
     };
 }
Index: code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSlot.cc
===================================================================
--- code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSlot.cc	(revision 2913)
+++ code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSlot.cc	(revision 2914)
@@ -34,4 +34,5 @@
 
 #include "Weapon.h"
+#include "WeaponSystem.h"
 
 namespace orxonox
@@ -43,6 +44,7 @@
         RegisterObject(WeaponSlot);
 
-        this->unlimitedAmmo_ = false;
-        this->attachedWeapon_ = 0;
+        this->weaponSystem_ = 0;
+        this->weapon_ = 0;
+
         this->setObjectMode(0x0);
 
@@ -53,4 +55,7 @@
     {
 COUT(0) << "~WeaponSlot" << std::endl;
+
+        if (this->isInitialized() && this->weaponSystem_)
+            this->weaponSystem_->removeWeaponSlot(this);
     }
 
@@ -58,34 +63,29 @@
     {
         SUPER(WeaponSlot, XMLPort, xmlelement, mode);
-    }
 
-    /*sets the munition type
-     *unlimited: true
-     *limited:   false  (in this case there will be munition)
-     */
-    void WeaponSlot::setAmmoType(bool isUnlimited)
-    {
-        unlimitedAmmo_ = isUnlimited;
-    }
-
-
-    void WeaponSlot::fire()
-    {
-        if ( this->attachedWeapon_ )
-//COUT(0) << "WeaponSlot::fire" << std::endl;
-        this->attachedWeapon_->fire();
+        // ...
     }
 
     void WeaponSlot::attachWeapon(Weapon *weapon)
     {
-        this->attachedWeapon_ = weapon;
-        weapon->setAttachedToWeaponSlot(this);
-//COUT(0) << "WeaponSlot::attachWeapon position=" << this->getWorldPosition() << std::endl;
-        weapon->setPosition(this->getPosition());
+        if (this->weapon_)
+            this->removeWeapon();
+
+        this->weapon_ = weapon;
+
+        if (this->weapon_)
+        {
+            this->weapon_->setWeaponSlot(this);
+            this->weapon_->setPosition(this->getPosition());
+        }
     }
 
-    Weapon * WeaponSlot::getAttachedWeapon() const
+    void WeaponSlot::removeWeapon()
     {
-        return this->attachedWeapon_;
+        if (this->weapon_)
+        {
+            this->weapon_->setWeaponSlot(0);
+            this->weapon_ = 0;
+        }
     }
 }
Index: code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSlot.h
===================================================================
--- code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSlot.h	(revision 2913)
+++ code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSlot.h	(revision 2914)
@@ -43,10 +43,13 @@
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
-            void attachWeapon(Weapon *weapon);
-            Weapon * getAttachedWeapon() const;
-            void setAmmoType(bool isUnlimited);
-            void fire();
+            void attachWeapon(Weapon * weapon);
+            void removeWeapon();
+            Weapon * getWeapon() const
+                { return this->weapon_; }
 
-            inline void setWeaponSystem(WeaponSystem *weaponSystem)
+            inline bool isOccupied() const
+                { return (this->weapon_ != 0); }
+
+            inline void setWeaponSystem(WeaponSystem * weaponSystem)
                 { this->weaponSystem_ = weaponSystem; }
             inline WeaponSystem * getWeaponSystem() const
@@ -55,8 +58,6 @@
 
         private:
-            Weapon *attachedWeapon_;
-            bool unlimitedAmmo_;
-
-            WeaponSystem *weaponSystem_;
+            WeaponSystem * weaponSystem_;
+            Weapon * weapon_;
     };
 }
Index: code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSystem.cc
===================================================================
--- code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSystem.cc	(revision 2913)
+++ code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSystem.cc	(revision 2914)
@@ -36,4 +36,5 @@
 #include "WeaponPack.h"
 #include "WeaponSet.h"
+#include "Weapon.h"
 
 /* WeaponSystem
@@ -61,14 +62,81 @@
             if (this->pawn_)
                 this->pawn_->setWeaponSystem(0);
-        }
-    }
-
-    void WeaponSystem::attachWeaponSet(WeaponSet *wSet)
-    {
-        if (!wSet)
-            return;
-
-        this->weaponSets_[wSet->getFireMode()] = wSet;
-        wSet->setWeaponSystem(this);
+
+            for (std::map<unsigned int, WeaponSet*>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); )
+                delete (it++)->second;
+
+            for (std::set<WeaponPack*>::iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); )
+                delete (*(it++));
+
+            for (std::set<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); )
+                delete (*(it++));
+        }
+    }
+
+    void WeaponSystem::addWeaponSlot(WeaponSlot * wSlot)
+    {
+        if (!wSlot)
+            return;
+
+        this->weaponSlots_.insert(wSlot);
+        wSlot->setWeaponSystem(this);
+    }
+
+    void WeaponSystem::removeWeaponSlot(WeaponSlot * wSlot)
+    {
+        if (!wSlot)
+            return;
+
+        if (wSlot->getWeapon())
+            this->removeWeaponPack(wSlot->getWeapon()->getWeaponPack());
+
+        this->weaponSlots_.erase(wSlot);
+    }
+
+    WeaponSlot * WeaponSystem::getWeaponSlot(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::set<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
+        {
+            ++i;
+            if (i > index)
+                return (*it);
+        }
+        return 0;
+    }
+
+    bool WeaponSystem::addWeaponSet(WeaponSet * wSet)
+    {
+        if (wSet)
+            return this->addWeaponSet(wSet, wSet->getDesiredFiremode());
+        else
+            return false;
+    }
+
+    bool WeaponSystem::addWeaponSet(WeaponSet * wSet, unsigned int firemode)
+    {
+        if (!wSet || firemode >= WeaponSystem::MAX_FIRE_MODES)
+            return false;
+
+        std::map<unsigned int, WeaponSet*>::const_iterator it = this->weaponSets_.find(firemode);
+        if (it == this->weaponSets_.end())
+        {
+            this->weaponSets_[firemode] = wSet;
+            wSet->setWeaponSystem(this);
+            return true;
+        }
+
+        return false;
+    }
+
+    void WeaponSystem::removeWeaponSet(WeaponSet * wSet)
+    {
+        for (std::map<unsigned int, WeaponSet*>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); )
+        {
+            if (it->second == wSet)
+                this->weaponSets_.erase(it++);
+            else
+                ++it;
+        }
     }
 
@@ -85,17 +153,72 @@
     }
 
-    void WeaponSystem::attachWeaponSlot(WeaponSlot *wSlot)
-    {
-        if (!wSlot)
-            return;
-
-        this->weaponSlots_.insert(wSlot);
-        wSlot->setWeaponSystem(this);
-    }
-
-    WeaponSlot * WeaponSystem::getWeaponSlot(unsigned int index) const
-    {
-        unsigned int i = 0;
+    bool WeaponSystem::canAddWeaponPack(WeaponPack * wPack)
+    {
+        if (!wPack)
+            return false;
+
+        unsigned int freeSlots = 0;
         for (std::set<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
+        {
+            if (!(*it)->isOccupied())
+                ++freeSlots;
+        }
+
+        return (freeSlots >= wPack->getNumWeapons());
+    }
+
+    bool WeaponSystem::addWeaponPack(WeaponPack * wPack)
+    {
+        if (!this->canAddWeaponPack(wPack))
+            return false;
+
+        // Attach all weapons to the first free slots (and to the Pawn)
+        unsigned int i = 0;
+        for (std::set<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
+        {
+            if (!(*it)->isOccupied() && i < wPack->getNumWeapons())
+            {
+                Weapon* weapon = wPack->getWeapon(i);
+                (*it)->attachWeapon(weapon);
+                this->getPawn()->attach(weapon);
+                ++i;
+            }
+        }
+
+        // Assign the desired weaponmode to the firemodes
+        for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
+        {
+            unsigned int weaponmode = wPack->getDesiredWeaponmode(it->first);
+            if (weaponmode != WeaponSystem::WEAPON_MODE_UNASSIGNED)
+                it->second->setWeaponmodeLink(wPack, weaponmode);
+        }
+
+        this->weaponPacks_.insert(wPack);
+        wPack->setWeaponSystem(this);
+        wPack->attachNeededMunitionToAllWeapons(); // TODO - what is this?
+
+        return true;
+    }
+
+    void WeaponSystem::removeWeaponPack(WeaponPack * wPack)
+    {
+        // Remove all weapons from their WeaponSlot
+        unsigned int i = 0;
+        Weapon* weapon = 0;
+        while (weapon = wPack->getWeapon(i++))
+            weapon->getWeaponSlot()->removeWeapon();
+
+        // Remove all added links from the WeaponSets
+        for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
+            it->second->removeWeaponmodeLink(wPack);
+
+        // Remove the WeaponPack from the WeaponSystem
+        this->weaponPacks_.erase(wPack);
+    }
+
+    WeaponPack * WeaponSystem::getWeaponPack(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::set<WeaponPack*>::iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
         {
             ++i;
@@ -106,29 +229,35 @@
     }
 
-    void WeaponSystem::attachWeaponPack(WeaponPack *wPack, unsigned int wSetNumber)
-    {
-        if (!wPack)
-            return;
-
-        std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(wSetNumber);
-        if (it != this->weaponSets_.end() && it->second)
-            it->second->attachWeaponPack(wPack);
-
-        this->weaponPacks_.insert(wPack);
-        wPack->setWeaponSystem(this);
-        wPack->attachNeededMunitionToAllWeapons(); // TODO - what is this?
-    }
-
-    WeaponPack * WeaponSystem::getWeaponPack(unsigned int index) const
-    {
-        unsigned int i = 0;
-        for (std::set<WeaponPack*>::iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
-        {
-            ++i;
-            if (i > index)
-                return (*it);
-        }
-        return 0;
-   }
+    bool WeaponSystem::swapWeaponSlots(WeaponSlot * wSlot1, WeaponSlot * wSlot2)
+    {
+        // TODO
+    }
+
+    void WeaponSystem::changeWeaponmode(WeaponPack * wPack, WeaponSet * wSet, unsigned int weaponmode)
+    {
+        if (!wPack || !wSet)
+            return;
+
+        // Check if the WeaponPack belongs to this WeaponSystem
+        std::set<WeaponPack *>::iterator it1 = this->weaponPacks_.find(wPack);
+        if (it1 == this->weaponPacks_.end())
+            return;
+
+        // Check if the WeaponSet belongs to this WeaponSystem
+        bool foundWeaponSet = false;
+        for (std::map<unsigned int, WeaponSet *>::iterator it2 = this->weaponSets_.begin(); it2 != this->weaponSets_.end(); ++it2)
+        {
+            if (it2->second == wSet)
+            {
+                foundWeaponSet = true;
+                break;
+            }
+        }
+        if (!foundWeaponSet)
+            return;
+
+        // Finally set the link between firemode and weaponmode
+        wSet->setWeaponmodeLink(wPack, weaponmode);
+    }
 
     void WeaponSystem::setNewMunition(const std::string& munitionType, Munition * munitionToAdd)
@@ -148,8 +277,4 @@
     }
 
-
-    //n is the n'th weaponSet, starting with zero
-    //SpaceShip.cc only needs to have the keybinding to a specific Set-number n (=firemode)
-    //in future this could be well defined and not only for 3 different WeaponModes
     void WeaponSystem::fire(unsigned int firemode)
     {
Index: code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSystem.h
===================================================================
--- code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSystem.h	(revision 2913)
+++ code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSystem.h	(revision 2914)
@@ -40,6 +40,4 @@
 namespace orxonox
 {
-    const unsigned int MAX_FIRE_MODES = 8;
-
     class _OrxonoxExport WeaponSystem : public BaseObject
     {
@@ -48,14 +46,27 @@
             virtual ~WeaponSystem();
 
-            void attachWeaponSlot(WeaponSlot * wSlot);
+            // adding and removing WeaponSlots
+            void addWeaponSlot(WeaponSlot * wSlot);
+            void removeWeaponSlot(WeaponSlot * wSlot);
             WeaponSlot * getWeaponSlot(unsigned int index) const;
 
-            void attachWeaponSet(WeaponSet * wSet);
+            // adding and removing WeaponSets
+            bool addWeaponSet(WeaponSet * wSet);
+            bool addWeaponSet(WeaponSet * wSet, unsigned int firemode);
+            void removeWeaponSet(WeaponSet * wSet);
             WeaponSet * getWeaponSet(unsigned int index) const;
 
-            void attachWeaponPack(WeaponPack * wPack, unsigned int wSetNumber);
+            // adding and removing WeaponPacks
+            bool canAddWeaponPack(WeaponPack * wPack);
+            bool addWeaponPack(WeaponPack * wPack);
+            void removeWeaponPack(WeaponPack * wPack);
             WeaponPack * getWeaponPack(unsigned int index) const;
 
+            // configure slots and firemodes
+            bool swapWeaponSlots(WeaponSlot * wSlot1, WeaponSlot * wSlot2);
+            void changeWeaponmode(WeaponPack * wPack, WeaponSet * wSet, unsigned int weaponmode);
+
             void fire(unsigned int firemode);
+
 
             void setNewMunition(const std::string& munitionType, Munition * munitionToAdd);
@@ -71,8 +82,12 @@
                 { return this->weaponSlots_.size(); }
 
-            static inline unsigned int getMaxFireModes()
-                { return MAX_FIRE_MODES; }
-            static inline unsigned int getFireModeMask(unsigned int firemode)
+            static inline unsigned int getFiremodeMask(unsigned int firemode)
                 { return (0x1 << firemode); }
+
+            static const unsigned int MAX_FIRE_MODES = 8;
+            static const unsigned int FIRE_MODE_UNASSIGNED = (unsigned int)-1;
+
+            static const unsigned int MAX_WEAPON_MODES = 8;
+            static const unsigned int WEAPON_MODE_UNASSIGNED = (unsigned int)-1;
 
         private:
Index: code/branches/weapons/src/orxonox/objects/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/weapons/src/orxonox/objects/worldentities/pawns/Pawn.cc	(revision 2913)
+++ code/branches/weapons/src/orxonox/objects/worldentities/pawns/Pawn.cc	(revision 2914)
@@ -123,6 +123,6 @@
         if (this->weaponSystem_)
         {
-            for (unsigned int firemode = 0; firemode < WeaponSystem::getMaxFireModes(); firemode++)
-                if (this->fire_ & WeaponSystem::getFireModeMask(firemode))
+            for (unsigned int firemode = 0; firemode < WeaponSystem::MAX_FIRE_MODES; firemode++)
+                if (this->fire_ & WeaponSystem::getFiremodeMask(firemode))
                     this->weaponSystem_->fire(firemode);
         }
@@ -255,5 +255,5 @@
     void Pawn::fire(unsigned int firemode)
     {
-        this->firehack_ |= WeaponSystem::getFireModeMask(firemode);
+        this->firehack_ |= WeaponSystem::getFiremodeMask(firemode);
     }
 
@@ -280,5 +280,5 @@
         this->attach(wSlot);
         if (this->weaponSystem_)
-            this->weaponSystem_->attachWeaponSlot(wSlot);
+            this->weaponSystem_->addWeaponSlot(wSlot);
     }
 
@@ -291,28 +291,28 @@
     }
 
+    void Pawn::addWeaponSet(WeaponSet * wSet)
+    {
+        if (this->weaponSystem_)
+            this->weaponSystem_->addWeaponSet(wSet);
+    }
+
+    WeaponSet * Pawn::getWeaponSet(unsigned int index) const
+    {
+        if (this->weaponSystem_)
+            return this->weaponSystem_->getWeaponSet(index);
+        else
+            return 0;
+    }
+
     void Pawn::addWeaponPack(WeaponPack * wPack)
     {
         if (this->weaponSystem_)
-            this->weaponSystem_->attachWeaponPack(wPack, wPack->getFireMode());
-    }
-
-    WeaponPack * Pawn::getWeaponPack(unsigned int firemode) const
-    {
-        if (this->weaponSystem_)
-            return this->weaponSystem_->getWeaponPack(firemode);
-        else
-            return 0;
-    }
-
-    void Pawn::addWeaponSet(WeaponSet * wSet)
-    {
-        if (this->weaponSystem_)
-            this->weaponSystem_->attachWeaponSet(wSet);
-    }
-
-    WeaponSet * Pawn::getWeaponSet(unsigned int index) const
-    {
-        if (this->weaponSystem_)
-            return this->weaponSystem_->getWeaponSet(index);
+            this->weaponSystem_->addWeaponPack(wPack);
+    }
+
+    WeaponPack * Pawn::getWeaponPack(unsigned int index) const
+    {
+        if (this->weaponSystem_)
+            return this->weaponSystem_->getWeaponPack(index);
         else
             return 0;
Index: code/branches/weapons/src/orxonox/objects/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/weapons/src/orxonox/objects/worldentities/pawns/Pawn.h	(revision 2913)
+++ code/branches/weapons/src/orxonox/objects/worldentities/pawns/Pawn.h	(revision 2914)
@@ -85,8 +85,8 @@
             void addWeaponSlot(WeaponSlot * wSlot);
             WeaponSlot * getWeaponSlot(unsigned int index) const;
-            void addWeaponPack(WeaponPack * wPack);
-            WeaponPack * getWeaponPack(unsigned int firemode) const;
             void addWeaponSet(WeaponSet * wSet);
             WeaponSet * getWeaponSet(unsigned int index) const;
+            void addWeaponPack(WeaponPack * wPack);
+            WeaponPack * getWeaponPack(unsigned int index) const;
 
             inline const WorldEntity* getWorldEntity() const
