summaryrefslogtreecommitdiff
path: root/game/server/tf/bot/behavior/missions/tf_bot_mission_reprogrammed.h
blob: 7c63c7eec225026196ac55bb63f2760976e7822c (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
//========= Copyright Valve Corporation, All rights reserved. ============//
// tf_bot_mission_suicide_bomber.h
// Move to target and explode
// Michael Booth, October 2011

#ifndef TF_BOT_MISSION_REPROGRAMMED_H
#define TF_BOT_MISSION_REPROGRAMMED_H

#include "Path/NextBotPathFollow.h"

class CTFBotMissionReprogrammed : public Action< CTFBot >
{
#ifdef STAGING_ONLY
public:
	CTFBotMissionReprogrammed( void );

	virtual ActionResult< CTFBot >	OnStart( CTFBot *me, Action< CTFBot > *priorAction );
	virtual ActionResult< CTFBot >	Update( CTFBot *me, float interval );
	virtual void					OnEnd( CTFBot *me, Action< CTFBot > *nextAction );

	virtual EventDesiredResult< CTFBot > OnStuck( CTFBot *me );
	virtual EventDesiredResult< CTFBot > OnKilled( CTFBot *me, const CTakeDamageInfo &info );

	virtual QueryResultType ShouldAttack( const INextBot *me, const CKnownEntity *them ) const;	// should we attack "them"?

	virtual const char *GetName( void ) const	{ return "MissionReprogrammed"; };

private:
	CHandle< CBaseEntity > m_victim;	// the victim we are trying to destroy
	Vector m_lastKnownVictimPosition;

	PathFollower m_path;
	CountdownTimer m_repathTimer;

	CountdownTimer m_talkTimer;
	CountdownTimer m_detonateTimer;
	CountdownTimer m_detonateSeekTimer;
	CountdownTimer m_reprogrammedTimer;

	void StartDetonate( CTFBot *me, bool wasSuccessful = false );
	void Detonate( CTFBot *me );
	CTFPlayer *FindNearestEnemy( CTFBot *me );
	bool m_hasDetonated;
	bool m_wasSuccessful;

	int m_consecutivePathFailures;

	Vector m_vecDetLocation;
#endif // STAGING_ONLY
};


#endif // TF_BOT_MISSION_REPROGRAMMED_H