Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2986


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.

Location:
code/branches/gametypes/src/orxonox/objects
Files:
10 edited

Legend:

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

    r2978 r2986  
    4444        RegisterObject(Asteroids);
    4545        this->firstCheckpointReached_ = false;
     46        this->firstTimeSpawned_ = false;
    4647    }
    4748
     
    5960            this->end();
    6061        }
    61        
    6262    }
    6363
     64    void Asteroids::spawnPlayer(PlayerInfo* player)
     65    {
     66        if (this->timerIsActive_ && this->firstTimeSpawned_)
     67        {
     68            this->end();
     69            return;
     70        }
     71
     72        this->firstTimeSpawned_ = true;
     73        Gametype::spawnPlayer(player);
     74    }
    6475
    6576    void Asteroids::start()
  • code/branches/gametypes/src/orxonox/objects/gametypes/Asteroids.h

    r2970 r2986  
    5050              { this->firstCheckpointReached_ = reached; }
    5151
     52        protected:
     53            virtual void spawnPlayer(PlayerInfo* player);
     54
    5255        private:
    5356            bool firstCheckpointReached_;
    5457            bool gameEnded_;
     58            bool firstTimeSpawned_;
    5559
    5660    };
  • code/branches/gametypes/src/orxonox/objects/quest/QuestEffectBeacon.cc

    r2662 r2986  
    4141
    4242#include "orxonox/objects/infos/PlayerInfo.h"
    43 #include "orxonox/objects/worldentities/ControllableEntity.h"
     43#include "orxonox/objects/worldentities/pawns/Pawn.h"
    4444#include "orxonox/objects/worldentities/triggers/PlayerTrigger.h"
    4545#include "QuestEffect.h"
     
    120120
    121121        //! Extracting the ControllableEntity form the PlayerTrigger.
    122         ControllableEntity* entity = trigger->getTriggeringPlayer();
    123 
    124         if(entity == NULL)
    125         {
    126             COUT(2) << "The QuestEffectBeacon was triggered by an entity other than a ControllableEntity." << std::endl;
     122        Pawn* pawn = trigger->getTriggeringPlayer();
     123
     124        if(pawn == NULL)
     125        {
     126            COUT(2) << "The QuestEffectBeacon was triggered by an entity other than a Pawn." << std::endl;
    127127            return false;
    128128        }
    129129       
    130130        //! Extract the PlayerInfo from the ControllableEntity.
    131         PlayerInfo* player = entity->getPlayer();
     131        PlayerInfo* player = pawn->getPlayer();
    132132       
    133133        if(player == NULL)
  • 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()
  • code/branches/gametypes/src/orxonox/objects/worldentities/MovableEntity.h

    r2662 r2986  
    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/branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc

    r2978 r2986  
    3737
    3838#include "orxonox/objects/worldentities/ControllableEntity.h"
     39#include "orxonox/objects/worldentities/pawns/Pawn.h"
    3940
    4041namespace orxonox
     
    5152    this->bIsDestination_ = false;
    5253    //this->setVisible(true);
     54
     55    this->notifyMaskUpdate();
    5356  }
    5457
     
    8790     }
    8891  }
     92
     93  void CheckPoint::notifyMaskUpdate()
     94  {
     95      this->targetMask_.exclude(Class(BaseObject));
     96      this->targetMask_.include(Class(Pawn));
     97  }
    8998}
  • code/branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.h

    r2970 r2986  
    5757    private:
    5858      virtual void triggered(bool bIsTriggered);
     59      virtual void notifyMaskUpdate();
    5960
    6061      inline void setDestination(bool isDestination)
  • code/branches/gametypes/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc

    r2826 r2986  
    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/branches/gametypes/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h

    r2826 r2986  
    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/branches/gametypes/src/orxonox/objects/worldentities/triggers/PlayerTrigger.h

    r2662 r2986  
    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   
Note: See TracChangeset for help on using the changeset viewer.