Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 23, 2009, 9:57:52 PM (15 years ago)
Author:
landauf
Message:

merged gametypes branch back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc

    r2896 r3033  
    3535#include "core/Executor.h"
    3636#include "core/GameMode.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 (GameMode::isMaster() && enableCollisionDamage_)
     78        {
     79            Pawn* victim = dynamic_cast<Pawn*>(otherObject);
     80            if (victim)
     81            {
     82                victim->damage(this->collisionDamage_ * victim->getVelocity().dotProduct(this->getVelocity()));
     83            }
     84        }
     85
     86        return false;
     87    }
     88
    7089
    7190    void MovableEntity::registerVariables()
Note: See TracChangeset for help on using the changeset viewer.