From 15feb02863e8c82789a24e2273da53df97ccdc18 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 14 Jun 2026 01:03:52 +0100 Subject: [PATCH] Use typed shapes for inventory drag preview --- .voidbot/state/aetheria.cc | Bin 56357 -> 56550 bytes Assets/Scripts/UI/Menu/InventoryPanel.cs | 29 +++++++++++++++++------ docs/aetheria-perfect-machine-map.md | 2 ++ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 447805bd6b243012f9da4ce2ca1da7df60255388..c77d8168022a759ca69817a05ab9b402f69f3a3e 100644 GIT binary patch delta 1025 zcmZuwK}%Fo6h=o%i*k`t7QtBrZgiN@hGuLP1v%70QV0e&*Z0oMyL#u{*S+`6Fc7&A zT1Iv^?IKJ9b5YEuq##0FMQA(!Kzp~XI`7V?Gt%ZQ&O7%z-}jyGtbb1Z`I7qhws-L6 zTqZM>$xh|6>4{9XwAwRlcY2>+=qwj(cJH#4skpOwGB@d(`}?l<{`}A!?OXZQQ@4lt zOF4)X);QKddR`o{&}%>_>r|DC=ot;B5up#iGD08I^u-F7ranne@HyCOz!-JP|^jF29;Z+)ExDXH``WggQ z7zuQw6BGtQdQ3n?aUYgFrWB{KEc6N6xS4lmies=4n}mx2U!o>^3@CgObA?BM$IOfb zSq~jMEo0>oNk%TFKhc+%6|0fp9;qRc8xIg8@T3qd(uus~WA|oQh@$P2j~-7%Y2f5+ zYaQb)6$||x`lLlEX9~(Npz`P|K_1ngf0>TP- z?p!+acl`YvKwEea7eYoRB zvbl-UJHsmawO!kNe09_DZ-Z>Qz_-;j|L*n=T6 h+~FBJw!hf*AYX6~w)UTPl?(1fo2B1h2fFL|(m%x$aIXLW delta 839 zcmY*XO>0v@6s1YUwphDqt*FJj(?tz!sx_%g0}^RbN{di*ar1JMH|@Nc$IQI6&q@ml zZUqO#tzZ#cS+enaQLJ6KX>`>;;KGIAKX6_`nq+(C+X-VTd>MLJ6g3h? zs@V4JkDU;59U}X8>)cQ|QdnY~nbm?N*>+Qb2&l z2kpyRa zAHAHXDta*#-L3)}1V1jT)>%aXGND0`M_Qwbp&}J%7DT*7D3OmfCe5g+KSIKMot033JW5CGxQnAE!jWWB=m{V8`Le9MA z!K2-qQWz#8f2hOCp?*NyXI1^MIlJx zWVomlLE9YA26<6aXX4(+kf6ehlTih280XGlfTFD3^~_rop0lt>75%(^@!M#hJ=kBo zvT%#c0&WzJe;*W~8!&N5<(BA93zB9Gv~}69H>RzBdDzy!KOXBUUGDnS%4>sF{leZp zxL5ylFfiC%RrhQghoc=Ro0*z!m3px8u@|0orS9r^!pt@6zxne~4>Nl;f$QggeI6V+ Kmg4By+{%9gQ#73b diff --git a/Assets/Scripts/UI/Menu/InventoryPanel.cs b/Assets/Scripts/UI/Menu/InventoryPanel.cs index cd2e17f56..6e6ee3265 100644 --- a/Assets/Scripts/UI/Menu/InventoryPanel.cs +++ b/Assets/Scripts/UI/Menu/InventoryPanel.cs @@ -363,7 +363,7 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler var item = entity.GearOccupancy[v.x, v.y]; if (item != null) { - var originalOccupancy = hullData.Shape.Inset(item.Data.Shape, item.Position, item.EquippableItem.Rotation); + var originalOccupancy = hullData.Shape.Inset(GetItemShape(item.EquippableItem), item.Position, item.EquippableItem.Rotation); _dragCells = originalOccupancy.Coordinates .Select(v1 => Instantiate(CellInstances[v1], DragParent, true).transform).ToArray(); foreach(var dragCell in _dragCells) @@ -411,14 +411,13 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler //Debug.Log("Entity Pointer Enter"); if (!(GameManager.DragObject is ItemDragObject itemDragObject)) return; var item = itemDragObject.Item; - var itemData = GameManager.ItemManager.GetData(item); if (!(item is EquippableItem equippableItem)) return; var placementPosition = v + itemDragObject.OriginCellOffset; if (entity.ItemFits(equippableItem, placementPosition)) { //foreach (var cell in _dragCells) cell.gameObject.SetActive(false); FakeItem = item; - FakeOccupancy = hullData.Shape.Inset(itemData.Shape, placementPosition, item.Rotation); + FakeOccupancy = hullData.Shape.Inset(GetItemShape(item), placementPosition, item.Rotation); RefreshCells(); GameManager.RegisterDragTarget(drag => { @@ -587,8 +586,7 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler if (item != null) { var itemPosition = cargo.Cargo[item]; - var itemData = GameManager.ItemManager.GetData(item); - var originalOccupancy = cargo.Data.InteriorShape.Inset(itemData.Shape, itemPosition, item.Rotation); + var originalOccupancy = cargo.Data.InteriorShape.Inset(GetItemShape(item), itemPosition, item.Rotation); _dragCells = originalOccupancy.Coordinates .Select(v1 => Instantiate(CellInstances[v1], DragParent, true).transform).ToArray(); foreach(var dragCell in _dragCells) @@ -634,13 +632,12 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler //Debug.Log("Inventory Pointer Enter"); if (!(GameManager.DragObject is ItemDragObject itemDragObject)) return; var item = itemDragObject.Item; - var itemData = GameManager.ItemManager.GetData(item); var placementPosition = v + itemDragObject.OriginCellOffset; if (cargo.ItemFits(item, placementPosition)) { //foreach (var cell in _dragCells) cell.gameObject.SetActive(false); FakeItem = item; - FakeOccupancy = cargo.Data.InteriorShape.Inset(itemData.Shape, placementPosition, item.Rotation); + FakeOccupancy = cargo.Data.InteriorShape.Inset(GetItemShape(item), placementPosition, item.Rotation); RefreshCells(); GameManager.RegisterDragTarget(drag => { @@ -882,6 +879,24 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler return _displayedEntity.ItemManager.GetData(item).Durability; } + private Shape GetItemShape(ItemInstance item) + { + var typedItem = FindTypedInventoryItem(item); + if (typedItem != null && typedItem.ShapeCells.Count > 0) + return ToShape(typedItem); + + return GameManager.ItemManager.GetData(item).Shape; + } + + private static Shape ToShape(AetheriaRuntimeCatalogItem item) + { + var shape = new Shape(Math.Max(item.ShapeWidth, 1), Math.Max(item.ShapeHeight, 1)); + foreach (var cell in item.ShapeCells) + shape[new int2(cell.X, cell.Y)] = true; + + return shape; + } + private static AetheriaRuntimeCatalogItem FindTypedInventoryItem(ItemInstance item) { var itemId = item?.Data?.ItemId ?? Guid.Empty; diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 3cbc8f2c1..ed5672529 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -153,6 +153,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. Inventory cargo cell tint now uses typed hardpoint facets before falling back to legacy `EquippableItemData.HardpointType`. Inventory HUD durability tint uses typed max durability before falling back to legacy `ItemData.Durability`. + Inventory drag preview occupancy now projects typed item shape cells into the + local `Shape` grid before falling back to legacy `ItemData.Shape`. - `Galaxy` generation no longer accepts a runtime item catalog reader or `ItemManager`. Sector and tutorial generation receive the package-owned typed runtime catalog. `Galaxy` projects typed corporation v2 records into temporary legacy