62e48a3b0b
The 2026-08-06 audit found the shipping scene was still the abandoned co-op-Hades game with LANTERN combat bolted on, and that a third of the codebase was live code for a direction abandoned on 2026-07-13. Operator chose deletion over freezing: "everything is saved in source control if needed. I want the project to be clean." DELETED (~140 source files, Scripts 335->231, Tests 77->43): - Enemy variants + boss (H3). ChargerAuthoring / SpitterAuthoring / SwarmerAuthoring were attached to ZERO prefabs, so LungeState / SpitterState / SwarmerTag were never baked: ~272 lines of Bursted AI passes, BossAISystem (261 lines) and the whole MixBands escalation curve could not match a single chunk at runtime, while 734 lines of green tests certified them. Both shipping enemy prefabs were already byte-identical in stats. - Run/room lifecycle: RunDirector FSM, RunInfo/RunMap/RoomPlan/RoomTag, route select, portal interact, ready-check, room field/teardown. - Meta shop, prep loadout, boons (incl. KillRewardSystem and DashTrailDamageSystem, which existed only to serve boon flags). - Build palette + structures, shared storage, inventory/equipment (already recorded PAUSED in CLAUDE.md). - The HUD panels driving all of the above (HudSystem 1168 -> 610). KEPT deliberately: BaseGridMath + BaseAnchor (8 systems use PlotCenter for spawn rings, respawn and dynamic light), the resource ledger + StorageMath, the save system, region/relevancy. Three of these were in the delete set until I checked their consumers — worth remembering that the file-level manifest was wrong about them. Also folds in audit finding M5: PlayerClass was a second, server-only copy of the byte FrameId already replicates. It existed for the meta shop; with that gone, FrameId is the single frame identity. Harvest is now single-sink (ledger). HarvestMath keeps its shape so LANTERN's carried-vs-banked cargo split lands in one place, not two. 295/295 EditMode green, zero compile errors. Subscene re-bake and Play validation follow in the next commit. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
86 lines
3.9 KiB
C#
86 lines
3.9 KiB
C#
#if UNITY_EDITOR
|
|
using ProjectM.Simulation;
|
|
using Unity.Collections;
|
|
using Unity.Entities;
|
|
using Unity.Mathematics;
|
|
using Unity.Transforms;
|
|
|
|
namespace ProjectM.Server
|
|
{
|
|
/// <summary>
|
|
/// 07-20 sandbox combat target: keeps ONE planted <see cref="TargetDummyTag"/> dummy alive in the DevSandbox
|
|
/// (scene-name gate — the established dev-script convention; GymSub bakes no WaveDirector, so this is the
|
|
/// sandbox's enemy source by design). The dummy is a real enemy ghost instantiated from a baked prefab
|
|
/// (grunt-shaped preferred), parked at the first player's position + a fixed offset, HP fat enough to eat a
|
|
/// few chains; it dies through the NORMAL death path (Dying corpse window → destroy → kill pop on the client)
|
|
/// and respawns at the same anchor shortly after — kill feedback stays testable on repeat. Editor-only.
|
|
/// </summary>
|
|
[WorldSystemFilter(WorldSystemFilterFlags.ServerSimulation)]
|
|
public partial class TargetDummySpawnSystem : SystemBase
|
|
{
|
|
const float RespawnDelaySec = 1.5f;
|
|
const float DummyHealth = 400f;
|
|
static readonly float3 AnchorOffset = new float3(3f, 0f, 1.5f);
|
|
|
|
float _respawnTimer;
|
|
float3 _anchor;
|
|
bool _anchored;
|
|
|
|
protected override void OnUpdate()
|
|
{
|
|
if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name != "DevSandbox")
|
|
return;
|
|
|
|
// A dummy exists (alive OR in its Dying corpse window) -> nothing to do; the corpse window
|
|
// conveniently delays the respawn timer until the body is gone.
|
|
var dummyQ = SystemAPI.QueryBuilder().WithAll<TargetDummyTag>().Build();
|
|
if (!dummyQ.IsEmpty) { _respawnTimer = 0f; return; }
|
|
|
|
// Anchor once on the first player seen (spawn point + offset = a consistent training spot).
|
|
if (!_anchored)
|
|
{
|
|
foreach (var xf in SystemAPI.Query<RefRO<LocalTransform>>().WithAll<PlayerTag>())
|
|
{
|
|
_anchor = xf.ValueRO.Position + AnchorOffset;
|
|
_anchored = true;
|
|
break;
|
|
}
|
|
if (!_anchored) return; // no player yet (world still connecting)
|
|
}
|
|
|
|
_respawnTimer += SystemAPI.Time.DeltaTime; // wall-frame is fine: dev spawner in the plain server group
|
|
if (_respawnTimer < RespawnDelaySec) return;
|
|
_respawnTimer = 0f;
|
|
|
|
// Grunt-shaped prefab preferred (no lunge/spit machinery on a training dummy); fall back to any enemy.
|
|
var prefQ = EntityManager.CreateEntityQuery(new EntityQueryDesc
|
|
{
|
|
All = new ComponentType[] { typeof(EnemyTag), typeof(Prefab) },
|
|
|
|
Options = EntityQueryOptions.IncludePrefab,
|
|
});
|
|
var prefabs = prefQ.ToEntityArray(Allocator.Temp);
|
|
if (prefabs.Length == 0)
|
|
{
|
|
prefabs.Dispose();
|
|
var anyQ = EntityManager.CreateEntityQuery(new EntityQueryDesc
|
|
{
|
|
All = new ComponentType[] { typeof(EnemyTag), typeof(Prefab) },
|
|
Options = EntityQueryOptions.IncludePrefab,
|
|
});
|
|
prefabs = anyQ.ToEntityArray(Allocator.Temp);
|
|
if (prefabs.Length == 0) { prefabs.Dispose(); return; } // no enemy ghosts in this world
|
|
}
|
|
var prefab = prefabs[0];
|
|
prefabs.Dispose();
|
|
|
|
var inst = EntityManager.Instantiate(prefab);
|
|
var baked = EntityManager.GetComponentData<LocalTransform>(prefab);
|
|
EntityManager.SetComponentData(inst, baked.WithPosition(_anchor)); // WithPosition: never FromPosition (Scale reset)
|
|
EntityManager.SetComponentData(inst, new Health { Current = DummyHealth, Max = DummyHealth });
|
|
EntityManager.AddComponent<TargetDummyTag>(inst); // server-only: plants it (every AI pass excludes the tag)
|
|
}
|
|
}
|
|
}
|
|
#endif
|