Index: code/trunk/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 3032)
+++ code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 3033)
@@ -138,4 +138,5 @@
     class MovableEntity;
     class Sublevel;
+    class ForceField;
 
     class Model;
@@ -162,4 +163,6 @@
     class Pawn;
     class SpaceShip;
+    class TeamBaseMatchBase;
+    class Destroyer;
 
     class Item;
@@ -172,4 +175,5 @@
     class EventTrigger;
     class PlayerTrigger;
+    class CheckPoint;
 
     class WeaponSystem;
@@ -204,4 +208,7 @@
     class Deathmatch;
     class TeamDeathmatch;
+    class Asteroids;
+    class TeamBaseMatch;
+    class UnderAttack;
     class Pong;
 
@@ -236,4 +243,5 @@
     class HUDSpeedBar;
     class HUDHealthBar;
+    class HUDTimer;
     class InGameConsole;
     class Notification;
Index: code/trunk/src/orxonox/objects/gametypes/Asteroids.cc
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/Asteroids.cc	(revision 3033)
+++ code/trunk/src/orxonox/objects/gametypes/Asteroids.cc	(revision 3033)
@@ -0,0 +1,93 @@
+/*
+ *   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:
+ *      Aurelian Jaggi
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Asteroids.h"
+
+#include "core/CoreIncludes.h"
+#include "objects/infos/PlayerInfo.h"
+#include "objects/worldentities/pawns/Pawn.h"
+
+#include "network/Host.h"
+
+namespace orxonox
+{
+    CreateUnloadableFactory(Asteroids);
+
+    Asteroids::Asteroids(BaseObject* creator) : Gametype(creator)
+    {
+        RegisterObject(Asteroids);
+        this->firstCheckpointReached_ = false;
+        this->firstTimeSpawned_ = false;
+    }
+
+    void Asteroids::tick(float dt)
+    {
+        SUPER(Asteroids, tick, dt);
+
+        if (firstCheckpointReached_ && !this->timerIsActive_)
+        {
+            this->startTimer();
+        }
+
+        if (this->time_ < 0 && !this->hasEnded() && this->timerIsActive_)
+        {
+            this->end();
+        }
+    }
+
+    void Asteroids::spawnPlayer(PlayerInfo* player)
+    {
+        if (this->timerIsActive_ && this->firstTimeSpawned_)
+        {
+            this->end();
+            return;
+        }
+
+        this->firstTimeSpawned_ = true;
+        Gametype::spawnPlayer(player);
+    }
+
+    void Asteroids::start()
+    {
+        Gametype::start();
+
+        std::string message = "The match has started! Reach the first chekpoint within 60 seconds! But be aware, there may be pirates around...";
+        COUT(0) << message << std::endl;
+        Host::Broadcast(message);
+    }
+
+    void Asteroids::end()
+    {
+        Gametype::end();
+
+        std::string message = "The match has ended.";
+        COUT(0) << message << std::endl;
+        Host::Broadcast(message);
+    }
+}
Index: code/trunk/src/orxonox/objects/gametypes/Asteroids.h
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/Asteroids.h	(revision 3033)
+++ code/trunk/src/orxonox/objects/gametypes/Asteroids.h	(revision 3033)
@@ -0,0 +1,63 @@
+/*
+ *   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:
+ *      Aurelian Jaggi
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Asteroids_H__
+#define _Asteroids_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "Gametype.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Asteroids : public Gametype
+    {
+        public:
+            Asteroids(BaseObject* creator);
+            virtual ~Asteroids() {}
+
+            virtual void tick(float dt);
+
+            virtual void start();
+            virtual void end();
+
+            inline void firstCheckpointReached(bool reached)
+              { this->firstCheckpointReached_ = reached; }
+
+        protected:
+            virtual void spawnPlayer(PlayerInfo* player);
+
+        private:
+            bool firstCheckpointReached_;
+            bool gameEnded_;
+            bool firstTimeSpawned_;
+
+    };
+}
+
+#endif /* _Asteroids_H__ */
Index: code/trunk/src/orxonox/objects/gametypes/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/CMakeLists.txt	(revision 3032)
+++ code/trunk/src/orxonox/objects/gametypes/CMakeLists.txt	(revision 3033)
@@ -3,4 +3,7 @@
   Deathmatch.cc
   TeamDeathmatch.cc
+  TeamBaseMatch.cc
   Pong.cc
+  UnderAttack.cc
+  Asteroids.cc
 )
Index: code/trunk/src/orxonox/objects/gametypes/Gametype.cc
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/Gametype.cc	(revision 3032)
+++ code/trunk/src/orxonox/objects/gametypes/Gametype.cc	(revision 3033)
@@ -60,4 +60,8 @@
         this->numberOfBots_ = 0;
 
+        this->timeLimit_ = 0;
+        this->time_ = 0;
+        this->timerIsActive_ = false;
+
         this->initialStartCountdown_ = 3;
 
@@ -88,4 +92,13 @@
         SUPER(Gametype, tick, dt);
 
+        //count timer
+        if (timerIsActive_)
+        {
+            if (this->timeLimit_ == 0)
+                this->time_ += dt;
+            else
+                this->time_ -= dt;
+        }
+
         if (this->gtinfo_.bStartCountdownRunning_ && !this->gtinfo_.bStarted_)
             this->gtinfo_.startCountdown_ -= dt;
@@ -93,5 +106,5 @@
         if (!this->gtinfo_.bStarted_)
             this->checkStart();
-        else
+        else if (!this->gtinfo_.bEnded_)
             this->spawnDeadPlayersIfRequested();
 
