Index: code/branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.cc
===================================================================
--- code/branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.cc	(revision 2984)
+++ code/branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.cc	(revision 2985)
@@ -20,5 +20,5 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
- *   Author:
+ *   Author: Val Mikos
  */
  
@@ -28,5 +28,4 @@
 
 
-//implement this! not done yet!
 #include "objects/worldentities/pawns/TeamBaseMatchBase.h" 
 #include "core/CoreIncludes.h"
@@ -99,4 +98,51 @@
     }
 
+
+    // if the player is in the same team as the base, he can't make any damage to it
+    bool TeamBaseMatch::allowPawnDamage(Pawn* victim, Pawn* originator)
+    {
+        TeamBaseMatchBase* base = dynamic_cast<TeamBaseMatchBase*>(victim);
+        if (base)
+        {
+            std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.find(base);
+            if (it != this->bases_.end())
+                return (!this->pawnsAreInTheSameTeam(victim, base));
+        }
+        return (!this->pawnsAreInTheSameTeam(victim, originator));
+    }
+
+    bool TeamBaseMatch::pawnsAreInTheSameTeam(Pawn* pawn1, TeamBaseMatchBase* base)
+    {
+        if (pawn1 && base)
+        {
+            std::map<PlayerInfo*, int>::const_iterator it1 = this->teamnumbers_.find(pawn1->getPlayer());
+	    int teamnrbase = -1;
+	    int teamnrplayer = getTeam(pawn1->getPlayer());
+
+	    switch(base->getState())
+            {
+                case BaseState::controlTeam1:
+                    teamnrbase = 0;
+                    break;
+                case BaseState::controlTeam2:
+                    teamnrbase = 1;
+                    break;
+                case BaseState::uncontrolled:
+                default:
+		    teamnrbase = -1;
+	    }
+
+
+	    if(teamnrbase == teamnrplayer){
+		return false;
+	    }
+        }
+        return true;
+    }
+
+
+
+
+
     // collect Points for killing oppenents
     void TeamBaseMatch::playerScored(PlayerInfo* player)
@@ -181,15 +227,6 @@
         return 0;
     }
-
-
-    // declare the functions 'getshape' and 'setshape' from the XML function here
- 
-
-
-
     
 }
 
  
-
- 
Index: code/branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.h
===================================================================
--- code/branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.h	(revision 2984)
+++ code/branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.h	(revision 2985)
@@ -23,5 +23,5 @@
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Val Mikos
  *
  */
@@ -59,4 +59,8 @@
             virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
 
+	    virtual bool allowPawnDamage(Pawn* victim, Pawn* originator);
+
+
+
             // give information about the state of a base 
             // (this should be pretty useless atm)
@@ -78,4 +82,8 @@
             void winPoints();
 
+
+	    bool pawnsAreInTheSameTeam(Pawn* pawn1, TeamBaseMatchBase* base);
+            using TeamDeathmatch::pawnsAreInTheSameTeam;
+
             std::set<TeamBaseMatchBase*> bases_;
             Timer<TeamBaseMatch> scoreTimer_;
Index: code/branches/gametypes/src/orxonox/objects/gametypes/TeamDeathmatch.h
===================================================================
--- code/branches/gametypes/src/orxonox/objects/gametypes/TeamDeathmatch.h	(revision 2984)
+++ code/branches/gametypes/src/orxonox/objects/gametypes/TeamDeathmatch.h	(revision 2985)
@@ -55,4 +55,7 @@
             virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn);
 
+            inline const ColourValue& getTeamColour(int teamnr) const
+                { return this->teamcolours_[teamnr]; }
+
         protected:
             virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
Index: code/branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc
===================================================================
--- code/branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc	(revision 2984)
+++ code/branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc	(revision 2985)
@@ -23,5 +23,5 @@
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Val Mikos
  *
  */
@@ -31,4 +31,5 @@
 #include "core/CoreIncludes.h"
 #include "objects/gametypes/TeamBaseMatch.h"
+#include "objects/Teamcolourable.h"
 
 namespace orxonox
@@ -48,4 +49,40 @@
         }
     }
+
+    void TeamBaseMatchBase::changeTeamColour()
+    {
+        this->fireEvent();
+
+        TeamDeathmatch* gametype = dynamic_cast<TeamDeathmatch*>(this->getGametype());
+        if (!gametype)
+            return;
+
+        ColourValue colour;
+
+        switch (this->state_)
+        {
+            case BaseState::controlTeam1:
+                colour = gametype->getTeamColour(0);
+                break;
+            case BaseState::controlTeam2:
+                colour = gametype->getTeamColour(1);
+                break;
+            case BaseState::uncontrolled:
+            default:
+                colour = ColourValue(0.5, 0.5, 0.7, 1.0);
+                break;
+        }
+
+        
+        std::set<WorldEntity*> attachments = this->getAttachedObjects();
+        for (std::set<WorldEntity*>::iterator it = attachments.begin(); it != attachments.end(); ++it)
+        {
+            if ((*it)->isA(Class(Teamcolourable)))
+            {
+                Teamcolourable* tc = dynamic_cast<Teamcolourable*>(*it);
+                tc->setTeamColour(colour);
+            }
+        }
+    }
 }
 
Index: code/branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h
===================================================================
--- code/branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h	(revision 2984)
+++ code/branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h	(revision 2985)
@@ -23,5 +23,5 @@
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Val Mikos
  *
  */
@@ -70,4 +70,5 @@
             {
                 this->state_ = state;
+                this->changeTeamColour();
 	    }
 
@@ -81,4 +82,5 @@
 
         protected:
+            void changeTeamColour();
 
             BaseState::Enum state_;
