b34945c2d2
Deletes CyclePhaseSystem, GoalReachedSystem, CoreDamage/CoreRestore, ThreatDirector, CoreIntegrity/GoalProgress/RunPhase/RunOutcome/ThreatState components, CoreVisualFeedbackSystem, and the whole Client/Onboarding slice (+6 test files). Keepers reworked: RunDirectorSystem (UpdateBefore attr + launch guard + goal/threat bank removed; sole SaveRequest raiser now), CycleDirectorSpawnSystem (ledger/meta host only), WaveSystem UNGATED (waves run wherever a WaveDirector is baked), EnemyAISystem core-fallback stripped, AmbientAudioSystem reworked (bed + run cues; no CycleState gate), MusicSystem RunInfo-only, HudSystem big trim (goal meter, core bar, siege banner, terminal banner, outcome flash, onboarding hook all gone), MetaShop/ClassPrep/AimReticle siege gates dropped, DebugOverlay/ops re-meant (SpawnWave=force next wave, EndSiege=quiet arena; SetCalm/AdvanceGoal/SetHeat retired, bytes reserved), TuningConfig Core knobs retired (ids 20-23 reserved), StorageMath.DrainFraction deleted, HowToPlay copy rewritten. Save epoch v7 (fresh epoch, operator-approved): SaveData drops goal/core/outcome + conveyor/machine-IO fields; MinLoadableVersion=7; PendingSave/PendingStructure trimmed; RollTerminalCampaignForward deleted; SaveStructureScan signature slimmed. 390 tests green; Play world-creation clean (player + waves live, no exceptions). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
44 lines
1.7 KiB
C#
44 lines
1.7 KiB
C#
using System.Collections.Generic;
|
|
using Unity.Collections;
|
|
using Unity.Entities;
|
|
|
|
namespace ProjectM.Simulation
|
|
{
|
|
/// <summary>
|
|
/// Scans a server world for PLAYER-built structures (<see cref="PlacedStructure"/> + <see cref="RuntimePlacedTag"/>)
|
|
/// into the flat SaveData arrays — the SINGLE shared scan used by BOTH the autosave (SaveWriteSystem) and the
|
|
/// quit-to-menu save (WorldLauncher), so the two paths can never drift (only RuntimePlacedTag structures are saved;
|
|
/// anything baked into the subscene is the subscene's source of truth, not the save's). Managed (List/array) —
|
|
/// runs only on a save, never in the hot loop.
|
|
/// </summary>
|
|
public static class SaveStructureScan
|
|
{
|
|
public static void Collect(EntityManager em, uint nowTick, out StructureSave[] structures)
|
|
{
|
|
var structs = new List<StructureSave>();
|
|
|
|
using var q = em.CreateEntityQuery(
|
|
ComponentType.ReadOnly<PlacedStructure>(),
|
|
ComponentType.ReadOnly<RuntimePlacedTag>());
|
|
using var entities = q.ToEntityArray(Allocator.Temp);
|
|
|
|
for (int k = 0; k < entities.Length; k++)
|
|
{
|
|
var e = entities[k];
|
|
var ps = em.GetComponentData<PlacedStructure>(e);
|
|
|
|
structs.Add(new StructureSave
|
|
{
|
|
Type = ps.Type,
|
|
CellX = ps.Cell.x,
|
|
CellZ = ps.Cell.y,
|
|
// EB-1: guarded so structures without Health don't crash the autosave path (no try/catch).
|
|
HP = em.HasComponent<Health>(e) ? em.GetComponentData<Health>(e).Current : 0f,
|
|
});
|
|
}
|
|
|
|
structures = structs.ToArray();
|
|
}
|
|
}
|
|
}
|