Files
galaxy-game/internal/model/game/production.go
T
2026-01-20 13:33:53 +02:00

37 lines
930 B
Go

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