summaryrefslogtreecommitdiff
path: root/game/shared/tf2/weapon_builder.h
blob: a684dbb1723362f5406a36bcb561f2fd2b10f6fa (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
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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#ifndef WEAPON_BUILDER_H
#define WEAPON_BUILDER_H
#ifdef _WIN32
#pragma once
#endif

#include "weapon_combat_usedwithshieldbase.h"

class CBaseObject;

//=========================================================
// Builder Weapon
//=========================================================
class CWeaponBuilder : public CWeaponCombatUsedWithShieldBase
{
	DECLARE_CLASS( CWeaponBuilder, CWeaponCombatUsedWithShieldBase );
public:
	CWeaponBuilder();

	virtual void	UpdateOnRemove( void );

	DECLARE_SERVERCLASS();

	virtual void	Precache( void );
	virtual bool	CanDeploy( void );
	virtual bool	CanHolster( void );
	virtual CBaseCombatWeapon *GetLastWeapon( void );
	virtual bool	Holster( CBaseCombatWeapon *pSwitchingTo = NULL );
	virtual void	ItemPostFrame( void );
	virtual void	PrimaryAttack( void );
	virtual void	WeaponIdle( void );
	virtual bool	Deploy( void );	
	virtual const char	*GetViewModel( int viewmodelindex = 0 ) const;

	void	SetCurrentState( int iState );
	void	SetCurrentObject( int iObject );

	virtual void	GainedNewTechnology( CBaseTechnology *pTechnology );
	virtual void	Equip( CBaseCombatCharacter *pOwner );

	// Add a new object type to the list of objects this builder weapon can build
	void	AddBuildableObject( int iObjectType );

	// Placement
	void	StartPlacement( void );
	void	StopPlacement( void );
	bool	UpdatePlacement( void );

	// Building
	void	StartBuilding( void );
	void	StoppedBuilding( int iObjectType );
	bool	IsBuilding( void );
	void	FinishedObject( void );

	virtual void	GetControlPanelInfo( int nPanelIndex, const char *&pPanelName );

	virtual bool			ShouldShowControlPanels( void );

private:
	void	PerformModifications( CBaseObject* pObject );

public:
	CNetworkVar( int, m_iBuildState );
	CNetworkVar( unsigned int, m_iCurrentObject );
	int		m_iCurrentObjectID;
	CNetworkVar( int, m_iCurrentObjectState );

	// Objects that this builder can build
	CNetworkArray( bool, m_bObjectValidity, OBJ_LAST );
	// Buildability of each object
	CNetworkArray( bool, m_bObjectBuildability, OBJ_LAST );

	// Build data for the current object, propagated when the player starts to build it
	CNetworkVar( float, m_flStartTime );
	CNetworkVar( float, m_flTotalTime );

	float	m_flLastRepairTime;

	CNetworkHandle( CBaseObject, m_hObjectBeingBuilt );
};


#endif // WEAPON_BUILDER_H