Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 26, 2016, 4:53:34 PM (8 years ago)
Author:
fvultier
Message:

merged discharger, thats the last one

Location:
code/branches/presentationFS16
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationFS16

  • code/branches/presentationFS16/src/orxonox/controllers/AIController.cc

    r11071 r11208  
    197197                    if (this->bHasTargetPosition_)
    198198                        this->moveToTargetPosition();
    199                     this->doFire();
     199                    this->doPush();
    200200                }
    201201
     
    227227                    this->moveToTargetPosition();
    228228
    229                     this->doFire();
     229                    this->doPush();
    230230            }
    231231        }
     
    241241                    if((timeout_< 0)||(!target_))//Check if the timeout is over or target died.
    242242                    {
    243                        controllable->fire(0);//kill the rocket
     243                       controllable->push(0);//kill the rocket
    244244                       this->setPreviousMode();//get out of rocket mode
    245245                    }
  • code/branches/presentationFS16/src/orxonox/controllers/ArtificialController.cc

    r11099 r11208  
    132132        @brief DoFire is called when a bot should shoot and decides which weapon is used and whether the bot shoots at all.
    133133    */
    134     void ArtificialController::doFire()
     134    void ArtificialController::doPush()
    135135    {
    136136        if(!this->bSetupWorked)//setup: find out which weapons are active ! hard coded: laser is "0", lens flare is "1", ...
     
    144144            if (this->isCloseAtTarget(130) && (firemode = getFiremode("LightningGun")) > -1 )
    145145            {//LENSFLARE: short range weapon
    146                 this->getControllableEntity()->fire(firemode); //ai uses lens flare if they're close enough to the target
     146                this->getControllableEntity()->push(firemode); //ai uses lens flare if they're close enough to the target
    147147            }
    148148            else if( this->isCloseAtTarget(400) && (random < this->botlevel_) && (firemode = getFiremode("RocketFire")) > -1 )
    149149            {//ROCKET: mid range weapon
    150150                this->mode_ = ROCKET; //Vector-implementation: mode_.push_back(ROCKET);
    151                 this->getControllableEntity()->fire(firemode); //launch rocket
     151                this->getControllableEntity()->push(firemode); //launch rocket
    152152                if(this->getControllableEntity() && this->target_) //after fire(3) is called, getControllableEntity() refers to the rocket!
    153153                {
     
    161161            }
    162162            else if ((firemode = getFiremode("HsW01")) > -1 ) //LASER: default weapon
    163                 this->getControllableEntity()->fire(firemode);
     163                this->getControllableEntity()->push(firemode);
    164164        }
    165165    }
  • code/branches/presentationFS16/src/orxonox/controllers/ArtificialController.h

    r11071 r11208  
    4848            virtual void changedControllableEntity() override;
    4949
    50             virtual void doFire();
     50            virtual void doPush();
    5151            void setBotLevel(float level=1.0f);
    5252            inline float getBotLevel() const
  • code/branches/presentationFS16/src/orxonox/controllers/DroneController.cc

    r11071 r11208  
    130130                       this->aimAtTarget();
    131131                       if(!this->friendlyFire())
    132                            this->getDrone()->fire(0);
     132                           this->getDrone()->push(0);
    133133                    }
    134134               }
  • code/branches/presentationFS16/src/orxonox/controllers/FightingController.cc

    r11083 r11208  
    318318        }
    319319             
    320         this->getControllableEntity()->fire(firemode);
     320        this->getControllableEntity()->push(firemode);
    321321       
    322322    }
  • code/branches/presentationFS16/src/orxonox/controllers/HumanController.cc

    r11071 r11208  
    4040namespace orxonox
    4141{
    42     extern const std::string __CC_fire_name = "fire";
     42    extern const std::string __CC_push_name = "push";
    4343    extern const std::string __CC_suicide_name = "suicide";
     44    extern const std::string __CC_release_name = "release";
    4445
    4546    SetConsoleCommand("HumanController", "moveFrontBack",          &HumanController::moveFrontBack ).addShortcut().setAsInputCommand();
     
    5152    SetConsoleCommand("HumanController", "toggleFormationFlight",  &HumanController::toggleFormationFlight).addShortcut().keybindMode(KeybindMode::OnPress);
    5253    SetConsoleCommand("HumanController", "FFChangeMode",           &HumanController::FFChangeMode).addShortcut().keybindMode(KeybindMode::OnPress);
    53     SetConsoleCommand("HumanController", __CC_fire_name,           &HumanController::fire          ).addShortcut().keybindMode(KeybindMode::OnHold);
     54    SetConsoleCommand("HumanController", __CC_push_name,           &HumanController::push          ).addShortcut().keybindMode(KeybindMode::OnHold);
     55    SetConsoleCommand("HumanController", __CC_release_name,        &HumanController::release       ).addShortcut().keybindMode(KeybindMode::OnRelease);
    5456    SetConsoleCommand("HumanController", "reload",                 &HumanController::reload        ).addShortcut();
    5557    SetConsoleCommand("HumanController", "boost",                  &HumanController::boost         ).addShortcut().setAsInputCommand().keybindMode(KeybindMode::OnPressAndRelease);
     
    155157    }
    156158
    157     void HumanController::fire(unsigned int firemode)
    158     {
    159         if (HumanController::localController_s)
    160             HumanController::localController_s->doFire(firemode);
    161     }
    162 
    163     void HumanController::doFire(unsigned int firemode)
    164     {
    165         if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    166         {
    167             HumanController::localController_s->controllableEntity_->fire(firemode);
     159    void HumanController::push(unsigned int firemode)
     160    {
     161        if (HumanController::localController_s)
     162            HumanController::localController_s->doPush(firemode);
     163    }
     164
     165    void HumanController::doPush(unsigned int firemode)
     166    {
     167        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     168        {
     169            HumanController::localController_s->controllableEntity_->push(firemode);
    168170            //if human fires, set slaves free. See FormationController::forceFreeSlaves()
     171            if (HumanController::localController_s->state_==MASTER && HumanController::localController_s->formationMode_ == NORMAL)
     172            {
     173                HumanController::localController_s->forceFreeSlaves();
     174            }
     175        }
     176    }
     177
     178    void HumanController::release(unsigned int firemode)
     179    {
     180        if (HumanController::localController_s)
     181            HumanController::localController_s->doRelease(firemode);
     182    }
     183
     184    void HumanController::doRelease(unsigned int firemode)
     185    {
     186        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     187        {
     188            HumanController::localController_s->controllableEntity_->release(firemode);
     189            //if human releases, set slaves free. See FormationController::forceFreeSlaves()
    169190            if (HumanController::localController_s->state_==MASTER && HumanController::localController_s->formationMode_ == NORMAL)
    170191            {
  • code/branches/presentationFS16/src/orxonox/controllers/HumanController.h

    r11071 r11208  
    6161            virtual void pitch(const Vector2& value);
    6262
    63             static void fire(unsigned int firemode);
    64             virtual void doFire(unsigned int firemode);
     63            static void push(unsigned int firemode);
     64            virtual void doPush(unsigned int firemode);
     65            static void release(unsigned int firemode);
     66            virtual void doRelease(unsigned int firemode);
    6567            static void reload();
    6668
  • code/branches/presentationFS16/src/orxonox/controllers/NewHumanController.cc

    r11071 r11208  
    5454    SetConsoleCommand("NewHumanController", "accelerate", &NewHumanController::accelerate).keybindMode(KeybindMode::OnPress);
    5555    SetConsoleCommand("NewHumanController", "decelerate", &NewHumanController::decelerate).keybindMode(KeybindMode::OnPress);
    56     SetConsoleCommand("NewHumanController", "unfire",     &NewHumanController::unfire    ).keybindMode(KeybindMode::OnRelease).addShortcut();
    5756
    5857    RegisterUnloadableClass(NewHumanController);
     
    277276    }
    278277
    279     void NewHumanController::doFire(unsigned int firemode)
     278    void NewHumanController::doPush(unsigned int firemode)
    280279    {
    281280        if (!this->controllableEntity_)
     
    291290        }
    292291        else
    293             HumanController::doFire(firemode); //call for formationflight
     292        {
     293            HumanController::doPush(firemode); //call for formationflight
     294        }
     295    }
     296
     297    void NewHumanController::doRelease(unsigned int firemode)
     298    {
     299        if (!this->controllableEntity_)
     300            return;
     301
     302        this->firemode_ = firemode;
     303
     304        HumanController::doRelease(firemode); //call for formationflight
    294305    }
    295306
     
    342353            }
    343354        }
    344     }
    345 
    346     void NewHumanController::unfire()
    347     {
    348         if (NewHumanController::localController_s)
    349             NewHumanController::localController_s->doUnfire();
    350     }
    351 
    352     void NewHumanController::doUnfire()
    353     {
    354         this->firemode_ = -1;
    355         hideArrows();
    356355    }
    357356
  • code/branches/presentationFS16/src/orxonox/controllers/NewHumanController.h

    r11071 r11208  
    5454            static void decelerate();
    5555
    56             virtual void doFire(unsigned int firemode) override;
     56            virtual void doPush(unsigned int firemode) override;
     57            virtual void doRelease(unsigned int firemode) override;
    5758
    5859            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) override;
    59 
    60             static void unfire();
    61             virtual void doUnfire();
    6260
    6361            void centerCursor();
  • code/branches/presentationFS16/src/orxonox/controllers/WaypointPatrolController.cc

    r11071 r11208  
    6969
    7070            if (this->getControllableEntity() && this->isCloseAtTarget(this->attackradius_) && this->isLookingAtTarget(math::pi / 20.0f))
    71                 this->getControllableEntity()->fire(0);
     71                this->getControllableEntity()->push(0);
    7272        }
    7373        else
Note: See TracChangeset for help on using the changeset viewer.