support multi-module (#4)

* add multimodule
* re-package modules
This commit is contained in:
Ilia Denisov
2026-02-22 08:57:19 +02:00
committed by GitHub
parent 9e36d7151e
commit 8f982278d2
132 changed files with 317 additions and 191 deletions
+43
View File
@@ -0,0 +1,43 @@
package generator
import (
"fmt"
"math/rand"
)
type PlanetClass string
const (
PlanetClassHW PlanetClass = "HW"
PlanetClassDW PlanetClass = "DW"
PlanetClassGiant PlanetClass = "Giant"
PlanetClassBig PlanetClass = "Big"
PlanetClassNormal PlanetClass = "Normal"
PlanetClassRich PlanetClass = "Rich"
PlanetClassAsterioid PlanetClass = "Asteroid"
)
type Planet struct {
PlanetClass PlanetClass
Position Coordinate
Size float64
Resources float64 // Сырьё
}
type PlanetarySystem struct {
HW Planet
DW []Planet
}
func (p Planet) RandomName() string {
return fmt.Sprintf("%s-%04d-%04d", p.PlanetClass, rand.Intn(1000), rand.Intn(1000))
}
func NewPlanet(pc PlanetClass, c Coordinate, size, resources float64) Planet {
return Planet{
PlanetClass: pc,
Position: c,
Size: size,
Resources: resources,
}
}