From c99281a0da0df95f6bb8a26676c9c5afdbaa995d Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Wed, 7 Jun 2017 21:11:50 -0500 Subject: [PATCH] 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. --- code/game/ai_dmq3.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/game/ai_dmq3.c b/code/game/ai_dmq3.c index a18df550..8f22e2f5 100644 --- a/code/game/ai_dmq3.c +++ b/code/game/ai_dmq3.c @@ -2830,8 +2830,12 @@ float BotEntityVisible(int viewer, vec3_t eye, vec3_t viewangles, float fov, int aas_entityinfo_t entinfo; vec3_t dir, entangles, start, end, middle; - //calculate middle of bounding box BotEntityInfo(ent, &entinfo); + if (!entinfo.valid) { + return 0; + } + + //calculate middle of bounding box VectorAdd(entinfo.mins, entinfo.maxs, middle); VectorScale(middle, 0.5, middle); VectorAdd(entinfo.origin, middle, middle);