Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11208


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:
47 edited
9 copied

Legend:

Unmodified
Added
Removed
  • code/branches/presentationFS16

  • code/branches/presentationFS16/data/defaultConfig/keybindings.ini

    r10622 r11208  
    122122KeyStop=
    123123KeySystemRequest="printScreen"
    124 KeyT="onpress fire 3"
     124KeyT= onpress push 3 | onrelease release 3
    125125KeyTab="NewHumanController changeMode"
    126126KeyU=""
     
    132132KeyVolumeDown=
    133133KeyVolumeUp=
    134 KeyW="scale 1 moveFrontBack"
     134KeyW="scale 1 moveFrontBack "
    135135KeyWake=
    136136KeyWebBack=
     
    142142KeyWebStop=
    143143KeyX="selectClosest"
    144 KeyY="onpress fire 4"
     144KeyY= onpress push 4 | onrelease release 4
    145145KeyYen=
    146146KeyZ="selectNext"
     
    152152Button6=
    153153Button7=
    154 Left="fire 0"
    155 Middle="fire 2"
    156 Right= fire 1 | unfire
     154Left= push 0 | release 0
     155Middle= push 2 | release 2
     156Right= push 1 | release 1
    157157Wheel1Down="NewHumanController decelerate"
    158158Wheel1Up="NewHumanController accelerate"
  • code/branches/presentationFS16/data/gui/scripts/KeyBindMenu.lua

    r8232 r11208  
    77
    88    commandList = {}
    9     table.insert(commandList, "fire 0")
    10     table.insert(commandList, "fire 1 | unfire")
    11     table.insert(commandList, "onpress fire 2")
    12     table.insert(commandList, "onpress fire 3")
     9    table.insert(commandList, "fire 0" | "release 0")
     10    table.insert(commandList, "fire 1" | "release 1")
     11    table.insert(commandList, "onpress fire 2" | "onrelease release 2")
     12    table.insert(commandList, "onpress fire 3" | "onrelease release 3")
    1313    table.insert(commandList, "scale 1 moveFrontBack")
    1414    table.insert(commandList, "scale -1 moveFrontBack")
  • code/branches/presentationFS16/data/levels/emptyLevel.oxw

    r11199 r11208  
    1313
    1414<?lua
    15   include("templates/spaceshipEscort.oxt")
     15  include("templates/spaceshipEscortDischarger.oxt")
    1616  include("templates/spaceshipHover.oxt")
    1717?>
     
    2929
    3030    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
    31     <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
     31    <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescortdischarger />
    3232
    3333    <SpaceShip position="0,0,0" lookat="0,0,0" >
  • code/branches/presentationFS16/data/levels/includes/weaponSettingsEscort.oxi

    r11052 r11208  
    11    <weaponslots>
    2       <WeaponSlot position="-9.2,2,-13" />
    3       <WeaponSlot position=" 9.2,2,-13" />
     2      <WeaponSlot
     3        position="-9.2,2,-13"
     4      />
    45    </weaponslots>
     6
    57    <weaponsets>
    6       <WeaponSet firemode=0 />
    7       <WeaponSet firemode=1 />
     8      <WeaponSet
     9        firemode=0
     10      />
    811    </weaponsets>
     12   
    913    <weaponpacks>
    1014      <WeaponPack>
    1115        <links>
    12           <DefaultWeaponmodeLink firemode=0 weaponmode=0 />
    13           <DefaultWeaponmodeLink firemode=1 weaponmode=1 />
     16          <DefaultWeaponmodeLink
     17            firemode=0
     18            weaponmode=0
     19          />
    1420        </links>
    1521        <Weapon>
    16           <HsW01 mode=0 munitionpershot=1 delay=0.125 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" projectileMesh="LaserBeam2.mesh" />
     22          <Discharger
     23            mode=0
     24            munitionpershot=1
     25            delay=0
     26            damage=0.8
     27            material="Flares/point_lensflare"
     28            muzzleoffset=" 1.6, 1.3, -2.0"
     29            projectileMesh="LaserBeam2.mesh"
     30          />
    1731        </Weapon>
    18         <Weapon>
    19           <HsW01 mode=0 munitionpershot=1 delay=0     damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" projectileMesh="LaserBeam2.mesh" />
    20         </Weapon>
     32   
    2133      </WeaponPack>
    22       <WeaponPack>
    23         <links>
    24           <DefaultWeaponmodeLink firemode=1 weaponmode=0 />
    25         </links>
    26       </WeaponPack>
     34
    2735    </weaponpacks>
    2836    <munition>
    29       <LaserMunition initialmagazines=8 maxmagazines=8 munitionpermagazine=10 replenishamount=1 replenishinterval=7.5/>
     37      <LaserMunition
     38        initialmagazines=2
     39        maxmagazines=2
     40        munitionpermagazine=10
     41        replenishamount=1
     42        replenishinterval=2
     43      />
    3044    </munition>
  • code/branches/presentationFS16/data/levels/missionOne.oxw

    r11052 r11208  
    1212  include("templates/lodInformation.oxt")
    1313  include("templates/spaceshipAssff.oxt")
     14  include("templates/spaceshipEscort.oxt")
    1415  include("templates/spaceshipPirate.oxt")
    1516  include("templates/spaceshipSpacecruiser.oxt")
     
    5758        <events>
    5859            <trigger>
    59                 <TeamSpawnPoint team=0 position="800,700,600" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff>
     60                <TeamSpawnPoint team=0 position="800,700,600" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort>
    6061                  <EventTrigger invert=true>
    6162                    <events>
  • code/branches/presentationFS16/data/overlays/HUDTemplates3.oxo

    r11052 r11208  
    184184     weaponModeHUDSize      = "0.09, 0.03"
    185185    />
     186
     187    <HUDChargeBar
     188     name                   = "ChargeBar"
     189     background    = "Orxonox/BarBackground"
     190     size          = "0.40, 0.04"
     191     position      = "0.0 , 0.5 "
     192     pickpoint     = "0, 1"
     193     correctaspect = true
     194     iconmaterial  = "Orxonox/BarIconCharge"
     195    >
     196      <BarColour position = 0.0 colour = "0.7,0.5,0.2" />
     197      <BarColour position = 0.5 colour = "0.2,0.7,0.2" />
     198      <BarColour position = 1.0 colour = "0.7,0.2,0.2" />
     199    </HUDChargeBar>
    186200   
    187201    <HUDTimer
  • code/branches/presentationFS16/src/modules/invader/InvaderEnemyShooter.cc

    r11083 r11208  
    7171    void InvaderEnemyShooter::shoot()
    7272    {
    73         ControllableEntity::fire(0);
     73        ControllableEntity::push(0);
    7474    }
    7575
  • code/branches/presentationFS16/src/modules/invader/InvaderShip.cc

    r11071 r11208  
    9191        // shoot!
    9292        if (isFireing)
    93             ControllableEntity::fire(0);
     93            ControllableEntity::push(0);
    9494
    9595        // Camera
  • code/branches/presentationFS16/src/modules/jump/JumpFigure.cc

    r11071 r11208  
    398398    }
    399399
    400     void JumpFigure::fire(unsigned int firemode)
    401     {
    402 
    403     }
    404 
    405     void JumpFigure::fired(unsigned int firemode)
     400    void JumpFigure::push(unsigned int firemode)
     401    {
     402
     403    }
     404
     405    void JumpFigure::pushed(unsigned int firemode)
    406406    {
    407407        firePressed_ = true;
  • code/branches/presentationFS16/src/modules/jump/JumpFigure.h

    r11105 r11208  
    4747            virtual void rotatePitch(const Vector2& value) override;
    4848            virtual void rotateRoll(const Vector2& value) override;
    49             void fire(unsigned int firemode);
    50             virtual void fired(unsigned int firemode) override;
     49            void push(unsigned int firemode);
     50            virtual void pushed(unsigned int firemode) override;
    5151            virtual void JumpFromPlatform(JumpPlatform* platform);
    5252            virtual void JumpFromSpring(JumpSpring* spring);
  • code/branches/presentationFS16/src/modules/objects/controllers/TurretController.cc

    r11071 r11208  
    198198            {
    199199
    200                 this->getControllableEntity()->fire(0);
     200                this->getControllableEntity()->push(0);
    201201            }
    202202        }
  • code/branches/presentationFS16/src/modules/overlays/hud/CMakeLists.txt

    r11052 r11208  
    1414  HUDWeapon.cc
    1515  HUDWeaponSystem.cc
     16  HUDChargeBar.cc
    1617  ChatOverlay.cc
    1718  AnnounceMessage.cc
  • code/branches/presentationFS16/src/modules/towerdefense/TowerDefenseSelecter.cc

    r11071 r11208  
    146146    }
    147147
    148     void TowerDefenseSelecter::fire(unsigned int firemode)
     148    void TowerDefenseSelecter::push(unsigned int firemode)
    149149    {
    150150    }
    151151
    152     void TowerDefenseSelecter::fired(unsigned int firemode)
     152    void TowerDefenseSelecter::pushed(unsigned int firemode)
    153153    {
    154154       
  • code/branches/presentationFS16/src/modules/towerdefense/TowerDefenseSelecter.h

    r11071 r11208  
    4747            virtual void rotatePitch(const Vector2& value) override;
    4848            virtual void rotateRoll(const Vector2& value) override;
    49             void fire(unsigned int firemode);
    50             virtual void fired(unsigned int firemode) override;
     49            void push(unsigned int firemode);
     50            virtual void pushed(unsigned int firemode) override;
    5151            virtual void boost(bool bBoost) override;
    5252            virtual void setSelectedPosition(TDCoordinate* newPos);
  • code/branches/presentationFS16/src/modules/weapons/WeaponsPrereqs.h

    r11052 r11208  
    107107    class SimpleRocketFire;
    108108    class GravityBombFire;
     109    class Discharger;
    109110}
    110111
  • code/branches/presentationFS16/src/modules/weapons/projectiles/Rocket.cc

    r11071 r11208  
    218218        Destroys the Rocket upon pressing "fire".
    219219    */
    220     void Rocket::fired(unsigned int firemode)
     220    void Rocket::pushed(unsigned int firemode)
    221221    {
    222222        this->destroyObject();
  • code/branches/presentationFS16/src/modules/weapons/projectiles/Rocket.h

    r11071 r11208  
    116116            virtual void setShooter(Pawn* shooter) override;
    117117
    118             virtual void fired(unsigned int firemode) override;
     118            virtual void pushed(unsigned int firemode) override;
    119119
    120120            /**
  • code/branches/presentationFS16/src/modules/weapons/projectiles/RocketOld.cc

    r11071 r11208  
    218218        Destroys the RocketOld upon pressing "fire".
    219219    */
    220     void RocketOld::fired(unsigned int firemode)
     220    void RocketOld::pushed(unsigned int firemode)
    221221    {
    222222        this->destroyObject();
  • code/branches/presentationFS16/src/modules/weapons/projectiles/RocketOld.h

    r11071 r11208  
    116116            virtual void setShooter(Pawn* shooter) override;
    117117
    118             virtual void fired(unsigned int firemode) override;
     118            virtual void pushed(unsigned int firemode) override;
    119119
    120120        private:
  • code/branches/presentationFS16/src/modules/weapons/weaponmodes/CMakeLists.txt

    r11108 r11208  
    1313  GravityBombFire.cc
    1414  MineGun.cc
     15  Discharger.cc
    1516)
  • 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
  • code/branches/presentationFS16/src/orxonox/weaponsystem/Weapon.cc

    r11071 r11208  
    9999        Fire this Weapon with the the WeaponMode defined by @param mode
    100100    */
    101     void Weapon::fire(unsigned int mode)
     101    void Weapon::push(unsigned int mode)
    102102    {
    103103        // To avoid firing with more than one mode at the same time, we lock the weapon (reloading) for
     
    114114        // Note: The reloading of each WeaponMode is internally handled by each A, B and C.
    115115        //       The reloading of the weapon is only performed to avoid firing with different modes at the same time.
     116   
     117   
    116118        if (this->bReloading_ && this->reloadingWeaponmode_ != mode)
    117119            return;
     
    123125        {
    124126            float reloading_time = 0;
    125             if (it->second->fire(&reloading_time))
     127            if (it->second->push(&reloading_time))
     128            {
     129                this->bReloading_ = true;
     130                this->reloadingWeaponmode_ = mode;
     131
     132                this->reloadTimer_.setInterval(reloading_time);
     133                this->reloadTimer_.startTimer();
     134            }
     135        }
     136    }
     137
     138    void Weapon::release(unsigned int mode)
     139    {
     140        if (this->bReloading_ && this->reloadingWeaponmode_ != mode)
     141            return;
     142
     143        std::multimap<unsigned int, WeaponMode*>::iterator start = this->weaponmodes_.lower_bound(mode);
     144        std::multimap<unsigned int, WeaponMode*>::iterator end   = this->weaponmodes_.upper_bound(mode);
     145
     146        for (std::multimap<unsigned int, WeaponMode*>::iterator it = start; it != end; ++it)
     147        {
     148            float reloading_time = 0;
     149            if (it->second->release(&reloading_time))
    126150            {
    127151                this->bReloading_ = true;
  • code/branches/presentationFS16/src/orxonox/weaponsystem/Weapon.h

    r11071 r11208  
    5252            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5353
    54             void fire(unsigned int mode);
     54            void push(unsigned int mode);
     55            void release(unsigned int mode);
    5556            void reload();
    5657
  • code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponMode.cc

    r11108 r11208  
    2424 *      Fabian 'x3n' Landau
    2525 *   Co-authors:
    26  *      ...
     26 *      Johannes Sager
    2727 *
    2828 */
     
    6363        this->bAutoReload_ = true;
    6464        this->bParallelReload_ = true;
     65        this->chargeable_ = false;              // most weapons are not chargeable
     66        this->charges_ = 0;                     // always start with no charges
     67        this->maxCharges_ = 100;                // default maximum charges one can have are 100
    6568
    6669        this->reloadTimer_.setTimer(0.0f, false, createExecutor(createFunctor(&WeaponMode::reloaded, this)));
     
    121124    {
    122125        (*reloadTime) = this->reloadTime_;
    123        
    124126        // Fireing is only possible if this weapon mode is not reloading and there is enough munition
    125127        if (!this->bReloading_ && this->munition_ && this->munition_->takeMunition(this->munitionPerShot_, this))
     
    169171    }
    170172
     173    bool WeaponMode::push(float* reloadTime)
     174    {
     175
     176        if( this->chargeable_)                                                                                                          // chargeable weapons are supposed to charge on push
     177        {
     178            this->munition_ = this->weapon_->getWeaponPack()->getWeaponSystem()->getMunition(&this->munitiontype_);                     // updates the pointer to the munition(which we use in the next step)
     179            if(this->charges_ < this->maxCharges_ && this->bReloading_ == false && this->munition_->canTakeMunition(1, this))           // charges up unless:
     180            {                                                                                                                           // - we are fully charged
     181                this->charges_ += 1;                                                                                                    // - we are reloading
     182            }                                                                                                                           // - we have no munition
     183            return false;
     184        }
     185        else                                                                                                                            // normal (not chargeable) weapons are supposed to fire on push
     186        {
     187            return fire(reloadTime);
     188        }
     189    }
     190
     191    bool WeaponMode::release(float* reloadTime)                 
     192    {
     193        if( this->chargeable_)                                                                                                          // chargeable weapons are supposed to fire on release
     194        {
     195            return fire(reloadTime);
     196        }
     197        else                                                                                                                            // normal (not chargeable) weapons should do nothing on release
     198        {
     199            return false;
     200        }
     201    }
     202
    171203    bool WeaponMode::reload()
    172204    {
  • code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponMode.h

    r11108 r11208  
    2424 *      Fabian 'x3n' Landau
    2525 *   Co-authors:
    26  *      ...
     26 *      Johannes Sager
    2727 *
    2828 */
     
    4545    /**
    4646    @brief
    47         A WeaponMode defines how a Weapon is used. It specifies what kind of @ref orxonox::Projectile is created when you fire it, how much time it takes to reload, what sound you hear while shooting, how much damage the projectile deals to a target, ...
     47        A WeaponMode defines how a Weapon is used. It specifies what kind of
     48        @ref orxonox::Projectile is created when you fire it, how much time it takes to reload,
     49        what sound you hear while shooting, how much damage the projectile deals to a target, ...
    4850    */
    4951    class _OrxonoxExport WeaponMode : public BaseObject
     
    5557            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5658
     59            virtual bool push(float* reloadTime);
     60            virtual bool release(float* reloadTime);
    5761            virtual bool fire(float* reloadTime);
    5862            bool reload();
     
    106110
    107111            // Fire
     112            inline unsigned int getMaxCharges()                 // get the maximum of charges one can have
     113                { return this->maxCharges_;}
     114            inline unsigned int getCharges()                    // get the current amount of charges
     115                { return this->charges_;}
     116            inline bool isChargeable()                          // returns if the weaponmode is chargeable
     117                { return this->chargeable_;}
    108118            inline void setDamage(float damage)
    109119                { this->damage_ = damage;}
     
    166176            unsigned int initialMagazines_;
    167177            unsigned int munitionPerShot_;
     178            unsigned int charges_;                  // current amount of charges only matters for chargeable weapons(chargeable == true)
     179            unsigned int maxCharges_;               // maximum amount of charges (is initialized with 100 in weaponmode.cc) only matters for chargeable weapons(chargeable == true)
    168180
    169181            float reloadTime_;
    170             bool bAutoReload_; // If true, the weapon reloads the magazine automatically.
    171             bool bParallelReload_; // If true, the weapon reloads in parallel to the magazine reloading.
     182            bool bAutoReload_;                      // If true, the weapon reloads the magazine automatically.
     183            bool bParallelReload_;                  // If true, the weapon reloads in parallel to the magazine reloading.
     184            bool chargeable_;                       // If true, the weapon charges up on push and fires on release
    172185
    173186            float damage_;
     
    189202
    190203            Timer reloadTimer_;
    191             bool bReloading_; // If true, this weapon mode is marked as reloading.
     204            bool bReloading_;                       // If true, this weapon mode is marked as reloading.
    192205
    193206            Vector3 muzzlePosition_;
    194207            Quaternion muzzleOrientation_;
    195208
    196             std::string fireSoundPath_; // The path of the sound played when fireing
    197             float fireSoundVolume_; // The volume of the sound played when fireing
    198             std::vector<WorldSound*> fireSounds_; // List of sounds used by the weapon mode. Because multiple sounds may overlap, we need mor than one WorldSound instance.
    199             std::string reloadSoundPath_; // The path of the sound played when reloading
    200             float reloadSoundVolume_; // The volume of the sound played when reloading
     209            std::string fireSoundPath_;             // The path of the sound played when fireing
     210            float fireSoundVolume_;                 // The volume of the sound played when fireing
     211            std::vector<WorldSound*> fireSounds_;   // List of sounds used by the weapon mode. Because multiple sounds may overlap, we need mor than one WorldSound instance.
     212            std::string reloadSoundPath_;           // The path of the sound played when reloading
     213            float reloadSoundVolume_;               // The volume of the sound played when reloading
    201214            WorldSound* reloadSound_;
    202215    };
  • code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponPack.cc

    r11071 r11208  
    7474        Fire all weapons in this WeaponSet with the defined weaponmode.
    7575    */
    76     void WeaponPack::fire(unsigned int weaponmode)
     76    void WeaponPack::push(unsigned int weaponmode)
    7777    {
    7878        for (Weapon* weapon : this->weapons_)
    79             weapon->fire(weaponmode);
     79            weapon->push(weaponmode);
     80    }
     81
     82    void WeaponPack::release(unsigned int weaponmode)
     83    {
     84        for (Weapon* weapon : this->weapons_)
     85            weapon->release(weaponmode);
    8086    }
    8187
  • code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponPack.h

    r11071 r11208  
    4646            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4747
    48             void fire(unsigned int weaponmode);
     48            void push(unsigned int weaponmode);
     49            void release(unsigned int weaponmode);
    4950            void reload();
    5051
  • code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponSet.cc

    r11071 r11208  
    6060    }
    6161
    62     void WeaponSet::fire()
     62    void WeaponSet::push()
    6363    {
    6464        // Fire all WeaponPacks with their defined weaponmode
    6565        for (const auto& mapEntry : this->weaponpacks_)
    6666            if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED)
    67                 mapEntry.first->fire(mapEntry.second);
     67                mapEntry.first->push(mapEntry.second);
     68    }
     69
     70    void WeaponSet::release()
     71    {
     72        // Fire all WeaponPacks with their defined weaponmode
     73        for (const auto& mapEntry : this->weaponpacks_)
     74            if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED)
     75                mapEntry.first->release(mapEntry.second);
    6876    }
    6977
  • code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponSet.h

    r11071 r11208  
    4646            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4747
    48             void fire();
     48            void push();
     49            void release();
    4950            void reload();
    5051
  • code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponSystem.cc

    r11099 r11208  
    287287        Fires the @ref orxonox::WeaponSet with the specified firemode.
    288288    */
    289     void WeaponSystem::fire(unsigned int firemode)
     289    void WeaponSystem::push(unsigned int firemode)
    290290    {
    291291        std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode);
    292292        if (it != this->weaponSets_.end() && it->second)
    293             it->second->fire();
     293            it->second->push();
     294    }
     295
     296    void WeaponSystem::release(unsigned int firemode)
     297    {
     298        std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode);
     299        if (it != this->weaponSets_.end() && it->second)
     300            it->second->release();
    294301    }
    295302
  • code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponSystem.h

    r11176 r11208  
    7676            void changeWeaponmode(WeaponPack * wPack, WeaponSet * wSet, unsigned int weaponmode);
    7777
    78             void fire(unsigned int firemode);
     78            void push(unsigned int firemode);
     79            void release(unsigned int firemode);
    7980            void reload();
    8081
  • code/branches/presentationFS16/src/orxonox/worldentities/ControllableEntity.cc

    r11071 r11208  
    4949    RegisterClass(ControllableEntity);
    5050
    51     registerMemberNetworkFunction( ControllableEntity, fire );
     51    registerMemberNetworkFunction( ControllableEntity, push );
    5252    registerMemberNetworkFunction( ControllableEntity, setTargetInternal );
    5353
     
    299299    }
    300300
    301     void ControllableEntity::fire(unsigned int firemode)
     301    void ControllableEntity::push(unsigned int firemode)
    302302    {
    303303        if(GameMode::isMaster())
    304304        {
    305             this->fired(firemode);
     305            this->pushed(firemode);
    306306        }
    307307        else
    308308        {
    309             callMemberNetworkFunction(&ControllableEntity::fire, this->getObjectID(), 0, firemode);
     309            callMemberNetworkFunction(&ControllableEntity::push, this->getObjectID(), 0, firemode);
     310        }
     311    }
     312
     313    void ControllableEntity::release(unsigned int firemode)
     314    {
     315        if(GameMode::isMaster())
     316        {
     317            this->released(firemode);
     318        }
     319        else
     320        {
     321            callMemberNetworkFunction(&ControllableEntity::release, this->getObjectID(), 0, firemode);
    310322        }
    311323    }
  • code/branches/presentationFS16/src/orxonox/worldentities/ControllableEntity.h

    r11071 r11208  
    9696                { this->rotateRoll(Vector2(value, 0)); }
    9797
    98             void fire(unsigned int firemode);
    99             virtual void fired(unsigned int firemode) {}
     98            void push(unsigned int firemode);
     99            void release(unsigned int firemode);
     100            virtual void pushed(unsigned int firemode) {}
     101            virtual void released(unsigned int firemode) {}
    100102            virtual void reload() {}
    101103
  • code/branches/presentationFS16/src/orxonox/worldentities/pawns/Pawn.cc

    r11176 r11208  
    432432    */
    433433
    434     void Pawn::fired(unsigned int firemode)
    435     {
    436         if (this->weaponSystem_)
    437             this->weaponSystem_->fire(firemode);
     434    void Pawn::pushed(unsigned int firemode)
     435    {
     436        if (this->weaponSystem_)
     437            this->weaponSystem_->push(firemode);
     438    }
     439
     440    void Pawn::released(unsigned int firemode)
     441    {
     442        if (this->weaponSystem_)
     443            this->weaponSystem_->release(firemode);
    438444    }
    439445
  • code/branches/presentationFS16/src/orxonox/worldentities/pawns/Pawn.h

    r11176 r11208  
    157157            virtual void kill();
    158158
    159             virtual void fired(unsigned int firemode) override;
     159            virtual void pushed(unsigned int firemode) override;
     160            virtual void released(unsigned int firemode) override;
    160161            virtual void postSpawn();
    161162
  • code/branches/presentationFS16/src/orxonox/worldentities/pawns/Spectator.cc

    r11071 r11208  
    4242namespace orxonox
    4343{
    44     extern const std::string __CC_fire_name;
     44    extern const std::string __CC_push_name;
    4545    extern const std::string __CC_suicide_name;
    4646
     
    162162
    163163        // change keybind mode of fire command to OnPress to avoid firing after respawn
    164         ModifyConsoleCommand(__CC_fire_name).keybindMode(KeybindMode::OnPress);
     164        ModifyConsoleCommand(__CC_push_name).keybindMode(KeybindMode::OnPress);
    165165
    166166        // disable suicide
     
    177177        // change fire command to a helper function and change keybind mode to OnPress
    178178        // as soon as the player releases and presses the button again, the helper function will be called which changes the keybind mode back to OnHold
    179         ModifyConsoleCommand(__CC_fire_name).pushFunction(&Spectator::resetFireCommand).keybindMode(KeybindMode::OnPress);
     179        ModifyConsoleCommand(__CC_push_name).pushFunction(&Spectator::resetFireCommand).keybindMode(KeybindMode::OnPress);
    180180
    181181        // enable suicide
     
    188188    void Spectator::resetFireCommand(unsigned int firemode)
    189189    {
    190         ModifyConsoleCommand(__CC_fire_name).popFunction().keybindMode(KeybindMode::OnHold); // pop this helper function and change keybind mode
    191 
    192         CommandExecutor::execute(__CC_fire_name + " " + multi_cast<std::string>(firemode)); // call the fire command again, this time with the real function
     190        ModifyConsoleCommand(__CC_push_name).popFunction().keybindMode(KeybindMode::OnHold); // pop this helper function and change keybind mode
     191
     192        CommandExecutor::execute(__CC_push_name + " " + multi_cast<std::string>(firemode)); // call the fire command again, this time with the real function
    193193    }
    194194
     
    229229    }
    230230
    231     void Spectator::fired(unsigned int firemode)
     231    void Spectator::pushed(unsigned int firemode)
    232232    {
    233233        if (this->getPlayer())
  • code/branches/presentationFS16/src/orxonox/worldentities/pawns/Spectator.h

    r9667 r11208  
    5454            virtual void rotateRoll(const Vector2& value);
    5555
    56             virtual void fired(unsigned int firemode);
     56            virtual void pushed(unsigned int firemode);
    5757            virtual void greet();
    5858            virtual void mouseLook() {}
Note: See TracChangeset for help on using the changeset viewer.