Index: code/trunk/src/libraries/network/GamestateManager.h
===================================================================
--- code/trunk/src/libraries/network/GamestateManager.h	(revision 10546)
+++ code/trunk/src/libraries/network/GamestateManager.h	(revision 10622)
@@ -1,3 +1,3 @@
-/*
+  /*
  *   ORXONOX - the hottest 3D action shooter ever to exist
  *                    > www.orxonox.net <
@@ -78,7 +78,7 @@
       std::map< uint32_t, packet::Gamestate* > gamestates;
     };
-    
+
   public:
-    
+
     GamestateManager();
     ~GamestateManager();
@@ -88,5 +88,5 @@
     virtual uint32_t  getLastReceivedGamestateID( unsigned int peerID );
     virtual uint32_t  getCurrentGamestateID(){ if( currentGamestate_) return currentGamestate_->getID(); else return GAMESTATEID_INITIAL; }
-    
+
     bool processGamestates();
     bool sendAck(unsigned int gamestateID, uint32_t peerID);
Index: code/trunk/src/libraries/network/LANDiscoverable.cc
===================================================================
--- code/trunk/src/libraries/network/LANDiscoverable.cc	(revision 10546)
+++ code/trunk/src/libraries/network/LANDiscoverable.cc	(revision 10622)
@@ -35,4 +35,7 @@
 #include "util/Output.h"
 #include "packet/ServerInformation.h"
+#include "core/config/ConfigValueIncludes.h"
+#include "core/CoreIncludes.h"
+
 
 namespace orxonox
@@ -43,7 +46,19 @@
   LANDiscoverable::LANDiscoverable()
   {
+    /* register object in orxonox */
+    RegisterObject(LANDiscoverable);
+
+    this->setConfigValues();
+    //     this->setActivity(true);
     this->host_ = 0;
     this->bActive_ = false;
-//     this->setActivity(true);
+  }
+
+  void LANDiscoverable::setConfigValues()
+  {
+    /* update ownName string from orxonox.ini config file, if it
+     * has changed.
+     */
+    SetConfigValueExternal(ownName, "Discovery", "ownName", "OrxServer");
   }
 
@@ -61,5 +76,5 @@
     if( bActive == this->bActive_ )        // no change
       return;
