Main Page Modules Namespaces C++ Classes Compound List File List Index
TNL: Zap::Ship Class Reference

# Zap::Ship Class Reference

`#include <ship.h>`

Inheritance diagram for Zap::Ship:

## Public Types

enum | { MaxVelocity = 450, Acceleration = 2500, BoostMaxVelocity = 700, BoostAcceleration = 5000,
RepairRadius = 65,
RepairDisplayRadius = 18,
CollisionRadius = 24,
VisibilityRadius = 30,
KillDeleteDelay = 1500,
ExplosionFadeTime = 300,
MaxControlObjectInterpDistance = 200,
TrailCount = 2,
EnergyMax = 100000,
EnergyRechargeRate = 6000,
EnergyBoostDrain = 15000,
EnergyShieldDrain = 27000,
EnergyRepairDrain = 15000,
EnergySensorDrain = 8000,
EnergyCloakDrain = 8000,
EnergyEngineerCost = 75000,
EnergyShieldHitDrain = 20000,
EnergyCooldownThreshold = 15000,
WeaponFireDecloakTime = 350,
ShipModuleCount = 2,
ShipWeaponCount = 3,
SensorZoomTime = 300,
CloakFadeTime = 300,
CloakCheckRadius = 200,
RepairHundredthsPerSecond = 16,
MaxEngineerDistance = 100,
WarpFadeInTime = 500
}
enum | MaskBits { InitialMask = BIT(0), PositionMask = BIT(1), MoveMask = BIT(2), WarpPositionMask = BIT(3),
ExplosionMask = BIT(4),
HealthMask = BIT(5),
PowersMask = BIT(6),
LoadoutMask = BIT(7)
}

## Public Member Functions

void | selectWeapon ()
void | selectWeapon (U32 weaponIndex)
void | render ()
| Ship (StringTableEntry playerName="", S32 team=-1, Point p=Point(0, 0), F32 m=1.0)
F32 | getHealth ()
void | onGhostRemove ()
| onGhostRemove is called on the client side before the destructor when ghost has gone out of scope and is about to be deleted from the client.
bool | isShieldActive ()
bool | isBoostActive ()
bool | isCloakActive ()
bool | isSensorActive ()
bool | isRepairActive ()
bool | isEngineerActive ()
bool | engineerBuildObject ()
bool | hasEngineeringModule ()
bool | isDestroyed ()
bool | areItemsMounted ()
bool | carryingResource ()
Item * | unmountResource ()
F32 | getSensorZoomFraction ()
Point | getAimVector ()
void | setLoadout (U32 module1, U32 module2, U32 weapon1, U32 weapon2, U32 weapon3)
void | idle (IdleCallPath path)
void | processMove (U32 stateIndex)
void | processWeaponFire ()
void | processEnergy ()
void | updateModuleSounds ()
void | emitMovementSparks ()
bool | findRepairTargets ()
void | repairTargets ()
void | controlMoveReplayComplete ()
void | emitShipExplosion (Point pos)
void | setActualPos (Point p)
virtual void | damageObject (DamageInfo *theInfo)
void | kill (DamageInfo *theInfo)
void | kill ()
void | writeControlState (BitStream *stream)
void | readControlState (BitStream *stream)
U32 | packUpdate (GhostConnection *connection, U32 updateMask, BitStream *stream)
| Write the object's state to a packet.
void | unpackUpdate (GhostConnection *connection, BitStream *stream)
| Unpack data written by packUpdate().
void | processArguments (S32 argc, const char **argv)
| TNL_DECLARE_CLASS (Ship)

## Data Fields

Timer | mFireTimer
Timer | mWarpInTimer
F32 | mHealth
S32 | mEnergy
StringTableEntry | mPlayerName
bool | mCooldown
U32 | mSensorStartTime
U32 | mModule [ShipModuleCount]
bool | mModuleActive [ModuleCount]
SFXHandle | mModuleSound [ModuleCount]
U32 | mWeapon [ShipWeaponCount]
U32 | mActiveWeapon
Timer | mSensorZoomTimer
Timer | mWeaponFireDecloakTimer
Timer | mCloakTimer
U32 | mSparkElapsed
S32 | mLastTrailPoint [TrailCount]
FXTrail | mTrail [TrailCount]
F32 | mass
bool | hasExploded
Vector< SafePtr< Item > > | mMountedItems
Vector< SafePtr< GameObject > > | mRepairTargets

## Private Types

typedef MoveObject | Parent

## Member Typedef Documentation

typedef MoveObject Zap::Ship::Parent`[private]`

Reimplemented from Zap::GameObject.

## Member Enumeration Documentation

anonymous enum

Enumerator:

  MaxVelocity |
  Acceleration |
  BoostMaxVelocity |
  BoostAcceleration |
  RepairRadius |
  RepairDisplayRadius |
  CollisionRadius |
  VisibilityRadius |
  KillDeleteDelay |
  ExplosionFadeTime |
  MaxControlObjectInterpDistance |
  TrailCount |
  EnergyMax |
  EnergyRechargeRate |
  EnergyBoostDrain |
  EnergyShieldDrain |
  EnergyRepairDrain |
  EnergySensorDrain |
  EnergyCloakDrain |
  EnergyEngineerCost |
  EnergyShieldHitDrain |
  EnergyCooldownThreshold |
  WeaponFireDecloakTime |
  ShipModuleCount |
  ShipWeaponCount |
  SensorZoomTime |
  CloakFadeTime |
  CloakCheckRadius |
  RepairHundredthsPerSecond |
  MaxEngineerDistance |
  WarpFadeInTime |

enum Zap::Ship::MaskBits

Enumerator:

  InitialMask |
  PositionMask |
  MoveMask |
  WarpPositionMask |
  ExplosionMask |
  HealthMask |
  PowersMask |
  LoadoutMask |

## Constructor & Destructor Documentation

Zap::Ship::Ship | ( | StringTableEntry | playerName = `""`,
|  | S32 | team = `-1`,
|  | Point | p = `Point(0, 0)`,
|  | F32 | m = `1.0` |
| ) |  |  |

## Member Function Documentation

void Zap::Ship::selectWeapon | ( |  | ) |

void Zap::Ship::selectWeapon | ( | U32 | weaponIndex | ) |

void Zap::Ship::render | ( |  | ) | `[virtual]`

Reimplemented from Zap::GameObject.

F32 Zap::Ship::getHealth | ( |  | ) | `[inline, virtual]`

Reimplemented from Zap::GameObject.

void Zap::Ship::onGhostRemove | ( |  | ) | `[virtual]`

onGhostRemove is called on the client side before the destructor when ghost has gone out of scope and is about to be deleted from the client.

Reimplemented from TNL::NetObject.

bool Zap::Ship::isShieldActive | ( |  | ) | `[inline]`

bool Zap::Ship::isBoostActive | ( |  | ) | `[inline]`

bool Zap::Ship::isCloakActive | ( |  | ) | `[inline]`

bool Zap::Ship::isSensorActive | ( |  | ) | `[inline]`

bool Zap::Ship::isRepairActive | ( |  | ) | `[inline]`

bool Zap::Ship::isEngineerActive | ( |  | ) | `[inline]`

bool Zap::Ship::engineerBuildObject | ( |  | ) | `[inline]`

bool Zap::Ship::hasEngineeringModule | ( |  | ) | `[inline]`

bool Zap::Ship::isDestroyed | ( |  | ) | `[inline, virtual]`

Reimplemented from Zap::GameObject.

bool Zap::Ship::areItemsMounted | ( |  | ) | `[inline]`

bool Zap::Ship::carryingResource | ( |  | ) |

Item* Zap::Ship::unmountResource | ( |  | ) |

F32 Zap::Ship::getSensorZoomFraction | ( |  | ) | `[inline]`

Point Zap::Ship::getAimVector | ( |  | ) |

void Zap::Ship::setLoadout | ( | U32 | module1,
|  | U32 | module2,
|  | U32 | weapon1,
|  | U32 | weapon2,
|  | U32 | weapon3 |
| ) |  |  |

void Zap::Ship::idle | ( | IdleCallPath | path | ) | `[virtual]`

Reimplemented from Zap::GameObject.

void Zap::Ship::processMove | ( | U32 | stateIndex | ) |

void Zap::Ship::processWeaponFire | ( |  | ) |

void Zap::Ship::processEnergy | ( |  | ) |

void Zap::Ship::updateModuleSounds | ( |  | ) |

void Zap::Ship::emitMovementSparks | ( |  | ) |

bool Zap::Ship::findRepairTargets | ( |  | ) |

void Zap::Ship::repairTargets | ( |  | ) |

void Zap::Ship::controlMoveReplayComplete | ( |  | ) | `[virtual]`

Reimplemented from Zap::GameObject.

void Zap::Ship::emitShipExplosion | ( | Point | pos | ) |

void Zap::Ship::setActualPos | ( | Point | p | ) | `[virtual]`

Reimplemented from Zap::GameObject.

virtual void Zap::Ship::damageObject | ( | DamageInfo * | theInfo | ) | `[virtual]`

Reimplemented from Zap::GameObject.

void Zap::Ship::kill | ( | DamageInfo * | theInfo | ) |

void Zap::Ship::kill | ( |  | ) |

void Zap::Ship::writeControlState | ( | BitStream * | stream | ) | `[virtual]`

Reimplemented from Zap::GameObject.

void Zap::Ship::readControlState | ( | BitStream * | stream | ) | `[virtual]`

Reimplemented from Zap::GameObject.

U32 Zap::Ship::packUpdate | ( | GhostConnection * | connection,
|  | U32 | updateMask,
|  | BitStream * | stream |
| ) |  |  | `[virtual]`

Write the object's state to a packet.

packUpdate is called on an object when it is to be written into a packet stream for transmission to the client. The updateMask parameter contains the out-of-date state mask for the object. The initial update mask for any object to a client will always be 0xFFFFFFFF, signifying that all states are out of date. It is often useful to check for this mask, to write one-time initialization information for that object.

Reimplemented from TNL::NetObject.

void Zap::Ship::unpackUpdate | ( | GhostConnection * | connection,
|  | BitStream * | stream |
| ) |  |  | `[virtual]`

Unpack data written by packUpdate().

unpackUpdate is called on the client to read an update out of a packet's bit stream. Because the update mask is not encoded by the network system directly, each unpack update function will have to determine from the bit stream which states are being updated.

Reimplemented from TNL::NetObject.

void Zap::Ship::processArguments | ( | S32 | argc,
|  | const char ** | argv |
| ) |  |  | `[virtual]`

Reimplemented from Zap::GameObject.

Zap::Ship::TNL_DECLARE_CLASS | ( | Ship |  | ) |

## Field Documentation

Timer Zap::Ship::mFireTimer

Timer Zap::Ship::mWarpInTimer

F32 Zap::Ship::mHealth

S32 Zap::Ship::mEnergy

StringTableEntry Zap::Ship::mPlayerName

bool Zap::Ship::mCooldown

U32 Zap::Ship::mSensorStartTime

U32 Zap::Ship::mModule[ShipModuleCount]

bool Zap::Ship::mModuleActive[ModuleCount]

SFXHandle Zap::Ship::mModuleSound[ModuleCount]

U32 Zap::Ship::mWeapon[ShipWeaponCount]

U32 Zap::Ship::mActiveWeapon

Timer Zap::Ship::mSensorZoomTimer

Timer Zap::Ship::mWeaponFireDecloakTimer

Timer Zap::Ship::mCloakTimer

U32 Zap::Ship::mSparkElapsed

S32 Zap::Ship::mLastTrailPoint[TrailCount]

FXTrail Zap::Ship::mTrail[TrailCount]

F32 Zap::Ship::mass

bool Zap::Ship::hasExploded

Vector<SafePtr<Item> > Zap::Ship::mMountedItems

Vector<SafePtr<GameObject> > Zap::Ship::mRepairTargets