tests: produce on planets, unload on routes
This commit is contained in:
@@ -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]
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user