From ec505fc059208dcb64fabe7e88269d0a90d5e707 Mon Sep 17 00:00:00 2001 From: soul Date: Sat, 28 Nov 2026 16:30:19 +0100 Subject: [PATCH] Every hull conducts heat from construction: Entity.MapEntity owns a fresh hull's conductivity Loadouts.Materialize (scenario fits, presets, boss loadouts) never set HullConductivity, so an authored hull was insulated on every edge; only LoadoutGenerator.EquipHardpoints set it. MapEntity now sets every hull cell conducting and the generator's loop is deleted. A saved ship's edges (EntitySerializer.Unpack) and the inventory toggles overwrite it as before. Co-Authored-By: Claude Sonnet 5.5 --- Assets/Scripts/ServerShared/Entity.cs | 2 ++ .../Scripts/ServerShared/LoadoutGenerator.cs | 1 - .../HullConductivityTests.cs | 20 +++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 tests/Aetheria.Shared.Tests/HullConductivityTests.cs diff --git a/Assets/Scripts/ServerShared/Entity.cs b/Assets/Scripts/ServerShared/Entity.cs index 1da2d7ade..c85756213 100644 --- a/Assets/Scripts/ServerShared/Entity.cs +++ b/Assets/Scripts/ServerShared/Entity.cs @@ -1422,6 +1422,8 @@ public abstract class Entity } } var cellCount = hullData.Shape.Coordinates.Length; + // A hull conducts heat on every edge from construction; the player insulates an edge, a saved ship's edges overwrite this. + foreach (var v in hullData.Shape.Coordinates) HullConductivity[v.x, v.y] = true; foreach (var v in hullData.Shape.Coordinates) { Armor[v.x, v.y] = hullData.Armor; diff --git a/Assets/Scripts/ServerShared/LoadoutGenerator.cs b/Assets/Scripts/ServerShared/LoadoutGenerator.cs index 5bec63b34..be77cadf5 100644 --- a/Assets/Scripts/ServerShared/LoadoutGenerator.cs +++ b/Assets/Scripts/ServerShared/LoadoutGenerator.cs @@ -403,7 +403,6 @@ public class LoadoutGenerator private void EquipHardpoints(Entity entity) { var hullData = ItemManager.GetData(entity.Hull) as HullData; - foreach (var v in hullData.Shape.Coordinates) entity.HullConductivity[v.x, v.y] = true; var previousProducts = new List<(FactionProductData product, GearData design)>(); foreach (var hardpoint in hullData.Hardpoints.OrderByDescending(h=>h.Shape.Coordinates.Length)) { diff --git a/tests/Aetheria.Shared.Tests/HullConductivityTests.cs b/tests/Aetheria.Shared.Tests/HullConductivityTests.cs new file mode 100644 index 000000000..12a75a0c1 --- /dev/null +++ b/tests/Aetheria.Shared.Tests/HullConductivityTests.cs @@ -0,0 +1,20 @@ +using System.Linq; +using Xunit; + +// A hull conducts heat on every edge from construction (Entity.MapEntity), so a fit a scenario authors, a hand-built ship and a +// generated one all start where the generator's own ships always did; only the player's insulation toggle or a saved ship's edges change it. +public sealed partial class RunStartTests +{ + // The Duel fit goes through Loadouts.Materialize, which never wrote conductivity. Kills: MapEntity leaving the grid all-false + // (an authored hull insulated on every edge, as at the base: 0-2 rocks a sortie against 1-33 conducting). + [Fact] + public void AMaterializedHullConductsOnEveryEdge() + { + var (_, _, staged, failures) = Launch(new Duel(), Inputs(() => GalaxySeed)); + Assert.True(failures.Count == 0, string.Join("; ", failures)); + var ship = staged.Player; + var cells = ship.HullData.Shape.Coordinates; + Assert.NotEmpty(cells); + Assert.All(cells, v => Assert.True(ship.HullConductivity[v.x, v.y].x && ship.HullConductivity[v.x, v.y].y, $"cell {v}")); + } +}