Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 30, 2010, 3:44:22 PM (14 years ago)
Author:
scheusso
Message:

some network related fixes

Location:
code/branches/presentation3/src/modules/weapons
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3/src/modules/weapons/projectiles/SimpleRocket.cc

    r7018 r7019  
    6464
    6565        if (GameMode::isMaster())
    66        {
     66        {
    6767            this->setCollisionType(WorldEntity::Kinematic);
    6868            this->fuel_=true;
     
    100100
    101101        SUPER(SimpleRocket, tick, dt);
    102         if (this->getVelocity().squaredLength() >130000) this->maxLife_-=dt; //if Velocity bigger than about 360, uses a lot more "fuel" :)
    103        
     102        if ( GameMode::isMaster() )
     103        {
     104            if (this->getVelocity().squaredLength() >130000)
     105                this->maxLife_-=dt; //if Velocity bigger than about 360, uses a lot more "fuel" :)
     106           
    104107
    105108            this->setAngularVelocity(this->getOrientation() * this->localAngularVelocity_);
     
    108111
    109112           
    110             if (this->fuel_) {
     113            if (this->fuel_)
     114            {
    111115                if (this->destroyTimer_.getRemainingTime()<  this->lifetime_-this->maxLife_ )
    112116                    this->fuel_=false;
    113             } else this->disableFire();
     117            }
     118            else
     119                this->disableFire();
    114120
    115121            if( this->bDestroy_ )
    116122                this->destroy();
     123        }
    117124               
    118125    }
    119126
    120     void SimpleRocket::disableFire(){
    121         this->setAcceleration(0,0,0);       
    122         this->fire_->detachFromParent();
    123 
     127    void SimpleRocket::disableFire()
     128    {
     129        this->setAcceleration(0,0,0);
     130        this->fire_->destroy();
     131        this->fire_ = 0;
     132//         this->fire_->detachFromParent();
    124133    }
    125134
     
    132141        if (this->isInitialized())
    133142        {
    134             this->getController()->destroy();
    135             COUT(4)<< "simplerocket destroyed\n";
     143            if( GameMode::isMaster() )
     144            {
     145                this->getController()->destroy();
     146                COUT(4)<< "simplerocket destroyed\n";
     147            }
    136148        }
    137149    }
     
    204216        }
    205217    }
    206    
    207 
    208     void SimpleRocket::fired(unsigned int firemode)
    209     {
    210         if (this->owner_)
    211         {
    212             {
    213                 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    214                 effect->setPosition(this->getPosition());
    215                 effect->setOrientation(this->getOrientation());
    216                 effect->setDestroyAfterLife(true);
    217                 effect->setSource("Orxonox/explosion4");
    218                 effect->setLifetime(2.0f);
    219             }
    220 
    221             {
    222                 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    223                 effect->setPosition(this->getPosition());
    224                 effect->setOrientation(this->getOrientation());
    225                 effect->setDestroyAfterLife(true);
    226                 effect->setSource("Orxonox/smoke4");
    227                 effect->setLifetime(3.0f);
    228             }
    229             this->destroy();
    230         }
    231     }
    232218
    233219    /**
  • code/branches/presentation3/src/modules/weapons/projectiles/SimpleRocket.h

    r7018 r7019  
    122122            inline float getDamage() const
    123123                { return this->damage_; }
    124             virtual void fired(unsigned int firemode);
    125                        
     124
    126125
    127126        private:
  • code/branches/presentation3/src/modules/weapons/weaponmodes/SimpleRocketFire.cc

    r7018 r7019  
    4646        RegisterObject(SimpleRocketFire);
    4747
    48         this->reloadTime_ = 4;
     48        this->reloadTime_ = 1;
    4949        this->bParallelReload_ = false;
    5050        this->damage_ = 100;
Note: See TracChangeset for help on using the changeset viewer.