[Orxonox-commit 1361] r6079 - code/branches/particles2/src/modules/weapons/projectiles

scheusso at orxonox.net scheusso at orxonox.net
Tue Nov 17 10:59:26 CET 2009


Author: scheusso
Date: 2009-11-17 10:59:25 +0100 (Tue, 17 Nov 2009)
New Revision: 6079

Modified:
   code/branches/particles2/src/modules/weapons/projectiles/Rocket.cc
   code/branches/particles2/src/modules/weapons/projectiles/Rocket.h
Log:
trying to make CE change possible


Modified: code/branches/particles2/src/modules/weapons/projectiles/Rocket.cc
===================================================================
--- code/branches/particles2/src/modules/weapons/projectiles/Rocket.cc	2009-11-17 00:36:21 UTC (rev 6078)
+++ code/branches/particles2/src/modules/weapons/projectiles/Rocket.cc	2009-11-17 09:59:25 UTC (rev 6079)
@@ -34,6 +34,9 @@
 #include "graphics/ParticleSpawner.h"
 #include "graphics/Model.h"
 #include "objects/collisionshapes/ConeCollisionShape.h"
+#include "infos/PlayerInfo.h"
+#include "controllers/Controller.h"
+#include "worldentities/CameraPosition.h"
 
 namespace orxonox
 {
@@ -68,6 +71,11 @@
 
             this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&Rocket::destroyObject, this)));
         }
+        
+        this->camPosition_ = new CameraPosition(this);
+        this->camPosition_->setPosition(0,0,0);
+        this->attach( this->camPosition_ );
+        this->addCameraPosition( this->camPosition_ );
     }
 
     /**
@@ -80,6 +88,10 @@
         {
             this->collisionShape_->destroy();
             this->model_->destroy();
+            
+            if (GameMode::isMaster() && this->owner_)
+                this->owner_->getPlayer()->startControl(this->originalControllableEntity_);
+            this->camPosition_->destroy();
         }
     }
 
@@ -96,6 +108,9 @@
     void Rocket::setOwner(Pawn* owner)
     {
         this->owner_ = owner;
+            
+        this->originalControllableEntity_ = this->owner_->getPlayer()->getControllableEntity();
+        this->owner_->getPlayer()->startControl(this);
     }
 
     /**

Modified: code/branches/particles2/src/modules/weapons/projectiles/Rocket.h
===================================================================
--- code/branches/particles2/src/modules/weapons/projectiles/Rocket.h	2009-11-17 00:36:21 UTC (rev 6078)
+++ code/branches/particles2/src/modules/weapons/projectiles/Rocket.h	2009-11-17 09:59:25 UTC (rev 6079)
@@ -109,14 +109,17 @@
                 { this->damage_ = damage; }
             inline float getDamage() const
                 { return this->damage_; }
+            virtual void fire(unsigned int firemode) {}
             
         private:
             WeakPtr<Pawn> owner_;
             Vector3 localAngularVelocity_;
             float damage_;
             bool bDestroy_;
+            ControllableEntity* originalControllableEntity_;
             
             Model* model_;
+            CameraPosition* camPosition_;
             ConeCollisionShape* collisionShape_;
             Timer destroyTimer_;
             float lifetime_;




More information about the Orxonox-commit mailing list