Lower dropped pickups from typed zone state

This commit is contained in:
Meta Vens 2026-06-16 05:51:07 +01:00
commit 101d237129
7 changed files with 70 additions and 11 deletions

View file

@ -2316,6 +2316,7 @@ public class ActionGameManager : MonoBehaviour
}
ZoneRenderer.LoadZone(Zone);
RestoreDroppedPickupsFromTypedZoneState(galaxyZone);
if (CurrentEntity != null)
{
@ -2324,6 +2325,49 @@ public class ActionGameManager : MonoBehaviour
}
}
private void RestoreDroppedPickupsFromTypedZoneState(GalaxyZone galaxyZone)
{
if (RuntimeCatalog == null ||
ZoneRenderer == null ||
galaxyZone == null)
{
return;
}
var zoneIndex = ZoneIndex(galaxyZone);
if (zoneIndex < 0)
return;
var runId = IsTutorial ? "tutorial" : "local";
var zoneKey = $"global:aetheria.run_state.{runId}.zone.{zoneIndex}.v1";
AetheriaRuntimeZoneStateSnapshot zoneState;
try
{
zoneState = AetheriaRuntimeCatalogStore.ReadZoneStates(RuntimeStateFilePath)
.FirstOrDefault(zone => string.Equals(zone.RecordKey, zoneKey, StringComparison.Ordinal));
}
catch (Exception ex)
{
Debug.LogError($"Failed to read typed dropped pickup state for zone {zoneKey}: {ex}");
return;
}
if (zoneState?.DroppedPickups == null || zoneState.DroppedPickups.Count == 0)
return;
foreach (var pickup in zoneState.DroppedPickups.OrderBy(pickup => pickup.PickupIndex))
{
var item = CreateLoadoutItem(pickup.Item);
if (item == null)
continue;
ZoneRenderer.DropItem(
new Vector3((float)pickup.PositionX, (float)pickup.PositionY, (float)pickup.PositionZ),
new Vector3((float)pickup.VelocityX, (float)pickup.VelocityY, (float)pickup.VelocityZ),
item);
}
}
private void ToggleFullscreenMenu(GameObject menu)
{
if (EventSystem.current != null && EventSystem.current.currentSelectedGameObject != null && EventSystem.current.currentSelectedGameObject.GetComponent<TMP_InputField>() != null) return;