mods: gate_driver presses at the menus' pace after a probe that shows no move (review)

A probe that showed no move pressed Enter at once, and the menus then probed again at once: Enter came
every 3 to 5 s (68 times in 6 min on a cold cache), with no press_every and no check that frames had
moved on. It now asks the menus for one press at their pace, and a probe waits for Enter to be up.
The docs say what idle cannot tell (a held player) and what a cold cache does to CONTROL.
This commit is contained in:
TheGeogeo
2026-11-30 21:49:19 +01:00
parent 923dc26741
commit 8b79ed2720
3 changed files with 22 additions and 8 deletions

View File

@ -1168,6 +1168,14 @@ fn the_gate_driver_fails_without_a_position_or_without_control() {
log.iter().any(|l| l.starts_with("GATE FAIL no control")),
"{log:?}"
);
// A probe that shows no move asks for a press at the menus' pace, not right away: one every 25 s.
let presses: Vec<f64> = log
.iter()
.filter(|l| l.starts_with("GATE PRESS"))
.map(|l| seconds_of(l))
.collect();
assert!(presses.len() <= 9, "{log:?}");
assert!(presses.windows(2).all(|w| w[1] - w[0] >= 24.9), "{log:?}");
}
#[test]

View File

@ -198,7 +198,10 @@ ships disabled: a run enables a copy of it in a mods folder of its own (`LEONIDA
position is known. A start that takes minutes to compile pipelines does not throw its presses away.
- **Control.** Holding W for 3 s must move the player at least 1 m and at most 30 m. More is the title placing the
player itself (a load, a cutscene), not a walk: it tries again (`GATE PROBE ... placed`). Less is a screen that
still waits: it presses once more (`GATE PROBE ... still`) and tries again.
still waits (`GATE PROBE ... still`): it presses once more, at the menus' pace, and tries again.
- **Limits.** In `idle`, a mark at 0.0 m does not tell a player standing still from one the title holds (a cutscene
can start after control and hold the player); `roam` shows it. With a cold pipeline cache the world can take
minutes, and the player can stay held: `GATE CONTROL` then comes late, or `GATE FAIL no control` at 900 s.
- **Then.** `idle` (the default) stands still, for measuring. `roam` walks a fixed loop: W, with short J and L turns
(the stand-in pad's right stick turns the camera).
- **Its log lines.** Through `leonida.log`, the log is also its heartbeat:

View File

@ -75,11 +75,14 @@ function M:step()
if self.state == "boot" then
if frame >= self.cfg.boot_frames and now >= self.cfg.boot_seconds then self.state = "menus" end
elseif self.state == "menus" then
if self:position() then
self.state = "probe"
elseif not self.release_at and (self.press_frame == nil or frame >= self.press_frame + 3)
and (self.last_press == nil or now - self.last_press >= self.cfg.press_every) then
local may_press = not self.release_at and (self.press_frame == nil or frame >= self.press_frame + 3)
and (self.last_press == nil or now - self.last_press >= self.cfg.press_every)
if self:position() and not self.want_press then
-- Once Enter is up: a probe holding W would cut its press short.
if not self.release_at then self.state = "probe" end
elseif may_press then
self:press(now, frame)
self.want_press = false
end
elseif self.state == "probe" then
if not self.probe then
@ -107,10 +110,10 @@ function M:step()
-- The title placed the player itself (a load, a cutscene): no screen to press through, show control again.
self:say("PROBE", string.format("t=%.1f", now), string.format("moved=%.1f", moved), "placed")
else
-- A screen still wants a press: one, then show control again.
-- A screen may still want a press: one, at the menus' pace (press_every, frames moving on), then show
-- control again.
self:say("PROBE", string.format("t=%.1f", now), string.format("moved=%.1f", moved), "still")
self.state = "menus"
self:press(now, frame)
self.state, self.want_press = "menus", true
end
else
if self.state == "roam" and (self.roam_until == nil or now >= self.roam_until) then