Nuclide
Software Development Kit for id Technology
NSItem Class Reference

About this class

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.
Inheritance diagram for NSItem:
NSPhysicsEntity NSWeapon

Public Member Functions

void NSItem (void)
 
virtual void Spawned (void)
 Called when the entity is fulled initialized. More...
 
virtual bool ItemPickupCheck (entity)
 
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 Input (entity, string, string)
 Called when we are being prompted by another object/function with an input message. 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 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 OnUse (entity)
 Overridable: Called when this item is used. 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)
 
virtual bool InInventory (void)
 

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 NSPhysicsEntity.

Reimplemented in NSWeapon.

◆ GetFloating()

bool NSItem::GetFloating ( void  )

◆ GetSpinning()

bool NSItem::GetSpinning ( void  )

◆ InInventory()

bool NSItem::InInventory ( void  )
virtual

◆ Input()

void NSItem::Input ( entity  eAct,
string  strInput,
string  strData 
)
virtual

Called when we are being prompted by another object/function with an input message.

Reimplemented from NSSurfacePropEntity.

◆ IsWeapon()

bool NSItem::IsWeapon ( void  )
virtual

Reimplemented in NSWeapon.

◆ ItemPickupCheck()

bool NSItem::ItemPickupCheck ( entity  pickerUpper)
virtual

◆ OnInventoryUse()

void NSItem::OnInventoryUse ( void  )
virtual

◆ OnPickup()

void NSItem::OnPickup ( void  )
virtual

Overridable: Called when this item is picked up.

◆ OnUse()

void NSItem::OnUse ( entity  user)
virtual

Overridable: Called when this item is used.

◆ 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 NSPhysicsEntity.

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 NSPhysicsEntity.

◆ 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 NSPhysicsEntity.

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 NSPhysicsEntity.

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 NSPhysicsEntity.

Reimplemented in NSWeapon.

◆ SetFloating()

void NSItem::SetFloating ( 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 NSPhysicsEntity.

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 NSPhysicsEntity.

Reimplemented in NSWeapon.

◆ Touch()

void NSItem::Touch ( entity  eToucher)
virtual

Called whenever we're touching another entity.

Reimplemented from NSPhysicsEntity.


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