42 lines
1.8 KiB
C#
42 lines
1.8 KiB
C#
using Unity.Entities;
|
|
using Unity.NetCode;
|
|
|
|
namespace ProjectM.Simulation
|
|
{
|
|
/// <summary>Resource-type ids for harvested materials (a byte, not an enum, per the cross-assembly enum-in-Burst hazard).</summary>
|
|
public static class ResourceId
|
|
{
|
|
/// <summary>Unused / empty sentinel (aligns with StorageMath's 0-itemId no-op).</summary>
|
|
public const byte None = 0;
|
|
|
|
/// <summary>Magic energy — powers abilities / charging.</summary>
|
|
public const byte Aether = 1;
|
|
|
|
/// <summary>Raw ore — structures / building.</summary>
|
|
public const byte Ore = 2;
|
|
|
|
/// <summary>Biomass — misc / crafting.</summary>
|
|
public const byte Biomass = 3;
|
|
}
|
|
|
|
/// <summary>
|
|
/// A harvestable resource node in the procedural expedition field — an ownerless INTERPOLATED ghost
|
|
/// (region-tagged Expedition) that clients see and shoot. The server-only ResourceHarvestSystem sweeps
|
|
/// projectiles against it; each hit deposits <see cref="HarvestPerHit"/> of <see cref="ResourceId"/> into
|
|
/// the GLOBAL resource ledger and decrements <see cref="Remaining"/>; the node despawns at <= 0.
|
|
/// ResourceId/Remaining are [GhostField] so clients can tint by type and (later) show depletion;
|
|
/// HarvestPerHit is baked, server-only.
|
|
/// </summary>
|
|
public struct ResourceNode : IComponentData
|
|
{
|
|
/// <summary>Which resource this node yields (see <see cref="ResourceId"/>).</summary>
|
|
[GhostField] public byte ResourceId;
|
|
|
|
/// <summary>Remaining resource units; the node despawns when this reaches 0.</summary>
|
|
[GhostField] public int Remaining;
|
|
|
|
/// <summary>Units yielded per projectile hit (baked; server-only).</summary>
|
|
public float HarvestPerHit;
|
|
}
|
|
}
|