Orxonox: orxonox::Pawn Class Reference

# orxonox::Pawn Class Reference

`#include <src/orxonox/objects/worldentities/pawns/Pawn.h>`

Inheritance diagram for orxonox::Pawn:

List of all members.

## Public Member Functions

void | addHealth (float health)
void | addWeaponPack (WeaponPack *wPack)
void | addWeaponSet (WeaponSet *wSet)
void | addWeaponSlot (WeaponSlot *wSlot)
virtual void | damage (float damage, Pawn *originator=0)
virtual void | doFire (uint8_t firemode)
virtual void | dropItems ()
virtual void | fire (unsigned int firemode)
unsigned int | getExplosionChunks () const
float | getHealth () const
float | getInitialHealth () const
ControllableEntity * | getLastHitOriginator () const
float | getMaxHealth () const
PickupCollection & | getPickups ()
float | getSpawnParticleDuration () const
const std::string & | getSpawnParticleSource () const
WeaponPack * | getWeaponPack (unsigned int index) const
WeaponSet * | getWeaponSet (unsigned int index) const
WeaponSlot * | getWeaponSlot (unsigned int index) const
const WorldEntity * | getWorldEntity () const
virtual void | hit (Pawn *originator, const Vector3 &force, float damage)
bool | isAlive () const
virtual void | kill ()
| Pawn (BaseObject *creator)
virtual void | postSpawn ()
void | registerVariables ()
virtual void | reload ()
void | removeHealth (float health)
void | setExplosionChunks (unsigned int chunks)
virtual void | setHealth (float health)
void | setInitialHealth (float initialhealth)
void | setMaxHealth (float maxhealth)
void | setSpawnParticleDuration (float duration)
void | setSpawnParticleSource (const std::string &source)
virtual void | startLocalHumanControl ()
virtual void | tick (float dt)
| Gets called every frame.
virtual void | useItem ()
virtual void | XMLPort (Element &xmlelement, XMLPort::Mode mode)
| XML loading and saving.
virtual | ~Pawn ()

## Protected Member Functions

virtual void | death ()
virtual void | deatheffect ()
virtual void | goWithStyle ()
virtual void | removePlayer ()
virtual void | setPlayer (PlayerInfo *player)
virtual void | spawneffect ()

## Protected Attributes

bool | bAlive_
bool | bReload_
float | health_
float | initialHealth_
Pawn * | lastHitOriginator_
float | maxHealth_
unsigned int | numexplosionchunks_
PickupCollection | pickups_
float | spawnparticleduration_
std::string | spawnparticlesource_
WeaponSystem * | weaponSystem_

## Private Member Functions

void | setWeaponSystem (WeaponSystem *weaponsystem)

## Friends

class | WeaponSystem

## Constructor & Destructor Documentation

orxonox::Pawn::Pawn | ( | BaseObject * | creator | ) |

References bAlive_, bReload_, orxonox::RadarViewable::Dot, getPickups(), orxonox::ControllableEntity::hasLocalController(), health_, initialHealth_, orxonox::RadarViewable::isHumanShip_, orxonox::GameMode::isMaster(), lastHitOriginator_, maxHealth_, RegisterObject, registerVariables(), orxonox::PickupCollection::setOwner(), orxonox::WeaponSystem::setPawn(), orxonox::RadarViewable::setRadarObjectColour(), orxonox::RadarViewable::setRadarObjectShape(), spawnparticleduration_, orxonox::PawnManager::touch(), WeaponSystem, and weaponSystem_.

orxonox::Pawn::~Pawn | ( |  | ) | `[virtual]`

References orxonox::BaseObject::isInitialized(), and weaponSystem_.

## Member Function Documentation

void orxonox::Pawn::addHealth | ( | float | health | ) | `[inline]`

Referenced by orxonox::HealthImmediate::pickedUp(), and orxonox::HealthUsable::used().

void orxonox::Pawn::addWeaponPack | ( | WeaponPack * | wPack | ) |

References orxonox::WeaponSystem::addWeaponPack(), and weaponSystem_.

Referenced by XMLPort().

void orxonox::Pawn::addWeaponSet | ( | WeaponSet * | wSet | ) |

References orxonox::WeaponSystem::addWeaponSet(), and weaponSystem_.

Referenced by XMLPort().

