Functions to convert coordinate from one celestial type to another
@@ -39,3 +39,18 @@ func (c Coordinate) IsMoon() bool {
func (c Coordinate) IsDebris() bool {
return c.Type == DebrisType
}
+
+// Planet return a new coordinate with planet type
+func (c Coordinate) Planet() Coordinate {
+ return Coordinate{Galaxy: c.Galaxy, System: c.System, Position: c.Position, Type: PlanetType}
+}
+
+// Moon return a new coordinate with moon type
+func (c Coordinate) Moon() Coordinate {
+ return Coordinate{Galaxy: c.Galaxy, System: c.System, Position: c.Position, Type: MoonType}
+}
+
+// Debris return a new coordinate with debris type
+func (c Coordinate) Debris() Coordinate {
+ return Coordinate{Galaxy: c.Galaxy, System: c.System, Position: c.Position, Type: DebrisType}
+}
