Fixed inablity to delete paths between nodes.

Some fixes to facing node index search.
This commit is contained in:
jeefo 2019-08-29 23:31:54 +03:00
commit 2f4b329ad1
4 changed files with 105 additions and 40 deletions

View file

@ -47,18 +47,12 @@ public:
// gets the build number of bot
int buildNumber ();
// gets the shooting cone deviation
float getShootingCone (edict_t *ent, const Vector &position);
// check if origin is visible from the entity side
bool isVisible (const Vector &origin, edict_t *ent);
// check if entity is alive
bool isAlive (edict_t *ent);
// check if origin is inside view cone of entity
bool isInViewCone (const Vector &origin, edict_t *ent);
// checks if entitiy is fakeclient
bool isFakeClient (edict_t *ent);
@ -142,6 +136,16 @@ public:
return m_sendToHook.enable ();
}
// gets the shooting cone deviation
float getShootingCone (edict_t *ent, const Vector &position) {
return ent->v.v_angle.forward () | (position - (ent->v.origin + ent->v.view_ofs)).normalize (); // he's facing it, he meant it
}
// check if origin is inside view cone of entity
bool isInViewCone (const Vector &origin, edict_t *ent) {
return getShootingCone (ent, origin) >= cr::cosf (cr::degreesToRadians ((ent->v.fov > 0 ? ent->v.fov : 90.0f) * 0.5f));
}
public:
static int32 CR_STDCALL sendTo (int socket, const void *message, size_t length, int flags, const struct sockaddr *dest, int destLength);
};