Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 18, 2009, 6:00:13 PM (15 years ago)
Author:
Aurelian
Message:

Respawning changed, not possible anymore, not completely working. Movable Entity is now able to cause damage.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gametypes/src/orxonox/objects/worldentities/MovableEntity.cc

    r2662 r2986  
    3535#include "core/Executor.h"
    3636#include "core/Core.h"
     37#include "objects/worldentities/pawns/Pawn.h"
    3738
    3839namespace orxonox
     
    6768    {
    6869        SUPER(MovableEntity, XMLPort, xmlelement, mode);
     70
     71        XMLPortParam(MovableEntity, "enablecollisiondamage", setEnableCollisionDamage, getEnableCollisionDamage, xmlelement, mode).defaultValues(false);
     72        XMLPortParam(MovableEntity, "collisiondamage", setCollisionDamage, getCollisionDamage, xmlelement, mode).defaultValues(1);
    6973    }
     74
     75    bool MovableEntity::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     76    {
     77            if (Core::isMaster() && enableCollisionDamage_)
     78            {
     79                Pawn* victim = dynamic_cast<Pawn*>(otherObject);
     80                if (victim)
     81                {
     82COUT(0) << "colission";
     83                   
     84                    victim->damage(this->collisionDamage_ * victim->getVelocity().dotProduct(this->getVelocity()));
     85}
     86            }
     87
     88        return false;
     89    }
     90
    7091
    7192    void MovableEntity::registerVariables()
Note: See TracChangeset for help on using the changeset viewer.