Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 3, 2016, 5:48:18 PM (8 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 .

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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)
Note: See TracChangeset for help on using the changeset viewer.