fix: breakable headache (ref #660)

fix: bots firing rates on short distances (ref #658)
This commit is contained in:
jeefo 2025-01-14 14:17:53 +03:00
commit c07d02c14e
No known key found for this signature in database
GPG key ID: D696786B81B667C8
9 changed files with 157 additions and 53 deletions

View file

@ -164,6 +164,8 @@ private:
edict_t *m_localEntity {};
Array <edict_t *> m_breakables {};
HashMap <int32_t, bool> m_checkedBreakables {};
SmallArray <ConVarReg> m_cvars {};
SharedLibrary m_gameLib {};
SharedLibrary m_engineLib {};
@ -269,6 +271,9 @@ public:
// creates a fake client's a nd resets all the entvars
edict_t *createFakeClient (StringRef name);
// mark breakable entity as invalid
void markBreakableAsInvalid (edict_t *ent);
// public inlines
public:
// get the current time on server
@ -424,6 +429,11 @@ public:
return !m_breakables.empty ();
}
// is breakable entity is valid ?
bool isBreakableValid (edict_t *ent) {
return m_checkedBreakables[indexOfEntity (ent)];
}
// find variable value by variable name
StringRef findCvar (StringRef name) {
return engfuncs.pfnCVarGetString (name.chars ());

View file

@ -56,7 +56,7 @@ public:
bool isDoorEntity (edict_t *ent);
// this function is checking that pointed by ent pointer obstacle, can be destroyed
bool isShootableBreakable (edict_t *ent);
bool isBreakableEntity (edict_t *ent, bool initialSeed = false);
// nearest player search helper
bool findNearestPlayer (void **holder, edict_t *to, float searchDistance = 4096.0, bool sameTeam = false, bool needBot = false, bool needAlive = false, bool needDrawn = false, bool needBotWithC4 = false);