refactor: planet industry production

This commit is contained in:
Ilia Denisov
2026-02-08 20:12:27 +02:00
parent b928bb2976
commit f8412be248
4 changed files with 14 additions and 37 deletions
+4 -2
View File
@@ -1,6 +1,8 @@
package game
import (
"fmt"
"github.com/google/uuid"
)
@@ -42,8 +44,8 @@ func (st ShipType) DriveBlockMass() float64 {
}
func (st ShipType) WeaponsBlockMass() float64 {
if st.Armament == 0 || st.Weapons == 0 {
return 0
if (st.Armament == 0 && st.Weapons != 0) || (st.Armament != 0 && st.Weapons == 0) {
panic(fmt.Sprintf("ship class invalid design: A=%d W=%.03f", st.Armament, st.Weapons))
}
return float64(st.Armament+1) * (st.Weapons.F() / 2)
}