diff --git a/tests/Aetheria.Shared.Tests/ConsumableAiTests.cs b/tests/Aetheria.Shared.Tests/ConsumableAiTests.cs index 1b6d95cc9..ea1ee917e 100644 --- a/tests/Aetheria.Shared.Tests/ConsumableAiTests.cs +++ b/tests/Aetheria.Shared.Tests/ConsumableAiTests.cs @@ -587,7 +587,11 @@ public sealed class ConsumableAiTests : IDisposable s.Zone.Update(.05f); Assert.True(s.Agent.Target.Value.IsNone); agent.Task = new FollowTask { Anchor = s.Prey, Standoff = 100 }; - for (var i = 0; i < 6 && !(s.State is FollowState); i++) agent.Update(.05f); + for (var i = 0; i < 6 && !(s.State is FollowState); i++) + { + agent.Update(.05f); + PilotApplier.Apply(s.Agent); + } Assert.True(s.State is FollowState, $"the agent is in {s.State?.GetType().Name}"); void Paint(float strength) @@ -595,6 +599,7 @@ public sealed class ConsumableAiTests : IDisposable s.Agent.ReceivePaint(s.Locker, s.Locker.Equipment.Single(i => i.Behaviors.Any(b => b is LockWeapon)), PaintMode.Track, strength); s.Agent.PublishInbox(); agent.Update(.05f); + PilotApplier.Apply(s.Agent); } Paint(.3f); Assert.False(s.Active(s.Vent)); diff --git a/tests/Aetheria.Shared.Tests/FireControlPerWeaponTests.cs b/tests/Aetheria.Shared.Tests/FireControlPerWeaponTests.cs index cf47b2041..bd576b16b 100644 --- a/tests/Aetheria.Shared.Tests/FireControlPerWeaponTests.cs +++ b/tests/Aetheria.Shared.Tests/FireControlPerWeaponTests.cs @@ -371,6 +371,7 @@ public sealed class FireControlPerWeaponTests : IDisposable flight.Join(agent, new PatrolOrbitsTask()); flight.Update(.1f); + PilotApplier.Apply(r.Shooter); Assert.Equal(expected, ((FollowTask) agent.Task).Standoff, 2); } @@ -730,7 +731,9 @@ public sealed class FireControlPerWeaponTests : IDisposable // update leaves the root state for combat, the second is combat deciding. var agent = new Minion(r.Shooter, FactionDoctrine.Default(r.Shooter.ItemManager.GameplaySettings).Combatant); agent.Update(.01f); + PilotApplier.Apply(r.Shooter); agent.Update(.01f); + PilotApplier.Apply(r.Shooter); Assert.True(r.Gun.Weapon.Firing); } diff --git a/tests/Aetheria.Shared.Tests/FlightTests.cs b/tests/Aetheria.Shared.Tests/FlightTests.cs index dc3f4da10..dc238bb7b 100644 --- a/tests/Aetheria.Shared.Tests/FlightTests.cs +++ b/tests/Aetheria.Shared.Tests/FlightTests.cs @@ -57,6 +57,8 @@ public sealed class FlightTests : IDisposable private void Tick(float dt) { foreach (var flight in _zone.Flights.ToArray()) flight.Update(dt); + // The flight-only step: each member's command (its flight's designation) is applied as the zone step applies it. + foreach (var entity in _zone.Entities.ToArray()) PilotApplier.Apply(entity); } [Fact] diff --git a/tests/Aetheria.Shared.Tests/SimClockTests.cs b/tests/Aetheria.Shared.Tests/SimClockTests.cs index c12b23baf..6426fe47d 100644 --- a/tests/Aetheria.Shared.Tests/SimClockTests.cs +++ b/tests/Aetheria.Shared.Tests/SimClockTests.cs @@ -140,8 +140,8 @@ public sealed partial class RunStartTests var launched = Launch(new Duel()); Assert.Empty(launched.failures); _items.Random = new CultMath.Random(0xC0FFEE); - launched.staged.Player.MovementDirection = float2(0, 1); - launched.staged.Player.Turn = .5f; + launched.staged.Player.Command.Movement = float2(0, 1); + launched.staged.Player.Command.Turn = TurnCommand.OfRate(.5f); foreach (var ship in launched.arena.Entities.OfType()) ship.SetTarget(launched.arena.Entities.OfType().First(other => other != ship)); return (launched.arena, launched.staged.Player); @@ -238,8 +238,8 @@ public sealed partial class RunStartTests Assert.True(turned > 60, "the held turn turned the ship"); // A write to Direction between steps (staging, a load, a wormhole exit) is not a turn. - player.Turn = 0; - player.MovementDirection = float2(0, 0); // the drives are idled so the Direction write below is tested alone + player.Command.Turn = TurnCommand.OfRate(0); + player.Command.Movement = float2(0, 0); // the drives are idled so the Direction write below is tested alone for (var step = 0; step < 600 && abs(player.TurnRate) > 0; step++) arena.Update(ClockFrame); player.Direction = normalize(float2(3, -4)); arena.Update(ClockFrame); @@ -295,7 +295,7 @@ public sealed partial class RunStartTests public void DrawnRotationFollowsTheTurn() { var (arena, player) = LaunchDuel(); - player.Turn = 1f; + player.Command.Turn = TurnCommand.OfRate(1f); for (var step = 0; step < 300; step++) arena.Update(ClockFrame); var rate = player.TurnRate; Assert.True(abs(rate) > .05f, "the ship is turning");