From f4942233050f75669f5cb9e5022c01e8e4403d93 Mon Sep 17 00:00:00 2001 From: esefxdz Date: Thu, 15 Oct 2026 14:57:28 +0300 Subject: [PATCH] lgbot: debug log says why it isn't steering Co-Authored-By: Claude Opus 5.5 --- home/minqlx-plugins/lgbot.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/home/minqlx-plugins/lgbot.py b/home/minqlx-plugins/lgbot.py index daf7754..3685486 100644 --- a/home/minqlx-plugins/lgbot.py +++ b/home/minqlx-plugins/lgbot.py @@ -176,13 +176,20 @@ if minqlx: self.read_at = now return self.settings + def idle(self, now, why): + if self.debug and now - self.log_at >= 1.0: + self.log_at = now + self.logger.info("lgbot idle: %s", why) + def tick(self): - players = self.players() - bot = next((p for p in players if is_lgbot(p.clean_name, p.steam_id)), None) - if bot is None or not bot.is_alive: - return now = time.time() s = self.read_cvars(now) + players = self.players() + bot = next((p for p in players if is_lgbot(p.clean_name, p.steam_id)), None) + if bot is None: + return self.idle(now, "no lgbot on the server") + if not bot.is_alive: + return self.idle(now, "lgbot is dead") cands = [] for p in players: if p.id == bot.id or p.team == "spectator" or not p.is_alive: @@ -193,8 +200,8 @@ if minqlx: cands.append(((pos.x, pos.y), p)) bpos = bot.position() target = pick_target((bpos.x, bpos.y), cands) - if target is None: - return # nobody to duel: stock AI roams + if target is None: # nobody to duel: stock AI roams + return self.idle(now, "no target within %d (%d candidates)" % (MAX_TARGET_DIST, len(cands))) tpos = target.position() direction = self.strafer.step(int(now * 1000), s) want = wanted_range(s, bot.health, target.health)