From 15a8093138d5128761d86aa1c94d65d7917a0bc3 Mon Sep 17 00:00:00 2001 From: Metroid_Skittles Date: Sat, 7 Feb 2026 08:02:07 +0100 Subject: [PATCH] Update AutismBotIngame/python/ingamefollowct.py --- AutismBotIngame/python/ingamefollowct.py | 32 +++++++++++++++--------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/AutismBotIngame/python/ingamefollowct.py b/AutismBotIngame/python/ingamefollowct.py index fc8cd60..4884024 100644 --- a/AutismBotIngame/python/ingamefollowct.py +++ b/AutismBotIngame/python/ingamefollowct.py @@ -90,21 +90,28 @@ def exit_handler(): subprocess.getoutput(f"pkill -9 -u {whoami}") def bot_process_movement(input_line): - dist_target = input_line[input_line.index("dist_target:") + len("dist_target:"):input_line.index("enemy_distance")] - enemy_distance = input_line[input_line.index("enemy_distance:") + len("enemy_distance:"):input_line.index("targeteam:")] - targeteam = input_line[input_line.index("targeteam:") + len("targeteam:"):input_line.index("state:")] - state = input_line[input_line.index("state:") + len("state:"):] + try: + dist_target = input_line[input_line.index("dist_target:") + len("dist_target:"):input_line.index("enemy_distance")] + enemy_distance = input_line[input_line.index("enemy_distance:") + len("enemy_distance:"):input_line.index("targeteam:")] + targeteam = input_line[input_line.index("targeteam:") + len("targeteam:"):input_line.index("state:")] + state = input_line[input_line.index("state:") + len("state:"):] - state = int(state.strip()) - dist_target = float(dist_target) - enemy_distance = float(enemy_distance) - targeteam = int(targeteam) + state = int(state.strip()) + dist_target = float(dist_target) + enemy_distance = float(enemy_distance) + targeteam = int(targeteam) + except (ValueError, IndexError): + # Ignore malformed movement packets instead of crashing the main loop. + return global last_forward_time strInput = "cl_minmodels 1; wait 2; " if targeteam == 3: strInput = "cl_minmodels 1; wait 2; " + + def forward_burst(wait_ticks): + return f"+forward; wait {wait_ticks}; -forward; " # Keep movement fluid: avoid frequent full stops. should_push_forward = False @@ -116,7 +123,7 @@ def bot_process_movement(input_line): should_push_forward = True if should_push_forward: - strInput += "+forward; wait 2;" + strInput += forward_burst(2) last_forward_time = time.time() else: strInput += "wait 2;" @@ -124,13 +131,14 @@ def bot_process_movement(input_line): #print('dist_target: ', dist_target, ' enemy distance: ', enemy_distance, ' targeteam: ', targeteam, ' state:', state) if dist_target > team_follow_distance: # Favor forward movement when drifting away from teammates. - strInput += f"+forward; wait {random.randint(min_forward_wait, max_forward_wait)}; " + strInput += forward_burst(random.randint(min_forward_wait, max_forward_wait)) elif enemy_distance <= enemy_chase_distance: # Close enemy: keep pressure by closing distance. - strInput += f"+forward; wait {random.randint(min_forward_wait, max_forward_wait)}; " + strInput += forward_burst(random.randint(min_forward_wait, max_forward_wait)) if enemy_distance <= infect_chase_distance: # Chase and attack at close range. - strInput += "+forward; wait 10; +attack; wait 20; -attack; " + strInput += forward_burst(10) + strInput += "+attack; wait 20; -attack; " if dist_target <= team_follow_distance: # Keep subtle strafes to avoid robotic straight lines. strInput = strinput_append(strInput, 2)