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/server/tf/tf_logic_on_holiday.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/server/tf/tf_logic_on_holiday.cpp')
| -rw-r--r-- | game/server/tf/tf_logic_on_holiday.cpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/game/server/tf/tf_logic_on_holiday.cpp b/game/server/tf/tf_logic_on_holiday.cpp new file mode 100644 index 0000000..6bc8000 --- /dev/null +++ b/game/server/tf/tf_logic_on_holiday.cpp @@ -0,0 +1,64 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#include "cbase.h" +#include "tf_gamerules.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +class CLogicOnHoliday : public CLogicalEntity +{ + DECLARE_CLASS( CLogicOnHoliday, CLogicalEntity ); + DECLARE_DATADESC(); + + COutputEvent m_IsAprilFools; + COutputEvent m_IsFullMoon; + COutputEvent m_IsHalloween; + COutputEvent m_IsNothing; + COutputEvent m_IsSmissmas; + COutputEvent m_IsTFBirthday; + COutputEvent m_IsValentines; + + void InputFire( inputdata_t & ) + { + bool isAprilFools = TF_IsHolidayActive( kHoliday_AprilFools ); + bool isFullMoon = TF_IsHolidayActive( kHoliday_FullMoon ); + bool isHalloween = TF_IsHolidayActive( kHoliday_Halloween ); + bool isSmissmas = TF_IsHolidayActive( kHoliday_Christmas ); + bool isTFBirthday = TF_IsHolidayActive( kHoliday_TFBirthday ); + bool isValentines = TF_IsHolidayActive( kHoliday_Valentines ); + bool isNothing = !(isTFBirthday || isHalloween || isSmissmas || isValentines || isFullMoon || isAprilFools); + + if ( isNothing ) + { + m_IsNothing.FireOutput( this, this ); + return; + } + + if ( isAprilFools ) m_IsAprilFools.FireOutput( this, this ); + if ( isFullMoon ) m_IsFullMoon.FireOutput( this, this ); + if ( isHalloween ) m_IsHalloween.FireOutput( this, this ); + if ( isSmissmas ) m_IsSmissmas.FireOutput( this, this ); + if ( isTFBirthday ) m_IsTFBirthday.FireOutput( this, this ); + if ( isValentines ) m_IsValentines.FireOutput( this, this ); + + } +}; + +LINK_ENTITY_TO_CLASS( tf_logic_on_holiday, CLogicOnHoliday ); + +BEGIN_DATADESC( CLogicOnHoliday ) + DEFINE_INPUTFUNC( FIELD_VOID, "Fire", InputFire ), + DEFINE_OUTPUT( m_IsAprilFools, "IsAprilFools" ), + DEFINE_OUTPUT( m_IsFullMoon, "IsFullMoon" ), + DEFINE_OUTPUT( m_IsHalloween, "IsHalloween" ), + DEFINE_OUTPUT( m_IsSmissmas, "IsSmissmas" ), + DEFINE_OUTPUT( m_IsTFBirthday, "IsTFBirthday" ), + DEFINE_OUTPUT( m_IsValentines, "IsValentines" ), + DEFINE_OUTPUT( m_IsNothing, "IsNothing" ), +END_DATADESC() |