Index: code/trunk/src/orxonox/worldentities/ControllableEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/ControllableEntity.cc	(revision 5929)
+++ code/trunk/src/orxonox/worldentities/ControllableEntity.cc	(revision 6417)
@@ -36,4 +36,5 @@
 #include "core/GameMode.h"
 #include "core/XMLPort.h"
+#include "network/NetworkFunction.h"
 
 #include "Scene.h"
@@ -47,4 +48,7 @@
 {
     CreateFactory(ControllableEntity);
+
+    registerMemberNetworkFunction( ControllableEntity, fire );
+    registerMemberNetworkFunction( ControllableEntity, setTargetInternal );
 
     ControllableEntity::ControllableEntity(BaseObject* creator) : MobileEntity(creator)
@@ -62,7 +66,9 @@
         this->camera_ = 0;
         this->xmlcontroller_ = 0;
+        this->controller_ = 0;
         this->reverseCamera_ = 0;
         this->bDestroyWhenPlayerLeft_ = false;
         this->cameraPositionRootNode_ = this->node_->createChildSceneNode();
+        this->currentCameraPosition_ = 0;
         this->bMouseLook_ = false;
         this->mouseLookSpeed_ = 200;
@@ -169,4 +175,5 @@
             {
                 this->cameraPositions_.front()->attachCamera(this->camera_);
+                this->currentCameraPosition_ = this->cameraPositions_.front().get();
             }
             else if (this->cameraPositions_.size() > 0)
@@ -178,7 +185,13 @@
                         ++it;
                         if (it != this->cameraPositions_.end())
+                        {
                             (*it)->attachCamera(this->camera_);
+                            this->currentCameraPosition_ = *it;
+                        }
                         else
+                        {
                             (*this->cameraPositions_.begin())->attachCamera(this->camera_);
+                            this->currentCameraPosition_ = *this->cameraPositions_.begin();
+                        }
                         break;
                     }
@@ -188,4 +201,5 @@
             {
                 this->camera_->attachToNode(this->cameraPositionRootNode_);
+                this->currentCameraPosition_ = 0;
             }
         }
@@ -198,4 +212,11 @@
         if (!this->bMouseLook_)
             this->cameraPositionRootNode_->setOrientation(Quaternion::IDENTITY);
+        if (this->getCamera())
+        {
+            if (!this->bMouseLook_&& this->currentCameraPosition_->getDrag())
+                this->getCamera()->setDrag(true);
+            else
+                this->getCamera()->setDrag(false);
+        }
     }
 
@@ -216,4 +237,37 @@
         if (this->bMouseLook_)
             this->cameraPositionRootNode_->roll(Radian(value.y * this->mouseLookSpeed_), Ogre::Node::TS_LOCAL);
+    }
+
+    void ControllableEntity::fire(unsigned int firemode)
+    {
+        if(GameMode::isMaster())
+        {
+            this->fired(firemode);
+        }
+        else
+        {
+            callMemberNetworkFunction(ControllableEntity, fire, this->getObjectID(), 0, firemode);
+        }
+    }
+
+    void ControllableEntity::setTarget( WorldEntity* target )
+    {
+        this->target_ = target;
+        if ( !GameMode::isMaster() )
+        {
+            if ( target != 0 )
+            {
+                callMemberNetworkFunction(ControllableEntity, setTargetInternal, this->getObjectID(), 0, target->getObjectID() );
+            }
+           else
+           {
+                callMemberNetworkFunction(ControllableEntity, setTargetInternal, this->getObjectID(), 0, OBJECTID_UNKNOWN );
+           }
+        }
+    }
+
+    void ControllableEntity::setTargetInternal( uint32_t targetID )
+    {
+        this->setTarget( orxonox_cast<WorldEntity*>(Synchronisable::getSynchronisable(targetID)) );
     }
 
@@ -279,15 +333,21 @@
             this->camera_ = new Camera(this);
             this->camera_->requestFocus();
-            if (this->cameraPositionTemplate_ != "")
+            if (!this->cameraPositionTemplate_.empty())
                 this->addTemplate(this->cameraPositionTemplate_);
             if (this->cameraPositions_.size() > 0)
+            {
                 this->cameraPositions_.front()->attachCamera(this->camera_);
+                this->currentCameraPosition_ = this->cameraPositions_.front();
+            }
             else
+            {
                 this->camera_->attachToNode(this->cameraPositionRootNode_);
+                this->currentCameraPosition_ = 0;
+            }
         }
 
         if (!this->hud_ && GameMode::showsGraphics())
         {
-            if (this->hudtemplate_ != "")
+            if (!this->hudtemplate_.empty())
             {
                 this->hud_ = new OverlayGroup(this);
