Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double Ƌ=0.666,Ɗ=0.5,Ɖ=1.0,ƈ=0.1;int Ƈ=60;IEnumerator<bool>Ɔ,ƅ,Ƅ,ƃ,Ƃ,Ɓ,ƀ,ſ,ž;List<double>Ž=new List<double>();double ż=0
- ,Ż=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 ƣ=
- DateTime.Now;bool Ƣ=true,ơ=false,Ơ=false,Ɵ=true,ƞ=false,ƫ=false,Ɲ=true,ƛ=false,ƚ=false,ƙ=false,Ƙ=false,Ɨ=false,Ɩ=false,ƕ=false,Ɣ
- =false,Ɠ=false;string ƒ="IPBM Missile Script",Ƒ="===============================================================",Ɛ="",Ə=
- "";StringBuilder Ǝ=new StringBuilder();List<IMyThrust>Ɯ=new List<IMyThrust>(),ů=new List<IMyThrust>(),Ş=new List<IMyThrust
- >(),ŏ=new List<IMyThrust>(),Ŏ=new List<IMyThrust>(),ō=new List<IMyThrust>();List<IMyGyro>Ō=new List<IMyGyro>(),ŋ=new List
- <IMyGyro>();List<IMyShipConnector>Ŋ=new List<IMyShipConnector>(),ʼn=new List<IMyShipConnector>();List<IMyShipMergeBlock>ň=
- new List<IMyShipMergeBlock>(),Ň=new List<IMyShipMergeBlock>();List<IMyRemoteControl>ņ=new List<IMyRemoteControl>(),Ņ=new
- List<IMyRemoteControl>();List<IMyPowerProducer>ń=new List<IMyPowerProducer>();List<IMyGasTank>Ń=new List<IMyGasTank>();List<
- IMyCameraBlock>ł=new List<IMyCameraBlock>();List<IMyWarhead>Ł=new List<IMyWarhead>();List<IMyGasGenerator>ŀ=new List<IMyGasGenerator>(
- );List<ċ>Ŀ=new List<ċ>();SortedList<string,string>ľ=new SortedList<string,string>{{"Missile Primary Group Name",
- "Missile 1 Primary"},{"Missile Secondary Group Name","Missile 1 Secondary"},{"Missile Secondary Block Keyword","2nd"},{
- "Filter Keyword Merge Block",""},{"Filter Keyword Connector",""},{"Filter Keyword Remote Control",""},{"Filter Keyword Gyroscope",""},{
- "Filter Keyword Camera",""},{"Filter Keyword Warhead",""},{"Filter Keyword Global",""},{"Filter Keyword Thrust",""},{"Filter Keyword Power",""}
- ,{"Filter Keyword Hydrogen",""},{"Filter Keyword H2/O2 Gens",""},{"Filter Keyword Timer","Logic"}};SortedList<string,
- double>Ľ=new SortedList<string,double>{{"Forward Speed Maximum",100},{"Forward Speed Tolerance",0.925},{"Travel Elevation",
- 10000},{"Echo Life In Seconds",10},{"Launch Delay In Seconds",0},{"Post Detach Rescan Delay In Seconds",0.5},{
- "Waypoint Distance",750},{"Gyro Multiplier",10.0},{"Gyro Limiter",0.6},{"Warhead Radius Small",4.49},{"Warhead Radius Large",22},{
- "Randomized Offset Distance",0},{"Missile Tube Protection Distance",40},{"Missile Tube Protection Time In Seconds",3}};SortedList<string,bool>ļ=new
- SortedList<string,bool>{{"Same Grid Only",true},{"Autoboot Basic",true},{"Detach Merge Blocks",true},{"Detach Connectors",false},{
- "Auto Max Speed",true}};List<Ą>Ļ=new List<Ą>();HashSet<string>ĺ=new HashSet<string>();TimeSpan Ĺ=new TimeSpan(0),ĸ=new TimeSpan(0),ķ=new
- TimeSpan(0,0,5),Ķ=new TimeSpan(0),ĵ=new TimeSpan(0),Ő=new TimeSpan(0),Ĵ=new TimeSpan(0),Œ=new TimeSpan(0);SortedList<string,ÿ>Ů=
- new SortedList<string,ÿ>();Vector3D Ŭ=new Vector3D(0,0,0),ū=new Vector3D(0,0,0),Ū=new Vector3D(0,0,0),ũ=new Vector3D(0,0,0)
- ,Ũ=new Vector3D(0,0,0);MyDetectedEntityInfo ŧ=new MyDetectedEntityInfo(),Ŧ=new MyDetectedEntityInfo();ţ ť=new ţ();ś Ť=new
- ś();public enum ţ{Ţ,š,Š,ŭ,ş,ŝ,Ŝ}public enum ś{Ś,ř,Ř,ŗ,Ŗ,ŕ}Program(){ſ=Û();ť=ţ.Ţ;Ť=ś.Ś;Ǝ.AppendLine("//Launch Time>=10");Ǝ
- .AppendLine("//Altitude>1000");Ǝ.AppendLine("//Elevation>1000");Ǝ.AppendLine("//Gravity<=0.5");Ǝ.AppendLine(
- "//Forward Speed>=90");Ǝ.AppendLine("//Lateral Speed<10");Ǝ.AppendLine("//Total Speed>90");Ǝ.AppendLine("//Distance From Axis<=5");Ǝ.
- AppendLine("//Distance From Target<=500");Ǝ.AppendLine("//Primary Active=True");Ǝ.AppendLine("//Secondary Active=False");Ǝ.Append(
- "//Repeatable=False");Runtime.UpdateFrequency=UpdateFrequency.Update1;}void Main(string ő){if(ð()){ƥ=0;if(ķ.TotalSeconds<=0){if(Me.
- CustomData.Length!=Ɛ.Length||Me.CustomData!=Ɛ)Ɲ=true;ķ=TimeSpan.FromSeconds(5);}if(Ɲ){if(ƻ()){Ɲ=false;ķ=TimeSpan.FromSeconds(10);}
- }else if(ƫ){if(ǟ())ƫ=false;}else ǚ();}else ƥ++;if(ő.Length>0)Ŕ(ő);Ǜ();}void Ŕ(string ő){try{string œ=ő.ToLower();if(Ď(ő))
- {}else if(œ.Contains(" ")){int è=œ.IndexOf(" ");string å=œ.Substring(0,è).ToLower(),ø=œ.Substring(è+1);double ǜ;switch(å)
- {case"direct":if(Ď(ø))ƙ=true;break;case"travel":if(double.TryParse(ø,out ǜ)){Ľ["Travel Elevation"]=ǜ;ƫ=true;}break;case
- "raycast":if(double.TryParse(ø,out ǜ))G(ǜ);break;}}else{switch(œ){case"scan":Ƣ=true;ơ=Ơ;break;case"deactivate":Ơ=false;break;case
- "save":if(!Ɲ)ƫ=true;break;case"load":if(!ƫ)Ɲ=true;break;case">":switch(Ť){case ś.Ś:Ť=ś.ř;break;case ś.ř:Ť=ś.Ř;break;case ś.Ř:Ť
- =ś.ŗ;break;case ś.ŗ:Ť=ś.Ŗ;break;case ś.Ŗ:Ť=ś.ŕ;break;case ś.ŕ:Ť=ś.Ś;break;}break;case"<":switch(Ť){case ś.Ś:Ť=ś.ŕ;break;
- case ś.ř:Ť=ś.Ś;break;case ś.Ř:Ť=ś.ř;break;case ś.ŗ:Ť=ś.Ř;break;case ś.Ŗ:Ť=ś.ŗ;break;case ś.ŕ:Ť=ś.Ŗ;break;}break;case
- "raycast":G();break;}}N($"Ran argument: {ő}");}catch{N($"Error caught running argument: {ő}");}}void Ǜ(){Ƥ++;L();if(Ƥ>=8){Ƥ=0;
- switch(Ť){case ś.Ś:ǫ();break;case ś.ř:Ǫ();break;case ś.Ř:DZ();break;case ś.ŗ:Ǩ();break;case ś.Ŗ:ǧ();break;case ś.ŕ:Ǧ();break;}
- for(int K=0;K<20;K++)Echo("");}}void ǚ(){if(Ɔ==null)Ɔ=Ǚ();Y();X();V();if(Ơ&&ť!=ţ.š&&ť!=ţ.Ţ)Ü();ǭ();if(ž!=null)Ò();Ǥ(ref Ɔ);
- }IEnumerator<bool>Ǚ(){bool ǘ=false,ĭ,Ǘ,ǖ,Ǖ,ǔ,Ǔ,ǝ=false;int ǒ=0;Vector3D Ǒ,ǐ,Ǐ,ǎ;IMyRemoteControl U;List<IMyThrust>Ǎ;while
- (true){while(!Dž())yield return true;if(!Ơ)while(!Ƴ())yield return true;if(Ơ&&!Ƣ){N("Booting");if(!ǘ){while(!Ƽ())yield
- return true;ǘ=true;}while(Ơ&&!Ƣ){ĭ=!Ɣ&&ļ["Auto Max Speed"];if(Ɩ&&Ő.TotalSeconds>=2.5){Ɣ=true;ĭ=false;}if(Į(ĭ))Ʀ=k();else Ʀ=0f;
- if(ĭ){if(ƍ>ƪ){Ő=TimeSpan.FromSeconds(0);ƪ=ƍ;}}if(Ʀ>0f){ƕ=true;if(ĭ)Ɩ=true;}else{ƕ=false;Ɩ=false;}Ǎ=ı();for(int K=0;K<Ǎ.
- Count;K++){if(!ò())yield return true;Ǎ[K].ThrustOverridePercentage=Ʀ;}if(Ɠ){B();if(Ĵ.TotalSeconds>0.0)Ŭ=ŧ.Position+(ô(ŧ.
- Velocity)*Ĵ.TotalSeconds);}if(Ĩ(out U)){if(ĸ.TotalSeconds<Ƨ||Vector3D.Distance(ũ,ū)<ƨ){ť=ţ.š;Ǒ=(U.WorldMatrix.Forward*250)+ū;}
- else if(Đ()){ť=ţ.Š;Ǒ=Ŭ;if(Ɠ){if(ŧ.Velocity.Length()>0f){double nj=Vector3D.Distance(ū,Ŭ)/ŷ;ǐ=Ŭ+(ô(ŧ.Velocity)*nj);nj=Vector3D.
- Distance(ū,ǐ)/ŷ;ǐ=Ŭ+(ô(ŧ.Velocity)*nj);nj=Vector3D.Distance(ū,ǐ)/ŷ;ǐ=Ŭ+(ô(ŧ.Velocity)*nj);if(Vector3D.Distance(Ǒ,ǐ)<ų*0.75)Ǒ=ǐ;}}}
- else{if(ĵ.TotalSeconds<=0){Ǎ=ĩ();Ƭ=0;for(int K=0;K<Ǎ.Count;K++){if(!ò())yield return true;Ƭ+=Ǎ[K].MaxEffectiveThrust;}ĵ=
- TimeSpan.FromSeconds(5);}Ǒ=ĕ();}if(ť!=ţ.š){Ū=h(Ǒ,U);ÿ P;if(ť==ţ.ŭ&&ƞ&&ğ(out P))Ū.Z=r(P.g,U);else if(Ų>=0.25){MatrixD Nj=U.
- 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.
- Normalize(Ǒ-ū)*100.0;ǎ=U.WorldMatrix.Forward*100;Ʃ=Vector3D.Distance(Ǐ,ǎ);}if(Ł.Count>0&&(ť==ţ.Š||ť==ţ.ŝ)&&Vector3D.Distance(ū,ũ)
- >=75){if(ł.Count>0){double F=ų+500;if(ł[ǒ].AvailableScanRange>=F){MyDetectedEntityInfo D=ł[ǒ].Raycast(F);ǒ++;if(ǒ>=ł.Count
- )ǒ=0;if(!D.IsEmpty()&&u(D)){if(Vector3D.Distance((Vector3D)D.HitPosition,Ł[0].GetPosition())<t())for(int K=0;K<Ł.Count;K
- ++)Ł[K].Detonate();}}}bool ǩ=ų<=250;for(int K=0;K<Ł.Count;K++){if(!ò())yield return true;Ł[K].IsArmed=ǩ;}}if(U!=null||Ĩ(
- out U)){Ǖ=false;ǔ=false;Ǘ=false;ǖ=false;Ǔ=ƕ;if(Ũ.Y>0)Ǖ=true;if(Ũ.Y<0)ǔ=true;if(Ũ.X>0)ǖ=true;if(Ũ.X<0)Ǘ=true;Matrix ǰ,ǯ;U.
- Orientation.GetMatrix(out ǰ);Ǎ=ī();for(int K=0;K<Ǎ.Count;K++){Ǎ[K].Orientation.GetMatrix(out ǯ);if(ǯ.Forward==ǰ.Down)Ǎ[K].Enabled=ǔ
- ;else if(ǯ.Forward==ǰ.Up)Ǎ[K].Enabled=Ǖ;else if(ǯ.Forward==ǰ.Left)Ǎ[K].Enabled=Ǘ;else if(ǯ.Forward==ǰ.Right)Ǎ[K].Enabled=
- ǖ;else if(ǯ.Forward==ǰ.Backward)Ǎ[K].Enabled=Ǔ;else if(ǯ.Forward==ǰ.Forward)Ǎ[K].Enabled=ǝ;}}bool Ǯ;for(int K=0;K<Ŀ.Count
- ;K++){if(!ò())yield return true;if((!Ŀ[K].ď||Ŀ[K].Ĉ)&&Ŀ[K].Ċ.Enabled){Ǯ=true;for(int Ã=0;Ã<Ŀ[K].ĉ.Count;Ã++){if(!ò())
- yield return true;if(!í(Ŀ[K].ĉ[Ã])){Ǯ=false;break;}}if(Ǯ){Ŀ[K].Ċ.Trigger();Ŀ[K].ď=true;}}}yield return true;}}yield return
- true;}}void ǭ(){TimeSpan Ǭ=Runtime.TimeSinceLastRun;Ĺ-=Ǭ;if(Ơ)ĸ+=Ǭ;ķ-=Ǭ;Ķ-=Ǭ;ĵ-=Ǭ;if(Ɩ)Ő+=Ǭ;if(Ɠ){Ĵ+=Ǭ;Œ-=Ǭ;}}void ǫ(int ǥ=6
- ){Echo("--Output--");for(int K=0;K<Ļ.Count;K++)Echo(Ļ[K].ă);if(ǥ>1)Ǫ(ǥ-1);}void Ǫ(int ǥ=6){Echo("--Status--");if(Ơ)Echo(
- "Active");else Echo("Idle");Echo("");if(ť==ţ.ş)Echo("Orienting towards target");if(ť==ţ.Ŝ)Echo("Ascending");if(ť==ţ.Š)Echo(
- "Heading directly to target");if(ť==ţ.ŝ)Echo("Approaching target");if(ť==ţ.ŭ)Echo("Navigating around planet");if(ť==ţ.š)Echo(
- "Flying straight to protect missile tubes");Echo($"Speed: {ŷ:N1} / {ƪ:N1}");Echo($"Lateral Speed: {Ų:N2}");Echo($"Total Speed: {ƍ:N1}");if(Ơ&&Ɨ){Echo(
- $"Est. Max Turn Radius: {ƌ:N0}");Echo($"Est. Drift Distance: {Ű:N0}");}if(ƞ){Echo($"Elevation: {ź:N1}");Echo($"Altitude: {Ż:N1}");Echo(
- $"Gravity: {((Ÿ/9.81)*100.0):N2}%");}Echo($"Last: {Runtime.LastRunTimeMs:N3}ms");Echo($"Average: {ż:N2} / {Ƌ}ms");if(ƥ>0)Echo($"Overheat Ticks: {ƥ}");if(ǥ
- >1)DZ(ǥ-1);}void DZ(int ǥ=6){Echo("--Target--");Echo($"Distance: {ų:N2}");if(Ɨ)Echo($"Accuracy: {Ŵ:N2}");Echo(
- "Coordinates:");Echo(Ŭ.ToString("N0"));if(ǥ>1)Ǩ(ǥ-1);}void Ǩ(int ǥ=6){Echo("--Primary Blocks--");if(Ɯ.Count>0)Echo(
- $"Primary Thrust: {Ɯ.Count}");if(ņ.Count>0){Echo($"Primary Remote: {ņ.Count}");Ð<IMyRemoteControl>(ņ);}if(Ŋ.Count>0){Echo(
- $"Primary Connector: {Ŋ.Count}");Ð<IMyShipConnector>(Ŋ);}if(ň.Count>0){Echo($"Primary Merge: {ň.Count}");Ð<IMyShipMergeBlock>(ň);}if(Ō.Count>0)Echo(
- $"Primary Gyro: {Ō.Count}");if(ł.Count>0)Echo($"Camera: {ł.Count}");if(Ł.Count>0)Echo($"Warhead: {Ł.Count}");if(Ŀ.Count>0)Echo($"Timer: {Ŀ.Count}"
- );if(ǥ>1)ǧ(ǥ-1);}void ǧ(int ǥ=6){Echo("--Secondary Blocks--");if(Ş.Count>0)Echo($"Secondary Thrust: {Ş.Count}");if(Ņ.
- Count>0){Echo($"Secondary Remote: {Ņ.Count}");Ð<IMyRemoteControl>(Ņ);}if(ʼn.Count>0){Echo($"Secondary Connector: {ʼn.Count}");Ð
- <IMyShipConnector>(ʼn);}if(Ň.Count>0){Echo($"Secondary Merge: {Ň.Count}");Ð<IMyShipMergeBlock>(Ň);}if(ŋ.Count>0)Echo(
- $"Secondary Gyro: {ŋ.Count}");if(ǥ>1)Ǧ(ǥ-1);}void Ǧ(int ǥ=6){Echo("--Raycast Status--");if(!ŧ.IsEmpty()){if(Ɠ)Echo("Tracking target");Echo(
- $"Target Distance: {ų:N0}");Echo($"Target Speed: {ŧ.Velocity.Length():N2}");Echo($"Next Raycast: {Œ.TotalSeconds:N2}s");Echo($"Accuracy: {Ʃ:N1}");
- }else if(!Ŧ.IsEmpty()){Echo("Last raycast hit, bad target");if(Ŧ.Relationship==MyRelationsBetweenPlayerAndBlock.Enemies)
- Echo("Relationship: Enemies");else if(Ŧ.Relationship==MyRelationsBetweenPlayerAndBlock.FactionShare)Echo(
- "Relationship: Faction Share");else if(Ŧ.Relationship==MyRelationsBetweenPlayerAndBlock.Neutral)Echo("Relationship: Neutral");else if(Ŧ.Relationship
- ==MyRelationsBetweenPlayerAndBlock.Friends)Echo("Relationship: Friends");else if(Ŧ.Relationship==
- MyRelationsBetweenPlayerAndBlock.NoOwnership)Echo("Relationship: No Owner");else if(Ŧ.Relationship==MyRelationsBetweenPlayerAndBlock.Owner)Echo(
- "Relationship: You are the owner");Echo($"Distance: {Vector3D.Distance(ū,(Vector3D)Ŧ.HitPosition):N0}");}if(ǥ>1)ǫ(ǥ-1);}bool Ǥ(ref IEnumerator<bool>Ǡ){
- bool ǣ,Ǣ=false;try{ǣ=Ǡ.MoveNext();}catch{ǣ=false;Ǣ=true;}if(!ǣ)ǡ(ref Ǡ);return!ǣ||Ǣ;}void ǡ(ref IEnumerator<bool>Ǡ){try{Ǡ.
- Dispose();}catch{}try{Ǡ=null;}catch{}}bool ǟ(){if(Ɓ==null)Ɓ=Ǟ();return Ǥ(ref Ɓ);}IEnumerator<bool>Ǟ(){StringBuilder lj=new
- StringBuilder();lj.AppendLine();lj.AppendLine(Ƒ);lj.AppendLine("==Missile Number Settings");lj.AppendLine(Ƒ);lj.AppendLine();for(int K=0;K
- <Ľ.Count;K++){if(!ò())yield return true;lj.AppendLine($"{Ľ.Keys[K]}={Ľ.Values[K]}");}lj.AppendLine();lj.AppendLine(Ƒ);lj.
- AppendLine("==Missile Text Settings");lj.AppendLine(Ƒ);lj.AppendLine();for(int K=0;K<ľ.Count;K++){if(!ò())yield return true;lj.
- AppendLine($"{ľ.Keys[K]}={ľ.Values[K]}");}lj.AppendLine();lj.AppendLine(Ƒ);lj.AppendLine("==Missile Switch Settings");lj.AppendLine(Ƒ)
- ;lj.AppendLine();for(int K=0;K<ļ.Count;K++){if(!ò())yield return true;lj.AppendLine($"{ļ.Keys[K]}={ļ.Values[K]}");}lj.
- AppendLine();lj.AppendLine(Ƒ);lj.AppendLine();lj.AppendLine($"Script={ƒ} v{Ź}");Me.CustomData=lj.ToString().Trim();Ɛ=Me.CustomData;ƛ=
- true;yield return false;}bool ƻ(){if(Me.CustomData.Length==0){Ɲ=false;ƫ=true;return true;}if(ƀ==null)ƀ=ƺ();return Ǥ(ref ƀ);}
- IEnumerator<bool>ƺ(){string[]ƹ=Me.CustomData.Split(new[]{"\r\n","\r","\n"},StringSplitOptions.RemoveEmptyEntries);if(!ò())yield
- return true;string Ƹ,Ʒ,ƶ;double Ƶ;bool ƴ;for(int K=1;K<ƹ.Length;K++){if(!ò())yield return true;Ƹ=ƹ[K];if(Ƹ.Length>0&&Ĭ(out Ʒ,
- out ƶ,Ƹ)){double.TryParse(ƶ,out Ƶ);ƴ=ƶ.ToLower()=="true";if(Ʒ.ToLower()=="script"){ƛ=ƶ==$"{ƒ} v{Ź}";continue;}if(ļ.
- ContainsKey(Ʒ)){ļ[Ʒ]=ƴ;continue;}if(!ò())yield return true;if(Ľ.ContainsKey(Ʒ)){Ľ[Ʒ]=Ƶ;continue;}if(!ò())yield return true;if(ľ.
- ContainsKey(Ʒ)){ľ[Ʒ]=ƶ;continue;}N($"Unhandled setting: {Ƹ}");}}if(!ò())yield return true;ŵ=Ľ["Gyro Limiter"];Ŷ=Ľ["Gyro Multiplier"
- ];Ə=ľ["Filter Keyword Global"].ToLower();ƪ=Ľ["Forward Speed Maximum"];ƨ=Ľ["Missile Tube Protection Distance"];Ƨ=Ľ[
- "Missile Tube Protection Time In Seconds"];Ɛ=Me.CustomData;if(!ƛ)ƫ=true;yield return false;}bool Ƴ(){if(Ƃ==null)Ƃ=Ʋ();return Ǥ(ref Ƃ);}IEnumerator<bool>Ʋ(){
- TimeSpan Ʊ=new TimeSpan(0,0,0),ư=TimeSpan.FromSeconds(7.7);while(!Ơ&&!Ƣ){if(ư.TotalSeconds<=0.0){Ƣ=true;ơ=false;while(!Dž())yield
- return true;ư=TimeSpan.FromSeconds(7.7);}else ư-=Runtime.TimeSinceLastRun;if(Ʊ.TotalSeconds<=0.0){for(int K=0;K<Ɯ.Count;K++){
- if(!ò())yield return true;Ɯ[K].ThrustOverridePercentage=0f;}for(int K=0;K<Ş.Count;K++){if(!ò())yield return true;Ş[K].
- 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
- ;}for(int K=0;K<ŋ.Count;K++){if(!ò())yield return true;ŋ[K].Yaw=0f;ŋ[K].Pitch=0f;ŋ[K].Roll=0f;ŋ[K].GyroOverride=false;}
- bool Ư=false;for(int K=0;K<Ŋ.Count;K++){if(!ò())yield return true;Ŋ[K].Enabled=true;if(Ŋ[K].Status==MyShipConnectorStatus.
- Connectable)Ŋ[K].ToggleConnect();if(Ŋ[K].Status==MyShipConnectorStatus.Connected)Ư=true;}for(int K=0;K<ň.Count&&!Ư;K++){if(!ò())
- 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].
- Status==MyShipConnectorStatus.Connectable)ʼn[K].ToggleConnect();}if(Ư){List<IMyPowerProducer>Ʈ=new List<IMyPowerProducer>();
- GridTerminalSystem.GetBlocksOfType<IMyPowerProducer>(Ʈ);if(Ʈ.Count>ń.Count){for(int K=0;K<ń.Count;K++){if(!ò())yield return true;if(ń[K]is
- IMyBatteryBlock){IMyBatteryBlock ƭ=(IMyBatteryBlock)ń[K];ƭ.Enabled=true;ƭ.ChargeMode=ChargeMode.Recharge;}}}}for(int K=0;K<Ń.Count;K++)
- {if(!ò())yield return true;Ń[K].Enabled=true;Ń[K].Stockpile=true;}for(int K=0;K<Ł.Count;K++){if(!ò())yield return true;Ł[
- K].IsArmed=false;}Ʊ=TimeSpan.FromSeconds(5);}else Ʊ-=Runtime.TimeSinceLastRun;yield return true;}yield return false;}bool
- Ƽ(bool H=false){if(ƃ==null)ƃ=ƽ(H);return Ǥ(ref ƃ);}IEnumerator<bool>ƽ(bool H){bool Lj=false;if(!H){TimeSpan LJ=TimeSpan.
- FromSeconds(Ľ["Launch Delay In Seconds"]);if(LJ.TotalSeconds>0.0)N($"Delaying launch by: {LJ.TotalSeconds:N1} seconds");while(LJ.
- TotalSeconds>0.0){yield return true;LJ-=Runtime.TimeSinceLastRun;}}if(ļ["Autoboot Basic"]){if(Ŋ.Count>0){N(
- $"Detaching {Ŋ.Count} primary connectors");for(int K=0;K<Ŋ.Count;K++){if(!ò())yield return true;try{if(Ŋ[K].Status==MyShipConnectorStatus.Connected)Ŋ[K].
- ToggleConnect();Ŋ[K].Enabled=false;}catch{}}}if(ň.Count>0){N($"Detaching {ň.Count} primary merge blocks");for(int K=0;K<ň.Count;K++){
- if(!ò())yield return true;try{ň[K].Enabled=false;}catch{}}}TimeSpan dž=TimeSpan.FromSeconds(Ľ[
- "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){
- yield return true;dž-=Runtime.TimeSinceLastRun;}}N("Beginning hard scan");Ƣ=true;ơ=true;while(!Dž())yield return true;N(
- "Rebooting");Lj=true;}do{if(ń.Count>0){N($"Enabling {ń.Count} power blocks");for(int K=0;K<ń.Count;K++){if(!ò())yield return true;
- try{O(ń[K]);}catch{}}}if(Ń.Count>0){N($"Enabling {Ń.Count} hydrogen tanks");for(int K=0;K<Ń.Count;K++){if(!ò())yield return
- true;try{Ń[K].Enabled=true;Ń[K].Stockpile=false;}catch{}}}if(ŀ.Count>0){N($"Enabling {ŀ.Count} gas generators");for(int K=0;
- K<Ń.Count;K++){if(!ò())yield return true;try{Ń[K].Enabled=true;Ń[K].Stockpile=false;}catch{}}}if(ł.Count>0){N(
- $"Enabling {ł.Count} cameras");for(int K=0;K<ł.Count;K++){if(!ò())yield return true;try{ł[K].Enabled=true;ł[K].EnableRaycast=true;}catch{}}}if(!H&&Ɯ.
- Count>0){N($"Enabling {Ɯ.Count} primary thrust");for(int K=0;K<Ɯ.Count;K++){if(!ò())yield return true;try{Ɯ[K].Enabled=true;Ɯ
- [K].ThrustOverridePercentage=0f;}catch{}}}if(H&&Ş.Count>0){N($"Enabling {Ş.Count} secondary thrust");for(int K=0;K<Ş.
- Count;K++){if(!ò())yield return true;try{Ş[K].Enabled=true;Ş[K].ThrustOverridePercentage=0f;}catch{}}}if(!H&&Ō.Count>0){N(
- $"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]
- .GyroOverride=false;}catch{}}}if(H&&ŋ.Count>0){N($"Enabling {ŋ.Count} secondary 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].GyroOverride=false;}catch{}}}
- if(!H&&Ŋ.Count>0){N($"Detaching {Ŋ.Count} primary connectors");for(int K=0;K<Ŋ.Count;K++){if(!ò())yield return true;try{if
- (Ŋ[K].Status==MyShipConnectorStatus.Connected)Ŋ[K].ToggleConnect();Ŋ[K].Enabled=false;}catch{}}}if(H&&ʼn.Count>0){N(
- $"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].
- ToggleConnect();ʼn[K].Enabled=false;}catch{}}}if(!H&&ň.Count>0){N($"Detaching {ň.Count} primary merge blocks");for(int K=0;K<ň.Count;K
- ++){if(!ò())yield return true;try{ň[K].Enabled=false;}catch{}}}if(H&&Ň.Count>0){N(
- $"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.
- FromSeconds(Ľ["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){yield return true;dž-=Runtime.TimeSinceLastRun;}N("Beginning hard scan");Ƣ=true;ơ=true;while(
- !Dž())yield return true;N("Rebooting");Lj=true;}}else Lj=false;}while(Lj);yield return false;}bool Dž(){if(!Ƣ)return true;if(ƅ
- ==null)ƅ=ǃ(ơ);bool DŽ=Ǥ(ref ƅ);if(DŽ){Ƣ=false;ơ=false;}return DŽ;}IEnumerator<bool>ǃ(bool ǂ){W();bool ǁ=ļ["Same Grid Only"];
- List<IMyTimerBlock>ǀ=new List<IMyTimerBlock>();if(!ǂ&&ļ["Autoboot Basic"]){Vector3D ƿ=Me.GetPosition();if(ļ[
- "Detach Merge Blocks"]){List<IMyTerminalBlock>ƾ=new List<IMyTerminalBlock>();GridTerminalSystem.GetBlocksOfType<IMyShipMergeBlock>(ƾ,C=>!ǁ||C
- .CubeGrid==Me.CubeGrid);if(ƾ.Count>0){List<ā>Ì=new List<ā>();for(int K=0;K<ƾ.Count;K++){if(!ò())yield return true;if(Ġ(ƾ[
- K],"Filter Keyword Merge Block"))Ì.Add(new ā{Ā=Vector3D.Distance(ƿ,ƾ[K].GetPosition()),I=ƾ[K]});}Ì=Ì.OrderBy(Ã=>Ã.Ā).
- ToList();if(!ò())yield return true;ň.Add((IMyShipMergeBlock)Ì[0].I);}}if(ļ["Detach Connectors"]){List<IMyTerminalBlock>ij=new
- List<IMyTerminalBlock>();GridTerminalSystem.GetBlocksOfType<IMyShipConnector>(ij,C=>!ǁ||C.CubeGrid==Me.CubeGrid);if(ij.Count>0
- ){List<ā>Ì=new List<ā>();for(int K=0;K<ij.Count;K++){if(!ò())yield return true;if(Ġ(ij[K],"Filter Keyword Connector"))Ì.Add
- (new ā{Ā=Vector3D.Distance(ƿ,ij[K].GetPosition()),I=ij[K]});}Ì=Ì.OrderBy(Ã=>Ã.Ā).ToList();if(!ò())yield return true;Ŋ.Add((
- IMyShipConnector)Ì[0].I);}}List<IMyTimerBlock>Ë=new List<IMyTimerBlock>();GridTerminalSystem.GetBlocksOfType<IMyTimerBlock>(Ë,C=>!ǁ||C.
- CubeGrid==Me.CubeGrid);for(int K=0;K<Ë.Count;K++){if(!ò())yield return true;if(Ġ(Ë[K],"Filter Keyword Timer")&&Ë[K].CustomData.
- Length==0)Ë[K].CustomData=Ǝ.ToString();}}else{bool Ê=true;string É=ľ["Missile Primary Group Name"].ToLower(),È=ľ[
- "Missile Secondary Group Name"].ToLower();List<IMyTerminalBlock>Ç=new List<IMyTerminalBlock>(),Æ=new List<IMyTerminalBlock>(),Å=new List<
- IMyTerminalBlock>();List<IMyBlockGroup>Ä=new List<IMyBlockGroup>();GridTerminalSystem.GetBlockGroups(Ä,C=>C.Name.ToLower()==É);for(int K
- =0;K<Ä.Count;K++){if(!ò())yield return true;Å.Clear();Ä[K].GetBlocks(Å);for(int Ã=0;Ã<Å.Count;Ã++){if(!ò())yield return
- true;if(!Ç.Contains(Å[Ã])){if(Ê&&!(Å[Ã]is IMyShipMergeBlock)&&!(Å[Ã]is IMyShipConnector))Ê=false;Ç.Add(Å[Ã]);}}}Ä.Clear();
- GridTerminalSystem.GetBlockGroups(Ä,C=>C.Name.ToLower()==È);for(int K=0;K<Ä.Count;K++){if(!ò())yield return true;Å.Clear();Ä[K].GetBlocks(
- Å);for(int Ã=0;Ã<Å.Count;Ã++){if(!ò())yield return true;if(!Æ.Contains(Å[Ã])){if(Ê&&!(Å[Ã]is IMyShipMergeBlock)&&!(Å[Ã]is
- IMyShipConnector))Ê=false;Æ.Add(Å[Ã]);}}}if(ǂ&&(Ç.Count==0||Æ.Count==0||Ê)){Å.Clear();GridTerminalSystem.GetBlocksOfType<
- IMyTerminalBlock>(Å,C=>!ǁ||C.CubeGrid==Me.CubeGrid);bool Â=Ç.Count==0,Á=Æ.Count==0;for(int K=0;K<Å.Count;K++){if(!ò())yield return true;
- if(ö(Å[K])){if(Á||!Æ.Contains(Å[K]))Æ.Add(Å[K]);}else{if(Â||!Ç.Contains(Å[K]))Ç.Add(Å[K]);}}}for(int K=0;K<Ç.Count;K++){if
- (!ò())yield return true;if(Ç[K]is IMyTimerBlock)ǀ.Add((IMyTimerBlock)Ç[K]);else J(Ç[K]);}for(int K=0;K<Æ.Count;K++){if(!ò
- ())yield return true;J(Æ[K],true);}if(ņ.Count>1){while(!á(ņ))yield return true;}if(Ņ.Count>1){while(!á(Ņ))yield return
- true;}IMyRemoteControl À;if(Ĩ(out À)){Matrix º,Í;À.Orientation.GetMatrix(out º);Vector3D d=ô(º.Backward),Ï=ô(º.Down);for(int
- K=0;K<Ɯ.Count;K++){if(!ò())yield return true;Ɯ[K].Orientation.GetMatrix(out Í);if(Vector3D.Distance(d,ô(Í.Forward))<=ƈ)ů.
- Add(Ɯ[K]);else if(Vector3D.Distance(Ï,ô(Í.Forward))<=ƈ)Ŏ.Add(Ɯ[K]);}for(int K=0;K<Ş.Count;K++){if(!ò())yield return true;Ş[
- K].Orientation.GetMatrix(out Í);if(Vector3D.Distance(d,ô(Í.Forward))<=ƈ)ŏ.Add(Ş[K]);else if(Vector3D.Distance(Ï,ô(Í.
- Forward))<=ƈ)ō.Add(Ş[K]);}}else{N("No remote controller found");Ƣ=true;ơ=Ơ;}}if(!ò())yield return true;Ƙ=ʼn.Count>0||ō.Count>0||
- ŏ.Count>0||ŋ.Count>0||Ň.Count>0||Ņ.Count>0||Ş.Count>0;string[]ä;for(int K=0;K<ǀ.Count;K++){if(!ò())yield return true;if(ǀ
- [K].CustomData.Length>0){ċ ã=new ċ();ã.Ċ=ǀ[K];ä=ǀ[K].CustomData.Split(new[]{"\r\n","\r","\n"},StringSplitOptions.
- RemoveEmptyEntries);for(int Ã=0;Ã<ä.Length;Ã++){if(!ò())yield return true;if(!ä[Ã].StartsWith("//")){Ć â=new Ć();if(ä[Ã].ToLower()==
- "repeatable=true")ã.Ĉ=true;else{try{if(æ(ä[Ã],out â.å,out â.ü,out â.ą))ã.ĉ.Add(â);}catch{}}}}if(ã.ĉ.Count>0)Ŀ.Add(ã);}}yield return false
- ;}bool á(List<IMyRemoteControl>ß){if(Ƅ==null)Ƅ=à(ß);return Ǥ(ref Ƅ);}IEnumerator<bool>à(List<IMyRemoteControl>ß){List<ā>Ì
- =new List<ā>();Vector3D Þ=Me.GetPosition();for(int K=0;K<ß.Count;K++){if(!ò())yield return true;Ì.Add(new ā{Ā=Vector3D.
- Distance(Þ,ß[K].GetPosition()),I=(IMyTerminalBlock)ß[K]});}Ì=Ì.OrderBy(Ã=>Ã.Ā).ToList();ß.Clear();for(int K=0;K<Ì.Count;K++){if(
- !ò())yield return true;ß.Add((IMyRemoteControl)Ì[K].I);}yield return false;}void Ü(){ſ.MoveNext();}IEnumerator<bool>Û(){
- IMyRemoteControl U;List<IMyGyro>Ú;while(true){ƚ=true;var Ù=new Vector3D(-Ū.X,Ū.Y,Ū.Z);if(Ĩ(out U)){Ú=Ī();var Ø=U.WorldMatrix;var Ö=
- Vector3D.TransformNormal(Ù,Ø);foreach(IMyGyro Õ in Ú){if(!ò())yield return true;try{var Ô=Õ.WorldMatrix;var Ó=Vector3D.
- TransformNormal(Ö,Matrix.Transpose(Ô));Õ.Pitch=(float)Ó.X;Õ.Yaw=(float)Ó.Y;Õ.Roll=(float)Ó.Z;Õ.GyroOverride=Ó!=Vector3D.Zero;}catch{}}}
- ƚ=false;yield return true;}}void Ò(){if(ž==null)ž=Ñ();Ǥ(ref ž);}IEnumerator<bool>Ñ(){for(int K=0;K<ł.Count;K++){if(!ò())
- yield return true;ł[K].Enabled=true;ł[K].EnableRaycast=true;}yield return false;}void Ð<Ý>(List<Ý>µ)where Ý:class{for(int K=0
- ;K<µ.Count;K++){Echo(((IMyTerminalBlock)µ[K]).CustomName);}}void Y(){IMyRemoteControl U;if(Ĩ(out U))ū=U.GetPosition();
- else ū=Me.GetPosition();if(Ơ)ų=Vector3D.Distance(ū,Ŭ);}void X(){IMyRemoteControl U;if(Ĩ(out U)){ƍ=U.GetShipSpeed();Ũ=
- Vector3D.TransformNormal(U.GetShipVelocities().LinearVelocity,MatrixD.Transpose(U.WorldMatrix));ŷ=ƍ*Vector3D.Normalize(Ũ).Z*-1.0
- ;Ų=ƍ-Math.Abs(ŷ);}if(double.IsNaN(ŷ)){ƍ=0;ŷ=0;Ų=0;}}void W(){ł.Clear();Ł.Clear();ń.Clear();Ń.Clear();Ŀ.Clear();ŀ.Clear();
- Ɯ.Clear();ů.Clear();Ŏ.Clear();Ō.Clear();Ŋ.Clear();ň.Clear();ņ.Clear();Ş.Clear();ŏ.Clear();ō.Clear();ŋ.Clear();ʼn.Clear();Ň
- .Clear();Ņ.Clear();}void V(){if(Ĺ.TotalSeconds<=0.0){Ĺ=TimeSpan.FromSeconds(3);IMyRemoteControl U;if(Ĩ(out U)){Vector3D S
- ;if(U.TryGetPlanetPosition(out S)){ƞ=true;string R=S.ToString("N0");double Q;if(!Ů.ContainsKey(R))Ů[R]=new ÿ{g=S,ý=Ľ[
- "Travel Elevation"]};if(U.TryGetPlanetElevation(MyPlanetElevation.Sealevel,out Q)){ź=Q;Ů[R].Î=Math.Max(ź,Ů[R].Î);Ů[R].þ=Vector3D.Distance(
- ū,S)-Q;Ɨ=Vector3D.Distance(Ŭ,Ů[R].g)<=Ů[R].þ*1.7182;}if(U.TryGetPlanetElevation(MyPlanetElevation.Surface,out Q))Ż=Q;Ÿ=U.
- GetNaturalGravity().Length();if(Ķ.TotalSeconds<=0){ű=U.CalculateShipMass().PhysicalMass;Ķ=TimeSpan.FromSeconds(15);}}else{ÿ P;if(ƞ&&ğ(out
- 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
- IMyBatteryBlock)((IMyBatteryBlock)I).ChargeMode=ChargeMode.Auto;}void N(string M){if(M.Length>0){if(ĺ.Add(M))Ļ.Insert(0,new Ą{ă=M,Ă=
- TimeSpan.FromSeconds(Ľ["Echo Life In Seconds"])});while(Ļ.Count>60){ĺ.Remove(Ļ[60].ă);Ļ.RemoveAt(60);}}}void L(){for(int K=0;K<Ļ
- .Count;K+=0){Ļ[K].Ă-=Runtime.TimeSinceLastRun;if(Ļ[K].Ă.TotalSeconds<=0.0){ĺ.Remove(Ļ[K].ă);Ļ.RemoveAt(K);}else K++;}}
- void J(IMyTerminalBlock I,bool H=false){if(I is IMyCameraBlock){if(Ġ(I,"Filter Keyword Camera"))ł.Add((IMyCameraBlock)I);}
- else if(I is IMyWarhead){if(Ġ(I,"Filter Keyword Warhead"))Ł.Add((IMyWarhead)I);}else if(I is IMyPowerProducer){if(Ġ(I,
- "Filter Keyword Power"))ń.Add((IMyPowerProducer)I);}else if(I is IMyGasTank){if(I.BlockDefinition.SubtypeName.ToLower().Contains("hydrogen")&&
- Ġ(I,"Filter Keyword Hydrogen"))Ń.Add((IMyGasTank)I);}else if(I is IMyGasGenerator){if(Ġ(I,"Filter Keyword H2/O2 Gens"))ŀ.
- Add((IMyGasGenerator)I);}else if(!H){if(I is IMyThrust){if(Ġ(I,"Filter Keyword Thrust"))Ɯ.Add((IMyThrust)I);}else if(I is
- IMyGyro){if(Ġ(I,"Filter Keyword Gyroscope"))Ō.Add((IMyGyro)I);}else if(I is IMyShipConnector){if(ļ["Detach Connectors"]&&Ġ(I,
- "Filter Keyword Connector"))Ŋ.Add((IMyShipConnector)I);}else if(I is IMyShipMergeBlock){if(ļ["Detach Merge Blocks"]&&Ġ(I,
- "Filter Keyword Merge Block"))ň.Add((IMyShipMergeBlock)I);}else if(I is IMyRemoteControl){if(Ġ(I,"Filter Keyword Remote Control")){ņ.Add((
- IMyRemoteControl)I);((IMyRemoteControl)I).DampenersOverride=true;}}}else{if(I is IMyThrust){if(Ġ(I,"Filter Keyword Thrust"))Ş.Add((
- IMyThrust)I);}else if(I is IMyGyro){if(Ġ(I,"Filter Keyword Gyroscope"))ŋ.Add((IMyGyro)I);}else if(I is IMyShipConnector){if(ļ[
- "Detach Connectors"]&&Ġ(I,"Filter Keyword Connector"))ʼn.Add((IMyShipConnector)I);}else if(I is IMyShipMergeBlock){if(ļ[
- "Detach Merge Blocks"]&&Ġ(I,"Filter Keyword Merge Block"))Ň.Add((IMyShipMergeBlock)I);}else if(I is IMyRemoteControl){if(Ġ(I,
- "Filter Keyword Remote Control")){Ņ.Add((IMyRemoteControl)I);((IMyRemoteControl)I).DampenersOverride=true;}}}}void G(double F=-1){if(ł.Count>0){
- IMyCameraBlock E;if(F==-1){E=é();N($"Attempting raycast with: {E.CustomName}");MyDetectedEntityInfo D=E.Raycast(E.AvailableScanRange);
- if(!D.IsEmpty()){if(u(D)){ŧ=D;Ŭ=ŧ.Position;w();ƙ=true;Ɠ=true;Ĵ=TimeSpan.FromSeconds(0);Œ=TimeSpan.FromSeconds((Vector3D.
- Distance(ŧ.Position,ū)/2000.0)/(double)ł.Count);}else Ŧ=D;}}else{E=ê(F,Vector3D.Zero);N(
- $"Attempting raycast with: {E.CustomName}");MyDetectedEntityInfo D=E.Raycast(F);if(!D.IsEmpty()){if(u(D)){ŧ=D;Ŭ=ŧ.Position;w();ƙ=true;Ɠ=true;Ĵ=TimeSpan.
- FromSeconds(0);Œ=TimeSpan.FromSeconds((Vector3D.Distance(ŧ.Position,ū)/2000.0)/(double)ł.Count);}else Ŧ=D;}}}else{
- GridTerminalSystem.GetBlocksOfType<IMyCameraBlock>(ł,C=>C.CubeGrid==Me.CubeGrid);N($"No cameras loaded, found {ł.Count} cameras");Ò();}}
- void B(){Vector3D Z=ŧ.Position+(ô(ŧ.Velocity)*Ĵ.TotalSeconds),A;double F=Vector3D.Distance(ū,Z)*1.05;IMyCameraBlock E=ê(F,Z)
- ;if(E!=null){A=Vector3D.TransformNormal(Z-E.GetPosition(),Matrix.Transpose(E.WorldMatrix));MyDetectedEntityInfo D=E.
- Raycast(F,A);if(!D.IsEmpty()){if(u(D)){ŧ=D;Ŭ=ŧ.Position;ų=Vector3D.Distance(ū,Ŭ);Ĵ=TimeSpan.FromSeconds(0);Œ=TimeSpan.
- FromSeconds((Vector3D.Distance(ŧ.Position,ū)/2000.0)/(double)ł.Count);}else Ŧ=D;}}}void w(){Ơ=true;double v=Ľ[
- "Randomized Offset Distance"];if(v!=0.0){Ŭ+=č(v);}ų=Vector3D.Distance(Ŭ,Me.GetPosition());Ŵ=Vector3D.Distance(Ŭ,Me.GetPosition());ĸ=new TimeSpan(0);
- ũ=Me.GetPosition();ƙ=false;}bool u(MyDetectedEntityInfo D){return D.Relationship!=MyRelationsBetweenPlayerAndBlock.
- Friends&&D.Relationship!=MyRelationsBetweenPlayerAndBlock.Owner&&(D.Type==MyDetectedEntityType.LargeGrid||D.Type==
- MyDetectedEntityType.SmallGrid);}double t(){bool s=Me.CubeGrid.GridSizeEnum==MyCubeSize.Large;if(Ł.Count>0)s=Ł[0].CubeGrid.GridSizeEnum==
- MyCubeSize.Large;if(s)return Ľ["Warhead Radius Large"];return Ľ["Warhead Radius Small"];}double r(Vector3D g,IMyTerminalBlock f){
- 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=
- 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=
- 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
- k(){if(ť==ţ.ŭ||ť==ţ.Š||ť==ţ.š||ť==ţ.Ŝ)return 1f-(float)(Ʃ/15.0);if(ť==ţ.ş||ť==ţ.ŝ){ÿ P;if(ƞ&&ğ(out P)){Vector3D j=Ē(P.g,Ŭ
- ,Vector3D.Distance(ū,P.g));double F=Vector3D.Distance(j,ū);return Math.Max(0.05f,Math.Min(1f,(float)(F/Ľ[
- "Waypoint Distance"])));}}return 0f;}Vector3D h(Vector3D g,IMyTerminalBlock f){MatrixD e=f.WorldMatrix;Vector3D c=f.GetPosition(),d=e.
- 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.
- Distance(Ğ,g),o=Vector3D.Distance(ª,g),ě=Vector3D.Distance(Ğ,c),n=Vector3D.Distance(ª,c);double Ě=Math.Acos((Ĝ*Ĝ-ě*ě-q*q)/(-2.0*
- ě*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(ę>
- 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*Ŷ,
- Math.PI,ŵ);return new Vector3D(ę,l,0);}double Ę(double ą,double ė,double ĝ){double ñ=1;if(ą<0)ñ=-1;return Math.Min(Math.Abs(
- ą),ė*ĝ)*ñ;}Vector3D ĕ(){Vector3D d,j,Ĕ;double ē=Ľ["Waypoint Distance"];if(ų<=ē)return Ŭ;ÿ P;d=(Vector3D.Normalize(Ŭ-ū)*Ľ[
- "Waypoint Distance"])+ū;if(ƞ&&ğ(out P)){j=Ē(P.g,d,P.þ+P.ý);if(Ɨ){Ĕ=Ē(P.g,Ŭ,Vector3D.Distance(ū,P.g));Ŵ=Vector3D.Distance(Ĕ,ū);ƌ=(ƍ/(Ƭ/ű))*(
- ƍ/2.0);Ű=(Ų/(Ƭ/ű))*(Ų/2.0);IMyRemoteControl U;if(Ĩ(out U)){if(Ŵ<=ƌ&&Ŵ<Ű&&Ż>=Ŵ){ť=ţ.ş;return Ē(P.g,Ŭ,Vector3D.Distance(Ŭ,P
- .g)+(ų*0.05));}}if(Ŵ<=ē){ť=ţ.ş;return Ē(P.g,Ŭ,Vector3D.Distance(ū,P.g)-Math.Min(ų*0.05,(ē-Ŵ)));}if(Ŵ>ē*2.0&&ź<=Math.Min(P
- .ý*0.5,1500)){ť=ţ.Ŝ;return Ē(P.g,ū,P.þ+P.ý);}ť=ţ.ŭ;return j;}else{ť=ţ.ŭ;if(Vector3D.Distance(d,P.g)>Vector3D.Distance(j,P
- .g)){return d;}return j;}}ť=ţ.Š;return d;}Vector3D Ē(Vector3D đ,Vector3D g,double F){return(Vector3D.Normalize(g-đ)*F)+đ;
- }bool Đ(){if(ƙ)return true;ÿ P;if(ƞ&&ğ(out P)){Vector3D Ė=Vector3D.Normalize(Ŭ-ū)*50.0;return Vector3D.Distance(ū+Ė,P.g)>
- 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;
- İ=Vector3D.Distance(Ů.Values[K].g,ū);}else{į=Vector3D.Distance(Ů.Values[K].g,ū);if(į<İ){İ=į;IJ=K;}}}if(IJ>=0&&Ů.Count>IJ){ħ=
- Ů.Values[IJ];return true;}return false;}bool Į(bool ĭ=false){if(ĭ)return ŷ<=ƪ*1.05;return ŷ<ƪ*Ľ["Forward Speed Tolerance"]
- ;}bool Ĭ(out string å,out string ø,string ú){å="";ø="";if(!ú.StartsWith("=")&&ú.Contains("=")){try{int è=ú.IndexOf("=");å
- =ú.Substring(0,è);ø=ú.Substring(è+1);return true;}catch{}}return false;}List<IMyThrust>ī(){if(Ɵ||Ş.Count==0)return Ɯ;
- return Ş;}List<IMyGyro>Ī(){if(Ɵ||ŋ.Count==0)return Ō;return ŋ;}List<IMyThrust>ĩ(){if(Ɵ||ō.Count==0)return Ŏ;return ō;}List<
- IMyThrust>ı(){if(Ɵ||ŏ.Count==0)return ů;return ŏ;}bool Ĩ(out IMyRemoteControl U){U=null;if(Ɵ){if(ņ.Count>0){for(int K=0;K<ņ.Count
- ;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
- if(Ņ.Count>0){for(int K=0;K<Ņ.Count;K++)if(Ħ(Ņ[K])){U=Ņ[K];return true;}}if(Ơ&&!Ƣ)N("Failed to find Remote Control");
- return false;}bool Ħ(IMyTerminalBlock I){try{return I.CubeGrid.CubeExists(I.Position);}catch{}return false;}bool ĥ(string Ĥ,
- out Vector3D ó){ó=new Vector3D(0,0,0);try{string[]ģ=Ĥ.Split(':');if(ģ.Length>=5){double Ã,Ģ,ġ;if(double.TryParse(ģ[2],out Ã
- )&&double.TryParse(ģ[3],out Ģ)&&double.TryParse(ģ[4],out ġ)){ó=new Vector3D(Ã,Ģ,ġ);return true;}}}catch{}return false;}
- bool Ġ(IMyTerminalBlock I,string û){string ć=ľ[û].ToLower(),ù=I.CustomName.ToLower(),ø=I.CustomData.ToLower();return(ć.
- Length==0||ø.Contains(ć)||ù.Contains(ć))&&(Ə.Length==0||ø.Contains(Ə)||ù.Contains(Ə));}bool ö(IMyTerminalBlock I){string õ=ľ[
- "Missile Secondary Block Keyword"].ToLower();return I.CustomName.ToLower().Contains(õ)||(I.CustomData.Length>0&&I.CustomData.ToLower().Contains(õ));}
- Vector3D ô(Vector3 ó){return new Vector3D(ó.X,ó.Y,ó.Z);}bool ò(double ñ=0.9){return(Runtime.CurrentInstructionCount<(Runtime.
- MaxInstructionCount*Ɗ*ñ)&&(DateTime.Now-ƣ).TotalMilliseconds<Ɖ*ñ);}bool ð(){ƣ=DateTime.Now;ż=ï();Ž.Add(Runtime.LastRunTimeMs);if(Ž.Count>Ƈ)
- Ž.RemoveRange(0,Ž.Count-Ƈ);return ż<=Ƌ;}double ï(){if(Ž.Count==0)return 0;double î=0;for(int K=0;K<Ž.Count;K++)î+=Ž[K];
- return î/(double)Ž.Count;}bool í(Ć ì){double ë=0;switch(ì.å.ToLower()){case"launch time":ë=ĸ.TotalSeconds;break;case"altitude"
- :ë=Ż;break;case"elevation":ë=ź;break;case"gravity":ë=Ÿ;break;case"forward speed":ë=ŷ;break;case"lateral speed":ë=Ų;break;
- case"total speed":ë=ƍ;break;case"distance from axis":ë=Ŵ;break;case"distance from target":ë=ų;break;case"primary active":if(
- Ɵ)ë=1;else ë=0;break;case"secondary active":if(!Ɵ)ë=1;else ë=0;break;}switch(ì.ü){case"=":return ë==ì.ą;case">=":return ë
- >=ì.ą;case"<=":return ë<=ì.ą;}return false;}IMyCameraBlock ê(double F,Vector3D g){if(ł.Count>0){int è=-1;double ç=-1;for(
- int K=0;K<ł.Count;K++){if(ł[K].AvailableScanRange>=F&&(g==Vector3D.Zero||ł[K].CanScan(g))){if(è==-1){è=K;ç=ł[K].
- AvailableScanRange;}else if(ł[K].AvailableScanRange<ç){è=K;ç=ł[K].AvailableScanRange;}}}if(è>=0)return ł[è];}return null;}IMyCameraBlock é
- (){if(ł.Count>0){int è=0;double ç=ł[0].AvailableScanRange;for(int K=1;K<ł.Count;K++){if(ł[K].AvailableScanRange>ç){è=K;ç=
- ł[K].AvailableScanRange;}}return ł[è];}return null;}bool æ(string ú,out string å,out string ü,out double ą){int è;string
- ø;å="";ü="";ą=0;if(ú.Contains(">="))ü=">=";else if(ú.Contains("<="))ü="<=";else if(ú.Contains("="))ü="=";else return
- false;è=ú.IndexOf(ü);å=ú.Substring(0,è).Trim();ø=ú.Substring(è+ü.Length).Trim();if(ø.ToLower()=="true")ą=1;else if(ø.ToLower(
- )=="false")ą=0;else if(double.TryParse(ø,out ą))return true;return false;}bool Ď(string ø){Vector3D S;if(ĥ(ø,out S)){N(
- $"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
- );if(Č.Next(1,100)<50)ñ=-1;ó.X=Č.NextDouble()*F*ñ;if(Č.Next(1,100)<50)ñ=-1;ó.Y=Č.NextDouble()*F*ñ;if(Č.Next(1,100)<50)ñ=-
- 1;ó.Z=Č.NextDouble()*F*ñ;return ó;}class ċ{public IMyTimerBlock Ċ;public List<Ć>ĉ=new List<Ć>();public bool ď=false,Ĉ=
- false;}class Ć{public string å="",ü="";public double ą=double.MaxValue;}class Ą{public string ă="";public TimeSpan Ă=new
- TimeSpan(0,0,0);}class ā{public double Ā;public IMyTerminalBlock I;}class ÿ{public Vector3D g=new Vector3D(0,0,0);public double
- þ=0,Î=0,ý=0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement