Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 3, 2016, 5:48:18 PM (9 years ago)
Author:
fvultier
Message:

Implemented a feature that was requested during PPS: Vulnerability can be switched on/off using the event system. Also: Resolved a TODO in CommandNotification.cc .

Location:
code/branches/fabienHS15/src/orxonox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/fabienHS15/src/orxonox/weaponsystem/WeaponMode.cc

    r10791 r11027  
    7575        this->muzzleOrientation_ = Quaternion::IDENTITY;
    7676
    77         hudImageString_ = "WSHUD_WM_Unknown";
     77        hudImageString_ = "Orxonox/WSHUD_WM_Unknown";
    7878
    7979        if( GameMode::isMaster() )
  • code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.cc

    r10814 r11027  
    3434#include "core/GameMode.h"
    3535#include "core/XMLPort.h"
     36#include "core/EventIncludes.h"
    3637#include "network/NetworkFunction.h"
    3738
     
    6263
    6364        this->bAlive_ = true;
     65        this->bVulnerable_ = true;
    6466
    6567        this->health_ = 0;
     
    134136        XMLPortParam(Pawn, "shieldabsorption", setShieldAbsorption, getShieldAbsorption, xmlelement, mode).defaultValues(0);
    135137
     138        XMLPortParam(Pawn, "vulnerable", setVulnerable, isVulnerable, xmlelement, mode).defaultValues(true);
     139
    136140        XMLPortParam(Pawn, "spawnparticlesource", setSpawnParticleSource, getSpawnParticleSource, xmlelement, mode);
    137141        XMLPortParam(Pawn, "spawnparticleduration", setSpawnParticleDuration, getSpawnParticleDuration, xmlelement, mode).defaultValues(3.0f);
     
    149153
    150154        XMLPortParam ( RadarViewable, "radarname", setRadarName, getRadarName, xmlelement, mode );
     155    }
     156
     157    void Pawn::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
     158    {
     159        SUPER(Pawn, XMLEventPort, xmlelement, mode);
     160
     161        XMLPortEventState(Pawn, BaseObject, "vulnerability", setVulnerable, xmlelement, mode);
    151162    }
    152163
     
    242253    }
    243254
     255    void Pawn::changedVulnerability()
     256    {
     257
     258    }
     259
    244260    void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
    245261    {
     262        // A pawn can only get damaged if it is vulnerable
     263        if (!isVulnerable())
     264        {
     265            return;
     266        }
     267
    246268        // Applies multiplier given by the DamageBoost Pickup.
    247269        if (originator)
  • code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.h

    r10814 r11027  
    6262
    6363            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     64            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
    6465            virtual void tick(float dt);
    6566
     
    131132
    132133            virtual void decreaseShieldRechargeCountdownTime(float dt);
     134
     135            /** @brief Sets the state of the pawns vulnerability. @param bVulnerable */
     136            inline void setVulnerable(bool bVulnerable)
     137            {
     138                if (this->bVulnerable_ != bVulnerable)
     139                {
     140                    this->bVulnerable_ = bVulnerable;
     141                    this->changedVulnerability();
     142                }
     143            }
     144            /** @brief Returns the state of the pawns vulnerability. @return The state of the vulnerability */
     145            inline const bool& isVulnerable() const { return this->bVulnerable_; }
     146            /** @brief This function gets called if the vulnerability of the pawn changes. */
     147            virtual void changedVulnerability();
    133148
    134149            inline ControllableEntity* getLastHitOriginator() const
     
    212227
    213228            bool bAlive_;
     229            bool bVulnerable_; ///< If false the pawn may not ged damaged
    214230
    215231            virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const
Note: See TracChangeset for help on using the changeset viewer.