-
Notifications
You must be signed in to change notification settings - Fork 0
/
MonsterTools.cpp
170 lines (148 loc) · 3.64 KB
/
MonsterTools.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#include "extension.h"
#include "MonsterTools.h"
#include "CEntity.h"
#include "CAI_NPC.h"
#include "MonsterConfig.h"
MonsterTools g_MonsterTools;
MonsterConfig g_MonsterConfig;
IMonster_Listener *s_MonsterListener = NULL;
extern CViewVectors *g_ViewVectors;
extern CViewVectors *g_DefaultViewVectors;
void MonsterTools::SetListener(IMonster_Listener *listener)
{
s_MonsterListener = listener;
}
void MonsterTools::SetConfig(MConfig config, bool value)
{
switch(config)
{
case MC_b_PlayGiveSuit:
g_MonsterConfig.m_bEnable_PlayerGiveSuit = value;
break;
case MC_b_HL2DM_Damage_Style:
g_MonsterConfig.m_bEnable_HL2DM_Damage_Style = value;
break;
case MC_b_Item_Weapon_Respawn:
g_MonsterConfig.m_bEnable_Item_Weapon_Respawn = value;
break;
case MC_b_Prop_PickUp:
g_MonsterConfig.m_bEnable_Prop_Pickup = value;
break;
case MC_b_CleanUpMap:
g_MonsterConfig.m_bEnable_CleanUpMap = value;
break;
case MC_b_DefaultViewVectors:
g_MonsterConfig.m_bEnableDefault_ViewVectors = value;
if(g_ViewVectors && g_DefaultViewVectors)
{
if(g_MonsterConfig.m_bEnableDefault_ViewVectors)
{
memcpy(g_ViewVectors, g_DefaultViewVectors, sizeof(CViewVectors));
} else {
g_ViewVectors->m_vDuckHullMax.z = 36.0f;
}
}
break;
case MC_b_Blast_Self_Damage:
g_MonsterConfig.m_bEnableBlast_Self_Damage = value;
break;
case MC_b_RemoveDropWeapon:
g_MonsterConfig.m_bEnableRemoveDropWeapon = value;
break;
case MC_b_CSS_Weapon_Penetration:
g_MonsterConfig.m_bEnable_CSS_Weapon_Penetration = value;
break;
default:
break;
}
}
void MonsterTools::SetConfig(MConfig config, int value)
{
}
void MonsterTools::SetConfig(MConfig config, float value)
{
switch(config)
{
case MC_f_NPCWeaponRemoveDelay:
g_MonsterConfig.m_fNPCWeaponRemoveDelay = value;
break;
default:
break;
}
}
bool MonsterTools::IsNPC(CBaseEntity *pEntity)
{
CEntity *cent = CEntity::Instance(pEntity);
if(cent)
{
return cent->IsNPC();
}
return false;
}
void MonsterTools::OnMonsterShutdown()
{
if(s_MonsterListener)
{
s_MonsterListener->OnMonsterShutdown();
}
}
Disposition_t MonsterTools::IRelationType(CBaseEntity *pEntity, CBaseEntity *pTarget, Disposition_t original_value)
{
if(s_MonsterListener)
{
return (Disposition_t)s_MonsterListener->IRelationType(pEntity, pTarget, original_value);
}
return original_value;
}
void MonsterTools::NPC_UpdateOnRemove(CBaseEntity *pEntity)
{
if(s_MonsterListener)
{
s_MonsterListener->NPC_UpdateOnRemove(pEntity);
}
}
bool MonsterTools::PlayerCanPickup(CBaseEntity *pPlayer, CBaseEntity *pEntity, const char *classname)
{
if(s_MonsterListener)
{
return s_MonsterListener->PlayerCanPickup(pPlayer, pEntity, classname);
}
return true;
}
void MonsterTools::OnVehicleOverturned(CBaseEntity *pPlayer, CBaseEntity *pEntity)
{
if(s_MonsterListener)
{
s_MonsterListener->OnVehicleOverturned(pPlayer, pEntity);
}
}
bool MonsterTools::CanExitVehicle(CBaseEntity *pPlayer, CBaseEntity *pEntity, bool original_value)
{
if(s_MonsterListener)
{
return s_MonsterListener->CanExitVehicle(pPlayer, pEntity, original_value);
}
return original_value;
}
bool MonsterTools::IsPassengerVisible( int nRole, bool original_value)
{
if(s_MonsterListener)
{
return s_MonsterListener->IsPassengerVisible(nRole, original_value);
}
return original_value;
}
void MonsterTools::OnNPCTakeDamage(int hitgroup, CTakeDamageInfo &info)
{
if(s_MonsterListener)
{
s_MonsterListener->OnNPCTakeDamage(hitgroup, info);
}
}
void MonsterTools::OnPlayerKilledNPC(int client, int entity, int npc_class)
{
if(s_MonsterListener)
{
s_MonsterListener->OnPlayerKilledNPC(client, entity, npc_class);
}
}