Use typed state for docking bay limits
This commit is contained in:
parent
ce8adfbaf2
commit
1f7e7cc09d
160 changed files with 326 additions and 274 deletions
Binary file not shown.
|
|
@ -359,6 +359,7 @@ internal static class LegacyCatalogReader
|
|||
var description = GetString(payload, 2);
|
||||
var shape = ReadShape(payload, 5);
|
||||
var interiorShape = ReadInteriorShape(unionKey, payload, shape);
|
||||
var dockingMaxSize = unionKey == 30 ? ReadPoint(payload, 25) : PointFacts.Empty;
|
||||
var hardpoints = unionKey == 3 ? ReadHardpoints(payload, 23) : [];
|
||||
var behaviorKey = unionKey == 31 || unionKey is 2 or 3 or 29 or 30 ? 11 : 10;
|
||||
var behaviorPayloads = ReadBehaviorPayloads(payload, behaviorKey);
|
||||
|
|
@ -418,6 +419,8 @@ internal static class LegacyCatalogReader
|
|||
HullArmor = unionKey == 3 ? GetDouble(payload, 27) : 0,
|
||||
HullDrag = unionKey == 3 ? GetDouble(payload, 28) : 0,
|
||||
HullCanTow = unionKey == 3 && GetBool(payload, 29),
|
||||
DockingMaxSizeX = dockingMaxSize.X,
|
||||
DockingMaxSizeY = dockingMaxSize.Y,
|
||||
SimpleCommodityCategory = unionKey == 0 ? GetEnumName(payload, 10, SimpleCommodityCategories) : "",
|
||||
CompoundCommodityCategory = unionKey == 1 ? GetEnumName(payload, 11, CompoundCommodityCategories) : "",
|
||||
WeaponRange = unionKey == 31 ? GetEnumName(payload, 24, WeaponRanges) : "",
|
||||
|
|
@ -1019,6 +1022,13 @@ internal static class LegacyCatalogReader
|
|||
ReadIntValue(coordinates.ElementAtOrDefault(1)));
|
||||
}
|
||||
|
||||
private static PointFacts ReadPoint(IReadOnlyDictionary<int, object?> payload, int key)
|
||||
{
|
||||
return payload.TryGetValue(key, out var value)
|
||||
? ReadPoint(value)
|
||||
: PointFacts.Empty;
|
||||
}
|
||||
|
||||
private static string ReadEnumName(object? value, IReadOnlyDictionary<int, string> names)
|
||||
{
|
||||
var index = ReadIntValue(value);
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ internal static class AetheriaRuntimeCatalogSnapshotMapper
|
|||
item.HullArmor,
|
||||
item.HullDrag,
|
||||
item.HullCanTow,
|
||||
item.DockingMaxSizeX,
|
||||
item.DockingMaxSizeY,
|
||||
item.SimpleCommodityCategory,
|
||||
item.CompoundCommodityCategory);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,6 +83,11 @@ var maxDurabilityItems = items
|
|||
var durableMaxDurabilityItems = maxDurabilityItems.Count(item => item.Durability > 0);
|
||||
var importedThermalRangeItems = items.Count(item => item.MaximumTemperature > item.MinimumTemperature);
|
||||
var importedThermalCurveItems = items.Count(item => item.ThermalPerformanceCurveKeys.Length > 0);
|
||||
var dockingBayItems = items.Count(item => item.Category == "DockingBayData");
|
||||
var dockingBayMaxSizeItems = items.Count(item =>
|
||||
item.Category == "DockingBayData" &&
|
||||
item.DockingMaxSizeX > 0 &&
|
||||
item.DockingMaxSizeY > 0);
|
||||
var describedCorporations = corporations.Count(corporation => !string.IsNullOrWhiteSpace(corporation.Description));
|
||||
var corporationNameLinks = corporations.Count(corporation => !string.IsNullOrWhiteSpace(corporation.GeonameFileLegacyId));
|
||||
var corporationAllegianceEdges = corporations.Sum(corporation => corporation.Allegiances.Length);
|
||||
|
|
@ -277,6 +282,12 @@ if (weaponItems == 0)
|
|||
throw new InvalidOperationException("Typed item definitions did not import any weapon facets.");
|
||||
}
|
||||
|
||||
if (dockingBayItems == 0 || dockingBayMaxSizeItems != dockingBayItems)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"Typed docking bay max-size import mismatch: dockingBays={dockingBayItems}, maxSizes={dockingBayMaxSizeItems}.");
|
||||
}
|
||||
|
||||
if (describedCorporations == 0)
|
||||
{
|
||||
throw new InvalidOperationException("Typed corporations did not import descriptions from legacy key 3.");
|
||||
|
|
@ -382,6 +393,7 @@ Console.WriteLine($"Hull armor/physical facet items: {hullArmorItems}/{hullPhysi
|
|||
Console.WriteLine($"Simple/compound commodity category items: {simpleCommodityCategoryItems}/{compoundCommodityCategoryItems}");
|
||||
Console.WriteLine($"Durable hull/weapon items: {durableMaxDurabilityItems}/{maxDurabilityItems.Length}");
|
||||
Console.WriteLine($"Thermal range/curve items: {importedThermalRangeItems}/{importedThermalCurveItems}");
|
||||
Console.WriteLine($"Docking bay max-size items: {dockingBayMaxSizeItems}/{dockingBayItems}");
|
||||
Console.WriteLine($"Typed catalog trade items: {tradeItems.Length}");
|
||||
Console.WriteLine($"Eve catalog surface: {surface.Surface.Id} ({surface.Surface.Root.Children.Length} root children)");
|
||||
Console.WriteLine($"Corporations: {corporations.Length}");
|
||||
|
|
|
|||
|
|
@ -144,6 +144,12 @@ public sealed class AetheriaItemDefinition
|
|||
|
||||
[Key(43)]
|
||||
public bool HullCanTow { get; set; }
|
||||
|
||||
[Key(44)]
|
||||
public int DockingMaxSizeX { get; set; }
|
||||
|
||||
[Key(45)]
|
||||
public int DockingMaxSizeY { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
|
|
|
|||
|
|
@ -131,6 +131,11 @@ public sealed class AetheriaRuntimeItemCatalog : IRuntimeItemProjectionReader
|
|||
cargoBay.InteriorShape = ProjectShape(item.InteriorShapeWidth, item.InteriorShapeHeight, item.InteriorShapeCells);
|
||||
}
|
||||
|
||||
if (projected is DockingBayData dockingBay)
|
||||
{
|
||||
dockingBay.MaxSize = new int2(item.DockingMaxSizeX, item.DockingMaxSizeY);
|
||||
}
|
||||
|
||||
if (projected is WeaponItemData weapon)
|
||||
{
|
||||
weapon.WeaponRange = ParseEnum(item.WeaponRange, WeaponRange.Short);
|
||||
|
|
|
|||
|
|
@ -1835,11 +1835,14 @@ public class EquippedCargoBay : EquippedItem
|
|||
public class EquippedDockingBay : EquippedCargoBay
|
||||
{
|
||||
public Ship DockedShip;
|
||||
public int2 MaxSize => _data.MaxSize;
|
||||
private DockingBayData _data;
|
||||
public int2 MaxSize { get; }
|
||||
|
||||
public EquippedDockingBay(ItemManager itemManager, EquippableItem item, int2 position, Entity entity, string name) : base(itemManager, item, position, entity, name)
|
||||
{
|
||||
_data = ItemManager.GetData(EquippableItem) as DockingBayData;
|
||||
var typedDockingBay = ItemManager.GetRuntimeItem(EquippableItem);
|
||||
MaxSize = typedDockingBay != null
|
||||
? new int2(typedDockingBay.DockingMaxSizeX, typedDockingBay.DockingMaxSizeY)
|
||||
: int2.zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue