LANTERN purge B1: delete the automation chain (Harvester/Conveyor/Fabricator)
Deletes the M7 production systems, automation components/math, authoring, 3 machine prefabs, and 6 test files (-43 tests, 459 green). Trims the automation paths out of BaseRestoreSystem/SaveStructureScan/BuildPlaceSystem/BuildSendSystem/ HudSystem/HudTheme/StructureCatalogAuthoring/Tuning. RuntimePlacedTag (save marker, a keeper) re-homed into StructureComponents.cs. StructureType byte codes stay reserved. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,17 +6,16 @@ namespace ProjectM.Simulation
|
||||
{
|
||||
/// <summary>
|
||||
/// Scans a server world for PLAYER-built structures (<see cref="PlacedStructure"/> + <see cref="RuntimePlacedTag"/>)
|
||||
/// into the flat SaveData v2 arrays — the SINGLE shared scan used by BOTH the autosave (SaveWriteSystem) and the
|
||||
/// into the flat SaveData arrays — the SINGLE shared scan used by BOTH the autosave (SaveWriteSystem) and the
|
||||
/// quit-to-menu save (WorldLauncher), so the two paths can never drift (only RuntimePlacedTag structures are saved;
|
||||
/// anything baked into the subscene is the subscene's source of truth, not the save's). Cooldowns are stored as
|
||||
/// REMAINING ticks (epoch-independent). Managed (List/array) — runs only on a save, never in the hot loop.
|
||||
/// anything baked into the subscene is the subscene's source of truth, not the save's). Managed (List/array) —
|
||||
/// runs only on a save, never in the hot loop.
|
||||
/// </summary>
|
||||
public static class SaveStructureScan
|
||||
{
|
||||
public static void Collect(EntityManager em, uint nowTick, out StructureSave[] structures, out StructureIoRow[] io)
|
||||
{
|
||||
var structs = new List<StructureSave>();
|
||||
var ioRows = new List<StructureIoRow>();
|
||||
|
||||
using var q = em.CreateEntityQuery(
|
||||
ComponentType.ReadOnly<PlacedStructure>(),
|
||||
@@ -27,46 +26,19 @@ namespace ProjectM.Simulation
|
||||
{
|
||||
var e = entities[k];
|
||||
var ps = em.GetComponentData<PlacedStructure>(e);
|
||||
int idx = structs.Count;
|
||||
|
||||
var row = new StructureSave
|
||||
structs.Add(new StructureSave
|
||||
{
|
||||
Type = ps.Type,
|
||||
CellX = ps.Cell.x,
|
||||
CellZ = ps.Cell.y,
|
||||
RemainingTicks = ProductionMath.RemainingTicks(ps.NextTick, nowTick),
|
||||
// EB-1: guarded so automation machines (no Health) don't crash the autosave path (no try/catch).
|
||||
// EB-1: guarded so structures without Health don't crash the autosave path (no try/catch).
|
||||
HP = em.HasComponent<Health>(e) ? em.GetComponentData<Health>(e).Current : 0f,
|
||||
};
|
||||
|
||||
if (em.HasComponent<Conveyor>(e))
|
||||
row.Direction = em.GetComponentData<Conveyor>(e).Direction;
|
||||
|
||||
if (em.HasComponent<ConveyorItem>(e) && em.IsComponentEnabled<ConveyorItem>(e))
|
||||
{
|
||||
var item = em.GetComponentData<ConveyorItem>(e);
|
||||
row.ConveyorResId = item.ResourceId;
|
||||
row.ConveyorCount = item.Count;
|
||||
}
|
||||
|
||||
structs.Add(row);
|
||||
|
||||
if (em.HasBuffer<MachineInput>(e))
|
||||
{
|
||||
var buf = em.GetBuffer<MachineInput>(e, true);
|
||||
for (int i = 0; i < buf.Length; i++)
|
||||
ioRows.Add(new StructureIoRow { StructureIndex = idx, Slot = 0, ResourceId = buf[i].ResourceId, Count = buf[i].Count });
|
||||
}
|
||||
if (em.HasBuffer<MachineOutput>(e))
|
||||
{
|
||||
var buf = em.GetBuffer<MachineOutput>(e, true);
|
||||
for (int i = 0; i < buf.Length; i++)
|
||||
ioRows.Add(new StructureIoRow { StructureIndex = idx, Slot = 1, ResourceId = buf[i].ResourceId, Count = buf[i].Count });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
structures = structs.ToArray();
|
||||
io = ioRows.ToArray();
|
||||
io = System.Array.Empty<StructureIoRow>(); // machine I/O retired with the automation chain (row type dies at save v7)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user