-    
+
     if( bActive )
     {
@@ -84,9 +99,9 @@
   {
     ENetEvent event;
-    
+
     if( this->bActive_==false )
       return;
     assert(this->host_);
-    
+
     while( enet_host_service( this->host_, &event, 0 ) > 0 )
     {
@@ -104,5 +119,6 @@
             orxout(internal_info, context::network) << "Received LAN discovery message from client " << event.peer->host->receivedAddress << endl;
             packet::ServerInformation info;
-            info.setServerName("Orxonox Server");
+            info.setServerName(this->ownName);
+            info.setClientNumber(this->clientNumber);
             info.send(event.peer);
 //             ENetPacket* packet = enet_packet_create( LAN_DISCOVERY_ACK, strlen(LAN_DISCOVERY_ACK)+1, ENET_PACKET_FLAG_RELIABLE );
Index: code/trunk/src/libraries/network/LANDiscoverable.h
===================================================================
--- code/trunk/src/libraries/network/LANDiscoverable.h	(revision 10546)
+++ code/trunk/src/libraries/network/LANDiscoverable.h	(revision 10622)
@@ -31,9 +31,10 @@
 
 #include "NetworkPrereqs.h"
+#include "core/config/Configurable.h"
 
 namespace orxonox
 {
 
-  class LANDiscoverable
+  class LANDiscoverable: public Configurable
   {
     public:
@@ -42,8 +43,14 @@
       void setActivity( bool bActive );
       void update();
+      void updateClientNumber(int clientNumber) {this->clientNumber = clientNumber;}
+;
+      /** Function used for the configuration file parameter update */
+      void setConfigValues();
 
     private:
       bool            bActive_;
       ENetHost*       host_;
+      std::string     ownName;
+      int             clientNumber;
   };
 
Index: code/trunk/src/libraries/network/LANDiscovery.cc
===================================================================
--- code/trunk/src/libraries/network/LANDiscovery.cc	(revision 10546)
+++ code/trunk/src/libraries/network/LANDiscovery.cc	(revision 10622)
@@ -89,5 +89,8 @@
           {
             packet::ServerInformation info(&event);
-            orxout(internal_info, context::network) << "Received LAN discovery server information; Name: " << info.getServerName() << ", Address: " << info.getServerIP() << ", RTT: " << info.getServerRTT() << endl;
+            std::string payload = info.getServerName();
+            info.setServerName(payload.substr(0,payload.length()-2));
+            info.setClientNumber( Ogre::StringConverter::parseInt(payload.substr(payload.length()-1)));
+            orxout(internal_info, context::network) << "Received LAN discovery server information; Name: " << info.getServerName() << ", Address: " << info.getServerIP() << ", Players: " << info.getClientNumber() << ", RTT: " << info.getServerRTT() << endl;
             std::vector<packet::ServerInformation>::iterator it;
             for( it=this->servers_.begin(); it!=this->servers_.end(); ++it )
@@ -124,4 +127,22 @@
   }
 
+  std::string LANDiscovery::getServerListItemRTT(unsigned int index)
+  {
+    if( index >= this->servers_.size() )
+      return BLANKSTRING;
+    else{
+      uint32_t serverrtt = this->servers_[index].getServerRTT();
+      return Ogre::StringConverter::toString(serverrtt);
+    }
+  }
 
+  std::string LANDiscovery::getServerListItemPlayerNumber(unsigned int index)
+  {
+    if( index >= this->servers_.size() )
+      return BLANKSTRING;
+    else{
+      int playerNumber = this->servers_[index].getClientNumber();
+      return Ogre::StringConverter::toString(playerNumber);
+    }
+  }
 } // namespace orxonox
Index: code/trunk/src/libraries/network/LANDiscovery.h
===================================================================
--- code/trunk/src/libraries/network/LANDiscovery.h	(revision 10546)
+++ code/trunk/src/libraries/network/LANDiscovery.h	(revision 10622)
@@ -33,4 +33,5 @@
 #include "packet/ServerInformation.h"
 #include "util/Singleton.h"
+#include <OgreStringConverter.h>
 
 #include <vector>
@@ -51,6 +52,8 @@
       std::string getServerListItemName( unsigned int index ); // tolua_export
       std::string getServerListItemIP( unsigned int index ); // tolua_export
+      std::string getServerListItemRTT( unsigned int index ); // tolua_export
+      std::string getServerListItemPlayerNumber( unsigned int index ); // tolua_export
       static LANDiscovery& getInstance(){ return Singleton<LANDiscovery>::getInstance(); } // tolua_export
-      
+
     private:
       static LANDiscovery* singletonPtr_s;
Index: code/trunk/src/libraries/network/MasterServer.cc
===================================================================
--- code/trunk/src/libraries/network/MasterServer.cc	(revision 10546)
+++ code/trunk/src/libraries/network/MasterServer.cc	(revision 10622)
@@ -34,5 +34,5 @@
 #include "util/Output.h"
 
-namespace orxonox 
+namespace orxonox
 {
   /*** MACROS ***/
@@ -45,9 +45,6 @@
   MasterServer *MasterServer::instance = NULL;
 
-
-
-
   /* command: list servers */
-  void 
+  void
   MasterServer::listServers( void )
   {
@@ -59,6 +56,6 @@
 
     /* loop through list elements */
-    for( i = MasterServer::getInstance()->mainlist.serverlist.begin(); 
-      i != MasterServer::getInstance()->mainlist.serverlist.end(); ++i ) 
+    for( i = MasterServer::getInstance()->mainlist.serverlist.begin();
+      i != MasterServer::getInstance()->mainlist.serverlist.end(); ++i )
     {
       orxout(user_info) << "  " << (*i).ServerInfo.getServerIP() << std::endl;
@@ -70,13 +67,13 @@
   }
 
-  void 
+  void
   MasterServer::delServer( std::string todeladdr )
   {
     /* tell the user we're now removing the entry from the server list */
-    orxout(user_info) << "MS: Deleting server \"" << todeladdr << "\"..." 
+    orxout(user_info) << "MS: Deleting server \"" << todeladdr << "\"..."
       << std::endl;
 
     /* see if we actually have that server on our list */
-    ServerListSearchResult shandle = 
+    ServerListSearchResult shandle =
       MasterServer::getInstance()->mainlist.findServerByAddress(todeladdr);
 
@@ -86,5 +83,5 @@
     }
 
-    /* force-disconnect the server */  
+    /* force-disconnect the server */
     enet_peer_disconnect( shandle.result.peer, 0 );
 
@@ -98,14 +95,14 @@
 
   /* helpers */
-  static void 
+  static void
   helper_output_debug( ENetEvent *event, char *addrconv )
   {
     orxout(verbose, context::master_server)
-      << "A packet of length" 
+      << "A packet of length"
       << event->packet->dataLength
       << " containing "
       << (const char*)event->packet->data
       << " was received from "
-      << addrconv 
+      << addrconv
       << " on channel "
       << event->channelID << endl;
@@ -122,21 +119,21 @@
 
     /* loop through list elements */
-    for( i = mainlist.serverlist.begin(); i 
-        != mainlist.serverlist.end(); ++i ) 
+    for( i = mainlist.serverlist.begin(); i
+        != mainlist.serverlist.end(); ++i )
     {
       /* send this particular server */
       /* build reply string */
-      char *tosend = (char *)calloc( (*i).ServerInfo.getServerIP().length() 
-          + MSPROTO_SERVERLIST_ITEM_LEN + 2,1 );
-      if( !tosend ) 
+      int packetlen = MSPROTO_SERVERLIST_ITEM_LEN + 1 + (*i).ServerInfo.getServerIP().length() + 1 + (*i).ServerInfo.getServerName().length() + 1 + sizeof((*i).ServerInfo.getClientNumber()) + 1;
+      char *tosend = (char *)calloc(packetlen ,1 );
+      if( !tosend )
       { orxout(internal_warning, context::master_server) << "Masterserver.cc: Memory allocation failed." << endl;
         continue;
-      } 
-      sprintf( tosend, "%s %s", MSPROTO_SERVERLIST_ITEM, 
-          (*i).ServerInfo.getServerIP().c_str() );
+      }
+      sprintf( tosend, "%s %s %s %u", MSPROTO_SERVERLIST_ITEM,
+          (*i).ServerInfo.getServerIP().c_str(), (*i).ServerInfo.getServerName().c_str(), (*i).ServerInfo.getClientNumber());
 
       /* create packet from it */
       reply = enet_packet_create( tosend,
-          strlen( tosend ) + 1, 
+          strlen( tosend ) + 1,
           ENET_PACKET_FLAG_RELIABLE);
 
@@ -149,5 +146,5 @@
       /* free the tosend buffer */
       free( tosend );
-    } 
+    }
 
     /* create end-of-list packet */
@@ -163,25 +160,25 @@
   }
 
-  /* maybe the two methods below can be merged into one and 
-   * made to use ENet's RTT functionality to check for disconnected 
+  /* maybe the two methods below can be merged into one and
+   * made to use ENet's RTT functionality to check for disconnected
    * servers.
    */
-  void 
+  void
   MasterServer::helper_cleanupServers( void )
   {
     /* get an iterator */
     std::list<ServerListElem>::iterator i;
-     
+
     if( mainlist.serverlist.size() == 0 )
       return;
 
     /* loop through list elements */
-    for( i = mainlist.serverlist.begin(); i 
-        != mainlist.serverlist.end(); ++i ) 
+    for( i = mainlist.serverlist.begin(); i
+        != mainlist.serverlist.end(); ++i )
     { /* see if we have a disconnected peer */
-      if( (*i).peer && 
+      if( (*i).peer &&
          ((*i).peer->state == ENET_PEER_STATE_DISCONNECTED ||
           (*i).peer->state == ENET_PEER_STATE_ZOMBIE ))
-      { 
+      {
         /* Remove it from the list */
         orxout(internal_warning) << (char*)(*i).peer->data << " timed out.\n";
@@ -190,5 +187,5 @@
         /* stop iterating, we manipulated the list */
         /* TODO note: this only removes one dead server per loop
-         * iteration. not beautiful, but one iteration is ~100ms, 
+         * iteration. not beautiful, but one iteration is ~100ms,
          * so not really relevant for the moment.
          */
@@ -196,5 +193,5 @@
       }
     }
- 
+
   }
 
@@ -204,5 +201,5 @@
   /***** EVENTS *****/
   /* connect event */
-  int 
+  int
   MasterServer::eventConnect( ENetEvent *event )
   { /* check for bad parameters */
@@ -217,11 +214,11 @@
 
     /* output debug info */
-    orxout(verbose, context::master_server) << "A new client connected from " 
-      << addrconv 
-      << " on port " 
+    orxout(verbose, context::master_server) << "A new client connected from "
+      << addrconv
+      << " on port "
       << event->peer->address.port << endl;
 
     /* store string form of address here */
-    event->peer->data = addrconv; 
+    event->peer->data = addrconv;
 
     /* all fine. */
@@ -230,5 +227,5 @@
 
   /* disconnect event */
-  int 
+  int
   MasterServer::eventDisconnect( ENetEvent *event )
   { /* check for bad parameters */
@@ -255,5 +252,5 @@
 
   /* data event */
-  int 
+  int
   MasterServer::eventData( ENetEvent *event )
   { /* validate packet */
@@ -262,8 +259,15 @@
       return -1;
     }
-     
+
     /* generate address in readable form */
     char *addrconv = (char *) calloc( 50, 1 );
     enet_address_get_host_ip( &(event->peer->address), addrconv, 49 );
+    /* convert to string */
+    std::string ip = std::string( addrconv );
+    /* delete addrconv */
+    if( addrconv ) free( addrconv );
+
+    /* pointer to full packet data */
+    char * packetdata = (char *)event->packet->data;
 
     /* output debug info about the data that has come */
@@ -271,49 +275,61 @@
 
     /* GAME SERVER OR CLIENT CONNECTION? */
-    if( !strncmp( (char *)event->packet->data, MSPROTO_GAME_SERVER, 
-      MSPROTO_GAME_SERVER_LEN ) )
+    if( !strncmp(packetdata, MSPROTO_GAME_SERVER, MSPROTO_GAME_SERVER_LEN ) )
     { /* Game server */
 
-      if( !strncmp( (char *)event->packet->data 
-        + MSPROTO_GAME_SERVER_LEN+1, 
-        MSPROTO_REGISTER_SERVER, MSPROTO_REGISTER_SERVER_LEN ) )
+      if( !strncmp( packetdata + MSPROTO_GAME_SERVER_LEN+1, MSPROTO_REGISTER_SERVER, MSPROTO_REGISTER_SERVER_LEN ) )
       { /* register new server */
-        mainlist.addServer( packet::ServerInformation( event ),
-          event->peer );
-        
+        mainlist.addServer( packet::ServerInformation( event ), event->peer );
+
         /* tell people we did so */
-        orxout(internal_info, context::master_server) << "Added new server to list: " << 
+        orxout(internal_info, context::master_server) << "Added new server to list: " <<
           packet::ServerInformation( event ).getServerIP() << endl;
       }
 
-      else if( !strncmp( (char *)event->packet->data
-        + MSPROTO_GAME_SERVER_LEN+1,
-        MSPROTO_SERVERDC, MSPROTO_SERVERDC_LEN ) )
-      {
+      else if( !strncmp( packetdata + MSPROTO_GAME_SERVER_LEN+1, MSPROTO_SERVERDC, MSPROTO_SERVERDC_LEN ) )
+      { /* disconnect server */
+
+        /* remove the server from the list it belongs to */
+        this->mainlist.delServerByAddress( ip );
+
+        /* tell the user */
+        orxout(internal_info, context::master_server) << "Removed server " << ip << " from list." << endl;
+      }
+      /* TODO add hook for disconnect here */
+
+      else if( !strncmp( packetdata + MSPROTO_GAME_SERVER_LEN+1, MSPROTO_SET_NAME, MSPROTO_SET_NAME_LEN ) )
+      { /* save server name */
         /* create string from peer data */
-        std::string name = std::string( addrconv );
+        std::string data (event->packet->data,event->packet->data + event->packet->dataLength );
+        std::string name = data.substr(MSPROTO_GAME_SERVER_LEN+1 + MSPROTO_SET_NAME_LEN + 1);
 
         /* remove the server from the list it belongs to */
-        this->mainlist.delServerByAddress( name );
+        this->mainlist.setNameByAddress( ip, name );
 
         /* tell the user */
-        orxout(internal_info, context::master_server) << "Removed server " << name << " from list." << endl;
-      }
-
-      /* TODO add hook for disconnect here */
-    }
-    else if( !strncmp( (char *)event->packet->data, MSPROTO_CLIENT, 
-      MSPROTO_CLIENT_LEN) )
+        orxout(internal_info, context::master_server) << "Updated server " << ip << " with new name " << name << endl;
+      }
+
+      else if( !strncmp( packetdata + MSPROTO_GAME_SERVER_LEN+1, MSPROTO_SET_CLIENTS, MSPROTO_SET_CLIENTS_LEN ) )
+      { /* save client count from server */
+        /* create string from peer data */
+        std::string data (event->packet->data,event->packet->data + event->packet->dataLength );
+        std::string textform= data.substr(MSPROTO_GAME_SERVER_LEN + 1 + MSPROTO_SET_CLIENTS_LEN + 1);
+        int clientNumber = Ogre::StringConverter::parseInt(textform);
+
+        this->mainlist.setClientsByAddress( ip, clientNumber);
+
+        /* tell the user */
+        orxout(internal_info, context::master_server) << "Updated server " << ip << " with new client number " << clientNumber << endl;
+      }
+    }
+    else if( !strncmp( packetdata, MSPROTO_CLIENT, MSPROTO_CLIENT_LEN) )
     { /* client */
-      if( !strncmp( (char *)event->packet->data + MSPROTO_CLIENT_LEN+1,
-        MSPROTO_REQ_LIST, MSPROTO_REQ_LIST_LEN ) )
+      if( !strncmp( packetdata + MSPROTO_CLIENT_LEN+1, MSPROTO_REQ_LIST, MSPROTO_REQ_LIST_LEN ) )
         /* send server list */
         helper_sendlist( event );
     }
     else
-    { /* bad message, don't do anything. */ } 
-
-    /* delete addrconv */
-    if( addrconv ) free( addrconv );
+    { /* bad message, don't do anything. */ }
 
     /* Clean up the packet now that we're done using it. */
@@ -324,5 +340,5 @@
 
   /**** MAIN ROUTINE *****/
-  int 
+  int
   MasterServer::run()
   {
@@ -330,5 +346,5 @@
     ENetEvent *event = (ENetEvent *)calloc(sizeof(ENetEvent), sizeof(char));
     if( event == NULL )
-    { 
+    {
       orxout(user_error, context::master_server) << "Could not create ENetEvent structure, exiting." << endl;
       exit( EXIT_FAILURE );
@@ -345,9 +361,9 @@
     switch (event->type)
     { /* new connection */
-      case ENET_EVENT_TYPE_CONNECT: 
+      case ENET_EVENT_TYPE_CONNECT:
         eventConnect( event ); break;
 
         /* disconnect */
-      case ENET_EVENT_TYPE_DISCONNECT: 
+      case ENET_EVENT_TYPE_DISCONNECT:
         eventDisconnect( event ); break;
 
@@ -358,6 +374,7 @@
 
     /* done */
+    free(event);
     return 0;
-  } 
+  }
 
   /* constructor */
@@ -380,7 +397,7 @@
     this->address.port = ORX_MSERVER_PORT;
 
-    /* create a host with the above settings (the last two 0 mean: accept 
+    /* create a host with the above settings (the last two 0 mean: accept
      * any input/output bandwidth */
-    this->server = enet_host_create( &this->address, ORX_MSERVER_MAXCONNS, 
+    this->server = enet_host_create( &this->address, ORX_MSERVER_MAXCONNS,
         ORX_MSERVER_MAXCHANS, 0, 0 );
     assert(this->server);
@@ -388,5 +405,5 @@
     /* see if creation worked */
     if( !this->server )
-    { orxout(user_error, context::master_server) << 
+    { orxout(user_error, context::master_server) <<
         "An error occurred while trying to create an ENet server host." << endl;
       exit( EXIT_FAILURE );
Index: code/trunk/src/libraries/network/MasterServer.h
===================================================================
--- code/trunk/src/libraries/network/MasterServer.h	(revision 10546)
+++ code/trunk/src/libraries/network/MasterServer.h	(revision 10622)
@@ -49,5 +49,8 @@
 #include <cstdio>
 
-namespace orxonox 
+#include <OgreStringConverter.h>
+
+
+namespace orxonox
 {
   /* singleton */
@@ -63,9 +66,9 @@
       /* static pointer for commands */
       static MasterServer *instance;
-      static MasterServer *getInstance() 
+      static MasterServer *getInstance()
         { return instance; }
-      static void setInstance( MasterServer *setto ) 
+      static void setInstance( MasterServer *setto )
         { instance = setto;  }
-      
+
       /* functions for commands */
       static void listServers( void );
Index: code/trunk/src/libraries/network/MasterServerProtocol.h
===================================================================
--- code/trunk/src/libraries/network/MasterServerProtocol.h	(revision 10546)
+++ code/trunk/src/libraries/network/MasterServerProtocol.h	(revision 10622)
@@ -37,11 +37,9 @@
 /* Client token (shows that the party sending data is a client */
 #define MSPROTO_CLIENT "CL"
-#define MSPROTO_CLIENT_LEN 2 
+#define MSPROTO_CLIENT_LEN 2
 
 /* Request: Serverlist (requiest made from client to master server */
 #define MSPROTO_REQ_LIST "REQ:LIST"
 #define MSPROTO_REQ_LIST_LEN 8
-
-
 
 
@@ -67,5 +65,5 @@
 /* ping request from server */
 #define MSPROTO_PING_GAMESERVER "PING"
-#define MSPROTO_PING_GAMESERVER_LEN 4 
+#define MSPROTO_PING_GAMESERVER_LEN 4
 
 /* server disconnect */
@@ -75,7 +73,15 @@
 /* ping reply */
 #define MSPROTO_ACK "ACK"
-#define MSPROTO_ACK_LEN 3 
+#define MSPROTO_ACK_LEN 3
 
+/* server name */
+#define MSPROTO_SET_NAME "NAM"
+#define MSPROTO_SET_NAME_LEN 3
 
+/* server number of clients */
+#define MSPROTO_SET_CLIENTS "CLI"
+#define MSPROTO_SET_CLIENTS_LEN 3
+
+#define SERVER_NAME_MAXLEN 7
 
 /* default master server port */
Index: code/trunk/src/libraries/network/PeerList.cc
===================================================================
--- code/trunk/src/libraries/network/PeerList.cc	(revision 10546)
+++ code/trunk/src/libraries/network/PeerList.cc	(revision 10622)
@@ -38,8 +38,8 @@
   PeerList::~PeerList() { }
 
-  int 
+  int
   PeerList::addPeer( ENetPeer *toadd )
   { /* error correction */
-    if( toadd == NULL ) 
+    if( toadd == NULL )
     { orxout(internal_error, context::master_server) << "PeerList::addPeer: empty peer given." << endl;
       return -1;
@@ -52,5 +52,5 @@
 
   bool sub_compAddr( ENetAddress addr1, ENetAddress addr2 )
-  { 
+  {
     for( int i = 0; i < 16; ++i )
       if( addr1.host.addr[i] < addr2.host.addr[i] )
@@ -61,5 +61,5 @@
     return 0;
   }
-    
+
 
   bool
@@ -69,5 +69,5 @@
 
     /* loop through list elements */
-    for( i = peerlist.begin(); i != peerlist.end(); ++i ) 
+    for( i = peerlist.begin(); i != peerlist.end(); ++i )
       if( !sub_compAddr((*i)->address, addr ) )
       { /* found this name, remove and quit */
@@ -86,5 +86,5 @@
 
     /* loop through list elements */
-    for( i = peerlist.begin(); i != peerlist.end(); ++i ) 
+    for( i = peerlist.begin(); i != peerlist.end(); ++i )
       if( !sub_compAddr((*i)->address, addr ) )
         /* found this name, remove and quit */
@@ -95,4 +95,8 @@
   }
 
+  int
+  PeerList::count(){
+    return this->peerlist.size();
+  }
+
 }
-
Index: code/trunk/src/libraries/network/PeerList.h
===================================================================
--- code/trunk/src/libraries/network/PeerList.h	(revision 10546)
+++ code/trunk/src/libraries/network/PeerList.h	(revision 10622)
@@ -35,10 +35,10 @@
 
 /* peer list */
-namespace orxonox 
+namespace orxonox
 {
-  /** This class keeps a list of open connections 
+  /** This class keeps a list of open connections
    * and some info about them.
    */
-  class PeerList 
+  class PeerList
   { public:
       /** constructor */
@@ -50,6 +50,6 @@
       /** \param toadd The peer to add
        * \return 0 for success, -1 for error.
-       * 
-       * Add new peer to list 
+       *
+       * Add new peer to list
        */
       int addPeer( ENetPeer *toadd );
@@ -57,15 +57,21 @@
       /** \param addr Address to look for
        * \return if the peer was found or not
-       * 
-       * Remove peer from list by address 
+       *
+       * Remove peer from list by address
        */
       bool remPeerByAddr( ENetAddress addr );
 
       /** \param addr The address to find by
-       * 
-       * Find a connection by address */
+       *
+       * Find a connection by address
+       */
       ENetPeer *findPeerByAddr( ENetAddress addr );
 
-      /* NOTE: making this list public so it can easily 
+      /**
+       * Count current peers
+       */
+       int count();
+
+      /* NOTE: making this list public so it can easily
        * be iterated. This makes sense since iterating it
        * will happen all the time, and using getter methods
Index: code/trunk/src/libraries/network/Server.cc
===================================================================
--- code/trunk/src/libraries/network/Server.cc	(revision 10546)
+++ code/trunk/src/libraries/network/Server.cc	(revision 10622)
@@ -77,5 +77,11 @@
     this->timeSinceLastUpdate_=0;
   }
-
+/*
+  Server::Server(int port, const std::string name)
+  {
+    this->setPort( port );
+    this->timeSinceLastUpdate_=0;
+    this->serverName_=name;
+  }*/
   /**
   * Constructor
@@ -108,7 +114,9 @@
     /* make discoverable on LAN */
     LANDiscoverable::setActivity(true);
+    LANDiscoverable::updateClientNumber(0);
 
     /* make discoverable on WAN */
     WANDiscoverable::setActivity(true);
+    WANDiscoverable::updateClientNumber(0);
 
     /* done */
@@ -283,4 +291,7 @@
     // inform all the listeners
     this->clientIDs_.push_back(peerID);
+    WANDiscoverable::updateClientNumber(this->clientIDs_.size());
+    LANDiscoverable::updateClientNumber(this->clientIDs_.size());
+
     ClientConnectionListener::broadcastClientConnected(peerID);
     GamestateManager::addPeer(peerID);
@@ -289,4 +300,5 @@
 
     orxout(internal_info, context::network) << "Server: added client id: " << peerID << endl;
+
     createClient(peerID);
 }
@@ -309,4 +321,7 @@
     }
   }
+  WANDiscoverable::updateClientNumber(this->clientIDs_.size());
+  LANDiscoverable::updateClientNumber(this->clientIDs_.size());
+
   ClientConnectionListener::broadcastClientDisconnected(peerID);
   GamestateManager::removePeer(peerID);
Index: code/trunk/src/libraries/network/Server.h
===================================================================
--- code/trunk/src/libraries/network/Server.h	(revision 10546)
+++ code/trunk/src/libraries/network/Server.h	(revision 10622)
@@ -67,4 +67,7 @@
     virtual void printRTT();
     float getPacketLoss(unsigned int clientID);
+    int getClientCount() { return this->clientIDs_.size();}
+    std::string getServerName() { return this->serverName_;}
+
   protected:
     void updateGamestate();
@@ -89,4 +92,5 @@
     std::deque<packet::Packet*> packetQueue_;
     std::vector<uint32_t>       clientIDs_;
+    std::string                 serverName_;
   };
 
Index: code/trunk/src/libraries/network/ServerList.cc
===================================================================
--- code/trunk/src/libraries/network/ServerList.cc	(revision 10546)
+++ code/trunk/src/libraries/network/ServerList.cc	(revision 10622)
@@ -30,5 +30,5 @@
 
 namespace orxonox
-{ 
+{
   ServerList::ServerList()
   { /* create a new list */ }
@@ -39,24 +39,24 @@
   }
 
-  int 
+  int
   ServerList::addServer( packet::ServerInformation toadd,
     ENetPeer *peer )
-  { 
+  {
     ServerListElem toAdd;
     toAdd.ServerInfo = toadd;
     toAdd.peer = peer;
 
-    this->serverlist.push_back( toAdd ); 
+    this->serverlist.push_back( toAdd );
     return 0;
   }
 
-  bool 
+  bool
   ServerList::delServerByName( std::string name )
-  { 
+  {
     /* get an iterator */
     std::list<ServerListElem>::iterator i;
 
     /* loop through list elements */
-    for( i = serverlist.begin(); i != serverlist.end(); ++i ) 
+    for( i = serverlist.begin(); i != serverlist.end(); ++i )
       if( (*i).ServerInfo.getServerName() == name )
       { /* found this name, remove and quit */
@@ -68,10 +68,10 @@
 
   bool ServerList::delServerByAddress( std::string address )
-  { 
+  {
     /* get an iterator */
     std::list<ServerListElem>::iterator i;
 
     /* loop through list elements */
-    for( i = serverlist.begin(); i != serverlist.end(); ++i ) 
+    for( i = serverlist.begin(); i != serverlist.end(); ++i )
       if( (*i).ServerInfo.getServerIP() == address )
       { /* found this name, remove and quit */
@@ -90,5 +90,5 @@
 
     /* loop through list elements */
-    for( i = serverlist.begin(); i != serverlist.end(); ++i ) 
+    for( i = serverlist.begin(); i != serverlist.end(); ++i )
       if( (*i).ServerInfo.getServerIP() == address )
       { /* found the target, return it */
@@ -110,7 +110,7 @@
     /* iterate, return when name found */
     /* loop through list elements */
-    for( i = serverlist.begin(); i != serverlist.end(); ++i ) 
+    for( i = serverlist.begin(); i != serverlist.end(); ++i )
       if( (*i).ServerInfo.getServerName() == name )
-      { 
+      {
         ServerListSearchResult res = { (*i), true };
         return res;
@@ -124,24 +124,52 @@
   /* SORTING */
   /* sort by name */
-  bool sub_compare_names( ServerListElem no1, 
+  bool sub_compare_names( ServerListElem no1,
     ServerListElem no2 )
   { return no1.ServerInfo.getServerName() > no2.ServerInfo.getServerName(); }
 
   void ServerList::sortByName()
-  { 
-    this->serverlist.sort( sub_compare_names ); 
+  {
+    this->serverlist.sort( sub_compare_names );
   }
-  
+
   /* sort by ping */
-  bool sub_compare_pings( ServerListElem no1, 
+  bool sub_compare_pings( ServerListElem no1,
     ServerListElem no2 )
-  { 
-    return no1.ServerInfo.getServerName() > no2.ServerInfo.getServerName();
+  {
+    return no1.ServerInfo.getServerRTT() > no2.ServerInfo.getServerRTT();
   }
 
   void ServerList::sortByPing()
   {
-    this->serverlist.sort( sub_compare_pings ); 
+    this->serverlist.sort( sub_compare_pings );
   }
 
+  bool ServerList::setNameByAddress( std::string address, std::string name  ){
+    /* get an iterator */
+    std::list<ServerListElem>::iterator i;
+
+    /* loop through list elements */
+    for( i = serverlist.begin(); i != serverlist.end(); ++i )
+      if( (*i).ServerInfo.getServerIP() == address )
+      { /* found this adress, rename and quit */
+        (*i).ServerInfo.setServerName( name );
+        return true;
+      }
+    return false;
+  };
+
+  bool ServerList::setClientsByAddress( std::string address, int clientNumber ){
+    /* get an iterator */
+    std::list<ServerListElem>::iterator i;
+
+    /* loop through list elements */
+    for( i = serverlist.begin(); i != serverlist.end(); ++i )
+      if( (*i).ServerInfo.getServerIP() == address )
+      { /* found this adress, rename and quit */
+        (*i).ServerInfo.setClientNumber( clientNumber );
+        return true;
+      }
+    return false;
+  };
+
 }
Index: code/trunk/src/libraries/network/ServerList.h
===================================================================
--- code/trunk/src/libraries/network/ServerList.h	(revision 10546)
+++ code/trunk/src/libraries/network/ServerList.h	(revision 10622)
@@ -35,8 +35,8 @@
 
 /* methods necessary */
-namespace orxonox 
-{ 
+namespace orxonox
+{
   /* HELPER STRUCTURES */
-  struct ServerListElem 
+  struct ServerListElem
   {
     /* server information (name, IP, etc) */
@@ -63,5 +63,5 @@
    * and some info about them.
    */
-  class ServerList 
+  class ServerList
   { public:
       /** constructor */
@@ -74,5 +74,5 @@
       /* BASIC MANIPULATION */
       /** \param toadd the server to add.
-       * 
+       *
        * Add server to the game server list
        */
@@ -81,24 +81,25 @@
 
       /** \param name Name of the server to remove
-       * 
-       * Remove server by name 
+       *
+       * Remove server by name
        */
       bool delServerByName( std::string name );
 
       /** \param address IP address of the server to remove
-       * 
+       *
        * Remove server by address
        */
       bool delServerByAddress( std::string address );
 
+      bool setNameByAddress( std::string address, std::string name  );
 
-
+      bool setClientsByAddress( std::string address, int clientNumber );
 
       /* SEARCHING */
-      /* \param address The address of the server that is to be 
+      /* \param address The address of the server that is to be
        *  found
        * \return A struct containing a result of the search and a boolean
        *  that is only true if the search was successful
-       * 
+       *
        * Find and return the list handle of a given address.
        */
@@ -107,8 +108,8 @@
 
 
-      /* \param name The name of the server that is to be 
+      /* \param name The name of the server that is to be
        *  found
        * \return The struct containing the list entry of the server
-       * 
+       *
        * Find and return the list handle of a given name.
        */
@@ -120,5 +121,5 @@
       /** sort by name  */
       void sortByName();
-      
+
       /** sort by ping */
       void sortByPing();
Index: code/trunk/src/libraries/network/WANDiscoverable.cc
===================================================================
--- code/trunk/src/libraries/network/WANDiscoverable.cc	(revision 10546)
+++ code/trunk/src/libraries/network/WANDiscoverable.cc	(revision 10622)
@@ -44,5 +44,5 @@
     /* debugging output */
     orxout(verbose, context::master_server) << "Creating WANDiscoverable." << endl;
-  
+
     /* register object in orxonox */
     RegisterObject(WANDiscoverable);
@@ -50,15 +50,15 @@
     /* check for the masterserver address option in orxonox.ini */
     this->setConfigValues();
-    
+
   }
 
   void WANDiscoverable::setConfigValues()
   {
-    /* update msaddress string from orxonox.ini config file, if it 
-     * has changed. 
+    /* update msaddress string from orxonox.ini config file, if it
+     * has changed.
      */
-    SetConfigValueExternal(msaddress, "WANDiscovery", "msaddress", "orxonox.net");
-//     SetConfigValue( msaddress, "orxonox.net");
-  } 
+    SetConfigValueExternal(msaddress, "Discovery", "msaddress", "orxonox.net");
+    SetConfigValueExternal(ownName, "Discovery", "ownName", "OrxServer");
+  }
 
   WANDiscoverable::~WANDiscoverable()
@@ -67,10 +67,10 @@
       this->disconnect();
   }
-  
+
   void WANDiscoverable::setActivity(bool bActive)
   {
     if( bActive==this->bActive_ )
       return;
-    
+
     if( bActive )
     {
@@ -84,5 +84,5 @@
     }
   }
-  
+
   bool WANDiscoverable::connect()
   {
@@ -93,20 +93,23 @@
       return false;
     }
-    
+
     /* connect and see if it worked */
     if( msc.connect( this->msaddress.c_str(), ORX_MSERVER_PORT ) )
     {
-      orxout(internal_error, context::master_server) << "Could not connect to master server at " 
+      orxout(internal_error, context::master_server) << "Could not connect to master server at "
                  << this->msaddress << endl;
       return false;
     }
-                 
+
     /* debugging output */
     orxout(verbose, context::master_server) << "Initialization of WANDiscoverable complete." << endl;
-    
-    
+
     // Now register the server at the master server
     this->msc.sendRequest( MSPROTO_GAME_SERVER " " MSPROTO_REGISTER_SERVER );
-    
+
+    std::string request = MSPROTO_GAME_SERVER " " MSPROTO_SET_NAME " ";
+    request += this->ownName;
+    this->msc.sendRequest( request );
+
     return true;
   }
@@ -118,6 +121,15 @@
   }
 
+  void WANDiscoverable::updateClientNumber(int clientNumber)
+  {
+    orxout(verbose, context::master_server) << "Sending new number of clients: " << clientNumber << endl;
+    std::string request = MSPROTO_GAME_SERVER " " MSPROTO_SET_CLIENTS " ";
+    request += Ogre::StringConverter::toString(clientNumber);
+
+    this->msc.sendRequest( request );
+  }
 
 
-  
+
+
 } // namespace orxonox
Index: code/trunk/src/libraries/network/WANDiscoverable.h
===================================================================
--- code/trunk/src/libraries/network/WANDiscoverable.h	(revision 10546)
+++ code/trunk/src/libraries/network/WANDiscoverable.h	(revision 10622)
@@ -32,4 +32,5 @@
 #include "core/config/Configurable.h"
 #include "MasterServerComm.h"
+#include <OgreStringConverter.h>
 
 namespace orxonox
@@ -46,6 +47,6 @@
 
       /** \return Address of the master server
-       * 
-       * Get the master server address 
+       *
+       * Get the master server address
        */
       std::string getMSAddress()
@@ -54,20 +55,23 @@
       /** Function used for the configuration file parameter update */
       void setConfigValues();
-      
+
       /** Function used to set the activity/discoverability */
       void setActivity( bool bActive );
 
+      void updateClientNumber(int clientNumber);
+
       /** Master server communications object */
       MasterServerComm msc;
-      
+
     private:
       /** Function used to connect to the master server */
       bool connect();
-      
+
       /** Function used to disconnect from the master server */
       void disconnect();
-      
+
       /** master server address */
       std::string msaddress;
+      std::string ownName;
       bool        bActive_;
 
Index: code/trunk/src/libraries/network/WANDiscovery.cc
===================================================================
--- code/trunk/src/libraries/network/WANDiscovery.cc	(revision 10546)
+++ code/trunk/src/libraries/network/WANDiscovery.cc	(revision 10622)
@@ -41,5 +41,5 @@
     /* debugging output */
     orxout(verbose, context::master_server) << "Creating WANDiscovery." << endl;
-  
+
     /* register object in orxonox */
     RegisterObject(WANDiscovery);
@@ -54,5 +54,5 @@
     /* connect and see if it worked */
     if( msc.connect( this->msaddress.c_str(), ORX_MSERVER_PORT ) )
-      orxout(internal_error, context::master_server) << "Could not connect to master server at " 
+      orxout(internal_error, context::master_server) << "Could not connect to master server at "
         << this->msaddress << endl;
 
@@ -63,19 +63,19 @@
   void WANDiscovery::setConfigValues()
   {
-    /* update msaddress string from orxonox.ini config file, if it 
-     * has changed. 
+    /* update msaddress string from orxonox.ini config file, if it
+     * has changed.
      */
     SetConfigValue( msaddress, "master.orxonox.net");
-  } 
+  }
 
   WANDiscovery::~WANDiscovery()
-  { 
+  {
     /* clear server list */
-    this->servers_.clear();  
+    this->servers_.clear();
   }
 
   /* callback for the network reply poller */
   int WANDiscovery::rhandler( char *addr, ENetEvent *ev )
-  { 
+  {
     /* error recognition */
     if( !ev || !ev->packet || !ev->packet->data )
@@ -88,13 +88,17 @@
     if( !strncmp( (char*)ev->packet->data, MSPROTO_SERVERLIST_ITEM,
       MSPROTO_SERVERLIST_ITEM_LEN ) )
-    { 
+    {
       /* create server structure from that item */
       packet::ServerInformation toadd;
 
       /* fill in data, -1 for the index: index should be length -1 */
-      toadd.setServerName( std::string((char*)ev->packet->data + 
-        MSPROTO_SERVERLIST_ITEM_LEN+1) );
-      toadd.setServerIP( std::string((char*)ev->packet->data + 
-        MSPROTO_SERVERLIST_ITEM_LEN+1) );
+      std::string datastr = std::string((char*)ev->packet->data + MSPROTO_SERVERLIST_ITEM_LEN+1);
+      int separator = datastr.find(" ");
+      toadd.setServerIP(datastr.substr(0,separator));
+      int secondsep = datastr.find(" ", separator + 1);
+      toadd.setServerName(datastr.substr(separator + 1, secondsep - separator - 1));
+      toadd.setClientNumber(Ogre::StringConverter::parseInt(datastr.substr(secondsep+1)));
+
+      orxout(internal_info, context::network) << "Received WAN discovery server information; Name: " << toadd.getServerName() << ", Address: " << toadd.getServerIP() << ", Players: " << toadd.getClientNumber() << ", RTT: " << toadd.getServerRTT() << endl;
 
       /* add to list */
@@ -103,10 +107,10 @@
     else if( !strncmp( (char*)ev->packet->data, MSPROTO_SERVERLIST_END,
       MSPROTO_SERVERLIST_END_LEN ) )
-    { 
+    {
       /* this is the only case where 2 should be returned,
        * as 1 is used to signal that we're done receiving
        * the list
        */
-      return 2; 
+      return 2;
     }
 
@@ -114,5 +118,5 @@
     return 1;
   }
- 
+
   void WANDiscovery::discover()
   {
@@ -131,5 +135,5 @@
       { case 0: /* no event occured, decrease timeout */
           --i; break;
-        case 1: /* got a list element, continue */ 
+        case 1: /* got a list element, continue */
           break;
         case 2: /* done. */
@@ -159,4 +163,23 @@
   }
 
+  std::string WANDiscovery::getServerListItemRTT(unsigned int index)
+  {
+    if( index >= this->servers_.size() )
+      return BLANKSTRING;
+    else{
+      uint32_t serverrtt = this->servers_[index].getServerRTT();
+      return Ogre::StringConverter::toString(serverrtt);
+    }
+
+  }
+  std::string WANDiscovery::getServerListItemPlayerNumber(unsigned int index)
+  {
+    if( index >= this->servers_.size() )
+      return BLANKSTRING;
+    else{
+      int playerNumber = this->servers_[index].getClientNumber();
+      return Ogre::StringConverter::toString(playerNumber);
+    }
+  }
 
 } // namespace orxonox
Index: code/trunk/src/libraries/network/WANDiscovery.h
===================================================================
--- code/trunk/src/libraries/network/WANDiscovery.h	(revision 10546)
+++ code/trunk/src/libraries/network/WANDiscovery.h	(revision 10622)
@@ -35,4 +35,5 @@
 #include "MasterServerComm.h"
 #include "MasterServerProtocol.h"
+#include <OgreStringConverter.h>
 
 #include <vector>
@@ -56,6 +57,6 @@
 
       /** \return Address of the master server
-       * 
-       * Get the master server address 
+       *
+       * Get the master server address
        */
       std::string getMSAddress()
@@ -65,20 +66,34 @@
       void discover(); // tolua_export
 
-      /** \param index Index to get the name of 
+      /** \param index Index to get the name of
        * \return The name of the server
-       * 
-       * Get the name of the server at index index. 
+       *
+       * Get the name of the server at index index.
        */
       std::string getServerListItemName( unsigned int index ); // tolua_export
 
-      /** \param index Index to get the IP of 
+      /** \param index Index to get the IP of
        * \return The IP of the server
-       * 
-       * Get the IP of the server at index index. 
+       *
+       * Get the IP of the server at index index.
        */
       std::string getServerListItemIP( unsigned int index ); // tolua_export
 
+      /** \param index Index to get the RTT of
+       * \return The RTT of the server
+       *
+       * Get the RTT of the server at index index.
+       */
+      std::string getServerListItemRTT( unsigned int index ); // tolua_export
+
+      /** \param index Index to get the RTT of
+       * \return The number of players on the server
+       *
+       * Get the number of players on the server
+       */
+      std::string getServerListItemPlayerNumber( unsigned int index ); // tolua_export
+
       /* todo: might make this private and use getter/setter methods
-       * at some later time. 
+       * at some later time.
        */
       /** game server list */
@@ -92,5 +107,5 @@
 
       int rhandler( char *addr, ENetEvent *ev );
-      
+
     private:
       /** master server address */
Index: code/trunk/src/libraries/network/packet/ServerInformation.cc
===================================================================
--- code/trunk/src/libraries/network/packet/ServerInformation.cc	(revision 10546)
+++ code/trunk/src/libraries/network/packet/ServerInformation.cc	(revision 10622)
@@ -39,10 +39,9 @@
   namespace packet
   {
-    
+
     ServerInformation::ServerInformation()
     {
-      
     }
-    
+
     ServerInformation::ServerInformation(ENetEvent* event)
     {
@@ -69,20 +68,21 @@
     ServerInformation::~ServerInformation()
     {
-      
+
     }
 
     void ServerInformation::send(ENetPeer* peer)
     {
-      uint32_t size = returnSize((char*&)LAN_DISCOVERY_ACK) + returnSize(this->serverName_);
+      std::string payload = this->serverName_ + Ogre::StringConverter::toString(this->clientNumber_);
+      uint32_t size = returnSize((char*&)LAN_DISCOVERY_ACK) + returnSize(payload);
       uint8_t* temp = new uint8_t[size];
       uint8_t* temp2 = temp;
       saveAndIncrease((char*&)LAN_DISCOVERY_ACK, temp2);
-      saveAndIncrease(this->serverName_, temp2);
+      saveAndIncrease(payload, temp2);
       ENetPacket* packet = enet_packet_create( temp, size, 0 );
       enet_peer_send(peer, 0, packet);
-      
+
       delete[] temp;
     }
-  
+
   } // namespace packet
 
@@ -95,3 +95,2 @@
   }
 } // namespace orxonox
-
Index: code/trunk/src/libraries/network/packet/ServerInformation.h
===================================================================
--- code/trunk/src/libraries/network/packet/ServerInformation.h	(revision 10546)
+++ code/trunk/src/libraries/network/packet/ServerInformation.h	(revision 10622)
@@ -30,4 +30,6 @@
 
 #include <string>
+#include <OgreStringConverter.h>
+
 
 #ifndef SERVERINFORMATION_H
@@ -45,14 +47,17 @@
         ServerInformation(ENetEvent* event);
         ~ServerInformation();
-        
+
         void          send( ENetPeer* peer );
+        void          setServerName(std::string name) { this->serverName_ = name; }
+        std::string   getServerName() { return this->serverName_; }
+        void          setServerIP( std::string IP ) { this->serverIP_ = IP; }
         std::string   getServerIP() { return this->serverIP_; }
-        std::string   getServerName() { return this->serverName_; }
-        void          setServerName(std::string name) { this->serverName_ = name; }
-        void          setServerIP( std::string IP ) { this->serverIP_ = IP; }
+        void          setClientNumber( int clientNumber ) { this->clientNumber_ = clientNumber; }
+        int           getClientNumber() { return this->clientNumber_; }
         uint32_t      getServerRTT() { return this->serverRTT_; }
-        
+
       private:
         std::string   serverName_;
+        int           clientNumber_;
         std::string   serverIP_;
         uint32_t      serverRTT_;
Index: code/trunk/src/modules/objects/ForceField.h
===================================================================
--- code/trunk/src/modules/objects/ForceField.h	(revision 10546)
+++ code/trunk/src/modules/objects/ForceField.h	(revision 10622)
@@ -160,5 +160,4 @@
             const std::string& getMode(void); //!< Get the mode of the ForceField.
 
-        private:
             //! Strings to represent the modes.
             static const std::string modeTube_s;
@@ -166,7 +165,7 @@
             static const std::string modeInvertedSphere_s;
             static const std::string modeNewtonianGravity_s;
-
             static const std::string modeHomogen_s;
 
+        private:
             float velocity_; //!< The velocity of the ForceField.
             float radius_; //!< The radius of the ForceField.
Index: code/trunk/src/modules/objects/Turret.cc
===================================================================
--- code/trunk/src/modules/objects/Turret.cc	(revision 10546)
+++ code/trunk/src/modules/objects/Turret.cc	(revision 10622)
@@ -223,4 +223,5 @@
         XMLPortParam(Turret, "maxYaw", setMaxYaw, getMaxYaw, xmlelement, mode);
         XMLPortParam(Turret, "maxPitch", setMaxPitch, getMaxPitch, xmlelement, mode);
+        XMLPortParam(Turret, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode);
     }
 
Index: code/trunk/src/modules/objects/Turret.h
===================================================================
--- code/trunk/src/modules/objects/Turret.h	(revision 10546)
+++ code/trunk/src/modules/objects/Turret.h	(revision 10622)
@@ -102,4 +102,10 @@
                 { return this->maxYaw_; }
 
+            inline void setRotationThrust(float rotationthrust)
+            	{ this->rotationThrust_ = rotationthrust; }
+
+            inline float getRotationThrust()
+            	{ return this->rotationThrust_; }
+
         protected:
             Vector3 startDir_; //!< The initial facing direction, in local coordinates.
Index: code/trunk/src/modules/objects/controllers/TurretController.cc
===================================================================
--- code/trunk/src/modules/objects/controllers/TurretController.cc	(revision 10546)
+++ code/trunk/src/modules/objects/controllers/TurretController.cc	(revision 10622)
@@ -104,5 +104,5 @@
         {
             Pawn* entity = orxonox_cast<Pawn*>(*it);
-            if (!entity || FormationController::sameTeam(this->getControllableEntity(), entity, this->getGametype()))
+            if (!entity || FormationController::sameTeam(turret, entity, this->getGametype()))
                 continue;
             tempScore = turret->isInRange(entity);
@@ -196,4 +196,5 @@
             if(this->isLookingAtTargetNew(Degree(5).valueRadians()))
             {
+
                 this->getControllableEntity()->fire(0);
             }
Index: code/trunk/src/modules/tetris/Tetris.h
===================================================================
--- code/trunk/src/modules/tetris/Tetris.h	(revision 10546)
+++ code/trunk/src/modules/tetris/Tetris.h	(revision 10622)
@@ -90,5 +90,4 @@
             void clearRow(unsigned int row);
 
-
             PlayerInfo* player_;
 
Index: code/trunk/src/modules/towerdefense/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/towerdefense/CMakeLists.txt	(revision 10546)
+++ code/trunk/src/modules/towerdefense/CMakeLists.txt	(revision 10622)
@@ -2,5 +2,4 @@
   TowerDefense.cc
   TowerDefenseTower.cc
-  TowerTurret.cc
   TowerDefenseCenterpoint.cc
   TowerDefenseHUDController.cc
@@ -8,5 +7,5 @@
   TDCoordinate.cc
   TowerDefenseEnemy.cc
-
+  TowerDefenseSelecter.cc
 )
 
@@ -17,4 +16,5 @@
     orxonox
     overlays
+    objects
   SOURCE_FILES ${TOWERDEFENSE_SRC_FILES}
 )
Index: code/trunk/src/modules/towerdefense/TDCoordinate.cc
===================================================================
--- code/trunk/src/modules/towerdefense/TDCoordinate.cc	(revision 10546)
+++ code/trunk/src/modules/towerdefense/TDCoordinate.cc	(revision 10622)
@@ -17,13 +17,50 @@
     {
         //RegisterObject(TDCoordinate);
-        x=0;
-        y=0;
+        Set(0,0);
 
     }
 
     TDCoordinate::TDCoordinate(int x, int y)
-    {
-        this->x=x;
-        this->y=y;
+    {        
+        Set(x,y);
+    }
+
+    void TDCoordinate::Set(int x, int y)
+    {        
+        if (x < 0)
+        {
+            _x = 0;
+        }
+        else if (x > 15)
+        {
+            _x = 15;
+        }
+        else
+        {
+            _x = x;
+        }
+
+        if (y < 0)
+        {
+            _y = 0;
+        }
+        else if (y > 15)
+        {
+            _y = 15;
+        }
+        else
+        {
+            _y = y;
+        }
+    }
+
+    int TDCoordinate::GetX()
+    {        
+        return _x;
+    }
+
+    int TDCoordinate::GetY()
+    {        
+        return _y;
     }
 
@@ -34,6 +71,6 @@
 
         Vector3 *coord = new Vector3();
-        coord->x= (x-8) * tileScale;
-        coord->y= (y-8) * tileScale;
+        coord->x= (_x-8) * tileScale;
+        coord->y= (_y-8) * tileScale;
         coord->z=100;
 
Index: code/trunk/src/modules/towerdefense/TDCoordinate.h
===================================================================
--- code/trunk/src/modules/towerdefense/TDCoordinate.h	(revision 10546)
+++ code/trunk/src/modules/towerdefense/TDCoordinate.h	(revision 10622)
@@ -16,14 +16,15 @@
     {
         public:
-            int x;
-            int y;
+            TDCoordinate();
+            TDCoordinate(int x, int y);
+            virtual ~TDCoordinate() {};
+            virtual void Set(int x, int y);
+            virtual int GetX();
+            virtual int GetY();
+            virtual Vector3 get3dcoordinate(); 
 
-            TDCoordinate();
-
-            Vector3 get3dcoordinate();
-
-            virtual ~TDCoordinate() {};
-
-            TDCoordinate(int x, int y);
+        private:
+            int _x;
+            int _y;
     };
 
Index: code/trunk/src/modules/towerdefense/Tower.cc
===================================================================
--- code/trunk/src/modules/towerdefense/Tower.cc	(revision 10546)
+++ 	(revision )
@@ -1,113 +1,0 @@
-//
-//  Tower.cc
-//  Orxonox
-//
-//  Created by Fabian Mentzer on 29.04.12.
-//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
-/* Not implemented fully */
-
-#include "Tower.h"
-
-#include "core/CoreIncludes.h"
-//#include "core/XMLPort.h"
-
-namespace orxonox
-{
-    RegisterClass(Tower);
-
-    /**
-    @brief
-        Constructor. Registers and initializes the object.
-    */
-    Tower::Tower(Context* context) : Pawn(context)
-    {
-        RegisterObject(Tower);
-
-        this->setCollisionType(WorldEntity::Dynamic);
-
-        //this->removeAllEngines();
-
-        /*
-        this->size_ = 10.0f;
-        this->delay_ = false;
-        this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this)));
-        */
-    }
-
-    void Tower::setOrientation(const Quaternion& orientation)
-    {
-        static int ori;
-        //orxout() << "orientation " << ++ori << endl;
-    }
-
-    void Tower::rotateYaw(const Vector2& value)
-    {
-        static int yaw;
-        //orxout() << "rotateYaw " << ++yaw << endl;
-    }
-
-    void Tower::rotatePitch(const Vector2& value)
-    {
-        static int pitch;
-        //orxout() << "rotatePitch " << ++pitch << endl;
-    }
-
-    void Tower::rotateRoll(const Vector2& value)
-    {
-        static int roll;
-        //orxout() << "rotateRoll" << ++roll << endl;
-    }
-
-    // This function is called whenever a player presses the up or the down key.
-    // You have to implement what happens when the up or the down key is pressed.
-    // value.x < 0 means: down key is pressed.
-    // I suggest to create a new class which is a controllable entity I will refer to as "TowerMover". This is the controllable entity that the
-    // player controls in order to move the tower along the centerpoint and in order to place the tower at the appropriate position.
-    //
-
-    // The tower itsself is controlled by a WayPointPatroController at the instance you place it on the centerpoint.
-    //(don't forget to set the team_ parameter such that all tower are in the same team)
-
-    //How to move a tower: simply attach the tower to the TowerMover
-    //How to place a tower: detach the tower from the TowerMover
-
-    /**
-    @brief
-        Overloaded the function to rotate the stone.
-    @param value
-        A vector whose first component is the angle by which to rotate.
-    */
-    /*
-    void Tower::moveFrontBack(const Vector2& value)
-    {
-        //orxout() << "frontBack.x: " << value.x << endl;
-    }
-    */
-
-    /**
-    @brief
-        Overloaded the function to steer the stone right and left
-    @param value
-        A vector whose first component is the direction in which we want to steer the stone.
-    */
-    /*
-    void Tower::moveRightLeft(const Vector2& value)
-    {
-        //orxout() << "rightLeft.x: " << value.x << endl;
-
-        if(!this->delay_)
-        {
-            const Vector3& position = this->getPosition();
-            Vector3 newPos = Vector3(position.x+value.x/abs(value.x)*this->size_, position.y, position.z);
-            if(!this->tetris_->isValidMove(this, newPos))
-                return;
-
-            this->setPosition(newPos);
-            this->delay_ = true;
-            this->delayTimer_.startTimer();
-        }
-    }
-    */
-}
Index: code/trunk/src/modules/towerdefense/Tower.h
===================================================================
--- code/trunk/src/modules/towerdefense/Tower.h	(revision 10546)
+++ 	(revision )
@@ -1,52 +1,0 @@
-//
-//  Tower.h
-//  Orxonox
-//
-//  Created by Fabian Mentzer on 29.04.12.
-//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
-/**
-@brief
-See TowerDefenseReadme.txt for Information.
-
-@ingroup TowerDefense
-*/
-
-
-#ifndef Orxonox_Tower_h
-#define Orxonox_Tower_h
-
-#include "towerdefense/TowerDefensePrereqs.h"
-#include "worldentities/pawns/SpaceShip.h"
-
-
-namespace orxonox
-{
-    class _TowerDefenseExport Tower : public Pawn
-    {
-    public:
-        Tower(Context* context);
-        virtual ~Tower() {};
-
-        // Maybe later override these to move towers with cursor keys
-        /*
-        virtual void moveFrontBack(const Vector2& value);
-        virtual void moveRightLeft(const Vector2& value);
-        */
-
-        // Overriding these to stop towers from spasing out
-        void setOrientation(const Quaternion& orientation);
-        virtual void rotateYaw(const Vector2& value);
-        virtual void rotatePitch(const Vector2& value);
-        virtual void rotateRoll(const Vector2& value);
-
-        void setGame(TowerDefense* towerdefense)
-        { assert(towerdefense); game_ = towerdefense; }
-    private:
-        TowerDefense* game_;
-    };
-}
-
-
-#endif
Index: code/trunk/src/modules/towerdefense/TowerDefense.cc
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefense.cc	(revision 10546)
+++ code/trunk/src/modules/towerdefense/TowerDefense.cc	(revision 10622)
@@ -37,5 +37,4 @@
  *
  *
- *
  *TIPP: Eclipse hilft euch schnell auf bereits vorhanden Funktionen zuzugreifen:
  * einfach "this->" eingeben und kurz warten. Dann tauch eine Liste mit Vorschlägen auf. Wenn ihr jetzt weiter
@@ -77,5 +76,4 @@
 #include "TowerDefenseCenterpoint.h"
 //#include "TDCoordinate.h"
-#include "TowerTurret.h"
 #include "worldentities/SpawnPoint.h"
 #include "worldentities/pawns/Pawn.h"
@@ -88,10 +86,24 @@
 /* Part of a temporary hack to allow the player to add towers */
 #include "core/command/ConsoleCommand.h"
+#include <cmath>
+
 
 namespace orxonox
 {
+    static const std::string __CC_addTower_name  = "addTower";
+    static const std::string __CC_upgradeTower_name = "upgradeTower";
+    static const int upgradeCost = 20;
+    static const int towerCost = 20;
+    unsigned int maxspaceships = 30;
+    int maxspaceshipsstandard = 30;
+
+
+
+    SetConsoleCommand("TowerDefense", __CC_addTower_name,  &TowerDefense::addTower ).addShortcut().defaultValues(1);
+    SetConsoleCommand("TowerDefense", __CC_upgradeTower_name, &TowerDefense::upgradeTower).addShortcut().defaultValues(0);
+
     RegisterUnloadableClass(TowerDefense);
 
-    TowerDefense::TowerDefense(Context* context) : Deathmatch(context)
+    TowerDefense::TowerDefense(Context* context) : TeamDeathmatch(context)
     {
         RegisterObject(TowerDefense);
@@ -103,11 +115,23 @@
         }*/
 
+        //Timer for the waves (10 seconds between the waves)
+        selecter = NULL;
+        this->player_ = NULL;        
         this->setHUDTemplate("TowerDefenseHUD");
-
-        //this->stats_ = new TowerDefensePlayerStats();
-
-        /* Temporary hack to allow the player to add towers and upgrade them */
-        this->dedicatedAddTower_ = createConsoleCommand( "addTower", createExecutor( createFunctor(&TowerDefense::addTower, this) ) );
-        this->dedicatedUpgradeTower_ = createConsoleCommand( "upgradeTower", createExecutor( createFunctor(&TowerDefense::upgradeTower, this) ) );
+        this->nextwaveTimer_.setTimer(10, false, createExecutor(createFunctor(&TowerDefense::nextwave, this)));
+        this->nextwaveTimer_.stopTimer();
+        this->waves_ = 0;
+        this->time = 0;
+        this->credit_ = 0;
+        this->lifes_ = 0;
+        this->timeSetTower_ = 0;
+        spaceships =15;
+        eggs=3;
+        ufos=7;
+        randomships=5;
+
+
+        ModifyConsoleCommand(__CC_addTower_name).setObject(this);
+        ModifyConsoleCommand(__CC_upgradeTower_name).setObject(this);
     }
 
@@ -117,6 +141,6 @@
         if (this->isInitialized())
         {
-            if( this->dedicatedAddTower_ )
-                delete this->dedicatedAddTower_;
+            ModifyConsoleCommand(__CC_addTower_name).setObject(NULL);
+            ModifyConsoleCommand(__CC_upgradeTower_name).setObject(NULL);
         }
     }
@@ -131,38 +155,70 @@
     void TowerDefense::start()
     {
-
-        Deathmatch::start();
-
-// Waypoints: [1,3] [10,3] [10,11] [13,11] -> add the points to a matrix so the player cant place towers on the path
-        for (int i=0; i < 16 ; i++){
-            for (int j = 0; j< 16 ; j++){
-                towermatrix[i][j] = false;
+        if (center_ != NULL) // There needs to be a TowerDefenseCenterpoint, i.e. the area the game takes place.
+        {
+            if (selecter == NULL)
+            {
+                selecter = new TowerDefenseSelecter(this->center_->getContext());                
             }
-        }
-
+            selecter->addTemplate(center_->getSelecterTemplate());
+            center_->attach(selecter);
+        }
+        else // If no centerpoint was specified, an error is thrown and the level is exited.
+        {
+            orxout(internal_error) << "Jump: No Centerpoint specified." << endl;
+            return;
+        }
+
+        TeamDeathmatch::start();
+
+        // Waypoints: [1,3] [10,3] [10,11] [13,11] -> add the points to a matrix so the player cant place towers on the path
+        for (int i=0; i < 16 ; i++)
+        {
+            for (int j = 0; j< 16 ; j++)
+            {
+                towerModelMatrix[i][j] = NULL;
+                towerTurretMatrix[i][j] = NULL;
+            }
+        }
+
+        
+
+        if (player_ != NULL)
+        {
+            //this->player_->startControl(selecter);
+        }
+        else
+        {
+            orxout() << "player=NULL" << endl;
+        }
+
+
+        Model* dummyModel = new Model(this->center_->getContext());
+
+        //the path of the spacehips has to be blocked, so that no towers can be build there
         for (int k=0; k<3; k++)
-            towermatrix[1][k]=true;
+            towerModelMatrix[1][k]=dummyModel;
         for (int l=1; l<11; l++)
-            towermatrix[l][3]=true;
+        	towerModelMatrix[l][3]=dummyModel;
         for (int m=3; m<12; m++)
-            towermatrix[10][m]=true;
+        	towerModelMatrix[10][m]=dummyModel;
         for (int n=10; n<14; n++)
-            towermatrix[n][11]=true;
+        	towerModelMatrix[n][11]=dummyModel;
         for (int o=13; o<16; o++)
-            towermatrix[13][o]=true;
+        	towerModelMatrix[13][o]=dummyModel;
+
 
         //set initial credits, lifes and WaveNumber
-        this->setCredit(200);
-        this->setLifes(50);
+        this->setCredit(100);
+        this->setLifes(100);
         this->setWaveNumber(0);
         time=0.0;
 
+        /*
         //adds initial towers
         for (int i=0; i <7; i++){
             addTower(i+3,4);
-        }/*
-        for (int j=0; j < 7; j++){
-            addTower(9,j+5);
-        }*/
+        }
+		*/
     }
 
@@ -178,5 +234,6 @@
             en1->addTemplate("enemytowerdefense1");
             en1->setScale(3);
-            en1->setHealth(en1->getHealth() + this->getWaveNumber()*4);
+            en1->lookAt(Vector3(0,0,100000));
+            en1->setHealth(en1->getHealth() +50 + this->getWaveNumber()*4);
             break;
 
@@ -184,5 +241,7 @@
             en1->addTemplate("enemytowerdefense2");
             en1->setScale(2);
-            en1->setHealth(en1->getHealth() + this->getWaveNumber()*4);
+            en1->lookAt(Vector3(0,0,100000));
+            en1->roll(Degree(120));
+            en1->setHealth(en1->getHealth() -30 + this->getWaveNumber()*4);
             //  en1->setShieldHealth(en1->getShield() = this->getWaveNumber()*2))
             break;
@@ -191,10 +250,13 @@
             en1->addTemplate("enemytowerdefense3");
             en1->setScale(1);
-            en1->setHealth(en1->getHealth() + this->getWaveNumber()*4);
+            en1->lookAt(Vector3(0,0,100000));
+            en1->roll(Degree(120));
+            en1->setHealth(en1->getHealth() -10 + this->getWaveNumber()*4);
             break;
         }
 
+        en1->setTeam(2);
         en1->getController();
-        en1->setPosition(path.at(0)->get3dcoordinate());
+        en1->setPosition(path.at(0)->get3dcoordinate());        
         TowerDefenseEnemyvector.push_back(en1);
 
@@ -209,13 +271,40 @@
     {
 
-        Deathmatch::end();
+        TeamDeathmatch::end();
         ChatManager::message("Match is over! Gameover!");
 
+    }
+
+    void TowerDefense::spawnPlayer(PlayerInfo* player)
+    {
+        assert(player);
+        this->player_ = player;
+
+        if (selecter->getPlayer() == NULL)
+        {
+            this->player_ = player;
+            player->startControl(selecter);
+            players_[player].state_ = PlayerState::Alive;
+        } 
+    }
+
+    /**
+    @brief
+        Get the player.
+    @return
+        Returns a pointer to the player. If there is no player, NULL is returned.
+    */
+    PlayerInfo* TowerDefense::getPlayer(void) const
+    {
+        return this->player_;
     }
 
     //not working yet
     void TowerDefense::upgradeTower(int x,int y)
-    {/*
-        const int upgradeCost = 20;
+    {
+        TDCoordinate* coord = new TDCoordinate(x,y);
+        x = coord->GetX();
+        y = coord->GetY();
+        
 
         if (!this->hasEnoughCreditForTower(upgradeCost))
@@ -225,5 +314,8 @@
         }
 
-        if (towermatrix [x][y] == NULL)
+
+        Model* dummyModel2 = new Model(this->center_->getContext());
+
+        if (towerModelMatrix [x][y] == NULL || (towerModelMatrix [x][y])->getMeshSource() == dummyModel2->getMeshSource())
         {
             orxout() << "no tower on this position" << endl;
@@ -233,15 +325,37 @@
         else
         {
-            (towermatrix [x][y])->upgradeTower();
-        }*/
+            (towerTurretMatrix [x][y])->upgradeTower();
+            switch(towerTurretMatrix[x][y]->upgrade)
+                   {
+                   case 1 :
+                	   towerModelMatrix[x][y]->setMeshSource("TD_T2.mesh");
+                	   break;
+
+                   case 2 :
+                	   towerModelMatrix[x][y]->setMeshSource("TD_T3.mesh");
+                	   break;
+                   case 3 :
+                	   towerModelMatrix[x][y]->setMeshSource("TD_T4.mesh");
+                	   break;
+                   case 4 :
+                	   towerModelMatrix[x][y]->setMeshSource("TD_T5.mesh");
+                	   break;
+
+                   }
+
+            this->buyTower(upgradeCost);
+        }
     }
 
     /*adds Tower at Position (x,y) and reduces credit and adds the point to the towermatrix. template ("towerturret")
     so towers have ability if the turrets
-
     */
+
     void TowerDefense::addTower(int x, int y)
-    {
-        const int towerCost = 20;
+    {        
+        TDCoordinate* coord = new TDCoordinate(x,y);
+        x = coord->GetX();
+        y = coord->GetY();
+
 
         if (!this->hasEnoughCreditForTower(towerCost))
@@ -251,5 +365,5 @@
         }
 
-        if (towermatrix [x][y]==true)
+        if (towerModelMatrix [x][y]!=NULL)
         {
             orxout() << "not possible to put tower here!!" << endl;
@@ -264,23 +378,33 @@
         int tileScale = (int) this->center_->getTileScale();
 
-        if (x > 15 || y > 15 || x < 0 || y < 0)
+        /*if (x > 15 || y > 15 || x < 0 || y < 0)
         {
             //Hard coded: TODO: let this depend on the centerpoint's height, width and fieldsize (fieldsize doesn't exist yet)
             orxout() << "Can not add Tower: x and y should be between 0 and 15" << endl;
             return;
-        }
-
-        orxout() << "Will add tower at (" << (x-8) * tileScale << "," << (y-8) * tileScale << ")" << endl;
-
-       //Reduce credit
-        this->buyTower(towerCost);
-        towermatrix [x][y]=true;
+        }*/
+
+        //orxout() << "Will add tower at (" << (x-8) * tileScale << "," << (y-8) * tileScale << ")" << endl;
+        orxout() << "Will add tower at (" << x << "," << y << ")" << endl;
+
+
+        //Create Model
+        Model* newTowerModel = new Model(this->center_->getContext());
+        newTowerModel->setMeshSource("TD_T1.mesh");
+        newTowerModel->setScale(30);
+        newTowerModel->pitch(Degree(90));
+        newTowerModel->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 80);
 
         //Creates tower
         TowerDefenseTower* towernew = new TowerDefenseTower(this->center_->getContext());
-        towernew->addTemplate("towerturret");
-        towernew->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 75);
+        towernew->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 275);
         towernew->setGame(this);
-    }
+        towernew->setTeam(1);
+
+        //Reduce credit
+         this->buyTower(towerCost);
+         towerModelMatrix [x][y]= newTowerModel;
+         towerTurretMatrix [x][y]= towernew;
+    }    
 
     bool TowerDefense::hasEnoughCreditForTower(int towerCost)
@@ -296,18 +420,136 @@
 
  
+    void TowerDefense::nextwave()
+    {
+
+    	orxout() << "newwave" << endl;
+    	TowerDefenseEnemyvector.clear();
+    	waves_++;
+        //maxspaceships = round(maxspaceshipsstandard + 0.25*(waves_));
+    	time=0;
+
+    	int helpnumber = 40 -(waves_);
+    	if(helpnumber <= 0) {helpnumber =1;}
+        float numSpaceships = std::abs((rand() % 100)*5.0f*(helpnumber));
+        float numEggs = std::abs((rand() % 100)*1.0f*(waves_));
+        float numUfos = std::abs((rand() % 100)*1.5f*(0.5f*(waves_))) ;
+
+        float totalnumber = (numSpaceships + numEggs + numUfos)*1.3f;
+
+        int newspaceships = (int)(maxspaceships* numSpaceships / totalnumber);
+        int neweggs = (int)(maxspaceships*numEggs / totalnumber);
+        int newufos = (int)(maxspaceships*numUfos / totalnumber);
+        int newrandomships = maxspaceships -newspaceships - neweggs - newufos;
+        spaceships =newspaceships;
+        eggs=neweggs;
+        ufos=newufos;
+        randomships=newrandomships;
+
+        orxout() << spaceships << endl;
+        orxout() << eggs << endl;
+        orxout() << ufos << endl;
+        orxout() << randomships << endl;
+
+
+
+
+
+    }
+
     void TowerDefense::tick(float dt)
     {
         SUPER(TowerDefense, tick, dt);
         time +=dt;
+        timeSetTower_ +=dt;
+
+        //Check if tower has to be set (because TowerDefenseSelecter asks for it)
+        if(timeSetTower_ >= 0.25)
+        {
+        	timeSetTower_ =0;
+			if(selecter != NULL && selecter->firePressed_)
+			{
+
+				int x = selecter->selectedPos_->GetX();
+				int y = selecter->selectedPos_->GetY();
+				Model* dummyModel2 = new Model(this->center_->getContext());
+
+
+
+				if(towerModelMatrix[x][y] == NULL)
+				{
+					addTower(x,y);
+				}
+				else
+				{
+					if(!((towerModelMatrix [x][y])->getMeshSource() == dummyModel2->getMeshSource()))
+					{
+						towerTurretMatrix[x][y]->upgradeTower();
+				        if(towerTurretMatrix[x][y]->upgrade < towerTurretMatrix[x][y]->upgradeMax)
+				        {
+				        	int specificupgradecost = (int)(upgradeCost*(std::pow(1.5,towerTurretMatrix[x][y]->upgrade)));
+				        	if(this->credit_ >= specificupgradecost)
+				        	{
+					        	this->buyTower(specificupgradecost);
+								switch(towerTurretMatrix[x][y]->upgrade)
+							   {
+								   case 1 :
+									   towerModelMatrix[x][y]->setMeshSource("TD_T2.mesh");
+									   break;
+
+								   case 2 :
+									   towerModelMatrix[x][y]->setMeshSource("TD_T3.mesh");
+									   break;
+				                   case 3 :
+				                	   towerModelMatrix[x][y]->setMeshSource("TD_T4.mesh");
+				                	   break;
+				                   case 4 :
+				                	   towerModelMatrix[x][y]->setMeshSource("TD_T5.mesh");
+				                	   break;
+
+							   }
+				        	}
+
+
+				        }
+					}
+				}
+				selecter->firePressed_ = false;
+			}
+        }
 
         TDCoordinate* coord1 = new TDCoordinate(1,1);
         std::vector<TDCoordinate*> path;
         path.push_back(coord1);
-        if(time>1 && TowerDefenseEnemyvector.size() < 30)
-        {
-            //adds different types of enemys depending on the WaveNumber
-            addTowerDefenseEnemy(path, this->getWaveNumber() % 3 +1 );
-            time = time-1;
-        }
+
+
+
+
+
+        if(time>=TowerDefenseEnemyvector.size() && TowerDefenseEnemyvector.size() < maxspaceships)
+		{
+
+        	//adds different types of enemys depending on the WaveNumber progressively making the combination of enemys more difficult
+        	if(spaceships>0)
+        	{
+    			addTowerDefenseEnemy(path, 1);
+    			spaceships--;
+
+        	}else if(ufos>0)
+        	{
+    			addTowerDefenseEnemy(path, 3);
+    			ufos--;
+        	}else if(eggs>0)
+        	{
+    			addTowerDefenseEnemy(path, 2);
+    			eggs--;
+        	}else if(randomships>0)
+        	{
+    			addTowerDefenseEnemy(path, rand() % 3 +1);
+    			randomships--;
+
+        	}
+
+		}
+
 
         Vector3* endpoint = new Vector3(500, 700, 150);
@@ -317,5 +559,5 @@
             if(TowerDefenseEnemyvector.at(i) != NULL && TowerDefenseEnemyvector.at(i)->isAlive())
             {
-                //destroys enemys at the end of teh path and reduces the life by 1. no credits gifted
+                //destroys enemys at the end of the path and reduces the life by 1. no credits gifted
 
                 Vector3 ship = TowerDefenseEnemyvector.at(i)->getRVWorldPosition();
@@ -333,4 +575,5 @@
             }
         }
+
         //goes thorugh vector to see if an enemy is still alive. if not next wave is launched
         int count= 0;
@@ -343,7 +586,10 @@
         }
 
+        if (count == 0 && !this->nextwaveTimer_.isActive())
+            this->nextwaveTimer_.startTimer();
+
+/*            time2 +=dt;
         if(count== 0)
         {
-            time2 +=dt;
             if(time2 > 10)
             {
@@ -354,7 +600,8 @@
             }
         }
-
-
-    }
+*/
+
+    }
+
 
     // Function to test if we can add waypoints using code only. Doesn't work yet
@@ -399,5 +646,5 @@
     void TowerDefense::playerEntered(PlayerInfo* player)
     {
-        Deathmatch::playerEntered(player);
+        TeamDeathmatch::playerEntered(player);
 
         const std::string& message = player->getName() + " entered the game";
@@ -407,5 +654,5 @@
     bool TowerDefense::playerLeft(PlayerInfo* player)
     {
-        bool valid_player = Deathmatch::playerLeft(player);
+        bool valid_player = TeamDeathmatch::playerLeft(player);
 
         if (valid_player)
@@ -437,5 +684,5 @@
         }
 
-        Deathmatch::pawnKilled(victim, killer);
+        TeamDeathmatch::pawnKilled(victim, killer);
     }
 
Index: code/trunk/src/modules/towerdefense/TowerDefense.h
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefense.h	(revision 10546)
+++ code/trunk/src/modules/towerdefense/TowerDefense.h	(revision 10622)
@@ -38,13 +38,17 @@
 #define _TowerDefense_H__
 #include "TDCoordinate.h"
+#include "TowerDefenseSelecter.h"
 #include "towerdefense/TowerDefensePrereqs.h"
-#include "gametypes/Deathmatch.h"
+#include "gametypes/TeamDeathmatch.h"
 #include "TowerDefenseEnemy.h"
 #include "util/Output.h"
 #include "core/object/WeakPtr.h"
+#include "TowerDefenseSelecter.h"
+#include "graphics/Camera.h"    
+
 
 namespace orxonox
 {
-    class _TowerDefenseExport TowerDefense : public Deathmatch
+    class _TowerDefenseExport TowerDefense : public TeamDeathmatch
     {
     public:
@@ -53,12 +57,12 @@
 
         std::vector<orxonox::WeakPtr<TowerDefenseEnemy> > TowerDefenseEnemyvector;
-        bool towermatrix[16][16];
+        Model* towerModelMatrix[16][16];
+        TowerDefenseTower* towerTurretMatrix[16][16];
         void addTowerDefenseEnemy(std::vector<TDCoordinate*> path, int templatenr);
         virtual void start(); //<! The function is called when the gametype starts
         virtual void end();
         virtual void tick(float dt);
-        //virtual void playerEntered(PlayerInfo* player);
-        //virtual bool playerLeft(PlayerInfo* player);
-        //Player Stats (set,get, reduce)
+        virtual void spawnPlayer(PlayerInfo* player);
+        PlayerInfo* getPlayer(void) const;
         int getCredit(){ return this->credit_; }
         int getLifes(){ return this->lifes_; }
@@ -69,6 +73,12 @@
         void buyTower(int cost){ credit_ -= cost;}
         void addCredit(int credit) { credit_+=credit; }
-        void nextwave(){ waves_++;}
+        void nextwave();
         int reduceLifes(int NumberofLifes){ return lifes_-=NumberofLifes; }
+        TowerDefenseSelecter* selecter;
+        int spaceships;
+        int eggs;
+        int ufos;
+        int randomships;
+
 
         //virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
@@ -83,9 +93,5 @@
         /* Adds a tower at x, y in the playfield */
         void addTower(int x, int y);
-
         void upgradeTower(int x, int y);
-        /* Part of a temporary hack to allow the player to add towers */
-        ConsoleCommand* dedicatedAddTower_;
-        ConsoleCommand* dedicatedUpgradeTower_;
 
         //TODO: void spawnNewWave()
@@ -96,17 +102,16 @@
     private:
         TowerDefenseCenterpoint *center_;
+        PlayerInfo* player_;
         float time;
-        float time2;
+        float timeSetTower_;
+//        float time2;
         int credit_;
         int waves_;
         int lifes_;
+        Timer nextwaveTimer_;
 
         /* handles stats */
         bool hasEnoughCreditForTower(int towerCost);
         bool hasEnoughCreditForUpgrade();
-
-
-
-        std::vector<TowerTurret*> towers_;
     };
 }
Index: code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.cc
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.cc	(revision 10546)
+++ code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.cc	(revision 10622)
@@ -53,5 +53,4 @@
         this->width_ = 15;
         this->height_ = 15;
-        this->towerTemplate_ = "";
 
         //this->setCollisionType(Static);
@@ -72,5 +71,5 @@
         XMLPortParam(TowerDefenseCenterpoint, "height", setHeight, getHeight, xmlelement, mode);
         XMLPortParam(TowerDefenseCenterpoint, "tileScale", setTileScale, getTileScale, xmlelement, mode);
-        XMLPortParam(TowerDefenseCenterpoint, "towerTemplate", setTowerTemplate, getTowerTemplate, xmlelement, mode);
+        XMLPortParam(TowerDefenseCenterpoint, "selecterTemplate", setSelecterTemplate, getSelecterTemplate, xmlelement, mode);
 
         //TODO: add XMLPortObject(TowerDefenseCenterpoint, WorldEntity, "waypoints", addWaypoint, getWaypoint,  xmlelement, mode);
Index: code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.h
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.h	(revision 10546)
+++ code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.h	(revision 10622)
@@ -60,14 +60,14 @@
             void setWidth(unsigned int width)
                 { this->width_ = width; }
-
             unsigned int getWidth(void) const
                 { return this->width_; }
-
             void setHeight(unsigned int height)
                 { this->height_ = height; }
-
             unsigned int getHeight(void) const
                 { return this->height_; }
-
+            void setSelecterTemplate(const std::string& newTemplate)
+                { this->selecterTemplate_ = newTemplate; }
+            const std::string& getSelecterTemplate() const
+                { return this->selecterTemplate_; }   
             /**
                 @brief How to convert to world coordinates, e.g. that 0,15 is not at -8,-8 but at -80,-80 (if scale would be 10)
@@ -79,22 +79,11 @@
                 { return this->tileScale_; }
 
-            /**
-            @brief Set the template for the towers.
-            @param template The template name to be applied to each tower.
-            */
-            void setTowerTemplate(const std::string& templateName)
-                { this->towerTemplate_ = templateName; }
-
-            const std::string& getTowerTemplate(void) const
-                { return this->towerTemplate_; }
-
         private:
             void checkGametype();
 
+            std::string selecterTemplate_;
             unsigned int width_;
             unsigned int height_;
             unsigned int tileScale_;
-
-            std::string towerTemplate_;
     };
 }
Index: code/trunk/src/modules/towerdefense/TowerDefenseEnemy.cc
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefenseEnemy.cc	(revision 10546)
+++ code/trunk/src/modules/towerdefense/TowerDefenseEnemy.cc	(revision 10622)
@@ -35,5 +35,9 @@
     //add credit if enemy is destroyed
     TowerDefenseEnemy::~TowerDefenseEnemy(){
-        //this->td->addCredit(1);
+
+    	if (this->isInitialized())
+    	{
+    		getGame()->addCredit(1);
+    	}
     }
 
@@ -64,8 +68,12 @@
         if (getGame() && once_ == false && getHealth() <= 0)
         {
+        	orxout() << "damagefunctionIF" << endl;
             getGame()->addCredit(1);
             once_ = true;
         }
+        orxout() << "damagefunction" << endl;
+
     }
+
 /*
     void TowerDefenseEnemy::popWaypoint()
Index: code/trunk/src/modules/towerdefense/TowerDefenseSelecter.cc
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefenseSelecter.cc	(revision 10622)
+++ code/trunk/src/modules/towerdefense/TowerDefenseSelecter.cc	(revision 10622)
@@ -0,0 +1,184 @@
+/*
+ *   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:
+ *      Fabien Vultier
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file TowerDefenseSelecter.cc
+    @brief This class represents your figure when you play the minigame. Here the movement of the figure, activating items, ... are handled.
+*/
+
+#include "TowerDefenseSelecter.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "graphics/Model.h"
+
+namespace orxonox
+{
+    RegisterClass(TowerDefenseSelecter);
+
+    TowerDefenseSelecter::TowerDefenseSelecter(Context* context) : ControllableEntity(context)
+    {
+        RegisterObject(TowerDefenseSelecter);
+
+        // initialize variables
+        moveUpPressed_ = false;
+        moveDownPressed_ = false;
+        moveLeftPressed_ = false;
+        moveRightPressed_ = false;
+        firePressed_ = false;
+        setSelectedPosition(6,6);
+        timerSetFire_=0;
+    }
+
+    TowerDefenseSelecter::~TowerDefenseSelecter()
+    {
+
+    }
+
+    void TowerDefenseSelecter::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(TowerDefenseSelecter, XMLPort, xmlelement, mode);
+    }
+
+    void TowerDefenseSelecter::tick(float dt)
+    {
+        SUPER(TowerDefenseSelecter, tick, dt);
+
+
+        if (hasLocalController())
+        {
+        	timerSetFire_ +=dt;
+
+        	if(timerSetFire_ >= 0.25)
+        	{
+        		timerSetFire_ = 0;
+
+        		int selecterPosX = selectedPos_->GetX();
+				int selecterPosY = selectedPos_->GetY();
+
+				if (moveUpPressed_ == true)
+				{
+					moveUpPressed_ = false;
+					selectedPos_->Set(selecterPosX, selecterPosY + 1);
+					updatePosition();
+				}
+				if (moveDownPressed_ == true)
+				{
+					moveDownPressed_ = false;
+					selectedPos_->Set(selecterPosX, selecterPosY - 1);
+					updatePosition();
+				}
+
+				if (moveLeftPressed_ == true)
+				{
+					moveLeftPressed_ = false;
+					selectedPos_->Set(selecterPosX - 1, selecterPosY);
+					updatePosition();
+				}
+				if (moveRightPressed_ == true)
+				{
+					moveRightPressed_ = false;
+					selectedPos_->Set(selecterPosX + 1, selecterPosY);
+					updatePosition();
+				}
+
+
+			}
+
+
+
+        }
+     }
+
+
+    void TowerDefenseSelecter::moveFrontBack(const Vector2& value)
+    {
+        if (value.x > 0)
+        {
+            moveUpPressed_ = true;
+            moveDownPressed_ = false;
+        }
+        else
+        {
+            moveUpPressed_ = false;
+            moveDownPressed_ = true;
+        }
+    }
+
+    void TowerDefenseSelecter::moveRightLeft(const Vector2& value)
+    {
+        if (value.x > 0)
+        {
+            moveLeftPressed_ = false;
+            moveRightPressed_ = true;
+        }
+        else
+        {
+            moveLeftPressed_ = true;
+            moveRightPressed_ = false;
+        }
+    }
+
+    void TowerDefenseSelecter::rotateYaw(const Vector2& value)
+    {
+    }
+
+    void TowerDefenseSelecter::rotatePitch(const Vector2& value)
+    {
+    }
+
+    void TowerDefenseSelecter::rotateRoll(const Vector2& value)
+    {
+    }
+
+
+    void TowerDefenseSelecter::boost(bool bBoost)
+    {
+        firePressed_ = true;
+        orxout() << "boost" << endl;
+    }
+
+
+    void TowerDefenseSelecter::updatePosition()
+    {
+        setPosition(selectedPos_->get3dcoordinate());
+    }
+
+    void TowerDefenseSelecter::setSelectedPosition(TDCoordinate* newPos)
+    {
+        selectedPos_ = newPos;
+        updatePosition();
+    }
+
+    void TowerDefenseSelecter::setSelectedPosition(int x,  int y)
+    {
+        setSelectedPosition(new TDCoordinate(x,y));
+    }
+
+
+}
Index: code/trunk/src/modules/towerdefense/TowerDefenseSelecter.h
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefenseSelecter.h	(revision 10622)
+++ code/trunk/src/modules/towerdefense/TowerDefenseSelecter.h	(revision 10622)
@@ -0,0 +1,67 @@
+/*
+ *   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:
+ *      Fabien Vultier
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _TowerDefenseSelecter_H__
+#define _TowerDefenseSelecter_H__
+
+#include "towerdefense/TowerDefensePrereqs.h"
+#include "worldentities/ControllableEntity.h"
+#include "TDCoordinate.h"
+
+namespace orxonox
+{
+class _TowerDefenseExport TowerDefenseSelecter : public ControllableEntity
+    {
+        public:
+            TowerDefenseSelecter(Context* context); //!< Constructor. Registers and initializes the object.
+            virtual ~TowerDefenseSelecter();
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);         
+            virtual void tick(float dt);            
+            virtual void moveFrontBack(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
+            virtual void moveRightLeft(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
+            virtual void rotateYaw(const Vector2& value);
+            virtual void rotatePitch(const Vector2& value);
+            virtual void rotateRoll(const Vector2& value);
+            virtual void boost(bool bBoost);
+            virtual void setSelectedPosition(TDCoordinate* newPos);
+            virtual void setSelectedPosition(int x, int y);
+            bool firePressed_;
+            TDCoordinate* selectedPos_;
+
+
+        private:            
+            virtual void updatePosition();
+            float timerSetFire_;
+            bool moveUpPressed_;
+            bool moveDownPressed_;
+            bool moveLeftPressed_;
+            bool moveRightPressed_;            
+    };
+}
+
+#endif /* _TowerDefenseSelecter_H__ */
Index: code/trunk/src/modules/towerdefense/TowerDefenseTower.cc
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefenseTower.cc	(revision 10546)
+++ code/trunk/src/modules/towerdefense/TowerDefenseTower.cc	(revision 10622)
@@ -22,10 +22,14 @@
         Constructor. Registers and initializes the object.
     */
-    TowerDefenseTower::TowerDefenseTower(Context* context) : Pawn(context)
+    TowerDefenseTower::TowerDefenseTower(Context* context) : Turret(context)
     {
         RegisterObject(TowerDefenseTower);
+        game_ =NULL;
+        this->setCollisionType(WorldEntity::None);
+        upgrade = 0;
+        this->addTemplate("towerdefensetower");
 
-        this->setCollisionType(WorldEntity::Dynamic);
-        upgrade = 0;
+        upgradeMax = 5;
+
 
         //this->removeAllEngines();
@@ -38,4 +42,5 @@
     }
 
+    /*
     void TowerDefenseTower::setOrientation(const Quaternion& orientation)
     {
@@ -53,19 +58,20 @@
     {
     }
+    */
 
     bool TowerDefenseTower::upgradeTower()
     {
-        if(upgrade < 3)
+        if(upgrade < upgradeMax)
         {
             upgrade++;
             float reloadrate = getReloadRate();
             float reloadwaittime = getReloadWaitTime();
-            this->setDamageMultiplier(5000);
-
-            reloadrate = 0.5f*reloadrate;
-            reloadwaittime = 0.5f*reloadwaittime;
+            this->setDamageMultiplier((upgrade+1)*1.5f);
+            this->setRotationThrust(2*this->getRotationThrust());
+            reloadrate = 0.7f*reloadrate;
+            reloadwaittime = 0.7f*reloadwaittime;
             setReloadRate(reloadrate);
             setReloadWaitTime(reloadwaittime);
-            this->addTemplate("towerturret1");
+            //this->addTemplate("towerturret1");
         }
         else
Index: code/trunk/src/modules/towerdefense/TowerDefenseTower.h
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefenseTower.h	(revision 10546)
+++ code/trunk/src/modules/towerdefense/TowerDefenseTower.h	(revision 10622)
@@ -20,9 +20,10 @@
 #include "towerdefense/TowerDefensePrereqs.h"
 #include "worldentities/pawns/SpaceShip.h"
+#include "objects/Turret.h"
 
 
 namespace orxonox
 {
-    class _TowerDefenseExport TowerDefenseTower : public Pawn
+    class _TowerDefenseExport TowerDefenseTower : public Turret
     {
     public:
@@ -37,8 +38,10 @@
 
         // Overriding these to stop TowerDefenseTowers from spasing out
+        /*
         void setOrientation(const Quaternion& orientation);
         virtual void rotateYaw(const Vector2& value);
         virtual void rotatePitch(const Vector2& value);
         virtual void rotateRoll(const Vector2& value);
+        */
         virtual bool upgradeTower();
 
@@ -46,7 +49,9 @@
         void setGame(TowerDefense* Towerdefense)
         { assert(Towerdefense); game_ = Towerdefense; }
+        int upgrade;
+        int upgradeMax;
     private:
         TowerDefense* game_;
-        int upgrade;
+
     };
 }
Index: code/trunk/src/modules/towerdefense/TowerTurret.cc
===================================================================
--- code/trunk/src/modules/towerdefense/TowerTurret.cc	(revision 10546)
+++ 	(revision )
@@ -1,41 +1,0 @@
-//
-//  Tower.cc
-//  Orxonox
-//
-//  Created by Fabian Mentzer on 29.04.12.
-//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
-/* Not implemented fully */
-
-//#include "Tower.h"
-#include "TowerTurret.h"
-
-#include "core/CoreIncludes.h"
-//#include "core/XMLPort.h"
-
-namespace orxonox
-{
-    RegisterClass(TowerTurret);
-
-    /**
-    @brief
-        Constructor. Registers and initializes the object.
-    */
-    TowerTurret::TowerTurret(Context* context) : StaticEntity(context)
-    {
-        RegisterObject(TowerTurret);
-
-        this->setCollisionType(WorldEntity::Static);
-
-
-    }
-
-    void TowerTurret::setOrientation(const Quaternion& orientation)
-    {
-        static int ori;
-        orxout() << "orientation " << ++ori << endl;
-    }
-
-
-}
Index: code/trunk/src/modules/towerdefense/TowerTurret.h
===================================================================
--- code/trunk/src/modules/towerdefense/TowerTurret.h	(revision 10546)
+++ 	(revision )
@@ -1,53 +1,0 @@
-//
-//  Tower.h
-//  Orxonox
-//
-//  Created by Fabian Mentzer on 29.04.12.
-//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
-//
-
-/**
-@brief
-See TowerDefenseReadme.txt for Information.
-
-@ingroup TowerDefense
-*/
-
-
-#ifndef Orxonox_Tower_h
-#define Orxonox_Tower_h
-
-#include "towerdefense/TowerDefensePrereqs.h"
-#include "worldentities/pawns/SpaceShip.h"
-#include "worldentities/StaticEntity.h"
-
-
-namespace orxonox
-{
-    class _TowerDefenseExport TowerTurret : public StaticEntity
-    {
-    public:
-        TowerTurret(Context* context);
-        virtual ~TowerTurret() {};
-
-        // Maybe later override these to move towers with cursor keys
-        /*
-        virtual void moveFrontBack(const Vector2& value);
-        virtual void moveRightLeft(const Vector2& value);
-        */
-
-        // Overriding these to stop towers from spasing out
-        void setOrientation(const Quaternion& orientation);
-        //virtual void rotateYaw(const Vector2& value);
-        //virtual void rotatePitch(const Vector2& value);
-        //virtual void rotateRoll(const Vector2& value);
-
-        void setGame(TowerDefense* towerdefense)
-        { assert(towerdefense); game_ = towerdefense; }
-    private:
-        TowerDefense* game_;
-    };
-}
-
-
-#endif
Index: code/trunk/src/modules/weapons/WeaponsPrereqs.h
===================================================================
--- code/trunk/src/modules/weapons/WeaponsPrereqs.h	(revision 10546)
+++ code/trunk/src/modules/weapons/WeaponsPrereqs.h	(revision 10622)
@@ -75,4 +75,5 @@
     class ReplenishingMunition;
     class RocketMunition;
+    class GravityBombMuntion;
 
     // projectiles
@@ -82,5 +83,7 @@
     class Projectile;
     class Rocket;
+    class RocketOld;
     class SimpleRocket;
+    class GravityBomb;
 
     // weaponmodes
@@ -91,5 +94,7 @@
     class LightningGun;
     class RocketFire;
+    class RocketFireOld;
     class SimpleRocketFire;
+    class GravityBombFire;
 }
 
Index: code/trunk/src/modules/weapons/munitions/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/weapons/munitions/CMakeLists.txt	(revision 10546)
+++ code/trunk/src/modules/weapons/munitions/CMakeLists.txt	(revision 10622)
@@ -4,3 +4,4 @@
   FusionMunition.cc
   RocketMunition.cc
+  GravityBombMunition.cc
 )
Index: code/trunk/src/modules/weapons/munitions/GravityBombMunition.cc
===================================================================
--- code/trunk/src/modules/weapons/munitions/GravityBombMunition.cc	(revision 10622)
+++ code/trunk/src/modules/weapons/munitions/GravityBombMunition.cc	(revision 10622)
@@ -0,0 +1,32 @@
+/*
+ * GravityBombMunition.cc
+ *
+ *  Created on: Apr 16, 2015
+ *      Author: Manuel Eggimann
+ */
+#include "GravityBombMunition.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+RegisterClass(GravityBombMunition);
+
+    GravityBombMunition::GravityBombMunition(Context* context) : Munition(context)
+    {
+        RegisterObject(GravityBombMunition);
+        this->maxMunitionPerMagazine_ = 1;
+        this->maxMagazines_ = 30;
+        this->magazines_ = 15;
+
+        this->bUseSeparateMagazines_ = false;
+        this->bStackMunition_ = true;
+
+        this->bAllowMunitionRefilling_ = true;
+        this->bAllowMultiMunitionRemovementUnderflow_ = false;
+    }
+
+}
+
+
+
+
Index: code/trunk/src/modules/weapons/munitions/GravityBombMunition.h
===================================================================
--- code/trunk/src/modules/weapons/munitions/GravityBombMunition.h	(revision 10622)
+++ code/trunk/src/modules/weapons/munitions/GravityBombMunition.h	(revision 10622)
@@ -0,0 +1,35 @@
+/*
+ * GravityBombMunition.h
+ *
+ *  Created on: Apr 16, 2015
+ *      Author: meggiman
+ */
+
+#ifndef GRAVITYBOMBMUNITION_H_
+#define GRAVITYBOMBMUNITION_H_
+
+#include "weapons/WeaponsPrereqs.h"
+#include "weaponsystem/Munition.h"
+
+namespace orxonox
+{
+    /**
+     * @class   GravityBombMunition
+     *
+     * @brief   This class is used to set the behaviour of various 
+     *          munition specific attributes of the GravityBomb like max count of munition per magazine.
+     *
+     * @author  Manuel
+     * @date    23.05.2015
+     */
+    class _WeaponsExport GravityBombMunition : public Munition
+    {
+        public:
+            GravityBombMunition(Context* context);
+            virtual ~GravityBombMunition() {}
+    };
+
+}
+
+
+#endif /* GRAVITYBOMBMUNITION_H_ */
Index: code/trunk/src/modules/weapons/projectiles/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/weapons/projectiles/CMakeLists.txt	(revision 10546)
+++ code/trunk/src/modules/weapons/projectiles/CMakeLists.txt	(revision 10622)
@@ -6,4 +6,7 @@
   LightningGunProjectile.cc
   Rocket.cc
+  RocketOld.cc
   SimpleRocket.cc
+  GravityBomb.cc
+  GravityBombField.cc
 )
Index: code/trunk/src/modules/weapons/projectiles/GravityBomb.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/GravityBomb.cc	(revision 10622)
+++ code/trunk/src/modules/weapons/projectiles/GravityBomb.cc	(revision 10622)
@@ -0,0 +1,102 @@
+/*
+ * GravityBomb.cc
+ *
+ *  Created on: Mar 26, 2015
+ *      Author: Manuel Eggimann
+ */
+#include "GravityBomb.h"
+#include "graphics/Model.h"
+
+
+namespace orxonox{
+    RegisterClass(GravityBomb);
+
+    const float GravityBomb::LIFETIME = 2.5;  ///< The gravity bomb lifetime in seconds.
+
+    GravityBomb::GravityBomb(Context* context):
+                BasicProjectile(),
+                MovableEntity(context),
+                RadarViewable(this,static_cast<WorldEntity*>(this))
+        {
+            RegisterObject(GravityBomb);
+
+            this->setMass(10.0);
+            this->hasCollided_ = false;
+            if (GameMode::isMaster())
+            {
+                //Define CollisionType of the bomb
+                this->timeToLife_= LIFETIME;
+                this->setCollisionResponse(false);
+                this->setCollisionType(WorldEntity::Dynamic);
+                this->enableCollisionCallback();
+
+                //Add Collision Shape
+                SphereCollisionShape* collisionShape = new SphereCollisionShape(context);
+                collisionShape->setRadius(1.0);
+                this->attachCollisionShape(collisionShape);
+
+                //Create Bomb Model
+                Model* rocketModel = new Model(this->getContext());
+                rocketModel->setMeshSource("GravityBombRocket.mesh"); //Demo Model from SimpleRocket
+                rocketModel->scale(3.0f);
+                this->attach(rocketModel);
+                //Add second model because the bomb consists of the bomb and attached rockets (2 separate models)
+                Model* bombModel =  new Model(this->getContext());
+                bombModel->setMeshSource("GravityBomb.mesh"); //Demo Model from SimpleRocket
+                bombModel->scale(3.0f);
+                this->attach(bombModel);
+
+                //Add particle effect to the flying rockets.
+                ParticleEmitter* fire = new ParticleEmitter(this->getContext());
+                fire->setOrientation(this->getOrientation());
+                fire->setSource("Orxonox/simplerocketfire");
+                this->attach(fire);
+
+                //Add sound effect while the bomb is flying.
+                WorldSound* bombSound = new WorldSound(context);
+                bombSound->setSource("sounds/GravityBombFlight.ogg");
+                bombSound->setLooping(true);
+                bombSound->setVolume(1.0);
+                this->attach(bombSound);
+                bombSound->play();
+            }
+        }
+
+    GravityBomb::~GravityBomb(){}
+
+    void GravityBomb::tick(float dt)
+    {
+        SUPER(GravityBomb, tick, dt);
+        timeToLife_ -= dt;
+        if (timeToLife_ < 0)
+        {
+            //orxout(debug_output) << "bomb has stoped moving" <<endl;
+            setVelocity(Vector3::ZERO); //Stop the bomb.
+            detonate();
+            this->destroy();
+        }
+        else 
+        {
+            if (hasCollided_) detonate();
+            destroyCheck(); //Bomb is going to be destroyed by destroyCheck(). As written in BasicProectile, this Method should be called by every Projectile.
+        }
+    }
+
+    bool GravityBomb::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
+    {
+        hasCollided_ = processCollision(otherObject, contactPoint, cs);
+        return hasCollided_;
+    }
+
+    void GravityBomb::detonate()
+    {
+        //Create the GravityBombField and destroy the Projectil.
+        GravityBombField* field = new GravityBombField(this->getContext());
+        field->setShooter(this->getShooter());
+        field->setPosition(getPosition());
+        //orxout(debug_output) << "detonating. Creating GravityBombField." <<endl;
+        //orxout(debug_output) << "Field is at Position: " << getPosition() << endl;
+    }
+}
+
+
Index: code/trunk/src/modules/weapons/projectiles/GravityBomb.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/GravityBomb.h	(revision 10622)
+++ code/trunk/src/modules/weapons/projectiles/GravityBomb.h	(revision 10622)
@@ -0,0 +1,55 @@
+/*
+ * GravityBomb.h
+ *
+ *  Created on: Mar 19, 2015
+ *      Author: meggiman
+ */
+
+#ifndef GravityBOMB_H_
+#define GravityBOMB_H_
+
+#include "weapons/WeaponsPrereqs.h"
+
+#include "tools/Timer.h"
+
+#include "graphics/ParticleSpawner.h"
+#include "interfaces/RadarViewable.h"
+#include "objects/ForceField.h"
+#include "BasicProjectile.h"
+#include "worldentities/MovableEntity.h"
+#include "core/CoreIncludes.h"
+#include "objects/collisionshapes/SphereCollisionShape.h"
+#include "worldentities/WorldEntity.h"
+#include "GravityBombField.h"
+#include "sound/WorldSound.h"
+
+namespace orxonox
+{
+    /**
+     * @class   GravityBomb
+     *
+     * @brief   This class implements how long the bomb flies before it places the GravityField at it's last possition.
+     *          The field will be created either because the timelimit of the bomb expired or it hit something. After creation of the field,
+     *          the projectile (this object) is destroyed.
+     *
+     * @author  Manuel Eggimann
+     * @date    23.05.2015
+     */
+    class _WeaponsExport GravityBomb : public BasicProjectile , public MovableEntity, public RadarViewable
+    {
+        public:
+            GravityBomb(Context* context);
+            virtual ~GravityBomb();
+            virtual void tick(float dt);
+
+            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
+            void detonate();
+        private:
+        static const float LIFETIME;
+
+        bool hasCollided_;
+        float timeToLife_; //Time the bomb flies before it explodes.
+        WorldSound* bombSound_;
+    };
+}
+#endif /* GravityBOMB_H_ */
Index: code/trunk/src/modules/weapons/projectiles/GravityBombField.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/GravityBombField.cc	(revision 10622)
+++ code/trunk/src/modules/weapons/projectiles/GravityBombField.cc	(revision 10622)
@@ -0,0 +1,176 @@
+/*
+ * GravityBombField.cc
+ *
+ *  Created on: Apr 2, 2015
+ *      Author: Manuel Eggimann
+ */
+
+#include "GravityBombField.h"
+#include "graphics/Model.h"
+
+namespace orxonox{
+    RegisterClass(GravityBombField);
+
+    //Change these constants to alter the behaviour of the field.
+    
+    const float GravityBombField::FORCE_FIELD_LIFETIME = 15;
+    const float GravityBombField::FORCE_SPHERE_START_RADIUS = 250;
+    const float GravityBombField::FORCE_SPHERE_START_STRENGTH = -700;
+    const float GravityBombField::PEAK_EXPLOSION_FORCE = 5e4;
+    const float GravityBombField::FORCE_FIELD_EXPLOSION_DAMMAGE = 100;
+    const float GravityBombField::EXPLOSION_DURATION = 1;
+    const float GravityBombField::EXPLOSION_RADIUS = 600;
+    const float GravityBombField::PEAK_ANGULAR_VELOCITY = 20;
+    const float GravityBombField::CENTRE_MODEL_END_SIZE = 1.5;
+
+    GravityBombField::GravityBombField(Context* context) : ForceField(context),RadarViewable(this, static_cast<WorldEntity*>(this))
+    {
+        RegisterObject(GravityBombField);
+        //Initialize variable with their initial values.
+        lifetime_=FORCE_FIELD_LIFETIME;
+        forceStrength_ = FORCE_SPHERE_START_STRENGTH;
+        forceSphereRadius_ = FORCE_SPHERE_START_RADIUS;
+        modelScaling_ = 1;
+        fieldExploded_ = false;
+
+        setVelocity(FORCE_SPHERE_START_STRENGTH);
+        setDiameter(2*FORCE_SPHERE_START_RADIUS);
+        setMode(modeSphere_s);
+        setCollisionResponse(false);
+
+        //Make the Field visible on Radar and minimap.
+        this->setRadarObjectColour(ColourValue(1.0, 0.0, 0.2,1)); // Red
+        this->setRadarObjectShape(RadarViewable::Dot);
+        this->setRadarObjectScale(1.0f);
+        
+
+        //Attach Model
+        Model* model = new Model(this->getContext());
+        model->setMeshSource("GravityBomb.mesh"); //Demo Model from SimpleRocket
+        model->scale(2.5f);
+        bombModel_ = new MovableEntity(context);
+        bombModel_->attach(model);
+        this->attach(bombModel_);
+
+        //Add a Backlight to the centre.
+        centreLight_ = new Backlight(context);
+        centreLight_->setColour(ColourValue(0.2,0.9,0.2,1));
+        centreLight_->setScale(0.3);
+        centreLight_->setTrailMaterial("Trail/backlighttrail");
+        centreLight_->setMaterial("Examples/Flare");
+        centreLight_->setLifetime(20);
+        bombModel_->attach(centreLight_);
+
+        //Let the Bomb Modell in the centre rotate in a random direction.
+        Vector3 randomRotation;
+        randomRotation.x = rnd();
+        randomRotation.y = rnd();
+        randomRotation.y = rnd();
+        randomRotation.normalise();
+        bombModel_->setAngularAcceleration(randomRotation*(PEAK_ANGULAR_VELOCITY/FORCE_FIELD_LIFETIME));
+
+        //Add Collision Shape
+        SphereCollisionShape* collisionShape = new SphereCollisionShape(context);
+        collisionShape->setRadius(10.0);
+        this->attachCollisionShape(collisionShape);
+
+        //Add particle effect to visualize the force field.
+        this->particleSphere_ = new ParticleEmitter(this->getContext());
+        this->attach(this->particleSphere_);
+        particleSphere_->setSource("Orxonox/GravityBombField");
+
+        //Add a sound effect to the field.
+        WorldSound* fieldSound = new WorldSound(context);
+        fieldSound->setSource("sounds/GravityField.ogg");
+        fieldSound->setLooping(true);
+        fieldSound->setVolume(1.0);
+        this->attach(fieldSound);
+        fieldSound->play();
+    }
+
+    GravityBombField::~GravityBombField(){}
+
+    
+    void GravityBombField::tick(float dt)
+    {
+        SUPER(GravityBombField,tick,dt);
+        lifetime_-=dt;
+
+        if(lifetime_ > EXPLOSION_DURATION)//If field is still alive, make it smaller and stronger.
+        {
+            modelScaling_ += ((CENTRE_MODEL_END_SIZE-1) / FORCE_FIELD_LIFETIME)*dt;
+            forceStrength_ *= (1+dt/10);
+            forceSphereRadius_ = FORCE_SPHERE_START_RADIUS*(1-((FORCE_FIELD_LIFETIME-lifetime_)/FORCE_FIELD_LIFETIME)*((FORCE_FIELD_LIFETIME-lifetime_)/FORCE_FIELD_LIFETIME)*((FORCE_FIELD_LIFETIME-lifetime_)/FORCE_FIELD_LIFETIME));
+        }
+        else if(lifetime_ > 0)
+        {
+            if (!fieldExploded_) // Start the field explosion if it has not been started yet.
+            {
+                forceStrength_ = pow((EXPLOSION_DURATION + lifetime_),4)/EXPLOSION_DURATION * PEAK_EXPLOSION_FORCE;
+                fieldExploded_ = true;
+
+                //Add particle effect to visualize explosion
+                explosionCross_ = new ParticleEmitter(this->getContext());
+                explosionCross_->setSource("Orxonox/FieldExplosion");
+                explosionCross_->setOrientation(rnd(), rnd(), rnd(), rnd());
+                explosionCross_->setScale(0.7);
+                this->attach(explosionCross_);
+
+                //Add explosion sound effect.
+                explosionSound_ = new WorldSound(getContext());
+                explosionSound_->setSource("sounds/GravityFieldExplosion.ogg");
+                explosionSound_->setVolume(1.0);
+                explosionSound_->play();
+            }
+
+            //Check if any pawn is inside the shockwave and hit it with dammage proportional to the distance between explosion centre and pawn. Make sure, the same pawn is damaged only once.
+            for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
+            {
+                Vector3 distanceVector = it->getWorldPosition()-this->getWorldPosition();
+                 //orxout(debug_output) << "Found Pawn:" << it->getWorldPosition() << endl;
+                if(distanceVector.length()< forceSphereRadius_)
+                {
+                    //orxout(debug_output) << "Force sphere radius is: " << forceSphereRadius_ << " Distance to Pawn is: " << distanceVector.length();
+                    if (std::find(victimsAlreadyDamaged_.begin(),victimsAlreadyDamaged_.end(),*it) == victimsAlreadyDamaged_.end())
+                    {
+                        //orxout(debug_output) << "Found Pawn to damage: " << it->getWorldPosition() << endl;
+                        float damage = FORCE_FIELD_EXPLOSION_DAMMAGE*(1-distanceVector.length()/EXPLOSION_RADIUS);
+                        //orxout(debug_output) << "Damage: " << damage << endl;
+                        it->hit(shooter_, it->getWorldPosition(), NULL, damage, 0,0);
+                        victimsAlreadyDamaged_.push_back(*it);
+                    }
+                }
+            }
+
+            forceSphereRadius_ = EXPLOSION_RADIUS*(1-lifetime_/EXPLOSION_DURATION);
+            explosionCross_->setScale(forceSphereRadius_/FORCE_SPHERE_START_RADIUS);
+        }
+        else if (lifetime_ > -6) //The field has to exist for 6 more seconds for the particles of the particle effect to vanish smoothly.
+        {
+            //Make the bomb model invisible, let the strength of the field be zero and remove all particle emitters so the particle effect will slowly vanish.
+            bombModel_->setVisible(false);
+            this->setRadarVisibility(false);
+            forceStrength_ = 0;
+            forceSphereRadius_ = 0.00001;
+            particleSphere_->getParticleInterface()->removeAllEmitters();
+            explosionCross_->getParticleInterface()->removeAllEmitters();
+        }
+        
+        setDiameter(forceSphereRadius_*2);
+        setVelocity(forceStrength_);
+        if(lifetime_>0) particleSphere_->setScale(forceSphereRadius_/FORCE_SPHERE_START_RADIUS);
+        bombModel_->setScale(modelScaling_);
+
+        if (lifetime_ <= -4)
+        {
+            orxout(debug_output) << "Timeout. Destroying field." << endl;
+            this->destroy();
+        }
+    }
+
+    void GravityBombField::destroy()
+    {
+        ForceField::destroy();
+    }
+
+}
Index: code/trunk/src/modules/weapons/projectiles/GravityBombField.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/GravityBombField.h	(revision 10622)
+++ code/trunk/src/modules/weapons/projectiles/GravityBombField.h	(revision 10622)
@@ -0,0 +1,90 @@
+/*
+ * GravityBombField.h
+ *
+ *  Created on: Apr 2, 2015
+ *      Author: meggiman
+ */
+
+#ifndef GRAVITYBOMBFIELD_H_
+#define GRAVITYBOMBFIELD_H_
+
+#include "graphics/ParticleSpawner.h"
+#include "interfaces/RadarViewable.h"
+#include "objects/ForceField.h"
+#include "BasicProjectile.h"
+#include "worldentities/MovableEntity.h"
+#include "core/CoreIncludes.h"
+#include "GravityBomb.h"
+#include "graphics/ParticleSpawner.h"
+#include "tools/ParticleInterface.h"
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include "graphics/Backlight.h"
+#include "sound/WorldSound.h"
+
+namespace orxonox {
+
+/**
+ * @class   GravityBombField
+ *
+ * @brief   This class is used by GravityBomb to place the ForceField and Visual effect to the environment.
+ *          The field has a maximum lifetime and gets smaller and stronger the more time passes. In the end, the field explodes and damages all pawns nearby.
+ *
+ * @author  Manuel Eggimann
+ * @date    23.05.2015
+ */
+class GravityBombField: public ForceField, public RadarViewable {
+public:
+    GravityBombField(Context* context);
+    virtual ~GravityBombField();
+    virtual void tick(float dt);
+    virtual void destroy();
+
+    /**
+     * @fn  void GravityBombField::setShooter(Pawn* shooter)
+     *
+     * @brief   This function is used to determine save the pawn who created the field and is used inside the GravityBomb class.
+     *
+     * @author  Manuel Eggimann
+     * @date    23.05.2015
+     *
+     * @param [in,out]  the Pawn that created the field.
+     */
+    void setShooter(Pawn* shooter)
+    { this->shooter_ = shooter; }
+
+    Pawn* getShooter()
+    { return this->shooter_; }
+
+private:
+    //Set these constants inside GravityBombField.cc to alter the behaviour of the field.
+    
+    static const float FORCE_FIELD_LIFETIME;    ///< The lifetime of the ForceField in seconds. After lifetime seconds, has already exploded and the particle effects will start to vanish. 
+    static const float FORCE_SPHERE_START_RADIUS;   ///< The initial sphere radius of the Force Field. The forcefield gets smaller by time.
+    static const float FORCE_SPHERE_START_STRENGTH; ///< The initial Force the Field exerts on every object with non-zero mass.
+    static const float FORCE_FIELD_EXPLOSION_DAMMAGE;   ///< The maximum dammage a pawn gets nearby an exploding field. The farer away from explosion center the smaller the dammage.
+    static const float EXPLOSION_DURATION;  ///< Determines how fast the shockwave of the Explosion expands. It takes GravityBombField::EXPLOSION_DURATION seconds for the field to expand from 0 radius to GravityBombField::EXPLOSION_RADIUS.
+    static const float EXPLOSION_RADIUS;    ///< How far does the shockwave reach. All pawns which outside of a sphere witch this radius rest unharmed by the explosion.
+    static const float PEAK_ANGULAR_VELOCITY;   ///< The model of the bomb in the center of the Field does rotate faster and faster as time passes until it reaches PEAK_ANGULAR_VELOCITY at the fields end of life.
+    static const float PEAK_EXPLOSION_FORCE;    ///< The peak force the explosion exerts on the pawns nearby.
+    static const float CENTRE_MODEL_END_SIZE;   ///< Size of the 3d-model of the bomb in the fields centre.
+
+    float forceSphereRadius_;
+    float forceStrength_;
+    float lifetime_;
+    float modelScaling_;
+    Vector3 rotationVector_;
+    bool fieldExploded_;
+    ParticleEmitter * particleSphere_;
+    ParticleEmitter * explosionCross_;
+    std::vector<Pawn*> victimsAlreadyDamaged_;
+    MovableEntity * bombModel_;
+    Pawn* shooter_;
+    Backlight* centreLight_;
+    WorldSound* explosionSound_;
+};
+
+}
+#endif /* GRAVITYBOMBFIELD_H_ */
+
Index: code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc	(revision 10546)
+++ code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc	(revision 10622)
@@ -47,4 +47,6 @@
 
         this->textureIndex_ = 1;
+        this->setMass(2);
+        this->setCollisionType(Dynamic);
         this->maxTextureIndex_ = 8;
         this->textureTimer_.setTimer(0.01f, true, createExecutor(createFunctor(&LightningGunProjectile::changeTexture, this)));
Index: code/trunk/src/modules/weapons/projectiles/Rocket.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Rocket.cc	(revision 10546)
+++ code/trunk/src/modules/weapons/projectiles/Rocket.cc	(revision 10622)
@@ -48,4 +48,5 @@
 #include "worldentities/CameraPosition.h"
 #include "worldentities/pawns/Pawn.h"
+//#include "particleuniverse/include/ParticleUniverseSystemManager.h"
 
 namespace orxonox
@@ -83,4 +84,9 @@
             fire->setOrientation(this->getOrientation());
             fire->setSource("Orxonox/rocketfire");
+            
+            // Add Particle Universe Effects
+            //ParticleUniverse::ParticleSystemManager* pManager = ParticleUniverse::ParticleSystemManager::getSingletonPtr();
+            //ParticleUniverse::ParticleSystem* pSys1 = pManager->createParticleSystem("pSys1", "bubbles", this->getScene()->getSceneManager());
+            //this->attachOgreObject(pSys1);
 
             this->enableCollisionCallback();
@@ -223,9 +229,12 @@
     void Rocket::destructionEffect()
     {
-        ParticleSpawner *effect1, *effect2;
+        ParticleSpawner *effect1, *effect2, *effect3, *effect4, *effect5;
         if(this->getShooter())
         {
             effect1 = new ParticleSpawner(this->getShooter()->getContext());
             effect2 = new ParticleSpawner(this->getShooter()->getContext());
+            effect3 = new ParticleSpawner(this->getShooter()->getContext());
+            effect4 = new ParticleSpawner(this->getShooter()->getContext());
+            effect5 = new ParticleSpawner(this->getShooter()->getContext());
         }
         else
@@ -233,4 +242,7 @@
             effect1 = new ParticleSpawner(this->getContext());
             effect2 = new ParticleSpawner(this->getContext());
+            effect3 = new ParticleSpawner(this->getContext());
+            effect4 = new ParticleSpawner(this->getContext());
+            effect5 = new ParticleSpawner(this->getContext());
         }
 
@@ -238,5 +250,5 @@
         effect1->setOrientation(this->getOrientation());
         effect1->setDestroyAfterLife(true);
-        effect1->setSource("Orxonox/explosion4");
+        effect1->setSource("orxonox/explosion_flash");
         effect1->setLifetime(2.0f);
 
@@ -244,6 +256,24 @@
         effect2->setOrientation(this->getOrientation());
         effect2->setDestroyAfterLife(true);
-        effect2->setSource("Orxonox/smoke4");
+        effect2->setSource("orxonox/explosion_flame");
         effect2->setLifetime(3.0f);
+
+        effect3->setPosition(this->getPosition());
+        effect3->setOrientation(this->getOrientation());
+        effect3->setDestroyAfterLife(true);
+        effect3->setSource("orxonox/explosion_shockwave");
+        effect3->setLifetime(3.0f);
+
+        effect4->setPosition(this->getPosition());
+        effect4->setOrientation(this->getOrientation());
+        effect4->setDestroyAfterLife(true);
+        effect4->setSource("orxonox/explosion_sparks");
+        effect4->setLifetime(3.0f);
+
+        effect5->setPosition(this->getPosition());
+        effect5->setOrientation(this->getOrientation());
+        effect5->setDestroyAfterLife(true);
+        effect5->setSource("orxonox/explosion_streak1");
+        effect5->setLifetime(3.0f);
     }
 
Index: code/trunk/src/modules/weapons/projectiles/RocketOld.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/RocketOld.cc	(revision 10622)
+++ code/trunk/src/modules/weapons/projectiles/RocketOld.cc	(revision 10622)
@@ -0,0 +1,298 @@
+/*
+ *   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:
+ *      Oliver Scheuss
+ *   Co-authors:
+ *      simonmie
+ *
+ */
+
+/**
+    @file RocketOld.h
+    @brief Implementation of the RocketOld class.
+*/
+
+#include "RocketOld.h"
+
+#include <BulletDynamics/Dynamics/btRigidBody.h>
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "Scene.h"
+#include "controllers/Controller.h"
+#include "graphics/Model.h"
+#include "graphics/ParticleSpawner.h"
+#include "infos/PlayerInfo.h"
+#include "objects/collisionshapes/ConeCollisionShape.h"
+#include "sound/WorldSound.h"
+#include "worldentities/CameraPosition.h"
+#include "worldentities/pawns/Pawn.h"
+//#include "particleuniverse/include/ParticleUniverseSystemManager.h"
+
+namespace orxonox
+{
+    RegisterClass(RocketOld);
+
+    /**
+    @brief
+        Constructor. Registers the object and initializes some default values.
+    */
+    RocketOld::RocketOld(Context* context)
+        : ControllableEntity(context)
+        , BasicProjectile()
+        , RadarViewable(this, static_cast<WorldEntity*>(this))
+    {
+        RegisterObject(RocketOld);// Register the RocketOld class to the core
+
+        this->localAngularVelocity_ = 0;
+        this->lifetime_ = 100.0f;
+
+        if (GameMode::isMaster())
+        {
+            this->setCollisionType(WorldEntity::Kinematic);
+            this->setVelocity(0,0,-100);
+
+            // Create RocketOld model
+            Model* model = new Model(this->getContext());
+            model->setMeshSource("rocket.mesh");
+            model->scale(0.7f);
+            this->attach(model);
+
+            // Add effects.
+            ParticleEmitter* fire = new ParticleEmitter(this->getContext());
+            this->attach(fire);
+            fire->setOrientation(this->getOrientation());
+            fire->setSource("Orxonox/rocketfire");
+            
+            // Add Particle Universe Effects
+            //ParticleUniverse::ParticleSystemManager* pManager = ParticleUniverse::ParticleSystemManager::getSingletonPtr();
+            //ParticleUniverse::ParticleSystem* pSys1 = pManager->createParticleSystem("pSys1", "bubbles", this->getScene()->getSceneManager());
+            //this->attachOgreObject(pSys1);
+
+            this->enableCollisionCallback();
+            this->setCollisionResponse(false);
+            this->setCollisionType(Kinematic);
+
+            // Add collision shape
+            ConeCollisionShape* collisionShape = new ConeCollisionShape(this->getContext());
+            collisionShape->setRadius(3);
+            collisionShape->setHeight(500);
+            this->attachCollisionShape(collisionShape);
+
+            this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this)));
+
+            // Add sound
+            this->defSndWpnEngine_ = new WorldSound(this->getContext());
+            this->defSndWpnEngine_->setLooping(true);
+            this->defSndWpnEngine_->setSource("sounds/Rocket_engine.ogg");
+            this->defSndWpnEngine_->setVolume(1.0f);
+            this->attach(defSndWpnEngine_);
+
+            this->defSndWpnLaunch_ = new WorldSound(this->getContext());
+            this->defSndWpnLaunch_->setLooping(false);
+            this->defSndWpnLaunch_->setSource("sounds/Rocket_launch.ogg");
+            this->defSndWpnLaunch_->setVolume(1.0f);
+            this->attach(defSndWpnLaunch_);
+        }
+        else
+        {
+            this->defSndWpnEngine_ = 0;
+            this->defSndWpnLaunch_ = 0;
+        }
+
+        // Add camera
+        CameraPosition* camPosition = new CameraPosition(this->getContext());
+        camPosition->setPosition(0,4,15);
+        camPosition->setAllowMouseLook(true);
+        this->addCameraPosition(camPosition);
+
+        this->setRadarObjectColour(ColourValue(1.0, 0.5, 0.0)); // orange
+        this->setRadarObjectShape(RadarViewable::Triangle);
+        this->setRadarObjectScale(0.5f);
+    }
+
+    /**
+    @brief
+        Destructor. Destroys controller, if present and kills sounds, if playing.
+    */
+    RocketOld::~RocketOld()
+    {
+        if(this->isInitialized())
+        {
+            if (GameMode::isMaster())
+            {
+                this->destructionEffect();
+
+                if (this->getPlayer() && this->getController())
+                    this->player_->stopTemporaryControl();
+            }
+
+            if ( this->defSndWpnEngine_ )
+                this->defSndWpnEngine_->destroy();
+
+            if ( this->defSndWpnLaunch_ )
+                this->defSndWpnLaunch_->destroy();
+        }
+    }
+
+    /**
+    @brief
+        Sets the entity that fired the RocketOld.
+    @param shooter
+        A pointer to the Pawn that fired the RocketOld.
+    */
+    void RocketOld::setShooter(Pawn* shooter)
+    {
+        this->BasicProjectile::setShooter(shooter);
+        
+        this->player_ = this->getShooter()->getPlayer();
+        if(this->player_)
+            this->player_->startTemporaryControl(this);
+
+        if( GameMode::isMaster() )
+        {
+            this->defSndWpnEngine_->play();
+            this->defSndWpnLaunch_->play();
+        }
+    }
+
+    /**
+    @brief
+        Defines which actions the RocketOld has to take in each tick.
+    @param dt
+        The length of the tick.
+    */
+    void RocketOld::tick(float dt)
+    {
+        SUPER(RocketOld, tick, dt);
+
+        if( this->hasLocalController() )
+        {
+            this->setAngularVelocity(this->getOrientation() * this->localAngularVelocity_);
+            this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() );
+            this->localAngularVelocity_ = 0;
+        }
+
+       this->destroyCheck();
+    }
+
+    bool RocketOld::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
+    {
+        return this->processCollision(otherObject, contactPoint, cs);
+    }
+
+    /**
+    @brief
+        Destroys the RocketOld and stops the sound,
+    */
+    void RocketOld::destroyObject(void)
+    {
+        if (GameMode::isMaster() && this->defSndWpnEngine_->isPlaying())
+            this->defSndWpnEngine_->stop();
+
+        this->BasicProjectile::destroyObject();
+    }
+
+    /**
+    @brief
+        Destroys the RocketOld upon pressing "fire".
+    */
+    void RocketOld::fired(unsigned int firemode)
+    {
+        this->destroyObject();
+    }
+
+    /**
+    @brief
+        The effects that are displayed, when the RocketOld is destroyed.
+    */
+    void RocketOld::destructionEffect()
+    {
+        ParticleSpawner *effect1, *effect2;
+        if(this->getShooter())
+        {
+            effect1 = new ParticleSpawner(this->getShooter()->getContext());
+            effect2 = new ParticleSpawner(this->getShooter()->getContext());
+        }
+        else
+        {
+            effect1 = new ParticleSpawner(this->getContext());
+            effect2 = new ParticleSpawner(this->getContext());
+        }
+
+        effect1->setPosition(this->getPosition());
+        effect1->setOrientation(this->getOrientation());
+        effect1->setDestroyAfterLife(true);
+        effect1->setSource("Orxonox/explosion4");
+        effect1->setLifetime(2.0f);
+
+        effect2->setPosition(this->getPosition());
+        effect2->setOrientation(this->getOrientation());
+        effect2->setDestroyAfterLife(true);
+        effect2->setSource("Orxonox/smoke4");
+        effect2->setLifetime(3.0f);
+    }
+
+    /**
+    @brief
+        Rotates the RocketOld around the y-axis by the amount specified by the first component of the input 2-dim vector.
+    @param value
+        The vector determining the amount of the angular movement.
+    */
+    void RocketOld::rotateYaw(const Vector2& value)
+    {
+        ControllableEntity::rotateYaw(value);
+
+        if( !this->isInMouseLook() )
+            this->localAngularVelocity_.y += value.x;
+    }
+
+    /**
+    @brief
+        Rotates the RocketOld around the x-axis by the amount specified by the first component of the input 2-dim vector.
+    @param value
+        The vector determining the amount of the angular movement.
+    */
+    void RocketOld::rotatePitch(const Vector2& value)
+    {
+        ControllableEntity::rotatePitch(value);
+
+        if( !this->isInMouseLook() )
+            this->localAngularVelocity_.x += value.x;
+    }
+
+    /**
+    @brief
+        Rotates the RocketOld around the z-axis by the amount specified by the first component of the input 2-dim vector.
+    @param value
+        The vector determining the amount of the angular movement.
+    */
+    void RocketOld::rotateRoll(const Vector2& value)
+    {
+        ControllableEntity::rotateRoll(value);
+
+        if( !this->isInMouseLook() )
+            this->localAngularVelocity_.z += value.x;
+    }
+
+}
Index: code/trunk/src/modules/weapons/projectiles/RocketOld.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/RocketOld.h	(revision 10622)
+++ code/trunk/src/modules/weapons/projectiles/RocketOld.h	(revision 10622)
@@ -0,0 +1,134 @@
+/*
+ *   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:
+ *      Oliver Scheuss
+ *   Co-authors:
+ *      simonmie
+ *
+ */
+
+/**
+    @file RocketOld.h
+    @brief Definition of the RocketOld class.
+*/
+
+#ifndef _RocketOld_H__
+#define _RocketOld_H__
+
+#include "weapons/WeaponsPrereqs.h"
+
+#include "tools/Timer.h"
+
+#include "interfaces/RadarViewable.h"
+#include "worldentities/ControllableEntity.h"
+
+#include "BasicProjectile.h"
+
+namespace orxonox
+{
+    class ConeCollisionShape;
+
+    /**
+    @brief
+        RocketOld that can be steered by the player.
+
+    @author
+        Oli Scheuss
+    @ingroup WeaponsProjectiles
+    */
+    class _WeaponsExport RocketOld : public ControllableEntity, public BasicProjectile, public RadarViewable
+    {
+        public:
+            RocketOld(Context* context);
+            virtual ~RocketOld();
+
+            virtual void tick(float dt); //!< Defines which actions the RocketOld has to take in each tick.
+
+            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
+            virtual void destroyObject(void);
+            void destructionEffect();
+
+            virtual void moveFrontBack(const Vector2& value) {}
+            virtual void moveRightLeft(const Vector2& value) {}
+            virtual void moveUpDown(const Vector2& value) {}
+
+            virtual void rotateYaw(const Vector2& value);
+            virtual void rotatePitch(const Vector2& value);
+            virtual void rotateRoll(const Vector2& value);
+
+            /**
+            @brief Moves the RocketOld in the Front/Back-direction by the specifed amount.
+            @param value  The amount by which the RocketOld is to be moved.
+            */
+            inline void moveFrontBack(float value)
+                { this->moveFrontBack(Vector2(value, 0)); }
+            /**
+            @brief Moves the RocketOld in the Right/Left-direction by the specifed amount.
+            @param value  The amount by which the RocketOld is to be moved.
+            */
+            inline void moveRightLeft(float value)
+                { this->moveRightLeft(Vector2(value, 0)); }
+            /**
+            @brief Moves the RocketOld in the Up/Down-direction by the specifed amount.
+            @param value  The amount by which the RocketOld is to be moved.
+            */
+            inline void moveUpDown(float value)
+                { this->moveUpDown(Vector2(value, 0)); }
+
+            /**
+            @brief Rotates the RocketOld around the y-axis by the specifed amount.
+            @param value  The amount by which the RocketOld is to be rotated.
+            */
+            inline void rotateYaw(float value)
+                { this->rotateYaw(Vector2(value, 0)); }
+            /**
+            @brief Rotates the RocketOld around the x-axis by the specifed amount.
+            @param value  The amount by which the RocketOld is to be rotated.
+            */
+            inline void rotatePitch(float value)
+                { this->rotatePitch(Vector2(value, 0)); }
+            /**
+            @brief Rotates the RocketOld around the z-axis by the specifed amount.
+            @param value  The amount by which the RocketOld is to be rotated.
+            */
+            inline void rotateRoll(float value)
+                { this->rotateRoll(Vector2(value, 0)); }
+
+            virtual void setShooter(Pawn* shooter);
+
+            virtual void fired(unsigned int firemode);
+
+        private:
+            Vector3 localAngularVelocity_; //!< Variable to temporarily store accumulated steering command input.
+
+            WeakPtr<PlayerInfo> player_; //!< The player that controls the RocketOld.
+            //WeakPtr<Pawn> pawn_; //!< The pawn that controls the RocketOld. TODO
+            Timer destroyTimer_; //!< Timer to destroy the projectile after its lifetime has run out.
+            float lifetime_; //!< The time the projectile exists.
+
+            WorldSound* defSndWpnEngine_; //!< Engine sound.
+            WorldSound* defSndWpnLaunch_; //!< Launch sound.
+    };
+
+}
+
+#endif /* _RocketOld_H__ */
Index: code/trunk/src/modules/weapons/weaponmodes/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/CMakeLists.txt	(revision 10546)
+++ code/trunk/src/modules/weapons/weaponmodes/CMakeLists.txt	(revision 10622)
@@ -6,4 +6,6 @@
   LightningGun.cc
   RocketFire.cc
+  RocketFireOld.cc
   SimpleRocketFire.cc
+  GravityBombFire.cc
 )
Index: code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc	(revision 10546)
+++ code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc	(revision 10622)
@@ -108,4 +108,5 @@
         model->setScale(5);
 
+        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
         projectile->setOrientation(this->getMuzzleOrientation());
         projectile->setPosition(this->getMuzzlePosition());
Index: code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc	(revision 10546)
+++ code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc	(revision 10622)
@@ -68,4 +68,5 @@
         BillboardProjectile* projectile = new BillboardProjectile(this->getContext());
 
+        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
         projectile->setOrientation(this->getMuzzleOrientation());
         projectile->setPosition(this->getMuzzlePosition());
Index: code/trunk/src/modules/weapons/weaponmodes/GravityBombFire.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/GravityBombFire.cc	(revision 10622)
+++ code/trunk/src/modules/weapons/weaponmodes/GravityBombFire.cc	(revision 10622)
@@ -0,0 +1,56 @@
+/*
+ * GravityBombFire.cc
+ *
+ *  Created on: Apr 16, 2015
+ *      Author: Manuel Eggimann
+ */
+#include "GravityBombFire.h"
+
+#include "core/CoreIncludes.h"
+#include "weaponsystem/Weapon.h"
+#include "weaponsystem/WeaponPack.h"
+#include "weaponsystem/WeaponSystem.h"
+#include "worldentities/pawns/Pawn.h"
+
+#include "weapons/projectiles/GravityBomb.h"
+
+namespace orxonox
+{
+    RegisterClass(GravityBombFire);
+
+    const float GravityBombFire::BOMB_VELOCITY = 600.0; ///< The velocity of the bomb after launch
+
+    GravityBombFire::GravityBombFire(Context* context) : WeaponMode(context)
+    {
+        RegisterObject(GravityBombFire);
+
+        this->reloadTime_ = 0.50f; 
+        this->bParallelReload_ = false;
+        this->damage_ = 20.0f;  ///< The damage of the Bomb if it hits a pawn.
+
+        this->setMunitionName("GravityBombMunition");
+        this->setDefaultSoundWithVolume("sounds/Rocket_launch.ogg",0.8);    ///< sets sound of the bomb as it is fired.
+    }
+
+    GravityBombFire::~GravityBombFire(){};
+
+    void GravityBombFire::fire()
+    {
+        GravityBomb* bomb = new GravityBomb(this->getContext());
+        //Create a new Bomb in 3D-Space and set the right direction speed and orientation.
+        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
+        bomb->setOrientation(this->getMuzzleOrientation());
+        bomb->setPosition(this->getMuzzlePosition());
+        bomb->setVelocity(this->getMuzzleDirection() * (this->BOMB_VELOCITY+this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity().length()));
+
+        //Set the shooter of the bomb so it is possible to determine the pawn that killed another one and define damage to shield and healt the bomb does.
+        bomb->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+        bomb->setDamage(this->getDamage());
+        bomb->setShieldDamage(this->getShieldDamage());
+        bomb->setHealthDamage(this->getHealthDamage());
+    }
+
+
+}
+
+
Index: code/trunk/src/modules/weapons/weaponmodes/GravityBombFire.h
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/GravityBombFire.h	(revision 10622)
+++ code/trunk/src/modules/weapons/weaponmodes/GravityBombFire.h	(revision 10622)
@@ -0,0 +1,43 @@
+/*
+* GravityBombFire.h
+*
+*  Created on: Apr 16, 2015
+*      Author: Manuel Eggimann
+*/
+
+/**
+    @file GravityBombFire.h
+    @brief Definition of the GravityBombFire class.
+*/
+
+#ifndef _GravityBombFire_H__
+#define _GravityBombFire_H__
+
+#include "weapons/WeaponsPrereqs.h"
+#include "weaponsystem/WeaponMode.h"
+
+namespace orxonox
+{
+
+    /**
+    *@brief
+    *   Fires the GravityBomb. This class implements everything needed to fire the BasicProjectile GravityBomb.
+    *   Everything that has to do with the bombs behaviour after launching it is implemented in GravityBomb and GravityBombField.
+    *@author
+    *    Manuel Eggimann
+    *@ingroup WeaponsWeaponModes
+    */
+    class _WeaponsExport GravityBombFire : public WeaponMode
+    {
+        public:
+            GravityBombFire(Context* context);
+            virtual ~GravityBombFire();
+
+            virtual void fire();
+
+        private:
+            static const float BOMB_VELOCITY; //!< The initial speed of the bomb when it is launched.
+    };
+}
+
+#endif /* _GravityBombFire_H__ */
Index: code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc	(revision 10546)
+++ code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc	(revision 10622)
@@ -66,4 +66,5 @@
         ParticleProjectile* projectile = new ParticleProjectile(this->getContext());
 
+        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
         projectile->setOrientation(this->getMuzzleOrientation());
         projectile->setPosition(this->getMuzzlePosition());
Index: code/trunk/src/modules/weapons/weaponmodes/RocketFireOld.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/RocketFireOld.cc	(revision 10622)
+++ code/trunk/src/modules/weapons/weaponmodes/RocketFireOld.cc	(revision 10622)
@@ -0,0 +1,86 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oliver Scheuss
+ *   Co-authors:
+ *      simonmie
+ *
+ */
+
+/**
+    @file RocketFire.h
+    @brief Implementation of the RocketFire class.
+*/
+
+#include "RocketFireOld.h"
+
+#include "core/CoreIncludes.h"
+#include "util/Math.h"
+
+#include "weaponsystem/Weapon.h"
+#include "weaponsystem/WeaponPack.h"
+#include "weaponsystem/WeaponSystem.h"
+#include "worldentities/pawns/Pawn.h"
+
+#include "weapons/projectiles/RocketOld.h"
+
+namespace orxonox
+{
+    RegisterClass(RocketFireOld);
+
+    RocketFireOld::RocketFireOld(Context* context) : WeaponMode(context)
+    {
+        RegisterObject(RocketFireOld);
+
+        this->reloadTime_ = 0.20f;
+        this->bParallelReload_ = false;
+        this->damage_ = 0.0f;
+        this->speed_ = 500.0f;
+
+        this->setMunitionName("RocketMunition");
+        // The firing sound of the Rocket is played in Rocket.cc (because of OpenAl sound positioning)
+    }
+
+    RocketFireOld::~RocketFireOld()
+    {
+    }
+
+    /**
+    @brief
+        Fires the weapon. Creates the Rocket and fires it.
+    */
+    void RocketFireOld::fire()
+    {
+        RocketOld* rocket = new RocketOld(this->getContext());
+
+        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
+        rocket->setOrientation(this->getMuzzleOrientation());
+        rocket->setPosition(this->getMuzzlePosition());
+        rocket->setVelocity(this->getMuzzleDirection() * this->speed_);
+        rocket->scale(2);
+
+        rocket->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+        rocket->setDamage(this->getDamage());
+        rocket->setShieldDamage(this->getShieldDamage());
+        rocket->setHealthDamage(this->getHealthDamage());
+    }
+}
Index: code/trunk/src/modules/weapons/weaponmodes/RocketFireOld.h
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/RocketFireOld.h	(revision 10622)
+++ code/trunk/src/modules/weapons/weaponmodes/RocketFireOld.h	(revision 10622)
@@ -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:
+ *      Oliver Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file RocketFireOld.h
+    @brief Definition of the RocketFire class.
+*/
+
+#ifndef _RocketFireOld_H__
+#define _RocketFireOld_H__
+
+#include "weapons/WeaponsPrereqs.h"
+#include "weaponsystem/WeaponMode.h"
+
+namespace orxonox
+{
+
+    /**
+    @brief
+        Fires the (steerable) RocketOld.
+    @author
+        Oliver Scheuss
+    @ingroup WeaponsWeaponModes
+    */
+    class _WeaponsExport RocketFireOld : public WeaponMode
+    {
+        public:
+            RocketFireOld(Context* context);
+            virtual ~RocketFireOld();
+
+            virtual void fire();
+
+        private:
+            float speed_; //!< The speed of the Rocket.
+    };
+}
+
+#endif /* _RocketFireOld_H__ */
Index: code/trunk/src/orxonox/controllers/ControllerDirector.cc
===================================================================
--- code/trunk/src/orxonox/controllers/ControllerDirector.cc	(revision 10546)
+++ code/trunk/src/orxonox/controllers/ControllerDirector.cc	(revision 10622)
@@ -41,4 +41,5 @@
     {
         SUPER(ControllerDirector, XMLPort, xmlelement, mode);
+        XMLPortParam(ControllerDirector, "scriptname", setScriptName, getScriptName, xmlelement, mode).defaultValues("testscript");
 
         orxout(verbose)<< "ControllerDirector::XMLPort " 
@@ -83,5 +84,5 @@
        else
          return;
-       
+
        /* Set up a luastate to use for running the scripts */
        LuaState * ls = new LuaState();
@@ -98,6 +99,6 @@
         * variable "newctrlid" defined, which means it can make use of it.
         */
-
-       ls->doFile("testscript.lua");
+       std::string scr = this->scriptname_ + ".lua";
+       ls->doFile(scr);
 
        /* Increase the controller ID so we have a different one for
Index: code/trunk/src/orxonox/controllers/ControllerDirector.h
===================================================================
--- code/trunk/src/orxonox/controllers/ControllerDirector.h	(revision 10546)
+++ code/trunk/src/orxonox/controllers/ControllerDirector.h	(revision 10622)
@@ -47,4 +47,7 @@
             virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
 
+            inline void setScriptName(const std::string& name) { this->scriptname_ = name; }
+            inline const std::string& getScriptName() const { return this->scriptname_; }
+
 
             /* Take over control of a given object */
@@ -55,5 +58,6 @@
             //void setNewController(Controller * controller);
 
-        private:
+        protected:
+            std::string scriptname_;   
             PlayerInfo* player_;
             ControllableEntity* entity_; 
Index: code/trunk/src/orxonox/controllers/FormationController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/FormationController.cc	(revision 10546)
+++ code/trunk/src/orxonox/controllers/FormationController.cc	(revision 10622)
@@ -955,4 +955,6 @@
     bool FormationController::sameTeam(ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gametype)
     {
+
+
         if (entity1 == entity2)
             return true;
@@ -984,5 +986,5 @@
         }
 
-        TeamDeathmatch* tdm = orxonox_cast<TeamDeathmatch*>(gametype);
+        TeamGametype* tdm = orxonox_cast<TeamGametype*>(gametype);
         if (tdm)
         {
@@ -992,14 +994,4 @@
             if (entity2->getPlayer())
                 team2 = tdm->getTeam(entity2->getPlayer());
-        }
-
-        Mission* miss = orxonox_cast<Mission*>(gametype);
-        if (miss)
-        {
-            if (entity1->getPlayer())
-                team1 = miss->getTeam(entity1->getPlayer());
-
-            if (entity2->getPlayer())
-                team2 = miss->getTeam(entity2->getPlayer());
         }
 
Index: code/trunk/src/orxonox/controllers/ScriptController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/ScriptController.cc	(revision 10546)
+++ code/trunk/src/orxonox/controllers/ScriptController.cc	(revision 10622)
@@ -21,9 +21,23 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      ...
  *   Co-authors:
  *      ...
  *
  */
+
+ /*
+  * Currently available lua commands:
+  *
+  * IMPORTANT: ALL COMMANDS DO REQUIRE 7 PARAMETERS TO BE PROVIDED. FILL UP WITH ZEROES IN UNIMPORTANT PLACES.
+  *
+  * Command             | Abbreviation | Parameter 1          | '' 2     | '' 3    | '' 4                 | '' 5     | '' 6     | '' 7
+  *
+  * "Move And Look"     | mal          | GoTo X Coordinate    | '' Y ''  | '' Z '' | LookAt X Coordinate  |  '' Y '' |  '' Y '' | Duration
+  * "Rotate And Look"   | ral          | GoTo X Coordinate    | '' Y ''  | '' Z '' | Axis (1=x, 2=z, 3=z) |     -    |     -    | Duration
+  * "Spiral"            | spi          | GoTo X Coordinate    | '' Y ''  | '' Z '' |          -           |     -    |     -    | Duration
+  * "Transition Look"   | chl          | From X Coordinate    | '' Y ''  | '' Z '' | To X Coordinate      |  '' Y '' |  '' Y '' | Duration
+  * "Idle (Do nothing)" | idle         | Duration
+  */
 
 #include "ScriptController.h"
@@ -32,5 +46,6 @@
 #include "worldentities/ControllableEntity.h"
 #include "core/LuaState.h"
-#include <cmath>
+#include "core/LuaState.h"
+#include "util/Math.h"
 
 namespace orxonox
@@ -66,4 +81,7 @@
         this->eventno = 0;
 
+        /* - First "previous event" scheduled at t=0 */
+        /* - Needed for automatically updating event times */
+        this->prevEventTime = 0;
     }
 
@@ -178,13 +196,64 @@
 
         /* Get a variable that specifies how far along the trajectory
-         * we are 
+         * we are currently.
          */
         float dl = eventTime / currentEvent.duration; 
 
-        /* Depending  */
+        /* Depending on command */
         /* Do some moving */
         if( this->processing )
-        { 
-          if( this->currentEvent.fctName == "mal" )
+        {
+          // Abbreviation for "spiral" (rotation + translation)
+          if (this->currentEvent.fctName == "spi") {
+
+            // Need to know a perpendicular basis to the translation vector:
+            // Given (a, b, c) we chose (b, -a, 0)norm and (0, c, -b)norm
+            // Currently we set a fix rotational radius of 400
+            // TODO: Add an option to adjust radius of spiral movement
+            Vector3 direction = this->currentEvent.v1 - startpos;
+
+            Vector3* ortho1 = new Vector3(direction.y, -direction.x, 0);
+            float absOrtho1 = sqrt(direction.y * direction.y + direction.x * direction.x);
+            *ortho1 = 400 * cos(2 * math::pi * dl) * (*ortho1)/absOrtho1;
+
+            Vector3* ortho2 = new Vector3(0, direction.z, -direction.y);
+            float absOrtho2 = sqrt(direction.y * direction.y + direction.z * direction.z);
+            *ortho2 = 400 * sin(2 * math::pi * dl) * (*ortho2)/absOrtho2;
+
+            this->entity_->setPosition( (1-dl)*startpos + dl * this->currentEvent.v1 + *ortho1 + *ortho2);
+
+            delete ortho1;
+            delete ortho2;
+          }
+
+          // Abbreviation for "rotate and look"
+          if (this->currentEvent.fctName == "ral")
+          { 
+            // Specify the axis
+            Vector3* a;
+              switch ((int) currentEvent.d) {
+                case 3:
+                  a = new Vector3(this->currentEvent.v1.x + this->currentEvent.e*cos(2*math::pi*dl),
+                                  this->currentEvent.v1.y + this->currentEvent.e*sin(2*math::pi*dl),
+                                  this->currentEvent.v1.z);
+                break;
+                case 2:
+                  a = new Vector3(this->currentEvent.v1.x + this->currentEvent.e*sin(2*math::pi*dl),
+                                  this->currentEvent.v1.y,
+                                  this->currentEvent.v1.z + this->currentEvent.e*cos(2*math::pi*dl));
+                break;
+                case 1:
+                  a = new Vector3(this->currentEvent.v1.x,
+                                  this->currentEvent.v1.y + this->currentEvent.e*sin(2*math::pi*dl),
+                                  this->currentEvent.v1.z + this->currentEvent.e*cos(2*math::pi*dl));
+                break;
+              }
+
+            this->entity_->setPosition(*a);
+
+            /* Look at the specified position */
+            this->entity_->lookAt(this->currentEvent.v1);
+          }
+          else if( this->currentEvent.fctName == "mal" )
           {
             /* Set the position to the correct place in the trajectory */
@@ -193,7 +262,4 @@
             /* Look at the specified position */
             this->entity_->lookAt(this->currentEvent.v2);
-
-            /* Update look at position */
-            //this->lookAtPosition = this->currentEvent.v2;
           }
           else if( this->currentEvent.fctName == "chl" )
@@ -224,12 +290,31 @@
       /* Fill the structure with all the provided information */
       tmp.fctName = instruction;
+
       //tmp.x1 = x1; tmp.y1 = y1; tmp.z1 = z1;
       //tmp.x2 = x2; tmp.y2 = y2; tmp.z2 = z2;
       tmp.v1 = Vector3(x1,y1,z1);
       tmp.v2 = Vector3(x2,y2,z2);
+
+      // the parameters are not required to be vector coordinates!
+      // for convenience they are however stored twice if they have some kind of different meaning
+      tmp.a = x1;
+      tmp.b = y1;
+      tmp.c = z1;
+      tmp.d = x2;
+      tmp.e = y2;
+      tmp.f = z2;
+
       tmp.duration = duration;
-      tmp.eventTime = executionTime;
-
-      orxout(verbose) << tmp.fctName << endl;
+
+      /* This is kind of a hack. If we hit the function idle all we want to do is
+         advance event execution time, not schedule anything */
+      if (instruction == "idle") {
+        tmp.eventTime = this->prevEventTime;
+        this->prevEventTime += x1;
+        return;
+      } else {
+        tmp.eventTime = this->prevEventTime;
+        this->prevEventTime += duration;
+      }
 
       /* Add the created event to the event list */
Index: code/trunk/src/orxonox/controllers/ScriptController.h
===================================================================
--- code/trunk/src/orxonox/controllers/ScriptController.h	(revision 10546)
+++ code/trunk/src/orxonox/controllers/ScriptController.h	(revision 10622)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      ...
  *   Co-authors:
  *      ...
@@ -45,6 +45,12 @@
         std::string fctName;
 
+        /** Final position we want to be at **/
         Vector3 v1;
+
+        /** Where we are looking **/
         Vector3 v2;
+
+        /** The parameters are additionally stored as a set of 6 numerical values **/
+        float a, b, c, d, e, f;
 
         /** Time span of the event */
@@ -69,8 +75,8 @@
             // LUA interface
             // tolua_begin 
-            void eventScheduler(std::string instruction, 
-              float x1, float y1, float z1, 
-              float x2, float y2, float z2, 
-              float duration, float executionTime);
+            void eventScheduler(std::string instruction = "", 
+              float x1 = 0, float y1 = 0, float z1 = 0, 
+              float x2 = 0, float y2 = 0, float z2 = 0, 
+              float duration = 0, float executionTime = 0);
 
             static ScriptController* getScriptController();
@@ -116,4 +122,7 @@
             Vector3 startpos;
 
+            /* Time of the previously scheduled event */
+            float prevEventTime;
+
             /* - Position to look at during that transition */
             //Vector3 lookAtPosition;
Index: code/trunk/src/orxonox/controllers/testscript.lua
===================================================================
--- code/trunk/src/orxonox/controllers/testscript.lua	(revision 10546)
+++ code/trunk/src/orxonox/controllers/testscript.lua	(revision 10622)
@@ -1,1 +1,1 @@
-print	('1: Hello World')
+print ('1: Hello World')
Index: code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.cc	(revision 10546)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.cc	(revision 10622)
@@ -367,5 +367,5 @@
             if (GameMode::isMaster())
             {
-//                this->deathEffect();
+                this->deatheffect();
                 this->goWithStyle();
             }
@@ -387,5 +387,5 @@
     {
         // play death effect
-        {
+        /*{
             ParticleSpawner* effect = new ParticleSpawner(this->getContext());
             effect->setPosition(this->getPosition());
@@ -410,5 +410,58 @@
             effect->setSource("Orxonox/sparks");
             effect->setLifetime(4.0f);
-        }
+        }*/
+        
+        
+        {
+            ParticleSpawner* effect = new ParticleSpawner(this->getContext());
+            effect->setPosition(this->getPosition());
+            effect->setOrientation(this->getOrientation());
+            effect->setDestroyAfterLife(true);
+            effect->setSource("orxonox/explosion_flash2");
+            effect->setLifetime(5.0f);
+        }
+        {
+            ParticleSpawner* effect = new ParticleSpawner(this->getContext());
+            effect->setPosition(this->getPosition());
+            effect->setOrientation(this->getOrientation());
+            effect->setDestroyAfterLife(true);
+            effect->setSource("orxonox/explosion_flame2");
+            effect->setLifetime(5.0f);
+        }
+        {
+            ParticleSpawner* effect = new ParticleSpawner(this->getContext());
+            effect->setPosition(this->getPosition());
+            effect->setOrientation(this->getOrientation());
+            effect->setDestroyAfterLife(true);
+            effect->setSource("orxonox/explosion_shockwave2");
+            effect->scale(20);
+            effect->setLifetime(5.0f);
+        }{
+            ParticleSpawner* effect = new ParticleSpawner(this->getContext());
+            effect->setPosition(this->getPosition());
+            effect->setOrientation(this->getOrientation());
+            effect->setDestroyAfterLife(true);
+            effect->setSource("orxonox/explosion_sparks2");
+            effect->setLifetime(5.0f);
+        }
+        {
+            ParticleSpawner* effect = new ParticleSpawner(this->getContext());
+            effect->setPosition(this->getPosition());
+            effect->setOrientation(this->getOrientation());
+            effect->setDestroyAfterLife(true);
+            effect->setSource("orxonox/explosion_streak2");
+            effect->setLifetime(5.0f);
+        }
+        {
+            ParticleSpawner* effect = new ParticleSpawner(this->getContext());
+            effect->setPosition(this->getPosition());
+            effect->setOrientation(this->getOrientation());
+            effect->setDestroyAfterLife(true);
+            effect->setSource("orxonox/explosion_afterglow");
+            effect->scale(20);
+            effect->setLifetime(5.0f);
+        }
+        
+        
         for (unsigned int i = 0; i < this->numexplosionchunks_; ++i)
         {
