Repository navigation
GM lines run only on a confirmed selection (#296) - #301
Merged
Merged
Conversation
…#296) selectConfirmed accepted any echo of the player's target field that showed the unit, so an echo from an earlier select of the same unit, with another unit's select still pending behind it, confirmed the new select; the GM line then ran on that other unit. The session now keeps a log of the selections it sent and moves a lower bound on the server's progress with each echo (to the oldest send the echo can answer). A selection is confirmed only when every send from there on is that unit. Reselecting the unit already confirmed needs no echo (the core sends none for an unchanged field). When a new echo could not be told from an old one, a neutral selection (none, else the agent itself) is made and confirmed first. Respawn's wait for a cleared selection uses the same rule.
…on (#296 review) UNIT_FIELD_TARGET is also written by Unit::Attack, Unit::AttackStop and a stun, without touching the selection GM commands read. An echo of a value the session never sent now leaves the selection in force unknown, and a repeated select is confirmed with no echo only when the base came from an echo of the session's own send; otherwise a neutral selection is made first (one the log, the dropped sends and the field do not hold). The log is capped at 32 sends; an echo of a dropped unit confirms nothing. The confirmed select lives in the session (SelectConfirmed); GMOn (.aura world buffs) goes through it and GMOnConfirmed, and .respawn is sent with GMOnConfirmed on a confirmed clear.
… stunned (#296 review 2) The core rewrites the player's target field only through Attack, AttackStop and stun apply/end; a rewrite to exactly the unit of a pending select read as its echo. While the player is hot (its own SMSG_ATTACKSTART until the ATTACKSTOP, UNIT_FLAG_IN_COMBAT or UNIT_FLAG_STUNNED) and for SelectionCombatSettle after, no echo confirms and no GM line on a selection goes out. Cooling down fences off every send so far; SelectConfirmed waits inside its timer, then selects again (through a neutral selection when the unit was fenced off) and needs the echo of that new send. A neutral selection no longer counts the unknown base's placeholder as a unit.
When GPS started before the session had read the create block, the target field was unknown and SelectConfirmed made a neutral selection of nothing first, which the test refused (CI run 39915580906). The test now echoes every selection, allows only one neutral selection of nothing before the commander, and still checks that .gps runs with the commander selected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the last part of #296: a GM chat line (
.levelup,.respawn,.aura, ...) could run on a stale selection.CMSG_SET_SELECTIONit sends; an echo of the player's target field confirms a selection only when it answers the session's own send. A value the session never sent (the core rewrites the field on attack start/stop and stuns) makes the selection unknown..respawnand the.aurabuffs go through the same confirmed path. The log is capped at 32 entries.Tests: session log unit tests (fresh/stale echo, attack stop, attack on a player, cap, far teleport, combat rewrite to the pending unit) and command-level tests including the separate-threads race;
-raceruns green; fullgo test ./...green; mutations turn them red.Reviews: Opus cold review SHIP (after one fix round), Codex adversarial approve (after two fix rounds).