Advertisement
NickNDS

IPBM 2 Beta

Nov 29th, 2021
491
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.43 KB | None | 0 0
  1. double Ƌ=0.666,Ɗ=0.5,Ɖ=1.0,ƈ=0.1;int Ƈ=60;IEnumerator<bool>Ɔ,ƅ,Ƅ,ƃ,Ƃ,Ɓ,ƀ,ſ,ž;List<double>Ž=new List<double>();double ż=0
  2. ,Ż=0,ź=0,Ź=2.0,Ÿ=0,ŷ=0,Ŷ=2,ŵ=0.7,Ŵ=-1,ų=-1,Ų=0,ű=0,ƌ=0,Ű=0,ƍ=0,Ƭ=0,ƪ=100,Ʃ=0,ƨ=40,Ƨ=3;float Ʀ=0f;int ƥ=0,Ƥ=8;DateTime ƣ=
  3. DateTime.Now;bool Ƣ=true,ơ=false,Ơ=false,Ɵ=true,ƞ=false,ƫ=false,Ɲ=true,ƛ=false,ƚ=false,ƙ=false,Ƙ=false,Ɨ=false,Ɩ=false,ƕ=false,Ɣ
  4. =false,Ɠ=false;string ƒ="IPBM Missile Script",Ƒ="===============================================================",Ɛ="",Ə=
  5. "";StringBuilder Ǝ=new StringBuilder();List<IMyThrust>Ɯ=new List<IMyThrust>(),ů=new List<IMyThrust>(),Ş=new List<IMyThrust
  6. >(),ŏ=new List<IMyThrust>(),Ŏ=new List<IMyThrust>(),ō=new List<IMyThrust>();List<IMyGyro>Ō=new List<IMyGyro>(),ŋ=new List
  7. <IMyGyro>();List<IMyShipConnector>Ŋ=new List<IMyShipConnector>(),ʼn=new List<IMyShipConnector>();List<IMyShipMergeBlock>ň=
  8. new List<IMyShipMergeBlock>(),Ň=new List<IMyShipMergeBlock>();List<IMyRemoteControl>ņ=new List<IMyRemoteControl>(),Ņ=new
  9. List<IMyRemoteControl>();List<IMyPowerProducer>ń=new List<IMyPowerProducer>();List<IMyGasTank>Ń=new List<IMyGasTank>();List<
  10. IMyCameraBlock>ł=new List<IMyCameraBlock>();List<IMyWarhead>Ł=new List<IMyWarhead>();List<IMyGasGenerator>ŀ=new List<IMyGasGenerator>(
  11. );List<ċ>Ŀ=new List<ċ>();SortedList<string,string>ľ=new SortedList<string,string>{{"Missile Primary Group Name",
  12. "Missile 1 Primary"},{"Missile Secondary Group Name","Missile 1 Secondary"},{"Missile Secondary Block Keyword","2nd"},{
  13. "Filter Keyword Merge Block",""},{"Filter Keyword Connector",""},{"Filter Keyword Remote Control",""},{"Filter Keyword Gyroscope",""},{
  14. "Filter Keyword Camera",""},{"Filter Keyword Warhead",""},{"Filter Keyword Global",""},{"Filter Keyword Thrust",""},{"Filter Keyword Power",""}
  15. ,{"Filter Keyword Hydrogen",""},{"Filter Keyword H2/O2 Gens",""},{"Filter Keyword Timer","Logic"}};SortedList<string,
  16. double>Ľ=new SortedList<string,double>{{"Forward Speed Maximum",100},{"Forward Speed Tolerance",0.925},{"Travel Elevation",
  17. 10000},{"Echo Life In Seconds",10},{"Launch Delay In Seconds",0},{"Post Detach Rescan Delay In Seconds",0.5},{
  18. "Waypoint Distance",750},{"Gyro Multiplier",10.0},{"Gyro Limiter",0.6},{"Warhead Radius Small",4.49},{"Warhead Radius Large",22},{
  19. "Randomized Offset Distance",0},{"Missile Tube Protection Distance",40},{"Missile Tube Protection Time In Seconds",3}};SortedList<string,bool>ļ=new
  20. SortedList<string,bool>{{"Same Grid Only",true},{"Autoboot Basic",true},{"Detach Merge Blocks",true},{"Detach Connectors",false},{
  21. "Auto Max Speed",true}};List<Ą>Ļ=new List<Ą>();HashSet<string>ĺ=new HashSet<string>();TimeSpan Ĺ=new TimeSpan(0),ĸ=new TimeSpan(0),ķ=new
  22. TimeSpan(0,0,5),Ķ=new TimeSpan(0),ĵ=new TimeSpan(0),Ő=new TimeSpan(0),Ĵ=new TimeSpan(0),Œ=new TimeSpan(0);SortedList<string,ÿ>Ů=
  23. new SortedList<string,ÿ>();Vector3D Ŭ=new Vector3D(0,0,0),ū=new Vector3D(0,0,0),Ū=new Vector3D(0,0,0),ũ=new Vector3D(0,0,0)
  24. ,Ũ=new Vector3D(0,0,0);MyDetectedEntityInfo ŧ=new MyDetectedEntityInfo(),Ŧ=new MyDetectedEntityInfo();ţ ť=new ţ();ś Ť=new
  25. ś();public enum ţ{Ţ,š,Š,ŭ,ş,ŝ,Ŝ}public enum ś{Ś,ř,Ř,ŗ,Ŗ,ŕ}Program(){ſ=Û();ť=ţ.Ţ;Ť=ś.Ś;Ǝ.AppendLine("//Launch Time>=10");Ǝ
  26. .AppendLine("//Altitude>1000");Ǝ.AppendLine("//Elevation>1000");Ǝ.AppendLine("//Gravity<=0.5");Ǝ.AppendLine(
  27. "//Forward Speed>=90");Ǝ.AppendLine("//Lateral Speed<10");Ǝ.AppendLine("//Total Speed>90");Ǝ.AppendLine("//Distance From Axis<=5");Ǝ.
  28. AppendLine("//Distance From Target<=500");Ǝ.AppendLine("//Primary Active=True");Ǝ.AppendLine("//Secondary Active=False");Ǝ.Append(
  29. "//Repeatable=False");Runtime.UpdateFrequency=UpdateFrequency.Update1;}void Main(string ő){if(ð()){ƥ=0;if(ķ.TotalSeconds<=0){if(Me.
  30. CustomData.Length!=Ɛ.Length||Me.CustomData!=Ɛ)Ɲ=true;ķ=TimeSpan.FromSeconds(5);}if(Ɲ){if(ƻ()){Ɲ=false;ķ=TimeSpan.FromSeconds(10);}
  31. }else if(ƫ){if(ǟ())ƫ=false;}else ǚ();}else ƥ++;if(ő.Length>0)Ŕ(ő);Ǜ();}void Ŕ(string ő){try{string œ=ő.ToLower();if(Ď(ő))
  32. {}else if(œ.Contains(" ")){int è=œ.IndexOf(" ");string å=œ.Substring(0,è).ToLower(),ø=œ.Substring(è+1);double ǜ;switch(å)
  33. {case"direct":if(Ď(ø))ƙ=true;break;case"travel":if(double.TryParse(ø,out ǜ)){Ľ["Travel Elevation"]=ǜ;ƫ=true;}break;case
  34. "raycast":if(double.TryParse(ø,out ǜ))G(ǜ);break;}}else{switch(œ){case"scan":Ƣ=true;ơ=Ơ;break;case"deactivate":Ơ=false;break;case
  35. "save":if(!Ɲ)ƫ=true;break;case"load":if(!ƫ)Ɲ=true;break;case">":switch(Ť){case ś.Ś:Ť=ś.ř;break;case ś.ř:Ť=ś.Ř;break;case ś.Ř:Ť
  36. =ś.ŗ;break;case ś.ŗ:Ť=ś.Ŗ;break;case ś.Ŗ:Ť=ś.ŕ;break;case ś.ŕ:Ť=ś.Ś;break;}break;case"<":switch(Ť){case ś.Ś:Ť=ś.ŕ;break;
  37. case ś.ř:Ť=ś.Ś;break;case ś.Ř:Ť=ś.ř;break;case ś.ŗ:Ť=ś.Ř;break;case ś.Ŗ:Ť=ś.ŗ;break;case ś.ŕ:Ť=ś.Ŗ;break;}break;case
  38. "raycast":G();break;}}N($"Ran argument: {ő}");}catch{N($"Error caught running argument: {ő}");}}void Ǜ(){Ƥ++;L();if(Ƥ>=8){Ƥ=0;
  39. switch(Ť){case ś.Ś:ǫ();break;case ś.ř:Ǫ();break;case ś.Ř:DZ();break;case ś.ŗ:Ǩ();break;case ś.Ŗ:ǧ();break;case ś.ŕ:Ǧ();break;}
  40. for(int K=0;K<20;K++)Echo("");}}void ǚ(){if(Ɔ==null)Ɔ=Ǚ();Y();X();V();if(Ơ&&ť!=ţ.š&&ť!=ţ.Ţ)Ü();ǭ();if(ž!=null)Ò();Ǥ(ref Ɔ);
  41. }IEnumerator<bool>Ǚ(){bool ǘ=false,ĭ,Ǘ,ǖ,Ǖ,ǔ,Ǔ,ǝ=false;int ǒ=0;Vector3D Ǒ,ǐ,Ǐ,ǎ;IMyRemoteControl U;List<IMyThrust>Ǎ;while
  42. (true){while(!Dž())yield return true;if(!Ơ)while(!Ƴ())yield return true;if(Ơ&&!Ƣ){N("Booting");if(!ǘ){while(!Ƽ())yield
  43. return true;ǘ=true;}while(Ơ&&!Ƣ){ĭ=!Ɣ&&ļ["Auto Max Speed"];if(Ɩ&&Ő.TotalSeconds>=2.5){Ɣ=true;ĭ=false;}if(Į(ĭ))Ʀ=k();else Ʀ=0f;
  44. if(ĭ){if(ƍ>ƪ){Ő=TimeSpan.FromSeconds(0);ƪ=ƍ;}}if(Ʀ>0f){ƕ=true;if(ĭ)Ɩ=true;}else{ƕ=false;Ɩ=false;}Ǎ=ı();for(int K=0;K<Ǎ.
  45. Count;K++){if(!ò())yield return true;Ǎ[K].ThrustOverridePercentage=Ʀ;}if(Ɠ){B();if(Ĵ.TotalSeconds>0.0)Ŭ=ŧ.Position+(ô(ŧ.
  46. Velocity)*Ĵ.TotalSeconds);}if(Ĩ(out U)){if(ĸ.TotalSeconds<Ƨ||Vector3D.Distance(ũ,ū)<ƨ){ť=ţ.š;Ǒ=(U.WorldMatrix.Forward*250)+ū;}
  47. else if(Đ()){ť=ţ.Š;Ǒ=Ŭ;if(Ɠ){if(ŧ.Velocity.Length()>0f){double nj=Vector3D.Distance(ū,Ŭ)/ŷ;ǐ=Ŭ+(ô(ŧ.Velocity)*nj);nj=Vector3D.
  48. Distance(ū,ǐ)/ŷ;ǐ=Ŭ+(ô(ŧ.Velocity)*nj);nj=Vector3D.Distance(ū,ǐ)/ŷ;ǐ=Ŭ+(ô(ŧ.Velocity)*nj);if(Vector3D.Distance(Ǒ,ǐ)<ų*0.75)Ǒ=ǐ;}}}
  49. else{if(ĵ.TotalSeconds<=0){Ǎ=ĩ();Ƭ=0;for(int K=0;K<Ǎ.Count;K++){if(!ò())yield return true;Ƭ+=Ǎ[K].MaxEffectiveThrust;}ĵ=
  50. TimeSpan.FromSeconds(5);}Ǒ=ĕ();}if(ť!=ţ.š){Ū=h(Ǒ,U);ÿ P;if(ť==ţ.ŭ&&ƞ&&ğ(out P))Ū.Z=r(P.g,U);else if(Ų>=0.25){MatrixD Nj=U.
  51. WorldMatrix;Vector3D NJ=Vector3D.Normalize(Ũ);Ū.Z=r((((NJ.X*Nj.Right)+(NJ.Y*Nj.Up))*150.0)+ū,U);}}else Ū=new Vector3D(0,0,0);Ǐ=Vector3D.
  52. Normalize(Ǒ-ū)*100.0;ǎ=U.WorldMatrix.Forward*100;Ʃ=Vector3D.Distance(Ǐ,ǎ);}if(Ł.Count>0&&(ť==ţ.Š||ť==ţ.ŝ)&&Vector3D.Distance(ū,ũ)
  53. >=75){if(ł.Count>0){double F=ų+500;if(ł[ǒ].AvailableScanRange>=F){MyDetectedEntityInfo D=ł[ǒ].Raycast(F);ǒ++;if(ǒ>=ł.Count
  54. )ǒ=0;if(!D.IsEmpty()&&u(D)){if(Vector3D.Distance((Vector3D)D.HitPosition,Ł[0].GetPosition())<t())for(int K=0;K<Ł.Count;K
  55. ++)Ł[K].Detonate();}}}bool ǩ=ų<=250;for(int K=0;K<Ł.Count;K++){if(!ò())yield return true;Ł[K].IsArmed=ǩ;}}if(U!=null||Ĩ(
  56. out U)){Ǖ=false;ǔ=false;Ǘ=false;ǖ=false;Ǔ=ƕ;if(Ũ.Y>0)Ǖ=true;if(Ũ.Y<0)ǔ=true;if(Ũ.X>0)ǖ=true;if(Ũ.X<0)Ǘ=true;Matrix ǰ,ǯ;U.
  57. Orientation.GetMatrix(out ǰ);Ǎ=ī();for(int K=0;K<Ǎ.Count;K++){Ǎ[K].Orientation.GetMatrix(out ǯ);if(ǯ.Forward==ǰ.Down)Ǎ[K].Enabled=ǔ
  58. ;else if(ǯ.Forward==ǰ.Up)Ǎ[K].Enabled=Ǖ;else if(ǯ.Forward==ǰ.Left)Ǎ[K].Enabled=Ǘ;else if(ǯ.Forward==ǰ.Right)Ǎ[K].Enabled=
  59. ǖ;else if(ǯ.Forward==ǰ.Backward)Ǎ[K].Enabled=Ǔ;else if(ǯ.Forward==ǰ.Forward)Ǎ[K].Enabled=ǝ;}}bool Ǯ;for(int K=0;K<Ŀ.Count
  60. ;K++){if(!ò())yield return true;if((!Ŀ[K].ď||Ŀ[K].Ĉ)&&Ŀ[K].Ċ.Enabled){Ǯ=true;for(int Ã=0;Ã<Ŀ[K].ĉ.Count;Ã++){if(!ò())
  61. yield return true;if(!í(Ŀ[K].ĉ[Ã])){Ǯ=false;break;}}if(Ǯ){Ŀ[K].Ċ.Trigger();Ŀ[K].ď=true;}}}yield return true;}}yield return
  62. true;}}void ǭ(){TimeSpan Ǭ=Runtime.TimeSinceLastRun;Ĺ-=Ǭ;if(Ơ)ĸ+=Ǭ;ķ-=Ǭ;Ķ-=Ǭ;ĵ-=Ǭ;if(Ɩ)Ő+=Ǭ;if(Ɠ){Ĵ+=Ǭ;Œ-=Ǭ;}}void ǫ(int ǥ=6
  63. ){Echo("--Output--");for(int K=0;K<Ļ.Count;K++)Echo(Ļ[K].ă);if(ǥ>1)Ǫ(ǥ-1);}void Ǫ(int ǥ=6){Echo("--Status--");if(Ơ)Echo(
  64. "Active");else Echo("Idle");Echo("");if(ť==ţ.ş)Echo("Orienting towards target");if(ť==ţ.Ŝ)Echo("Ascending");if(ť==ţ.Š)Echo(
  65. "Heading directly to target");if(ť==ţ.ŝ)Echo("Approaching target");if(ť==ţ.ŭ)Echo("Navigating around planet");if(ť==ţ.š)Echo(
  66. "Flying straight to protect missile tubes");Echo($"Speed: {ŷ:N1} / {ƪ:N1}");Echo($"Lateral Speed: {Ų:N2}");Echo($"Total Speed: {ƍ:N1}");if(Ơ&&Ɨ){Echo(
  67. $"Est. Max Turn Radius: {ƌ:N0}");Echo($"Est. Drift Distance: {Ű:N0}");}if(ƞ){Echo($"Elevation: {ź:N1}");Echo($"Altitude: {Ż:N1}");Echo(
  68. $"Gravity: {((Ÿ/9.81)*100.0):N2}%");}Echo($"Last: {Runtime.LastRunTimeMs:N3}ms");Echo($"Average: {ż:N2} / {Ƌ}ms");if(ƥ>0)Echo($"Overheat Ticks: {ƥ}");if(ǥ
  69. >1)DZ(ǥ-1);}void DZ(int ǥ=6){Echo("--Target--");Echo($"Distance: {ų:N2}");if(Ɨ)Echo($"Accuracy: {Ŵ:N2}");Echo(
  70. "Coordinates:");Echo(Ŭ.ToString("N0"));if(ǥ>1)Ǩ(ǥ-1);}void Ǩ(int ǥ=6){Echo("--Primary Blocks--");if(Ɯ.Count>0)Echo(
  71. $"Primary Thrust: {Ɯ.Count}");if(ņ.Count>0){Echo($"Primary Remote: {ņ.Count}");Ð<IMyRemoteControl>(ņ);}if(Ŋ.Count>0){Echo(
  72. $"Primary Connector: {Ŋ.Count}");Ð<IMyShipConnector>(Ŋ);}if(ň.Count>0){Echo($"Primary Merge: {ň.Count}");Ð<IMyShipMergeBlock>(ň);}if(Ō.Count>0)Echo(
  73. $"Primary Gyro: {Ō.Count}");if(ł.Count>0)Echo($"Camera: {ł.Count}");if(Ł.Count>0)Echo($"Warhead: {Ł.Count}");if(Ŀ.Count>0)Echo($"Timer: {Ŀ.Count}"
  74. );if(ǥ>1)ǧ(ǥ-1);}void ǧ(int ǥ=6){Echo("--Secondary Blocks--");if(Ş.Count>0)Echo($"Secondary Thrust: {Ş.Count}");if(Ņ.
  75. Count>0){Echo($"Secondary Remote: {Ņ.Count}");Ð<IMyRemoteControl>(Ņ);}if(ʼn.Count>0){Echo($"Secondary Connector: {ʼn.Count}");Ð
  76. <IMyShipConnector>(ʼn);}if(Ň.Count>0){Echo($"Secondary Merge: {Ň.Count}");Ð<IMyShipMergeBlock>(Ň);}if(ŋ.Count>0)Echo(
  77. $"Secondary Gyro: {ŋ.Count}");if(ǥ>1)Ǧ(ǥ-1);}void Ǧ(int ǥ=6){Echo("--Raycast Status--");if(!ŧ.IsEmpty()){if(Ɠ)Echo("Tracking target");Echo(
  78. $"Target Distance: {ų:N0}");Echo($"Target Speed: {ŧ.Velocity.Length():N2}");Echo($"Next Raycast: {Œ.TotalSeconds:N2}s");Echo($"Accuracy: {Ʃ:N1}");
  79. }else if(!Ŧ.IsEmpty()){Echo("Last raycast hit, bad target");if(Ŧ.Relationship==MyRelationsBetweenPlayerAndBlock.Enemies)
  80. Echo("Relationship: Enemies");else if(Ŧ.Relationship==MyRelationsBetweenPlayerAndBlock.FactionShare)Echo(
  81. "Relationship: Faction Share");else if(Ŧ.Relationship==MyRelationsBetweenPlayerAndBlock.Neutral)Echo("Relationship: Neutral");else if(Ŧ.Relationship
  82. ==MyRelationsBetweenPlayerAndBlock.Friends)Echo("Relationship: Friends");else if(Ŧ.Relationship==
  83. MyRelationsBetweenPlayerAndBlock.NoOwnership)Echo("Relationship: No Owner");else if(Ŧ.Relationship==MyRelationsBetweenPlayerAndBlock.Owner)Echo(
  84. "Relationship: You are the owner");Echo($"Distance: {Vector3D.Distance(ū,(Vector3D)Ŧ.HitPosition):N0}");}if(ǥ>1)ǫ(ǥ-1);}bool Ǥ(ref IEnumerator<bool>Ǡ){
  85. bool ǣ,Ǣ=false;try{ǣ=Ǡ.MoveNext();}catch{ǣ=false;Ǣ=true;}if(!ǣ)ǡ(ref Ǡ);return!ǣ||Ǣ;}void ǡ(ref IEnumerator<bool>Ǡ){try{Ǡ.
  86. Dispose();}catch{}try{Ǡ=null;}catch{}}bool ǟ(){if(Ɓ==null)Ɓ=Ǟ();return Ǥ(ref Ɓ);}IEnumerator<bool>Ǟ(){StringBuilder lj=new
  87. StringBuilder();lj.AppendLine();lj.AppendLine(Ƒ);lj.AppendLine("==Missile Number Settings");lj.AppendLine(Ƒ);lj.AppendLine();for(int K=0;K
  88. <Ľ.Count;K++){if(!ò())yield return true;lj.AppendLine($"{Ľ.Keys[K]}={Ľ.Values[K]}");}lj.AppendLine();lj.AppendLine(Ƒ);lj.
  89. AppendLine("==Missile Text Settings");lj.AppendLine(Ƒ);lj.AppendLine();for(int K=0;K<ľ.Count;K++){if(!ò())yield return true;lj.
  90. AppendLine($"{ľ.Keys[K]}={ľ.Values[K]}");}lj.AppendLine();lj.AppendLine(Ƒ);lj.AppendLine("==Missile Switch Settings");lj.AppendLine(Ƒ)
  91. ;lj.AppendLine();for(int K=0;K<ļ.Count;K++){if(!ò())yield return true;lj.AppendLine($"{ļ.Keys[K]}={ļ.Values[K]}");}lj.
  92. AppendLine();lj.AppendLine(Ƒ);lj.AppendLine();lj.AppendLine($"Script={ƒ} v{Ź}");Me.CustomData=lj.ToString().Trim();Ɛ=Me.CustomData;ƛ=
  93. true;yield return false;}bool ƻ(){if(Me.CustomData.Length==0){Ɲ=false;ƫ=true;return true;}if(ƀ==null)ƀ=ƺ();return Ǥ(ref ƀ);}
  94. IEnumerator<bool>ƺ(){string[]ƹ=Me.CustomData.Split(new[]{"\r\n","\r","\n"},StringSplitOptions.RemoveEmptyEntries);if(!ò())yield
  95. return true;string Ƹ,Ʒ,ƶ;double Ƶ;bool ƴ;for(int K=1;K<ƹ.Length;K++){if(!ò())yield return true;Ƹ=ƹ[K];if(Ƹ.Length>0&&Ĭ(out Ʒ,
  96. out ƶ,Ƹ)){double.TryParse(ƶ,out Ƶ);ƴ=ƶ.ToLower()=="true";if(Ʒ.ToLower()=="script"){ƛ=ƶ==$"{ƒ} v{Ź}";continue;}if(ļ.
  97. ContainsKey(Ʒ)){ļ[Ʒ]=ƴ;continue;}if(!ò())yield return true;if(Ľ.ContainsKey(Ʒ)){Ľ[Ʒ]=Ƶ;continue;}if(!ò())yield return true;if(ľ.
  98. ContainsKey(Ʒ)){ľ[Ʒ]=ƶ;continue;}N($"Unhandled setting: {Ƹ}");}}if(!ò())yield return true;ŵ=Ľ["Gyro Limiter"];Ŷ=Ľ["Gyro Multiplier"
  99. ];Ə=ľ["Filter Keyword Global"].ToLower();ƪ=Ľ["Forward Speed Maximum"];ƨ=Ľ["Missile Tube Protection Distance"];Ƨ=Ľ[
  100. "Missile Tube Protection Time In Seconds"];Ɛ=Me.CustomData;if(!ƛ)ƫ=true;yield return false;}bool Ƴ(){if(Ƃ==null)Ƃ=Ʋ();return Ǥ(ref Ƃ);}IEnumerator<bool>Ʋ(){
  101. TimeSpan Ʊ=new TimeSpan(0,0,0),ư=TimeSpan.FromSeconds(7.7);while(!Ơ&&!Ƣ){if(ư.TotalSeconds<=0.0){Ƣ=true;ơ=false;while(!Dž())yield
  102. return true;ư=TimeSpan.FromSeconds(7.7);}else ư-=Runtime.TimeSinceLastRun;if(Ʊ.TotalSeconds<=0.0){for(int K=0;K<Ɯ.Count;K++){
  103. if(!ò())yield return true;Ɯ[K].ThrustOverridePercentage=0f;}for(int K=0;K<Ş.Count;K++){if(!ò())yield return true;Ş[K].
  104. ThrustOverridePercentage=0f;}for(int K=0;K<Ō.Count;K++){if(!ò())yield return true;Ō[K].Yaw=0f;Ō[K].Pitch=0f;Ō[K].Roll=0f;Ō[K].GyroOverride=false
  105. ;}for(int K=0;K<ŋ.Count;K++){if(!ò())yield return true;ŋ[K].Yaw=0f;ŋ[K].Pitch=0f;ŋ[K].Roll=0f;ŋ[K].GyroOverride=false;}
  106. bool Ư=false;for(int K=0;K<Ŋ.Count;K++){if(!ò())yield return true;Ŋ[K].Enabled=true;if(Ŋ[K].Status==MyShipConnectorStatus.
  107. Connectable)Ŋ[K].ToggleConnect();if(Ŋ[K].Status==MyShipConnectorStatus.Connected)Ư=true;}for(int K=0;K<ň.Count&&!Ư;K++){if(!ò())
  108. yield return true;if(ň[K].IsConnected)Ư=true;}for(int K=0;K<ʼn.Count;K++){if(!ò())yield return true;ʼn[K].Enabled=true;if(ʼn[K].
  109. Status==MyShipConnectorStatus.Connectable)ʼn[K].ToggleConnect();}if(Ư){List<IMyPowerProducer>Ʈ=new List<IMyPowerProducer>();
  110. GridTerminalSystem.GetBlocksOfType<IMyPowerProducer>(Ʈ);if(Ʈ.Count>ń.Count){for(int K=0;K<ń.Count;K++){if(!ò())yield return true;if(ń[K]is
  111. IMyBatteryBlock){IMyBatteryBlock ƭ=(IMyBatteryBlock)ń[K];ƭ.Enabled=true;ƭ.ChargeMode=ChargeMode.Recharge;}}}}for(int K=0;K<Ń.Count;K++)
  112. {if(!ò())yield return true;Ń[K].Enabled=true;Ń[K].Stockpile=true;}for(int K=0;K<Ł.Count;K++){if(!ò())yield return true;Ł[
  113. K].IsArmed=false;}Ʊ=TimeSpan.FromSeconds(5);}else Ʊ-=Runtime.TimeSinceLastRun;yield return true;}yield return false;}bool
  114. Ƽ(bool H=false){if(ƃ==null)ƃ=ƽ(H);return Ǥ(ref ƃ);}IEnumerator<bool>ƽ(bool H){bool Lj=false;if(!H){TimeSpan LJ=TimeSpan.
  115. FromSeconds(Ľ["Launch Delay In Seconds"]);if(LJ.TotalSeconds>0.0)N($"Delaying launch by: {LJ.TotalSeconds:N1} seconds");while(LJ.
  116. TotalSeconds>0.0){yield return true;LJ-=Runtime.TimeSinceLastRun;}}if(ļ["Autoboot Basic"]){if(Ŋ.Count>0){N(
  117. $"Detaching {Ŋ.Count} primary connectors");for(int K=0;K<Ŋ.Count;K++){if(!ò())yield return true;try{if(Ŋ[K].Status==MyShipConnectorStatus.Connected)Ŋ[K].
  118. ToggleConnect();Ŋ[K].Enabled=false;}catch{}}}if(ň.Count>0){N($"Detaching {ň.Count} primary merge blocks");for(int K=0;K<ň.Count;K++){
  119. if(!ò())yield return true;try{ň[K].Enabled=false;}catch{}}}TimeSpan dž=TimeSpan.FromSeconds(Ľ[
  120. "Post Detach Rescan Delay In Seconds"]);if(dž.TotalSeconds>0.0){N($"Delaying post detach rescan by: {dž.TotalSeconds:N1} seconds");while(dž.TotalSeconds>0.0){
  121. yield return true;dž-=Runtime.TimeSinceLastRun;}}N("Beginning hard scan");Ƣ=true;ơ=true;while(!Dž())yield return true;N(
  122. "Rebooting");Lj=true;}do{if(ń.Count>0){N($"Enabling {ń.Count} power blocks");for(int K=0;K<ń.Count;K++){if(!ò())yield return true;
  123. try{O(ń[K]);}catch{}}}if(Ń.Count>0){N($"Enabling {Ń.Count} hydrogen tanks");for(int K=0;K<Ń.Count;K++){if(!ò())yield return
  124. true;try{Ń[K].Enabled=true;Ń[K].Stockpile=false;}catch{}}}if(ŀ.Count>0){N($"Enabling {ŀ.Count} gas generators");for(int K=0;
  125. K<Ń.Count;K++){if(!ò())yield return true;try{Ń[K].Enabled=true;Ń[K].Stockpile=false;}catch{}}}if(ł.Count>0){N(
  126. $"Enabling {ł.Count} cameras");for(int K=0;K<ł.Count;K++){if(!ò())yield return true;try{ł[K].Enabled=true;ł[K].EnableRaycast=true;}catch{}}}if(!H&&Ɯ.
  127. Count>0){N($"Enabling {Ɯ.Count} primary thrust");for(int K=0;K<Ɯ.Count;K++){if(!ò())yield return true;try{Ɯ[K].Enabled=true;Ɯ
  128. [K].ThrustOverridePercentage=0f;}catch{}}}if(H&&Ş.Count>0){N($"Enabling {Ş.Count} secondary thrust");for(int K=0;K<Ş.
  129. Count;K++){if(!ò())yield return true;try{Ş[K].Enabled=true;Ş[K].ThrustOverridePercentage=0f;}catch{}}}if(!H&&Ō.Count>0){N(
  130. $"Enabling {Ō.Count} primary gyroscopes");for(int K=0;K<Ō.Count;K++){if(!ò())yield return true;try{Ō[K].Enabled=true;Ō[K].Yaw=0f;Ō[K].Pitch=0f;Ō[K].Roll=0f;Ō[K]
  131. .GyroOverride=false;}catch{}}}if(H&&ŋ.Count>0){N($"Enabling {ŋ.Count} secondary gyroscopes");for(int K=0;K<ŋ.Count;K++){
  132. if(!ò())yield return true;try{ŋ[K].Enabled=true;ŋ[K].Yaw=0f;ŋ[K].Pitch=0f;ŋ[K].Roll=0f;ŋ[K].GyroOverride=false;}catch{}}}
  133. if(!H&&Ŋ.Count>0){N($"Detaching {Ŋ.Count} primary connectors");for(int K=0;K<Ŋ.Count;K++){if(!ò())yield return true;try{if
  134. (Ŋ[K].Status==MyShipConnectorStatus.Connected)Ŋ[K].ToggleConnect();Ŋ[K].Enabled=false;}catch{}}}if(H&&ʼn.Count>0){N(
  135. $"Detaching {ʼn.Count} secondary connectors");for(int K=0;K<ʼn.Count;K++){if(!ò())yield return true;try{if(ʼn[K].Status==MyShipConnectorStatus.Connected)ʼn[K].
  136. ToggleConnect();ʼn[K].Enabled=false;}catch{}}}if(!H&&ň.Count>0){N($"Detaching {ň.Count} primary merge blocks");for(int K=0;K<ň.Count;K
  137. ++){if(!ò())yield return true;try{ň[K].Enabled=false;}catch{}}}if(H&&Ň.Count>0){N(
  138. $"Detaching {Ň.Count} secondary merge blocks");for(int K=0;K<Ň.Count;K++){if(!ò())yield return true;try{Ň[K].Enabled=false;}catch{}}}if(!Lj){TimeSpan dž=TimeSpan.
  139. FromSeconds(Ľ["Post Detach Rescan Delay In Seconds"]);if(dž.TotalSeconds>0.0){N(
  140. $"Delaying post detach rescan by: {dž.TotalSeconds:N1} seconds");while(dž.TotalSeconds>0.0){yield return true;dž-=Runtime.TimeSinceLastRun;}N("Beginning hard scan");Ƣ=true;ơ=true;while(
  141. !Dž())yield return true;N("Rebooting");Lj=true;}}else Lj=false;}while(Lj);yield return false;}bool Dž(){if(!Ƣ)return true;if(ƅ
  142. ==null)ƅ=ǃ(ơ);bool DŽ=Ǥ(ref ƅ);if(DŽ){Ƣ=false;ơ=false;}return DŽ;}IEnumerator<bool>ǃ(bool ǂ){W();bool ǁ=ļ["Same Grid Only"];
  143. List<IMyTimerBlock>ǀ=new List<IMyTimerBlock>();if(!ǂ&&ļ["Autoboot Basic"]){Vector3D ƿ=Me.GetPosition();if(ļ[
  144. "Detach Merge Blocks"]){List<IMyTerminalBlock>ƾ=new List<IMyTerminalBlock>();GridTerminalSystem.GetBlocksOfType<IMyShipMergeBlock>(ƾ,C=>!ǁ||C
  145. .CubeGrid==Me.CubeGrid);if(ƾ.Count>0){List<ā>Ì=new List<ā>();for(int K=0;K<ƾ.Count;K++){if(!ò())yield return true;if(Ġ(ƾ[
  146. K],"Filter Keyword Merge Block"))Ì.Add(new ā{Ā=Vector3D.Distance(ƿ,ƾ[K].GetPosition()),I=ƾ[K]});}Ì=Ì.OrderBy(Ã=>Ã.Ā).
  147. ToList();if(!ò())yield return true;ň.Add((IMyShipMergeBlock)Ì[0].I);}}if(ļ["Detach Connectors"]){List<IMyTerminalBlock>ij=new
  148. List<IMyTerminalBlock>();GridTerminalSystem.GetBlocksOfType<IMyShipConnector>(ij,C=>!ǁ||C.CubeGrid==Me.CubeGrid);if(ij.Count>0
  149. ){List<ā>Ì=new List<ā>();for(int K=0;K<ij.Count;K++){if(!ò())yield return true;if(Ġ(ij[K],"Filter Keyword Connector"))Ì.Add
  150. (new ā{Ā=Vector3D.Distance(ƿ,ij[K].GetPosition()),I=ij[K]});}Ì=Ì.OrderBy(Ã=>Ã.Ā).ToList();if(!ò())yield return true;Ŋ.Add((
  151. IMyShipConnector)Ì[0].I);}}List<IMyTimerBlock>Ë=new List<IMyTimerBlock>();GridTerminalSystem.GetBlocksOfType<IMyTimerBlock>(Ë,C=>!ǁ||C.
  152. CubeGrid==Me.CubeGrid);for(int K=0;K<Ë.Count;K++){if(!ò())yield return true;if(Ġ(Ë[K],"Filter Keyword Timer")&&Ë[K].CustomData.
  153. Length==0)Ë[K].CustomData=Ǝ.ToString();}}else{bool Ê=true;string É=ľ["Missile Primary Group Name"].ToLower(),È=ľ[
  154. "Missile Secondary Group Name"].ToLower();List<IMyTerminalBlock>Ç=new List<IMyTerminalBlock>(),Æ=new List<IMyTerminalBlock>(),Å=new List<
  155. IMyTerminalBlock>();List<IMyBlockGroup>Ä=new List<IMyBlockGroup>();GridTerminalSystem.GetBlockGroups(Ä,C=>C.Name.ToLower()==É);for(int K
  156. =0;K<Ä.Count;K++){if(!ò())yield return true;Å.Clear();Ä[K].GetBlocks(Å);for(int Ã=0;Ã<Å.Count;Ã++){if(!ò())yield return
  157. true;if(!Ç.Contains(Å[Ã])){if(Ê&&!(Å[Ã]is IMyShipMergeBlock)&&!(Å[Ã]is IMyShipConnector))Ê=false;Ç.Add(Å[Ã]);}}}Ä.Clear();
  158. GridTerminalSystem.GetBlockGroups(Ä,C=>C.Name.ToLower()==È);for(int K=0;K<Ä.Count;K++){if(!ò())yield return true;Å.Clear();Ä[K].GetBlocks(
  159. Å);for(int Ã=0;Ã<Å.Count;Ã++){if(!ò())yield return true;if(!Æ.Contains(Å[Ã])){if(Ê&&!(Å[Ã]is IMyShipMergeBlock)&&!(Å[Ã]is
  160. IMyShipConnector))Ê=false;Æ.Add(Å[Ã]);}}}if(ǂ&&(Ç.Count==0||Æ.Count==0||Ê)){Å.Clear();GridTerminalSystem.GetBlocksOfType<
  161. IMyTerminalBlock>(Å,C=>!ǁ||C.CubeGrid==Me.CubeGrid);bool Â=Ç.Count==0,Á=Æ.Count==0;for(int K=0;K<Å.Count;K++){if(!ò())yield return true;
  162. if(ö(Å[K])){if(Á||!Æ.Contains(Å[K]))Æ.Add(Å[K]);}else{if(Â||!Ç.Contains(Å[K]))Ç.Add(Å[K]);}}}for(int K=0;K<Ç.Count;K++){if
  163. (!ò())yield return true;if(Ç[K]is IMyTimerBlock)ǀ.Add((IMyTimerBlock)Ç[K]);else J(Ç[K]);}for(int K=0;K<Æ.Count;K++){if(!ò
  164. ())yield return true;J(Æ[K],true);}if(ņ.Count>1){while(!á(ņ))yield return true;}if(Ņ.Count>1){while(!á(Ņ))yield return
  165. true;}IMyRemoteControl À;if(Ĩ(out À)){Matrix º,Í;À.Orientation.GetMatrix(out º);Vector3D d=ô(º.Backward),Ï=ô(º.Down);for(int
  166. K=0;K<Ɯ.Count;K++){if(!ò())yield return true;Ɯ[K].Orientation.GetMatrix(out Í);if(Vector3D.Distance(d,ô(Í.Forward))<=ƈ)ů.
  167. Add(Ɯ[K]);else if(Vector3D.Distance(Ï,ô(Í.Forward))<=ƈ)Ŏ.Add(Ɯ[K]);}for(int K=0;K<Ş.Count;K++){if(!ò())yield return true;Ş[
  168. K].Orientation.GetMatrix(out Í);if(Vector3D.Distance(d,ô(Í.Forward))<=ƈ)ŏ.Add(Ş[K]);else if(Vector3D.Distance(Ï,ô(Í.
  169. Forward))<=ƈ)ō.Add(Ş[K]);}}else{N("No remote controller found");Ƣ=true;ơ=Ơ;}}if(!ò())yield return true;Ƙ=ʼn.Count>0||ō.Count>0||
  170. ŏ.Count>0||ŋ.Count>0||Ň.Count>0||Ņ.Count>0||Ş.Count>0;string[]ä;for(int K=0;K<ǀ.Count;K++){if(!ò())yield return true;if(ǀ
  171. [K].CustomData.Length>0){ċ ã=new ċ();ã.Ċ=ǀ[K];ä=ǀ[K].CustomData.Split(new[]{"\r\n","\r","\n"},StringSplitOptions.
  172. RemoveEmptyEntries);for(int Ã=0;Ã<ä.Length;Ã++){if(!ò())yield return true;if(!ä[Ã].StartsWith("//")){Ć â=new Ć();if(ä[Ã].ToLower()==
  173. "repeatable=true")ã.Ĉ=true;else{try{if(æ(ä[Ã],out â.å,out â.ü,out â.ą))ã.ĉ.Add(â);}catch{}}}}if(ã.ĉ.Count>0)Ŀ.Add(ã);}}yield return false
  174. ;}bool á(List<IMyRemoteControl>ß){if(Ƅ==null)Ƅ=à(ß);return Ǥ(ref Ƅ);}IEnumerator<bool>à(List<IMyRemoteControl>ß){List<ā>Ì
  175. =new List<ā>();Vector3D Þ=Me.GetPosition();for(int K=0;K<ß.Count;K++){if(!ò())yield return true;Ì.Add(new ā{Ā=Vector3D.
  176. Distance(Þ,ß[K].GetPosition()),I=(IMyTerminalBlock)ß[K]});}Ì=Ì.OrderBy(Ã=>Ã.Ā).ToList();ß.Clear();for(int K=0;K<Ì.Count;K++){if(
  177. !ò())yield return true;ß.Add((IMyRemoteControl)Ì[K].I);}yield return false;}void Ü(){ſ.MoveNext();}IEnumerator<bool>Û(){
  178. IMyRemoteControl U;List<IMyGyro>Ú;while(true){ƚ=true;var Ù=new Vector3D(-Ū.X,Ū.Y,Ū.Z);if(Ĩ(out U)){Ú=Ī();var Ø=U.WorldMatrix;var Ö=
  179. Vector3D.TransformNormal(Ù,Ø);foreach(IMyGyro Õ in Ú){if(!ò())yield return true;try{var Ô=Õ.WorldMatrix;var Ó=Vector3D.
  180. TransformNormal(Ö,Matrix.Transpose(Ô));Õ.Pitch=(float)Ó.X;Õ.Yaw=(float)Ó.Y;Õ.Roll=(float)Ó.Z;Õ.GyroOverride=Ó!=Vector3D.Zero;}catch{}}}
  181. ƚ=false;yield return true;}}void Ò(){if(ž==null)ž=Ñ();Ǥ(ref ž);}IEnumerator<bool>Ñ(){for(int K=0;K<ł.Count;K++){if(!ò())
  182. yield return true;ł[K].Enabled=true;ł[K].EnableRaycast=true;}yield return false;}void Ð<Ý>(List<Ý>µ)where Ý:class{for(int K=0
  183. ;K<µ.Count;K++){Echo(((IMyTerminalBlock)µ[K]).CustomName);}}void Y(){IMyRemoteControl U;if(Ĩ(out U))ū=U.GetPosition();
  184. else ū=Me.GetPosition();if(Ơ)ų=Vector3D.Distance(ū,Ŭ);}void X(){IMyRemoteControl U;if(Ĩ(out U)){ƍ=U.GetShipSpeed();Ũ=
  185. Vector3D.TransformNormal(U.GetShipVelocities().LinearVelocity,MatrixD.Transpose(U.WorldMatrix));ŷ=ƍ*Vector3D.Normalize(Ũ).Z*-1.0
  186. ;Ų=ƍ-Math.Abs(ŷ);}if(double.IsNaN(ŷ)){ƍ=0;ŷ=0;Ų=0;}}void W(){ł.Clear();Ł.Clear();ń.Clear();Ń.Clear();Ŀ.Clear();ŀ.Clear();
  187. Ɯ.Clear();ů.Clear();Ŏ.Clear();Ō.Clear();Ŋ.Clear();ň.Clear();ņ.Clear();Ş.Clear();ŏ.Clear();ō.Clear();ŋ.Clear();ʼn.Clear();Ň
  188. .Clear();Ņ.Clear();}void V(){if(Ĺ.TotalSeconds<=0.0){Ĺ=TimeSpan.FromSeconds(3);IMyRemoteControl U;if(Ĩ(out U)){Vector3D S
  189. ;if(U.TryGetPlanetPosition(out S)){ƞ=true;string R=S.ToString("N0");double Q;if(!Ů.ContainsKey(R))Ů[R]=new ÿ{g=S,ý=Ľ[
  190. "Travel Elevation"]};if(U.TryGetPlanetElevation(MyPlanetElevation.Sealevel,out Q)){ź=Q;Ů[R].Î=Math.Max(ź,Ů[R].Î);Ů[R].þ=Vector3D.Distance(
  191. ū,S)-Q;Ɨ=Vector3D.Distance(Ŭ,Ů[R].g)<=Ů[R].þ*1.7182;}if(U.TryGetPlanetElevation(MyPlanetElevation.Surface,out Q))Ż=Q;Ÿ=U.
  192. GetNaturalGravity().Length();if(Ķ.TotalSeconds<=0){ű=U.CalculateShipMass().PhysicalMass;Ķ=TimeSpan.FromSeconds(15);}}else{ÿ P;if(ƞ&&ğ(out
  193. P)){if(P.Î*0.95<P.ý)P.ý=Math.Round(P.Î*0.95);}ƞ=false;Ż=0;ź=0;}}}}void O(IMyPowerProducer I){I.Enabled=true;if(I is
  194. IMyBatteryBlock)((IMyBatteryBlock)I).ChargeMode=ChargeMode.Auto;}void N(string M){if(M.Length>0){if(ĺ.Add(M))Ļ.Insert(0,new Ą{ă=M,Ă=
  195. TimeSpan.FromSeconds(Ľ["Echo Life In Seconds"])});while(Ļ.Count>60){ĺ.Remove(Ļ[60].ă);Ļ.RemoveAt(60);}}}void L(){for(int K=0;K<Ļ
  196. .Count;K+=0){Ļ[K].Ă-=Runtime.TimeSinceLastRun;if(Ļ[K].Ă.TotalSeconds<=0.0){ĺ.Remove(Ļ[K].ă);Ļ.RemoveAt(K);}else K++;}}
  197. void J(IMyTerminalBlock I,bool H=false){if(I is IMyCameraBlock){if(Ġ(I,"Filter Keyword Camera"))ł.Add((IMyCameraBlock)I);}
  198. else if(I is IMyWarhead){if(Ġ(I,"Filter Keyword Warhead"))Ł.Add((IMyWarhead)I);}else if(I is IMyPowerProducer){if(Ġ(I,
  199. "Filter Keyword Power"))ń.Add((IMyPowerProducer)I);}else if(I is IMyGasTank){if(I.BlockDefinition.SubtypeName.ToLower().Contains("hydrogen")&&
  200. Ġ(I,"Filter Keyword Hydrogen"))Ń.Add((IMyGasTank)I);}else if(I is IMyGasGenerator){if(Ġ(I,"Filter Keyword H2/O2 Gens"))ŀ.
  201. Add((IMyGasGenerator)I);}else if(!H){if(I is IMyThrust){if(Ġ(I,"Filter Keyword Thrust"))Ɯ.Add((IMyThrust)I);}else if(I is
  202. IMyGyro){if(Ġ(I,"Filter Keyword Gyroscope"))Ō.Add((IMyGyro)I);}else if(I is IMyShipConnector){if(ļ["Detach Connectors"]&&Ġ(I,
  203. "Filter Keyword Connector"))Ŋ.Add((IMyShipConnector)I);}else if(I is IMyShipMergeBlock){if(ļ["Detach Merge Blocks"]&&Ġ(I,
  204. "Filter Keyword Merge Block"))ň.Add((IMyShipMergeBlock)I);}else if(I is IMyRemoteControl){if(Ġ(I,"Filter Keyword Remote Control")){ņ.Add((
  205. IMyRemoteControl)I);((IMyRemoteControl)I).DampenersOverride=true;}}}else{if(I is IMyThrust){if(Ġ(I,"Filter Keyword Thrust"))Ş.Add((
  206. IMyThrust)I);}else if(I is IMyGyro){if(Ġ(I,"Filter Keyword Gyroscope"))ŋ.Add((IMyGyro)I);}else if(I is IMyShipConnector){if(ļ[
  207. "Detach Connectors"]&&Ġ(I,"Filter Keyword Connector"))ʼn.Add((IMyShipConnector)I);}else if(I is IMyShipMergeBlock){if(ļ[
  208. "Detach Merge Blocks"]&&Ġ(I,"Filter Keyword Merge Block"))Ň.Add((IMyShipMergeBlock)I);}else if(I is IMyRemoteControl){if(Ġ(I,
  209. "Filter Keyword Remote Control")){Ņ.Add((IMyRemoteControl)I);((IMyRemoteControl)I).DampenersOverride=true;}}}}void G(double F=-1){if(ł.Count>0){
  210. IMyCameraBlock E;if(F==-1){E=é();N($"Attempting raycast with: {E.CustomName}");MyDetectedEntityInfo D=E.Raycast(E.AvailableScanRange);
  211. if(!D.IsEmpty()){if(u(D)){ŧ=D;Ŭ=ŧ.Position;w();ƙ=true;Ɠ=true;Ĵ=TimeSpan.FromSeconds(0);Œ=TimeSpan.FromSeconds((Vector3D.
  212. Distance(ŧ.Position,ū)/2000.0)/(double)ł.Count);}else Ŧ=D;}}else{E=ê(F,Vector3D.Zero);N(
  213. $"Attempting raycast with: {E.CustomName}");MyDetectedEntityInfo D=E.Raycast(F);if(!D.IsEmpty()){if(u(D)){ŧ=D;Ŭ=ŧ.Position;w();ƙ=true;Ɠ=true;Ĵ=TimeSpan.
  214. FromSeconds(0);Œ=TimeSpan.FromSeconds((Vector3D.Distance(ŧ.Position,ū)/2000.0)/(double)ł.Count);}else Ŧ=D;}}}else{
  215. GridTerminalSystem.GetBlocksOfType<IMyCameraBlock>(ł,C=>C.CubeGrid==Me.CubeGrid);N($"No cameras loaded, found {ł.Count} cameras");Ò();}}
  216. void B(){Vector3D Z=ŧ.Position+(ô(ŧ.Velocity)*Ĵ.TotalSeconds),A;double F=Vector3D.Distance(ū,Z)*1.05;IMyCameraBlock E=ê(F,Z)
  217. ;if(E!=null){A=Vector3D.TransformNormal(Z-E.GetPosition(),Matrix.Transpose(E.WorldMatrix));MyDetectedEntityInfo D=E.
  218. Raycast(F,A);if(!D.IsEmpty()){if(u(D)){ŧ=D;Ŭ=ŧ.Position;ų=Vector3D.Distance(ū,Ŭ);Ĵ=TimeSpan.FromSeconds(0);Œ=TimeSpan.
  219. FromSeconds((Vector3D.Distance(ŧ.Position,ū)/2000.0)/(double)ł.Count);}else Ŧ=D;}}}void w(){Ơ=true;double v=Ľ[
  220. "Randomized Offset Distance"];if(v!=0.0){Ŭ+=č(v);}ų=Vector3D.Distance(Ŭ,Me.GetPosition());Ŵ=Vector3D.Distance(Ŭ,Me.GetPosition());ĸ=new TimeSpan(0);
  221. ũ=Me.GetPosition();ƙ=false;}bool u(MyDetectedEntityInfo D){return D.Relationship!=MyRelationsBetweenPlayerAndBlock.
  222. Friends&&D.Relationship!=MyRelationsBetweenPlayerAndBlock.Owner&&(D.Type==MyDetectedEntityType.LargeGrid||D.Type==
  223. MyDetectedEntityType.SmallGrid);}double t(){bool s=Me.CubeGrid.GridSizeEnum==MyCubeSize.Large;if(Ł.Count>0)s=Ł[0].CubeGrid.GridSizeEnum==
  224. MyCubeSize.Large;if(s)return Ľ["Warhead Radius Large"];return Ľ["Warhead Radius Small"];}double r(Vector3D g,IMyTerminalBlock f){
  225. MatrixD e=f.WorldMatrix;Vector3D c=f.GetPosition(),d=e.Down*5.0,ª=e.Right*5.0;d+=c;ª+=c;double q=Vector3D.Distance(c,g),p=
  226. Vector3D.Distance(d,g),o=Vector3D.Distance(ª,g),n=Vector3D.Distance(ª,c);double m=Math.Acos((o*o-n*n-q*q)/(-2.0*n*q));double l=
  227. 90.0-(m*180.0/Math.PI);if(q<p)l=180.0-l;if(l>180.0)l=-1.0*(360.0-l);l=-Ę((l/180.0)*Math.PI*Ŷ,Math.PI,ŵ*0.5);return l;}float
  228. k(){if(ť==ţ.ŭ||ť==ţ.Š||ť==ţ.š||ť==ţ.Ŝ)return 1f-(float)(Ʃ/15.0);if(ť==ţ.ş||ť==ţ.ŝ){ÿ P;if(ƞ&&ğ(out P)){Vector3D j=Ē(P.g,Ŭ
  229. ,Vector3D.Distance(ū,P.g));double F=Vector3D.Distance(j,ū);return Math.Max(0.05f,Math.Min(1f,(float)(F/Ľ[
  230. "Waypoint Distance"])));}}return 0f;}Vector3D h(Vector3D g,IMyTerminalBlock f){MatrixD e=f.WorldMatrix;Vector3D c=f.GetPosition(),d=e.
  231. Forward*5.0,ª=e.Right*5.0,Ğ=e.Up*5.0;d+=c;ª+=c;Ğ+=c;double q=Vector3D.Distance(c,g),p=Vector3D.Distance(d,g),Ĝ=Vector3D.
  232. Distance(Ğ,g),o=Vector3D.Distance(ª,g),ě=Vector3D.Distance(Ğ,c),n=Vector3D.Distance(ª,c);double Ě=Math.Acos((Ĝ*Ĝ-ě*ě-q*q)/(-2.0*
  233. ě*q)),m=Math.Acos((o*o-n*n-q*q)/(-2.0*n*q));double ę=90.0-(Ě*180.0/Math.PI),l=90.0-(m*180.0/Math.PI);if(q<p)ę=180-ę;if(ę>
  234. 180.0)ę=-1*(360-ę);if(q<p)l=180.0-l;if(l>180.0)l=-1.0*(360.0-l);ę=Ę((ę/180.0)*Math.PI*Ŷ,Math.PI,ŵ);l=Ę((l/180.0)*Math.PI*Ŷ,
  235. Math.PI,ŵ);return new Vector3D(ę,l,0);}double Ę(double ą,double ė,double ĝ){double ñ=1;if(ą<0)ñ=-1;return Math.Min(Math.Abs(
  236. ą),ė*ĝ)*ñ;}Vector3D ĕ(){Vector3D d,j,Ĕ;double ē=Ľ["Waypoint Distance"];if(ų<=ē)return Ŭ;ÿ P;d=(Vector3D.Normalize(Ŭ-ū)*Ľ[
  237. "Waypoint Distance"])+ū;if(ƞ&&ğ(out P)){j=Ē(P.g,d,P.þ+P.ý);if(Ɨ){Ĕ=Ē(P.g,Ŭ,Vector3D.Distance(ū,P.g));Ŵ=Vector3D.Distance(Ĕ,ū);ƌ=(ƍ/(Ƭ/ű))*(
  238. ƍ/2.0);Ű=(Ų/(Ƭ/ű))*(Ų/2.0);IMyRemoteControl U;if(Ĩ(out U)){if(Ŵ<=ƌ&&Ŵ<Ű&&Ż>=Ŵ){ť=ţ.ş;return Ē(P.g,Ŭ,Vector3D.Distance(Ŭ,P
  239. .g)+(ų*0.05));}}if(Ŵ<=ē){ť=ţ.ş;return Ē(P.g,Ŭ,Vector3D.Distance(ū,P.g)-Math.Min(ų*0.05,(ē-Ŵ)));}if(Ŵ>ē*2.0&&ź<=Math.Min(P
  240. .ý*0.5,1500)){ť=ţ.Ŝ;return Ē(P.g,ū,P.þ+P.ý);}ť=ţ.ŭ;return j;}else{ť=ţ.ŭ;if(Vector3D.Distance(d,P.g)>Vector3D.Distance(j,P
  241. .g)){return d;}return j;}}ť=ţ.Š;return d;}Vector3D Ē(Vector3D đ,Vector3D g,double F){return(Vector3D.Normalize(g-đ)*F)+đ;
  242. }bool Đ(){if(ƙ)return true;ÿ P;if(ƞ&&ğ(out P)){Vector3D Ė=Vector3D.Normalize(Ŭ-ū)*50.0;return Vector3D.Distance(ū+Ė,P.g)>
  243. Vector3D.Distance(ū,P.g);}return true;}bool ğ(out ÿ ħ){ħ=new ÿ();int IJ=-1;double İ=-1,į;for(int K=0;K<Ů.Count;K++){if(K==0){IJ=K;
  244. İ=Vector3D.Distance(Ů.Values[K].g,ū);}else{į=Vector3D.Distance(Ů.Values[K].g,ū);if(į<İ){İ=į;IJ=K;}}}if(IJ>=0&&Ů.Count>IJ){ħ=
  245. Ů.Values[IJ];return true;}return false;}bool Į(bool ĭ=false){if(ĭ)return ŷ<=ƪ*1.05;return ŷ<ƪ*Ľ["Forward Speed Tolerance"]
  246. ;}bool Ĭ(out string å,out string ø,string ú){å="";ø="";if(!ú.StartsWith("=")&&ú.Contains("=")){try{int è=ú.IndexOf("=");å
  247. =ú.Substring(0,è);ø=ú.Substring(è+1);return true;}catch{}}return false;}List<IMyThrust>ī(){if(Ɵ||Ş.Count==0)return Ɯ;
  248. return Ş;}List<IMyGyro>Ī(){if(Ɵ||ŋ.Count==0)return Ō;return ŋ;}List<IMyThrust>ĩ(){if(Ɵ||ō.Count==0)return Ŏ;return ō;}List<
  249. IMyThrust>ı(){if(Ɵ||ŏ.Count==0)return ů;return ŏ;}bool Ĩ(out IMyRemoteControl U){U=null;if(Ɵ){if(ņ.Count>0){for(int K=0;K<ņ.Count
  250. ;K++)if(Ħ(ņ[K])){U=ņ[K];return true;}}else if(Ņ.Count>0){for(int K=0;K<Ņ.Count;K++)if(Ħ(Ņ[K])){U=Ņ[K];return true;}}}else
  251. if(Ņ.Count>0){for(int K=0;K<Ņ.Count;K++)if(Ħ(Ņ[K])){U=Ņ[K];return true;}}if(Ơ&&!Ƣ)N("Failed to find Remote Control");
  252. return false;}bool Ħ(IMyTerminalBlock I){try{return I.CubeGrid.CubeExists(I.Position);}catch{}return false;}bool ĥ(string Ĥ,
  253. out Vector3D ó){ó=new Vector3D(0,0,0);try{string[]ģ=Ĥ.Split(':');if(ģ.Length>=5){double Ã,Ģ,ġ;if(double.TryParse(ģ[2],out Ã
  254. )&&double.TryParse(ģ[3],out Ģ)&&double.TryParse(ģ[4],out ġ)){ó=new Vector3D(Ã,Ģ,ġ);return true;}}}catch{}return false;}
  255. bool Ġ(IMyTerminalBlock I,string û){string ć=ľ[û].ToLower(),ù=I.CustomName.ToLower(),ø=I.CustomData.ToLower();return(ć.
  256. Length==0||ø.Contains(ć)||ù.Contains(ć))&&(Ə.Length==0||ø.Contains(Ə)||ù.Contains(Ə));}bool ö(IMyTerminalBlock I){string õ=ľ[
  257. "Missile Secondary Block Keyword"].ToLower();return I.CustomName.ToLower().Contains(õ)||(I.CustomData.Length>0&&I.CustomData.ToLower().Contains(õ));}
  258. Vector3D ô(Vector3 ó){return new Vector3D(ó.X,ó.Y,ó.Z);}bool ò(double ñ=0.9){return(Runtime.CurrentInstructionCount<(Runtime.
  259. MaxInstructionCount*Ɗ*ñ)&&(DateTime.Now-ƣ).TotalMilliseconds<Ɖ*ñ);}bool ð(){ƣ=DateTime.Now;ż=ï();Ž.Add(Runtime.LastRunTimeMs);if(Ž.Count>Ƈ)
  260. Ž.RemoveRange(0,Ž.Count-Ƈ);return ż<=Ƌ;}double ï(){if(Ž.Count==0)return 0;double î=0;for(int K=0;K<Ž.Count;K++)î+=Ž[K];
  261. return î/(double)Ž.Count;}bool í(Ć ì){double ë=0;switch(ì.å.ToLower()){case"launch time":ë=ĸ.TotalSeconds;break;case"altitude"
  262. :ë=Ż;break;case"elevation":ë=ź;break;case"gravity":ë=Ÿ;break;case"forward speed":ë=ŷ;break;case"lateral speed":ë=Ų;break;
  263. case"total speed":ë=ƍ;break;case"distance from axis":ë=Ŵ;break;case"distance from target":ë=ų;break;case"primary active":if(
  264. Ɵ)ë=1;else ë=0;break;case"secondary active":if(!Ɵ)ë=1;else ë=0;break;}switch(ì.ü){case"=":return ë==ì.ą;case">=":return ë
  265. >=ì.ą;case"<=":return ë<=ì.ą;}return false;}IMyCameraBlock ê(double F,Vector3D g){if(ł.Count>0){int è=-1;double ç=-1;for(
  266. int K=0;K<ł.Count;K++){if(ł[K].AvailableScanRange>=F&&(g==Vector3D.Zero||ł[K].CanScan(g))){if(è==-1){è=K;ç=ł[K].
  267. AvailableScanRange;}else if(ł[K].AvailableScanRange<ç){è=K;ç=ł[K].AvailableScanRange;}}}if(è>=0)return ł[è];}return null;}IMyCameraBlock é
  268. (){if(ł.Count>0){int è=0;double ç=ł[0].AvailableScanRange;for(int K=1;K<ł.Count;K++){if(ł[K].AvailableScanRange>ç){è=K;ç=
  269. ł[K].AvailableScanRange;}}return ł[è];}return null;}bool æ(string ú,out string å,out string ü,out double ą){int è;string
  270. ø;å="";ü="";ą=0;if(ú.Contains(">="))ü=">=";else if(ú.Contains("<="))ü="<=";else if(ú.Contains("="))ü="=";else return
  271. false;è=ú.IndexOf(ü);å=ú.Substring(0,è).Trim();ø=ú.Substring(è+ü.Length).Trim();if(ø.ToLower()=="true")ą=1;else if(ø.ToLower(
  272. )=="false")ą=0;else if(double.TryParse(ø,out ą))return true;return false;}bool Ď(string ø){Vector3D S;if(ĥ(ø,out S)){N(
  273. $"Target Specified: {S.ToString("N0")}");Ŭ=S;w();return true;}return false;}Vector3D č(double F){Random Č=new Random();double ñ=1;Vector3D ó=new Vector3D(0,0,0
  274. );if(Č.Next(1,100)<50)ñ=-1;ó.X=Č.NextDouble()*F*ñ;if(Č.Next(1,100)<50)ñ=-1;ó.Y=Č.NextDouble()*F*ñ;if(Č.Next(1,100)<50)ñ=-
  275. 1;ó.Z=Č.NextDouble()*F*ñ;return ó;}class ċ{public IMyTimerBlock Ċ;public List<Ć>ĉ=new List<Ć>();public bool ď=false,Ĉ=
  276. false;}class Ć{public string å="",ü="";public double ą=double.MaxValue;}class Ą{public string ă="";public TimeSpan Ă=new
  277. TimeSpan(0,0,0);}class ā{public double Ā;public IMyTerminalBlock I;}class ÿ{public Vector3D g=new Vector3D(0,0,0);public double
  278. þ=0,Î=0,ý=0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement