tests: produce on planets, unload on routes

This commit is contained in:
Ilia Denisov
2026-01-23 00:28:23 +02:00
parent 9825e05c0e
commit 812e0d4afd
15 changed files with 522 additions and 103 deletions
+16 -1
View File
@@ -81,6 +81,22 @@ func (c *Cache) DeleteScience(ri int, name string) error {
return nil
}
func ResearchTech(r *game.Race, indCapacity float64, drive, weapons, shields, cargo float64) {
increment := indCapacity / 5000.
if drive > 0 {
r.Tech = r.Tech.Set(game.TechDrive, r.Tech.Value(game.TechDrive)+increment*drive)
}
if weapons > 0 {
r.Tech = r.Tech.Set(game.TechWeapons, r.Tech.Value(game.TechWeapons)+increment*weapons)
}
if shields > 0 {
r.Tech = r.Tech.Set(game.TechShields, r.Tech.Value(game.TechShields)+increment*shields)
}
if cargo > 0 {
r.Tech = r.Tech.Set(game.TechCargo, r.Tech.Value(game.TechCargo)+increment*cargo)
}
}
// Internal func
func (c *Cache) raceScience(ri int) []game.Science {
@@ -96,5 +112,4 @@ func (c *Cache) mustScience(ri int, id uuid.UUID) *game.Science {
panic(fmt.Sprintf("science not found for race=%q id=%v", r.Name, id))
}
return &c.g.Race[ri].Sciences[i]
}