wip: generate rest of report

This commit is contained in:
Ilia Denisov
2026-02-04 13:57:25 +02:00
parent adbe605783
commit abc98ee72f
10 changed files with 521 additions and 155 deletions
+10 -5
View File
@@ -41,13 +41,17 @@ const (
StateTransfer ShipGroupState = "Transfer_Status"
)
func (sgs ShipGroupState) String() string {
return string(sgs)
}
type InSpace struct {
Origin uint `json:"origin"`
X float64 `json:"x"`
Y float64 `json:"y"`
Origin uint `json:"origin"`
X Float `json:"x"`
Y Float `json:"y"`
// zero is for Launched status
// TODO: calculate range dynamically -BUT- if affects ShipGroup.State()
Range float64 `json:"range"`
Range Float `json:"range"`
}
func (is InSpace) Equal(other InSpace) bool {
@@ -138,6 +142,7 @@ func (sg ShipGroup) State() ShipGroupState {
}
}
// FIXME: ambigous func, refactor
func (sg ShipGroup) OnPlanet() (uint, bool) {
switch sg.State() {
case StateInOrbit:
@@ -152,7 +157,7 @@ func (sg ShipGroup) OnPlanet() (uint, bool) {
func (sg ShipGroup) Coord() (float64, float64, bool) {
state := sg.State()
if state == StateInSpace || state == StateLaunched {
return sg.StateInSpace.X, sg.StateInSpace.Y, true
return sg.StateInSpace.X.F(), sg.StateInSpace.Y.F(), true
}
return 0, 0, false
}