Run body and fire phases during scripted control locks
This commit is contained in:
1 parent
5876da112c
commit
c285b57091
35 files changed
+1503
-45
No files matched your search
@@ -41,6 +41,7 @@ interactions.PracticeRequested += practice.Show;
|
||||
var prompts = 0;
|
||||
LevelTransition? destination = null;
|
||||
interactions.Transition += request => destination ??= request;
|
||||
using var playerBinding = new PlayerSceneBinding(director, simulation, interactions.Inventory, level.Player!.Tag!);
|
||||
director.Begin(start);
|
||||
interactions.Reset(); mechanisms.Reset(); director.Skip();
|
||||
|
||||
@@ -70,12 +71,18 @@ for (var leg = 0; leg < route.Length && destination == null; leg++)
|
||||
if (difference.Length() < 90) { arrived = true; break; }
|
||||
var desiredYaw = MathF.Atan2(-difference.X, difference.Y) * 180 / MathF.PI;
|
||||
var error = MathF.IEEERemainder(desiredYaw - simulation.Yaw, 360);
|
||||
if (director.Controlled)
|
||||
var previous = simulation.ActorRoot;
|
||||
// This is a modern input driver, not original navigation. Brake before
|
||||
//large heading changes; coasting turns can miss the narrow exit opening
|
||||
//when the recovered cutscene preparation changes the arrival speed.
|
||||
var brake = MathF.Abs(error) > 15 && simulation.Speed > 0;
|
||||
var input = brake ? new PlayerInput(false, true, false, false, false)
|
||||
: new PlayerInput(MathF.Abs(error) < 10, false, error > 1, error < -1, false);
|
||||
var acceptsInput = playerBinding.Step(input);
|
||||
Require(Vector3.Distance(previous, simulation.ActorRoot) < 100, "Player warped during input replay");
|
||||
interactions.UpdateEnergy(simulation.Energy);
|
||||
if (acceptsInput)
|
||||
{
|
||||
var previous = simulation.ActorRoot;
|
||||
simulation.Step(new(MathF.Abs(error) < 30, false, error > 1, error < -1, false));
|
||||
Require(Vector3.Distance(previous, simulation.ActorRoot) < 100, "Player warped during input replay");
|
||||
director.SyncActor(level.Player!.Tag!, simulation.ActorRoot, new(0, simulation.Yaw, 0));
|
||||
director.Touch(level.Player!.Tag!, simulation.ActorRoot);
|
||||
interactions.Update(simulation.ActorRoot, simulation.InteractionRadius);
|
||||
if (practice.Active) continue; // Same modal activation boundary as Program.
|
||||
@@ -86,7 +93,7 @@ for (var leg = 0; leg < route.Length && destination == null; leg++)
|
||||
director.Step(FixedStepClock.Step);
|
||||
if (destination != null) break;
|
||||
}
|
||||
Require(arrived || destination != null, $"Input route blocked at leg{leg}: {simulation.ActorRoot}");
|
||||
Require(arrived || destination != null, $"Input route blocked at leg{leg}: {simulation.Report}; yaw={simulation.Yaw}, control={director.AuthoredControlledTag}, shot={director.CurrentTag}, blocked={director.Blocked}, goal={route[leg]}");
|
||||
Require(tasks.Get("SCENE") == sceneStates[leg], $"Wrong task state after walking leg{leg}");
|
||||
Console.WriteLine($"PASS walked leg{leg}: SCENE={tasks.Get("SCENE")}, root={simulation.ActorRoot}");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user