summaryrefslogtreecommitdiff
path: root/game/server/tf/bot/map_entities/tf_bot_hint_entity.cpp
blob: ffd2c74647c64a6c2d7f1fb6c10f9e9f90e69e39 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//
//
//=============================================================================
#include "cbase.h"
#include "tf_bot_hint_entity.h"
#include "tf_obj.h"
#include "tf_player.h"


BEGIN_DATADESC( CBaseTFBotHintEntity )
	DEFINE_KEYFIELD( m_isDisabled, FIELD_BOOLEAN, "StartDisabled" ),
	DEFINE_INPUTFUNC( FIELD_VOID, "Enable", InputEnable ),
	DEFINE_INPUTFUNC( FIELD_VOID, "Disable", InputDisable ),
END_DATADESC()

IMPLEMENT_AUTO_LIST( ITFBotHintEntityAutoList );

//------------------------------------------------------------------------------
CBaseTFBotHintEntity::CBaseTFBotHintEntity( void )
	: m_isDisabled( false ),
	m_hintType( HINT_INVALID )
{
}


bool CBaseTFBotHintEntity::OwnerObjectHasNoOwner() const
{
	CBaseEntity* pOwner = GetOwnerEntity();
	if ( pOwner && pOwner->IsBaseObject() )
	{
		CBaseObject *pObj = static_cast< CBaseObject* >( pOwner );
		if ( pObj->GetBuilder() == NULL )
		{
			return true;
		}
		else
		{
			if ( !pObj->GetBuilder()->IsPlayerClass( TF_CLASS_ENGINEER ) )
			{
				AssertMsg( 0, "Object has an owner that's not engineer." );
				Warning( "Object has an owner that's not engineer." );
			}
		}
	}
	return false;
}


bool CBaseTFBotHintEntity::OwnerObjectFinishBuilding() const
{
	CBaseEntity* pOwner = GetOwnerEntity();
	if ( pOwner && pOwner->IsBaseObject() )
	{
		CBaseObject *pObj = static_cast< CBaseObject* >( pOwner );
		return !pObj->IsBuilding();
	}
	return false;
}