Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 13, 2008, 2:55:13 PM (15 years ago)
Author:
landauf
Message:
  • deatheffect (explosion) of Pawns works on client and server (creator of the effects can't be the Pawn itself because it will be destroyed on the client before synchronizing the effects)
  • fixed a small initialization error in Shader
  • fixed a bug in the resynchronization of already deleted MovableEntities
  • ExplosionChunk only recalculates it's velocity on the Master
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/ExplosionChunk.cc

    r2414 r2422  
    3030#include "ExplosionChunk.h"
    3131
     32#include "core/Core.h"
    3233#include "core/CoreIncludes.h"
    3334#include "core/Executor.h"
     
    4748            ThrowException(AbortLoading, "Can't create ExplosionChunk, no scene or no scene manager given.");
    4849
     50        this->bStop_ = false;
    4951        this->LOD_ = LODParticle::normal;
    5052
     
    6365        }
    6466
    65         Vector3 velocity(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1));
    66         velocity.normalise();
    67         velocity *= rnd(40, 60);
    68         this->setVelocity(velocity);
     67        if (Core::isMaster())
     68        {
     69            Vector3 velocity(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1));
     70            velocity.normalise();
     71            velocity *= rnd(60, 80);
     72            this->setVelocity(velocity);
    6973
    70         this->destroyTimer_.setTimer(rnd(1, 2), false, this, createExecutor(createFunctor(&ExplosionChunk::stop)));
     74            this->destroyTimer_.setTimer(rnd(1, 2), false, this, createExecutor(createFunctor(&ExplosionChunk::stop)));
     75        }
    7176
    7277        this->registerVariables();
     
    8691    void ExplosionChunk::registerVariables()
    8792    {
    88         REGISTERDATA(this->LOD_, direction::toclient, new NetworkCallback<ExplosionChunk>(this, &ExplosionChunk::LODchanged));
     93        REGISTERDATA(this->LOD_,   direction::toclient, new NetworkCallback<ExplosionChunk>(this, &ExplosionChunk::LODchanged));
     94        REGISTERDATA(this->bStop_, direction::toclient, new NetworkCallback<ExplosionChunk>(this, &ExplosionChunk::checkStop));
    8995    }
    9096
     
    97103    }
    98104
     105    void ExplosionChunk::checkStop()
     106    {
     107        if (this->bStop_)
     108            this->stop();
     109    }
     110
    99111    void ExplosionChunk::stop()
    100112    {
     
    104116            this->smoke_->setEnabled(false);
    105117
    106         this->destroyTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&ExplosionChunk::destroy)));
     118        if (Core::isMaster())
     119        {
     120            this->bStop_ = true;
     121            this->destroyTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&ExplosionChunk::destroy)));
     122        }
    107123    }
    108124
     
    116132        static const unsigned int CHANGES_PER_SECOND = 5;
    117133
    118         if (rnd() < dt*CHANGES_PER_SECOND)
     134        if (Core::isMaster() && rnd() < dt*CHANGES_PER_SECOND)
    119135        {
    120136            float length = this->getVelocity().length();
Note: See TracChangeset for help on using the changeset viewer.