Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
2.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef TF_WEAPON_LUNCHBOX_H
  7. #define TF_WEAPON_LUNCHBOX_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tf_weaponbase.h"
  12. // Client specific.
  13. #ifdef CLIENT_DLL
  14. #define CTFLunchBox C_TFLunchBox
  15. #define CTFLunchBox_Drink C_TFLunchBox_Drink
  16. #endif
  17. enum lunchbox_weapontypes_t
  18. {
  19. LUNCHBOX_STANDARD = 0, // Careful, can be the Scout BONK drink, or the Heavy sandvich.
  20. LUNCHBOX_ADDS_MAXHEALTH,
  21. LUNCHBOX_ADDS_MINICRITS,
  22. LUNCHBOX_STANDARD_ROBO,
  23. LUNCHBOX_STANDARD_FESTIVE,
  24. LUNCHBOX_ADDS_AMMO,
  25. };
  26. #define TF_SANDWICH_REGENTIME 30
  27. #define TF_CHOCOLATE_BAR_REGENTIME 10
  28. //=============================================================================
  29. //
  30. // TF Weapon Lunchbox.
  31. //
  32. class CTFLunchBox : public CTFWeaponBase
  33. {
  34. public:
  35. DECLARE_CLASS( CTFLunchBox, CTFWeaponBase );
  36. DECLARE_NETWORKCLASS();
  37. DECLARE_PREDICTABLE();
  38. // Server specific.
  39. #ifdef GAME_DLL
  40. DECLARE_DATADESC();
  41. #endif
  42. CTFLunchBox();
  43. virtual void UpdateOnRemove( void );
  44. virtual void Precache();
  45. virtual int GetWeaponID( void ) const { return TF_WEAPON_LUNCHBOX; }
  46. virtual void PrimaryAttack();
  47. virtual void SecondaryAttack();
  48. virtual void WeaponReset( void );
  49. virtual bool UsesPrimaryAmmo();
  50. virtual bool DropAllowed( void );
  51. int GetLunchboxType( void ) const { int iMode = 0; CALL_ATTRIB_HOOK_INT( iMode, set_weapon_mode ); return iMode; };
  52. float GetProgress( void ) { return GetEffectBarProgress(); }
  53. const char* GetEffectLabelText( void ) { return "#TF_SANDWICH"; }
  54. void DrainAmmo( bool bForceCooldown = false );
  55. virtual float InternalGetEffectBarRechargeTime( void ) { return GetLunchboxType() == LUNCHBOX_ADDS_MAXHEALTH ? TF_CHOCOLATE_BAR_REGENTIME : TF_SANDWICH_REGENTIME; }
  56. virtual void Detach( void ) OVERRIDE;
  57. #ifdef GAME_DLL
  58. void ApplyBiteEffects( CTFPlayer *pPlayer );
  59. #endif
  60. private:
  61. CTFLunchBox( const CTFLunchBox & ) {}
  62. // Prevent spamming with resupply cabinets: only 1 thrown at a time
  63. EHANDLE m_hThrownPowerup;
  64. };
  65. //=============================================================================
  66. //
  67. // TF Weapon Energy drink.
  68. //
  69. class CTFLunchBox_Drink : public CTFLunchBox
  70. {
  71. public:
  72. DECLARE_CLASS( CTFLunchBox_Drink, CTFLunchBox );
  73. DECLARE_NETWORKCLASS();
  74. DECLARE_PREDICTABLE();
  75. CTFLunchBox_Drink();
  76. bool AllowTaunts( void ) { return false; }
  77. virtual bool DropAllowed( void ) { return false; }
  78. const char* GetEffectLabelText( void ) { return "#TF_ENERGYDRINK"; }
  79. #ifdef CLIENT_DLL
  80. virtual const char* ModifyEventParticles( const char* token );
  81. virtual bool Holster( CBaseCombatWeapon *pSwitchingTo = NULL );
  82. #endif
  83. };
  84. #endif // TF_WEAPON_LUNCHBOX_H