Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

merged gametypes branch back to trunk

Location:
code/trunk
Files:
15 edited
8 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/objects/worldentities/CMakeLists.txt

    r2826 r3033  
    2323  PongBall.cc
    2424  PongBat.cc
     25  ForceField.cc
    2526)
    2627
  • code/trunk/src/orxonox/objects/worldentities/MobileEntity.cc

    r3028 r3033  
    166166    }
    167167
     168    void MobileEntity::applyCentralForce(const Vector3& force)
     169    {
     170        if (this->isDynamic())
     171            this->physicalBody_->applyCentralForce(btVector3(force.x * this->getMass(), force.y * this->getMass(), force.z * this->getMass()));
     172    }
     173
    168174    bool MobileEntity::isCollisionTypeLegal(WorldEntity::CollisionType type) const
    169175    {
  • code/trunk/src/orxonox/objects/worldentities/MobileEntity.h

    r3028 r3033  
    7575                { return this->angularAcceleration_; }
    7676
     77            void applyCentralForce(const Vector3& force);
     78            inline void applyCentralForce(float x, float y, float z)
     79                { this->applyCentralForce(Vector3(x, y, z)); }
     80
    7781            inline void setRotationRate(Degree rate)
    7882                { this->setAngularVelocity(this->getAngularVelocity().normalisedCopy() * rate.valueRadians()); }
  • 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()
  • code/trunk/src/orxonox/objects/worldentities/MovableEntity.h

    r2662 r3033  
    4646
    4747            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     48            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
    4849            void registerVariables();
    4950
     
    5556            inline void setOrientation(const Quaternion& orientation)
    5657                { MobileEntity::setOrientation(orientation); this->overwrite_orientation_ = this->getOrientation(); }
     58
     59            inline void setOwner(Pawn* owner)
     60                { this->owner_ = owner; }
     61            inline Pawn* getOwner() const
     62                { return this->owner_; }
     63
     64            inline void setCollisionDamage(float c)
     65                { this->collisionDamage_ = c; }
     66
     67            inline float getCollisionDamage()
     68                { return this->collisionDamage_; }
     69
     70            inline void setEnableCollisionDamage(bool c)
     71            {
     72                this->enableCollisionDamage_ = c;
     73                this->enableCollisionCallback();
     74            }
     75
     76            inline bool getEnableCollisionDamage()
     77                { return this->enableCollisionDamage_; }
    5778
    5879        private:
     
    7697            Timer<MovableEntity> resynchronizeTimer_;
    7798            Timer<MovableEntity>* continuousResynchroTimer_;
     99
     100            Pawn* owner_;
     101            float collisionDamage_;
     102            bool enableCollisionDamage_;
    78103    };
    79104}
  • code/trunk/src/orxonox/objects/worldentities/SpawnPoint.cc

    r2662 r3033  
    9595    void SpawnPoint::spawn(ControllableEntity* entity)
    9696    {
    97         entity->setPosition(this->getPosition());
    98         entity->setOrientation(this->getOrientation());
     97        entity->setPosition(this->getWorldPosition());
     98        entity->setOrientation(this->getWorldOrientation());
    9999    }
    100100}
  • code/trunk/src/orxonox/objects/worldentities/pawns/CMakeLists.txt

    r2710 r3033  
    33  Pawn.cc
    44  SpaceShip.cc
     5  TeamBaseMatchBase.cc
     6  Destroyer.cc
    57)
  • code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r2904 r3033  
    198198    void Pawn::death()
    199199    {
     200        this->setHealth(1);
    200201        if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_))
    201202        {
     
    214215                this->deatheffect();
    215216        }
    216         else
    217             this->setHealth(1);
    218217    }
    219218
  • code/trunk/src/orxonox/objects/worldentities/triggers/CMakeLists.txt

    r2710 r3033  
    44  EventTrigger.cc
    55  PlayerTrigger.cc
     6  CheckPoint.cc
    67)
  • code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc

    r3028 r3033  
    3535#include "core/XMLPort.h"
    3636
    37 #include "orxonox/objects/worldentities/ControllableEntity.h"
     37#include "orxonox/objects/worldentities/pawns/Pawn.h"
    3838
    3939namespace orxonox
     
    109109    WEMask.include(Class(WorldEntity));
    110110    this->targetMask_ *= WEMask;
     111
     112    this->notifyMaskUpdate();
    111113  }
    112114
     
    133135        if(this->isForPlayer())
    134136        {
    135           ControllableEntity* player = dynamic_cast<ControllableEntity*>(entity);
     137          Pawn* player = dynamic_cast<Pawn*>(entity);
    136138          this->setTriggeringPlayer(player);
    137139        }
  • code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h

    r3028 r3033  
    6363    protected:
    6464      virtual bool isTriggered(TriggerMode mode);
     65      virtual void notifyMaskUpdate() {}
     66
     67      ClassTreeMask targetMask_;
    6568
    6669    private:
    67       ClassTreeMask targetMask_;
    6870      std::set<Ogre::Node*> targetSet_;
    6971      float distance_;
  • code/trunk/src/orxonox/objects/worldentities/triggers/PlayerTrigger.h

    r2662 r3033  
    6060        @return Returns a pointer to the ControllableEntity that triggered the PlayerTrigger.
    6161        */
    62         inline ControllableEntity* getTriggeringPlayer(void) const
     62        inline Pawn* getTriggeringPlayer(void) const
    6363            { return this->player_; }
    6464       
     
    7777        @param player A pointer to the ControllableEntity that triggered the PlayerTrigger.
    7878        */
    79         inline void setTriggeringPlayer(ControllableEntity* player)
     79        inline void setTriggeringPlayer(Pawn* player)
    8080           { this->player_ = player; }
    8181
     
    8888       
    8989    private:
    90         ControllableEntity* player_; //!< The player that triggered the PlayerTrigger.
     90        Pawn* player_; //!< The player that triggered the PlayerTrigger.
    9191        bool isForPlayer_; //!< Is true when the PlayerTrigger schould be set to normally be triggered by ControllableEntities.
    9292   
  • code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.cc

    r3028 r3033  
    102102    {
    103103      this->bFirstTick_ = false;
    104       this->fireEvent(false);
     104      this->triggered(false);
    105105    }
    106106
     
    144144      this->bTriggered_ = (newState & 0x1);
    145145      this->bActive_ = newState & 2;
    146       this->fireEvent(this->bActive_);
     146      this->triggered(this->bActive_);
    147147      this->stateChanges_.pop();
    148148      if (this->stateChanges_.size() != 0)
     
    160160    else
    161161      this->setBillboardColour(ColourValue(1.0, 0.0, 0.0));
     162  }
     163
     164  void Trigger::triggered(bool bIsTriggered)
     165  {
     166    this->fireEvent(bIsTriggered);
    162167  }
    163168
  • code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.h

    r3028 r3033  
    8989        { return this->remainingActivations_; }
    9090
     91      inline void setVisible(bool visibility)
     92        { this->debugBillboard_.setVisible(visibility); }
     93
    9194      void setDelay(float delay);
    9295      inline float getDelay() const
     
    101104      inline bool isTriggered() { return this->isTriggered(this->mode_); }
    102105      virtual bool isTriggered(TriggerMode mode);
     106      virtual void triggered(bool bIsTriggered);
    103107
    104108    private:
Note: See TracChangeset for help on using the changeset viewer.