Index: code/branches/ai/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- code/branches/ai/src/orxonox/controllers/ArtificialController.cc	(revision 6957)
+++ code/branches/ai/src/orxonox/controllers/ArtificialController.cc	(revision 6958)
@@ -38,7 +38,10 @@
 #include "controllers/DroneController.h"
 #include "util/Math.h"
+#include "core/ConsoleCommand.h"
 
 namespace orxonox
 {
+    SetConsoleCommand(ArtificialController, formationflight, true);//.defaultValues(0, true);
+    SetConsoleCommand(ArtificialController, masteraction, true);
 
     static const unsigned int MAX_FORMATION_SIZE = 7;
@@ -56,5 +59,5 @@
 
         this->target_ = 0;
-        this->formationFlight_  =  true;
+        this->formationFlight_ = true;
         this->myMaster_ = 0;
         this->freedomCount_ = 0;
@@ -79,5 +82,38 @@
 
         XMLPortParam(ArtificialController, "team", setTeam, getTeam, xmlelement, mode).defaultValues(-1);
-//         XMLPortParam(ArtificialController, "formation", setFormationFlight, getFormationFlight, xmlelement, mode).defaultValues(true);
+        XMLPortParam(ArtificialController, "formation", setFormationFlight, getFormationFlight, xmlelement, mode).defaultValues(true);
+    }
+
+    //activate/deactivate formationflight
+    void ArtificialController::formationflight(bool form)
+    {
+        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
+        {
+            if (!it->getController())
+                continue;
+
+            ArtificialController *aiController = static_cast<ArtificialController*>(it->getController());
+
+            if(aiController)
+            {
+                aiController->formationFlight_ = form;
+            }
+        }
+    }
+    //get all masters to do this action
+    void ArtificialController::masteraction(int action) 
+    {
+        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
+        {
+            if (!it->getController())
+                continue;
+
+            ArtificialController *aiController = static_cast<ArtificialController*>(it->getController());
+
+            if(aiController || aiController->state_ == MASTER)
+            {
+                aiController->specificMasterAction_ = TURN180;
+            }
+        }
     }
 
@@ -125,6 +161,13 @@
             if (this->target_ || distance > 10)
             {
+                if (this->specificMasterAction_ == NONE)
+                {
                 this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_MASTER * sgn(coord.x) * coord.x*coord.x);
                 this->getControllableEntity()->rotatePitch(ROTATEFACTOR_MASTER * sgn(coord.y) * coord.y*coord.y);
+                } else if (this->specificMasterAction_ == TURN180)
+                {
+                this->getControllableEntity()->rotateYaw(-1.0f * sgn(coord.x) * coord.x*coord.x);
+                this->getControllableEntity()->rotatePitch(sgn(coord.y) * coord.y*coord.y);
+                }
 
             }
@@ -143,8 +186,4 @@
            this->getControllableEntity()->rotateYaw(-2.0f * ROTATEFACTOR_MASTER * sgn(coord.x) * coord.x*coord.x);
            this->getControllableEntity()->rotatePitch(2.0f * ROTATEFACTOR_MASTER * sgn(coord.y) * coord.y*coord.y);
-
-
-
-
 
             if (distance < 300)
@@ -177,5 +216,4 @@
             if( it != myMaster_->slaves_.end() )
                 myMaster_->slaves_.erase(it);
-// COUT(0) << "~unregister slave" << std::endl;
         }
     }
@@ -345,5 +383,10 @@
     void ArtificialController::specificMasterActionHold()
     {
-        if (specificMasterActionHoldCount_ == 0) this->specificMasterAction_ = NONE;
+        if (specificMasterActionHoldCount_ == 0) 
+         {
+            this->specificMasterAction_ = NONE;
+            this->searchNewTarget();
+            COUT(0) << "~action end" << std::endl;
+         }
         else specificMasterActionHoldCount_--;
     }
@@ -351,5 +394,11 @@
     void ArtificialController::turn180()
     {
-        this->specificMasterAction_  =  NONE;
+        COUT(0) << "~turn" << std::endl;
+
+        Quaternion orient = this->getControllableEntity()->getOrientation();
+
+        this->setTargetPosition(this->getControllableEntity()->getPosition() + 500.0f*orient*WorldEntity::BACK);
+        this->specificMasterActionHoldCount_ = 2;
+        this->specificMasterAction_  =  HOLD;
     }
 
@@ -382,5 +431,4 @@
     void ArtificialController::searchNewTarget()
     {
-COUT(0) << "search new target - start" << std::endl;
         if (!this->getControllableEntity())
             return;
@@ -407,5 +455,4 @@
             }
         }
-COUT(0) << "search new target - end: " << this->target_ << std::endl;
     }
 
@@ -544,5 +591,5 @@
         if (droneController && static_cast<ControllableEntity*>(droneController->getOwner()) == entity1)
             return true;
-            
+
         return (team1 == team2 && team1 != -1);
     }
Index: code/branches/ai/src/orxonox/controllers/ArtificialController.h
===================================================================
--- code/branches/ai/src/orxonox/controllers/ArtificialController.h	(revision 6957)
+++ code/branches/ai/src/orxonox/controllers/ArtificialController.h	(revision 6958)
@@ -59,4 +59,6 @@
             virtual void changedControllableEntity();
 
+            static void formationflight(bool form);
+            static void masteraction(int action);
 
         protected:
