[Orxonox-commit 2304] r7019 - in code/branches/presentation3/src/modules/weapons: projectiles weaponmodes

scheusso at orxonox.net scheusso at orxonox.net
Sun May 30 15:44:22 CEST 2010


Author: scheusso
Date: 2010-05-30 15:44:22 +0200 (Sun, 30 May 2010)
New Revision: 7019

Modified:
   code/branches/presentation3/src/modules/weapons/projectiles/SimpleRocket.cc
   code/branches/presentation3/src/modules/weapons/projectiles/SimpleRocket.h
   code/branches/presentation3/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
Log:
some network related fixes


Modified: code/branches/presentation3/src/modules/weapons/projectiles/SimpleRocket.cc
===================================================================
--- code/branches/presentation3/src/modules/weapons/projectiles/SimpleRocket.cc	2010-05-30 13:19:49 UTC (rev 7018)
+++ code/branches/presentation3/src/modules/weapons/projectiles/SimpleRocket.cc	2010-05-30 13:44:22 UTC (rev 7019)
@@ -63,7 +63,7 @@
         this->maxLife_=90;
 
         if (GameMode::isMaster())
-       {
+        {
             this->setCollisionType(WorldEntity::Kinematic);
             this->fuel_=true;
 
@@ -99,28 +99,37 @@
     {
 
         SUPER(SimpleRocket, tick, dt);
-        if (this->getVelocity().squaredLength() >130000) this->maxLife_-=dt; //if Velocity bigger than about 360, uses a lot more "fuel" :)
-        
+        if ( GameMode::isMaster() )
+        {
+            if (this->getVelocity().squaredLength() >130000)
+                this->maxLife_-=dt; //if Velocity bigger than about 360, uses a lot more "fuel" :)
+            
 
             this->setAngularVelocity(this->getOrientation() * this->localAngularVelocity_);
             this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() );
             this->localAngularVelocity_ = 0;
 
             
-            if (this->fuel_) {
+            if (this->fuel_)
+            {
                 if (this->destroyTimer_.getRemainingTime()<  this->lifetime_-this->maxLife_ ) 
                     this->fuel_=false;
-            } else this->disableFire();
+            }
+            else 
+                this->disableFire();
 
             if( this->bDestroy_ )
                 this->destroy();
+        }
                 
     }
 
-    void SimpleRocket::disableFire(){
-        this->setAcceleration(0,0,0);        
-        this->fire_->detachFromParent();
-
+    void SimpleRocket::disableFire()
+    {
+        this->setAcceleration(0,0,0);
+        this->fire_->destroy();
+        this->fire_ = 0;
+//         this->fire_->detachFromParent();
     }
 
     /**s
@@ -131,8 +140,11 @@
     {
         if (this->isInitialized()) 
         {
-            this->getController()->destroy();
-            COUT(4)<< "simplerocket destroyed\n";
+            if( GameMode::isMaster() )
+            {
+                this->getController()->destroy();
+                COUT(4)<< "simplerocket destroyed\n";
+            }
         }
     }
 
@@ -203,33 +215,7 @@
             this->destroy();
         }
     }
-    
 
-    void SimpleRocket::fired(unsigned int firemode)
-    {
-        if (this->owner_)
-        {
-            {
-                ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
-                effect->setPosition(this->getPosition());
-                effect->setOrientation(this->getOrientation());
-                effect->setDestroyAfterLife(true);
-                effect->setSource("Orxonox/explosion4");
-                effect->setLifetime(2.0f);
-            }
-
-            {
-                ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
-                effect->setPosition(this->getPosition());
-                effect->setOrientation(this->getOrientation());
-                effect->setDestroyAfterLife(true);
-                effect->setSource("Orxonox/smoke4");
-                effect->setLifetime(3.0f);
-            }
-            this->destroy();
-        }
-    }
-
     /**
     @brief
         Rotates the SimpleRocket around the y-axis by the amount specified by the first component of the input 2-dim vector.

Modified: code/branches/presentation3/src/modules/weapons/projectiles/SimpleRocket.h
===================================================================
--- code/branches/presentation3/src/modules/weapons/projectiles/SimpleRocket.h	2010-05-30 13:19:49 UTC (rev 7018)
+++ code/branches/presentation3/src/modules/weapons/projectiles/SimpleRocket.h	2010-05-30 13:44:22 UTC (rev 7019)
@@ -121,9 +121,8 @@
                 { this->damage_ = damage; }
             inline float getDamage() const
                 { return this->damage_; }
-            virtual void fired(unsigned int firemode);
-			
 
+
         private:
             WeakPtr<Pawn> owner_;
             Vector3 localAngularVelocity_;

Modified: code/branches/presentation3/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
===================================================================
--- code/branches/presentation3/src/modules/weapons/weaponmodes/SimpleRocketFire.cc	2010-05-30 13:19:49 UTC (rev 7018)
+++ code/branches/presentation3/src/modules/weapons/weaponmodes/SimpleRocketFire.cc	2010-05-30 13:44:22 UTC (rev 7019)
@@ -45,7 +45,7 @@
     {
         RegisterObject(SimpleRocketFire);
 
-        this->reloadTime_ = 4;
+        this->reloadTime_ = 1;
         this->bParallelReload_ = false;
         this->damage_ = 100;
         this->speed_ = 300;




More information about the Orxonox-commit mailing list