From 64214c5dd8392e750690407b30c5f8a6ecf619b1 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 14 Jun 2026 05:15:18 +0100 Subject: [PATCH] Use typed hull facets in motion consumers --- .voidbot/state/aetheria.cc | Bin 65980 -> 66565 bytes .../ServerShared/Agents/States/Combat.cs | 6 +++--- .../ServerShared/Behaviors/Thruster.cs | 8 ++++---- .../Behaviors/TurretController.cs | 6 +++--- Assets/Scripts/ServerShared/ItemManager.cs | 17 +++++++++++++++++ Assets/Scripts/ServerShared/Ship.cs | 2 +- docs/aetheria-perfect-machine-map.md | 9 ++++++--- 7 files changed, 34 insertions(+), 14 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 720e061b33456f58a9c8f3cd85108e056db56beb..56c66ee9f1b7ecf2e0e692bb5aaa7bf8ded603a9 100644 GIT binary patch delta 1480 zcmZ`(No*8H6lHA3FbD#~Y=$fqM-d=A-L}Vg2Al&35)zS+V8g|?a`&I^4l`9vRrTP> zA`2s=NCGfN%iK2@xr>xWR=>f(=MP;>2>XP~Zlss_wRj3BI+S>c9TWd+(3q zZ6|(cyZmd*(%$@z{(h^sZ~Mq(W{v#k-*$Pk7x_`Sj7r!6!Q)bcavz6)DwrSU)-O&O2bDXSEyI2gT8Bax3qWifu*=b>s(KH@ z9x5?fQNK-DSwuvj{$bb|J!+xdv@(jtu+YW2#e)%JAa+wC7%i7ot4t9ZzP&7PzbutF zh-OxSnWs=g3WoJy)1Z1b!J>F05eJSw6HxgA6YK%A_JSCS8yhzBl_-nJbVG0?3PQb+ zKvkq0lP~{%Z`6uktH+vb4;DB^tltC>u693j`s1WnKR^Ldz31W;YUWY!aWzoojoo!4 zmpX?7;-OJole5!3XQ!9RiQ65r-rkY9Cbvz0_^#oxUt5hRlP{(}a0V5NI;v3Hr6kIkIS%6pv~Ww?5| z?D)Q`s|sc61fqsqaBvNob;qJgWg&N-ds{zWy~_h4xNXkQ?N|%)z_;s*#rS)H_L@28 zr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(target.Hull); var targetVelocity = float3(target.Velocity.x, 0, target.Velocity.y); var shipVelocity = float3(_agent.Ship.Velocity.x, 0, _agent.Ship.Velocity.y); var predictedPosition = AetheriaMath.FirstOrderIntercept( @@ -93,7 +93,7 @@ public class CombatState : BaseState target.Position, targetVelocity ); - predictedPosition.y = _agent.Ship.Zone.GetHeight(predictedPosition.xz) + targetHullData.GridOffset; + predictedPosition.y = _agent.Ship.Zone.GetHeight(predictedPosition.xz) + (float)(targetHull?.HullGridOffset ?? 0); toTarget = normalize(predictedPosition - _agent.Ship.Position); } @@ -148,4 +148,4 @@ public class CombatState : BaseState } } } -} \ No newline at end of file +} diff --git a/Assets/Scripts/ServerShared/Behaviors/Thruster.cs b/Assets/Scripts/ServerShared/Behaviors/Thruster.cs index 44423a290..1429d802b 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Thruster.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Thruster.cs @@ -52,10 +52,10 @@ public class Thruster : Behavior, IAnalogBehavior public Thruster(ThrusterData data, EquippedItem item) : base(data, item) { _data = data; - var hullData = ItemManager.GetData(Entity.Hull) as HullData; - var hullCenter = hullData.Shape.CenterOfMass; - var itemData = ItemManager.GetData(item.EquippableItem); - var itemCenter = hullData.Shape.Inset(itemData.Shape, item.Position, item.EquippableItem.Rotation).CenterOfMass; + var hullShape = ItemManager.GetRuntimeShape(Entity.Hull); + var itemShape = ItemManager.GetRuntimeShape(item.EquippableItem); + var hullCenter = hullShape.CenterOfMass; + var itemCenter = hullShape.Inset(itemShape, item.Position, item.EquippableItem.Rotation).CenterOfMass; var toCenter = hullCenter - itemCenter; Torque = -dot(normalize(toCenter), float2(1, 0).Rotate(item.EquippableItem.Rotation)); Thrust = Evaluate(_data.Thrust); diff --git a/Assets/Scripts/ServerShared/Behaviors/TurretController.cs b/Assets/Scripts/ServerShared/Behaviors/TurretController.cs index 87ad77f9b..579f01eab 100644 --- a/Assets/Scripts/ServerShared/Behaviors/TurretController.cs +++ b/Assets/Scripts/ServerShared/Behaviors/TurretController.cs @@ -60,13 +60,13 @@ public class TurretController : Behavior, IInitializableBehavior var diff = Entity.Target.Value.Position - Entity.Position; if (_predictShots) { - var targetHullData = Entity.ItemManager.GetData(Entity.Target.Value.Hull) as HullData; + var targetHull = Entity.ItemManager.GetRuntimeItem(Entity.Target.Value.Hull); var targetVelocity = float3(Entity.Target.Value.Velocity.x, 0, Entity.Target.Value.Velocity.y); var predictedPosition = AetheriaMath.FirstOrderIntercept( Entity.Position, float3.zero, _shotSpeed, Entity.Target.Value.Position, targetVelocity ); - predictedPosition.y = Entity.Zone.GetHeight(predictedPosition.xz) + targetHullData.GridOffset; + predictedPosition.y = Entity.Zone.GetHeight(predictedPosition.xz) + (float)(targetHull?.HullGridOffset ?? 0); Entity.LookDirection = normalize(predictedPosition - Entity.Position); } else @@ -98,4 +98,4 @@ public class TurretController : Behavior, IInitializableBehavior } return true; } -} \ No newline at end of file +} diff --git a/Assets/Scripts/ServerShared/ItemManager.cs b/Assets/Scripts/ServerShared/ItemManager.cs index 979a69915..f50737581 100644 --- a/Assets/Scripts/ServerShared/ItemManager.cs +++ b/Assets/Scripts/ServerShared/ItemManager.cs @@ -64,6 +64,23 @@ public class ItemManager return itemId == Guid.Empty ? null : _itemProjections.GetRuntimeItem(itemId); } + public Shape GetRuntimeShape(ItemInstance item) + { + var typedItem = GetRuntimeItem(item); + return ToShape(typedItem?.ShapeWidth ?? 1, typedItem?.ShapeHeight ?? 1, typedItem?.ShapeCells); + } + + private static Shape ToShape(int width, int height, IReadOnlyList cells) + { + var shape = new Shape(Math.Max(width, 1), Math.Max(height, 1)); + if (cells == null) return shape; + + foreach (var cell in cells) + shape[new int2(cell.X, cell.Y)] = true; + + return shape; + } + public RuntimeItemReference CreateReference(ItemData item) { return new RuntimeItemReference(item); diff --git a/Assets/Scripts/ServerShared/Ship.cs b/Assets/Scripts/ServerShared/Ship.cs index fa13dfcb3..93c138283 100644 --- a/Assets/Scripts/ServerShared/Ship.cs +++ b/Assets/Scripts/ServerShared/Ship.cs @@ -284,7 +284,7 @@ public class Ship : Entity var velocityMagnitude = length(Velocity); if(velocityMagnitude > .01f) - Velocity = normalize(Velocity) * AetheriaMath.Decay(velocityMagnitude, HullData.Drag, delta); + Velocity = normalize(Velocity) * AetheriaMath.Decay(velocityMagnitude, (float)(ItemManager.GetRuntimeItem(Hull)?.HullDrag ?? 0), delta); Position.xz += Velocity * delta; diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 45299a58f..c3882a6d1 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -186,9 +186,10 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. `Entity.UnoccupiedSpace`, grid-offset placement, and `Entity.UpdateTemperature` also read typed hull shape/interior, hardpoints, base armor, mass, specific heat, and conductivity from runtime catalog rows. `EquippedItem` inset-shape - and behavior construction, docking bay max-size, ship drag, combat/turret - prediction, thruster behavior, and loadout generator helper predicates still - belong to legacy simulation projections until those owners are rebuilt. + and behavior construction, docking bay max-size, and loadout generator helper + predicates still belong to legacy simulation projections until those owners + are rebuilt. Ship drag, combat/turret shot prediction height, and thruster + torque geometry now consume typed hull facets and typed shape masks. The item properties panel also reads typed catalog title names, descriptions, manufacturer, base mass, max durability, thermal bounds, and thermal performance curve keys for basic item presentation without hydrating legacy @@ -708,6 +709,8 @@ First Aetheria surfaces to publish: checked-in `.cc` catalog, and move `Entity.MapEntity`, `Entity.UnoccupiedSpace`, grid-offset placement, and `Entity.UpdateTemperature` onto typed runtime hull rows. + - Done: move `Ship` drag, combat/turret predicted shot height, and thruster + torque geometry onto typed hull facets and typed shape masks. - Done: delete the console `give` command instead of preserving a debug operator path that hydrated typed item rows back into legacy item DTOs. - Done: delete `ItemManager.GetCatalogEntries` after all live callers