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 <noreply@anthropic.com>
This commit is contained in:
parent
d697a77160
commit
ec505fc059
3 changed files with 22 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
{
|
||||
|
|
|
|||
20
tests/Aetheria.Shared.Tests/HullConductivityTests.cs
Normal file
20
tests/Aetheria.Shared.Tests/HullConductivityTests.cs
Normal file
|
|
@ -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}"));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue