blob: ef03fb45f3b12b4457d0ecfbb480205f7ede6585 (
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
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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Base class for many flying NPCs
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "ai_basenpc_flyer_new.h"
#include "ai_route.h"
#include "ai_navigator.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define FLYER_ROUTE_REBUILD_TIME 3.0 // Time between route rebuilds
// NOTE: Never instantiate ai_base_npc_flyer_new directly!!
//IMPLEMENT_CUSTOM_AI( ai_base_npc_flyer_new, CAI_BaseNPCFlyerNew);
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
CAI_BaseNPCFlyerNew::CAI_BaseNPCFlyerNew()
{
}
//------------------------------------------------------------------------------
// Used to set up a flyer
//------------------------------------------------------------------------------
void CAI_BaseNPCFlyerNew::SpawnFlyer()
{
SetNavType( NAV_FLY );
AddFlag( FL_FLY );
SetMoveType( MOVETYPE_STEP );
CapabilitiesAdd( bits_CAP_MOVE_FLY );
}
/*
void CAI_BaseNPCFlyerNew::InitCustomSchedules(void)
{
INIT_CUSTOM_AI(CAI_BaseNPCFlyerNew);
ADD_CUSTOM_CONDITION(CAI_BaseNPCFlyerNew, COND_FLYER_MOVE_BLOCKED);
ADD_CUSTOM_CONDITION(CAI_BaseNPCFlyerNew, COND_FLYER_MOVE_IMPOSSIBLE);
}
*/
//------------------------------------------------------------------------------
// Should be called during Select Schedule (BLEAH!)
//------------------------------------------------------------------------------
void CAI_BaseNPCFlyerNew::ClearFlyerConditions(void)
{
// ClearCondition( COND_FLYER_MOVE_BLOCKED );
// ClearCondition( COND_FLYER_MOVE_IMPOSSIBLE );
}
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
float CAI_BaseNPCFlyerNew::MinGroundDist(void)
{
return 0;
}
//-----------------------------------------------------------------------------
// Sets the ground speed appropriately:
//-----------------------------------------------------------------------------
float CAI_BaseNPCFlyerNew::GetIdealSpeed( ) const
{
return m_flSpeed;
}
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
void CAI_BaseNPCFlyerNew::StartTask( const Task_t *pTask )
{
switch (pTask->iTask)
{
// Activity is just idle (have no run)
case TASK_RUN_PATH:
{
GetNavigator()->SetMovementActivity(ACT_IDLE);
TaskComplete();
break;
}
// Don't check for run/walk activity
case TASK_SCRIPT_RUN_TO_TARGET:
case TASK_SCRIPT_WALK_TO_TARGET:
{
if (GetTarget() == NULL)
{
TaskFail(FAIL_NO_TARGET);
}
else
{
if (!GetNavigator()->SetGoal( GOALTYPE_TARGETENT ) )
{
TaskFail(FAIL_NO_ROUTE);
GetNavigator()->ClearGoal();
}
}
TaskComplete();
break;
}
default:
{
BaseClass::StartTask(pTask);
}
break;
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CAI_BaseNPCFlyerNew::RunTask( const Task_t *pTask )
{
BaseClass::RunTask(pTask);
}
|