lgbot: review fixes: drift reset after pauses, player-like acceleration, sticky targets with hysteresis, wall backoff; plugin glue tests
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
a998614224
commit
86754715f5
6 files changed
+321
-30
No files matched your search
@@ -147,11 +147,14 @@ def refuse_impostor(status_text):
|
||||
return False
|
||||
|
||||
|
||||
REFUSED = 3
|
||||
|
||||
|
||||
def apply(st, old_aim):
|
||||
run = server()
|
||||
status = run("status")
|
||||
if refuse_impostor(status):
|
||||
return 1
|
||||
return REFUSED
|
||||
bot_in = bot_present(status)
|
||||
for cmd in build_commands(st, readd=(not bot_in or st["aim"] != old_aim), bot_in=bot_in):
|
||||
run(cmd)
|
||||
@@ -162,7 +165,7 @@ def apply(st, old_aim):
|
||||
|
||||
def main(argv, input_fn=input):
|
||||
arg = argv[1] if len(argv) > 1 else ""
|
||||
st = load_state()
|
||||
st = load_state(STATE)
|
||||
if arg == "off":
|
||||
run = server()
|
||||
if refuse_impostor(run("status")):
|
||||
@@ -187,8 +190,10 @@ def main(argv, input_fn=input):
|
||||
except (EOFError, KeyboardInterrupt):
|
||||
print("\ncancelled, nothing changed")
|
||||
return 1
|
||||
save_state(STATE, new)
|
||||
return apply(new, old_aim=st["aim"])
|
||||
rc = apply(new, old_aim=st["aim"])
|
||||
if rc != REFUSED: # saved even if the bot didn't show up (server restarting): --last retries
|
||||
save_state(STATE, new)
|
||||
return rc
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user