Stations: a station reactor, so the heater has power

Operator ruling, 2026-09-30: "Yep, we need a station reactor." Zenith's 16-cell
Reactor hardpoint had no design to fill it, so generated stations had no power.
A transient `AetherDb station-reactor [apply]` authored it from Manhattan, the
largest and most industrial reactor, scaled by cells (16/9):

  Station Reactor (GearData, Reactor hardpoint, full 4x4)
    mass 500 -> 888.9, price 750,000 -> 1,350,000 (to the nearest 50,000),
    charge 500..1000 -> 888.9..1777.8; every other value, the efficiency,
    overload and throttling stats and all stat terms, the roles (core,
    regulator), temperatures, durability and sound bank are Manhattan's.
  Product "Station Reactor" by Zhestokost (Manhattan's maker), default role
  quality.

Station generation fills the slot through its ordinary hardpoint pass. Tests:
every generated station carries one heater and a reactor; an idle station (a
quiet arena, nothing else running) holds its heater's cells above freezing over
the second five of ten minutes (unpowered they fell to ~247 K); a station hull
with no room for a heater fails generation by name instead of skipping it
(Soul's S11 survived before).

The station's border cells still sit near 265 K with the heater and reactor
running (the reactor core reaches ~433 K); how warm the whole hull should run
is left as a tuning question.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-30 18:01:32 +02:00
commit b3e7995ceb
3 changed files with 118 additions and 5 deletions

BIN
GameData/Aetheria.cc (Stored with Git LFS)

Binary file not shown.

View file

@ -404,9 +404,9 @@ public sealed class RunStartTests : IDisposable
private static bool IsHeater(EquippedItem item) =>
item.Behaviors.OfType<Thermotoggle>().Any(t => !t.ThermotoggleData.HighPass) && item.Behaviors.OfType<Heat>().Any();
// Every generated station carries exactly one heater.
// Every generated station carries exactly one heater, and a reactor to power it.
[Fact]
public void EveryGeneratedStationCarriesOneHeater()
public void EveryGeneratedStationCarriesOneHeaterAndAReactor()
{
var zone = Arena(null);
var generator = new LoadoutGenerator(ref _items.Random, _items, _galaxy, _galaxy.Entrance, _protagonist, .5f);
@ -414,9 +414,54 @@ public sealed class RunStartTests : IDisposable
{
var station = EntitySerializer.Unpack(_items, zone, generator.GenerateStationLoadout());
Assert.True(station.Equipment.Count(IsHeater) == 1, $"station {i} carries {station.Equipment.Count(IsHeater)} heaters");
Assert.True(station.Equipment.Any(item => item.Behaviors.OfType<Reactor>().Any()), $"station {i} has no reactor");
}
}
private const float Freezing = 273.15f;
// An idle station, powered by its reactor, holds its heater's cells (where the thermostat reads) above freezing
// over the second five of ten idle minutes. Unpowered, they cool from 280 K to about 247 K in that time. (The
// station's border cells still sit near 265 K; how warm the whole hull should run is a tuning question.)
[Fact]
public void AnIdleStationStaysAboveFreezing()
{
var zone = Arena(new Scenario { Ambient = false }); // no ships: nothing but the zone runs
var station = zone.Entities.First(entity => entity is OrbitalEntity && entity.DockingBays.Count > 0);
var heater = station.Equipment.Single(IsHeater);
var coldest = float.MaxValue;
for (var tick = 0; tick < 6000; tick++)
{
zone.Update(.1f);
if (tick >= 3000) coldest = min(coldest, heater.Temperature);
}
Assert.True(coldest > Freezing, $"the heater's cells fell to {coldest} K (station now {station.MinTemp}..{station.MaxTemp} K)");
}
// A station hull with no room left for a heater fails its generation by name, rather than spawning a station
// that will freeze. The only station hull on offer is one whose interior takes the smallest docking bay and no more.
[Fact]
public void AStationWithNoRoomForAHeaterFailsLoudly()
{
var sold = _cache.GetAll<FactionProductData>().Select(product => product.Design.Key).ToHashSet();
var bay = _cache.GetAll<DockingBayData>().Where(design => sold.Contains(_cache.RefOf(design).Key))
.OrderBy(design => design.Shape.Coordinates.Length).ThenBy(design => design.Name, StringComparer.Ordinal).First();
var shape = new Shape(bay.Shape.Width + 2, bay.Shape.Height + 2);
foreach (var cell in shape.AllCoordinates) shape[cell] = true;
var cramped = new HullData { Name = "Cramped Station", HullType = HullType.Station, Shape = shape, Durability = 100, Mass = 1000, Price = 1 };
_cache.Upsert(cramped);
_cache.Upsert(new FactionProductData
{
Name = "Cramped Station", Design = new CultRecordRef<CraftedItemData>(_cache.RefOf(cramped).Key), Manufacturer = _cache.RefOf(_protagonist)
});
foreach (var hull in _cache.GetAll<HullData>().Where(hull => hull.HullType == HullType.Station && hull != cramped))
hull.Price = 0; // generation offers no zero-price design, so the cramped hull is the only station
var generator = new LoadoutGenerator(ref _items.Random, _items, _galaxy, _galaxy.Entrance, _protagonist, .5f);
var failure = Assert.Throws<InvalidLoadoutException>(() => generator.GenerateStationLoadout());
Assert.Contains("heater", failure.Message);
}
// Q3, with the operator's 2026-09-30 ruling on the ten product-less designs: a design no product sells is a
// scenario test design and nothing else. A test design is one a scenario places: its preset's hull or a slot of
// it, or cargo it carries. These are the unsold designs no scenario places, by name.

View file

@ -37,8 +37,9 @@ public static class Program
case "targeting-catalog-6c": return TargetingCatalog6c(args.Contains("apply"));
case "targeting-catalog-6d": return TargetingCatalog6d(args.Contains("apply"));
case "product-gap": return ProductGap(args.Contains("apply"));
case "station-reactor": return StationReactor(args.Contains("apply"));
default:
Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, loadout [seed], save, settings, settings-dump, dangling [clear <Type.Member>]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], targeting-catalog [apply], targeting-catalog-6c [apply], targeting-catalog-6d [apply], product-gap [apply]");
Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, loadout [seed], save, settings, settings-dump, dangling [clear <Type.Member>]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], targeting-catalog [apply], targeting-catalog-6c [apply], targeting-catalog-6d [apply], product-gap [apply], station-reactor [apply]");
return 1;
}
}
@ -1555,4 +1556,71 @@ public static class Program
Console.WriteLine($"\nLanded {industrial.Length} deletions, {made.Length} products and the heater's price and durability in Aetheria.cc");
return 0;
}
// Scenarios map, operator ruling 2026-09-30 ("Yep, we need a station reactor"): Zenith's 16-cell Reactor hardpoint
// had no design to fill it, so generated stations had no power and their heater never ran. The station reactor is
// Manhattan, the largest and most industrial reactor, scaled to the slot: a full 4x4, its charge, mass and price
// times 16/9 (its cells over Manhattan's), every other value and stat term Manhattan's own, sold by Manhattan's maker.
private static int StationReactor(bool apply)
{
var db = AetherDb.Open(catalogWritable: apply);
var cache = db.Cache;
if (cache.GetAll<GearData>().Any(d => d.Name == "Station Reactor")) throw new InvalidOperationException("Station Reactor already exists.");
var manhattan = cache.GetAll<GearData>().Single(d => d.Name == "Manhattan");
var manhattanProduct = cache.GetAll<FactionProductData>().Single(p => p.Design.Key.Equals(cache.RefOf(manhattan).Key));
const float scale = 16f / 9f;
var shape = new Shape(4, 4);
foreach (var cell in shape.AllCoordinates) shape[cell] = true;
var design = new GearData
{
Name = "Station Reactor",
Description = "A reactor sized for a station's core.",
Hardpoint = HardpointType.Reactor,
Shape = shape,
Mass = manhattan.Mass * scale,
Price = (int) Math.Round(manhattan.Price * scale / 50000) * 50000,
SpecificHeat = manhattan.SpecificHeat,
Conductivity = manhattan.Conductivity,
Durability = manhattan.Durability,
MinimumTemperature = manhattan.MinimumTemperature,
MaximumTemperature = manhattan.MaximumTemperature,
OptimalTemperature = manhattan.OptimalTemperature,
PlateauWidth = manhattan.PlateauWidth,
ThermalResilience = manhattan.ThermalResilience,
SoundBank = manhattan.SoundBank,
Roles = manhattan.Roles.Select(role => new ItemRole { Name = role.Name }).ToList(),
Behaviors = MessagePack.MessagePackSerializer.Deserialize<List<BehaviorData>>(MessagePack.MessagePackSerializer.Serialize(manhattan.Behaviors)),
};
var reactor = design.Behaviors.OfType<ReactorData>().Single();
reactor.Charge.Min *= scale;
reactor.Charge.Max *= scale;
var product = new FactionProductData
{
Name = "Station Reactor",
Description = "",
Manufacturer = manhattanProduct.Manufacturer,
Roles = design.Roles.Select(role => new ProductRole { Role = role.Name }).ToList(),
};
Console.WriteLine($"Station Reactor, from Manhattan x {scale:F3}: shape 4x4 (16), mass {manhattan.Mass} -> {design.Mass}, " +
$"price {manhattan.Price} -> {design.Price}, charge {reactor.Charge.Min / scale}..{reactor.Charge.Max / scale} -> {reactor.Charge.Min}..{reactor.Charge.Max}; " +
$"product by {cache.Get(product.Manufacturer).Name}");
if (!apply)
{
Console.WriteLine("\nDry run. Pass \"apply\" to land it.");
return 0;
}
CultRecordRefs.Validate(design);
var key = new CultRecordKey(Guid.NewGuid().ToString("N"));
product.Design = new CultRecordRef<CraftedItemData>(key);
cache.Commit(batch =>
{
batch.Upsert(typeof(GearData), design, key);
batch.Upsert(typeof(FactionProductData), product, new CultRecordKey(Guid.NewGuid().ToString("N")));
});
Console.WriteLine("\nLanded the Station Reactor and its product in Aetheria.cc");
return 0;
}
}