diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/shared/tf/tf_weapon_lunchbox.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/shared/tf/tf_weapon_lunchbox.h')
| -rw-r--r-- | game/shared/tf/tf_weapon_lunchbox.h | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/game/shared/tf/tf_weapon_lunchbox.h b/game/shared/tf/tf_weapon_lunchbox.h new file mode 100644 index 0000000..2a73967 --- /dev/null +++ b/game/shared/tf/tf_weapon_lunchbox.h @@ -0,0 +1,108 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= +#ifndef TF_WEAPON_LUNCHBOX_H +#define TF_WEAPON_LUNCHBOX_H +#ifdef _WIN32 +#pragma once +#endif + +#include "tf_weaponbase.h" + +// Client specific. +#ifdef CLIENT_DLL +#define CTFLunchBox C_TFLunchBox +#define CTFLunchBox_Drink C_TFLunchBox_Drink +#endif + +enum lunchbox_weapontypes_t +{ + LUNCHBOX_STANDARD = 0, // Careful, can be the Scout BONK drink, or the Heavy sandvich. + LUNCHBOX_ADDS_MAXHEALTH, + LUNCHBOX_ADDS_MINICRITS, + LUNCHBOX_STANDARD_ROBO, + LUNCHBOX_STANDARD_FESTIVE, + LUNCHBOX_ADDS_AMMO, +}; + +#define TF_SANDWICH_REGENTIME 30 +#define TF_CHOCOLATE_BAR_REGENTIME 10 + +//============================================================================= +// +// TF Weapon Lunchbox. +// +class CTFLunchBox : public CTFWeaponBase +{ +public: + + DECLARE_CLASS( CTFLunchBox, CTFWeaponBase ); + DECLARE_NETWORKCLASS(); + DECLARE_PREDICTABLE(); + +// Server specific. +#ifdef GAME_DLL + DECLARE_DATADESC(); +#endif + + CTFLunchBox(); + + virtual void UpdateOnRemove( void ); + virtual void Precache(); + virtual int GetWeaponID( void ) const { return TF_WEAPON_LUNCHBOX; } + virtual void PrimaryAttack(); + virtual void SecondaryAttack(); + virtual void WeaponReset( void ); + virtual bool UsesPrimaryAmmo(); + + virtual bool DropAllowed( void ); + int GetLunchboxType( void ) const { int iMode = 0; CALL_ATTRIB_HOOK_INT( iMode, set_weapon_mode ); return iMode; }; + + float GetProgress( void ) { return GetEffectBarProgress(); } + const char* GetEffectLabelText( void ) { return "#TF_SANDWICH"; } + + void DrainAmmo( bool bForceCooldown = false ); + + virtual float InternalGetEffectBarRechargeTime( void ) { return GetLunchboxType() == LUNCHBOX_ADDS_MAXHEALTH ? TF_CHOCOLATE_BAR_REGENTIME : TF_SANDWICH_REGENTIME; } + virtual void Detach( void ) OVERRIDE; + +#ifdef GAME_DLL + void ApplyBiteEffects( CTFPlayer *pPlayer ); +#endif + +private: + CTFLunchBox( const CTFLunchBox & ) {} + + // Prevent spamming with resupply cabinets: only 1 thrown at a time + EHANDLE m_hThrownPowerup; +}; + +//============================================================================= +// +// TF Weapon Energy drink. +// +class CTFLunchBox_Drink : public CTFLunchBox +{ +public: + + DECLARE_CLASS( CTFLunchBox_Drink, CTFLunchBox ); + DECLARE_NETWORKCLASS(); + DECLARE_PREDICTABLE(); + + CTFLunchBox_Drink(); + + bool AllowTaunts( void ) { return false; } + + virtual bool DropAllowed( void ) { return false; } + + const char* GetEffectLabelText( void ) { return "#TF_ENERGYDRINK"; } + +#ifdef CLIENT_DLL + virtual const char* ModifyEventParticles( const char* token ); + virtual bool Holster( CBaseCombatWeapon *pSwitchingTo = NULL ); +#endif +}; + +#endif // TF_WEAPON_LUNCHBOX_H |