feat: moge groups in hyperspace

This commit is contained in:
Ilia Denisov
2026-01-18 22:38:11 +02:00
parent 741a5f726b
commit bd9db26ef4
12 changed files with 273 additions and 20 deletions
+9 -1
View File
@@ -47,7 +47,7 @@ type InSpace struct {
X float64 `json:"x"`
Y float64 `json:"y"`
// zero is for Launched status
// TODO: calculate range dynamically
// TODO: calculate range dynamically -BUT- if affects ShipGroup.State()
Range float64 `json:"range"`
}
@@ -154,6 +154,14 @@ 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 0, 0, false
}
func (sg ShipGroup) Equal(other ShipGroup) bool {
return sg.OwnerID == other.OwnerID &&
sg.TypeID == other.TypeID &&