Files
Project-M/Assets/_Project/Scripts/Authoring/Economy/ResourceFieldSpawnerAuthoring.cs
T
kronic 7460ab9d1c Docs: hygiene sweep — stale/misattributed doc-comments + CLAUDE.md example
- Repoint CLAUDE.md testing example from the deleted HeartbeatSystemTests to HealthApplyDamageSystemTests.
- Stale deleted-system refs: ResourceFieldSpawner/ClutterFieldSpawner(+Authoring) now cite RoomFieldSystem (was ExpeditionFieldSystem); BuildPlaceRequest drops the deleted RegionTransitRequest from its 'mirrors' list.
- Stale package version: 'Netcode 1.13.2' -> 'Netcode 1.x' in ProjectileClassificationSystem + BuildPlaceRequest.
- WorldCollisionComponents: remove the duplicated EnvironmentMask summary line; FeelConfig: fix the mangled 'is hitmap)' sentence.

Comment/doc only; compiles clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 23:54:44 -07:00

40 lines
1.5 KiB
C#

using ProjectM.Simulation;
using Unity.Entities;
using UnityEngine;
namespace ProjectM.Authoring
{
/// <summary>
/// Authoring for the baked <see cref="ResourceFieldSpawner"/> singleton (mirrors StorageSpawnerAuthoring).
/// Place once in the gameplay subscene and assign the resource-node ghost prefab; RoomFieldSystem
/// scatters the field each Expedition. Carries no transform.
/// </summary>
public class ResourceFieldSpawnerAuthoring : MonoBehaviour
{
[Tooltip("Resource-node ghost prefab. Must carry ResourceNodeAuthoring + a GhostAuthoringComponent (ownerless, interpolated).")]
public GameObject NodePrefab;
[Tooltip("Number of nodes per expedition.")]
[Min(1)] public int Count = 8;
[Tooltip("Scatter radius (world units) around the expedition origin.")]
[Min(1f)] public float Radius = 12f;
private class ResourceFieldSpawnerBaker : Baker<ResourceFieldSpawnerAuthoring>
{
public override void Bake(ResourceFieldSpawnerAuthoring authoring)
{
var entity = GetEntity(authoring, TransformUsageFlags.None);
AddComponent(entity, new ResourceFieldSpawner
{
Prefab = authoring.NodePrefab != null
? GetEntity(authoring.NodePrefab, TransformUsageFlags.Dynamic)
: Entity.Null,
Count = authoring.Count,
Radius = authoring.Radius,
});
}
}
}
}