24c68e9846
Tests · UI / test (push) Has been cancelled
Tests · Go / test (pull_request) Successful in 2m6s
Tests · Go / test (push) Successful in 2m6s
Tests · Integration / integration (pull_request) Successful in 1m51s
Tests · UI / test (pull_request) Successful in 3m53s
Issue #48 п.32 ("Stationed ship groups") shipped with a fragile race fallback: when a foreign group sat on a non-`other`-kind planet the inspector printed a generic "foreign" label, which collapsed the race dropdown to a single uninformative bucket. The engine FBS contract did not carry per-group race either, so live games hit the same gap. This patch carries race authoritatively from the engine through every layer down to the inspector. Wire format & engine - `pkg/schema/fbs/report.fbs`: add `race:string` to `OtherGroup` and `LocalGroup` (additive — old clients ignore). - `pkg/schema/fbs/report/`: regenerated Go bindings. - `ui/frontend/src/proto/galaxy/fbs/report/`: regenerated TS bindings. - `pkg/model/report.OtherGroup.Race`: new field; carried through `LocalGroup` via the embedded `OtherGroup`. - `pkg/transcoder/report.go`: encode + decode `race` on both `LocalGroup` and `OtherGroup`. - `game/internal/controller/report.go.otherGroup`: set `v.Race` from `c.g.Race[c.RaceIndex(sg.OwnerID)].Name` so every emitted group — own or foreign — carries the resolved race name. Legacy parser - `tools/local-dev/legacy-report/parser.go`: capture the `<Race> Groups` header into `pendingOtherGroup.race`, fill local group `Race` from `p.rep.Race`, propagate both into the `report.OtherGroup` rows. - Tests + smoke counts updated; regenerated `KNNTS{039,041}.json` fixtures so the synthetic loader carries the new field. UI - `ui/frontend/src/api/`: `ReportShipGroupBase.race` field; synthetic loader + FBS decoder populate it. - `ui/frontend/src/lib/inspectors/planet/ship-groups.svelte`: the stationed-groups inspector picks race directly from `group.race` (own falls back to `localRace`, both finally to the `race.unknown` placeholder). The planet-owner / "foreign" heuristic is gone. - Row label changes from "N ships mass M" to a compact `<class>` | `<N ×>` | `<mass>` three-column layout: the count cell is right-aligned tabular, the mass cell is right-aligned monospace + tabular, matching the inspector / calculator number conventions. Stale i18n keys removed (`ship_groups.row.count`, `.row.mass`, `.race.foreign`). - All affected unit tests (8 files) carry the new `race` field. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
252 lines
4.4 KiB
Plaintext
252 lines
4.4 KiB
Plaintext
// report reflects model/report/Report data object
|
|
include "common.fbs";
|
|
|
|
namespace report;
|
|
|
|
table RouteEntry {
|
|
key:uint64;
|
|
value:string;
|
|
}
|
|
|
|
table TechEntry {
|
|
key:string;
|
|
value:float32;
|
|
}
|
|
|
|
table Route {
|
|
planet:uint64;
|
|
route:[RouteEntry];
|
|
}
|
|
|
|
table Player {
|
|
name:string;
|
|
drive:float32;
|
|
weapons:float32;
|
|
shields:float32;
|
|
cargo:float32;
|
|
population:float32;
|
|
industry:float32;
|
|
planets:uint16;
|
|
relation:string;
|
|
votes:float32;
|
|
extinct:bool;
|
|
}
|
|
|
|
table Science {
|
|
name:string;
|
|
drive:float32;
|
|
weapons:float32;
|
|
shields:float32;
|
|
cargo:float32;
|
|
}
|
|
|
|
table OtherScience {
|
|
race:string;
|
|
name:string;
|
|
drive:float32;
|
|
weapons:float32;
|
|
shields:float32;
|
|
cargo:float32;
|
|
}
|
|
|
|
table ShipClass {
|
|
name:string;
|
|
drive:float32;
|
|
armament:uint64;
|
|
weapons:float32;
|
|
shields:float32;
|
|
cargo:float32;
|
|
mass:float32;
|
|
}
|
|
|
|
table OthersShipClass {
|
|
race:string;
|
|
name:string;
|
|
drive:float32;
|
|
armament:uint64;
|
|
weapons:float32;
|
|
shields:float32;
|
|
cargo:float32;
|
|
mass:float32;
|
|
}
|
|
|
|
table ShipProduction {
|
|
planet:uint64;
|
|
class:string;
|
|
cost:float32;
|
|
prod_used:float32;
|
|
percent:float32;
|
|
free:float32;
|
|
}
|
|
|
|
table IncomingGroup {
|
|
origin:uint64;
|
|
destination:uint64;
|
|
distance:float32;
|
|
speed:float32;
|
|
mass:float32;
|
|
}
|
|
|
|
table Bombing {
|
|
number:uint64;
|
|
planet:string;
|
|
owner:string;
|
|
attacker:string;
|
|
production:string;
|
|
industry:float32;
|
|
population:float32;
|
|
colonists:float32;
|
|
capital:float32;
|
|
material:float32;
|
|
attack_power:float32;
|
|
wiped:bool;
|
|
}
|
|
|
|
table UnidentifiedPlanet {
|
|
x:float32;
|
|
y:float32;
|
|
number:uint64;
|
|
}
|
|
|
|
table UninhabitedPlanet {
|
|
x:float32;
|
|
y:float32;
|
|
number:uint64;
|
|
size:float32;
|
|
name:string;
|
|
resources:float32;
|
|
capital:float32;
|
|
material:float32;
|
|
}
|
|
|
|
table LocalPlanet {
|
|
x:float32;
|
|
y:float32;
|
|
number:uint64;
|
|
size:float32;
|
|
name:string;
|
|
resources:float32;
|
|
capital:float32;
|
|
material:float32;
|
|
industry:float32;
|
|
population:float32;
|
|
colonists:float32;
|
|
production:string;
|
|
free_industry:float32;
|
|
}
|
|
|
|
table OtherPlanet {
|
|
owner:string;
|
|
x:float32;
|
|
y:float32;
|
|
number:uint64;
|
|
size:float32;
|
|
name:string;
|
|
resources:float32;
|
|
capital:float32;
|
|
material:float32;
|
|
industry:float32;
|
|
population:float32;
|
|
colonists:float32;
|
|
production:string;
|
|
free_industry:float32;
|
|
}
|
|
|
|
table UnidentifiedGroup {
|
|
x:float32;
|
|
y:float32;
|
|
}
|
|
|
|
table OtherGroup {
|
|
number:uint64;
|
|
class:string;
|
|
tech:[TechEntry];
|
|
cargo:string;
|
|
load:float32;
|
|
destination:uint64;
|
|
origin:uint64 = null;
|
|
range:float32 = null;
|
|
speed:float32;
|
|
mass:float32;
|
|
race:string;
|
|
}
|
|
|
|
table LocalGroup {
|
|
number:uint64;
|
|
class:string;
|
|
tech:[TechEntry];
|
|
cargo:string;
|
|
load:float32;
|
|
destination:uint64;
|
|
origin:uint64 = null;
|
|
range:float32 = null;
|
|
speed:float32;
|
|
mass:float32;
|
|
id:common.UUID (required);
|
|
state:string;
|
|
fleet:string;
|
|
race:string;
|
|
}
|
|
|
|
table LocalFleet {
|
|
name:string;
|
|
groups:uint64;
|
|
destination:uint64;
|
|
origin:uint64 = null;
|
|
range:float32 = null;
|
|
speed:float32;
|
|
state:string;
|
|
}
|
|
|
|
// BattleSummary identifies one battle the report recipient
|
|
// participated in or could see on a planet. `planet` lets the map
|
|
// place a battle marker without fetching the full BattleReport;
|
|
// `shots` lets the marker scale its stroke with the protocol length
|
|
// (1 shot → thinnest cross, 100+ shots → maximum cross thickness).
|
|
table BattleSummary {
|
|
id:common.UUID (required);
|
|
planet:uint64;
|
|
shots:uint64;
|
|
}
|
|
|
|
table Report {
|
|
version:uint64;
|
|
turn:uint64;
|
|
width:uint32;
|
|
height:uint32;
|
|
planet_count:uint32;
|
|
race:string;
|
|
votes:float32;
|
|
vote_for:string;
|
|
player:[Player];
|
|
local_science:[Science];
|
|
other_science:[OtherScience];
|
|
local_ship_class:[ShipClass];
|
|
other_ship_class:[OthersShipClass];
|
|
battle:[BattleSummary];
|
|
bombing:[Bombing];
|
|
incoming_group:[IncomingGroup];
|
|
local_planet:[LocalPlanet];
|
|
ship_production:[ShipProduction];
|
|
route:[Route];
|
|
other_planet:[OtherPlanet];
|
|
uninhabited_planet:[UninhabitedPlanet];
|
|
unidentified_planet:[UnidentifiedPlanet];
|
|
local_fleet:[LocalFleet];
|
|
local_group:[LocalGroup];
|
|
other_group:[OtherGroup];
|
|
unidentified_group:[UnidentifiedGroup];
|
|
}
|
|
|
|
// GameReportRequest is the signed-gRPC request payload for
|
|
// `MessageTypeUserGamesReport`. Gateway transcodes this into the
|
|
// engine's `?player=&turn=` query string after resolving the caller's
|
|
// race name from the runtime player mapping; only `game_id` and `turn`
|
|
// travel on the wire.
|
|
table GameReportRequest {
|
|
game_id:common.UUID (required);
|
|
turn:uint32;
|
|
}
|
|
|
|
root_type Report;
|