summaryrefslogtreecommitdiff
path: root/game/server/tf/tf_logic_on_holiday.cpp
blob: 6bc800006b72709584a92953f51806f5745313e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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()