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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: CTF Halloween Pickup.
//
//=============================================================================//
#ifndef ENTITY_HALLOWEEN_PICKUP_H
#define ENTITY_HALLOWEEN_PICKUP_H
#ifdef _WIN32
#pragma once
#endif
#ifdef GAME_DLL
#include "tf_powerup.h"
#include "tf_gamerules.h"
#include "tf_player.h"
#endif
#include "ehandle.h"
#define TF_HALLOWEEN_PICKUP_MODEL "models/items/target_duck.mdl"
#define TF_DUCK_PICKUP_MODEL "models/workshop/player/items/pyro/eotl_ducky/eotl_bonus_duck.mdl"
#define TF_GIFT_MODEL "models/props_halloween/gargoyle_ghost.mdl"; //"models/props_halloween/halloween_gift.mdl";
#define TF_HALLOWEEN_PICKUP_DEFAULT_SOUND "AmmoPack.Touch"
#define BONUS_DUCK_GLOW "superrare_beams1"
#define BONUS_DUCK_TRAIL_RED "duck_collect_trail_red"
#define BONUS_DUCK_TRAIL_BLUE "duck_collect_trail_blue"
#define BONUS_DUCK_TRAIL_SPECIAL_RED "duck_collect_trail_special_red"
#define BONUS_DUCK_TRAIL_SPECIAL_BLUE "duck_collect_trail_special_blue"
#define BONUS_DUCK_CREATED_SOUND "Duck.Quack"
#ifdef CLIENT_DLL
#define CBonusDuckPickup C_BonusDuckPickup
#define CHalloweenPickup C_HalloweenPickup
#define CHalloweenGiftPickup C_HalloweenGiftPickup
#include "c_tf_player.h"
#endif
//=============================================================================
//
// CTF Halloween Pickup class.
//
class CHalloweenPickup
#ifdef GAME_DLL
: public CTFPowerup
#else
: public C_BaseAnimating
#endif
{
public:
#ifdef GAME_DLL
DECLARE_CLASS( CHalloweenPickup, CTFPowerup );
#else
DECLARE_CLASS( CHalloweenPickup, C_BaseAnimating );
#endif
DECLARE_NETWORKCLASS();
CHalloweenPickup();
~CHalloweenPickup();
virtual void Precache( void ) OVERRIDE;
#ifdef GAME_DLL
virtual int UpdateTransmitState() OVERRIDE;
virtual int ShouldTransmit( const CCheckTransmitInfo *pInfo ) OVERRIDE;
virtual bool ValidTouch( CBasePlayer *pPlayer ) OVERRIDE;
virtual bool MyTouch( CBasePlayer *pPlayer ) OVERRIDE;
virtual CBaseEntity* Respawn( void );
virtual const char *GetDefaultPowerupModel( void ) OVERRIDE
{
return TF_HALLOWEEN_PICKUP_MODEL;
}
virtual float GetRespawnDelay( void ) OVERRIDE;
virtual bool ItemCanBeTouchedByPlayer( CBasePlayer *pPlayer );
#endif // GAME_DLL
private:
string_t m_iszSound;
string_t m_iszParticle;
#ifdef GAME_DLL
COutputEvent m_OnRedPickup;
COutputEvent m_OnBluePickup;
#endif
DECLARE_DATADESC();
};
class CBonusDuckPickup : public CHalloweenPickup
{
public:
DECLARE_CLASS( CBonusDuckPickup, CHalloweenPickup );
DECLARE_NETWORKCLASS();
CBonusDuckPickup();
~CBonusDuckPickup();
virtual void Precache( void ) OVERRIDE;
#ifdef GAME_DLL
virtual const char *GetDefaultPowerupModel( void ) OVERRIDE
{
return TF_DUCK_PICKUP_MODEL;
}
virtual float GetLifeTime() { if ( m_flLifeTime == 0) { m_flLifeTime = RandomFloat( 17.0f, 20.0f ); } return m_flLifeTime; }
virtual bool ValidTouch( CBasePlayer *pPlayer ) OVERRIDE;
void Spawn( void );
virtual bool MyTouch( CBasePlayer *pPlayer ) OVERRIDE;
void DropSingleInstance( Vector &vecLaunchVel, CBaseCombatCharacter *pThrower, float flThrowerTouchDelay, float flResetTime = 0.1f );
void NotifyFadeOut( void );
void UpdateCollisionBounds();
// Make this a base class in powerup
void BlinkThink();
void SetCreatorId( int value ) { m_iCreatorId = value; }
int GetCreatorId( void ) { return m_iCreatorId; }
void SetAssisterId( int value ) { m_iAssisterId = value; }
int GetAssisterId( void ) { return m_iAssisterId; }
void SetVictimId( int value ) { m_iVictimId = value; }
int GetVictimId( void ) { return m_iVictimId; }
void SetSpecial( void ){ m_bSpecial = true; }
void SetDuckFlag( int iFlag ) { m_iFlags |= iFlag; }
#else
virtual void OnDataChanged( DataUpdateType_t updateType ) OVERRIDE;
#endif // GAME_DLL
private:
string_t m_iszSound;
string_t m_iszParticle;
#ifdef GAME_DLL
float m_flLifeTime;
float m_flKillTime;
int m_nBlinkCount;
int m_iCreatorId;
int m_iAssisterId;
int m_iVictimId;
int m_iFlags;
#else
CNewParticleEffect *pGlowEffect;
#endif
CNetworkVar( bool, m_bSpecial );
DECLARE_DATADESC();
};
#ifdef GAME_DLL
//----------------------------------------------------------------------------
DECLARE_AUTO_LIST( IHalloweenGiftSpawnAutoList );
//*************************************************************************************************
// Dumb entity that is placed in Hammer.
// On Map load, server finds all the locations and makes note then deletes the entity
class CHalloweenGiftSpawnLocation : public CBaseEntity, public IHalloweenGiftSpawnAutoList
{
public:
DECLARE_CLASS( CHalloweenGiftSpawnLocation, CBaseEntity );
CHalloweenGiftSpawnLocation();
};
#endif // GAME_DLL
//*************************************************************************************************
// Networked Entity that represents a gift. Only visible and 'touchable' by the intended target
// Has a lifetime
// A server can spawn multiple of these for different people or the same person but each gift has a single target
class CHalloweenGiftPickup : public CHalloweenPickup
{
public:
DECLARE_CLASS( CHalloweenGiftPickup, CHalloweenPickup );
DECLARE_NETWORKCLASS();
CHalloweenGiftPickup();
//~CHalloweenGiftPickup();
virtual void Precache( void ) OVERRIDE;
void Spawn( void );
#ifdef GAME_DLL
void SetTargetPlayer( CTFPlayer *pTarget ); // Must be called before spawn
void DespawnGift();
void RemoveGift();
virtual const char *GetDefaultPowerupModel( void ) OVERRIDE
{
return TF_GIFT_MODEL;
}
//virtual float GetLifeTime() { if ( m_flLifeTime == 0 ) { m_flLifeTime = RandomFloat( 17.0f, 20.0f ); } return m_flLifeTime; }
virtual bool ValidTouch( CBasePlayer *pPlayer ) OVERRIDE;
virtual bool MyTouch( CBasePlayer *pPlayer ) OVERRIDE;
#endif
#ifdef CLIENT_DLL
virtual bool ShouldDraw();
virtual void OnDataChanged( DataUpdateType_t updateType ) OVERRIDE;
CTFPlayer *m_pPreviousTargetPlayer;
#endif
CNetworkVar( CHandle<CTFPlayer>, m_hTargetPlayer );
DECLARE_DATADESC();
};
//*************************************************************************************************
#endif // ENTITY_HALLOWEEN_PICKUP_H
|