void orxonox::Pawn::addWeaponSlot | ( | WeaponSlot * | wSlot | ) |

References orxonox::WeaponSystem::addWeaponSlot(), orxonox::WorldEntity::attach(), and weaponSystem_.

Referenced by XMLPort().

void orxonox::Pawn::damage | ( | float | damage,
|  | Pawn * | originator = `0` |
| ) |  |  | `[virtual]`

References orxonox::BaseObject::getGametype(), health_, lastHitOriginator_, and setHealth().

Referenced by orxonox::MovableEntity::collidesAgainst(), orxonox::Projectile::collidesAgainst(), hit(), and kill().

void orxonox::Pawn::death | ( |  | ) | `[protected, virtual]`

References bAlive_, dropItems(), orxonox::BaseObject::getGametype(), orxonox::ControllableEntity::getPlayer(), goWithStyle(), orxonox::GameMode::isMaster(), lastHitOriginator_, orxonox::Gametype::pawnKilled(), orxonox::ControllableEntity::setDestroyWhenPlayerLeft(), setHealth(), and orxonox::PlayerInfo::stopControl().

Referenced by kill(), and tick().

void orxonox::Pawn::deatheffect | ( |  | ) | `[protected, virtual]`

References orxonox::BaseObject::getCreator(), orxonox::WorldEntity::getOrientation(), orxonox::WorldEntity::getPosition(), numexplosionchunks_, orxonox::ParticleSpawner::setDestroyAfterLife(), orxonox::ParticleSpawner::setLifetime(), orxonox::StaticEntity::setOrientation(), orxonox::MovableEntity::setPosition(), orxonox::StaticEntity::setPosition(), and orxonox::ParticleEmitter::setSource().

void orxonox::Pawn::doFire | ( | uint8_t | firemode | ) | `[virtual]`

References callMemberNetworkFunction, orxonox::WeaponSystem::fire(), orxonox::Synchronisable::getObjectID(), orxonox::GameMode::isMaster(), and weaponSystem_.

Referenced by fire().

void orxonox::Pawn::dropItems | ( |  | ) | `[virtual]`

Reimplemented from orxonox::ControllableEntity.

References orxonox::PickupCollection::clear(), and getPickups().

Referenced by death().

void orxonox::Pawn::fire | ( | unsigned int | firemode | ) | `[virtual]`

Reimplemented from orxonox::ControllableEntity.

References doFire().

unsigned int orxonox::Pawn::getExplosionChunks | ( |  | ) | const`[inline]`

Referenced by XMLPort().

float orxonox::Pawn::getHealth | ( |  | ) | const`[inline]`

Referenced by orxonox::HealthImmediate::pickedUp(), orxonox::HUDHealthBar::tick(), orxonox::HealthUsable::used(), and XMLPort().

float orxonox::Pawn::getInitialHealth | ( |  | ) | const`[inline]`

Referenced by orxonox::TeamBaseMatch::allowPawnDeath(), orxonox::HUDHealthBar::tick(), and XMLPort().

ControllableEntity* orxonox::Pawn::getLastHitOriginator | ( |  | ) | const`[inline]`

float orxonox::Pawn::getMaxHealth | ( |  | ) | const`[inline]`

Referenced by orxonox::HealthImmediate::pickedUp(), orxonox::HealthUsable::used(), and XMLPort().

PickupCollection& orxonox::Pawn::getPickups | ( |  | ) | `[inline]`

Referenced by orxonox::BaseItem::addTo(), orxonox::Projectile::collidesAgainst(), dropItems(), orxonox::ModifierPickup::dropped(), orxonox::PickupInventory::getCurrentUsableIndex(), orxonox::PickupInventory::getEquipmentCount(), orxonox::PickupInventory::getEquipmentItem(), orxonox::PickupInventory::getPassiveCount(), orxonox::PickupInventory::getPassiveItem(), orxonox::PickupInventory::getUsableCount(), orxonox::PickupInventory::getUsableItem(), orxonox::PickupInventory::isCurrentUsable(), Pawn(), orxonox::ModifierPickup::pickedUp(), orxonox::BaseItem::removeFrom(), orxonox::PickupInventory::selectUsable(), orxonox::Engine::tick(), orxonox::PickupInventory::updateEquipment(), and orxonox::PickupInventory::updateUsable().

