Map Updates

This commit is contained in:
2026-06-04 21:49:03 -07:00
parent 16b01bec38
commit 15bc1022ee
43 changed files with 4054 additions and 62 deletions
@@ -0,0 +1,35 @@
using ProjectM.Simulation;
using Unity.Entities;
using UnityEngine;
namespace ProjectM.Authoring
{
/// <summary>
/// Generic authoring for a non-functional build-structure ghost prefab (Wall / Pylon) — duplicate
/// Turret.prefab so the ownerless interpolated GhostAuthoringComponent on PlacedStructure.Type comes free,
/// then swap TurretAuthoring for this. Bakes ONLY <see cref="PlacedStructure"/>{Type=<see cref="Kind"/>}
/// (no <see cref="Turret"/> stats, so TurretFireSystem ignores it). BuildPlaceSystem overrides Cell +
/// LastProcessedTick and adds RegionTag{Base} at placement. <see cref="Kind"/> is a byte (StructureType.*) to
/// dodge the cross-assembly enum-in-Burst hazard and the MCP enum-drop gotcha.
/// </summary>
public class StructureAuthoring : MonoBehaviour
{
[Tooltip("StructureType byte: 5 = Wall, 6 = Pylon (do NOT use 1-4: Turret + reserved M7 automation).")]
public byte Kind = StructureType.Wall;
private class StructureBaker : Baker<StructureAuthoring>
{
public override void Bake(StructureAuthoring authoring)
{
var entity = GetEntity(authoring, TransformUsageFlags.Dynamic);
AddComponent(entity, new PlacedStructure
{
Type = authoring.Kind,
Cell = default,
NextTick = 0u,
LastProcessedTick = 0u,
});
}
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3f03349205fb1fe43bf6aaff14fce0b7
@@ -20,6 +20,18 @@ namespace ProjectM.Authoring
[Tooltip("Ore cost to build a turret.")]
[Min(0)] public int TurretCostOre = 10;
[Tooltip("Wall structure ghost prefab (StructureAuthoring{Wall} + GhostAuthoring).")]
public GameObject WallPrefab;
[Tooltip("Ore cost to build a wall.")]
[Min(0)] public int WallCostOre = 4;
[Tooltip("Pylon cosmetic-beacon ghost prefab (StructureAuthoring{Pylon} + GhostAuthoring).")]
public GameObject PylonPrefab;
[Tooltip("Ore cost to build a pylon.")]
[Min(0)] public int PylonCostOre = 2;
private class StructureCatalogBaker : Baker<StructureCatalogAuthoring>
{
public override void Bake(StructureCatalogAuthoring authoring)
@@ -38,6 +50,28 @@ namespace ProjectM.Authoring
CostAmount = authoring.TurretCostOre,
});
}
if (authoring.WallPrefab != null)
{
buf.Add(new StructureCatalogEntry
{
Type = StructureType.Wall,
Prefab = GetEntity(authoring.WallPrefab, TransformUsageFlags.Dynamic),
CostResourceId = ResourceId.Ore,
CostAmount = authoring.WallCostOre,
});
}
if (authoring.PylonPrefab != null)
{
buf.Add(new StructureCatalogEntry
{
Type = StructureType.Pylon,
Prefab = GetEntity(authoring.PylonPrefab, TransformUsageFlags.Dynamic),
CostResourceId = ResourceId.Ore,
CostAmount = authoring.PylonCostOre,
});
}
}
}
}
@@ -0,0 +1,45 @@
using ProjectM.Simulation;
using Unity.Entities;
using UnityEngine;
namespace ProjectM.Authoring
{
/// <summary>
/// Authoring for a Blight-clutter ghost prefab (ownerless interpolated — duplicate from ResourceNode.prefab
/// so the GhostAuthoringComponent comes free). Bakes <see cref="BlightClutter"/> + <see cref="HitRadius"/>
/// (reused for the harvest/clear sweep) + <see cref="RegionTag"/>{Expedition} so GhostRelevancy scopes it to
/// expedition players. The field spawner overrides Variant (round-robin) + Position per instance. Defaults are
/// inline here (mirrors ResourceNodeAuthoring), not in Tuning.
/// </summary>
public class BlightClutterAuthoring : MonoBehaviour
{
[Tooltip("Hit-points before the clutter shatters.")]
[Min(1)] public int Remaining = 8;
[Tooltip("Scrap (Biomass) yielded per projectile hit — the 'minor scrap' trickle.")]
[Min(1f)] public float ScrapPerHit = 2f;
[Tooltip("Hit radius (world units) for the clear sweep.")]
[Min(0f)] public float HitRadius = 1.0f;
[Tooltip("Default visual variant (the spawner round-robins this per piece).")]
public byte Variant = 0;
private class BlightClutterBaker : Baker<BlightClutterAuthoring>
{
public override void Bake(BlightClutterAuthoring authoring)
{
var entity = GetEntity(authoring, TransformUsageFlags.Dynamic);
AddComponent(entity, new BlightClutter
{
Remaining = authoring.Remaining,
Variant = authoring.Variant,
ScrapResourceId = ResourceId.Biomass,
ScrapPerHit = authoring.ScrapPerHit,
});
AddComponent(entity, new HitRadius { Value = authoring.HitRadius });
AddComponent(entity, new RegionTag { Region = RegionId.Expedition });
}
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6b1aa9b83194a2c41b940dd9532377f4
@@ -0,0 +1,39 @@
using ProjectM.Simulation;
using Unity.Entities;
using UnityEngine;
namespace ProjectM.Authoring
{
/// <summary>
/// Authoring for the baked <see cref="ClutterFieldSpawner"/> singleton (mirrors ResourceFieldSpawnerAuthoring).
/// Place once in the gameplay subscene and assign the Blight-clutter ghost prefab; ExpeditionFieldSystem
/// scatters the clutter each expedition alongside the resource field. Carries no transform.
/// </summary>
public class ClutterFieldSpawnerAuthoring : MonoBehaviour
{
[Tooltip("Blight-clutter ghost prefab. Must carry BlightClutterAuthoring + a GhostAuthoringComponent (ownerless, interpolated).")]
public GameObject ClutterPrefab;
[Tooltip("Number of clutter pieces per expedition.")]
[Min(1)] public int Count = 14;
[Tooltip("Scatter radius (world units) around the expedition origin.")]
[Min(1f)] public float Radius = 14f;
private class ClutterFieldSpawnerBaker : Baker<ClutterFieldSpawnerAuthoring>
{
public override void Bake(ClutterFieldSpawnerAuthoring authoring)
{
var entity = GetEntity(authoring, TransformUsageFlags.None);
AddComponent(entity, new ClutterFieldSpawner
{
Prefab = authoring.ClutterPrefab != null
? GetEntity(authoring.ClutterPrefab, TransformUsageFlags.Dynamic)
: Entity.Null,
Count = authoring.Count,
Radius = authoring.Radius,
});
}
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 02623cc30f984104b88a75782bf0dd07