EB-2: felt spend - turrets burn a shared Charge pool, ledger-fed Fabricator mints it from Ore
Mined Ore now has an ongoing sink: a ledger-fed Fabricator converts Ore->Charge (1 Ore -> 3 Charge / 30t) and turrets spend Charge per shot, soft-failing (no shot, no cooldown burn) when the shared pool runs dry. - ResourceId.Charge=4 rides the existing [GhostField] StorageEntry ledger (no new wire). - TurretFireSystem: single ledger resolve + atomic spend / soft-fail / partial-refund. - Fabricator.InputFromLedger (byte, server-only) feeds input from the shared ledger, read live in-loop so two machines split a finite pool; both modes deposit to ledger. - HudSystem: violet Charge chip + global quiet-turret cue when siege && Charge==0. - StorageMath.TotalOf backs the affordability read; catalog re-enables the Fabricator (4 entries). See DR-033. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,10 @@ namespace ProjectM.Simulation
|
||||
public byte OutResourceId;
|
||||
public int OutAmount;
|
||||
public int PeriodTicks;
|
||||
|
||||
/// <summary>EB-2: 0 = consume the input from the MachineInput buffer (the M7 conveyor chain); !=0 = consume
|
||||
/// the input from the SHARED ledger (a base-loop ledger-fed Fabricator, e.g. Ore -> Charge). Server-only, NO [GhostField].</summary>
|
||||
public byte InputFromLedger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -17,6 +17,9 @@ namespace ProjectM.Simulation
|
||||
|
||||
/// <summary>Biomass — misc / crafting.</summary>
|
||||
public const byte Biomass = 3;
|
||||
|
||||
/// <summary>EB-2 turret munition ("Charge") — a ledger-only ammo currency a ledger-fed Fabricator mints from Ore.</summary>
|
||||
public const byte Charge = 4;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -58,5 +58,18 @@ namespace ProjectM.Simulation
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>Total count of <paramref name="itemId"/> across the buffer (0 if absent / itemId 0). EB-2 ledger
|
||||
/// affordability read; mirrors MachineSlotMath.TotalOf. Pure, non-generic, Burst-safe.</summary>
|
||||
public static int TotalOf(DynamicBuffer<StorageEntry> buffer, ushort itemId)
|
||||
{
|
||||
if (itemId == 0)
|
||||
return 0;
|
||||
int total = 0;
|
||||
for (int i = 0; i < buffer.Length; i++)
|
||||
if (buffer[i].ItemId == itemId)
|
||||
total += buffer[i].Count;
|
||||
return total;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,11 @@ namespace ProjectM.Simulation
|
||||
/// catch-up after any skipped ticks; restore re-seats the baseline so this never reflects wall-clock).</summary>
|
||||
public const int MaxProductionCatchup = 600;
|
||||
|
||||
/// <summary>EB-2: Charge (turret munition) consumed per turret shot, withdrawn from the global ledger. A
|
||||
/// turret with 0 Charge SOFT-FAILS (no shot, no cooldown advance). A ledger-fed Fabricator mints Charge from
|
||||
/// Ore. Operator feel-fork: keep generous so turrets stay fed while you keep mining.</summary>
|
||||
public const int TurretChargeCostPerShot = 1;
|
||||
|
||||
// ---- Inventory (per-player bag; InventoryMath / ResourceHarvestSystem / InventoryDepositSystem) ----
|
||||
|
||||
/// <summary>Max stacks a player can carry; InventoryMath rejects deposits past this and the harvest remainder spills to the global ledger.</summary>
|
||||
|
||||
Reference in New Issue
Block a user