From e41318916fc104c17bfcb9272b514c3c48cca9ad Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 13 Jun 2026 09:47:25 +0100 Subject: [PATCH] Import typed interior hardpoint geometry --- .voidbot/state/aetheria.cc | Bin 22125 -> 22326 bytes Aetheria.State.Import/Program.cs | 156 ++++++++++++++++++ Aetheria.State.Unity.Smoke/Program.cs | 18 ++ .../AetheriaRuntimeCatalogSnapshot.cs | 82 +++++++++ Aetheria.State.Verify/Program.cs | 55 ++++++ .../Documents/AetheriaItemDefinition.cs | 49 ++++++ Aetheria.State/README.md | 15 +- GameData/aetheria-world.cc | Bin 16592 -> 17677 bytes ...6bcb5217c5fee889541667442528a98491.msgpack | 4 +- ...a275af9147897cd1f60b23a18cc48b7fee.msgpack | 4 +- ...3921217d7ba077f48246e0b33fc1493431.msgpack | 4 +- ...3fbff428c15ab389a42d0d2aa0e75980fd.msgpack | 2 +- ...6b93b4259541f580967a52464d9686f3aa.msgpack | 4 +- ...fdee0c7ff471c8bb4b4e0b2067eb36da09.msgpack | 4 +- ...cc1c87e1e40afcab2bb8dd8f889fe0918b.msgpack | 2 +- ...1ac1edd3dffac04996b12d9f9d0e8304f1.msgpack | 2 +- ...1368ec2948a11425e377fa92a71d575637.msgpack | 4 +- ...8858c36442af01034165db67b886e94ce3.msgpack | 4 +- ...2cd5bdbf86136a558044079cba7a029ac8.msgpack | 4 +- ...6ba52bd445978bb0cb399047cf64aa722f.msgpack | 4 +- ...3e8ff05893f872c2437a5621f2a2eec71b.msgpack | 4 +- ...9bb06b3f45a746ac5f7739b1cbd896443f.msgpack | 4 +- ...07d0fb3e1d5d58fbc176520a100614f404.msgpack | 2 +- ...48df04cfa2250b7101fc00f9c6f2c1317c.msgpack | 4 +- ...06e97680a29efe7d1436947e3a8eba4c95.msgpack | 4 +- ...2ccd793983d2af31967b7d70a977fd2e02.msgpack | 4 +- ...f91cb8ca685ea96318a795771ae6d911eb.msgpack | 4 +- ...db27aa2b805705e823bed4877c4623cf88.msgpack | 4 +- ...5eead201bac20496fa5a2649e4b1522a37.msgpack | 4 +- ...fa0290206edd7b2e0dc08b0f9842dea0f2.msgpack | 4 +- ...dd6eeb3d8311f3753af60c2b5596719b15.msgpack | 4 +- ...d7e3a5d8fa1509efb8a9249d0e48891299.msgpack | 2 +- ...c76a739617023ffa2c2aeb091cf5580b7d.msgpack | 2 +- ...f5bd89832b6e55959ea4902bfa15bc8117.msgpack | 4 +- ...d52fa612f479ccbad76307db432c0b6147.msgpack | 2 +- ...268eff507c40681c6b1955fa786f99066c.msgpack | 2 +- ...ad0cb1b8ec9229ee0525bb8571edb6ea32.msgpack | 4 +- ...616a532f076ae0a66f2257f9c7899100a9.msgpack | 4 +- ...ae26acc72f64a9ca536b895d59a8675c66.msgpack | 4 +- ...44c85439d1f3caa1caaf24beb34e7d8d50.msgpack | 2 +- ...9500e6c9192f76c38393eb84bee3345ee0.msgpack | 4 +- ...dd6ef83562c3b82a0e03c21a37c241f5b8.msgpack | 4 +- ...5cdcddbcded4980427149dc10ba9eb08a1.msgpack | 2 +- ...baf1c52a76a0e7adce5acb06a2d7f5bd79.msgpack | 4 +- ...79872da971faf89ceef4c395a64f1b5e88.msgpack | 4 +- ...60257125aef40381db5877aa16c02b39e4.msgpack | 4 +- ...ea1ff3e3f204925bb28ccb1d45d2b3d732.msgpack | 4 +- ...786b7af0cd4f808a703d5f242c9b0fd372.msgpack | 2 +- ...05ae7658005ee7019c3810650baf8e6c4f.msgpack | 4 +- ...d65f26dcd9e6b2bc9ef89cb16dd16e4b07.msgpack | 4 +- ...4187f90237d4386c76e3b847376b466dd3.msgpack | 4 +- ...042b3f00710055061bb4b6d9b2306d14c3.msgpack | 2 +- ...36ce1066ae558fc09801457a30674f515b.msgpack | 4 +- ...e298fc6ceb8352b047986733e405d6006b.msgpack | 4 +- ...7cb628668b9e3842a59c0e2dd106a820bb.msgpack | 4 +- ...b30b7614eb776ee14b16bed525675b67b8.msgpack | 4 +- ...6321b14e59b2b62a7e914e74771273097a.msgpack | 4 +- ...d39c7f7412772d7ad9adc1f1db3f39cc10.msgpack | 4 +- ...e152a6e77f714229898548c45b02cc72d6.msgpack | 4 +- ...0ecea7ff27435bd9e9d534bcb0c1b892ef.msgpack | 4 +- ...daf7ada6d75ceaa0a07f1e0dc46d65003f.msgpack | 4 +- ...25c2c88303bdbc1a54a178c895086e6c55.msgpack | 4 +- ...320b70986559345e184297437f13bcae7d.msgpack | 4 +- ...1f7c425775d76ba34c55a9ae879e27b3d8.msgpack | 2 +- ...8181b2c9794fa3a70f803c67de8d0dcff0.msgpack | 4 +- ...918704bf6ad447ce7a4733664d3888359d.msgpack | 4 +- ...9358f522e1794e5a675f77b06e99ee061e.msgpack | 2 +- ...72d6a82431bf8c842bc57b1c7f3bae4876.msgpack | 4 +- ...78de0d154287774728c30a461ed0d9e334.msgpack | 4 +- ...5a77b77ba285ba04fa6e1c678d86988867.msgpack | 4 +- ...cb33184e1aade105b24afaba265b148ce4.msgpack | 4 +- ...92a3874ff91d1e08024120231bb836c2bb.msgpack | 4 +- ...30a284a5876d9f55597d457cebba6a2226.msgpack | 4 +- ...04c4d886f2bf72ae35b733603966e28d61.msgpack | 4 +- ...a65e76836067e0661b91eb2fa4cc5c2b3f.msgpack | 4 +- ...6550ff7ce20b046a653debb4e7bc10e047.msgpack | 2 +- ...2888041296cc8e256b3774e29b1b969c4b.msgpack | 4 +- ...eb069ff9e1ed707a2590cedcffc835ac23.msgpack | 4 +- ...199f861a6986234742cd7d603c9d8cbe86.msgpack | 4 +- ...699d5fc930104242470efeddc8f9500222.msgpack | 4 +- ...ef7f34c156794d697606252db56928e23b.msgpack | 4 +- ...d30298201bd0eced6bfa9c3b7e01d9448c.msgpack | 4 +- ...946ba31ec32b37bfe4b0829825c4e85029.msgpack | 2 +- ...cb793e7bcf5f7afa2c328d12d6561d0f1e.msgpack | 4 +- ...56919b8dd915d9fef8f2361b77d9bf6b99.msgpack | 4 +- ...386b0b8e8f80cfe0ad311061b682ecff95.msgpack | 4 +- ...1c82be1f818ee634833d6e3e637e694344.msgpack | 4 +- ...4f2a1a72a54f72c42a4e4c1d0f231586ba.msgpack | 4 +- ...34144722b989cf3cf2f03431cabc1f3929.msgpack | 4 +- ...a34a37e5fcb7892a29eb02cf5da1c338de.msgpack | 4 +- ...c97b1604f21df8132d6305f350e80ba5b7.msgpack | 4 +- ...c595e7f3aea98935f9e9a6aafdf8b4d9d2.msgpack | 4 +- ...1539aa45529f4c740066eb5301ed36edfd.msgpack | 4 +- ...2e4971d71ab5b8b38ac0c89c3f9a764764.msgpack | 2 +- ...79e8b3e7a51e9d5145e08f639a88de38be.msgpack | 4 +- ...cb2be74c711de0d5b22f9160aba0ee7ee9.msgpack | 2 +- ...65d32cdc881f54a82297e048ac6adff8ff.msgpack | 4 +- ...0336d40c18572d3f6ed6318a4008af5a89.msgpack | 4 +- ...fcd8fa1e9858c270d58ccf5d2170a3842c.msgpack | 4 +- ...d2064953cbde740647c3a820bacf9c27c3.msgpack | 4 +- ...33d98be75491a3b1b3af0d080505b31b21.msgpack | 4 +- ...76f8e8486ae0dd84c256d8c672c54837ec.msgpack | 4 +- ...7dd3b2bd29116afbf8857d8b5afdc85c8f.msgpack | 4 +- ...26af1122625e375d29d192aacad668e2a7.msgpack | 4 +- ...0d87791a49bb911b2e7ab294e1303e180c.msgpack | 4 +- ...85198b8b38c36fc5417df965fe098c7523.msgpack | 4 +- ...fdf046f5a7951655cf83dc22938e7563b2.msgpack | 4 +- ...f4651415e50cce4eb13240370a1394b928.msgpack | 4 +- ...52a044e5c42314b43945ded225f3009bf9.msgpack | 4 +- ...b76604f01f891d11f6bc9c079621d2b45c.msgpack | 4 +- ...dd6056bad45424aaadc0ed86534053fd43.msgpack | 2 +- ...6a84bb1ad648c6e3f72452f8ee47f98cb5.msgpack | 4 +- ...28230b2636da2c91d4e12ec6c804c8a04a.msgpack | 4 +- ...480afdb5047dee177edeac207ce337e083.msgpack | 4 +- ...7f81911af70edf42cb5275ce8f96dee707.msgpack | 2 +- ...07128f325b6f8981e61bf216400dd09f8e.msgpack | 4 +- ...f4dc349da455027ef5db10f14d88553894.msgpack | 4 +- ...1ade7f7e67031a1f69bec307690212bb53.msgpack | 4 +- ...3ff4da3985d54c314bcaf6ceca29a0d80e.msgpack | 4 +- ...1b1a624f836079caf3f9c892cbc94d0aae.msgpack | 4 +- ...01600dd1985f3e1ddeeb16b10593afc5ab.msgpack | 2 +- ...08e1a83f1dc14096339f67d56c0e0869ff.msgpack | 4 +- ...06d60f0e24b919fdf36a025cfddee87011.msgpack | 4 +- ...0f1c261fbbb7f1961d8acd057a3b287e38.msgpack | 4 +- ...5b07b6b9ec7bba75debf9915460dbe3e1a.msgpack | 4 +- ...2762b088b45c2b873b2816cc7dd4e7672c.msgpack | 4 +- ...e79aecf53d9558fd48290599da73065788.msgpack | 4 +- ...3dd2a11f08fa54e6ffc699ee7ff032399d.msgpack | 2 +- ...36c731b877c242d1dd966801858145a431.msgpack | 4 +- ...8668f9d2c05806983d89a8e9227a63871e.msgpack | 4 +- ...e2540502e68596a3603f76389e57028805.msgpack | 4 +- ...9ab8ab7bd5c5792eaffa4226a6c04eb105.msgpack | 4 +- ...b464103bd76e410747a9c9b7ff24e3c4e1.msgpack | 4 +- ...5ee0f0a8c3001293f5702aa2424e24427e.msgpack | 2 +- ...731eadcb421407c89d781610905a20f024.msgpack | 2 +- ...4a3699e1985d69a91cf8dcb7f4c66bddf5.msgpack | 4 +- ...25da6d94408d6a3d1d9118f6ee39b59f6b.msgpack | 4 +- ...27c780283d518bb03ec1796d41885bd88a.msgpack | 4 +- ...0f473896745b146e5990046afe53ac54b8.msgpack | 2 +- ...e9c2093d642b67286400600a6215e90683.msgpack | 4 +- ...8f723d3a0a7f48de7e52fe545a530c2559.msgpack | 4 +- ...3f7d34327c64a8a33c3dfb1809131717a1.msgpack | 4 +- ...42f2cef8f92eb11513d698d60a8ad234c4.msgpack | 4 +- ...d4f7d77f094191b2e9d7590b6795950780.msgpack | 4 +- ...c4bd13b358f1ffb0937b14289d35ab2d53.msgpack | 4 +- ...6b87f1ba0566a44f3d381b757edb40d25d.msgpack | 4 +- ...e4f0b2d619dceb69ec354fe56f99488b42.msgpack | 2 +- ...beb23a1fa47461adda98ef10295021480f.msgpack | 4 +- ...d3f4d154424deaf2f21dd15d213684d46f.msgpack | 4 +- ...8da4a63ef12a1dc5126b11ebba43840395.msgpack | 2 +- docs/aetheria-perfect-machine-map.md | 25 ++- 151 files changed, 644 insertions(+), 270 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index da42f64d1b523da140c333ba41c6074efe5ce1cb..4ec42eec4da6042ee697a98fc1f4c9880b976661 100644 GIT binary patch delta 1409 zcmaJ>O=}cE5OougB%-$%6p00Xfn+zyt{Xqlh?^LUMiBKN@nUDDcBjeA^w`~#I1&gd zxknlluYTeOA}n|n&tAML;vWzZ&t9ya*_l-lPrFmy{rdHLuj<>&(wkSM*H3!-4o(~$ zt5(M9=11?4SwFMMyzf~X$cp3DL-Th^gGTh;$Sbv4TIt(3T>9DGzcJW##bKKHq6GnO zNv637Ar#9HNmMA8Pyr7$N-iV>Of4#4p$lH@``|I@MuJwUra&hVx}Y@ESb6ODj0c}e zb@P4qwjf}Uf+;3jqQR2UY2hsLutk5nz{+D0su6JMo+Uy#P4Lsis=LEM-=_`s?qcz` z`-z0e7?|-rLw(R>4r)~~rQ?IEfY&3T=pEXlAG<_^mpOgK8tg3#OyQ|e%Ou0s9>Nk4 zX>ydHkPgfppw@kSnNW2qNQYmw+FewYr>h!6MWTLuJBKaiB;W|rGt`9X__0gy zOoNY%KtzZj=xUFJEt04ULn|;RY%x}sM?i_+yvnGOht@d9Lx(K#g~M`xCP|yrx%3e& z$#nt?^m13w)uGU!B@%<2mBff~X$>XYB9!LK-r?16GqH{(0$z)G6cG7Q$Jz-#ORR`a ztSxO&B&qLOD5YiWXlQb+?L$;7ts@GWQUsl(%yv?B(Rx2+?akaRLNx-*9`}({SPfm@ z!cYV=diJBxqpWm7+j8M-UV-KB8C5)p{Y;#QDFu{pkEm+W*lx6DcXLllPy{Q_S?G8| zUcjdMykY0xnG7SySZHfl0}dv~fDA%=*H7m?)c-iNW^v z1GoBSW~Q;pLlPzHoIer&0?hJkW56{A)F*V3TgR38T)l7BYR4KMPhLPrNY~~ZA;e{p zAWnOedd8Lt!E$ZN9j_N?pUY&@*0sUSjj8h_6ZN3&kpCwiZ1VpRdh={@#q65hT1y+x zdL@Yn4=_z&I!V$QQpjaxhd{XKD|2O{M7a!Y@Ian5|`-JTD=gW2F)Kl8SzOmv3hCZo@aqIx8)_RQVPEA^_a Nv>(j9>n}?6`Co)={$v0E delta 1231 zcmah}&r4K69Bne;K z8Jo&ZjOCNTVo&m>?N;+JEDCTnWhn_fK(_%M6D?x zk^&c1(6tKnz$Kc5q6|tCO^5M8gWzEeLRuzn4bE|r5TOT4R4G!X%fwx4Bt=9^=28WWYXP%V2UIe$fJ4nwpJ8<-c-GdRqhY9q zlh01CBk7fxNlY5gr=xpdVWa@6Ob1x*a7o16Q{dV>AlyrC9~elM3;pW~d?CS)b&Ob3 z2qCG7Seq#DnbwS#!4+J^5tS%}q=?G_ zSSUzh?gZD!Rjw$=x`(Y!QBEb%I7f^RSi&3;g_K3xT+7(CO_;(CRYdF!gA#wKl`3Us z021p!NTW#!(HOOAR0EQls+JBuWs9~#voDBkvk+B6hI$*IA5W&_G~~}Urb`Bf`qonp zaPW$uZ!;I0Z2-O$(f#*L{A$(&Jj1D zN5K;oqonAt6rqP4TCG&hMg7r^PY8FBlNIW#4_o%se+=DiyL5hqpetF~G(!=sQwa8n zc~u&({-I>cqQ)FFVp=tK1D%CJ3F$G8+o7^I?@Q`$phbIR61T~>@}wGC7ke$^BR&@$$aV55f3N<%u(KNmmx)rim)7L}uzzy;*fq!5 z9Mm+HYV9~Ef>KkMFiR+erV ItemRotations = CreateEnumMap([ + "None", + "CounterClockwise", + "Reversed", + "Clockwise" + ]); private static readonly Dictionary HullTypes = CreateEnumMap(["Ship", "Station", "Turret"]); private static readonly Dictionary WeaponRanges = CreateEnumMap(["Melee", "Short", "Medium", "Long"]); private static readonly Dictionary WeaponCalibers = CreateEnumMap(["Small", "Medium", "Large", "ExtraLarge"]); @@ -305,6 +311,8 @@ internal static class LegacyCatalogReader var name = GetString(payload, 1); var description = GetString(payload, 2); var shape = ReadShape(payload, 5); + var interiorShape = ReadInteriorShape(unionKey, payload, shape); + var hardpoints = unionKey == 3 ? ReadHardpoints(payload, 23) : []; var behaviorKinds = ReadBehaviorKinds(payload, unionKey == 31 || unionKey is 2 or 3 or 29 or 30 ? 11 : 10); var summary = new AetheriaLegacyCatalogEntrySummary { @@ -332,6 +340,11 @@ internal static class LegacyCatalogReader ShapeHeight = shape.Height, OccupiedCells = shape.OccupiedCells, ShapeCells = shape.Cells, + InteriorShapeWidth = interiorShape.Width, + InteriorShapeHeight = interiorShape.Height, + InteriorOccupiedCells = interiorShape.OccupiedCells, + InteriorShapeCells = interiorShape.Cells, + Hardpoints = hardpoints, HardpointType = GetHardpointType(unionKey, payload), HullType = unionKey == 3 ? GetEnumName(payload, 25, HullTypes) : "", BehaviorKinds = behaviorKinds, @@ -589,6 +602,44 @@ internal static class LegacyCatalogReader return flags.Length == 0 ? "" : string.Join("|", flags); } + private static AetheriaItemHardpoint[] ReadHardpoints(IReadOnlyDictionary payload, int key) + { + if (!payload.TryGetValue(key, out var value) || value is not object?[] hardpoints) + { + return []; + } + + return hardpoints + .Select(ReadHardpoint) + .Where(hardpoint => hardpoint != null) + .Cast() + .ToArray(); + } + + private static AetheriaItemHardpoint? ReadHardpoint(object? value) + { + if (value is not object?[] fields) + { + return null; + } + + var position = ReadPoint(fields.ElementAtOrDefault(1)); + var shape = ReadShapeValue(fields.ElementAtOrDefault(2)); + return new AetheriaItemHardpoint + { + Type = ReadEnumName(fields.ElementAtOrDefault(0), HardpointTypes), + PositionX = position.X, + PositionY = position.Y, + ShapeWidth = shape.Width, + ShapeHeight = shape.Height, + OccupiedCells = shape.OccupiedCells, + ShapeCells = shape.Cells, + Transform = ReadStringValue(fields.ElementAtOrDefault(3)), + Rotation = ReadEnumName(fields.ElementAtOrDefault(4), ItemRotations), + Armor = ReadDoubleValue(fields.ElementAtOrDefault(5)) + }; + } + private static string[] ReadBehaviorKinds(IReadOnlyDictionary payload, int key) { if (!payload.TryGetValue(key, out var value) || value is not object?[] behaviors) @@ -641,6 +692,29 @@ internal static class LegacyCatalogReader return ShapeFacts.Empty; } + return ReadShapeValue(value); + } + + private static ShapeFacts ReadInteriorShape( + int unionKey, + IReadOnlyDictionary payload, + ShapeFacts itemShape) + { + return unionKey switch + { + 3 => itemShape.Shrink(), + 29 or 30 => ReadShape(payload, 24), + _ => ShapeFacts.Empty + }; + } + + private static ShapeFacts ReadShapeValue(object? value) + { + if (value == null) + { + return ShapeFacts.Empty; + } + var matrix = UnwrapShapeMatrix(value); if (matrix is not object?[] columns) { @@ -690,6 +764,53 @@ internal static class LegacyCatalogReader { return value is object?[] shapeObject && shapeObject.Length == 1 ? shapeObject[0] : value; } + + private static PointFacts ReadPoint(object? value) + { + if (value is not object?[] coordinates) + { + return PointFacts.Empty; + } + + return new PointFacts( + ReadIntValue(coordinates.ElementAtOrDefault(0)), + ReadIntValue(coordinates.ElementAtOrDefault(1))); + } + + private static string ReadEnumName(object? value, IReadOnlyDictionary names) + { + var index = ReadIntValue(value); + return names.TryGetValue(index, out var name) ? name : ""; + } + + private static int ReadIntValue(object? value) + { + return value switch + { + long integerValue => checked((int) integerValue), + int integerValue => integerValue, + double doubleValue => checked((int) doubleValue), + float floatValue => checked((int) floatValue), + _ => 0 + }; + } + + private static double ReadDoubleValue(object? value) + { + return value switch + { + double doubleValue => doubleValue, + float floatValue => floatValue, + long integerValue => integerValue, + int integerValue => integerValue, + _ => 0 + }; + } + + private static string ReadStringValue(object? value) + { + return value as string ?? ""; + } } internal sealed record LegacyCatalogEntry( @@ -703,4 +824,39 @@ internal readonly record struct ShapeFacts(int Width, int Height, AetheriaShapeC public static ShapeFacts Empty { get; } = new(0, 0, []); public int OccupiedCells => Cells.Length; + + public ShapeFacts Shrink() + { + if (Width == 0 || Height == 0 || Cells.Length == 0) + { + return Empty; + } + + var occupied = Cells + .Select(cell => (cell.X, cell.Y)) + .ToHashSet(); + var interior = Cells + .Where(cell => + IsOccupied(occupied, cell.X - 1, cell.Y - 1) && + IsOccupied(occupied, cell.X, cell.Y - 1) && + IsOccupied(occupied, cell.X + 1, cell.Y - 1) && + IsOccupied(occupied, cell.X - 1, cell.Y) && + IsOccupied(occupied, cell.X + 1, cell.Y) && + IsOccupied(occupied, cell.X - 1, cell.Y + 1) && + IsOccupied(occupied, cell.X, cell.Y + 1) && + IsOccupied(occupied, cell.X + 1, cell.Y + 1)) + .Select(cell => new AetheriaShapeCell { X = cell.X, Y = cell.Y }) + .ToArray(); + return new ShapeFacts(Width, Height, interior); + } + + private static bool IsOccupied(IReadOnlySet<(int X, int Y)> occupied, int x, int y) + { + return occupied.Contains((x, y)); + } +} + +internal readonly record struct PointFacts(int X, int Y) +{ + public static PointFacts Empty { get; } = new(0, 0); } diff --git a/Aetheria.State.Unity.Smoke/Program.cs b/Aetheria.State.Unity.Smoke/Program.cs index ea2a561d3..9d3b0a3ae 100644 --- a/Aetheria.State.Unity.Smoke/Program.cs +++ b/Aetheria.State.Unity.Smoke/Program.cs @@ -38,6 +38,23 @@ if (shaped.ShapeCells.Any(cell => cell.X < 0 || cell.Y < 0 || cell.X >= shaped.S throw new InvalidOperationException($"Runtime shape mask has out-of-bounds cells for {shaped.Name}."); } +var interior = catalog.Items.FirstOrDefault(item => item.InteriorShapeCells.Count > 0) + ?? throw new InvalidOperationException("Runtime catalog has no typed interior shape masks."); +if (interior.InteriorShapeCells.Count != interior.InteriorOccupiedCells) +{ + throw new InvalidOperationException( + $"Runtime interior shape mask count mismatch for {interior.Name}: cells={interior.InteriorShapeCells.Count}, occupied={interior.InteriorOccupiedCells}."); +} + +var hardpointHost = catalog.Items.FirstOrDefault(item => item.Hardpoints.Count > 0) + ?? throw new InvalidOperationException("Runtime catalog has no typed hardpoints."); +var hardpoint = hardpointHost.Hardpoints.First(); +if (hardpoint.ShapeCells.Count != hardpoint.OccupiedCells) +{ + throw new InvalidOperationException( + $"Runtime hardpoint shape count mismatch for {hardpointHost.Name}: cells={hardpoint.ShapeCells.Count}, occupied={hardpoint.OccupiedCells}."); +} + var behaviorKind = catalog.Items.SelectMany(item => item.BehaviorKinds).FirstOrDefault() ?? throw new InvalidOperationException("Runtime catalog has no behavior kind fingerprints."); if (!catalog.FindItemsByBehavior(behaviorKind).Any()) @@ -67,5 +84,6 @@ if (surface?.Schema != "gamecult.eve.surface.v1" || Console.WriteLine($"Aetheria Unity runtime catalog smoke passed: {statePath}"); Console.WriteLine($"Items/trade/equipment: {catalog.Items.Count}/{catalog.TradeItems.Count}/{catalog.EquipmentItems.Count}"); Console.WriteLine($"Shape mask sample: {shaped.Name} {shaped.ShapeWidth}x{shaped.ShapeHeight}/{shaped.ShapeCells.Count}"); +Console.WriteLine($"Interior/hardpoint sample: {interior.Name} {interior.InteriorShapeCells.Count}; {hardpointHost.Name} {hardpoint.Type} {hardpoint.ShapeCells.Count}"); Console.WriteLine($"Behavior sample: {behaviorKind}"); Console.WriteLine($"Eve surface: {surface.Surface.Id}"); diff --git a/Aetheria.State.Unity/AetheriaRuntimeCatalogSnapshot.cs b/Aetheria.State.Unity/AetheriaRuntimeCatalogSnapshot.cs index aebef747f..88570f85c 100644 --- a/Aetheria.State.Unity/AetheriaRuntimeCatalogSnapshot.cs +++ b/Aetheria.State.Unity/AetheriaRuntimeCatalogSnapshot.cs @@ -108,6 +108,11 @@ public sealed class AetheriaRuntimeCatalogItem int shapeHeight, int occupiedCells, IReadOnlyList shapeCells, + int interiorShapeWidth, + int interiorShapeHeight, + int interiorOccupiedCells, + IReadOnlyList interiorShapeCells, + IReadOnlyList hardpoints, string hardpointType, string hullType, IReadOnlyList behaviorKinds, @@ -131,6 +136,11 @@ public sealed class AetheriaRuntimeCatalogItem ShapeHeight = shapeHeight; OccupiedCells = occupiedCells; ShapeCells = shapeCells; + InteriorShapeWidth = interiorShapeWidth; + InteriorShapeHeight = interiorShapeHeight; + InteriorOccupiedCells = interiorOccupiedCells; + InteriorShapeCells = interiorShapeCells; + Hardpoints = hardpoints; HardpointType = hardpointType; HullType = hullType; BehaviorKinds = behaviorKinds; @@ -155,6 +165,11 @@ public sealed class AetheriaRuntimeCatalogItem public int ShapeHeight { get; } public int OccupiedCells { get; } public IReadOnlyList ShapeCells { get; } + public int InteriorShapeWidth { get; } + public int InteriorShapeHeight { get; } + public int InteriorOccupiedCells { get; } + public IReadOnlyList InteriorShapeCells { get; } + public IReadOnlyList Hardpoints { get; } public string HardpointType { get; } public string HullType { get; } public IReadOnlyList BehaviorKinds { get; } @@ -181,6 +196,11 @@ public sealed class AetheriaRuntimeCatalogItem item.ShapeHeight, item.OccupiedCells, item.ShapeCells.Select(AetheriaRuntimeShapeCell.FromState).ToArray(), + item.InteriorShapeWidth, + item.InteriorShapeHeight, + item.InteriorOccupiedCells, + item.InteriorShapeCells.Select(AetheriaRuntimeShapeCell.FromState).ToArray(), + item.Hardpoints.Select(AetheriaRuntimeHardpoint.FromState).ToArray(), item.HardpointType, item.HullType, item.BehaviorKinds, @@ -212,6 +232,68 @@ public sealed class AetheriaRuntimeShapeCell } } +public sealed class AetheriaRuntimeHardpoint +{ + public AetheriaRuntimeHardpoint( + string type, + int positionX, + int positionY, + int shapeWidth, + int shapeHeight, + int occupiedCells, + IReadOnlyList shapeCells, + string transform, + string rotation, + double armor) + { + Type = type; + PositionX = positionX; + PositionY = positionY; + ShapeWidth = shapeWidth; + ShapeHeight = shapeHeight; + OccupiedCells = occupiedCells; + ShapeCells = shapeCells; + Transform = transform; + Rotation = rotation; + Armor = armor; + } + + public string Type { get; } + + public int PositionX { get; } + + public int PositionY { get; } + + public int ShapeWidth { get; } + + public int ShapeHeight { get; } + + public int OccupiedCells { get; } + + public IReadOnlyList ShapeCells { get; } + + public string Transform { get; } + + public string Rotation { get; } + + public double Armor { get; } + + public static AetheriaRuntimeHardpoint FromState(AetheriaItemHardpoint hardpoint) + { + return new AetheriaRuntimeHardpoint( + hardpoint.Type, + hardpoint.PositionX, + hardpoint.PositionY, + hardpoint.ShapeWidth, + hardpoint.ShapeHeight, + hardpoint.OccupiedCells, + hardpoint.ShapeCells.Select(AetheriaRuntimeShapeCell.FromState).ToArray(), + hardpoint.Transform, + hardpoint.Rotation, + hardpoint.Armor); + } +} + public sealed class AetheriaRuntimeCorporation { public AetheriaRuntimeCorporation( diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 117080ff9..6bc83ae0e 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -44,6 +44,9 @@ var pricedItems = items.Count(item => item.Price > 0); var manufacturedItems = items.Count(item => !string.IsNullOrWhiteSpace(item.ManufacturerLegacyId)); var shapedItems = items.Count(item => item.ShapeWidth > 0 && item.ShapeHeight > 0 && item.OccupiedCells > 0); var shapedMaskItems = items.Count(item => item.ShapeCells.Length > 0); +var interiorShapeItems = items.Count(item => item.InteriorShapeCells.Length > 0); +var hardpointHostItems = items.Count(item => item.Hardpoints.Length > 0); +var hardpointCount = items.Sum(item => item.Hardpoints.Length); var behaviorItems = items.Count(item => item.BehaviorCount > 0 && item.BehaviorKinds.Length > 0); var hardpointItems = items.Count(item => !string.IsNullOrWhiteSpace(item.HardpointType)); var hullItems = items.Count(item => !string.IsNullOrWhiteSpace(item.HullType)); @@ -89,6 +92,57 @@ foreach (var item in items.Where(item => item.ShapeCells.Length > 0)) } } +foreach (var item in items.Where(item => item.InteriorShapeCells.Length > 0)) +{ + if (item.InteriorShapeCells.Length != item.InteriorOccupiedCells) + { + throw new InvalidOperationException( + $"Typed item interior shape mask count mismatch for {item.Name}: cells={item.InteriorShapeCells.Length}, occupied={item.InteriorOccupiedCells}."); + } + + if (item.InteriorShapeCells.Any(cell => + cell.X < 0 || cell.Y < 0 || cell.X >= item.InteriorShapeWidth || cell.Y >= item.InteriorShapeHeight)) + { + throw new InvalidOperationException($"Typed item interior shape mask has out-of-bounds cells for {item.Name}."); + } +} + +if (interiorShapeItems == 0) +{ + throw new InvalidOperationException("Typed item definitions did not import any interior shape masks."); +} + +if (hardpointHostItems == 0 || hardpointCount == 0) +{ + throw new InvalidOperationException("Typed item definitions did not import any hull hardpoints."); +} + +foreach (var item in items.Where(item => item.Hardpoints.Length > 0)) +{ + foreach (var hardpoint in item.Hardpoints) + { + if (string.IsNullOrWhiteSpace(hardpoint.Type)) + { + throw new InvalidOperationException($"Typed item hardpoint has no type for {item.Name}."); + } + + if (hardpoint.ShapeCells.Length != hardpoint.OccupiedCells) + { + throw new InvalidOperationException( + $"Typed item hardpoint shape count mismatch for {item.Name}: cells={hardpoint.ShapeCells.Length}, occupied={hardpoint.OccupiedCells}."); + } + + if (hardpoint.ShapeCells.Any(cell => + cell.X < 0 || cell.Y < 0 || cell.X >= hardpoint.ShapeWidth || cell.Y >= hardpoint.ShapeHeight)) + { + throw new InvalidOperationException($"Typed item hardpoint shape has out-of-bounds cells for {item.Name}."); + } + + // Legacy content includes at least one overhanging hardpoint. Preserve the + // payload faithfully here; content repair belongs to a separate pass. + } +} + if (behaviorItems == 0) { throw new InvalidOperationException("Typed item definitions did not import any behavior fingerprints."); @@ -201,6 +255,7 @@ Console.WriteLine($"Catalog fingerprint: {quarantine.CatalogFingerprint}"); Console.WriteLine($"Item definitions: {items.Length}"); Console.WriteLine($"Priced/manufactured/shaped items: {pricedItems}/{manufacturedItems}/{shapedItems}"); Console.WriteLine($"Shape masks: {shapedMaskItems}"); +Console.WriteLine($"Interior masks/hardpoint hosts/hardpoints: {interiorShapeItems}/{hardpointHostItems}/{hardpointCount}"); Console.WriteLine($"Behavior/hardpoint/hull/weapon items: {behaviorItems}/{hardpointItems}/{hullItems}/{weaponItems}"); Console.WriteLine($"Typed catalog trade items: {tradeItems.Length}"); Console.WriteLine($"Eve catalog surface: {surface.Surface.Id} ({surface.Surface.Root.Children.Length} root children)"); diff --git a/Aetheria.State/Documents/AetheriaItemDefinition.cs b/Aetheria.State/Documents/AetheriaItemDefinition.cs index 00e904ba1..41e13087c 100644 --- a/Aetheria.State/Documents/AetheriaItemDefinition.cs +++ b/Aetheria.State/Documents/AetheriaItemDefinition.cs @@ -90,6 +90,21 @@ public sealed class AetheriaItemDefinition [Key(25)] public AetheriaShapeCell[] ShapeCells { get; set; } = []; + + [Key(26)] + public int InteriorShapeWidth { get; set; } + + [Key(27)] + public int InteriorShapeHeight { get; set; } + + [Key(28)] + public int InteriorOccupiedCells { get; set; } + + [Key(29)] + public AetheriaShapeCell[] InteriorShapeCells { get; set; } = []; + + [Key(30)] + public AetheriaItemHardpoint[] Hardpoints { get; set; } = []; } [MessagePackObject] @@ -101,3 +116,37 @@ public sealed class AetheriaShapeCell [Key(1)] public int Y { get; set; } } + +[MessagePackObject] +public sealed class AetheriaItemHardpoint +{ + [Key(0)] + public string Type { get; set; } = ""; + + [Key(1)] + public int PositionX { get; set; } + + [Key(2)] + public int PositionY { get; set; } + + [Key(3)] + public int ShapeWidth { get; set; } + + [Key(4)] + public int ShapeHeight { get; set; } + + [Key(5)] + public int OccupiedCells { get; set; } + + [Key(6)] + public AetheriaShapeCell[] ShapeCells { get; set; } = []; + + [Key(7)] + public string Transform { get; set; } = ""; + + [Key(8)] + public string Rotation { get; set; } = ""; + + [Key(9)] + public double Armor { get; set; } +} diff --git a/Aetheria.State/README.md b/Aetheria.State/README.md index 61dd20130..14d18ecdf 100644 --- a/Aetheria.State/README.md +++ b/Aetheria.State/README.md @@ -47,7 +47,8 @@ item/faction/name-file documents without compiling Unity's legacy domain model into `Aetheria.State`. The current checked-in catalog maps to 115 item definitions, 12 factions, and 12 name files. Typed item definitions include legacy manufacturer IDs, price, shape dimensions, occupied cell counts, full -shape-cell masks, and +shape-cell masks, interior shape masks for hull/cargo equipment, hull hardpoint +definitions, and stable equipment facets: hardpoint type, hull type, behavior kind fingerprints, stack size, durability, and weapon range/caliber/type/fire/modifier classifications. @@ -75,9 +76,11 @@ Unity UI Toolkit lowering package exists. It opens `aetheria-world.cc`, emits immutable catalog read models for trade, equipment, behavior, hardpoint, manufacturer, corporation, and name-file queries, exposes typed item shape masks for layout and fitting consumers, and -can read the published Eve catalog surface. It does not deserialize legacy -`DatabaseEntry` objects and does not write state. Unity can use this as the -first package boundary once CultLib/Eve runtime packaging is available. +exposes typed interior masks and hardpoints for equipment/cargo layout +consumers, and can read the published Eve catalog surface. It does not +deserialize legacy `DatabaseEntry` objects and does not write state. Unity can +use this as the first package boundary once CultLib/Eve runtime packaging is +available. `Aetheria.State.Verify` opens a materialized state file and checks that the typed migration ledger matches the actual item, corporation, and name-file @@ -85,7 +88,9 @@ records in the `.cc` store. It also verifies the canonical legacy-ID lookup API for one migrated record of each catalog kind and checks that expanded item and corporation catalog facts survived materialization. The verifier also exercises the typed catalog snapshot query surface, shape-mask invariants, and the -published Eve catalog surface. +published Eve catalog surface. Legacy content currently includes at least one +overhanging hardpoint; the verifier preserves the payload and checks hardpoint +local masks rather than silently converting content repair into migration. Use it after import when `GameData/aetheria-world.cc` changes. `Aetheria.State.Unity.Smoke` opens the materialized state through the runtime diff --git a/GameData/aetheria-world.cc b/GameData/aetheria-world.cc index b50b9e2a43c1a2881fffb554b479af0d8652ee0e..137530c0b462e3f4334ccad64cb606c77b3afe53 100644 GIT binary patch delta 511 zcmbu5y-Pw-7{-%u@K%^zi1PYTSEL4s^L5X;24Ucmb7M7}k9*1RD|O4op@^XA3`s~d zH$~De{spa8OG`_Oe?kOtAsicjzxNrQ=Y8phuCGFm{YXJz;X>{(!99n&fGMDai@8G` z3;_Z%4;YfZbg9oV6prA`$3*%Va|{p``Ylo@GGF-)aumdjND2{wRA7P_R|wHOP>MrE zkfek{hNVQ16Q2l4xa&|4N&dQYqd&4M`ZE&M;ZS05Z^WZ|5{{UN=Ik1;diJ(mso>_IOh@>ScYmxwTMgd(~gAwe@c1 zr1;NA!S|W8KE;VaHr|&2gfK|5B`um%AhS}7y(9AL*15I|vz;6fpw)(EEvIY4IiZ+0pr=pbTec6AT823Om-aN#2abdl6fNSSj) zcX0K(k9RsYUx()N(hfcXp+v_*xNa)dIF!j3~ zMpodE#0CgtG$_s-xg^TQ7MMAUL=w+ILedQCX92tF!l+5T)mt~!cfYHDZCAI=ez`vO YU7g0K@y