2023-05-08 18:17:03 +00:00
|
|
|
/*
|
2024-06-22 07:24:13 +00:00
|
|
|
* Copyright (c) 2023-2024 Vera Visions LLC.
|
2023-05-08 18:17:03 +00:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2024-06-22 07:24:13 +00:00
|
|
|
typedef enumflags
|
|
|
|
{
|
|
|
|
ITEMFL_CHANGED_MODELINDEX,
|
|
|
|
ITEMFL_CHANGED_ORIGIN_X,
|
|
|
|
ITEMFL_CHANGED_ORIGIN_Y,
|
|
|
|
ITEMFL_CHANGED_ORIGIN_Z,
|
|
|
|
ITEMFL_CHANGED_ANGLES_X,
|
|
|
|
ITEMFL_CHANGED_ANGLES_Y,
|
|
|
|
ITEMFL_CHANGED_ANGLES_Z,
|
2024-09-17 19:46:31 +00:00
|
|
|
ITEMFL_CHANGED_VELOCITY,
|
2024-06-22 07:24:13 +00:00
|
|
|
ITEMFL_CHANGED_ANGULARVELOCITY,
|
2024-09-17 19:46:31 +00:00
|
|
|
ITEMFL_CHANGED_RENDERPROPS,
|
2024-06-22 07:24:13 +00:00
|
|
|
ITEMFL_CHANGED_SIZE,
|
|
|
|
ITEMFL_CHANGED_FLAGS,
|
|
|
|
ITEMFL_CHANGED_SOLID,
|
|
|
|
ITEMFL_CHANGED_FRAME,
|
|
|
|
ITEMFL_CHANGED_SKIN,
|
|
|
|
ITEMFL_CHANGED_MOVETYPE,
|
|
|
|
ITEMFL_CHANGED_EFFECTS,
|
|
|
|
ITEMFL_CHANGED_SCALE,
|
|
|
|
ITEMFL_CHANGED_ENTITYDEF,
|
|
|
|
ITEMFL_CHANGED_CHAIN,
|
|
|
|
} nsitem_changed_t;
|
2024-04-22 22:11:12 +00:00
|
|
|
|
2024-06-22 07:24:13 +00:00
|
|
|
/*! \brief This entity class represents inventory items, weapons. */
|
|
|
|
/*!QUAKED NSItem (0 0.8 0.8) (-16 -16 0) (16 16 72)
|
2024-04-22 22:11:12 +00:00
|
|
|
# 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.
|
2024-06-22 07:24:13 +00:00
|
|
|
- "model_world" : same as model.
|
|
|
|
- "model_player" : (Optional) when equipped, will use this model.
|
2024-04-22 22:11:12 +00:00
|
|
|
- "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.
|
2024-06-22 07:24:13 +00:00
|
|
|
- "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.
|
|
|
|
|
|
|
|
|
|
|
|
@ingroup baseclass
|
2024-04-22 22:11:12 +00:00
|
|
|
*/
|
2024-09-17 19:46:31 +00:00
|
|
|
class NSItem:NSPhysicsEntity
|
2023-05-08 18:17:03 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
void NSItem(void);
|
|
|
|
|
|
|
|
/* overrides */
|
2024-04-22 22:11:12 +00:00
|
|
|
#ifdef SERVER
|
2023-05-08 18:17:03 +00:00
|
|
|
virtual void Spawned(void);
|
|
|
|
virtual void Touch(entity);
|
|
|
|
virtual void Respawn(void);
|
|
|
|
virtual void SpawnKey(string, string);
|
2023-07-08 06:34:58 +00:00
|
|
|
virtual void Save(float);
|
|
|
|
virtual void Restore(string,string);
|
2024-06-22 07:24:13 +00:00
|
|
|
virtual void EvaluateEntity(void);
|
|
|
|
virtual float SendEntity(entity,float);
|
2023-05-08 18:17:03 +00:00
|
|
|
|
2024-06-22 07:24:13 +00:00
|
|
|
/* item related accessors */
|
2023-05-27 18:58:34 +00:00
|
|
|
nonvirtual void SetFloating(int);
|
|
|
|
nonvirtual bool GetFloating(void);
|
|
|
|
nonvirtual void SetSpinning(bool);
|
|
|
|
nonvirtual bool GetSpinning(void);
|
|
|
|
nonvirtual void PickupRespawn(void);
|
2024-06-22 07:24:13 +00:00
|
|
|
|
|
|
|
/* only if the entity is usable in the inventory. */
|
|
|
|
virtual void OnInventoryUse(void);
|
|
|
|
|
|
|
|
/** Overridable: Called when this item is picked up. */
|
|
|
|
virtual void OnPickup(void);
|
|
|
|
|
|
|
|
virtual void PrintDebugInfo(void);
|
|
|
|
/** Call to turn a weapon into a pickup. */
|
|
|
|
nonvirtual void BecomePickup(void);
|
2024-04-22 22:11:12 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-22 07:24:13 +00:00
|
|
|
/** Called when an item was added to someones inventory. */
|
|
|
|
virtual void AddedToInventory(void);
|
|
|
|
/** Called when an item was removed from someones inventory. */
|
|
|
|
virtual void RemovedFromInventory(void);
|
|
|
|
|
|
|
|
#ifdef CLIENT
|
|
|
|
virtual void ReceiveEntity(float,float);
|
|
|
|
virtual void ReceiveEvent(float);
|
|
|
|
virtual void PredictPreFrame(void);
|
|
|
|
virtual void PredictPostFrame(void);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
virtual bool IsWeapon(void);
|
2024-09-02 06:57:51 +00:00
|
|
|
virtual bool InInventory(void);
|
2023-05-08 18:17:03 +00:00
|
|
|
|
|
|
|
private:
|
2024-06-22 07:24:13 +00:00
|
|
|
/** Called to signal that the owner added this weapon to their inventory. */
|
2024-08-14 23:10:57 +00:00
|
|
|
virtual void _AddedCallback(void);
|
2024-06-22 07:24:13 +00:00
|
|
|
/** Called to signal that the owner removed this weapon from their inventory. */
|
2024-08-14 23:10:57 +00:00
|
|
|
virtual void _RemovedCallback(void);
|
2024-06-22 07:24:13 +00:00
|
|
|
|
2023-05-08 18:17:03 +00:00
|
|
|
int m_iClip;
|
|
|
|
int m_iWasDropped;
|
|
|
|
|
2024-06-22 07:24:13 +00:00
|
|
|
/* item related spawn keys */
|
2023-05-08 18:17:03 +00:00
|
|
|
int m_iInvItem;
|
|
|
|
string m_sndAcquire;
|
|
|
|
string m_sndRespawn;
|
2024-06-22 07:24:13 +00:00
|
|
|
string m_sndHum;
|
2023-05-08 18:17:03 +00:00
|
|
|
int m_bFloating;
|
|
|
|
bool m_bSpins;
|
2024-06-22 07:24:13 +00:00
|
|
|
string m_strInvName;
|
2024-04-22 22:11:12 +00:00
|
|
|
string m_strInvWeapon;
|
2024-06-22 07:24:13 +00:00
|
|
|
|
|
|
|
int m_iGiveHealth;
|
|
|
|
int m_iGiveArmor;
|
|
|
|
bool m_bNoTouch;
|
|
|
|
bool m_bInvCarry;
|
|
|
|
string m_strRequires;
|
|
|
|
|
|
|
|
int m_GiveAmmo[MAX_AMMO_TYPES];
|
|
|
|
|
|
|
|
#ifdef CLIENT
|
|
|
|
NETWORKED_FLOAT(chain_entnum)
|
|
|
|
NETWORKED_FLOAT(owner_entnum)
|
|
|
|
#endif
|
|
|
|
|
2024-09-02 06:57:51 +00:00
|
|
|
NSItem m_nextItem;
|
|
|
|
NSItem m_nextItem_net;
|
2024-06-22 07:24:13 +00:00
|
|
|
entity owner_net;
|
|
|
|
};
|