Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 25, 2009, 8:30:15 PM (16 years ago)
Author:
landauf
Message:

merged pickups2 branch back to trunk. not yet tested.

Location:
code/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/objects/controllers/HumanController.cc

    r3053 r3073  
    4949    SetConsoleCommand(HumanController, boost,         true).keybindMode(KeybindMode::OnHold);
    5050    SetConsoleCommand(HumanController, greet,         true);
    51     SetConsoleCommand(HumanController, use,           true);
    5251    SetConsoleCommand(HumanController, switchCamera,  true);
    5352    SetConsoleCommand(HumanController, mouseLook,     true);
     
    5655    SetConsoleCommand(HumanController, killBots,      true).defaultValues(0);
    5756    SetConsoleCommand(HumanController, dropItems,     true);
     57    SetConsoleCommand(HumanController, useItem,       true);
    5858
    5959    CreateUnloadableFactory(HumanController);
     
    133133    }
    134134
    135     void HumanController::use()
    136     {
    137         if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    138             HumanController::localController_s->controllableEntity_->use();
    139     }
    140 
    141135    void HumanController::switchCamera()
    142136    {
     
    163157    }
    164158
     159    void HumanController::useItem()
     160    {
     161        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     162            HumanController::localController_s->controllableEntity_->useItem();
     163    }
     164
    165165    void HumanController::addBots(unsigned int amount)
    166166    {
  • code/trunk/src/orxonox/objects/controllers/HumanController.h

    r3053 r3073  
    3434#include "util/Math.h"
    3535#include "Controller.h"
     36#include "objects/worldentities/pawns/Pawn.h"
    3637
    3738namespace orxonox
     
    5657            static void boost();
    5758            static void greet();
    58             static void use();
    5959            static void switchCamera();
    6060            static void mouseLook();
    6161            static void dropItems();
     62            static void useItem();
    6263
    6364            static void suicide();
     
    6566            static void addBots(unsigned int amount);
    6667            static void killBots(unsigned int amount = 0);
     68
     69            static inline HumanController* getLocalControllerSingleton()
     70                { return HumanController::localController_s; }
     71            static inline Pawn* getLocalControllerEntityAsPawn()
     72            {
     73                if (HumanController::localController_s) {
     74                    return dynamic_cast<Pawn*>(HumanController::localController_s->getControllableEntity());
     75                } else {
     76                    return NULL;
     77                }
     78            }
    6779
    6880        private:
Note: See TracChangeset for help on using the changeset viewer.