Nuclide
Software Development Kit for id Tech
NSItem Class Reference

This entity class represents inventory items, weapons. More...

#include <NSItem.h>

Inheritance diagram for NSItem:
NSRenderableEntity NSWeapon

Public Member Functions

void NSItem (void)
 
virtual void Spawned (void)
 Called when the entity is fulled initialized. More...
 
virtual void Touch (entity)
 Called whenever we're touching another entity. More...
 
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...
 
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 EvaluateEntity (void)
 Run each tic after physics are run to determine if we need to send updates over the network. More...
 
virtual float SendEntity (entity, float)
 Called by the engine whenever we need to send a client an update about this entity. More...
 
nonvirtual void SetItem (int i)
 
nonvirtual int GetItem (void)
 
nonvirtual void SetFloating (int)
 
nonvirtual bool GetFloating (void)
 
nonvirtual void SetSpinning (bool)
 
nonvirtual bool GetSpinning (void)
 
nonvirtual void PickupRespawn (void)
 
virtual void OnInventoryUse (void)
 
virtual void OnPickup (void)
 Overridable: Called when this item is picked up. More...
 
virtual void PrintDebugInfo (void)
 
nonvirtual void BecomePickup (void)
 Call to turn a weapon into a pickup. More...
 
virtual void AddedToInventory (void)
 Called when an item was added to someones inventory. More...
 
virtual void RemovedFromInventory (void)
 Called when an item was removed from someones inventory. More...
 
virtual void ReceiveEntity (float, float)
 Client: Handles network updates from the server for the associated entity. More...
 
virtual void ReceiveEvent (float)
 
virtual void PredictPreFrame (void)
 
virtual void PredictPostFrame (void)
 
virtual bool IsWeapon (void)
 

Detailed Description

This entity class represents inventory items, weapons.

QUAKED NSItem (0 0.8 0.8) (-16 -16 0) (16 16 72)

OVERVIEW

Represents any item within the players' inventory. These can be used, or be dormant.

KEYS

  • "targetname" : Name
  • "model" : world model.
  • "model_view" : view model.
  • "model_world" : same as model.
  • "model_player" : (Optional) when equipped, will use this model.
  • "inv_name" : Fancy title. Can be a localized string.
  • "inv_weapon" : name of the weapon to give on pickup. can be the same as this entitydef.
  • "inv_item" : item number. must be unique.
  • "inv_health" : How much health points to give on pick-up.
  • "inv_armor" : How much armor points to give on pick-up.
  • "no_touch" : If 1, will have to be triggered to be given to the activator.
  • "inv_carry" : If 1, will not use the item instantly.
  • "inv_icon" : Material for HUD graphics.
  • "requires" : Name of the item that has to be present in the players inventory in order to be picked up.

Constructor & Destructor Documentation

◆ NSItem()

void NSItem::NSItem ( void  )

Member Function Documentation

◆ AddedToInventory()

void NSItem::AddedToInventory ( void  )
virtual

Called when an item was added to someones inventory.

Reimplemented in NSWeapon.

◆ BecomePickup()

void NSItem::BecomePickup ( void  )

Call to turn a weapon into a pickup.

◆ EvaluateEntity()

void NSItem::EvaluateEntity ( void  )
virtual

Run each tic after physics are run to determine if we need to send updates over the network.

Reimplemented from NSRenderableEntity.

Reimplemented in NSWeapon.

◆ GetFloating()

bool NSItem::GetFloating ( void  )

◆ GetItem()

int NSItem::GetItem ( void  )

◆ GetSpinning()

bool NSItem::GetSpinning ( void  )

◆ IsWeapon()

bool NSItem::IsWeapon ( void  )
virtual

Reimplemented in NSWeapon.

◆ OnInventoryUse()

void NSItem::OnInventoryUse ( void  )
virtual

◆ OnPickup()

void NSItem::OnPickup ( void  )
virtual

Overridable: Called when this item is picked up.

◆ PickupRespawn()

void NSItem::PickupRespawn ( void  )

◆ PredictPostFrame()

void NSItem::PredictPostFrame ( void  )
virtual

Reimplemented in NSWeapon.

◆ PredictPreFrame()

void NSItem::PredictPreFrame ( void  )
virtual

Reimplemented in NSWeapon.

◆ PrintDebugInfo()

void NSItem::PrintDebugInfo ( void  )
virtual

◆ ReceiveEntity()

void NSItem::ReceiveEntity ( float  flNew,
float  flChanged 
)
virtual

Client: Handles network updates from the server for the associated entity.

Reimplemented from NSRenderableEntity.

Reimplemented in NSWeapon.

◆ ReceiveEvent()

void NSItem::ReceiveEvent ( float  eventType)
virtual

Reimplemented from NSEntity.

Reimplemented in NSWeapon.

◆ RemovedFromInventory()

void NSItem::RemovedFromInventory ( void  )
virtual

Called when an item was removed from someones inventory.

Reimplemented in NSWeapon.

◆ Respawn()

void NSItem::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 NSRenderableEntity.

◆ Restore()

void NSItem::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 NSRenderableEntity.

Reimplemented in NSWeapon.

◆ Save()

void NSItem::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 NSRenderableEntity.

Reimplemented in NSWeapon.

◆ SendEntity()

float NSItem::SendEntity ( entity  ,
float   
)
virtual

Called by the engine whenever we need to send a client an update about this entity.

Reimplemented from NSRenderableEntity.

Reimplemented in NSWeapon.

◆ SetFloating()

void NSItem::SetFloating ( int  i)

◆ SetItem()

void NSItem::SetItem ( int  i)

◆ SetSpinning()

void NSItem::SetSpinning ( bool  value)

◆ Spawned()

void NSItem::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 NSEntity.

Reimplemented in NSWeapon.

◆ SpawnKey()

void NSItem::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 NSRenderableEntity.

Reimplemented in NSWeapon.

◆ Touch()

void NSItem::Touch ( entity  eToucher)
virtual

Called whenever we're touching another entity.

Reimplemented from NSTrigger.


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