float orxonox::Pawn::getSpawnParticleDuration | ( |  | ) | const`[inline]`

Referenced by XMLPort().

const std::string& orxonox::Pawn::getSpawnParticleSource | ( |  | ) | const`[inline]`

Referenced by XMLPort().

WeaponPack * orxonox::Pawn::getWeaponPack | ( | unsigned int | index | ) | const

References orxonox::WeaponSystem::getWeaponPack(), and weaponSystem_.

Referenced by XMLPort().

WeaponSet * orxonox::Pawn::getWeaponSet | ( | unsigned int | index | ) | const

References orxonox::WeaponSystem::getWeaponSet(), and weaponSystem_.

Referenced by XMLPort().

WeaponSlot * orxonox::Pawn::getWeaponSlot | ( | unsigned int | index | ) | const

References orxonox::WeaponSystem::getWeaponSlot(), and weaponSystem_.

Referenced by XMLPort().

const WorldEntity* orxonox::Pawn::getWorldEntity | ( |  | ) | const`[inline, virtual]`

Implements orxonox::RadarViewable.

void orxonox::Pawn::goWithStyle | ( |  | ) | `[protected, virtual]`

References bAlive_, orxonox::BaseObject::getCreator(), orxonox::WorldEntity::getPosition(), orxonox::ControllableEntity::setDestroyWhenPlayerLeft(), and orxonox::MovableEntity::setPosition().

Referenced by death().

void orxonox::Pawn::hit | ( | Pawn * | originator,
|  | const Vector3 & | force,
|  | float | damage |
| ) |  |  | `[virtual]`

References damage(), orxonox::BaseObject::getGametype(), orxonox::MobileEntity::getVelocity(), and orxonox::ControllableEntity::setVelocity().

bool orxonox::Pawn::isAlive | ( |  | ) | const`[inline]`

void orxonox::Pawn::kill | ( |  | ) | `[virtual]`

References damage(), death(), and health_.

Referenced by orxonox::HumanController::suicide().

void orxonox::Pawn::postSpawn | ( |  | ) | `[virtual]`

References initialHealth_, orxonox::GameMode::isMaster(), setHealth(), and spawneffect().

Referenced by orxonox::SpawnPoint::spawn().

void orxonox::Pawn::registerVariables | ( |  | ) |

Reimplemented from orxonox::ControllableEntity.

Reimplemented in orxonox::SpaceShip.

References bAlive_, bReload_, health_, initialHealth_, orxonox::Synchronisable::registerVariable(), orxonox::VariableDirection::ToClient, and orxonox::VariableDirection::ToServer.

Referenced by Pawn().

void orxonox::Pawn::reload | ( |  | ) | `[virtual]`

Reimplemented from orxonox::ControllableEntity.

References bReload_.

void orxonox::Pawn::removeHealth | ( | float | health | ) | `[inline]`

void orxonox::Pawn::removePlayer | ( |  | ) | `[protected, virtual]`

Reimplemented from orxonox::ControllableEntity.

References orxonox::BaseObject::getGametype(), orxonox::ControllableEntity::getPlayer(), orxonox::Gametype::playerStopsControllingPawn(), and orxonox::ControllableEntity::removePlayer().

void orxonox::Pawn::setExplosionChunks | ( | unsigned int | chunks | ) | `[inline]`

Referenced by XMLPort().

void orxonox::Pawn::setHealth | ( | float | health | ) | `[virtual]`

References health_, and maxHealth_.

Referenced by orxonox::TeamBaseMatch::allowPawnDeath(), damage(), death(), postSpawn(), and XMLPort().

void orxonox::Pawn::setInitialHealth | ( | float | initialhealth | ) | `[inline]`

Referenced by XMLPort().

void orxonox::Pawn::setMaxHealth | ( | float | maxhealth | ) | `[inline]`

Referenced by XMLPort().

void orxonox::Pawn::setPlayer | ( | PlayerInfo * | player | ) | `[protected, virtual]`

Reimplemented from orxonox::ControllableEntity.

References orxonox::BaseObject::getGametype(), orxonox::Gametype::playerStartsControllingPawn(), and orxonox::ControllableEntity::setPlayer().

void orxonox::Pawn::setSpawnParticleDuration | ( | float | duration | ) | `[inline]`

Referenced by XMLPort().

