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.

64 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "cbase.h"
  8. #include "tf_gamerules.h"
  9. // memdbgon must be the last include file in a .cpp file!!!
  10. #include "tier0/memdbgon.h"
  11. class CLogicOnHoliday : public CLogicalEntity
  12. {
  13. DECLARE_CLASS( CLogicOnHoliday, CLogicalEntity );
  14. DECLARE_DATADESC();
  15. COutputEvent m_IsAprilFools;
  16. COutputEvent m_IsFullMoon;
  17. COutputEvent m_IsHalloween;
  18. COutputEvent m_IsNothing;
  19. COutputEvent m_IsSmissmas;
  20. COutputEvent m_IsTFBirthday;
  21. COutputEvent m_IsValentines;
  22. void InputFire( inputdata_t & )
  23. {
  24. bool isAprilFools = TF_IsHolidayActive( kHoliday_AprilFools );
  25. bool isFullMoon = TF_IsHolidayActive( kHoliday_FullMoon );
  26. bool isHalloween = TF_IsHolidayActive( kHoliday_Halloween );
  27. bool isSmissmas = TF_IsHolidayActive( kHoliday_Christmas );
  28. bool isTFBirthday = TF_IsHolidayActive( kHoliday_TFBirthday );
  29. bool isValentines = TF_IsHolidayActive( kHoliday_Valentines );
  30. bool isNothing = !(isTFBirthday || isHalloween || isSmissmas || isValentines || isFullMoon || isAprilFools);
  31. if ( isNothing )
  32. {
  33. m_IsNothing.FireOutput( this, this );
  34. return;
  35. }
  36. if ( isAprilFools ) m_IsAprilFools.FireOutput( this, this );
  37. if ( isFullMoon ) m_IsFullMoon.FireOutput( this, this );
  38. if ( isHalloween ) m_IsHalloween.FireOutput( this, this );
  39. if ( isSmissmas ) m_IsSmissmas.FireOutput( this, this );
  40. if ( isTFBirthday ) m_IsTFBirthday.FireOutput( this, this );
  41. if ( isValentines ) m_IsValentines.FireOutput( this, this );
  42. }
  43. };
  44. LINK_ENTITY_TO_CLASS( tf_logic_on_holiday, CLogicOnHoliday );
  45. BEGIN_DATADESC( CLogicOnHoliday )
  46. DEFINE_INPUTFUNC( FIELD_VOID, "Fire", InputFire ),
  47. DEFINE_OUTPUT( m_IsAprilFools, "IsAprilFools" ),
  48. DEFINE_OUTPUT( m_IsFullMoon, "IsFullMoon" ),
  49. DEFINE_OUTPUT( m_IsHalloween, "IsHalloween" ),
  50. DEFINE_OUTPUT( m_IsSmissmas, "IsSmissmas" ),
  51. DEFINE_OUTPUT( m_IsTFBirthday, "IsTFBirthday" ),
  52. DEFINE_OUTPUT( m_IsValentines, "IsValentines" ),
  53. DEFINE_OUTPUT( m_IsNothing, "IsNothing" ),
  54. END_DATADESC()