From e58042149e4caa4572d7f31a0d492b9a679fb69c Mon Sep 17 00:00:00 2001 From: soul Date: Tue, 1 Dec 2026 00:35:58 +0100 Subject: [PATCH] Thruster torque derives its lever on read; Orient cites the actuated-assemblies ruling Co-Authored-By: Claude Sonnet 5.5 --- .../Scripts/ServerShared/Behaviors/Thruster.cs | 16 ++++++++-------- Assets/Scripts/ServerShared/Entity.cs | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Assets/Scripts/ServerShared/Behaviors/Thruster.cs b/Assets/Scripts/ServerShared/Behaviors/Thruster.cs index 594414a2c..47f2d92a7 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Thruster.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Thruster.cs @@ -49,11 +49,13 @@ public class Thruster : Behavior, IPowerConsumer // Thrust at a full grant, the same stat read without the power-supply term: what a column promises. Live, like Thrust. public float NominalThrust => EvaluateNominalPower(_data.Thrust); // GameplaySettings.ThrustScale scales the push alone: it tunes how hard ships fight gravity, and turning does not. - public float Torque => Item == null ? 0f : -dot(_lever, Item.Orient(float2(1, 0))); + public float Torque => Item == null ? 0f : -dot(normalize(_hullCenter - _itemCenter), Item.Orient(float2(1, 0))); - // Unit vector from the thruster to the hull's centre of mass: placement, fixed at construction. Which way the - // thruster faces is not cached with it; Torque reads that live from EquippedItem.Orient. - private readonly float2 _lever; + // Placement, fixed at construction: the hull's centre of mass and the item's own centre, both in cell space. The + // lever (the direction from one to the other) and the facing it is dotted with are derived on every Torque read, + // so a later change to where the item sits or which way it faces moves the torque without a second owner. + private readonly float2 _hullCenter; + private readonly float2 _itemCenter; // This thruster's effect per unit throttle at the given thrust, in the body frame: xy is the push (x starboard, y // forward), z the clockwise yaw rate in rad/s. Zero when the item is absent or offline. The one geometry owner for @@ -85,11 +87,9 @@ public class Thruster : Behavior, IPowerConsumer { _data = data; var hullData = ItemManager.GetData(Entity.Hull) as HullData; - var hullCenter = hullData.Shape.CenterOfMass; + _hullCenter = hullData.Shape.CenterOfMass; var itemData = ItemManager.GetData(item.EquippableItem); - var itemCenter = hullData.Shape.Inset(itemData.Shape, item.Position, item.EquippableItem.Rotation).CenterOfMass; - var toCenter = hullCenter - itemCenter; - _lever = normalize(toCenter); + _itemCenter = hullData.Shape.Inset(itemData.Shape, item.Position, item.EquippableItem.Rotation).CenterOfMass; } public Thruster(ThrusterData data, ConsumableItemEffect item) : base(data, item) diff --git a/Assets/Scripts/ServerShared/Entity.cs b/Assets/Scripts/ServerShared/Entity.cs index e88d1c4ad..6b28af1cb 100644 --- a/Assets/Scripts/ServerShared/Entity.cs +++ b/Assets/Scripts/ServerShared/Entity.cs @@ -2180,9 +2180,10 @@ public class EquippedItem : IStatContext public HardpointData Hardpoint { get; } // The one owner of an item's facing in the sim: a vector in the body frame, expressed in the item's frame. - // Today that is the item's authored rotation; an articulated pod's pose composes here and nowhere else - // (ruling aetheria-release:ruling:articulated-pods-share-one-frame). Behavior.Direction, FireControl.MountDirection - // and Thruster's column and torque all derive facing through this. + // Today that is the item's authored rotation; an actuated assembly's pose composes here and nowhere else + // (ruling aetheria-release:ruling:actuated-assemblies-are-their-own-kind). A member's own mount motion (a gun's + // traverse, a thruster's gimbal) is composed after Orient, by that member's owner, not here. Behavior.Direction, + // FireControl.MountDirection and Thruster's column and torque all derive facing through this. public float2 Orient(float2 bodyVector) => bodyVector.Rotate(EquippableItem.Rotation); public EquippableItemData Data { get; }