Files
BT411/scratchpad/night6/file_78turn.py
T

43 lines
2.4 KiB
Python

"""#78 gimped turn-in-place follow-up comment."""
import base64
import json
import subprocess
import urllib.request
REPO = r"C:\git\bt411"
BASE = "https://gitea.mysticmachines.com/api/v1/repos/VWE/BT411"
out = subprocess.run(["git", "credential", "fill"],
input="protocol=https\nhost=gitea.mysticmachines.com\n\n",
capture_output=True, text=True, cwd=REPO)
cred = dict(l.split("=", 1) for l in out.stdout.strip().splitlines() if "=" in l)
AUTH = "Basic " + base64.b64encode(
(cred["username"] + ":" + cred["password"]).encode()).decode()
def call(method, path, payload=None):
data = json.dumps(payload).encode() if payload is not None else None
r = urllib.request.Request(BASE + path, data=data, method=method)
r.add_header("Authorization", AUTH)
r.add_header("Content-Type", "application/json")
return json.load(urllib.request.urlopen(r))
def comment(n, body):
marker = body.strip().splitlines()[0][:60]
for c in call("GET", "/issues/%d/comments" % n):
if marker in c.get("body", ""):
print(" #%d already has this comment - skipped" % n)
return
call("POST", "/issues/%d/comments" % n, {"body": body})
print(" #%d commented" % n)
BODY = """**Field-test follow-up** (`95cf49d`): interactive testing found a gimped mech pivoted as a **rotating statue** -- no turn step. Root cause: the binary's turn-in-place dispatcher (`FUN_004a9b5c`, master perf) runs OUTSIDE the gait-driver selection, so it arms the `trn` step for gimped mechs too (the gimp leg driver's case 4 exists precisely to advance it). The port had relocated that dispatcher into the NORMAL driver's Standing case -- which stops running the moment the gimp driver takes over. Mirrored the arming into the gimp driver; field-verified stepping pivots both directions while limping, with clean re-entry into the limp cycle on throttle-up.
Note for the old-timers: a limping mech step-turns with the **normal** turn animation -- there is no gimp-turn clip in the RES (the limp set is only wg/gg/gs). Authentic 1995 behavior: the limp shows in forward locomotion only.
Also in the tree: `run\\limp.cmd` -- a double-click solo demo (novice sim so crits can't fake a no-drive bug, `BT_SELF_DAMAGE_TICKS` holds the leg just past half). Plus a docs fix worth knowing: under the glass profile drive is the 1995 throttle-lever scheme (**SHIFT** up / **CTRL** down / **ALT** reverse), not WASD."""
comment(78, BODY)