lgbot: idle debug shows nearest player distance

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
esefandClaude Opus 5.5 committed 2026-10-15 15:21:07 +03:00
1 parent 86754715f5
commit e1c64bed4c
1 file changed
+3 -1
+3 -1
View File
@@ -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