@@ -111,4 +124,29 @@
     {
         this->gtinfo_.bEnded_ = true;
+
+        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+        {
+            if (it->first->getControllableEntity())
+            {
+                ControllableEntity* oldentity = it->first->getControllableEntity();
+        
+                ControllableEntity* entity = this->defaultControllableEntity_.fabricate(oldentity->getCreator());
+                if (oldentity->getCamera())
+                {
+                    entity->setPosition(oldentity->getCamera()->getWorldPosition());
+                    entity->setOrientation(oldentity->getCamera()->getWorldOrientation());
+                }
+                else
+                {
+                    entity->setPosition(oldentity->getWorldPosition());
+                    entity->setOrientation(oldentity->getWorldOrientation());
+                }
+
+                it->first->stopControl(oldentity, true);
+                it->first->startControl(entity);
+            }
+            else
+                this->spawnPlayerAsDefaultPawn(it->first);
+        }
     }
 
@@ -267,18 +305,6 @@
                 if (!it->first->isReadyToSpawn() || !this->gtinfo_.bStarted_)
                 {
-                    SpawnPoint* spawn = this->getBestSpawnPoint(it->first);
-                    if (spawn)
-                    {
-                        // force spawn at spawnpoint with default pawn
-                        ControllableEntity* entity = this->defaultControllableEntity_.fabricate(spawn);
-                        spawn->spawn(entity);
-                        it->first->startControl(entity);
-                        it->second.state_ = PlayerState::Dead;
-                    }
-                    else
-                    {
-                        COUT(1) << "Error: No SpawnPoints in current Gametype" << std::endl;
-                        abort();
-                    }
+                    this->spawnPlayerAsDefaultPawn(it->first);
+                    it->second.state_ = PlayerState::Dead;
                 }
             }
@@ -358,4 +384,21 @@
     }
 
+    void Gametype::spawnPlayerAsDefaultPawn(PlayerInfo* player)
+    {
+        SpawnPoint* spawn = this->getBestSpawnPoint(player);
+        if (spawn)
+        {
+            // force spawn at spawnpoint with default pawn
+            ControllableEntity* entity = this->defaultControllableEntity_.fabricate(spawn);
+            spawn->spawn(entity);
+            player->startControl(entity);
+        }
+        else
+        {
+            COUT(1) << "Error: No SpawnPoints in current Gametype" << std::endl;
+            abort();
+        }
+    }
+
     void Gametype::addBots(unsigned int amount)
     {
@@ -376,3 +419,30 @@
         }
     }
+
+    void Gametype::addTime(float t)
+    { 
+        if (this->timeLimit_ == 0)
+          this->time_ -= t;
+        else
+          this->time_ += t;
+    }
+
+    void Gametype::removeTime(float t)
+    { 
+        if (this->timeLimit_ == 0)
+          this->time_ += t;
+        else
+          this->time_ -= t;
+    }
+
+    void Gametype::resetTimer()
+    { 
+        this->resetTimer(timeLimit_);
+    }
+
+    void Gametype::resetTimer(float t)
+    { 
+        this->timeLimit_ = t;
+        this->time_ = t;
+    }
 }
Index: code/trunk/src/orxonox/objects/gametypes/Gametype.h
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/Gametype.h	(revision 3032)
+++ code/trunk/src/orxonox/objects/gametypes/Gametype.h	(revision 3033)
@@ -128,4 +128,28 @@
                 { return this->players_.size(); }
 
+            virtual void addTime(float t);
+            virtual void removeTime(float t);
+
+            inline  void startTimer()
+            { 
+                this->time_ = this->timeLimit_;
+                this->timerIsActive_ = true;
+            }
+
+            inline void stopTimer()
+              { this->timerIsActive_ = false; }
+
+            inline float getTime()
+              { return this->time_; }
+
+            inline bool getTimerIsActive()
+              { return timerIsActive_; }
+
+            inline void setTimeLimit(float t)
+              { this->timeLimit_ = t; }
+
+            virtual void resetTimer();
+            virtual void resetTimer(float t);
+
         protected:
             virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
@@ -134,4 +158,5 @@
             virtual void checkStart();
             virtual void spawnPlayer(PlayerInfo* player);
+            virtual void spawnPlayerAsDefaultPawn(PlayerInfo* player);
             virtual void spawnPlayersIfRequested();
             virtual void spawnDeadPlayersIfRequested();
@@ -141,4 +166,8 @@
             bool bAutoStart_;
             bool bForceSpawn_;
+
+            float time_;
+            float timeLimit_;
+            bool timerIsActive_;
 
             float initialStartCountdown_;
Index: code/trunk/src/orxonox/objects/gametypes/TeamBaseMatch.cc
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/TeamBaseMatch.cc	(revision 3033)
+++ code/trunk/src/orxonox/objects/gametypes/TeamBaseMatch.cc	(revision 3033)
@@ -0,0 +1,201 @@
+/*
+ *   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:
+ *      Val Mikos
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "TeamBaseMatch.h"
+
+#include "objects/worldentities/pawns/TeamBaseMatchBase.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    CreateUnloadableFactory(TeamBaseMatch);
+
+    TeamBaseMatch::TeamBaseMatch(BaseObject* creator) : TeamDeathmatch(creator)
+    {
+        RegisterObject(TeamBaseMatch);
+
+        this->scoreTimer_.setTimer(10, true, this, createExecutor(createFunctor(&TeamBaseMatch::winPoints)));
+        this->outputTimer_.setTimer(30, true, this, createExecutor(createFunctor(&TeamBaseMatch::showPoints)));
+
+        this->pointsTeam1_ = 0;
+        this->pointsTeam2_ = 0;
+    }
+
+    // Change the control of the defeated base and respawn it with its initial health
+    bool TeamBaseMatch::allowPawnDeath(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())
+            {
+                int teamnr = this->getTeam(originator->getPlayer());
+                if (teamnr == 0)
+                    base->setState(BaseState::controlTeam1);
+                if (teamnr == 1)
+                    base->setState(BaseState::controlTeam2);
+            }
+
+            victim->setHealth(victim->getInitialHealth());
+            return false;
+        }
+
+        return TeamDeathmatch::allowPawnDeath(victim, originator);
+    }
+
+
+    // 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)
+    {
+        int teamnr = this->getTeam(player);
+        this->addTeamPoints(teamnr, 5);
+    }
+
+    // show points or each interval of time
+    void TeamBaseMatch::showPoints()
+    {
+        COUT(0) << "Points standing:" << std::endl << "Team 1: "<< pointsTeam1_ << std::endl << "Team 2: " << pointsTeam2_ << std::endl;
+        if(pointsTeam1_ >=1700) COUT(0) << "Team 1 is near victory!" << std::endl;
+        if(pointsTeam2_ >=1700) COUT(0) << "Team 2 is near victory!" << std::endl;
+    }
+
+
+    // collect Points while controlling Bases
+    void TeamBaseMatch::winPoints()
+    {
+        int amountControlled = 0;
+        int amountControlled2 = 0;
+
+        for (std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)
+        {
+            if((*it)->getState() == BaseState::controlTeam1)
+            {
+                amountControlled++;
+            }
+            if((*it)->getState() == BaseState::controlTeam2)
+            {
+                amountControlled2++;
+            }
+        }
+
+        this->addTeamPoints(0, (amountControlled * 30));
+        this->addTeamPoints(1, (amountControlled2 * 30));
+    }
+
+
+    // end game if one team reaches 2000 points
+    void TeamBaseMatch::endGame()
+    {
+        if(this->pointsTeam1_>=2000 || this->pointsTeam2_ >=2000)
+        {
+            this->end();
+        }
+    }
+
+
+    // this function is called by the function winPoints() which adds points to the teams for every base and killed openents at a certain time
+    void TeamBaseMatch::addTeamPoints(int team, int points)
+    {
+        if(team == 0)
+        {
+            this->pointsTeam1_ += points;
+        }
+        if(team == 1)
+        {
+            this->pointsTeam2_ += points;
+        }
+
+        this->endGame();
+    }
+
+    void TeamBaseMatch::addBase(TeamBaseMatchBase* base)
+    {
+        this->bases_.insert(base);
+        base->setState(BaseState::uncontrolled);
+    }
+
+    TeamBaseMatchBase* TeamBaseMatch::getBase(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)
+        {
+            i++;
+            if (i > index)
+                return (*it);
+        }
+        return 0;
+    }
+
+}
+
+
Index: code/trunk/src/orxonox/objects/gametypes/TeamBaseMatch.h
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/TeamBaseMatch.h	(revision 3033)
+++ code/trunk/src/orxonox/objects/gametypes/TeamBaseMatch.h	(revision 3033)
@@ -0,0 +1,74 @@
+/*
+ *   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:
+ *      Val Mikos
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _TeamBaseMatch_H__
+#define _TeamBaseMatch_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <set>
+#include "TeamDeathmatch.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport TeamBaseMatch : public TeamDeathmatch
+    {
+        public:
+            TeamBaseMatch(BaseObject* creator);
+            virtual ~TeamBaseMatch() {}
+
+            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
+            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator);
+
+            virtual void playerScored(PlayerInfo* player);
+            virtual void showPoints();
+            virtual void endGame();
+
+            void addBase(TeamBaseMatchBase* base);
+            TeamBaseMatchBase* getBase(unsigned int index) const;
+
+            void addTeamPoints(int team, int points);
+
+        protected:
+            void winPoints();
+
+            bool pawnsAreInTheSameTeam(Pawn* pawn1, TeamBaseMatchBase* base);
+            using TeamDeathmatch::pawnsAreInTheSameTeam;
+
+            std::set<TeamBaseMatchBase*> bases_;
+            Timer<TeamBaseMatch> scoreTimer_;
+            Timer<TeamBaseMatch> outputTimer_;
+
+            //points for each team
+            int pointsTeam1_;
+            int pointsTeam2_;
+    };
+}
+
+#endif /* _TeamBaseMatch_H__ */
Index: code/trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc	(revision 3032)
+++ code/trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc	(revision 3033)
@@ -127,5 +127,5 @@
             {
                 TeamSpawnPoint* tsp = dynamic_cast<TeamSpawnPoint*>(*it);
-                if (tsp && tsp->getTeamNumber() != desiredTeamNr)
+                if (tsp && (int)tsp->getTeamNumber() != desiredTeamNr)
                 {
                     teamSpawnPoints.erase(it++);
@@ -189,3 +189,12 @@
         return false;
     }
+
+    int TeamDeathmatch::getTeam(PlayerInfo* player)
+    {
+        std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player);
+        if (it_player != this->teamnumbers_.end())
+            return it_player->second;
+        else
+            return -1;
+    }
 }
Index: code/trunk/src/orxonox/objects/gametypes/TeamDeathmatch.h
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/TeamDeathmatch.h	(revision 3032)
+++ code/trunk/src/orxonox/objects/gametypes/TeamDeathmatch.h	(revision 3033)
@@ -55,7 +55,11 @@
             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;
             bool pawnsAreInTheSameTeam(Pawn* pawn1, Pawn* pawn2);
+            int getTeam(PlayerInfo* player);
 
             std::map<PlayerInfo*, int> teamnumbers_;
