mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 07:11:46 +00:00
Make bots stop attacking player after disconnect
Bots did not notice player disconnected, so they kept attacking the last known position. Checking if entity is valid in BotEntityVisible might fix other similar issues too.
This commit is contained in:
parent
9aae0948ab
commit
c99281a0da
1 changed files with 5 additions and 1 deletions
|
@ -2830,8 +2830,12 @@ float BotEntityVisible(int viewer, vec3_t eye, vec3_t viewangles, float fov, int
|
||||||
aas_entityinfo_t entinfo;
|
aas_entityinfo_t entinfo;
|
||||||
vec3_t dir, entangles, start, end, middle;
|
vec3_t dir, entangles, start, end, middle;
|
||||||
|
|
||||||
//calculate middle of bounding box
|
|
||||||
BotEntityInfo(ent, &entinfo);
|
BotEntityInfo(ent, &entinfo);
|
||||||
|
if (!entinfo.valid) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//calculate middle of bounding box
|
||||||
VectorAdd(entinfo.mins, entinfo.maxs, middle);
|
VectorAdd(entinfo.mins, entinfo.maxs, middle);
|
||||||
VectorScale(middle, 0.5, middle);
|
VectorScale(middle, 0.5, middle);
|
||||||
VectorAdd(entinfo.origin, middle, middle);
|
VectorAdd(entinfo.origin, middle, middle);
|
||||||
|
|
Loading…
Reference in a new issue