Continued
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53b186388519ddb458c72bb717085721
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
using Unity.NetCode;
|
||||
|
||||
namespace ProjectM.Simulation
|
||||
{
|
||||
/// <summary>
|
||||
/// Client -> server request to upgrade the sender's ability damage one tier, spending Aether from the
|
||||
/// shared ledger. A one-off RPC. The server grows a single damage <see cref="StatModifier"/> on the
|
||||
/// player (replace-by-SourceId so the buffer stays bounded), which StatRecomputeSystem folds into
|
||||
/// EffectiveAbilityStats.Damage on both worlds — no new replicated component.
|
||||
/// </summary>
|
||||
public struct AbilityUpgradeRequest : IRpcCommand { }
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1236d3751a5740741a4a10e0a653565f
|
||||
@@ -0,0 +1,18 @@
|
||||
using Unity.NetCode;
|
||||
|
||||
namespace ProjectM.Simulation
|
||||
{
|
||||
/// <summary>
|
||||
/// Client -> server request to build a structure of <see cref="StructureType"/> at grid cell
|
||||
/// (<see cref="CellX"/>, <see cref="CellZ"/>). A one-off action, so an RPC (mirrors StorageOpRequest /
|
||||
/// RegionTransitRequest). StructureType is a byte; the cell is two int scalars (NOT an int2) to stay
|
||||
/// within the project's scalar-only RPC payload precedent (avoids first-of-its-kind composite-math-in-RPC
|
||||
/// codegen risk on Netcode 1.13.2). The server re-validates legality + cost authoritatively.
|
||||
/// </summary>
|
||||
public struct BuildPlaceRequest : IRpcCommand
|
||||
{
|
||||
public byte StructureType;
|
||||
public int CellX;
|
||||
public int CellZ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dbcc491dc3dd853459cd8cfad2458b17
|
||||
@@ -0,0 +1,24 @@
|
||||
using Unity.Collections;
|
||||
using Unity.Mathematics;
|
||||
|
||||
namespace ProjectM.Simulation
|
||||
{
|
||||
/// <summary>
|
||||
/// Pure, deterministic build-placement helpers (unit-tested like <see cref="BaseGridMath"/> /
|
||||
/// <c>StorageMath</c>). Occupancy is DERIVED from the live structure set each placement (the structure
|
||||
/// ghosts are the source of truth — restart- and replay-order-safe), never cached on the immutable
|
||||
/// baked <see cref="BaseAnchor"/>. The server passes a Temp <see cref="NativeHashSet{T}"/> of occupied
|
||||
/// cells built by scanning live <see cref="PlacedStructure"/> ghosts.
|
||||
/// </summary>
|
||||
public static class BuildPlacementMath
|
||||
{
|
||||
/// <summary>True if <paramref name="cell"/> is occupied in the derived set.</summary>
|
||||
public static bool IsOccupied(in NativeHashSet<int2> occupied, int2 cell) => occupied.Contains(cell);
|
||||
|
||||
/// <summary>Full server placement legality: the cell is in-plot (half-open, negative-safe) AND not occupied.</summary>
|
||||
public static bool CanPlace(in BaseAnchor anchor, in NativeHashSet<int2> occupied, int2 cell)
|
||||
{
|
||||
return BaseGridMath.IsCellInPlot(anchor, cell) && !occupied.Contains(cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 203dcbd4f9cc089408633b0bb6ccb2c1
|
||||
@@ -0,0 +1,75 @@
|
||||
using Unity.Entities;
|
||||
using Unity.Mathematics;
|
||||
using Unity.NetCode;
|
||||
|
||||
namespace ProjectM.Simulation
|
||||
{
|
||||
/// <summary>
|
||||
/// Structure type ids (a byte, not an enum, per the cross-assembly enum-in-Burst hazard). Turret is the
|
||||
/// first concrete structure; Harvester/Fabricator/Conveyor are RESERVED now (free) for the M7 automation
|
||||
/// pillar (production chains) so adding them later is purely additive.
|
||||
/// </summary>
|
||||
public static class StructureType
|
||||
{
|
||||
public const byte None = 0;
|
||||
public const byte Turret = 1;
|
||||
// Reserved for M7 automation — do not reuse these codes:
|
||||
public const byte Harvester = 2;
|
||||
public const byte Fabricator = 3;
|
||||
public const byte Conveyor = 4;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A built base structure occupying one grid cell. An ownerless INTERPOLATED ghost (RegionTag{Base},
|
||||
/// world-owned, runtime-spawned by BuildPlaceSystem). <see cref="Type"/> is the only replicated field
|
||||
/// (a cheap byte for client visual branching); <see cref="Cell"/> is server-only (clients derive it from
|
||||
/// the replicated LocalTransform via <see cref="BaseGridMath.WorldToCell"/>, so it stays off the wire).
|
||||
/// <see cref="NextTick"/> / <see cref="LastProcessedTick"/> are server-only raw NetworkTick values
|
||||
/// (<see cref="TickUtil.NonZero"/>-guarded; 0 = inactive): the Turret reuses <see cref="NextTick"/> as its
|
||||
/// fire cooldown NOW (not dead weight), and M7 production reuses both as the next-production-tick +
|
||||
/// deterministic offline catch-up linchpin (produced = floor((now - LastProcessedTick)/period)). These two
|
||||
/// tick fields are the IDENTITY/TIMING that cannot be reconstructed retroactively, so they are baked now.
|
||||
/// </summary>
|
||||
public struct PlacedStructure : IComponentData
|
||||
{
|
||||
/// <summary>Structure type (see <see cref="StructureType"/>); the only replicated field.</summary>
|
||||
[GhostField] public byte Type;
|
||||
|
||||
/// <summary>Occupied grid cell (server-only; clients derive it from LocalTransform).</summary>
|
||||
public int2 Cell;
|
||||
|
||||
/// <summary>Next action tick (server-only; turret cooldown now / next production tick in M7). 0 = inactive.</summary>
|
||||
public uint NextTick;
|
||||
|
||||
/// <summary>Last tick this structure was processed (server-only; M7 offline-catch-up baseline). Stamped at spawn.</summary>
|
||||
public uint LastProcessedTick;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A buildable defense turret (the first structure). Hitscan: <c>TurretFireSystem</c> applies a direct
|
||||
/// <c>DamageEvent</c> to the nearest in-range living Husk on cooldown (reusing
|
||||
/// <see cref="PlacedStructure.NextTick"/>) — reuses HealthApplyDamageSystem, no projectile/friendly-fire.
|
||||
/// </summary>
|
||||
public struct Turret : IComponentData
|
||||
{
|
||||
public float Range;
|
||||
public int CooldownTicks;
|
||||
public float Damage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// One row of the build catalog: cost + prefab per structure type. Modeled on AbilityPrefabElement
|
||||
/// (prefab baked via GetEntity, NEVER inside a blob — blobs don't remap entity refs). M7 adds a recipe
|
||||
/// column to this element additively (the catalog is baked, not replicated → no format break).
|
||||
/// </summary>
|
||||
public struct StructureCatalogEntry : IBufferElementData
|
||||
{
|
||||
public byte Type;
|
||||
public Entity Prefab;
|
||||
public byte CostResourceId;
|
||||
public int CostAmount;
|
||||
}
|
||||
|
||||
/// <summary>Tag on the baked singleton carrying the <see cref="StructureCatalogEntry"/> buffer (the build cost/prefab table).</summary>
|
||||
public struct StructureCatalog : IComponentData { }
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00d3379caf4807d4ebd97432848dd5d5
|
||||
@@ -0,0 +1,20 @@
|
||||
using Unity.Entities;
|
||||
using Unity.NetCode;
|
||||
|
||||
namespace ProjectM.Simulation
|
||||
{
|
||||
/// <summary>
|
||||
/// Long-arc progress toward the goal ("reach THEM"). Lives on the GLOBAL CycleDirector ghost (relevant in
|
||||
/// every region, alongside CycleState + the resource ledger), so it is visible to all players regardless
|
||||
/// of region. SINGLE writer: <c>CyclePhaseSystem</c> increments <see cref="Charge"/> on each completed
|
||||
/// cycle (Build -> Expedition). The HUD observes it for a progress bar.
|
||||
/// </summary>
|
||||
public struct GoalProgress : IComponentData
|
||||
{
|
||||
/// <summary>Accumulated progress.</summary>
|
||||
[GhostField] public int Charge;
|
||||
|
||||
/// <summary>Charge required to reach the goal.</summary>
|
||||
[GhostField] public int Target;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1f60b3396850074ca0e44b831b5980c
|
||||
Reference in New Issue
Block a user