M7 Automation: deterministic Harvester to Conveyor to Fabricator chains
Server-only production chains (never predicted): components + server systems + pure byte-only math (ProductionMath/ConveyorMath/MachineSlotMath), authoring + 3 machine prefabs wired into the Gameplay subscene, StructureCatalog rows, BuildPlace Direction/RuntimePlacedTag, Tuning, and 35 EditMode tests (catch-up gating, conveyor shuffle-invariance, SaveData v2 round-trip). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using ProjectM.Simulation;
|
||||
using Unity.Entities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ProjectM.Authoring
|
||||
{
|
||||
/// <summary>
|
||||
/// Authoring for a Harvester machine ghost prefab (duplicate a structure ghost so the ownerless interpolated
|
||||
/// GhostAuthoringComponent comes free). Bakes <see cref="PlacedStructure"/>{Type=Harvester} + <see cref="Harvester"/>
|
||||
/// stats + an empty <see cref="MachineOutput"/> buffer. BuildPlaceSystem stamps the Cell at placement; the
|
||||
/// production system initializes the tick baseline on first encounter (NextTick/LastProcessedTick baked 0).
|
||||
/// </summary>
|
||||
public class HarvesterAuthoring : MonoBehaviour
|
||||
{
|
||||
[Tooltip("Resource id this generator produces (1=Aether, 2=Ore, 3=Biomass).")]
|
||||
public byte OutputResourceId = 2; // Ore
|
||||
[Min(1)] public int Yield = 1;
|
||||
[Min(1)] public int PeriodTicks = 60;
|
||||
|
||||
private class HarvesterBaker : Baker<HarvesterAuthoring>
|
||||
{
|
||||
public override void Bake(HarvesterAuthoring authoring)
|
||||
{
|
||||
var entity = GetEntity(authoring, TransformUsageFlags.Dynamic);
|
||||
AddComponent(entity, new PlacedStructure
|
||||
{
|
||||
Type = StructureType.Harvester,
|
||||
Cell = default,
|
||||
NextTick = 0u,
|
||||
LastProcessedTick = 0u,
|
||||
});
|
||||
AddComponent(entity, new Harvester
|
||||
{
|
||||
ResourceId = authoring.OutputResourceId,
|
||||
Yield = authoring.Yield,
|
||||
PeriodTicks = authoring.PeriodTicks,
|
||||
});
|
||||
AddBuffer<MachineOutput>(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user