void orxonox::Pawn::setSpawnParticleSource | ( | const std::string & | source | ) | `[inline]`

Referenced by XMLPort().

void orxonox::Pawn::setWeaponSystem | ( | WeaponSystem * | weaponsystem | ) | `[inline, private]`

Referenced by orxonox::WeaponSystem::~WeaponSystem().

void orxonox::Pawn::spawneffect | ( |  | ) | `[protected, virtual]`

References orxonox::BaseObject::getCreator(), orxonox::WorldEntity::getOrientation(), orxonox::WorldEntity::getPosition(), orxonox::ParticleSpawner::setDestroyAfterLife(), orxonox::ParticleSpawner::setLifetime(), orxonox::StaticEntity::setOrientation(), orxonox::StaticEntity::setPosition(), orxonox::ParticleEmitter::setSource(), spawnparticleduration_, and spawnparticlesource_.

Referenced by postSpawn().

void orxonox::Pawn::startLocalHumanControl | ( |  | ) | `[virtual]`

Reimplemented from orxonox::ControllableEntity.

References orxonox::RadarViewable::isHumanShip_, and orxonox::ControllableEntity::startLocalHumanControl().

void orxonox::Pawn::tick | ( | float | dt | ) | `[virtual]`

Gets called every frame.

Parameters:

  | dt | The time since the last frame in seconds

Reimplemented from orxonox::ControllableEntity.

Reimplemented in orxonox::SpaceShip.

References bAlive_, bReload_, death(), health_, orxonox::GameMode::isMaster(), and SUPER.

virtual void orxonox::Pawn::useItem | ( |  | ) | `[inline, virtual]`

Reimplemented from orxonox::ControllableEntity.

void orxonox::Pawn::XMLPort | ( | Element & | xmlelement,
|  | XMLPort::Mode | mode |
| ) |  |  | `[virtual]`

XML loading and saving.

Parameters:

  | xmlelement | The XML-element
  | loading | Loading (true) or saving (false)

Returns:
  The XML-element

Reimplemented from orxonox::ControllableEntity.

Reimplemented in orxonox::SpaceShip.

References addWeaponPack(), addWeaponSet(), addWeaponSlot(), getExplosionChunks(), getHealth(), getInitialHealth(), getMaxHealth(), getSpawnParticleDuration(), getSpawnParticleSource(), getWeaponPack(), getWeaponSet(), getWeaponSlot(), setExplosionChunks(), setHealth(), setInitialHealth(), setMaxHealth(), setSpawnParticleDuration(), setSpawnParticleSource(), SUPER, XMLPortObject, and XMLPortParam.

## Friends And Related Function Documentation

friend class WeaponSystem`[friend]`

Referenced by Pawn().

## Member Data Documentation

bool orxonox::Pawn::bAlive_`[protected]`

Referenced by death(), goWithStyle(), Pawn(), registerVariables(), and tick().

bool orxonox::Pawn::bReload_`[protected]`

Referenced by Pawn(), registerVariables(), reload(), and tick().

float orxonox::Pawn::health_`[protected]`

Referenced by damage(), kill(), Pawn(), registerVariables(), setHealth(), and tick().

float orxonox::Pawn::initialHealth_`[protected]`

Referenced by Pawn(), postSpawn(), and registerVariables().

Pawn* orxonox::Pawn::lastHitOriginator_`[protected]`

Referenced by damage(), death(), and Pawn().

float orxonox::Pawn::maxHealth_`[protected]`

Referenced by Pawn(), and setHealth().

unsigned int orxonox::Pawn::numexplosionchunks_`[protected]`

Referenced by deatheffect().

PickupCollection orxonox::Pawn::pickups_`[protected]`

float orxonox::Pawn::spawnparticleduration_`[protected]`

Referenced by Pawn(), and spawneffect().

std::string orxonox::Pawn::spawnparticlesource_`[protected]`

Referenced by spawneffect().

WeaponSystem* orxonox::Pawn::weaponSystem_`[protected]`

Referenced by addWeaponPack(), addWeaponSet(), addWeaponSlot(), doFire(), getWeaponPack(), getWeaponSet(), getWeaponSlot(), Pawn(), and ~Pawn().

The documentation for this class was generated from the following files:

- src/orxonox/objects/worldentities/pawns/Pawn.h
- src/orxonox/objects/worldentities/pawns/Pawn.cc