feat(game): race exit warnings in the turn report (#12)
Tests · Go / test (push) Successful in 2m29s
Tests · UI / test (push) Waiting to run
Tests · Go / test (pull_request) Successful in 2m17s
Tests · Integration / integration (pull_request) Successful in 1m53s
Tests · UI / test (pull_request) Successful in 3m37s

Surface the inactivity-removal countdown the rules promise but the
engine never reported. A race within five turns of being auto-removed
for inactivity gets a personal warning in its own report; every race
within three turns is listed publicly to all participants.

- model: Report.PersonalExitWarning + RacesLeavingSoon ([]RaceExitNotice)
- fbs: RaceExitNotice table + Report.personal_exit_warning /
  races_leaving_soon (regenerated Go + TS bindings)
- transcoder: encode/decode both fields
- engine: ReportExitWarnings fills the recipient's TTL (1..5) and lists
  other non-extinct races with TTL 1..3, excluding the recipient itself
- ui: danger-styled personal banner + "races leaving soon" section
  (hidden when empty), wired into the report view, EN/RU i18n
- docs: rules.txt report-section list, FUNCTIONAL.md 6.4 + RU mirror

Voluntary quit and idle timeout share the TTL countdown and are not
distinguished, per the agreed scope.
This commit is contained in:
Ilia Denisov
2026-05-31 10:34:50 +02:00
parent 9dce15c7bb
commit 9e9977d5f1
28 changed files with 908 additions and 22 deletions
+14
View File
@@ -47,6 +47,13 @@ type Report struct {
OtherGroup []OtherGroup `json:"otherGroup,omitempty"`
UnidentifiedGroup []UnidentifiedGroup `json:"unidentifiedGroup,omitempty"`
// Race exit warnings. PersonalExitWarning is the recipient race's own
// number of turns remaining before auto-removal for inactivity (set when
// it is 1..5, otherwise 0). RacesLeavingSoon lists other races within 3
// turns of removal and is shown to every recipient.
PersonalExitWarning uint `json:"personalExitWarning,omitempty"`
RacesLeavingSoon []RaceExitNotice `json:"racesLeavingSoon,omitempty"`
OnPlanetGroupCache map[uint][]int `json:"-"`
InSpaceGroupRangeCache map[int]map[uint]float64 `json:"-"`
}
@@ -71,6 +78,13 @@ type Player struct {
Extinct bool `json:"extinct"`
}
// RaceExitNotice is a public notice that a race is within a few turns of being
// auto-removed for inactivity; TurnsLeft is the number of turns until removal.
type RaceExitNotice struct {
Race string `json:"race"`
TurnsLeft uint `json:"turnsLeft"`
}
func (r Report) MarshalBinary() (data []byte, err error) {
return json.Marshal(&r)
}