Index: code/trunk/src/orxonox/objects/gametypes/UnderAttack.cc
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/UnderAttack.cc	(revision 3033)
+++ code/trunk/src/orxonox/objects/gametypes/UnderAttack.cc	(revision 3033)
@@ -0,0 +1,170 @@
+/*
+ *   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:
+ *      Matthias Mock
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "UnderAttack.h"
+
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "util/Convert.h"
+#include "network/Host.h"
+
+#include "objects/worldentities/pawns/Destroyer.h"
+
+namespace orxonox
+{
+    CreateUnloadableFactory(UnderAttack);
+
+    UnderAttack::UnderAttack(BaseObject* creator) : TeamDeathmatch(creator)
+    {
+        RegisterObject(UnderAttack);
+        this->gameTime_ = 90;
+        this->teams_ = 2;
+        this->destroyer_ = 0;
+        this->gameEnded_ = false;
+
+        this->setConfigValues();
+        this->timesequence_ = (int) this->gameTime_;
+    }
+
+    void UnderAttack::setConfigValues()
+    {
+        SetConfigValue(gameTime_, 30);
+    }
+
+    void UnderAttack::addDestroyer(Destroyer* destroyer)
+    {
+        this->destroyer_ = destroyer;
+    }
+
+
+    void UnderAttack::destroyedPawn(Pawn* pawn)
+    {
+        if (pawn == this->destroyer_)
+        {
+            this->end(); //end gametype
+            std::string message = "Ship destroyed! Team 0 has won!";
+            COUT(0) << message << std::endl;
+            Host::Broadcast(message);
+            this->gameEnded_ = true;
+        }
+    }
+
+    bool UnderAttack::allowPawnHit(Pawn* victim, Pawn* originator)
+    {
+        if (victim == this->destroyer_)
+        {
+            if (originator && originator->getPlayer() && !gameEnded_)
+            {
+                if (this->getTeam(originator->getPlayer()) == 0)
+                    return true;
+                else
+                    return false;
+            }
+
+            return false;
+        }
+
+        return TeamDeathmatch::allowPawnHit(victim, originator);
+    }
+
+    bool UnderAttack::allowPawnDamage(Pawn* victim, Pawn* originator)
+    {
+        if (victim == this->destroyer_)
+        {
+            if (originator && originator->getPlayer() && !gameEnded_)
+            {
+                if (this->getTeam(originator->getPlayer()) == 0)
+                    return true;
+                else
+                    return false;
+            }
+
+            return false;
+        }
+
+        return TeamDeathmatch::allowPawnDamage(victim, originator);
+    }
+
+    bool UnderAttack::allowPawnDeath(Pawn* victim, Pawn* originator)
+    {
+        if (victim == this->destroyer_)
+        {
+            if (originator && originator->getPlayer() && !gameEnded_)
+            {
+                if (this->getTeam(originator->getPlayer()) == 0)
+                    return true;
+                else
+                    return false;
+            }
+
+            return false;
+        }
+
+        return TeamDeathmatch::allowPawnDeath(victim, originator);
+    }
+
+
+    void UnderAttack::tick(float dt)
+    {
+        SUPER(UnderAttack, tick, dt);
+
+        if (this->hasStarted() && !gameEnded_)
+        {
+            gameTime_ = gameTime_ - dt;
+            if (gameTime_<= 0)
+            {
+                this->gameEnded_ = true;
+                this->end();
+                std::string message = "Time is up! Team 1 has won!";
+                COUT(0) << message << std::endl;
+                Host::Broadcast(message);
+            }
+
+             //prints gametime
+            if ( gameTime_ <= timesequence_)
+            {
+                std::string message = convertToString(timesequence_) + " sec left!";
+                COUT(0) << message << std::endl;
+                Host::Broadcast(message);
+                if (timesequence_ >= 30 && timesequence_ <= 60)
+                {
+                    timesequence_ = timesequence_ - 10;
+                }
+                else if (timesequence_ <= 30)
+                {
+                    timesequence_ = timesequence_ - 5;
+                }
+                else
+                {
+                    timesequence_ = timesequence_ - 30;
+                }
+            }
+        }
+    }
+}
Index: code/trunk/src/orxonox/objects/gametypes/UnderAttack.h
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/UnderAttack.h	(revision 3033)
+++ code/trunk/src/orxonox/objects/gametypes/UnderAttack.h	(revision 3033)
@@ -0,0 +1,66 @@
+/*
+ *   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:
+ *      Matthias Mock
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _UnderAttack_H__
+#define _UnderAttack_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "TeamDeathmatch.h"
+#include "objects/worldentities/pawns/Pawn.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport UnderAttack : public TeamDeathmatch, public PawnListener
+    {
+        public:
+            UnderAttack(BaseObject* creator);
+            virtual ~UnderAttack() {}
+
+            void setConfigValues();
+            void tick (float dt);
+            void addDestroyer(Destroyer* destroyer);
+            inline Destroyer* getDestroyer() const
+                { return this->destroyer_; }
+
+            virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0);
+            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0);
+            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
+
+        protected:
+            virtual void destroyedPawn(Pawn* pawn);
+
+            Destroyer* destroyer_;
+            unsigned int teams_;
+            float gameTime_;
+            int timesequence_;
+            bool gameEnded_;
+    };
+}
+
+#endif /* _TeamDeathmatch_H__ */
Index: code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.cc	(revision 3032)
+++ code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.cc	(revision 3033)
@@ -41,5 +41,5 @@
 
 #include "orxonox/objects/infos/PlayerInfo.h"
-#include "orxonox/objects/worldentities/ControllableEntity.h"
+#include "orxonox/objects/worldentities/pawns/Pawn.h"
 #include "orxonox/objects/worldentities/triggers/PlayerTrigger.h"
 #include "QuestEffect.h"
@@ -120,14 +120,14 @@
 
         //! Extracting the ControllableEntity form the PlayerTrigger.
