using System.Numerics; using GamePort.Game; namespace GamePort.Application; /// VR02 ordinary-phase replay; extra ticks reuse the last received /// input. No actor relocation, velocity seeding or timer modification. public sealed class RocketshipSmoke { private readonly LabSimulation player; private readonly PlayerSceneBinding binding; private readonly SceneInventory inventory; private readonly SceneDirector director; private readonly SceneInteractions interactions; private readonly Rocketship ship; private readonly bool[] checks=new bool[10]; private readonly Vector3 initial; private readonly float energy; private PlayerInput last; private int extra; private float turnYaw; public RocketshipSmoke(LabSimulation player,PlayerSceneBinding binding,SceneDirector director,SceneInteractions interactions) { this.player=player;this.binding=binding;this.director=director;this.interactions=interactions; inventory=interactions.Inventory;ship=binding.Rocketship!; energy=player.Energy;initial=player.ActorRoot; inventory.SetState(0,1,1);inventory.SelectGadget(1); } public void BeforeFrame(int count,Action key,bool headless) { if(count==0&&!headless)key(82,true); if(count==1)Advance(90); if(count==2&&!headless)key(80,true); if(count==3) { Advance(45); if(!headless){key(80,false);key(82,false);} } if(count==4) { Advance(30);turnYaw=ship.Rotation.Y; if(!headless)key(40,true); } if(count==5) { Advance(65); if(!headless){key(40,false);key(21,true);} } if(count==6){Advance(35);if(!headless)key(21,false);} if(count==7) { Advance(30); if(headless)inventory.SelectGadget(-1);else key(43,true); } if(count==8){if(!headless)key(43,false);inventory.SelectGadget(1);} if(count==9){if(headless)player.SetNoclip(true);else key(60,true);} } public void Received(PlayerInput input)=>last=input; private void Advance(int count) { for(var i=0;i100&&ship.Root.Y>initial.Y+30&&ship.FireVisible&&ship.BodySteps>80; if(count==2)checks[2]=ship.Steering.Bank>0; if(count==3)checks[3]=ship.Rotation.Y!=0&&ship.Steering.Bank>10; if(count==4)checks[4]=ship.Maneuver.TurnRemaining>.9f; if(count==5)checks[5]=ship.Maneuver.TurnRemaining==0&&MathF.Abs(MathF.IEEERemainder(ship.Rotation.Y-turnYaw,360))>90&&ship.Maneuver.RollRemaining>.9f; if(count==6)checks[6]=ship.Maneuver.RollRemaining>0&&ship.Rotation.Z>60; if(count==7)checks[7]=!ship.Mounted&&player.GadgetMode==-1&&director.Controlled&&ship.EngineMode==0&&!ship.FireVisible; if(count==8)checks[8]=ship.Mounted&&player.GadgetMode==1; if(count==9)checks[9]=!ship.Mounted&&player.Noclip&&director.Controlled&&ship.EngineMode==0; } public bool Passed=>checks.All(x=>x)&&player.Energy==energy; public string Report=>$"Rocketship fixture: mount={checks[0]}, fly={checks[1]}, bank={checks[2]}, turn={checks[3]}, maneuver={checks[4]}, finish/roll={checks[5]}, barrel={checks[6]}, release={checks[7]}, remount={checks[8]}, noclip cleanup={checks[9]}, extra ordinary ticks={extra}, energy={player.Energy}/{energy}."; public static PlayerInput Input(int count)=>new(count<=2,false,count==2,false,false,RocketTurn:count==4,RocketRoll:count==5); public static string? StageName(int count)=>count switch {0=>"mounted",1=>"flying",2=>"bank",3=>"turn",4=>"maneuver",5=>"roll-start",6=>"barrel",7=>"released",8=>"remounted",9=>"noclip",_=>null}; }