Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6356 for code/branches


Ignore:
Timestamp:
Dec 15, 2009, 11:04:39 PM (15 years ago)
Author:
scheusso
Message:

god mode hack for presentation

Location:
code/branches/presentation2/src/orxonox
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/orxonox/controllers/Controller.cc

    r6108 r6356  
    4141        this->player_ = 0;
    4242        this->controllableEntity_ = 0;
     43        this->bGodMode_ = false;
    4344    }
    4445
  • code/branches/presentation2/src/orxonox/controllers/Controller.h

    r6295 r6356  
    5151
    5252            virtual inline void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) {};
     53           
     54            void setGodMode( bool mode ){ this->bGodMode_ = mode; }
     55            bool getGodMode(){ return this->bGodMode_; }
    5356
    5457            inline ControllableEntity* getControllableEntity() const
     
    7073            PlayerInfo* player_;
    7174            ControllableEntity* controllableEntity_;
     75        private:
     76            bool bGodMode_;
    7277    };
    7378}
  • code/branches/presentation2/src/orxonox/controllers/HumanController.cc

    r6195 r6356  
    5454    SetConsoleCommand(HumanController, mouseLook,     true);
    5555    SetConsoleCommand(HumanController, suicide,       true);
     56    SetConsoleCommand(HumanController, toggleGodMode, true);
    5657    SetConsoleCommand(HumanController, addBots,       true).defaultValues(1);
    5758    SetConsoleCommand(HumanController, killBots,      true).defaultValues(0);
     
    209210    }
    210211
     212    void HumanController::toggleGodMode()
     213    {
     214        HumanController::getLocalControllerSingleton()->setGodMode( !HumanController::getLocalControllerSingleton()->getGodMode() );
     215    }
     216
    211217    void HumanController::useItem()
    212218    {
  • code/branches/presentation2/src/orxonox/controllers/HumanController.h

    r6199 r6356  
    7474
    7575            static void suicide();
     76            static void toggleGodMode();
    7677
    7778            static void addBots(unsigned int amount);
  • code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc

    r6295 r6356  
    168168    void Pawn::hit(Pawn* originator, const Vector3& force, float damage)
    169169    {
    170         if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator))
     170        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
    171171        {
    172172            this->damage(damage, originator);
     
    179179    void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
    180180    {
    181         if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator))
     181        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
    182182        {
    183183            this->damage(damage, originator);
Note: See TracChangeset for help on using the changeset viewer.