add: implemented #122.

fix: bots try to defuse already beeing defused bomb (fixes #116).
fix: line ending in source code.
fix:  do not retreat with sniper weapon, if currently shooting and have ammo.
crlib: added deque class.
This commit is contained in:
ds 2020-09-16 13:07:47 +03:00
commit fa47e418b2
19 changed files with 420 additions and 73 deletions

View file

@ -355,6 +355,11 @@ public:
return !m_breakables.empty ();
}
// find variable value by variable name
StringRef findCvar (StringRef name) {
return engfuncs.pfnCVarGetString (name.chars ());
}
// helper to sending the client message
void sendClientMessage (bool console, edict_t *ent, const char *message);

View file

@ -117,6 +117,7 @@ public:
int getAliveHumansCount ();
float getConnectTime (int botId, float original);
float getAverageTeamKPD (bool calcForBots);
void setBombPlanted (bool isPlanted);
void frame ();
@ -142,6 +143,7 @@ public:
void setWeaponMode (int selection);
void updateTeamEconomics (int team, bool setTrue = false);
void updateBotDifficulties ();
void balanceBotDifficulties ();
void reset ();
void initFilters ();
void resetFilters ();

View file

@ -38,7 +38,8 @@ CR_DECLARE_SCOPED_ENUM (NetMsg,
NVGToggle = 19,
FlashBat = 20,
Fashlight = 21,
ItemStatus = 22
ItemStatus = 22,
ScoreInfo = 23
)
// vgui menus (since latest steam updates is obsolete, but left for old cs)
@ -124,6 +125,7 @@ private:
void netMsgItemStatus ();
void netMsgNVGToggle ();
void netMsgFlashBat ();
void netMsgScoreInfo ();
public:
MessageDispatcher ();

View file

@ -760,7 +760,6 @@ private:
int findDefendNode (const Vector &origin);
int findBestGoal ();
int findGoalPost (int tactic, IntArray *defensive, IntArray *offsensive);
int getMsgQueue ();
int bestPrimaryCarried ();
int bestSecondaryCarried ();
int bestGrenadeCarried ();
@ -975,6 +974,8 @@ public:
float m_firePause; // time to pause firing
float m_shootTime; // time to shoot
float m_timeLastFired; // time to last firing
float m_difficultyChange; // time when auto-difficulty was last applied to this bot
float m_kpdRatio; // kill per death ratio
int m_basePing; // base ping for bot
int m_numEnemiesLeft; // number of enemies alive left on map
@ -988,8 +989,6 @@ public:
int m_buyState; // current count in buying
int m_blindButton; // buttons bot press, when blind
int m_radioOrder; // actual command
int m_actMessageIndex; // current processed message
int m_pushMessageIndex; // offset for next pushed message
int m_prevGoalIndex; // holds destination goal node
int m_chosenGoalIndex; // used for experience, same as above
int m_lastDamageType; // stores last damage
@ -1034,6 +1033,7 @@ public:
BurstMode m_weaponBurstMode; // bot using burst mode? (famas/glock18, but also silencer mode)
Personality m_personality; // bots type
Array <BotTask> m_tasks;
Deque <int32> m_msgQueue;
public:
Bot (edict_t *bot, int difficulty, int personality, int team, int member);