Nuclide
Software Development Kit for id Technology
func_tank Class Reference

About this class

Server-Entity: Mountable Gun Turret.

QUAKED func_tank (0 .5 .8) ? FNCTANK_ACTIVE x x x FNCTANK_DIRECTONLY FNCTANK_CONTROLLABLE

OVERVIEW

A mountable tank gun turret type entity. A player (or NPC) can interact with it and shoot it. It's in the same family as the func_tankmortar entity, the difference being that this shoots bullets and not mortar blasts.

KEYS

  • "targetname" : Name
  • "yawrate" : The speed of the left/right movement of the gun.
  • "yawrange" : Range of left/right movement in degrees.
  • "pitchrate" : The speed of the up/down movement of the gun.
  • "pitchrange" : Range of up/down movement in degrees.
  • "barrel" : Distance from origin to barrel tip in units.
  • "barrely" : Horizontal distance origin to the center of the barrel tip.
  • "barrelz" : Vertical distance origin to the center of the barrel tip.
  • "firerate" : Number of bullets fired per second.
  • "bullet_damage" : Damage each fired bullet does.
  • "firespread" : Accuracy of the gun. 0 is best, 4 is worst.
  • "persistance" : Time in seconds for how long an NPC might continue shooting.
  • "minRange" : Minimum range the target can be at for an NPC to fire.
  • "maxRange" : Maximum range the target can be at for an NPC to fire.
  • "spritesmoke" : Sprite to spawn for 'smoke' when the entity is fired.
  • "spriteflash" : Sprite to spawn for a 'muzzleflash' when the entity is fired.
  • "spritescale" : Scale multiplier for both smoke and flash sprites.
  • "rotatesound" : Sound file to play in a loop while barrel is rotating.

SPAWNFLAGS

  • FNCTANK_ACTIVE (1) : TODO: Start active?
  • FNCTANK_DIRECTONLY (16) : TODO: ?
  • FNCTANK_CONTROLLABLE (32) : TODO: Can be interacted with similar to a tankmortar?

NOTES

I don't like the sprite stuff tacked on at all because of the extra networking involved and because it's so awfully GoldSrc specific. Eventually I need to design a more generic routine that allows people to just refer to materials with the appropriate blend-modes instead of hardcoding that some random sprites needs to be treated additive.

TRIVIA

This entity was introduced in Half-Life (1998).

Inheritance diagram for func_tank:
NSVehicle

Public Member Functions

void func_tank (void)
 
virtual void Spawned (void)
 Called when the entity is fulled initialized. More...
 
virtual void Save (float)
 Handles saving a copy of this entity to a given filehandle. More...
 
virtual void Restore (string, string)
 Similar to NSIO::SpawnKey but for save-game fields. More...
 
virtual void customphysics (void)
 
virtual void PlayerInput (void)
 
virtual void Respawn (void)
 Server: Called when the entity first spawns or when game-logic requests the entity to return to its original spawn state. More...
 
virtual void SpawnKey (string, string)
 This method handles entity key/value pairs on map load. More...
 
nonvirtual void SpriteSmoke (vector)
 
nonvirtual void SpriteFlash (vector)
 

Constructor & Destructor Documentation

◆ func_tank()

void func_tank::func_tank ( void  )

Member Function Documentation

◆ customphysics()

void func_tank::customphysics ( void  )
virtual

◆ PlayerInput()

void func_tank::PlayerInput ( void  )
virtual

Reimplemented from NSVehicle.

◆ Respawn()

void func_tank::Respawn ( void  )
virtual

Server: Called when the entity first spawns or when game-logic requests the entity to return to its original spawn state.

Reimplemented from NSSurfacePropEntity.

◆ Restore()

void func_tank::Restore ( string  strKey,
string  strValue 
)
virtual

Similar to NSIO::SpawnKey but for save-game fields.

Whatever you write into file handles within your NSIO::Save() method needs to be read back in here.

Reimplemented from NSVehicle.

◆ Save()

void func_tank::Save ( float  handle)
virtual

Handles saving a copy of this entity to a given filehandle.

Within you want to use the NSIO::SaveFloat() etc. methods to write the internal member attributes to the specified file handle.

Reimplemented from NSVehicle.

◆ Spawned()

void func_tank::Spawned ( void  )
virtual

Called when the entity is fulled initialized.

Any spawn key/value info pairs have already been dealt with. So now we can make full decisions on the entity. Always make sure to call super::Spawned(); inside your method when overriding.

Reimplemented from NSSurfacePropEntity.

◆ SpawnKey()

void func_tank::SpawnKey ( string  strKey,
string  strValue 
)
virtual

This method handles entity key/value pairs on map load.

You can easily convert the strValue parameter using the ReadFloat etc. methods that are part of NSIO.

Reimplemented from NSSurfacePropEntity.

◆ SpriteFlash()

void func_tank::SpriteFlash ( vector  org)

◆ SpriteSmoke()

void func_tank::SpriteSmoke ( vector  org)

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