Files
galaxy-game/pkg/model/game/production.go
T
2025-10-01 00:29:25 +03:00

34 lines
911 B
Go

package game
import "github.com/google/uuid"
type PlanetProduction string
const (
ProductionNone PlanetProduction = "-"
ProductionMaterial PlanetProduction = "MAT" // Сырьё
ProductionCapital PlanetProduction = "CAP" // Промышленность
ResearchDrive PlanetProduction = "DRIVE"
ResearchWeapons PlanetProduction = "WEAPONS"
ResearchShields PlanetProduction = "SHIELDS"
ResearchCargo PlanetProduction = "CARGO"
ResearchScience PlanetProduction = "SCIENCE"
ProductionShip PlanetProduction = "SHIP"
)
type ProductionType struct {
Production PlanetProduction `json:"type"`
SubjectID *uuid.UUID `json:"subjectId"`
}
func (p PlanetProduction) AsType(subject uuid.UUID) ProductionType {
switch p {
case ResearchScience, ProductionShip:
return ProductionType{Production: p, SubjectID: &subject}
default:
return ProductionType{Production: p, SubjectID: nil}
}
}