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