Demote entity blueprints to construction
This commit is contained in:
parent
dab29839a2
commit
7b605f049c
17 changed files with 73 additions and 96 deletions
Binary file not shown.
|
|
@ -181,23 +181,23 @@ public class ActionGameManager : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public RuntimeEntityBlueprint CreateRuntimeBlueprint(AetheriaRuntimeLoadoutTemplateSnapshot template)
|
public EntityConstructionBlueprint CreateEntityConstructionBlueprint(AetheriaRuntimeLoadoutTemplateSnapshot template)
|
||||||
{
|
{
|
||||||
var blueprint = CreateRuntimeBlueprint(template.RootEntity);
|
var blueprint = CreateEntityConstructionBlueprint(template.RootEntity);
|
||||||
if (blueprint != null && string.IsNullOrWhiteSpace(blueprint.Name))
|
if (blueprint != null && string.IsNullOrWhiteSpace(blueprint.Name))
|
||||||
blueprint.Name = template.Name;
|
blueprint.Name = template.Name;
|
||||||
return blueprint;
|
return blueprint;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RuntimeEntityBlueprint CreateRuntimeBlueprint(AetheriaRuntimeEntityLoadoutSnapshot entity)
|
private EntityConstructionBlueprint CreateEntityConstructionBlueprint(AetheriaRuntimeEntityLoadoutSnapshot entity)
|
||||||
{
|
{
|
||||||
var hull = CreateEquippableLoadoutItem(entity.Hull);
|
var hull = CreateEquippableLoadoutItem(entity.Hull);
|
||||||
if (hull == null)
|
if (hull == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
RuntimeEntityBlueprint blueprint = string.Equals(entity.Kind, "orbital", StringComparison.OrdinalIgnoreCase)
|
EntityConstructionBlueprint blueprint = string.Equals(entity.Kind, "orbital", StringComparison.OrdinalIgnoreCase)
|
||||||
? new RuntimeOrbitalEntityBlueprint()
|
? new OrbitalEntityConstructionBlueprint()
|
||||||
: new RuntimeShipBlueprint
|
: new ShipConstructionBlueprint
|
||||||
{
|
{
|
||||||
Direction = new float2(0, 1)
|
Direction = new float2(0, 1)
|
||||||
};
|
};
|
||||||
|
|
@ -213,7 +213,7 @@ public class ActionGameManager : MonoBehaviour
|
||||||
blueprint.DockingBayAssignments = entity.DockingBayAssignments.ToArray();
|
blueprint.DockingBayAssignments = entity.DockingBayAssignments.ToArray();
|
||||||
blueprint.WeaponGroups = entity.WeaponGroups.Select(group => group.ToArray()).ToArray();
|
blueprint.WeaponGroups = entity.WeaponGroups.Select(group => group.ToArray()).ToArray();
|
||||||
blueprint.Children = entity.Children
|
blueprint.Children = entity.Children
|
||||||
.Select(CreateRuntimeBlueprint)
|
.Select(CreateEntityConstructionBlueprint)
|
||||||
.Where(child => child != null)
|
.Where(child => child != null)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
return blueprint;
|
return blueprint;
|
||||||
|
|
@ -260,7 +260,6 @@ public class ActionGameManager : MonoBehaviour
|
||||||
var instance = ItemManager.CreateCraftedInstance(typedItem, (float)item.Quality);
|
var instance = ItemManager.CreateCraftedInstance(typedItem, (float)item.Quality);
|
||||||
if (instance is EquippableItem equippable)
|
if (instance is EquippableItem equippable)
|
||||||
{
|
{
|
||||||
equippable.Enabled.Value = item.Enabled;
|
|
||||||
if (item.Durability > 0)
|
if (item.Durability > 0)
|
||||||
equippable.Durability = (float)item.Durability;
|
equippable.Durability = (float)item.Durability;
|
||||||
}
|
}
|
||||||
|
|
@ -458,7 +457,7 @@ public class ActionGameManager : MonoBehaviour
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private AetheriaRuntimeLoadoutTemplateCommit ProjectLoadoutTemplate(RuntimeEntityBlueprint blueprint)
|
private AetheriaRuntimeLoadoutTemplateCommit ProjectLoadoutTemplate(EntityConstructionBlueprint blueprint)
|
||||||
{
|
{
|
||||||
return new AetheriaRuntimeLoadoutTemplateCommit
|
return new AetheriaRuntimeLoadoutTemplateCommit
|
||||||
{
|
{
|
||||||
|
|
@ -468,12 +467,12 @@ public class ActionGameManager : MonoBehaviour
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private AetheriaRuntimeEntityLoadoutCommit ProjectEntityLoadout(RuntimeEntityBlueprint blueprint)
|
private AetheriaRuntimeEntityLoadoutCommit ProjectEntityLoadout(EntityConstructionBlueprint blueprint)
|
||||||
{
|
{
|
||||||
return new AetheriaRuntimeEntityLoadoutCommit
|
return new AetheriaRuntimeEntityLoadoutCommit
|
||||||
{
|
{
|
||||||
Name = blueprint.Name ?? "",
|
Name = blueprint.Name ?? "",
|
||||||
Kind = blueprint is RuntimeShipBlueprint ? "ship" : blueprint is RuntimeOrbitalEntityBlueprint ? "orbital" : "entity",
|
Kind = blueprint is ShipConstructionBlueprint ? "ship" : blueprint is OrbitalEntityConstructionBlueprint ? "orbital" : "entity",
|
||||||
CorporationLegacyId = blueprint.Faction == Guid.Empty ? "" : blueprint.Faction.ToString("D"),
|
CorporationLegacyId = blueprint.Faction == Guid.Empty ? "" : blueprint.Faction.ToString("D"),
|
||||||
Hull = ProjectLoadoutItem(blueprint.Hull),
|
Hull = ProjectLoadoutItem(blueprint.Hull),
|
||||||
Equipment = ProjectSlots(blueprint.Equipment),
|
Equipment = ProjectSlots(blueprint.Equipment),
|
||||||
|
|
@ -527,7 +526,7 @@ public class ActionGameManager : MonoBehaviour
|
||||||
Quality = item is CraftedItemInstance crafted ? crafted.Quality : 1.0,
|
Quality = item is CraftedItemInstance crafted ? crafted.Quality : 1.0,
|
||||||
Durability = item is EquippableItem equippable ? equippable.Durability : 1.0,
|
Durability = item is EquippableItem equippable ? equippable.Durability : 1.0,
|
||||||
Quantity = item is SimpleCommodity commodity ? commodity.Quantity : 1,
|
Quantity = item is SimpleCommodity commodity ? commodity.Quantity : 1,
|
||||||
Enabled = item is not EquippableItem enabledItem || enabledItem.Enabled.Value
|
Enabled = true
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1277,7 +1276,7 @@ public class ActionGameManager : MonoBehaviour
|
||||||
return CurrentGalaxy?.Factions == null || faction == null ? -1 : Array.IndexOf(CurrentGalaxy.Factions, faction);
|
return CurrentGalaxy?.Factions == null || faction == null ? -1 : Array.IndexOf(CurrentGalaxy.Factions, faction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void QueueRuntimeLoadoutTemplateCommit(RuntimeEntityBlueprint blueprint)
|
public void QueueRuntimeLoadoutTemplateCommit(EntityConstructionBlueprint blueprint)
|
||||||
{
|
{
|
||||||
var loadout = ProjectLoadoutTemplate(blueprint);
|
var loadout = ProjectLoadoutTemplate(blueprint);
|
||||||
LoadoutTemplates.RemoveAll(template => template.Name == loadout.Name);
|
LoadoutTemplates.RemoveAll(template => template.Name == loadout.Name);
|
||||||
|
|
@ -1711,7 +1710,7 @@ public class ActionGameManager : MonoBehaviour
|
||||||
nearestFaction,
|
nearestFaction,
|
||||||
.5f);
|
.5f);
|
||||||
|
|
||||||
var turret = RuntimeEntityBlueprintProjector.InstantiateFromBlueprint(ItemManager, Zone, loadoutGenerator.GenerateTurretLoadout(), true);
|
var turret = EntityConstructionBlueprintProjector.InstantiateFromBlueprint(ItemManager, Zone, loadoutGenerator.GenerateTurretLoadout(), true);
|
||||||
turret.Position.xz = _currentEntity.Position.xz +
|
turret.Position.xz = _currentEntity.Position.xz +
|
||||||
ItemManager.Random.NextFloat2Direction() * ItemManager.Random.NextFloat(50, 500);
|
ItemManager.Random.NextFloat2Direction() * ItemManager.Random.NextFloat(50, 500);
|
||||||
turret.Zone = Zone;
|
turret.Zone = Zone;
|
||||||
|
|
@ -1743,7 +1742,7 @@ public class ActionGameManager : MonoBehaviour
|
||||||
//
|
//
|
||||||
// for (int i = 0; i < 8; i++)
|
// for (int i = 0; i < 8; i++)
|
||||||
// {
|
// {
|
||||||
// var ship = RuntimeEntityBlueprintProjector.InstantiateFromBlueprint(ItemManager, Zone, loadoutGenerator.GenerateShipLoadout(), true);
|
// var ship = EntityConstructionBlueprintProjector.InstantiateFromBlueprint(ItemManager, Zone, loadoutGenerator.GenerateShipLoadout(), true);
|
||||||
// ship.Position.xz = _currentEntity.Position.xz +
|
// ship.Position.xz = _currentEntity.Position.xz +
|
||||||
// ItemManager.Random.NextFloat2Direction() * ItemManager.Random.NextFloat(50, 500);
|
// ItemManager.Random.NextFloat2Direction() * ItemManager.Random.NextFloat(50, 500);
|
||||||
// ship.Zone = Zone;
|
// ship.Zone = Zone;
|
||||||
|
|
@ -1753,7 +1752,7 @@ public class ActionGameManager : MonoBehaviour
|
||||||
//
|
//
|
||||||
// for (int i = 0; i < 8; i++)
|
// for (int i = 0; i < 8; i++)
|
||||||
// {
|
// {
|
||||||
// var turret = RuntimeEntityBlueprintProjector.InstantiateFromBlueprint(ItemManager, Zone, loadoutGenerator.GenerateTurretLoadout(), true);
|
// var turret = EntityConstructionBlueprintProjector.InstantiateFromBlueprint(ItemManager, Zone, loadoutGenerator.GenerateTurretLoadout(), true);
|
||||||
// turret.Position.xz = _currentEntity.Position.xz +
|
// turret.Position.xz = _currentEntity.Position.xz +
|
||||||
// ItemManager.Random.NextFloat2Direction() * ItemManager.Random.NextFloat(50, 500);
|
// ItemManager.Random.NextFloat2Direction() * ItemManager.Random.NextFloat(50, 500);
|
||||||
// turret.Zone = Zone;
|
// turret.Zone = Zone;
|
||||||
|
|
@ -1918,7 +1917,7 @@ public class ActionGameManager : MonoBehaviour
|
||||||
SectorMap.QueueZoneReveal(CurrentGalaxy.Entrance.AdjacentZones.Prepend(CurrentGalaxy.Entrance));
|
SectorMap.QueueZoneReveal(CurrentGalaxy.Entrance.AdjacentZones.Prepend(CurrentGalaxy.Entrance));
|
||||||
PopulateLevel(CurrentGalaxy.Entrance);
|
PopulateLevel(CurrentGalaxy.Entrance);
|
||||||
var loadoutGenerator = new LoadoutGenerator(ref ItemManager.Random, ItemManager, RuntimeCatalog, CurrentGalaxy, Zone.GalaxyZone, IsTutorial ? CurrentGalaxy.ResolveFaction(Settings.TutorialGenerationSettings.ProtagonistFaction) : null, 2);
|
var loadoutGenerator = new LoadoutGenerator(ref ItemManager.Random, ItemManager, RuntimeCatalog, CurrentGalaxy, Zone.GalaxyZone, IsTutorial ? CurrentGalaxy.ResolveFaction(Settings.TutorialGenerationSettings.ProtagonistFaction) : null, 2);
|
||||||
var ship = RuntimeEntityBlueprintProjector.InstantiateFromBlueprint(
|
var ship = EntityConstructionBlueprintProjector.InstantiateFromBlueprint(
|
||||||
ItemManager,
|
ItemManager,
|
||||||
Zone,
|
Zone,
|
||||||
loadoutGenerator.GenerateShipLoadout(data => string.IsNullOrEmpty(Settings.StartingHullName) || data.Name==Settings.StartingHullName ),
|
loadoutGenerator.GenerateShipLoadout(data => string.IsNullOrEmpty(Settings.StartingHullName) || data.Name==Settings.StartingHullName ),
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ public class ShipInstance : EntityInstance
|
||||||
if (typedItem != null && typedItem.Durability > 0)
|
if (typedItem != null && typedItem.Durability > 0)
|
||||||
return (float)typedItem.Durability;
|
return (float)typedItem.Durability;
|
||||||
|
|
||||||
return Math.Max(item.Durability, 1f);
|
return item is EquippableItem equippable ? Math.Max(equippable.Durability, 1f) : 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AetheriaRuntimeCatalogItem FindTypedItem(ItemInstance item)
|
private static AetheriaRuntimeCatalogItem FindTypedItem(ItemInstance item)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 642627729ca40a74d865e205a6001bb1
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -38,7 +38,7 @@ public class Faction : INamedEntry
|
||||||
[Inspectable]
|
[Inspectable]
|
||||||
public int InfluenceDistance = 4;
|
public int InfluenceDistance = 4;
|
||||||
|
|
||||||
[RangedFloat(0, 1)]
|
[InspectableRangedFloat(0, 1)]
|
||||||
public Dictionary<Guid, float> Allegiance = new Dictionary<Guid, float>();
|
public Dictionary<Guid, float> Allegiance = new Dictionary<Guid, float>();
|
||||||
|
|
||||||
[InspectableSoundBank]
|
[InspectableSoundBank]
|
||||||
|
|
|
||||||
|
|
@ -4,20 +4,20 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Unity.Mathematics;
|
using Unity.Mathematics;
|
||||||
|
|
||||||
public static class RuntimeEntityBlueprintProjector
|
public static class EntityConstructionBlueprintProjector
|
||||||
{
|
{
|
||||||
public static RuntimeEntityBlueprint CaptureBlueprint(Entity entity)
|
public static EntityConstructionBlueprint CaptureBlueprint(Entity entity)
|
||||||
{
|
{
|
||||||
RuntimeEntityBlueprint blueprint;
|
EntityConstructionBlueprint blueprint;
|
||||||
if (entity is OrbitalEntity orbital)
|
if (entity is OrbitalEntity orbital)
|
||||||
blueprint = new RuntimeOrbitalEntityBlueprint
|
blueprint = new OrbitalEntityConstructionBlueprint
|
||||||
{
|
{
|
||||||
Orbit = orbital.OrbitId,
|
Orbit = orbital.OrbitId,
|
||||||
SecurityLevel = orbital.SecurityLevel,
|
SecurityLevel = orbital.SecurityLevel,
|
||||||
SecurityRadius = orbital.SecurityRadius
|
SecurityRadius = orbital.SecurityRadius
|
||||||
};
|
};
|
||||||
else if (entity is Ship ship)
|
else if (entity is Ship ship)
|
||||||
blueprint = new RuntimeShipBlueprint
|
blueprint = new ShipConstructionBlueprint
|
||||||
{
|
{
|
||||||
Position = ship.Position,
|
Position = ship.Position,
|
||||||
Direction = ship.Direction,
|
Direction = ship.Direction,
|
||||||
|
|
@ -41,19 +41,19 @@ public static class RuntimeEntityBlueprintProjector
|
||||||
return blueprint;
|
return blueprint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Entity InstantiateFromBlueprint(ItemManager itemManager, Zone zone, RuntimeEntityBlueprint blueprint, bool instantiate = false)
|
public static Entity InstantiateFromBlueprint(ItemManager itemManager, Zone zone, EntityConstructionBlueprint blueprint, bool instantiate = false)
|
||||||
{
|
{
|
||||||
blueprint.Settings ??= itemManager.GameplaySettings.DefaultEntitySettings.Copy();
|
blueprint.Settings ??= itemManager.GameplaySettings.DefaultEntitySettings.Copy();
|
||||||
return blueprint switch
|
return blueprint switch
|
||||||
{
|
{
|
||||||
RuntimeShipBlueprint shipBlueprint => InstantiateFromBlueprint(itemManager, zone, shipBlueprint, instantiate),
|
ShipConstructionBlueprint shipBlueprint => InstantiateFromBlueprint(itemManager, zone, shipBlueprint, instantiate),
|
||||||
RuntimeOrbitalEntityBlueprint orbitalBlueprint => InstantiateFromBlueprint(itemManager, zone, orbitalBlueprint, instantiate),
|
OrbitalEntityConstructionBlueprint orbitalBlueprint => InstantiateFromBlueprint(itemManager, zone, orbitalBlueprint, instantiate),
|
||||||
_ => null
|
_ => null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static Ship InstantiateFromBlueprint(ItemManager itemManager, Zone zone, RuntimeShipBlueprint blueprint, bool instantiate = false)
|
private static Ship InstantiateFromBlueprint(ItemManager itemManager, Zone zone, ShipConstructionBlueprint blueprint, bool instantiate = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
var entity = new Ship(itemManager, zone, instantiate ? (EquippableItem) itemManager.Instantiate(blueprint.Hull) : blueprint.Hull, blueprint.Settings);
|
var entity = new Ship(itemManager, zone, instantiate ? (EquippableItem) itemManager.Instantiate(blueprint.Hull) : blueprint.Hull, blueprint.Settings);
|
||||||
|
|
@ -64,7 +64,7 @@ public static class RuntimeEntityBlueprintProjector
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static OrbitalEntity InstantiateFromBlueprint(ItemManager itemManager, Zone zone, RuntimeOrbitalEntityBlueprint blueprint, bool instantiate = false)
|
private static OrbitalEntity InstantiateFromBlueprint(ItemManager itemManager, Zone zone, OrbitalEntityConstructionBlueprint blueprint, bool instantiate = false)
|
||||||
{
|
{
|
||||||
var entity = new OrbitalEntity(itemManager, zone, instantiate ? (EquippableItem) itemManager.Instantiate(blueprint.Hull) : blueprint.Hull, blueprint.Orbit, blueprint.Settings);
|
var entity = new OrbitalEntity(itemManager, zone, instantiate ? (EquippableItem) itemManager.Instantiate(blueprint.Hull) : blueprint.Hull, blueprint.Orbit, blueprint.Settings);
|
||||||
Restore(itemManager, zone, blueprint, entity, instantiate);
|
Restore(itemManager, zone, blueprint, entity, instantiate);
|
||||||
|
|
@ -74,7 +74,7 @@ public static class RuntimeEntityBlueprintProjector
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Restore(ItemManager itemManager, Zone zone, RuntimeEntityBlueprint blueprint, Entity entity, bool instantiate = false)
|
private static void Restore(ItemManager itemManager, Zone zone, EntityConstructionBlueprint blueprint, Entity entity, bool instantiate = false)
|
||||||
{
|
{
|
||||||
entity.Name = blueprint.Name;
|
entity.Name = blueprint.Name;
|
||||||
entity.Faction = zone?.Galaxy?.ResolveFaction(blueprint.Faction);
|
entity.Faction = zone?.Galaxy?.ResolveFaction(blueprint.Faction);
|
||||||
|
|
@ -112,14 +112,14 @@ public static class RuntimeEntityBlueprintProjector
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RuntimeShipBlueprint : RuntimeEntityBlueprint
|
public class ShipConstructionBlueprint : EntityConstructionBlueprint
|
||||||
{
|
{
|
||||||
public float3 Position;
|
public float3 Position;
|
||||||
public float2 Direction;
|
public float2 Direction;
|
||||||
public bool IsPlayerShip;
|
public bool IsPlayerShip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RuntimeOrbitalEntityBlueprint : RuntimeEntityBlueprint
|
public class OrbitalEntityConstructionBlueprint : EntityConstructionBlueprint
|
||||||
{
|
{
|
||||||
public Guid Orbit;
|
public Guid Orbit;
|
||||||
public int Story = -1;
|
public int Story = -1;
|
||||||
|
|
@ -127,7 +127,7 @@ public class RuntimeOrbitalEntityBlueprint : RuntimeEntityBlueprint
|
||||||
public float SecurityRadius;
|
public float SecurityRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class RuntimeEntityBlueprint
|
public abstract class EntityConstructionBlueprint
|
||||||
{
|
{
|
||||||
public string Name;
|
public string Name;
|
||||||
public EquippableItem Hull;
|
public EquippableItem Hull;
|
||||||
|
|
@ -137,7 +137,7 @@ public abstract class RuntimeEntityBlueprint
|
||||||
public int[] DockingBayAssignments;
|
public int[] DockingBayAssignments;
|
||||||
public (int2 position, ItemInstance item)[][] CargoContents;
|
public (int2 position, ItemInstance item)[][] CargoContents;
|
||||||
public (int2 position, ItemInstance item)[][] DockingBayContents;
|
public (int2 position, ItemInstance item)[][] DockingBayContents;
|
||||||
public RuntimeEntityBlueprint[] Children;
|
public EntityConstructionBlueprint[] Children;
|
||||||
public EntitySettings Settings;
|
public EntitySettings Settings;
|
||||||
public Guid Faction;
|
public Guid Faction;
|
||||||
public int[][] WeaponGroups;
|
public int[][] WeaponGroups;
|
||||||
|
|
@ -55,7 +55,7 @@ public class LoadoutGenerator
|
||||||
// PriceExponent = priceExponent;
|
// PriceExponent = priceExponent;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public RuntimeEntityBlueprint GenerateShipLoadout(Predicate<AetheriaRuntimeCatalogItem> hullFilter = null)
|
public EntityConstructionBlueprint GenerateShipLoadout(Predicate<AetheriaRuntimeCatalogItem> hullFilter = null)
|
||||||
{
|
{
|
||||||
var hullRow = RandomHull(HullType.Ship, hullFilter);
|
var hullRow = RandomHull(HullType.Ship, hullFilter);
|
||||||
if(hullRow==null)
|
if(hullRow==null)
|
||||||
|
|
@ -69,10 +69,10 @@ public class LoadoutGenerator
|
||||||
var entity = new Ship(ItemManager, null, hull, ItemManager.GameplaySettings.DefaultEntitySettings);
|
var entity = new Ship(ItemManager, null, hull, ItemManager.GameplaySettings.DefaultEntitySettings);
|
||||||
entity.Faction = Faction;
|
entity.Faction = Faction;
|
||||||
OutfitEntity(entity);
|
OutfitEntity(entity);
|
||||||
return RuntimeEntityBlueprintProjector.CaptureBlueprint(entity);
|
return EntityConstructionBlueprintProjector.CaptureBlueprint(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RuntimeOrbitalEntityBlueprint GenerateTurretLoadout()
|
public OrbitalEntityConstructionBlueprint GenerateTurretLoadout()
|
||||||
{
|
{
|
||||||
var hullRow = RandomHull(HullType.Turret);
|
var hullRow = RandomHull(HullType.Turret);
|
||||||
if(hullRow==null)
|
if(hullRow==null)
|
||||||
|
|
@ -84,10 +84,10 @@ public class LoadoutGenerator
|
||||||
var entity = new OrbitalEntity(ItemManager, null, hull, Guid.Empty, ItemManager.GameplaySettings.DefaultEntitySettings);
|
var entity = new OrbitalEntity(ItemManager, null, hull, Guid.Empty, ItemManager.GameplaySettings.DefaultEntitySettings);
|
||||||
entity.Faction = Faction;
|
entity.Faction = Faction;
|
||||||
OutfitEntity(entity);
|
OutfitEntity(entity);
|
||||||
return RuntimeEntityBlueprintProjector.CaptureBlueprint(entity) as RuntimeOrbitalEntityBlueprint;
|
return EntityConstructionBlueprintProjector.CaptureBlueprint(entity) as OrbitalEntityConstructionBlueprint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RuntimeOrbitalEntityBlueprint GenerateStationLoadout()
|
public OrbitalEntityConstructionBlueprint GenerateStationLoadout()
|
||||||
{
|
{
|
||||||
var hullRow = RandomHull(HullType.Station);
|
var hullRow = RandomHull(HullType.Station);
|
||||||
if(hullRow==null)
|
if(hullRow==null)
|
||||||
|
|
@ -130,7 +130,7 @@ public class LoadoutGenerator
|
||||||
|
|
||||||
entity.CanTow = hullRow.HullCanTow;
|
entity.CanTow = hullRow.HullCanTow;
|
||||||
|
|
||||||
return RuntimeEntityBlueprintProjector.CaptureBlueprint(entity) as RuntimeOrbitalEntityBlueprint;
|
return EntityConstructionBlueprintProjector.CaptureBlueprint(entity) as OrbitalEntityConstructionBlueprint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AetheriaRuntimeCatalogItem RandomHull(HullType type, Predicate<AetheriaRuntimeCatalogItem> hullFilter = null)
|
public AetheriaRuntimeCatalogItem RandomHull(HullType type, Predicate<AetheriaRuntimeCatalogItem> hullFilter = null)
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ public class Zone
|
||||||
|
|
||||||
foreach (var entityBlueprint in blueprint.Entities)
|
foreach (var entityBlueprint in blueprint.Entities)
|
||||||
{
|
{
|
||||||
var entity = RuntimeEntityBlueprintProjector.InstantiateFromBlueprint(_itemManager, this, entityBlueprint);
|
var entity = EntityConstructionBlueprintProjector.InstantiateFromBlueprint(_itemManager, this, entityBlueprint);
|
||||||
Entities.Add(entity);
|
Entities.Add(entity);
|
||||||
entity.Activate();
|
entity.Activate();
|
||||||
if (entity is Ship {IsPlayerShip: false} ship)
|
if (entity is Ship {IsPlayerShip: false} ship)
|
||||||
|
|
@ -102,11 +102,6 @@ public class Zone
|
||||||
return agent;
|
return agent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddOrbit(OrbitData orbit)
|
|
||||||
{
|
|
||||||
Orbits.Add(orbit.ID, new Orbit(Settings, orbit));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Update(float deltaTime)
|
public void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
_time += deltaTime;
|
_time += deltaTime;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ public class ZoneConstructionBlueprint
|
||||||
{
|
{
|
||||||
public List<BodyData> Planets = new List<BodyData>();
|
public List<BodyData> Planets = new List<BodyData>();
|
||||||
public List<OrbitData> Orbits = new List<OrbitData>();
|
public List<OrbitData> Orbits = new List<OrbitData>();
|
||||||
public List<RuntimeEntityBlueprint> Entities = new List<RuntimeEntityBlueprint>();
|
public List<EntityConstructionBlueprint> Entities = new List<EntityConstructionBlueprint>();
|
||||||
public float Radius = 2000;
|
public float Radius = 2000;
|
||||||
public float Mass = 10000;
|
public float Mass = 10000;
|
||||||
public double Time;
|
public double Time;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 8a3350bbbac7a7e4f9354196f7985fcb
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -283,7 +283,7 @@ public class SchematicDisplay : MonoBehaviour
|
||||||
if (typedItem != null && typedItem.Durability > 0)
|
if (typedItem != null && typedItem.Durability > 0)
|
||||||
return (float)typedItem.Durability;
|
return (float)typedItem.Durability;
|
||||||
|
|
||||||
return Math.Max(item.Durability, 1f);
|
return item is EquippableItem equippable ? Math.Max(equippable.Durability, 1f) : 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AetheriaRuntimeCatalogItem FindTypedItem(ItemInstance item)
|
private static AetheriaRuntimeCatalogItem FindTypedItem(ItemInstance item)
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,12 @@ public class SchematicListElement : MonoBehaviour
|
||||||
out WeaponFireType fireTypes,
|
out WeaponFireType fireTypes,
|
||||||
out WeaponModifiers modifiers)
|
out WeaponModifiers modifiers)
|
||||||
{
|
{
|
||||||
|
caliber = default;
|
||||||
|
range = default;
|
||||||
|
type = default;
|
||||||
|
fireTypes = default;
|
||||||
|
modifiers = default;
|
||||||
|
|
||||||
return
|
return
|
||||||
Enum.TryParse(weapon.WeaponCaliber, out caliber) &&
|
Enum.TryParse(weapon.WeaponCaliber, out caliber) &&
|
||||||
Enum.TryParse(weapon.WeaponRange, out range) &&
|
Enum.TryParse(weapon.WeaponRange, out range) &&
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
|
||||||
ContextMenu.AddOption("Save Loadout",
|
ContextMenu.AddOption("Save Loadout",
|
||||||
() =>
|
() =>
|
||||||
{
|
{
|
||||||
GameManager.QueueRuntimeLoadoutTemplateCommit(RuntimeEntityBlueprintProjector.CaptureBlueprint(_displayedEntity));
|
GameManager.QueueRuntimeLoadoutTemplateCommit(EntityConstructionBlueprintProjector.CaptureBlueprint(_displayedEntity));
|
||||||
});
|
});
|
||||||
|
|
||||||
if (GameManager.LoadoutTemplates.Any())
|
if (GameManager.LoadoutTemplates.Any())
|
||||||
|
|
@ -189,14 +189,14 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
|
||||||
|
|
||||||
private (string text, Action action, bool enabled) LoadoutOption(AetheriaRuntimeLoadoutTemplateSnapshot template)
|
private (string text, Action action, bool enabled) LoadoutOption(AetheriaRuntimeLoadoutTemplateSnapshot template)
|
||||||
{
|
{
|
||||||
var blueprint = GameManager.CreateRuntimeBlueprint(template);
|
var blueprint = GameManager.CreateEntityConstructionBlueprint(template);
|
||||||
if (blueprint == null)
|
if (blueprint == null)
|
||||||
return ($"{template.Name} - unavailable", () => { }, false);
|
return ($"{template.Name} - unavailable", () => { }, false);
|
||||||
|
|
||||||
var price = blueprint.Price(GameManager.ItemManager);
|
var price = blueprint.Price(GameManager.ItemManager);
|
||||||
return ($"{template.Name} - {price:n0}", () =>
|
return ($"{template.Name} - {price:n0}", () =>
|
||||||
{
|
{
|
||||||
var entity = RuntimeEntityBlueprintProjector.InstantiateFromBlueprint(GameManager.ItemManager, GameManager.Zone, blueprint, true);
|
var entity = EntityConstructionBlueprintProjector.InstantiateFromBlueprint(GameManager.ItemManager, GameManager.Zone, blueprint, true);
|
||||||
entity.SetParent(GameManager.DockedEntity);
|
entity.SetParent(GameManager.DockedEntity);
|
||||||
GameManager.Credits -= price;
|
GameManager.Credits -= price;
|
||||||
GameManager.CurrentEntity = entity;
|
GameManager.CurrentEntity = entity;
|
||||||
|
|
@ -885,7 +885,7 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
|
||||||
if (typedItem != null && typedItem.Durability > 0)
|
if (typedItem != null && typedItem.Durability > 0)
|
||||||
return (float)typedItem.Durability;
|
return (float)typedItem.Durability;
|
||||||
|
|
||||||
return Math.Max(item.Durability, 1f);
|
return item is EquippableItem equippable ? Math.Max(equippable.Durability, 1f) : 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Shape GetItemShape(ItemInstance item)
|
private Shape GetItemShape(ItemInstance item)
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using GameCult.Aetheria.State.Unity;
|
using GameCult.Aetheria.State.Unity;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UniRx;
|
using UniRx;
|
||||||
|
|
@ -378,7 +379,7 @@ public class PropertiesPanel : MonoBehaviour
|
||||||
if (typedItem != null && typedItem.Durability > 0)
|
if (typedItem != null && typedItem.Durability > 0)
|
||||||
return (float)typedItem.Durability;
|
return (float)typedItem.Durability;
|
||||||
|
|
||||||
return Math.Max(item.Durability, 1f);
|
return item is EquippableItem equippable ? Math.Max(equippable.Durability, 1f) : 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static (float minimum, float maximum) GetThermalRange(AetheriaRuntimeCatalogItem typedItem)
|
private static (float minimum, float maximum) GetThermalRange(AetheriaRuntimeCatalogItem typedItem)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 0592fb576747e3443949d779d01068aa
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -127,7 +127,7 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
||||||
now queues current-zone/current-entity-collection snapshots, current
|
now queues current-zone/current-entity-collection snapshots, current
|
||||||
action-bar bindings, and current faction relationship rows through the
|
action-bar bindings, and current faction relationship rows through the
|
||||||
runtime commit log during run checkpoints; `ZoneConstructionBlueprint` and
|
runtime commit log during run checkpoints; `ZoneConstructionBlueprint` and
|
||||||
`RuntimeEntityBlueprint` remain runtime construction/loadout projections
|
`EntityConstructionBlueprint` remain one-shot construction/loadout projections
|
||||||
rather than durable file formats. Runtime blueprints no longer capture or
|
rather than durable file formats. Runtime blueprints no longer capture or
|
||||||
restore live temperature, armor, max-armor, or hull-conductivity grids; those
|
restore live temperature, armor, max-armor, or hull-conductivity grids; those
|
||||||
grids are typed checkpoint state, not loadout/construction template state.
|
grids are typed checkpoint state, not loadout/construction template state.
|
||||||
|
|
@ -186,7 +186,7 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
||||||
triggers publish pending pulled state, and stat modifiers publish
|
triggers publish pending pulled state, and stat modifiers publish
|
||||||
applied/executed flags plus target-stat count. Turret controllers publish
|
applied/executed flags plus target-stat count. Turret controllers publish
|
||||||
initialized weapon count, shot speed, and predictive-aim flag.
|
initialized weapon count, shot speed, and predictive-aim flag.
|
||||||
`RuntimeEntityBlueprint` still exists for construction/loadout projection,
|
`EntityConstructionBlueprint` still exists for construction/loadout projection,
|
||||||
but those live hull grids and session scalars are not blueprint fields and
|
but those live hull grids and session scalars are not blueprint fields and
|
||||||
cannot be restored by the old blueprint projector path.
|
cannot be restored by the old blueprint projector path.
|
||||||
- `Aetheria.State` now defines `AetheriaLoadoutTemplate` as the typed Verse
|
- `Aetheria.State` now defines `AetheriaLoadoutTemplate` as the typed Verse
|
||||||
|
|
@ -194,7 +194,7 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
||||||
equipment, cargo bay, docking bay, child-entity, assignment, and weapon-group
|
equipment, cargo bay, docking bay, child-entity, assignment, and weapon-group
|
||||||
state through record-key references and typed value slots instead of opaque
|
state through record-key references and typed value slots instead of opaque
|
||||||
runtime blueprint serialization. Unity's save/loadout UI now projects its
|
runtime blueprint serialization. Unity's save/loadout UI now projects its
|
||||||
in-memory `RuntimeEntityBlueprint` into a typed Verse commit command, and
|
in-memory `EntityConstructionBlueprint` into a typed Verse commit command, and
|
||||||
gameplay boot reads typed loadout templates back from `aetheria-world.cc`
|
gameplay boot reads typed loadout templates back from `aetheria-world.cc`
|
||||||
through `AetheriaRuntimeCatalogStore` before lowering them into runtime
|
through `AetheriaRuntimeCatalogStore` before lowering them into runtime
|
||||||
construction blueprints for the restore menu. The in-memory list remains a
|
construction blueprints for the restore menu. The in-memory list remains a
|
||||||
|
|
@ -842,7 +842,7 @@ First Aetheria surfaces to publish:
|
||||||
- Done: move TurretController weapon range and shot-speed evaluation behind
|
- Done: move TurretController weapon range and shot-speed evaluation behind
|
||||||
`Weapon` runtime methods, so turret AI no longer casts weapon config DTOs
|
`Weapon` runtime methods, so turret AI no longer casts weapon config DTOs
|
||||||
to decide firing range or predictive aim.
|
to decide firing range or predictive aim.
|
||||||
- Done: cut live simulation grids out of `RuntimeEntityBlueprint`; loadout
|
- Done: cut live simulation grids out of `EntityConstructionBlueprint`; loadout
|
||||||
and construction templates no longer capture or restore temperature,
|
and construction templates no longer capture or restore temperature,
|
||||||
armor, max-armor, or hull-conductivity state.
|
armor, max-armor, or hull-conductivity state.
|
||||||
- Done: add Unity package readback for canonical typed run, zone, and
|
- Done: add Unity package readback for canonical typed run, zone, and
|
||||||
|
|
@ -1065,7 +1065,7 @@ First Aetheria surfaces to publish:
|
||||||
- Done: remove public `GasGiantData`/`SunData` handles from runtime wrappers;
|
- Done: remove public `GasGiantData`/`SunData` handles from runtime wrappers;
|
||||||
wave and light calculations now use copied wrapper fields after
|
wave and light calculations now use copied wrapper fields after
|
||||||
construction.
|
construction.
|
||||||
- Done: move saved loadout template ownership off `RuntimeEntityBlueprint`;
|
- Done: move saved loadout template ownership off `EntityConstructionBlueprint`;
|
||||||
`ActionGameManager` keeps typed `AetheriaRuntimeLoadoutTemplateSnapshot`
|
`ActionGameManager` keeps typed `AetheriaRuntimeLoadoutTemplateSnapshot`
|
||||||
documents and projects blueprints only for pricing, instantiation, and
|
documents and projects blueprints only for pricing, instantiation, and
|
||||||
commit boundaries.
|
commit boundaries.
|
||||||
|
|
@ -1313,16 +1313,20 @@ First Aetheria surfaces to publish:
|
||||||
- Done: quarantine the vendored Unity `MessagePack` assembly by disabling
|
- Done: quarantine the vendored Unity `MessagePack` assembly by disabling
|
||||||
asmdef auto-reference; only explicit state-spine assemblies should see it
|
asmdef auto-reference; only explicit state-spine assemblies should see it
|
||||||
while the Unity CultCache bridge still needs a low-level `.cc` codec.
|
while the Unity CultCache bridge still needs a low-level `.cc` codec.
|
||||||
- Done: demote `ZonePack`/`EntityPack` runtime names to
|
- Done: demote `ZonePack`/`EntityPack` save-payload names to
|
||||||
`RuntimeZoneBlueprint`/`RuntimeEntityBlueprint`, and rename loadout
|
construction blueprint vocabulary, and rename loadout collections away
|
||||||
collections away from save-payload vocabulary. These are now explicitly
|
from save-payload vocabulary. These are now explicitly construction
|
||||||
runtime construction projections, not portable state authority.
|
projections, not portable state authority.
|
||||||
- Done: continue the zone demotion by renaming `RuntimeZoneBlueprint` to
|
- Done: continue the zone demotion by renaming `RuntimeZoneBlueprint` to
|
||||||
`ZoneConstructionBlueprint`; the old intermediate name no longer appears
|
`ZoneConstructionBlueprint`; the old intermediate name no longer appears
|
||||||
in live Unity source.
|
in live Unity source.
|
||||||
- Done: rename the old `EntitySerializer` runtime helper to
|
- Done: rename the old `EntitySerializer` helper to
|
||||||
`RuntimeEntityBlueprintProjector`; it captures/instantiates runtime
|
`EntityConstructionBlueprintProjector`; it captures/instantiates
|
||||||
blueprint projections and no longer presents itself as a serializer.
|
construction blueprint projections and no longer presents itself as a
|
||||||
|
serializer or runtime-state owner.
|
||||||
|
- Done: delete the unused `Zone.AddOrbit(OrbitData)` construction-row
|
||||||
|
writer; zone orbit construction flows through `ZoneConstructionBlueprint`
|
||||||
|
only.
|
||||||
- Done: demote Unity's live `PlayerSettings` runtime object to
|
- Done: demote Unity's live `PlayerSettings` runtime object to
|
||||||
`RuntimePlayerSettings`; `AetheriaPlayerSettings` remains the typed Verse
|
`RuntimePlayerSettings`; `AetheriaPlayerSettings` remains the typed Verse
|
||||||
state document owner, while Unity only keeps a session projection and
|
state document owner, while Unity only keeps a session projection and
|
||||||
|
|
@ -1398,8 +1402,9 @@ First Aetheria surfaces to publish:
|
||||||
live Unity source has no `EntityPack`, `ShipPack`, `OrbitalEntityPack`,
|
live Unity source has no `EntityPack`, `ShipPack`, `OrbitalEntityPack`,
|
||||||
`ZonePack`, `PackedContents`, `PackZone`, `EntitySerializer.Pack`, or
|
`ZonePack`, `PackedContents`, `PackZone`, `EntitySerializer.Pack`, or
|
||||||
`EntitySerializer.Unpack` hits.
|
`EntitySerializer.Unpack` hits.
|
||||||
- Runtime entity blueprint projection no longer uses the `EntitySerializer`
|
- Entity construction blueprint projection no longer uses the `EntitySerializer`
|
||||||
authority name; live Unity source calls `RuntimeEntityBlueprintProjector`.
|
or runtime-state authority names; live Unity source calls
|
||||||
|
`EntityConstructionBlueprintProjector`.
|
||||||
- Unity runtime settings projection is now `RuntimePlayerSettings`; live Unity
|
- Unity runtime settings projection is now `RuntimePlayerSettings`; live Unity
|
||||||
source has no standalone `PlayerSettings` class/property/method symbols.
|
source has no standalone `PlayerSettings` class/property/method symbols.
|
||||||
- Input binding and action-bar edits now queue the same typed player-settings
|
- Input binding and action-bar edits now queue the same typed player-settings
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue