fix: ship production math

This commit is contained in:
IliaDenisov
2026-02-05 21:35:13 +03:00
committed by Ilia Denisov
parent 9088cc77c9
commit 327f2865d4
10 changed files with 158 additions and 205 deletions
+13
View File
@@ -83,6 +83,19 @@ func PlanetProduction(industry, population float64) float64 {
return industry*0.75 + population*0.25
}
func (p *Planet) ReleaseMaterial(shipMass float64) {
if p.Production.Type != ProductionShip || p.Production.Progress == nil {
panic("planet is not producing any ships")
}
p.Material = p.Material.Add(ProducedMaterial(shipMass, float64(*p.Production.Progress)))
p.Production.Progress = new(Float)
p.Production.ProdUsed = new(Float)
}
func ProducedMaterial(shipMass, progress float64) float64 {
return shipMass * progress
}
// Производство промышленности
// TODO: test on real values
// [x] ind * 5 + ind / res = prod