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:
@@ -10,13 +10,11 @@ namespace ProjectM.Server
|
||||
{
|
||||
/// <summary>
|
||||
/// One-shot server restore of player-built structures for a "Continue" session. The menu (WorldLauncher) stages a
|
||||
/// <see cref="PendingStructure"/>/<see cref="PendingStructureIo"/> carrier in the fresh ServerWorld BEFORE the
|
||||
/// gameplay subscene streams; this system waits (RequireForUpdate) for the streamed <see cref="StructureCatalog"/>
|
||||
/// + <see cref="BaseAnchor"/> + a valid NetworkTime, then replays each saved structure CHARGE-FREE: Instantiate the
|
||||
/// catalog prefab at the saved cell (preserving the baked Scale), re-stamp the rebased tick fields
|
||||
/// (<see cref="ProductionMath.RestoreNextTick"/>; LastProcessed = now so within-session catch-up resumes from now,
|
||||
/// never a wall-clock mint), re-tag RegionTag{Base} + RuntimePlacedTag, refill the in-flight conveyor item + the
|
||||
/// machine I/O buffers, then DESTROY the carrier so it never runs again. The ledger/goal restore separately +
|
||||
/// <see cref="PendingStructure"/> carrier in the fresh ServerWorld BEFORE the gameplay subscene streams; this
|
||||
/// system waits (RequireForUpdate) for the streamed <see cref="StructureCatalog"/> + <see cref="BaseAnchor"/> +
|
||||
/// a valid NetworkTime, then replays each saved structure CHARGE-FREE: Instantiate the catalog prefab at the
|
||||
/// saved cell (preserving the baked Scale), restore the wounded HP born-correct, re-tag RegionTag{Base} +
|
||||
/// RuntimePlacedTag, then DESTROY the carrier so it never runs again. The ledger restores separately +
|
||||
/// absolutely via CycleDirectorSpawnSystem's born-correct load (no double-spend, no Withdraw here).
|
||||
/// </summary>
|
||||
[BurstCompile]
|
||||
@@ -24,14 +22,12 @@ namespace ProjectM.Server
|
||||
public partial struct BaseRestoreSystem : ISystem
|
||||
{
|
||||
ComponentLookup<LocalTransform> m_TransformLookup;
|
||||
ComponentLookup<Conveyor> m_ConveyorLookup;
|
||||
ComponentLookup<Health> m_HealthLookup;
|
||||
|
||||
[BurstCompile]
|
||||
public void OnCreate(ref SystemState state)
|
||||
{
|
||||
m_TransformLookup = state.GetComponentLookup<LocalTransform>(isReadOnly: true);
|
||||
m_ConveyorLookup = state.GetComponentLookup<Conveyor>(isReadOnly: true);
|
||||
m_HealthLookup = state.GetComponentLookup<Health>(isReadOnly: true);
|
||||
state.RequireForUpdate<StructureCatalog>();
|
||||
state.RequireForUpdate<BaseAnchor>();
|
||||
@@ -48,7 +44,6 @@ namespace ProjectM.Server
|
||||
uint now = serverTick.TickIndexForValidTick;
|
||||
|
||||
m_TransformLookup.Update(ref state);
|
||||
m_ConveyorLookup.Update(ref state);
|
||||
m_HealthLookup.Update(ref state);
|
||||
|
||||
var anchor = SystemAPI.GetSingleton<BaseAnchor>();
|
||||
@@ -56,8 +51,8 @@ namespace ProjectM.Server
|
||||
|
||||
var ecb = new EntityCommandBuffer(Allocator.Temp);
|
||||
|
||||
foreach (var (pending, ioBuf, carrier) in
|
||||
SystemAPI.Query<DynamicBuffer<PendingStructure>, DynamicBuffer<PendingStructureIo>>().WithEntityAccess())
|
||||
foreach (var (pending, carrier) in
|
||||
SystemAPI.Query<DynamicBuffer<PendingStructure>>().WithEntityAccess())
|
||||
{
|
||||
for (int s = 0; s < pending.Length; s++)
|
||||
{
|
||||
@@ -81,12 +76,12 @@ namespace ProjectM.Server
|
||||
{
|
||||
Type = p.Type,
|
||||
Cell = cell,
|
||||
NextTick = ProductionMath.RestoreNextTick(now, p.RemainingTicks),
|
||||
NextTick = 0u, // cooldown restore retired with the automation chain (LANTERN purge)
|
||||
LastProcessedTick = TickUtil.NonZero(now),
|
||||
});
|
||||
// EB-1: restore the wounded HP born-correct in the SAME ecb as Instantiate (Health.Current is a
|
||||
// [GhostField]; a deferred set would leak baked Max to clients for one snapshot). Max + the
|
||||
// 0->full fallback come from the BAKED prefab, never the save. Automation machines lack Health.
|
||||
// 0->full fallback come from the BAKED prefab, never the save.
|
||||
if (m_HealthLookup.HasComponent(prefab))
|
||||
{
|
||||
var hm = m_HealthLookup[prefab];
|
||||
@@ -94,35 +89,6 @@ namespace ProjectM.Server
|
||||
}
|
||||
ecb.AddComponent(structure, new RegionTag { Region = RegionId.Base });
|
||||
ecb.AddComponent<RuntimePlacedTag>(structure);
|
||||
|
||||
if (p.Type == StructureType.Conveyor && m_ConveyorLookup.HasComponent(prefab))
|
||||
{
|
||||
var conv = m_ConveyorLookup[prefab];
|
||||
conv.Direction = p.Direction;
|
||||
ecb.SetComponent(structure, conv);
|
||||
ecb.SetComponent(structure, new ConveyorItem { ResourceId = p.ConveyorResId, Count = p.ConveyorCount });
|
||||
ecb.SetComponentEnabled<ConveyorItem>(structure, p.ConveyorCount > 0);
|
||||
}
|
||||
|
||||
// Refill machine I/O buffers from the flat io table (only slots with saved rows -> the prefab has them).
|
||||
bool inInit = false, outInit = false;
|
||||
DynamicBuffer<MachineInput> inBuf = default;
|
||||
DynamicBuffer<MachineOutput> outBuf = default;
|
||||
for (int r = 0; r < ioBuf.Length; r++)
|
||||
{
|
||||
if (ioBuf[r].StructureIndex != s)
|
||||
continue;
|
||||
if (ioBuf[r].Slot == 0)
|
||||
{
|
||||
if (!inInit) { inBuf = ecb.SetBuffer<MachineInput>(structure); inInit = true; }
|
||||
inBuf.Add(new MachineInput { ResourceId = ioBuf[r].ResourceId, Count = ioBuf[r].Count });
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!outInit) { outBuf = ecb.SetBuffer<MachineOutput>(structure); outInit = true; }
|
||||
outBuf.Add(new MachineOutput { ResourceId = ioBuf[r].ResourceId, Count = ioBuf[r].Count });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ecb.DestroyEntity(carrier);
|
||||
|
||||
Reference in New Issue
Block a user