From e1c64bed4c3d31a960283082aa81e20189f08c9e Mon Sep 17 00:00:00 2001 From: esefxdz Date: Thu, 15 Oct 2026 15:21:07 +0300 Subject: [PATCH] lgbot: idle debug shows nearest player distance Co-Authored-By: Claude Opus 5.5 --- home/minqlx-plugins/lgbot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/home/minqlx-plugins/lgbot.py b/home/minqlx-plugins/lgbot.py index 0121a9a..169c1ec 100644 --- a/home/minqlx-plugins/lgbot.py +++ b/home/minqlx-plugins/lgbot.py @@ -277,7 +277,9 @@ if minqlx: bpos = bot.position() tid = pick_target((bpos.x, bpos.y, bpos.z), cands, self.target_id) if tid is None: # nobody to duel close by: the bot AI walks over - return self.idle(now, "no target within %d on this floor (%d candidates)" % (MAX_TARGET_DIST, len(cands))) + near = min(((math.hypot(c[0][0] - bpos.x, c[0][1] - bpos.y), c[0][2] - bpos.z) for c in cands), default=None) + return self.idle(now, "no target within %d on this floor (%d candidates, nearest %s)" % ( + MAX_TARGET_DIST, len(cands), "dist=%d dz=%d bot=%d,%d" % (near + (bpos.x, bpos.y)) if near else "-")) if tid != self.target_id: self.strafer.reset() # drift was measured around the previous target self.target_id = tid