fix: ship production math
This commit is contained in:
committed by
Ilia Denisov
parent
9088cc77c9
commit
327f2865d4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user