Thruster torque derives its lever on read; Orient cites the actuated-assemblies ruling

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-12-01 00:35:58 +01:00
commit e58042149e
2 changed files with 12 additions and 11 deletions

View file

@ -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)

View file

@ -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; }