Polishes
This commit is contained in:
@@ -41,7 +41,6 @@ namespace ProjectM.Client
|
||||
float _stepElapsed;
|
||||
float _moveAccum;
|
||||
float3 _lastPos;
|
||||
int _oreBaseline;
|
||||
bool _sawSiege;
|
||||
|
||||
protected override void OnStartRunning()
|
||||
@@ -92,7 +91,11 @@ namespace ProjectM.Client
|
||||
}
|
||||
|
||||
// ---- remaining observable state ----
|
||||
int ore = LedgerOre();
|
||||
byte lifecycle = RunLifecycle.Staging;
|
||||
if (SystemAPI.TryGetSingleton<RunInfo>(out var runInfo)) lifecycle = runInfo.Lifecycle;
|
||||
bool localReady = false;
|
||||
foreach (var pr in SystemAPI.Query<RefRO<PlayerReady>>().WithAll<GhostOwnerIsLocal, PlayerTag>())
|
||||
{ localReady = pr.ValueRO.Value != 0; break; }
|
||||
CountStructures(out int turrets, out int fabs);
|
||||
byte phase = CyclePhase.Calm;
|
||||
if (SystemAPI.TryGetSingleton<CycleState>(out var cyc)) phase = cyc.Phase;
|
||||
@@ -104,7 +107,7 @@ namespace ProjectM.Client
|
||||
if (!_stepInit)
|
||||
{
|
||||
_stepElapsed = 0f; _moveAccum = 0f; _sawSiege = false;
|
||||
_oreBaseline = ore; _lastPos = playerPos;
|
||||
_lastPos = playerPos;
|
||||
_stepInit = true;
|
||||
}
|
||||
|
||||
@@ -120,8 +123,8 @@ namespace ProjectM.Client
|
||||
{
|
||||
StepElapsed = _stepElapsed,
|
||||
MoveDistance = _moveAccum,
|
||||
OreNow = ore,
|
||||
OreBaseline = _oreBaseline,
|
||||
LocalReady = localReady,
|
||||
Lifecycle = lifecycle,
|
||||
TurretCount = turrets,
|
||||
FabricatorCount = fabs,
|
||||
OnExpedition = onExp,
|
||||
@@ -159,16 +162,7 @@ namespace ProjectM.Client
|
||||
|
||||
// ---- state gathering helpers ----
|
||||
|
||||
int LedgerOre()
|
||||
{
|
||||
if (SystemAPI.TryGetSingletonEntity<ResourceLedger>(out var e))
|
||||
{
|
||||
var buf = SystemAPI.GetBuffer<StorageEntry>(e);
|
||||
for (int i = 0; i < buf.Length; i++)
|
||||
if (buf[i].ItemId == ResourceId.Ore) return buf[i].Count;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CountStructures(out int turrets, out int fabs)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user