Throttle lock is a forward floor on the solve; allocation moves after the performance update

The lock stops being an intent rewrite in Ship.Update: ThrustAllocator.Allocate takes forwardFloor, which ignores the
stick, asks full forward and holds every column with y > 0 at full (ruling overdrive-forward-floor). Ship allocates in
Entity's new UpdateThrottles phase, after every item's UpdatePerformance and before the power bus and Execute, so
liveness and thrust are the ones Execute acts on (finding liveness-read-before-performance).
Tests follow in the next commits; the test project still compiles, new behaviour is untested here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-10 19:26:49 +02:00
commit 534e402fdf
3 changed files with 26 additions and 12 deletions

View file

@ -98,19 +98,21 @@ public class Ship : Entity
#endregion
// Called by Entity.Update once the items' performance is current and before the power bus is stepped and the items
// execute: liveness, thrust and the throttles they decide are one phase, the one Execute acts on. The lock is a
// bound on the allocator's solve; intent reaches the allocator here and nowhere else.
protected override void UpdateThrottles()
{
if (_exitingWormhole || _enteringWormhole) return;
RecalculateEnvelope();
for (var i = 0; i < _allThrusters.Length; i++)
_columns[i] = _allThrusters[i].Column(_allThrusters[i].NominalThrust);
_allocator.Allocate(_columns, MovementDirection, Turn, _throttles, ThrottleLocked);
for (var i = 0; i < _allThrusters.Length; i++) _allThrusters[i].Axis = _throttles[i];
}
public override void Update(float delta)
{
if (_active && !_exitingWormhole && !_enteringWormhole)
{
RecalculateEnvelope();
// The lock replaces intent here, once; player and agent intent both pass through this one read.
var move = ThrottleLocked ? float2(0, 1) : MovementDirection;
for (var i = 0; i < _allThrusters.Length; i++)
_columns[i] = _allThrusters[i].Column(_allThrusters[i].NominalThrust);
_allocator.Allocate(_columns, move, Turn, _throttles);
for (var i = 0; i < _allThrusters.Length; i++) _allThrusters[i].Axis = _throttles[i];
}
var velocityMagnitude = length(Velocity);
if(velocityMagnitude > .01f)
Velocity = normalize(Velocity) * decay(velocityMagnitude, HullData.Drag, delta);