Release an unreachable optical contact and serve ready posts fairly (#138)
build / mod (push) Failing after 22s

An automatic optical contact is kept only within the optics' own reach and let go after a few failed probes. It stays out of the next picks for a while, so a visible alternative can be tried without constant switching; unknown world geometry gets a longer, still bounded wait. A player's command still waits for its contact and says so in the status line.

Ready posts are now served oldest-probe first through a simulation-wide probe sequence, so posts whose phases coincide all advance under the unchanged CHECKS_PER_TICK budget.

Tests: an out-of-range contact with a visible alternative, a blocked contact with a visible alternative, five same-phase posts, the bounded unknown-geometry wait, and the manual pin's status and out-of-reach behaviour.

Co-Authored-By: Kimi Code <noreply@moonshot.ai>
This commit is contained in:
2026-11-21 09:24:02 +03:00
parent 41ab52e802
commit bd2d8f4fed
2 changed files with 242 additions and 38 deletions
+3
View File
@@ -1416,6 +1416,8 @@ pub struct Sim {
/// The next blast's id (separate from `next`, so the other units' ids stay as they were).
blast_seq: u32,
next: u32,
/// The optical probe sequence: a ready post is served oldest-probe first (fair queue, #138).
optical_seq: u64,
/// The combat randomness: what is rolled for aim, hits, damage and raids. Drawing, sound and camera never
/// spend it (#85).
pub rng: Rng,
@@ -1529,6 +1531,7 @@ impl Sim {
blasts: Vec::new(),
blast_seq: 0,
next: 1,
optical_seq: 0,
rng: Rng::new(seed),
vis: Rng::new(seed ^ 0x5DEE_CE66_D1CE_4E5B),
fx_next: 0,