-        ControllableEntity* entity = trigger->getTriggeringPlayer();
-
-        if(entity == NULL)
-        {
-            COUT(2) << "The QuestEffectBeacon was triggered by an entity other than a ControllableEntity." << std::endl;
+        Pawn* pawn = trigger->getTriggeringPlayer();
+
+        if(pawn == NULL)
+        {
+            COUT(2) << "The QuestEffectBeacon was triggered by an entity other than a Pawn." << std::endl;
             return false;
         }
         
         //! Extract the PlayerInfo from the ControllableEntity.
-        PlayerInfo* player = entity->getPlayer();
+        PlayerInfo* player = pawn->getPlayer();
         
         if(player == NULL)
Index: code/trunk/src/orxonox/objects/worldentities/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/CMakeLists.txt	(revision 3032)
+++ code/trunk/src/orxonox/objects/worldentities/CMakeLists.txt	(revision 3033)
@@ -23,4 +23,5 @@
   PongBall.cc
   PongBat.cc
+  ForceField.cc
 )
 
Index: code/trunk/src/orxonox/objects/worldentities/ForceField.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ForceField.cc	(revision 3033)
+++ code/trunk/src/orxonox/objects/worldentities/ForceField.cc	(revision 3033)
@@ -0,0 +1,91 @@
+/*
+ *   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:
+ *      Aurelian Jaggi
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "ForceField.h"
+#include "core/XMLPort.h"
+
+#include "core/CoreIncludes.h"
+#include "objects/worldentities/MobileEntity.h"
+
+namespace orxonox
+{
+  CreateFactory(ForceField);
+
+    ForceField::ForceField(BaseObject* creator) : StaticEntity(creator)
+    {
+      RegisterObject(ForceField);
+
+      //Standard Values
+      this->setDirection(Vector3::ZERO);
+      velocity_ = 100;
+      diameter_ = 500;
+      length_ = 2000;
+    }
+
+    ForceField::~ForceField() {}
+
+    void ForceField::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+      SUPER(ForceField, XMLPort, xmlelement, mode);
+
+      //For correct xml import use: position, direction, velocity, scale
+
+      XMLPortParam(ForceField, "velocity", setVelocity, getVelocity, xmlelement, mode).defaultValues(100);
+      XMLPortParam(ForceField, "diameter", setDiameter, getDiameter, xmlelement, mode).defaultValues(500);
+      XMLPortParam(ForceField, "length"  , setLength  , getLength  , xmlelement, mode).defaultValues(2000);
+    }
+
+    void ForceField::tick(float dt)
+    {
+
+      for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
+      {
+
+        //calculate from
+        Vector3 directionVec = this->getOrientation() * WorldEntity::FRONT;
+        directionVec.normalise();
+
+        Vector3 distanceVec = it->getWorldPosition() - (this->getWorldPosition() + (this->length_ / 2 * directionVec));
+
+        //distance from centervector of the field (
+        float distFromCenterVec = ((it->getWorldPosition() - this->getWorldPosition()).crossProduct(directionVec)).length();
+
+        if (distanceVec.length() < this->length_ / 2 && distFromCenterVec < diameter_ / 2)
+        {
+          //normalize distance from center
+          it->applyCentralForce(((diameter_ / 2 - distFromCenterVec) / (diameter_ / 2)) * directionVec * velocity_);
+        }
+
+      }
+  }
+}
+
+
+
+
+
Index: code/trunk/src/orxonox/objects/worldentities/ForceField.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ForceField.h	(revision 3033)
+++ code/trunk/src/orxonox/objects/worldentities/ForceField.h	(revision 3033)
@@ -0,0 +1,72 @@
+/*
+ *   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:
+ *      Aurelian Jaggi
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+
+#ifndef _ForceField_H__
+#define _ForceField_H__
+
+#include "StaticEntity.h"
+#include "objects/Tickable.h"
+
+namespace orxonox
+{
+  class _OrxonoxExport ForceField : public StaticEntity, public Tickable
+  {
+    public:
+      ForceField(BaseObject* creator);
+      virtual ~ForceField();
+      virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CheckPoint object through XML.
+      virtual void tick(float dt);
+
+      inline void setVelocity(float vel)
+        { this->velocity_ = vel; }
+    
+      inline float getVelocity()
+        { return velocity_; }
+    
+      inline void setDiameter(float diam)
+        { this->diameter_ = diam; }
+
+      inline float getDiameter()
+        { return diameter_; }
+ 
+      inline void setLength(float l)
+        { this->length_ = l; }
+
+      inline float getLength()
+        { return length_; }
+
+    private:
+      float velocity_;
+      float diameter_;
+      float length_;
+  };
+}
+
+#endif
+
Index: code/trunk/src/orxonox/objects/worldentities/MobileEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/MobileEntity.cc	(revision 3032)
+++ code/trunk/src/orxonox/objects/worldentities/MobileEntity.cc	(revision 3033)
@@ -166,4 +166,10 @@
     }
 
+    void MobileEntity::applyCentralForce(const Vector3& force)
+    {
+        if (this->isDynamic())
+            this->physicalBody_->applyCentralForce(btVector3(force.x * this->getMass(), force.y * this->getMass(), force.z * this->getMass()));
+    }
+
     bool MobileEntity::isCollisionTypeLegal(WorldEntity::CollisionType type) const
     {
Index: code/trunk/src/orxonox/objects/worldentities/MobileEntity.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/MobileEntity.h	(revision 3032)
+++ code/trunk/src/orxonox/objects/worldentities/MobileEntity.h	(revision 3033)
@@ -75,4 +75,8 @@
                 { return this->angularAcceleration_; }
 
+            void applyCentralForce(const Vector3& force);
+            inline void applyCentralForce(float x, float y, float z)
+                { this->applyCentralForce(Vector3(x, y, z)); }
+
             inline void setRotationRate(Degree rate)
                 { this->setAngularVelocity(this->getAngularVelocity().normalisedCopy() * rate.valueRadians()); }
Index: code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc	(revision 3032)
+++ code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc	(revision 3033)
@@ -35,4 +35,5 @@
 #include "core/Executor.h"
 #include "core/GameMode.h"
+#include "objects/worldentities/pawns/Pawn.h"
 
 namespace orxonox
@@ -67,5 +68,23 @@
     {
         SUPER(MovableEntity, XMLPort, xmlelement, mode);
+
+        XMLPortParam(MovableEntity, "enablecollisiondamage", setEnableCollisionDamage, getEnableCollisionDamage, xmlelement, mode).defaultValues(false);
+        XMLPortParam(MovableEntity, "collisiondamage", setCollisionDamage, getCollisionDamage, xmlelement, mode).defaultValues(1);
     }
+
+    bool MovableEntity::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+    {
+        if (GameMode::isMaster() && enableCollisionDamage_)
+        {
+            Pawn* victim = dynamic_cast<Pawn*>(otherObject);
+            if (victim)
+            {
+                victim->damage(this->collisionDamage_ * victim->getVelocity().dotProduct(this->getVelocity()));
+            }
+        }
+
+        return false;
+    }
+
 
     void MovableEntity::registerVariables()
Index: code/trunk/src/orxonox/objects/worldentities/MovableEntity.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/MovableEntity.h	(revision 3032)
+++ code/trunk/src/orxonox/objects/worldentities/MovableEntity.h	(revision 3033)
@@ -46,4 +46,5 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
             void registerVariables();
 
@@ -55,4 +56,24 @@
             inline void setOrientation(const Quaternion& orientation)
                 { MobileEntity::setOrientation(orientation); this->overwrite_orientation_ = this->getOrientation(); }
+
+            inline void setOwner(Pawn* owner)
+                { this->owner_ = owner; }
+            inline Pawn* getOwner() const
+                { return this->owner_; }
+
+            inline void setCollisionDamage(float c)
+                { this->collisionDamage_ = c; }
+
+            inline float getCollisionDamage()
+                { return this->collisionDamage_; }
+
+            inline void setEnableCollisionDamage(bool c)
+            { 
+                this->enableCollisionDamage_ = c; 
+                this->enableCollisionCallback();
+            } 
+
+            inline bool getEnableCollisionDamage()
+                { return this->enableCollisionDamage_; }
 
         private:
@@ -76,4 +97,8 @@
             Timer<MovableEntity> resynchronizeTimer_;
             Timer<MovableEntity>* continuousResynchroTimer_;
+
+            Pawn* owner_;
+            float collisionDamage_;
+            bool enableCollisionDamage_;
     };
 }
Index: code/trunk/src/orxonox/objects/worldentities/SpawnPoint.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/SpawnPoint.cc	(revision 3032)
+++ code/trunk/src/orxonox/objects/worldentities/SpawnPoint.cc	(revision 3033)
@@ -95,6 +95,6 @@
     void SpawnPoint::spawn(ControllableEntity* entity)
     {
-        entity->setPosition(this->getPosition());
-        entity->setOrientation(this->getOrientation());
+        entity->setPosition(this->getWorldPosition());
+        entity->setOrientation(this->getWorldOrientation());
     }
 }
Index: code/trunk/src/orxonox/objects/worldentities/pawns/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/CMakeLists.txt	(revision 3032)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/CMakeLists.txt	(revision 3033)
@@ -3,3 +3,5 @@
   Pawn.cc
   SpaceShip.cc
+  TeamBaseMatchBase.cc
+  Destroyer.cc
 )
Index: code/trunk/src/orxonox/objects/worldentities/pawns/Destroyer.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/Destroyer.cc	(revision 3033)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/Destroyer.cc	(revision 3033)
@@ -0,0 +1,49 @@
+/*
+ *   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:
+ *      Matthias Mock
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Destroyer.h"
+
+#include "core/CoreIncludes.h"
+#include "objects/gametypes/UnderAttack.h"
+
+namespace orxonox
+{
+    CreateFactory(Destroyer);
+
+    Destroyer::Destroyer(BaseObject* creator) : SpaceShip(creator)
+    {
+        RegisterObject(Destroyer);
+
+        UnderAttack* gametype = dynamic_cast<UnderAttack*>(this->getGametype());
+        if (gametype)
+        {
+            gametype->addDestroyer(this);
+        }
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/pawns/Destroyer.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/Destroyer.h	(revision 3033)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/Destroyer.h	(revision 3033)
@@ -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:
+ *      Matthias Mock
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Destroyer_H__
+#define _Destroyer_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "SpaceShip.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Destroyer : public SpaceShip
+    {
+        public:
+            Destroyer(BaseObject* creator);
+            virtual ~Destroyer() {};
+
+    };
+}
+
+#endif /* _Destroyer_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc	(revision 3032)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc	(revision 3033)
@@ -198,4 +198,5 @@
     void Pawn::death()
     {
+        this->setHealth(1);
         if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_))
         {
@@ -214,6 +215,4 @@
                 this->deatheffect();
         }
-        else
-            this->setHealth(1);
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc	(revision 3033)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc	(revision 3033)
@@ -0,0 +1,88 @@
+/*
+ *   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:
+ *      Val Mikos
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+
+#include "TeamBaseMatchBase.h"
+#include "core/CoreIncludes.h"
+#include "objects/gametypes/TeamBaseMatch.h"
+#include "objects/Teamcolourable.h"
+
+namespace orxonox
+{
+    CreateFactory(TeamBaseMatchBase);
+
+    TeamBaseMatchBase::TeamBaseMatchBase(BaseObject* creator) : Pawn(creator)
+    {
+        RegisterObject(TeamBaseMatchBase);
+
+        this->state_ = BaseState::uncontrolled;
+
+        TeamBaseMatch* gametype = dynamic_cast<TeamBaseMatch*>(this->getGametype());
+        if (gametype)
+        {
+            gametype->addBase(this);
+        }
+    }
+
+    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/trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h	(revision 3033)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h	(revision 3033)
@@ -0,0 +1,81 @@
+/*
+ *   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:
+ *      Val Mikos
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _TeamBaseMatchBase_H__
+#define _TeamBaseMatchBase_H__
+
+#include "Pawn.h"
+
+namespace orxonox
+{
+
+
+    namespace BaseState
+    {
+        enum Enum
+        {
+            uncontrolled,
+            controlTeam1,
+            controlTeam2,
+        };
+    }
+
+
+    class _OrxonoxExport TeamBaseMatchBase : public Pawn
+    {
+        public:
+            TeamBaseMatchBase(BaseObject* creator);
+
+            // if class closes, close everything
+            virtual ~TeamBaseMatchBase() {}
+
+
+
+            // Set the state of a base to whatever the argument of the function is
+            void setState(BaseState::Enum state)
+            {
+                this->state_ = state;
+                this->changeTeamColour();
+            }
+
+
+            // Get the state of a base as a return value
+            BaseState::Enum getState() const
+            {
+                return this->state_;
+            }
+
+
+        protected:
+            void changeTeamColour();
+
+            BaseState::Enum state_;
+    };
+}
+
+#endif /* _TeamBaseMatchBase_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/triggers/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/CMakeLists.txt	(revision 3032)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/CMakeLists.txt	(revision 3033)
@@ -4,3 +4,4 @@
   EventTrigger.cc
   PlayerTrigger.cc
+  CheckPoint.cc
 )
Index: code/trunk/src/orxonox/objects/worldentities/triggers/CheckPoint.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/CheckPoint.cc	(revision 3033)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/CheckPoint.cc	(revision 3033)
@@ -0,0 +1,95 @@
+/*
+ *   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:
+ *      Aurelian Jaggi
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "CheckPoint.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "objects/gametypes/Asteroids.h"
+#include "orxonox/objects/worldentities/pawns/Pawn.h"
+
+namespace orxonox
+{
+  CreateFactory(CheckPoint);
+
+  CheckPoint::CheckPoint(BaseObject* creator) : DistanceTrigger(creator)
+  {
+    RegisterObject(CheckPoint);
+
+    this->setStayActive(true);
+    this->setDistance(50);
+    this->bIsFirst_ = false;
+    this->bIsDestination_ = false;
+    //this->setVisible(true);
+
+    this->notifyMaskUpdate();
+  }
+
+  CheckPoint::~CheckPoint()
+  {
+  }
+
+  void CheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+  {
+    SUPER(CheckPoint, XMLPort, xmlelement, mode);
+
+    XMLPortParam(CheckPoint, "isfirst", setFirst, getFirst, xmlelement, mode).defaultValues(false);
+    XMLPortParam(CheckPoint, "isdestination", setDestination, getDestination, xmlelement, mode).defaultValues(false);
+    XMLPortParam(CheckPoint, "addtime", setAddTime, getAddTime, xmlelement, mode).defaultValues(30);
+  }
+
+  void CheckPoint::triggered(bool bIsTriggered)
+  {
+    DistanceTrigger::triggered(bIsTriggered);
+
+    Asteroids* gametype = dynamic_cast<Asteroids*>(this->getGametype());
+    if (gametype)
+    {
+        gametype->addTime(addTime_);
+
+        if (bIsTriggered && bIsFirst_)
+        {
+            gametype->setTimeLimit(addTime_);
+            gametype->firstCheckpointReached(true);
+        }
+
+        if (bIsTriggered && bIsDestination_)
+        {
+            gametype->end();
+        }
+     }
+  }
+
+  void CheckPoint::notifyMaskUpdate()
+  {
+      this->targetMask_.exclude(Class(BaseObject));
+      this->targetMask_.include(Class(Pawn));
+  }
+}
Index: code/trunk/src/orxonox/objects/worldentities/triggers/CheckPoint.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/CheckPoint.h	(revision 3033)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/CheckPoint.h	(revision 3033)
@@ -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:
+ *      Aurelian Jaggi
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief
+*/
+
+#ifndef _CheckPoint_H__
+#define _CheckPoint_H__
+
+#include "DistanceTrigger.h"
+
+namespace orxonox
+{
+  class _OrxonoxExport CheckPoint : public DistanceTrigger
+  {
+    public:
+      CheckPoint(BaseObject* creator);
+      virtual ~CheckPoint();
+
+      virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CheckPoint object through XML.
+
+    private:
+      virtual void triggered(bool bIsTriggered);
+      virtual void notifyMaskUpdate();
+
+      inline void setDestination(bool isDestination)
+        { bIsDestination_ = isDestination; }
+
+      inline bool getDestination()
+        { return bIsDestination_; }
+
+      inline void setFirst(bool isFirst)
+        { this->bIsFirst_ = isFirst; }
+
+      inline bool getFirst()
+        { return this->bIsFirst_; }
+
+      inline void setAddTime(float time)
+        { this->addTime_ = time; }
+
+      inline bool getAddTime()
+        { return this->addTime_; }
+
+      bool bIsFirst_;
+      bool bIsDestination_;
+      float addTime_;
+  };
+}
+
+#endif /* _CheckPoint_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc	(revision 3032)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc	(revision 3033)
@@ -35,5 +35,5 @@
 #include "core/XMLPort.h"
 
-#include "orxonox/objects/worldentities/ControllableEntity.h"
+#include "orxonox/objects/worldentities/pawns/Pawn.h"
 
 namespace orxonox
@@ -109,4 +109,6 @@
     WEMask.include(Class(WorldEntity));
     this->targetMask_ *= WEMask;
+
+    this->notifyMaskUpdate();
   }
 
@@ -133,5 +135,5 @@
         if(this->isForPlayer())
 	{
-          ControllableEntity* player = dynamic_cast<ControllableEntity*>(entity);
+          Pawn* player = dynamic_cast<Pawn*>(entity);
 	  this->setTriggeringPlayer(player);
 	}
Index: code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h	(revision 3032)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h	(revision 3033)
@@ -63,7 +63,9 @@
     protected:
       virtual bool isTriggered(TriggerMode mode);
+      virtual void notifyMaskUpdate() {}
+
+      ClassTreeMask targetMask_;
 
     private:
-      ClassTreeMask targetMask_;
       std::set<Ogre::Node*> targetSet_;
       float distance_;
Index: code/trunk/src/orxonox/objects/worldentities/triggers/PlayerTrigger.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/PlayerTrigger.h	(revision 3032)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/PlayerTrigger.h	(revision 3033)
@@ -60,5 +60,5 @@
         @return Returns a pointer to the ControllableEntity that triggered the PlayerTrigger.
         */
-        inline ControllableEntity* getTriggeringPlayer(void) const
+        inline Pawn* getTriggeringPlayer(void) const
             { return this->player_; }
         
@@ -77,5 +77,5 @@
         @param player A pointer to the ControllableEntity that triggered the PlayerTrigger.
         */
-        inline void setTriggeringPlayer(ControllableEntity* player)
+        inline void setTriggeringPlayer(Pawn* player)
            { this->player_ = player; }
 
@@ -88,5 +88,5 @@
         
     private:
-        ControllableEntity* player_; //!< The player that triggered the PlayerTrigger.
+        Pawn* player_; //!< The player that triggered the PlayerTrigger.
         bool isForPlayer_; //!< Is true when the PlayerTrigger schould be set to normally be triggered by ControllableEntities.
     
Index: code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.cc	(revision 3032)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.cc	(revision 3033)
@@ -102,5 +102,5 @@
     {
       this->bFirstTick_ = false;
-      this->fireEvent(false);
+      this->triggered(false);
     }
 
@@ -144,5 +144,5 @@
       this->bTriggered_ = (newState & 0x1);
       this->bActive_ = newState & 2;
-      this->fireEvent(this->bActive_);
+      this->triggered(this->bActive_);
       this->stateChanges_.pop();
       if (this->stateChanges_.size() != 0)
@@ -160,4 +160,9 @@
     else
       this->setBillboardColour(ColourValue(1.0, 0.0, 0.0));
+  }
+
+  void Trigger::triggered(bool bIsTriggered)
+  {
+    this->fireEvent(bIsTriggered);
   }
 
Index: code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.h	(revision 3032)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.h	(revision 3033)
@@ -89,4 +89,7 @@
         { return this->remainingActivations_; }
 
+      inline void setVisible(bool visibility)
+        { this->debugBillboard_.setVisible(visibility); }
+
       void setDelay(float delay);
       inline float getDelay() const
@@ -101,4 +104,5 @@
       inline bool isTriggered() { return this->isTriggered(this->mode_); }
       virtual bool isTriggered(TriggerMode mode);
+      virtual void triggered(bool bIsTriggered);
 
     private:
Index: code/trunk/src/orxonox/overlays/hud/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/overlays/hud/CMakeLists.txt	(revision 3032)
+++ code/trunk/src/orxonox/overlays/hud/CMakeLists.txt	(revision 3033)
@@ -5,4 +5,5 @@
   HUDSpeedBar.cc
   HUDHealthBar.cc
+  HUDTimer.cc
   ChatOverlay.cc
   GametypeStatus.cc
Index: code/trunk/src/orxonox/overlays/hud/HUDTimer.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDTimer.cc	(revision 3033)
+++ code/trunk/src/orxonox/overlays/hud/HUDTimer.cc	(revision 3033)
@@ -0,0 +1,70 @@
+/*
+ *   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:
+ *      Aurelian Jaggi
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "HUDTimer.h"
+
+#include "core/CoreIncludes.h"
+#include "util/Convert.h"
+#include "objects/worldentities/ControllableEntity.h"
+#include "objects/gametypes/Gametype.h"
+
+namespace orxonox
+{
+  CreateFactory(HUDTimer);
+
+  HUDTimer::HUDTimer(BaseObject* creator) : OverlayText(creator)
+  {
+    RegisterObject(HUDTimer);
+
+    this->owner_ = 0;
+  }
+
+  HUDTimer::~HUDTimer()
+  {
+  }
+
+  void HUDTimer::tick(float dt)
+  {
+    SUPER(HUDTimer, tick, dt);
+
+    Gametype* gametype = this->getGametype();
+
+    if (gametype->getTimerIsActive())
+    {
+      this->setCaption(convertToString((int)gametype->getTime() + 1));
+    }
+  }
+
+  void HUDTimer::changedOwner()
+  {
+    SUPER(HUDTimer, changedOwner);
+
+    this->owner_ = dynamic_cast<ControllableEntity*>(this->getOwner());
+  }
+}
Index: code/trunk/src/orxonox/overlays/hud/HUDTimer.h
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDTimer.h	(revision 3033)
+++ code/trunk/src/orxonox/overlays/hud/HUDTimer.h	(revision 3033)
@@ -0,0 +1,53 @@
+/*
+ *   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:
+ *      Aurelian Jaggi
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _HUDTimer_H__
+#define _HUDTimer_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "overlays/OverlayText.h"
+#include "objects/Tickable.h"
+
+namespace orxonox
+{
+  class _OrxonoxExport HUDTimer : public OverlayText, public Tickable
+  {
+    public:
+      HUDTimer(BaseObject* creator);
+      ~HUDTimer();
+
+      virtual void tick(float dt);
+
+      virtual void changedOwner();
+
+      private:
+        ControllableEntity* owner_;
+  };
+}
+#endif /* _HUDTimer_H__ */
