Fix capture_audio_synth_header.py for headless --exec mode
Timers never fire in --headless --exec mode (the game loop runs but does not process the timer queue without explicit step() calls). Replace the Timer-based screenshot with a step() loop that advances the engine 30 ticks at 10ms each before calling automation.screenshot(). This fix was discovered and applied as part of blog post 0033 publication (Kanboard #209 / #345). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
988f0be369
commit
17664ba741
1 changed files with 6 additions and 5 deletions
|
|
@ -8,9 +8,10 @@ demo_path = (pathlib.Path(__file__).resolve().parent.parent /
|
|||
"tests" / "demo" / "audio_synth_demo.py")
|
||||
runpy.run_path(str(demo_path), run_name="__demo__")
|
||||
|
||||
def shot(timer, runtime):
|
||||
# In headless --exec mode timers never fire; use step() to advance the loop.
|
||||
for _ in range(30):
|
||||
mcrfpy.step(0.01)
|
||||
|
||||
automation.screenshot(OUT)
|
||||
print(f"Wrote {OUT}")
|
||||
sys.exit(0)
|
||||
|
||||
mcrfpy.Timer("header_shot", shot, 150)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue