#!/usr/bin/env bash # ========================================================================= # #146 -- desktop virtual throttle must be RELEASED on respawn. # # The pod's throttle is a physical lever and Mech::Reset deliberately leaves # it alone (subsystem loop starts at index 2; ControlsMapper is index 0) -- # authentic, kept. The desktop bridge only EMULATES that lever with the # static ramp accumulator sLever, so a pad/keyboard pilot respawned at speed # while holding nothing. Fix: queue the existing all-stop at Mech::Reset, # LOCAL VIEWPOINT MECH ONLY. # # WHAT THIS BENCH ACTUALLY TESTS. It does NOT test "does zeroing sLever # stop the mech" -- that path is the X all-stop button, proven in the field # every day, and BT_AUTODRIVE cannot exercise it anyway (forced mode reads # gBTDrive.forcedThrottle, never sLever -- mechmppr.cpp:677). # # It tests the one thing the fix could genuinely get WRONG: the viewpoint # gate. Mech::Reset also runs for REPLICANTS, so an ungated write to the # global gBTDrive would all-stop the local player every time a REMOTE mech # respawned -- a far worse bug than the one being fixed. # # PASS: A (who dies) logs "[respawn] desktop throttle released" once per # Mech::Reset, and B logs it ZERO times while A is respawning. # FAIL: any occurrence in B's log -> the gate leaks and remote respawns # stop the local pilot. # # A self-damages to death on a timer; B just flies and watches. # ========================================================================= set -x . /c/git/bt411/scratchpad/night6/bench_common.sh cd /c/git/bt411/content || exit 1 taskkill //F //IM btl4.exe > /dev/null 2>&1 sleep 2 rm -f tr_a.log tr_b.log tr_relay.log bt_expert_egg MP.EGG TR.EGG sed -i "s/^map=.*/map=grass/; s/^time=.*/time=day/; s/^vehicle=.*/vehicle=madcat/" TR.EGG # B: the OBSERVER. Also driving, so a leaked all-stop would be doubly visible. ( export BT_AUTODRIVE=0.6 export BT_DEATH_LOG=1 BT_MP_LOG=1 BT_KEY_LOG=1 bt_launch tr_b.log TR.EGG 0x0C -net 1601 ) sleep 2 # A: drives, dies repeatedly, respawns. ( export BT_AUTODRIVE=0.8 BT_SELF_DAMAGE=8 export BT_DEATH_LOG=1 BT_MP_LOG=1 BT_KEY_LOG=1 bt_launch tr_a.log TR.EGG 0x03 -net 1501 ) sleep 5 python ../tools/btconsole.py TR.EGG 127.0.0.1:1501 127.0.0.1:1601 > tr_relay.log 2>&1 & RELAY=$! sleep 280 kill $RELAY 2>/dev/null sleep 3 bt_kill_ours; sleep 2; taskkill //F //IM btl4.exe > /dev/null 2>&1; sleep 3 echo "=================== #146 THROTTLE RELEASE ON RESPAWN ===================" echo "--- A: how many respawns, how many releases? (must be 1:1) ---" echo -n " A Mech::Reset .......... "; grep -ac "Mech::Reset" tr_a.log echo -n " A throttle released .... "; grep -ac "desktop throttle released" tr_a.log echo echo "--- B: the VIEWPOINT GATE. Must be 0 releases despite seeing A respawn. ---" echo -n " B Mech::Reset (incl. replicant) .... "; grep -ac "Mech::Reset" tr_b.log echo -n " B throttle released (MUST BE 0) .... "; grep -ac "desktop throttle released" tr_b.log echo echo "--- A: the release must sit INSIDE the reset block ---" grep -aE "Mech::Reset|desktop throttle released" tr_a.log | head -8 echo echo "--- B: same window, to show B saw the respawn and still did not release ---" grep -aE "Mech::Reset|desktop throttle released" tr_b.log | head -8