-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwalkbot.h
More file actions
59 lines (53 loc) · 1.63 KB
/
walkbot.h
File metadata and controls
59 lines (53 loc) · 1.63 KB
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
#pragma once
#include "../common.h"
#include "../sdk/datatypes/usercmd.h"
#include "../sdk/entity.h"
#include "../utilities.h"
#include "../sdk/nav/nav_area.h"
#include "../utilities/micropather.h"
#include "../sdk/nav/nav_file.h"
#include "../utilities/micropather.h"
struct tEnemyBlacklist {
tEnemyBlacklist(CBaseEntity* pEnt) {
m_pEntity = pEnt;
m_tTimeSinceLast.Reset();
};
bool ShouldRemove() {
return m_tTimeSinceLast.Elapsed() > 5000;
}
CBaseEntity* m_pEntity;
CTimer m_tTimeSinceLast{};
};
class CWalkBot : public CSingleton<CWalkBot>
{
public:
void Run(CUserCmd* pCmd, CBaseEntity* pLocal);
void Reset(bool bReloadNav = false);
inline float GetAvgViewDelta() {
return m_flDeltaAvg;
};
private:
float m_flDeltaAvg;
CTimer m_tDoorOpenTimer{};
CTimer m_tSinceLastArea{};
CTimer m_tCrouchTimer{};
CTimer m_tBackUpTimer{};
CTimer m_tJumpTimer{};
std::string m_szCurrentMapName{};
nav_mesh::nav_file* m_pNavFile = nullptr;
nav_mesh::nav_area* m_pCurrentTarget{};
std::vector<nav_mesh::nav_area*> m_vAreasPath{};
std::deque<float> m_vDeltaAnglesHist{ 30, 999.0f };
std::deque<tEnemyBlacklist> m_vEnemyBlacklists{};
void UpdateEnemyBlacklist();
bool IsEnemyBlacklisted(CBaseEntity* pEnt);
void CalculateDeltaAvg();
void DrawAreas(CBaseEntity* pLocal);
bool LevelCheck();
void DoObstacleAction(CBaseEntity* pLocal, CUserCmd* pCmd);
void OptimizePath(Vector vPlayerPos);
void CalculateFootMovement(Vector vPlayerPos, Vector vPointPos, CUserCmd* pCmd);
bool DoesNeedNewPath(CBaseEntity* pLocal);
nav_mesh::nav_area* GetAreaNearEnemies(CBaseEntity* pLocal);
nav_mesh::nav_area* GetAreaNearPlayer(CBaseEntity* pLocal);
};