diff --git a/Assets/Scripts/ServerShared/LoadoutGenerator.cs b/Assets/Scripts/ServerShared/LoadoutGenerator.cs index 044b282df..e78dc9a4f 100644 --- a/Assets/Scripts/ServerShared/LoadoutGenerator.cs +++ b/Assets/Scripts/ServerShared/LoadoutGenerator.cs @@ -92,6 +92,19 @@ public class LoadoutGenerator throw new InvalidLoadoutException("Failed to equip selected docking bay!"); } + // Every station carries a heater (operator, 2026-09-30): an idle station has no other heat source and cools + // toward freezing and invisibility. A heater is general gear whose thermostat runs its heat only below a + // target, the composition a cockpit uses: a low-pass Thermotoggle, then Heat, in its behaviours. + emptyShape = entity.UnoccupiedSpace; + var (heaterProduct, heaterData) = RandomProduct(2, item => IsHeater(item) && item.Shape.FitsWithin(emptyShape, out _, out _), required: true); + if (heaterData == null) throw new InvalidLoadoutException("No compatible heater found for station!"); + + heaterData.Shape.FitsWithin(emptyShape, out var heaterRotation, out var heaterPosition); + var heater = ItemManager.CreateInstance(heaterProduct) as EquippableItem; + heater.Rotation = heaterRotation; + if (!entity.TryEquip(heater, heaterPosition)) + throw new InvalidLoadoutException("Failed to equip selected heater!"); + FillInterior(entity); var cargo = entity.CargoBays.First(); @@ -109,6 +122,11 @@ public class LoadoutGenerator return EntitySerializer.Pack(entity) as OrbitalEntityPack; } + private static bool IsHeater(GearData item) => + item.HardpointType == HardpointType.Tool && + item.Behaviors.Any(b => b is ThermotoggleData { HighPass: false }) && + item.Behaviors.Any(b => b is HeatData); + // Every entity needs a hull, so hulls are always required public (FactionProductData product, HullData design) RandomHull(HullType type, Predicate hullFilter = null) { diff --git a/tests/Aetheria.Shared.Tests/RunStartTests.cs b/tests/Aetheria.Shared.Tests/RunStartTests.cs index a1425b251..fd0356ef9 100644 --- a/tests/Aetheria.Shared.Tests/RunStartTests.cs +++ b/tests/Aetheria.Shared.Tests/RunStartTests.cs @@ -400,6 +400,23 @@ public sealed class RunStartTests : IDisposable Assert.Empty(RunStart.Check(_items, null)); } + // A heater is gear whose thermostat runs its heat only below a target: a low-pass thermotoggle, then heat. + private static bool IsHeater(EquippedItem item) => + item.Behaviors.OfType().Any(t => !t.ThermotoggleData.HighPass) && item.Behaviors.OfType().Any(); + + // Every generated station carries exactly one heater. + [Fact] + public void EveryGeneratedStationCarriesOneHeater() + { + var zone = Arena(null); + var generator = new LoadoutGenerator(ref _items.Random, _items, _galaxy, _galaxy.Entrance, _protagonist, .5f); + for (var i = 0; i < 8; i++) + { + var station = EntitySerializer.Unpack(_items, zone, generator.GenerateStationLoadout()); + Assert.True(station.Equipment.Count(IsHeater) == 1, $"station {i} carries {station.Equipment.Count(IsHeater)} heaters"); + } + } + // 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.