Scenarios Cut 1: a bare hull updates

Entity.Update walks _orderedEquipment, which only TryEquip and TryUnequip
set, so an entity nothing was ever equipped on threw a
NullReferenceException on its first tick. Scenario presets stage bare hulls
(a turret, an unpiloted target), and RunStartTests found it: MapEntity now
sets the ordered equipment to the hull alone when it adds the hull.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-30 12:52:44 +02:00
commit 72c58d365f

View file

@ -601,6 +601,8 @@ public abstract class Entity
var hullData = ItemManager.GetData(Hull) as HullData;
EquippedHull = new EquippedItem(ItemManager, Hull, int2.zero, this);
Equipment.Add(EquippedHull);
// A bare hull, one TryEquip never ran on, still updates: its ordered equipment is the hull alone.
_orderedEquipment = Equipment.ToArray();
Mass = hullData.Mass;
Temperature = new float[hullData.Shape.Width, hullData.Shape.Height];
NewTemperature = new float[hullData.Shape.Width, hullData.Shape.Height];