forked from nillerusr/source-engine
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnpc_mossman.cpp
151 lines (123 loc) · 4.58 KB
/
npc_mossman.cpp
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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Dr. Mossman, stalwart heroine, doing what is right in the face of
// near certain doom, all while fighting off the clumsy advances of her
// misogynistic colleges.
//=============================================================================//
//-----------------------------------------------------------------------------
// Generic NPC - purely for scripted sequence work.
//-----------------------------------------------------------------------------
#include "cbase.h"
#include "npcevent.h"
#include "ai_basenpc.h"
#include "ai_hull.h"
#include "ai_baseactor.h"
#include "ai_playerally.h"
#include "ai_behavior_follow.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// NPC's Anim Events Go Here
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CNPC_Mossman : public CAI_PlayerAlly
{
public:
DECLARE_CLASS( CNPC_Mossman, CAI_PlayerAlly );
DECLARE_DATADESC();
void Spawn( void );
void Precache( void );
Class_T Classify ( void );
void HandleAnimEvent( animevent_t *pEvent );
int GetSoundInterests ( void );
bool CreateBehaviors( void );
int SelectSchedule( void );
private:
CAI_FollowBehavior m_FollowBehavior;
};
LINK_ENTITY_TO_CLASS( npc_mossman, CNPC_Mossman );
BEGIN_DATADESC( CNPC_Mossman )
// DEFINE_FIELD( m_FollowBehavior, FIELD_EMBEDDED ), (auto saved by AI)
END_DATADESC()
//-----------------------------------------------------------------------------
// Classify - indicates this NPC's place in the
// relationship table.
//-----------------------------------------------------------------------------
Class_T CNPC_Mossman::Classify ( void )
{
return CLASS_PLAYER_ALLY_VITAL;
}
//-----------------------------------------------------------------------------
// HandleAnimEvent - catches the NPC-specific messages
// that occur when tagged animation frames are played.
//-----------------------------------------------------------------------------
void CNPC_Mossman::HandleAnimEvent( animevent_t *pEvent )
{
switch( pEvent->event )
{
case 1:
default:
BaseClass::HandleAnimEvent( pEvent );
break;
}
}
//-----------------------------------------------------------------------------
// GetSoundInterests - generic NPC can't hear.
//-----------------------------------------------------------------------------
int CNPC_Mossman::GetSoundInterests ( void )
{
return 0;
}
//-----------------------------------------------------------------------------
// Spawn
//-----------------------------------------------------------------------------
void CNPC_Mossman::Spawn()
{
Precache();
BaseClass::Spawn();
SetModel( "models/mossman.mdl" );
SetHullType(HULL_HUMAN);
SetHullSizeNormal();
SetSolid( SOLID_BBOX );
AddSolidFlags( FSOLID_NOT_STANDABLE );
SetMoveType( MOVETYPE_STEP );
SetBloodColor( BLOOD_COLOR_RED );
m_iHealth = 8;
m_flFieldOfView = 0.5;// indicates the width of this NPC's forward view cone ( as a dotproduct result )
m_NPCState = NPC_STATE_NONE;
CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_OPEN_DOORS | bits_CAP_ANIMATEDFACE | bits_CAP_TURN_HEAD );
CapabilitiesAdd( bits_CAP_FRIENDLY_DMG_IMMUNE );
AddEFlags( EFL_NO_DISSOLVE | EFL_NO_MEGAPHYSCANNON_RAGDOLL | EFL_NO_PHYSCANNON_INTERACTION );
NPCInit();
}
//-----------------------------------------------------------------------------
// Precache - precaches all resources this NPC needs
//-----------------------------------------------------------------------------
void CNPC_Mossman::Precache()
{
PrecacheModel( "models/mossman.mdl" );
BaseClass::Precache();
}
//=========================================================
// Purpose:
//=========================================================
bool CNPC_Mossman::CreateBehaviors()
{
AddBehavior( &m_FollowBehavior );
return BaseClass::CreateBehaviors();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
int CNPC_Mossman::SelectSchedule( void )
{
if ( !BehaviorSelectSchedule() )
{
}
return BaseClass::SelectSchedule();
}
//-----------------------------------------------------------------------------
// AI Schedules Specific to this NPC
//-----------------------------------------------------------------------------