fix: bots not throwing grenades since last commit
combat: various fixes to combat movements combat: tweaked grenade throwing code refactor: convert some arrays initializations to initializer lists build: switch docker image to clang 18.1
This commit is contained in:
parent
a94886f8f7
commit
2caa65f6ad
14 changed files with 253 additions and 221 deletions
|
|
@ -431,6 +431,7 @@ constexpr auto kSprayDistance = 260.0f;
|
|||
constexpr auto kDoubleSprayDistance = kSprayDistance * 2;
|
||||
constexpr auto kMaxChatterRepeatInterval = 99.0f;
|
||||
constexpr auto kViewFrameUpdate = 1.0f / 30.0f;
|
||||
constexpr auto kGrenadeDamageRadius = 385.0f;
|
||||
|
||||
constexpr auto kInfiniteDistanceLong = static_cast <int> (kInfiniteDistance);
|
||||
constexpr auto kMaxWeapons = 32;
|
||||
|
|
@ -443,8 +444,36 @@ constexpr auto kGrenadeInventoryEmpty = -1;
|
|||
constexpr auto kConfigExtension = "cfg";
|
||||
|
||||
// weapon masks
|
||||
constexpr auto kPrimaryWeaponMask = (cr::bit (Weapon::XM1014) | cr::bit (Weapon::M3) | cr::bit (Weapon::MAC10) | cr::bit (Weapon::UMP45) | cr::bit (Weapon::MP5) | cr::bit (Weapon::TMP) | cr::bit (Weapon::P90) | cr::bit (Weapon::AUG) | cr::bit (Weapon::M4A1) | cr::bit (Weapon::SG552) | cr::bit (Weapon::AK47) | cr::bit (Weapon::Scout) | cr::bit (Weapon::SG550) | cr::bit (Weapon::AWP) | cr::bit (Weapon::G3SG1) | cr::bit (Weapon::M249) | cr::bit (Weapon::Famas) | cr::bit (Weapon::Galil));
|
||||
constexpr auto kSecondaryWeaponMask = (cr::bit (Weapon::P228) | cr::bit (Weapon::Elite) | cr::bit (Weapon::USP) | cr::bit (Weapon::Glock18) | cr::bit (Weapon::Deagle) | cr::bit (Weapon::FiveSeven));
|
||||
constexpr auto kPrimaryWeaponMask = (cr::bit (Weapon::XM1014) |
|
||||
cr::bit (Weapon::M3) |
|
||||
cr::bit (Weapon::MAC10) |
|
||||
cr::bit (Weapon::UMP45) |
|
||||
cr::bit (Weapon::MP5) |
|
||||
cr::bit (Weapon::TMP) |
|
||||
cr::bit (Weapon::P90) |
|
||||
cr::bit (Weapon::AUG) |
|
||||
cr::bit (Weapon::M4A1) |
|
||||
cr::bit (Weapon::SG552) |
|
||||
cr::bit (Weapon::AK47) |
|
||||
cr::bit (Weapon::Scout) |
|
||||
cr::bit (Weapon::SG550) |
|
||||
cr::bit (Weapon::AWP) |
|
||||
cr::bit (Weapon::G3SG1) |
|
||||
cr::bit (Weapon::M249) |
|
||||
cr::bit (Weapon::Famas) |
|
||||
cr::bit (Weapon::Galil));
|
||||
|
||||
constexpr auto kSecondaryWeaponMask = (cr::bit (Weapon::P228)
|
||||
| cr::bit (Weapon::Elite)
|
||||
| cr::bit (Weapon::USP)
|
||||
| cr::bit (Weapon::Glock18)
|
||||
| cr::bit (Weapon::Deagle)
|
||||
| cr::bit (Weapon::FiveSeven));
|
||||
|
||||
constexpr auto kSniperWeaponMask = (cr::bit (Weapon::Scout)
|
||||
| cr::bit (Weapon::SG550)
|
||||
| cr::bit (Weapon::AWP)
|
||||
| cr::bit (Weapon::G3SG1));
|
||||
|
||||
// weapons < 7 are secondary
|
||||
constexpr auto kPrimaryWeaponMinIndex = 7;
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ public:
|
|||
using UniqueBot = UniquePtr <Bot>;
|
||||
|
||||
private:
|
||||
float m_timeRoundStart {};
|
||||
float m_timeRoundEnd {};
|
||||
float m_timeRoundMid {};
|
||||
float m_timeRoundStart {}; // time round has started
|
||||
float m_timeRoundEnd {}; // time round ended
|
||||
float m_timeRoundMid {}; // middle point timestamp of a round
|
||||
|
||||
float m_difficultyBalanceTime {}; // time to balance difficulties ?
|
||||
float m_autoKillCheckTime {}; // time to kill all the bots ?
|
||||
|
|
@ -277,7 +277,7 @@ public:
|
|||
// bot async worker wrapper
|
||||
class BotThreadWorker final : public Singleton <BotThreadWorker> {
|
||||
private:
|
||||
ThreadPool m_botWorker;
|
||||
ThreadPool m_botWorker {};
|
||||
|
||||
public:
|
||||
explicit BotThreadWorker () = default;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ private:
|
|||
StringArray m_sentences {};
|
||||
SmallArray <Client> m_clients {};
|
||||
|
||||
HashMap <int32_t, String> m_weaponAlias {};
|
||||
HashMap <int32_t, String> m_weaponAliases {};
|
||||
|
||||
public:
|
||||
BotSupport ();
|
||||
|
|
@ -121,13 +121,13 @@ public:
|
|||
}
|
||||
|
||||
// gets the shooting cone deviation
|
||||
float getShootingCone (edict_t *ent, const Vector &pos) {
|
||||
float getConeDeviation (edict_t *ent, const Vector &pos) const {
|
||||
return ent->v.v_angle.forward () | (pos - (ent->v.origin + ent->v.view_ofs)).normalize (); // he's facing it, he meant it
|
||||
}
|
||||
|
||||
// check if position is inside view cone of entity
|
||||
bool isInViewCone (const Vector &pos, edict_t *ent) {
|
||||
return getShootingCone (ent, pos) >= cr::cosf (cr::deg2rad ((ent->v.fov > 0 ? ent->v.fov : 90.0f) * 0.5f));
|
||||
bool isInViewCone (const Vector &pos, edict_t *ent) const {
|
||||
return getConeDeviation (ent, pos) >= cr::cosf (cr::deg2rad ((ent->v.fov > 0 ? ent->v.fov : 90.0f) * 0.5f));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
12
inc/yapb.h
12
inc/yapb.h
|
|
@ -297,7 +297,6 @@ private:
|
|||
bool m_isLeader {}; // bot is leader of his team
|
||||
bool m_checkTerrain {}; // check for terrain
|
||||
bool m_moveToC4 {}; // ct is moving to bomb
|
||||
bool m_grenadeRequested {}; // bot requested change to grenade
|
||||
bool m_needToSendWelcomeChat {}; // bot needs to greet people on server?
|
||||
bool m_isCreature {}; // bot is not a player, but something else ? zombie ?
|
||||
bool m_defuseNotified {}; // bot is notified about bomb defusion
|
||||
|
|
@ -367,7 +366,7 @@ private:
|
|||
int numEnemiesNear (const Vector &origin, const float radius);
|
||||
int numFriendsNear (const Vector &origin, const float radius);
|
||||
|
||||
float getBombTimeleft ();
|
||||
float getBombTimeleft () const;
|
||||
float getEstimatedNodeReachTime ();
|
||||
float isInFOV (const Vector &dest);
|
||||
float getShiftSpeed ();
|
||||
|
|
@ -386,8 +385,8 @@ private:
|
|||
bool checkWallOnRight ();
|
||||
bool updateNavigation ();
|
||||
bool isEnemyThreat ();
|
||||
bool isWeaponRestricted (int weaponIndex);
|
||||
bool isWeaponRestrictedAMX (int weaponIndex);
|
||||
bool isWeaponRestricted (int wid);
|
||||
bool isWeaponRestrictedAMX (int wid);
|
||||
bool isInViewCone (const Vector &origin);
|
||||
bool checkBodyParts (edict_t *target);
|
||||
bool seesEnemy (edict_t *player);
|
||||
|
|
@ -560,6 +559,11 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
// get run player move angles
|
||||
const Vector &getRpmAngles () {
|
||||
return getCurrentTaskId () == Task::Attack ? pev->v_angle : m_moveAngles;
|
||||
}
|
||||
|
||||
public:
|
||||
entvars_t *pev {};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue