Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 25, 2011, 9:28:29 PM (13 years ago)
Author:
dafrick
Message:

Reverse merge to revert last, failed, merge. Apparently you can't partially commit a merge.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/modules/weapons/projectiles/Projectile.cc

    r8578 r8579  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    4141    CreateFactory(Projectile);
    4242
    43     Projectile::Projectile(BaseObject* creator) : MovableEntity(creator), BasicProjectile()
     43    Projectile::Projectile(BaseObject* creator) : MovableEntity(creator)
    4444    {
    4545        RegisterObject(Projectile);
    4646
    4747        this->setConfigValues();
     48        this->bDestroy_ = false;
    4849        this->owner_ = 0;
     50        this->damage_ = 15;
    4951
    5052        // Get notification about collisions
     53
    5154        if (GameMode::isMaster())
    5255        {
     
    8184            return;
    8285
    83         if (this->getBDestroy())
     86        if (this->bDestroy_)
    8487            this->destroy(); // TODO: use a scheduler instead of deleting the object right here in tick()
    8588    }
     
    9194    }
    9295
    93     /* Calls the collidesAgainst function of BasicProjectile
    94      */
    9596    bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    9697    {
    97         return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
     98        if (!this->bDestroy_ && GameMode::isMaster())
     99        {
     100            if (otherObject == this->owner_)
     101                return false;
     102
     103            this->bDestroy_ = true;
     104
     105            if (this->owner_)
     106            {
     107                {
     108                    ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
     109                    effect->setPosition(this->getPosition());
     110                    effect->setOrientation(this->getOrientation());
     111                    effect->setDestroyAfterLife(true);
     112                    effect->setSource("Orxonox/explosion3");
     113                    effect->setLifetime(2.0f);
     114                }
     115                {
     116                    ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
     117                    effect->setPosition(this->getPosition());
     118                    effect->setOrientation(this->getOrientation());
     119                    effect->setDestroyAfterLife(true);
     120                    effect->setSource("Orxonox/smoke4");
     121                    effect->setLifetime(3.0f);
     122                }
     123            }
     124
     125            Pawn* victim = orxonox_cast<Pawn*>(otherObject);
     126            if (victim)
     127                victim->hit(this->owner_, contactPoint, this->damage_);
     128        }
     129        return false;
    98130    }
    99131
Note: See TracChangeset for help on using the changeset viewer.