Demote runtime save packs to blueprints

This commit is contained in:
Meta Vens 2026-06-13 18:06:59 +01:00
commit ade6845e1d
13 changed files with 188 additions and 176 deletions

View file

@ -1,4 +1,4 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
@ -170,19 +170,19 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
ContextMenu.AddOption("Save Loadout",
() =>
{
GameManager.SaveLoadout(EntitySerializer.Pack(_displayedEntity));
GameManager.SaveLoadout(EntitySerializer.CaptureBlueprint(_displayedEntity));
});
if (GameManager.Loadouts.Any())
if (GameManager.LoadoutBlueprints.Any())
{
ContextMenu.AddDropdown("Restore Loadout",
GameManager.Loadouts.Select<EntityPack, (string text, Action action, bool enabled)>(pack =>
ContextMenu.AddDropdown("Restore Loadout",
GameManager.LoadoutBlueprints.Select<RuntimeEntityBlueprint, (string text, Action action, bool enabled)>(blueprint =>
(
$"{pack.Name} - {pack.Price(GameManager.ItemManager):n0}", () =>
$"{blueprint.Name} - {blueprint.Price(GameManager.ItemManager):n0}", () =>
{
var entity = EntitySerializer.Unpack(GameManager.ItemManager, GameManager.Zone, pack, true);
var entity = EntitySerializer.InstantiateFromBlueprint(GameManager.ItemManager, GameManager.Zone, blueprint, true);
entity.SetParent(GameManager.DockedEntity);
GameManager.Credits -= pack.Price(GameManager.ItemManager);
GameManager.Credits -= blueprint.Price(GameManager.ItemManager);
GameManager.CurrentEntity = entity;
if(entity is Ship ship)
{
@ -190,7 +190,7 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
GameManager.DockingBay.DockedShip = ship;
}
Display(entity);
}, pack.Price(GameManager.ItemManager) < GameManager.Credits
}, blueprint.Price(GameManager.ItemManager) < GameManager.Credits
)));
}

View file

@ -71,35 +71,35 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
var mass = GameManager.Settings.ZoneSettings.ZoneMass.Evaluate(density);
Properties.AddProperty("Mass", () => ActionGameManager.PlayerSettings.Format(mass));
Properties.AddProperty("Radius", () => ActionGameManager.PlayerSettings.Format(radius));
if (zone.PackedContents == null)
if (zone.RuntimeBlueprint == null)
{
Properties.AddProperty(() => "Has not been visited");
}
else
{
var planetCount = zone.PackedContents.Planets.Count(body => body is PlanetData).ToString();
var planetCount = zone.RuntimeBlueprint.Planets.Count(body => body is PlanetData).ToString();
Properties.AddProperty("Planets", () => planetCount);
var beltCount = zone.PackedContents.Planets.Count(body => body is AsteroidBeltData).ToString();
var beltCount = zone.RuntimeBlueprint.Planets.Count(body => body is AsteroidBeltData).ToString();
Properties.AddProperty("Asteroid Belts", () => beltCount);
var giantCount = zone.PackedContents.Planets.Count(body => body is GasGiantData && !(body is SunData)).ToString();
var giantCount = zone.RuntimeBlueprint.Planets.Count(body => body is GasGiantData && !(body is SunData)).ToString();
Properties.AddProperty("Gas Giants", () => giantCount);
var starCount = zone.PackedContents.Planets.Count(body => body is SunData).ToString();
var starCount = zone.RuntimeBlueprint.Planets.Count(body => body is SunData).ToString();
Properties.AddProperty("Stars", () => starCount);
var stationCount = zone.PackedContents.Entities
var stationCount = zone.RuntimeBlueprint.Entities
.Count(entity => (GameManager.ItemManager.GetData(entity.Hull) as HullData).HullType == HullType.Station)
.ToString();
Properties.AddProperty("Stations", () => stationCount);
var turretCount = zone.PackedContents.Entities
var turretCount = zone.RuntimeBlueprint.Entities
.Count(entity => (GameManager.ItemManager.GetData(entity.Hull) as HullData).HullType == HullType.Turret)
.ToString();
Properties.AddProperty("Turrets", () => turretCount);
var shipCount = zone.PackedContents.Entities
var shipCount = zone.RuntimeBlueprint.Entities
.Count(entity => (GameManager.ItemManager.GetData(entity.Hull) as HullData).HullType == HullType.Ship)
.ToString();
Properties.AddProperty("Ships", () => shipCount);