Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 18, 2009, 6:14:52 PM (16 years ago)
Author:
landauf
Message:

Added many new features in the Munition class:

  • there are now 3 modes: a) every weapon has it's own magazine b) all weapons use the same magazin c) no magazines, just a big munition pool
  • the Munition class handles the reloading of the magazine

Split the Weapon class into Weapon and WeaponMode. WeaponMode creates the fire of the Weapon. A weapon can own several WeaponModes (for example primary and secondary fire). But it's also possible to have a weapon with several muzzles which all fire at the same time (there's a WeaponMode for each muzzle).

Renamed LaserGun to LaserFire and Fusion to FusionFire. They inherit now from WeaponMode.

Changed the code in the Weapon class to use the new Munition functionality.

Added ReplenishingMunition, a subclass of Munition that replenishes itself (used for LaserGunMunition).

Added a reload command to reload magazines.

Location:
code/branches/weapons/src/orxonox/objects/worldentities/pawns
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/weapons/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r2914 r2918  
    5656        this->fire_ = 0x0;
    5757        this->firehack_ = 0x0;
     58        this->bReload_ = false;
    5859
    5960        this->health_ = 0;
     
    115116        registerVariable(this->initialHealth_, variableDirection::toclient);
    116117        registerVariable(this->fire_,          variableDirection::toserver);
     118        registerVariable(this->bReload_,       variableDirection::toserver);
    117119    }
    118120
     
    121123        SUPER(Pawn, tick, dt);
    122124
    123         if (this->weaponSystem_)
     125        if (this->weaponSystem_ && GameMode::isMaster())
    124126        {
    125127            for (unsigned int firemode = 0; firemode < WeaponSystem::MAX_FIRE_MODES; firemode++)
    126128                if (this->fire_ & WeaponSystem::getFiremodeMask(firemode))
    127129                    this->weaponSystem_->fire(firemode);
    128         }
     130
     131            if (this->bReload_)
     132                this->weaponSystem_->reload();
     133        }
     134
    129135        this->fire_ = this->firehack_;
    130136        this->firehack_ = 0x0;
     137        this->bReload_ = false;
    131138
    132139        if (this->health_ <= 0)
     
    258265    }
    259266
     267    void Pawn::reload()
     268    {
     269        this->bReload_ = true;
     270    }
     271
    260272    void Pawn::postSpawn()
    261273    {
  • code/branches/weapons/src/orxonox/objects/worldentities/pawns/Pawn.h

    r2914 r2918  
    8181
    8282            virtual void fire(unsigned int firemode);
     83            virtual void reload();
    8384            virtual void postSpawn();
    8485
     
    131132            unsigned int fire_;
    132133            unsigned int firehack_;
     134            bool bReload_;
    133135
    134136            std::string spawnparticlesource_;
Note: See TracChangeset for help on using the changeset viewer.