Advertisement
krzxsiek

Program LCDs 2

Oct 5th, 2019
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 99.94 KB | None | 0 0
  1. /* v:2.0174 [1.191 compatibility, new Inventory variants]
  2. * Automatic LCDs 2 - In-game script by MMaster
  3. *
  4. * Last Update: Fixed multiline command marker \ at the end of line not working
  5. *  Slower command updates in SlowMode
  6. *  Added NB (no bars), NN (no numbers) & NNB (no bars or numbers) variants of Inventory, InvList, Missing and all their variants (check guide)
  7. *  Cockpit (and other blocks) panels support - read guide section 'How to use with cockpits?'
  8. *  Script now correctly uses the Text Padding property of the LCD (you can set it however you want and the script will work with it)
  9. *  Optimizations for servers running script limiter - use SlowMode!
  10. *  Added SlowMode setting to considerably slow down the script (4-5 times less processing per second)
  11. *  Now using MDK!
  12. *  First part of rewrite of memory management which should optimize memory allocations a lot (more optimizations in progress)
  13. *
  14. * Previous updates: Look at Change notes tab on Steam workshop page. */
  15.  
  16. /* Customize these: */
  17.  
  18. // Use this tag to identify LCDs managed by this script
  19. // Name filtering rules can be used here so you can use even G:Group or T:[My LCD]
  20. public string LCD_TAG = "T:[LCD]";
  21.  
  22. // Set to true if you want to slow down the script
  23. public const bool SlowMode = false;
  24.  
  25. // How many lines to scroll per step
  26. public const int SCROLL_LINES_PER_STEP = 1;
  27.  
  28. // Script automatically figures if LCD is using monospace font
  29. // if you use custom font scroll down to the bottom, then scroll a bit up until you find AddCharsSize lines
  30. // monospace font name and size definition is above those
  31.  
  32. // Enable initial boot sequence (after compile / world load)
  33. public const bool ENABLE_BOOT = true;
  34.  
  35. /* READ THIS FULL GUIDE
  36. http://steamcommunity.com/sharedfiles/filedetails/?id=407158161
  37.  
  38. Basic video guide
  39. Please watch the video guide even if you don't understand my English. You can see how things are done there.
  40.  
  41. https://youtu.be/vqpPQ_20Xso
  42.  
  43.  
  44. Please carefully read the FULL GUIDE before asking questions I had to remove guide from here to add more features :(
  45. Please DO NOT publish this script or its derivations without my permission! Feel free to use it in blueprints!
  46.  
  47. Special Thanks
  48. Keen Software House for awesome Space Engineers game
  49. Malware for contributing to programmable blocks game code and MDK!
  50.  
  51. Watch Twitter: https://twitter.com/MattsPlayCorner
  52. and Facebook: https://www.facebook.com/MattsPlayCorner1080p
  53. for more crazy stuff from me in the future :)
  54.  
  55. If you want to make scripts for Space Engineers check out MDK by Malware:
  56. https://github.com/malware-dev/MDK-SE/wiki/Quick-Introduction-to-Space-Engineers-Ingame-Scripts
  57. */
  58. bool MDK_IS_GREAT = true;
  59. /* Customize characters used by script */
  60. class MMStyle {
  61.     // Monospace font characters (\uXXXX is special character code)
  62.     public const char BAR_MONO_START = '[';
  63.     public const char BAR_MONO_END = ']';
  64.     public const char BAR_MONO_EMPTY = '\u2591'; // 25% rect
  65.     public const char BAR_MONO_FILL = '\u2588'; // full rect
  66.  
  67.     // Classic (Debug) font characters
  68.     // Start and end characters of progress bar need to be the same width!
  69.     public const char BAR_START = '[';
  70.     public const char BAR_END = ']';
  71.     // Empty and fill characters of progress bar need to be the same width!
  72.     public const char BAR_EMPTY = '\'';
  73.     public const char BAR_FILL = '|';
  74. }
  75. // (for developer) Debug level to show
  76. public const int DebugLevel = 0;
  77.  
  78. // (for modded lcds) Affects all LCDs managed by this programmable block
  79. /* LCD height modifier
  80. 0.5f makes the LCD have only 1/2 the lines of normal LCD
  81. 2.0f makes it fit 2x more lines on LCD */
  82. public const float HEIGHT_MOD = 1.0f;
  83.  
  84. /* line width modifier
  85. 0.5f moves the right edge to 50% of normal LCD width
  86. 2.0f makes it fit 200% more text on line */
  87. public const float WIDTH_MOD = 1.0f;
  88.  
  89. List<string> BOOT_FRAMES = new List<string>() {
  90. /* BOOT FRAMES
  91. * Each @"<text>" marks single frame, add as many as you want each will be displayed for one second
  92. * @"" is multiline string so you can write multiple lines */
  93. @"
  94. Initializing systems"
  95. ,
  96. @"
  97. Verifying connections"
  98. ,
  99. @"
  100. Loading commands"
  101. };
  102.  
  103. void ItemsConf() {
  104.     // ITEMS AND QUOTAS LIST
  105.     // (subType, mainType, quota, display name, short name)
  106.     // VANILLA ITEMS
  107.     Add("Stone", "Ore", 0, "Kamień");
  108.     Add("Iron", "Ore", 0, "Żelazo");
  109.     Add("Nickel", "Ore", 0, "Nikiel");
  110.     Add("Cobalt", "Ore", 0, "Kobalt");
  111.     Add("Magnesium", "Ore", 0, "Magnez");
  112.     Add("Silicon", "Ore", 0, "Krzem");
  113.     Add("Silver", "Ore", 0, "Srebro");
  114.     Add("Gold", "Ore", 0, "Złoto");
  115.     Add("Platinum", "Ore", 0, "Platyna");
  116.     Add("Uranium", "Ore", 0, "Uran");
  117.     Add("Ice", "Ore", 0, "Lód");
  118.     Add("Scrap", "Ore", 0, "Złom");
  119.     Add("Stone", "Ingot", 40000, "Żwir", "żwir");
  120.     Add("Iron", "Ingot", 300000, "Żelazo");
  121.     Add("Nickel", "Ingot", 900000, "Nikiel");
  122.     Add("Cobalt", "Ingot", 120000, "Kobalt");
  123.     Add("Magnesium", "Ingot", 80000, "Magnez");
  124.     Add("Silicon", "Ingot", 80000, "Krzem");
  125.     Add("Silver", "Ingot", 800000, "Srebro");
  126.     Add("Gold", "Ingot", 80000, "Złoto");
  127.     Add("Platinum", "Ingot", 45000, "Platyna");
  128.     Add("Uranium", "Ingot", 12000, "Uran");
  129.     Add("AutomaticRifleItem", "Tool", 0, "Automatic Rifle");
  130.     Add("PreciseAutomaticRifleItem", "Tool", 0, "* Precise Rifle");
  131.     Add("RapidFireAutomaticRifleItem", "Tool", 0, "** Rapid-Fire Rifle");
  132.     Add("UltimateAutomaticRifleItem", "Tool", 0, "*** Elite Rifle");
  133.     Add("WelderItem", "Tool", 0, "Welder");
  134.     Add("Welder2Item", "Tool", 0, "* Enh. Welder");
  135.     Add("Welder3Item", "Tool", 0, "** Prof. Welder");
  136.     Add("Welder4Item", "Tool", 0, "*** Elite Welder");
  137.     Add("AngleGrinderItem", "Tool", 0, "Angle Grinder");
  138.     Add("AngleGrinder2Item", "Tool", 0, "* Enh. Grinder");
  139.     Add("AngleGrinder3Item", "Tool", 0, "** Prof. Grinder");
  140.     Add("AngleGrinder4Item", "Tool", 0, "*** Elite Grinder");
  141.     Add("HandDrillItem", "Tool", 0, "Hand Drill");
  142.     Add("HandDrill2Item", "Tool", 0, "* Enh. Drill");
  143.     Add("HandDrill3Item", "Tool", 0, "** Prof. Drill");
  144.     Add("HandDrill4Item", "Tool", 0, "*** Elite Drill");
  145.     Add("Construction", "Component", 50000);
  146.     Add("MetalGrid", "Component", 15500, "Metal Grid");
  147.     Add("InteriorPlate", "Component", 55000, "Interior Plate");
  148.     Add("SteelPlate", "Component", 300000, "Steel Plate");
  149.     Add("Girder", "Component", 3500);
  150.     Add("SmallTube", "Component", 26000, "Small Tube");
  151.     Add("LargeTube", "Component", 6000, "Large Tube");
  152.     Add("Motor", "Component", 16000);
  153.     Add("Display", "Component", 500);
  154.     Add("BulletproofGlass", "Component", 12000, "Bulletp. Glass", "bpglass");
  155.     Add("Computer", "Component", 6500);
  156.     Add("Reactor", "Component", 10000);
  157.     Add("Thrust", "Component", 16000, "Thruster", "thruster");
  158.     Add("GravityGenerator", "Component", 250, "GravGen", "gravgen");
  159.     Add("Medical", "Component", 120);
  160.     Add("RadioCommunication", "Component", 250, "Radio-comm", "radio");
  161.     Add("Detector", "Component", 400);
  162.     Add("Explosives", "Component", 500);
  163.     Add("SolarCell", "Component", 2800, "Solar Cell");
  164.     Add("PowerCell", "Component", 2800, "Power Cell");
  165.     Add("Superconductor", "Component", 3000);
  166.     Add("Canvas", "Component", 300);
  167.     Add("NATO_5p56x45mm", "Ammo", 8000, "5.56x45mm", "5.56x45mm");
  168.     Add("NATO_25x184mm", "Ammo", 2500, "25x184mm", "25x184mm");
  169.     Add("Missile200mm", "Ammo", 1600, "200mm Missile", "200mmmissile");
  170.     Add("OxygenBottle", "OxygenContainerObject", 5, "Oxygen Bottle");
  171.     Add("HydrogenBottle", "GasContainerObject", 5, "Hydrogen Bottle");
  172.  
  173.     // MODDED ITEMS
  174.     // (subType, mainType, quota, display name, short name, used)
  175.     // * if used is true, item will be shown in inventory even for 0 items
  176.     // * if used is false, item will be used only for display name and short name
  177.     // AzimuthSupercharger
  178.     Add("AzimuthSupercharger", "Component", 1600, "Supercharger", "supercharger", false);
  179.     // OKI Ammo
  180.     Add("OKI23mmAmmo", "Ammo", 500, "23x180mm", "23x180mm", false);
  181.     Add("OKI50mmAmmo", "Ammo", 500, "50x450mm", "50x450mm", false);
  182.     Add("OKI122mmAmmo", "Ammo", 200, "122x640mm", "122x640mm", false);
  183.     Add("OKI230mmAmmo", "Ammo", 100, "230x920mm", "230x920mm", false);
  184.  
  185.     // REALLY REALLY REALLY
  186.     // DO NOT MODIFY ANYTHING BELOW THIS (TRANSLATION STRINGS ARE AT THE BOTTOM)
  187. }
  188. void Add(string sT, string mT, int q = 0, string dN = "", string sN = "", bool u = true) { Ə.ƃ(sT, mT, q, dN, sN, u); }
  189. Ƈ Ə;ȓ ƕ;Ģ ϓ;ɖ o=null;void ϒ(string ƚ){}void ϑ(string ϐ,string Ϗ){string Ƕ=ϐ.ToLower();switch(Ƕ){case"lcd_tag":LCD_TAG=Ϗ;
  190. break;}}void ϔ(){string[]lj=Me.CustomData.Split('\n');for(int F=0;F<lj.Length;F++){string ǎ=lj[F];int š=ǎ.IndexOf('=');if(š<0){ϒ
  191. (ǎ);continue;}string ώ=ǎ.Substring(0).Trim();string ǫ=ǎ.Substring(š+1).Trim();ϑ(ώ,ǫ);}}void ύ(ȓ ƕ){Ə=new Ƈ();ItemsConf(
  192. );ϔ();o=new ɖ(this,DebugLevel,ƕ);o.Ə=Ə;o.ɧ=LCD_TAG;o.ɦ=SCROLL_LINES_PER_STEP;o.ɥ=ENABLE_BOOT;o.ɤ=BOOT_FRAMES;o.ɣ=!
  193. MDK_IS_GREAT;o.ɢ=HEIGHT_MOD;o.ɬ=WIDTH_MOD;o.Ǡ();}void ό(){ƕ.ǂ=this;o.ǂ=this;}Program(){Runtime.UpdateFrequency=UpdateFrequency.
  194. Update1;}void Main(string ą,UpdateType ϊ){try{if(ƕ==null){ƕ=new ȓ(this,DebugLevel,SlowMode);ύ(ƕ);ϓ=new Ģ(o);ƕ.Ȉ(ϓ,0);}else{ό();
  195. o.ő.Ѕ();}if(ą.Length==0&&(ϊ&(UpdateType.Update1|UpdateType.Update10|UpdateType.Update100))==0){ƕ.ȩ();return;}if(ą!=""){if
  196. (ϓ.ă(ą)){ƕ.ȩ();return;}}ϓ.Ġ=0;ƕ.Ƞ();}catch(Exception ex){Echo("ERROR DESCRIPTION:\n"+ex.ToString());Me.Enabled=false;}}
  197. class ζ:ɓ{Ģ ē;ɖ o;string ą="";public ζ(ɖ Û,Ģ đ,string ij){Ɏ=-1;ɒ="ArgScroll";ą=ij;ē=đ;o=Û;}int Ŵ;β ε;public override void Ʌ(){ε
  198. =new β(Ɠ,o.ő);}int δ=0;int Y=0;ʤ ƚ;public override bool Ʉ(bool ë){if(!ë){Y=0;ε.Ŧ();ƚ=new ʤ(Ɠ);δ=0;}if(Y==0){if(!ƚ.ʻ(ą,ë))
  199. return false;if(ƚ.ˋ.Count>0){if(!int.TryParse(ƚ.ˋ[0].ij,out Ŵ))Ŵ=1;else if(Ŵ<1)Ŵ=1;}if(ƚ.ʸ.EndsWith("up"))Ŵ=-Ŵ;else if(!ƚ.ʸ.
  200. EndsWith("down"))Ŵ=0;Y++;ë=false;}if(Y==1){if(!ε.ϼ("textpanel".ʣ,ë))return false;Y++;ë=false;}è n;for(;δ<ε.ϲ();δ++){if(!Ɠ.Ȝ(20
  201. ))return false;IMyTextPanel γ=ε.ί[δ]as IMyTextPanel;if(!ē.Ĝ.TryGetValue(γ,out n))continue;if(n==null||n.å!=γ)continue;if(
  202. n.é)n.æ.Ļ=10;if(Ŵ>0)n.æ.ň(Ŵ);else if(Ŵ<0)n.æ.Ŭ(-Ŵ);else n.æ.ĺ();n.N();}return true;}}class β{ȓ Ɠ;ϵ α;IMyCubeGrid ΰ{get{
  203. return Ɠ.ǂ.Me.CubeGrid;}}IMyGridTerminalSystem ƿ{get{return Ɠ.ǂ.GridTerminalSystem;}}public List<IMyTerminalBlock>ί=new List<
  204. IMyTerminalBlock>();public β(ȓ ƕ,ϵ ή){Ɠ=ƕ;α=ή;}int η=0;public double ω(ref double χ,ref double φ,bool ë){if(!ë)η=0;for(;η<ί.Count;η++){
  205. if(!Ɠ.Ȝ(4))return Double.NaN;IMyInventory ρ=ί[η].GetInventory(0);if(ρ==null)continue;χ+=(double)ρ.CurrentVolume;φ+=(double
  206. )ρ.MaxVolume;}χ*=1000;φ*=1000;return(φ>0?χ/φ*100:100);}int υ=0;double τ=0;public double σ(bool ë){if(!ë){υ=0;τ=0;}for(;υ<
  207. ί.Count;υ++){if(!Ɠ.Ȝ(6))return Double.NaN;for(int ς=0;ς<2;ς++){IMyInventory ρ=ί[υ].GetInventory(ς);if(ρ==null)continue;τ
  208. +=(double)ρ.CurrentMass;}}return τ*1000;}int ψ=0;private bool π(bool ë=false){if(!ë)ψ=0;while(ψ<ί.Count){if(!Ɠ.Ȝ(4))return
  209. false;if(ί[ψ].CubeGrid!=ΰ){ί.RemoveAt(ψ);continue;}ψ++;}return true;}List<IMyBlockGroup>ο=new List<IMyBlockGroup>();List<
  210. IMyTerminalBlock>ξ=new List<IMyTerminalBlock>();int ν=0;public bool μ(string ʣ,bool ë){int λ=ʣ.IndexOf(':');string κ=(λ>=1&&λ<=2?ʣ.
  211. Substring(0):"");bool ι=κ.Contains("T");if(κ!="")ʣ=ʣ.Substring(λ+1);if(ʣ==""||ʣ=="*"){if(!ë){ξ.Clear();ƿ.GetBlocks(ξ);ί.AddList
  212. (ξ);}if(ι)if(!π(ë))return false;return true;}string ϋ=(κ.Contains("G")?ʣ.Trim():"");if(ϋ!=""){if(!ë){ο.Clear();ƿ.
  213. GetBlockGroups(ο);ν=0;}for(;ν<ο.Count;ν++){IMyBlockGroup ϕ=ο[ν];if(string.Compare(ϕ.Name,ϋ,true)==0){if(!ë){ξ.Clear();ϕ.GetBlocks(ξ);ί
  214. .AddList(ξ);}if(ι)if(!π(ë))return false;return true;}}return true;}if(!ë){ξ.Clear();ƿ.SearchBlocksOfName(ʣ,ξ);ί.AddList(ξ
  215. );}if(ι)if(!π(ë))return false;return true;}List<IMyBlockGroup>ϱ=new List<IMyBlockGroup>();List<IMyTerminalBlock>Ͻ=new
  216. List<IMyTerminalBlock>();int ϻ=0;int Ϻ=0;public bool Ϲ(string ʐ,string ϋ,bool ι,bool ë){if(!ë){ϱ.Clear();ƿ.GetBlockGroups(ϱ)
  217. ;ϻ=0;}for(;ϻ<ϱ.Count;ϻ++){IMyBlockGroup ϕ=ϱ[ϻ];if(string.Compare(ϕ.Name,ϋ,true)==0){if(!ë){Ϻ=0;Ͻ.Clear();ϕ.GetBlocks(Ͻ);}
  218. else ë=false;for(;Ϻ<Ͻ.Count;Ϻ++){if(!Ɠ.Ȝ(6))return false;if(ι&&Ͻ[Ϻ].CubeGrid!=ΰ)continue;if(α.Ѐ(Ͻ[Ϻ]))ί.Add(Ͻ[Ϻ]);}return
  219. true;}}return true;}List<IMyTerminalBlock>ϸ=new List<IMyTerminalBlock>();int Ϸ=0;public bool ϼ(string ʐ,string ʣ,bool ë){int
  220. λ=ʣ.IndexOf(':');string κ=(λ>=1&&λ<=2?ʣ.Substring(0):"");bool ι=κ.Contains("T");if(κ!="")ʣ=ʣ.Substring(λ+1);if(!ë){ϸ.
  221. Clear();Ϸ=0;}string ϋ=(κ.Contains("G")?ʣ.Trim():"");if(ϋ!=""){if(!Ϲ(ʐ,ϋ,ι,ë))return false;return true;}if(!ë)α.Ё(ref ϸ,ʐ);if(
  222. ʣ==""||ʣ=="*"){if(!ë)ί.AddList(ϸ);if(ι)if(!π(ë))return false;return true;}for(;Ϸ<ϸ.Count;Ϸ++){if(!Ɠ.Ȝ(4))return false;if(
  223. ι&&ϸ[Ϸ].CubeGrid!=ΰ)continue;if(ϸ[Ϸ].CustomName.Contains(ʣ))ί.Add(ϸ[Ϸ]);}return true;}public void ϴ(β ϳ){ί.AddList(ϳ.ί);}
  224. public void Ŧ(){ί.Clear();}public int ϲ(){return ί.Count;}}class ϵ{ȓ Ɠ;ɖ o;public MyGridProgram ǂ{get{return Ɠ.ǂ;}}public
  225. IMyGridTerminalSystem ƿ{get{return Ɠ.ǂ.GridTerminalSystem;}}public ϵ(ȓ ƕ,ɖ Û){Ɠ=ƕ;o=Û;}void Љ<ǡ>(List<IMyTerminalBlock>Ј,Func<
  226. IMyTerminalBlock,bool>Ї=null)where ǡ:class,IMyTerminalBlock{ƿ.GetBlocksOfType<ǡ>(Ј,Ї);}public Dictionary<string,Action<List<
  227. IMyTerminalBlock>,Func<IMyTerminalBlock,bool>>>І;public void Ѕ(){if(І!=null)return;І=new Dictionary<string,Action<List<IMyTerminalBlock>
  228. ,Func<IMyTerminalBlock,bool>>>(){{"CargoContainer"<IMyCargoContainer>},{"TextPanel"<IMyTextPanel>},{"Assembler"<
  229. IMyAssembler>},{"Refinery"<IMyRefinery>},{"Reactor"<IMyReactor>},{"SolarPanel"<IMySolarPanel>},{"BatteryBlock"<
  230. IMyBatteryBlock>},{"Beacon"<IMyBeacon>},{"RadioAntenna"<IMyRadioAntenna>},{"AirVent"<IMyAirVent>},{"ConveyorSorter"<
  231. IMyConveyorSorter>},{"OxygenTank"<IMyGasTank>},{"OxygenGenerator"<IMyGasGenerator>},{"OxygenFarm"<IMyOxygenFarm>},{"LaserAntenna"
  232. <IMyLaserAntenna>},{"Thrust"<IMyThrust>},{"Gyro"<IMyGyro>},{"SensorBlock"<IMySensorBlock>},{"ShipConnector"<
  233. IMyShipConnector>},{"ReflectorLight"<IMyReflectorLight>},{"InteriorLight"<IMyInteriorLight>},{"LandingGear"<IMyLandingGear>},{
  234. "ProgrammableBlock"<IMyProgrammableBlock>},{"TimerBlock"<IMyTimerBlock>},{"MotorStator"<IMyMotorStator>},{"PistonBase"<
  235. IMyPistonBase>},{"Projector"<IMyProjector>},{"ShipMergeBlock"<IMyShipMergeBlock>},{"SoundBlock"<IMySoundBlock>},{"Collector"<
  236. IMyCollector>},{"JumpDrive"<IMyJumpDrive>},{"Door"<IMyDoor>},{"GravityGeneratorSphere"<IMyGravityGeneratorSphere>},{
  237. "GravityGenerator"<IMyGravityGenerator>},{"ShipDrill"<IMyShipDrill>},{"ShipGrinder"<IMyShipGrinder>},{"ShipWelder"<IMyShipWelder>}
  238. ,{"Parachute"<IMyParachute>},{"LargeGatlingTurret"<IMyLargeGatlingTurret>},{"LargeInteriorTurret"<
  239. IMyLargeInteriorTurret>},{"LargeMissileTurret"<IMyLargeMissileTurret>},{"SmallGatlingGun"<IMySmallGatlingGun>},{
  240. "SmallMissileLauncherReload"<IMySmallMissileLauncherReload>},{"SmallMissileLauncher"<IMySmallMissileLauncher>},{"VirtualMass"<IMyVirtualMass>}
  241. ,{"Warhead"<IMyWarhead>},{"FunctionalBlock"<IMyFunctionalBlock>},{"LightingBlock"<IMyLightingBlock>},{
  242. "ControlPanel"<IMyControlPanel>},{"Cockpit"<IMyCockpit>},{"CryoChamber"<IMyCryoChamber>},{"MedicalRoom"<IMyMedicalRoom>},{
  243. "RemoteControl"<IMyRemoteControl>},{"ButtonPanel"<IMyButtonPanel>},{"CameraBlock"<IMyCameraBlock>},{"OreDetector"<
  244. IMyOreDetector>},{"ShipController"<IMyShipController>},{"Decoy"<IMyDecoy>}};}public void Њ(ref List<IMyTerminalBlock>Ā,string Є){
  245. Action<List<IMyTerminalBlock>,Func<IMyTerminalBlock,bool>>Ѓ;if(Є=="SurfaceProvider"){ƿ.GetBlocksOfType<IMyTextSurfaceProvider>
  246. (Ā);return;}if(І.TryGetValue(Є,out Ѓ))Ѓ(Ā,null);else{if(Є=="WindTurbine"){ƿ.GetBlocksOfType<IMyPowerProducer>(Ā,(Ђ)=>Ђ.
  247. BlockDefinition.TypeIdString.EndsWith("WindTurbine"));return;}if(Є=="HydrogenEngine"){ƿ.GetBlocksOfType<IMyPowerProducer>(Ā,(Ђ)=>Ђ.
  248. BlockDefinition.TypeIdString.EndsWith("HydrogenEngine"));return;}}}public void Ё(ref List<IMyTerminalBlock>Ā,string Ͽ){Њ(ref Ā,ϰ(Ͽ.Trim
  249. ()));}public bool Ѐ(IMyTerminalBlock å,string Ͽ){string Ͼ=ϰ(Ͽ);switch(Ͼ){case"FunctionalBlock":return true;case
  250. "ShipController":return(å as IMyShipController!=null);default:return å.BlockDefinition.TypeIdString.Contains(ϰ(Ͽ));}}public string ϰ(
  251. string Ϟ){if(Ϟ=="surfaceprovider")return"SurfaceProvider";if(Ϟ.ǭ("carg")||Ϟ.ǭ("conta"))return"CargoContainer";if(Ϟ.ǭ("text")||
  252. Ϟ.ǭ("lcd"))return"TextPanel";if(Ϟ.ǭ("ass"))return"Assembler";if(Ϟ.ǭ("refi"))return"Refinery";if(Ϟ.ǭ("reac"))return
  253. "Reactor";if(Ϟ.ǭ("solar"))return"SolarPanel";if(Ϟ.ǭ("wind"))return"WindTurbine";if(Ϟ.ǭ("hydro")&&Ϟ.Contains("eng"))return
  254. "HydrogenEngine";if(Ϟ.ǭ("bat"))return"BatteryBlock";if(Ϟ.ǭ("bea"))return"Beacon";if(Ϟ.Ǭ("vent"))return"AirVent";if(Ϟ.Ǭ("sorter"))return
  255. "ConveyorSorter";if(Ϟ.Ǭ("tank"))return"OxygenTank";if(Ϟ.Ǭ("farm")&&Ϟ.Ǭ("oxy"))return"OxygenFarm";if(Ϟ.Ǭ("gene")&&Ϟ.Ǭ("oxy"))return
  256. "OxygenGenerator";if(Ϟ.Ǭ("cryo"))return"CryoChamber";if(string.Compare(Ϟ,"laserantenna",true)==0)return"LaserAntenna";if(Ϟ.Ǭ("antenna"))
  257. return"RadioAntenna";if(Ϟ.ǭ("thrust"))return"Thrust";if(Ϟ.ǭ("gyro"))return"Gyro";if(Ϟ.ǭ("sensor"))return"SensorBlock";if(Ϟ.Ǭ(
  258. "connector"))return"ShipConnector";if(Ϟ.ǭ("reflector")||Ϟ.ǭ("spotlight"))return"ReflectorLight";if((Ϟ.ǭ("inter")&&Ϟ.Ǫ("light")))
  259. return"InteriorLight";if(Ϟ.ǭ("land"))return"LandingGear";if(Ϟ.ǭ("program"))return"ProgrammableBlock";if(Ϟ.ǭ("timer"))return
  260. "TimerBlock";if(Ϟ.ǭ("motor")||Ϟ.ǭ("rotor"))return"MotorStator";if(Ϟ.ǭ("piston"))return"PistonBase";if(Ϟ.ǭ("proj"))return"Projector";
  261. if(Ϟ.Ǭ("merge"))return"ShipMergeBlock";if(Ϟ.ǭ("sound"))return"SoundBlock";if(Ϟ.ǭ("col"))return"Collector";if(Ϟ.Ǭ("jump"))
  262. return"JumpDrive";if(string.Compare(Ϟ,"door",true)==0)return"Door";if((Ϟ.Ǭ("grav")&&Ϟ.Ǭ("sphe")))return
  263. "GravityGeneratorSphere";if(Ϟ.Ǭ("grav"))return"GravityGenerator";if(Ϟ.Ǫ("drill"))return"ShipDrill";if(Ϟ.Ǭ("grind"))return"ShipGrinder";if(Ϟ.Ǫ(
  264. "welder"))return"ShipWelder";if(Ϟ.ǭ("parach"))return"Parachute";if((Ϟ.Ǭ("turret")&&Ϟ.Ǭ("gatl")))return"LargeGatlingTurret";if((Ϟ
  265. .Ǭ("turret")&&Ϟ.Ǭ("inter")))return"LargeInteriorTurret";if((Ϟ.Ǭ("turret")&&Ϟ.Ǭ("miss")))return"LargeMissileTurret";if(Ϟ.Ǭ
  266. ("gatl"))return"SmallGatlingGun";if((Ϟ.Ǭ("launcher")&&Ϟ.Ǭ("reload")))return"SmallMissileLauncherReload";if((Ϟ.Ǭ(
  267. "launcher")))return"SmallMissileLauncher";if(Ϟ.Ǭ("mass"))return"VirtualMass";if(string.Compare(Ϟ,"warhead",true)==0)return
  268. "Warhead";if(Ϟ.ǭ("func"))return"FunctionalBlock";if(string.Compare(Ϟ,"shipctrl",true)==0)return"ShipController";if(Ϟ.ǭ("light"))
  269. return"LightingBlock";if(Ϟ.ǭ("contr"))return"ControlPanel";if(Ϟ.ǭ("coc"))return"Cockpit";if(Ϟ.ǭ("medi"))return"MedicalRoom";if
  270. (Ϟ.ǭ("remote"))return"RemoteControl";if(Ϟ.ǭ("but"))return"ButtonPanel";if(Ϟ.ǭ("cam"))return"CameraBlock";if(Ϟ.Ǭ("detect")
  271. )return"OreDetector";if(Ϟ.ǭ("decoy"))return"Decoy";return"Unknown";}public string Ϫ(IMyBatteryBlock ō){string ϝ="";if(ō.
  272. ChargeMode==ChargeMode.Recharge)ϝ="(+) ";else if(ō.ChargeMode==ChargeMode.Discharge)ϝ="(-) ";else ϝ="(±) ";return ϝ+o.Ǽ((ō.
  273. CurrentStoredPower/ō.MaxStoredPower)*100.0f)+"%";}Dictionary<MyLaserAntennaStatus,string>Ϝ=new Dictionary<MyLaserAntennaStatus,string>(){{
  274. MyLaserAntennaStatus.Idle,"IDLE"},{MyLaserAntennaStatus.Connecting,"CONNECTING"},{MyLaserAntennaStatus.Connected,"CONNECTED"},{
  275. MyLaserAntennaStatus.OutOfRange,"OUT OF RANGE"},{MyLaserAntennaStatus.RotatingToTarget,"ROTATING"},{MyLaserAntennaStatus.
  276. SearchingTargetForAntenna,"SEARCHING"}};public string ϛ(IMyLaserAntenna ŋ){return Ϝ[ŋ.Status];}public double Ϛ(IMyJumpDrive Ō,out double ˆ,out
  277. double Ŷ){ˆ=Ō.CurrentStoredPower;Ŷ=Ō.MaxStoredPower;return(Ŷ>0?ˆ/Ŷ*100:0);}public double ϙ(IMyJumpDrive Ō){double ˆ=Ō.
  278. CurrentStoredPower;double Ŷ=Ō.MaxStoredPower;return(Ŷ>0?ˆ/Ŷ*100:0);}}class Ϙ:ɓ{ɖ o;Ģ ē;public int ϗ=0;public Ϙ(ɖ Û,Ģ k){ɒ="BootPanelsTask"
  279. ;Ɏ=1;o=Û;ē=k;if(!o.ɥ){ϗ=int.MaxValue;ē.Ć=true;}}ǒ Ď;public override void Ʌ(){Ď=o.Ď;}public override bool Ʉ(bool ë){if(ϗ>o
  280. .ɤ.Count){Ɇ();return true;}if(!ë&&ϗ==0){ē.Ć=false;}if(!Ϯ(ë))return false;ϗ++;return true;}public override void Ƀ(){ē.Ć=
  281. true;}public void ϖ(){û ç=ē.ç;for(int F=0;F<ç.º();F++){è n=ç.ª(F);n.H();}ϗ=(o.ɥ?0:int.MaxValue);}int F;ŝ ϯ=null;public bool
  282. Ϯ(bool ë){û ç=ē.ç;if(!ë)F=0;int ϭ=0;for(;F<ç.º();F++){if(!Ɠ.Ȝ(40)||ϭ>5)return false;è n=ç.ª(F);ϯ=o.Ǐ(ϯ,n);float?Ϭ=n.ß?.
  283. FontSize;if(Ϭ!=null&&Ϭ>3f)continue;if(ϯ.ŗ.Count<=0)ϯ.Ť(o.Lj(null,n));else o.Lj(ϯ.ŗ[0],n);o.Ƭ();o.Ƣ(Ď.ǡ("B1"));double ʒ=(double)ϗ/o
  284. .ɤ.Count*100;o.Ư(ʒ);if(ϗ==o.ɤ.Count){o.Ǎ("");o.Ƣ("Automatic LCDs 2");o.Ƣ("by MMaster");}else o.nj(o.ɤ[ϗ]);bool é=n.é;n.é=
  285. false;o.Ǒ(n,ϯ);n.é=é;ϭ++;}return true;}public bool ϫ(){return ϗ<=o.ɤ.Count;}}public enum ϩ{Ϩ=0=1=2=3=4=5=6=7=
  286. 8=9=10=11=12=13=14=15=16=17=18=19=20=21=22=23=24=25=26=27=28=29=30=31,}
  287. class ʤ{ȓ Ɠ;public string ʸ="";public string ʣ="";public string ʺ="";public string ˏ="";public ϩ ˎ=ϩ.Ϩ;public ʤ(ȓ ƕ){Ɠ=ƕ;}ϩ ˍ
  288. (){if(ʸ=="echo"||ʸ=="center"||ʸ=="right")return ϩ.ϧ;if(ʸ.StartsWith("hscroll"))return ϩ.ʦ;if(ʸ.StartsWith("inventory")||ʸ
  289. .StartsWith("missing")||ʸ.StartsWith("invlist"))return ϩ.Ϧ;if(ʸ.StartsWith("working"))return ϩ.ʲ;if(ʸ.StartsWith("cargo")
  290. )return ϩ.ϥ;if(ʸ.StartsWith("mass"))return ϩ.Ϥ;if(ʸ.StartsWith("shipmass"))return ϩ.ʭ;if(ʸ=="oxygen")return ϩ.ϣ;if(ʸ.
  291. StartsWith("tanks"))return ϩ.Ϣ;if(ʸ.StartsWith("powertime"))return ϩ.ϡ;if(ʸ.StartsWith("powerused"))return ϩ.Ϡ;if(ʸ.StartsWith(
  292. "power"))return ϩ.ϟ;if(ʸ.StartsWith("speed"))return ϩ.έ;if(ʸ.StartsWith("accel"))return ϩ.ʹ;if(ʸ.StartsWith("alti"))return ϩ.ʫ;
  293. if(ʸ.StartsWith("charge"))return ϩ.Β;if(ʸ.StartsWith("docked"))return ϩ.ʥ;if(ʸ.StartsWith("time")||ʸ.StartsWith("date"))
  294. return ϩ.ʷ;if(ʸ.StartsWith("countdown"))return ϩ.ʶ;if(ʸ.StartsWith("textlcd"))return ϩ.ʵ;if(ʸ.EndsWith("count"))return ϩ.ʴ;if(
  295. ʸ.StartsWith("dampeners")||ʸ.StartsWith("occupied"))return ϩ.ʳ;if(ʸ.StartsWith("damage"))return ϩ.ʱ;if(ʸ.StartsWith(
  296. "amount"))return ϩ.ʰ;if(ʸ.StartsWith("pos"))return ϩ.ʯ;if(ʸ.StartsWith("distance"))return ϩ.ʬ;if(ʸ.StartsWith("details"))return
  297. ϩ.ʮ;if(ʸ.StartsWith("stop"))return ϩ.ʪ;if(ʸ.StartsWith("gravity"))return ϩ.ʩ;if(ʸ.StartsWith("customdata"))return ϩ.ʨ;if(
  298. ʸ.StartsWith("prop"))return ϩ.ʧ;return ϩ.Ϩ;}public ŵ ˌ(){switch(ˎ){case ϩ.ϧ:return new Ҕ();case ϩ.Ϧ:return new Ҡ();case ϩ
  299. .ϥ:return new ʙ();case ϩ.Ϥ:return new ҿ();case ϩ.ϣ:return new ҷ();case ϩ.Ϣ:return new щ();case ϩ.ϡ:return new Т();case ϩ.
  300. Ϡ:return new Р();case ϩ.ϟ:return new Ҥ();case ϩ.έ:return new я();case ϩ.ʹ:return new ʔ();case ϩ.Β:return new Ν();case ϩ.ʷ
  301. :return new ˮ();case ϩ.ʶ:return new Ω();case ϩ.ʵ:return new Ĺ();case ϩ.ʴ:return new ʏ();case ϩ.ʳ:return new ѩ();case ϩ.ʲ:
  302. return new ķ();case ϩ.ʱ:return new Ρ();case ϩ.ʰ:return new Ҽ();case ϩ.ʯ:return new Ҧ();case ϩ.ʮ:return new ˑ();case ϩ.ʭ:return
  303. new Ѩ();case ϩ.ʬ:return new Έ();case ϩ.ʫ:return new ʑ();case ϩ.ʪ:return new ь();case ϩ.ʩ:return new Ғ();case ϩ.ʨ:return new
  304. Τ();case ϩ.ʧ:return new ќ();case ϩ.ʦ:return new ґ();case ϩ.ʥ:return new Ҙ();default:return new ŵ();}}public List<ˀ>ˋ=new
  305. List<ˀ>();string[]ˊ=null;string ˉ="";bool ˈ=false;int ĵ=1;public bool ʻ(string ˇ,bool ë){if(!ë){ˎ=ϩ.Ϩ;ʣ="";ʸ="";ʺ=ˇ.
  306. TrimStart(' ');ˋ.Clear();if(ʺ=="")return true;int ˁ=ʺ.IndexOf(' ');if(ˁ<0||ˁ>=ʺ.Length-1)ˏ="";else ˏ=ʺ.Substring(ˁ+1);ˊ=ʺ.Split(
  307. ' ');ˉ="";ˈ=false;ʸ=ˊ[0].ToLower();ĵ=1;}for(;ĵ<ˊ.Length;ĵ++){if(!Ɠ.Ȝ(40))return false;string ij=ˊ[ĵ];if(ij=="")continue;if(ij[
  308. 0]=='{'&&ij[ij.Length-1]=='}'){ij=ij.Substring(1.Length-2);if(ij=="")continue;if(ʣ=="")ʣ=ij;else ˋ.Add(new ˀ(ij));continue;}if
  309. (ij[0]=='{'){ˈ=true;ˉ=ij.Substring(1);continue;}if(ij[ij.Length-1]=='}'){ˈ=false;ˉ+=' '+ij.Substring(0.Length-1);if(ʣ=="")ʣ=
  310. ˉ;else ˋ.Add(new ˀ(ˉ));continue;}if(ˈ){if(ˉ.Length!=0)ˉ+=' ';ˉ+=ij;continue;}if(ʣ=="")ʣ=ij;else ˋ.Add(new ˀ(ij));}ˎ=ˍ();
  311. return true;}}class ˀ{public string ʿ="";public string ʾ="";public string ij="";public List<string>ʽ=new List<string>();public
  312. ˀ(string ʼ){ij=ʼ;}public void ʻ(){if(ij==""||ʿ!=""||ʾ!=""||ʽ.Count>0)return;string ˆ=ij.Trim();if(ˆ[0]=='+'||ˆ[0]=='-'){ʿ+=ˆ
  313. [0];ˆ=ij.Substring(1);}string[]Ɵ=ˆ.Split('/');string ʛ=Ɵ[0];if(Ɵ.Length>1){ʾ=Ɵ[0];ʛ=Ɵ[1];}else ʾ="";if(ʛ.Length>0){string[
  314. ]Ą=ʛ.Split(',');for(int F=0;F<Ą.Length;F++)if(Ą[F]!="")ʽ.Add(Ą[F]);}}}class ʔ:ŵ{public ʔ(){Ɏ=0.5;ɒ="CmdAccel";}public
  315. override bool Ɨ(bool ë){double ʓ=0;if(ƚ.ʣ!="")double.TryParse(ƚ.ʣ.Trim(),out ʓ);o.ƃ(Ď.ǡ("AC1")+" ");o.ƴ(o.ǀ.ʀ.ToString("F1")+
  316. " m/s²");if(ʓ>0){double ʒ=o.ǀ.ʀ/ʓ*100;o.Ư(ʒ);}return true;}}class ʑ:ŵ{public ʑ(){Ɏ=1;ɒ="CmdAltitude";}public override bool Ɨ(
  317. bool ë){string ʐ=(ƚ.ʸ.EndsWith("sea")?"sea":"ground");switch(ʐ){case"sea":o.ƃ(Ď.ǡ("ALT1"));o.ƴ(o.ǀ.ɷ.ToString("F0")+" m");
  318. break;default:o.ƃ(Ď.ǡ("ALT2"));o.ƴ(o.ǀ.ɵ.ToString("F0")+" m");break;}return true;}}class ʏ:ŵ{public ʏ(){Ɏ=15;ɒ=
  319. "CmdBlockCount";}β Ķ;public override void Ʌ(){Ķ=new β(Ɠ,o.ő);}bool ʎ;bool ʍ;int ĵ=0;int Y=0;public override bool Ɨ(bool ë){if(!ë){ʎ=(ƚ.
  320. ʸ=="enabledcount");ʍ=(ƚ.ʸ=="prodcount");ĵ=0;Y=0;}if(ƚ.ˋ.Count==0){if(Y==0){if(!ë)Ķ.Ŧ();if(!Ķ.μ(ƚ.ʣ,ë))return false;Y++;ë=
  321. false;}if(!ʜ(Ķ,"blocks",ʎ,ʍ,ë))return false;return true;}for(;ĵ<ƚ.ˋ.Count;ĵ++){ˀ ij=ƚ.ˋ[ĵ];if(!ë)ij.ʻ();if(!Į(ij,ë))return false
  322. ;ë=false;}return true;}int ı=0;int IJ=0;bool Į(ˀ ij,bool ë){if(!ë){ı=0;IJ=0;}for(;ı<ij.ʽ.Count;ı++){if(IJ==0){if(!ë)Ķ.Ŧ();if(!
  323. Ķ.ϼ(ij.ʽ[ı].ʣ,ë))return false;IJ++;ë=false;}if(!ʜ(Ķ,ij.ʽ[ı],ʎ,ʍ,ë))return false;IJ=0;ë=false;}return true;}Dictionary<
  324. string,int>ʢ=new Dictionary<string,int>();Dictionary<string,int>ʡ=new Dictionary<string,int>();List<string>ʠ=new List<string>(
  325. );int ì=0;int ʟ=0;int ʞ=0;ʌ ʝ=new ʌ();bool ʜ(β Ā,string ʐ,bool ʎ,bool ʍ,bool ë){if(Ā.ϲ()==0){ʝ.Ŧ().ʆ(char.ToUpper(ʐ[0])).
  326. ʆ(ʐ.ToLower(),1.Length-1);o.ƃ(ʝ.ʆ(" ").ʆ(Ď.ǡ("C1")).ʆ(" "));string ʚ=(ʎ||ʍ?"0 / 0":"0");o.ƴ(ʚ);return true;}if(!ë){ʢ.
  327. Clear();ʡ.Clear();ʠ.Clear();ì=0;ʟ=0;ʞ=0;}if(ʞ==0){for(;ì<Ā.ϲ();ì++){if(!Ɠ.Ȝ(15))return false;IMyProductionBlock Ő=Ā.ί[ì]as
  328. IMyProductionBlock;ʝ.Ŧ().ʆ(Ā.ί[ì].DefinitionDisplayNameText);string Ƕ=ʝ.ɕ();if(ʠ.Contains(Ƕ)){ʢ[Ƕ]++;if((ʎ&&Ā.ί[ì].IsWorking)||(ʍ&&Ő!=null
  329. &&Ő.IsProducing))ʡ[Ƕ]++;}else{ʢ.Add(Ƕ,1);ʠ.Add(Ƕ);if(ʎ||ʍ)if((ʎ&&Ā.ί[ì].IsWorking)||(ʍ&&Ő!=null&&Ő.IsProducing))ʡ.Add(Ƕ,1)
  330. ;else ʡ.Add(Ƕ,0);}}ʞ++;ë=false;}for(;ʟ<ʢ.Count;ʟ++){if(!Ɠ.Ȝ(8))return false;o.ƃ(ʠ[ʟ]+" "+Ď.ǡ("C1")+" ");string ʚ=(ʎ||ʍ?ʡ[
  331. ʠ[ʟ]]+" / ":"")+ʢ[ʠ[ʟ]];o.ƴ(ʚ);}return true;}}class ʙ:ŵ{β Ķ;public ʙ(){Ɏ=2;ɒ="CmdCargo";}public override void Ʌ(){Ķ=new β
  332. (Ɠ,o.ő);}bool ʘ=true;bool ʗ=false;bool ʕ=false;bool ʖ=false;double ː=0;double Ο=0;int Y=0;public override bool Ɨ(bool ë){
  333. if(!ë){Ķ.Ŧ();ʘ=ƚ.ʸ.Contains("all");ʖ=ƚ.ʸ.EndsWith("bar");ʗ=(ƚ.ʸ[ƚ.ʸ.Length-1]=='x');ʕ=(ƚ.ʸ[ƚ.ʸ.Length-1]=='p');ː=0;Ο=0;Y=0
  334. ;}if(Y==0){if(ʘ){if(!Ķ.μ(ƚ.ʣ,ë))return false;}else{if(!Ķ.ϼ("cargocontainer".ʣ,ë))return false;}Y++;ë=false;}double Ξ=Ķ.
  335. ω(ref ː,ref Ο,ë);if(Double.IsNaN(Ξ))return false;if(ʖ){o.Ư(Ξ);return true;}o.ƃ(Ď.ǡ("C2")+" ");if(!ʗ&&!ʕ){o.ƴ(o.ȅ(ː)+
  336. "L / "+o.ȅ(Ο)+"L");o.Ƶ(Ξ,1.0f,o.ə);o.Ǎ(' '+o.Ǽ(Ξ)+"%");}else if(ʕ){o.ƴ(o.Ǽ(Ξ)+"%");o.Ư(Ξ);}else o.ƴ(o.Ǽ(Ξ)+"%");return true;}}
  337. class Ν:ŵ{public Ν(){Ɏ=3;ɒ="CmdCharge";}β Ķ;public override void Ʌ(){Ķ=new β(Ɠ,o.ő);}int Y=0;int ì=0;bool ʗ=false;bool Μ=
  338. false;bool ʖ=false;Dictionary<long,double>f=new Dictionary<long,double>();Dictionary<long,double>Κ=new Dictionary<long,double
  339. >();Dictionary<long,double>Ι=new Dictionary<long,double>();Dictionary<long,double>Θ=new Dictionary<long,double>();
  340. Dictionary<long,double>Η=new Dictionary<long,double>();double Ζ(long Ε,double ˆ,double Ŷ){double Δ=0;double Γ=0;double Λ=0;double
  341. Π=0;if(Κ.TryGetValue(Ε,out Λ)){Π=Θ[Ε];}if(f.TryGetValue(Ε,out Δ)){Γ=Ι[Ε];}double Χ=(Ɠ.ȏ-Λ);double ά=0;if(Χ>0)ά=(ˆ-Π)/Χ;if
  342. (ά<0){if(!Η.TryGetValue(Ε,out ά))ά=0;}else Η[Ε]=ά;if(Δ>0){Κ[Ε]=f[Ε];Θ[Ε]=Ι[Ε];}f[Ε]=Ɠ.ȏ;Ι[Ε]=ˆ;return(ά>0?(Ŷ-ˆ)/ά:0);}
  343. public override bool Ɨ(bool ë){if(!ë){Ķ.Ŧ();ʖ=ƚ.ʸ.EndsWith("bar");ʗ=ƚ.ʸ.Contains("x");Μ=ƚ.ʸ.Contains("time");ì=0;Y=0;}if(Y==0)
  344. {if(!Ķ.ϼ("jumpdrive".ʣ,ë))return false;if(Ķ.ϲ()<=0){o.Ǎ("Charge: "+Ď.ǡ("D2"));return true;}Y++;ë=false;}for(;ì<Ķ.ϲ();ì
  345. ++){if(!Ɠ.Ȝ(25))return false;IMyJumpDrive Ō=Ķ.ί[ì]as IMyJumpDrive;double ˆ,Ŷ,ʒ;ʒ=o.ő.Ϛ(Ō,out ˆ,out Ŷ);if(ʖ){o.Ư(ʒ);}else{o
  346. .ƃ(Ō.CustomName+" ");if(Μ){TimeSpan Ϊ=TimeSpan.FromSeconds(Ζ(Ō.EntityId,ˆ,Ŷ));o.ƴ(o.ǁ.ȕ(Ϊ));if(!ʗ){o.Ƶ(ʒ,1.0f,o.ə);o.ƴ(
  347. ' '+ʒ.ToString("0.0")+"%");}}else{if(!ʗ){o.ƴ(o.ȅ(ˆ)+"Wh / "+o.ȅ(Ŷ)+"Wh");o.Ƶ(ʒ,1.0f,o.ə);}o.ƴ(' '+ʒ.ToString("0.0")+"%");}}
  348. }return true;}}class Ω:ŵ{public Ω(){Ɏ=1;ɒ="CmdCountdown";}public override bool Ɨ(bool ë){bool ˣ=ƚ.ʸ.EndsWith("c");bool Ϋ=
  349. ƚ.ʸ.EndsWith("r");string Ψ="";int ͷ=ƚ.ʺ.IndexOf(' ');if(ͷ>=0)Ψ=ƚ.ʺ.Substring(ͷ+1).Trim();DateTime Φ=DateTime.Now;DateTime
  350. Υ;if(!DateTime.TryParseExact(Ψ,"H:mm d.M.yyyy",System.Globalization.CultureInfo.InvariantCulture,System.Globalization.
  351. DateTimeStyles.None,out Υ)){o.Ǎ(Ď.ǡ("C3"));o.Ǎ("  Countdown 19:02 28.2.2015");return true;}TimeSpan ˠ=Υ-Φ;string ĸ="";if(ˠ.Ticks<=0)ĸ=
  352. Ď.ǡ("C4");else{if((int)ˠ.TotalDays>0)ĸ+=(int)ˠ.TotalDays+" "+Ď.ǡ("C5")+" ";if(ˠ.Hours>0||ĸ!="")ĸ+=ˠ.Hours+"h ";if(ˠ.
  353. Minutes>0||ĸ!="")ĸ+=ˠ.Minutes+"m ";ĸ+=ˠ.Seconds+"s";}if(ˣ)o.Ƣ(ĸ);else if(Ϋ)o.ƴ(ĸ);else o.Ǎ(ĸ);return true;}}class Τ:ŵ{public Τ(
  354. ){Ɏ=1;ɒ="CmdCustomData";}public override bool Ɨ(bool ë){string ĸ="";if(ƚ.ʣ!=""&&ƚ.ʣ!="*"){IMyTerminalBlock Σ=o.ƿ.
  355. GetBlockWithName(ƚ.ʣ)as IMyTerminalBlock;if(Σ==null){o.Ǎ("CustomData: "+Ď.ǡ("CD1")+ƚ.ʣ);return true;}ĸ=Σ.CustomData;}else{o.Ǎ(
  356. "CustomData:"+Ď.ǡ("CD2"));return true;}if(ĸ.Length==0)return true;o.nj(ĸ);return true;}}class Ρ:ŵ{public Ρ(){Ɏ=5;ɒ="CmdDamage";}β Ķ;
  357. public override void Ʌ(){Ķ=new β(Ɠ,o.ő);}bool Ɯ=false;int ì=0;public override bool Ɨ(bool ë){bool ʗ=ƚ.ʸ.StartsWith("damagex");
  358. bool Ͷ=ƚ.ʸ.EndsWith("noc");bool ʹ=(!Ͷ&&ƚ.ʸ.EndsWith("c"));float ͳ=100;if(!ë){Ķ.Ŧ();Ɯ=false;ì=0;}if(!Ķ.μ(ƚ.ʣ,ë))return false;
  359. if(ƚ.ˋ.Count>0){if(!float.TryParse(ƚ.ˋ[0].ij,out ͳ))ͳ=100;}ͳ-=0.00001f;for(;ì<Ķ.ϲ();ì++){if(!Ɠ.Ȝ(30))return false;
  360. IMyTerminalBlock å=Ķ.ί[ì];IMySlimBlock Ͳ=å.CubeGrid.GetCubeBlock(å.Position);if(Ͳ==null)continue;float ͱ=(Ͷ?Ͳ.MaxIntegrity:Ͳ.
  361. BuildIntegrity);if(!ʹ)ͱ-=Ͳ.CurrentDamage;float ʒ=100*(ͱ/Ͳ.MaxIntegrity);if(ʒ>=ͳ)continue;Ɯ=true;string Ͱ=o.ǜ(Ͳ.FatBlock.
  362. DisplayNameText,o.ɠ*0.69f-o.ə);o.ƃ(Ͱ+' ');if(!ʗ){o.Ʃ(o.ȅ(ͱ)+" / ",0.69f);o.ƃ(o.ȅ(Ͳ.MaxIntegrity));}o.ƴ(' '+ʒ.ToString("0.0")+'%');o.Ư(ʒ
  363. );}if(!Ɯ)o.Ǎ(Ď.ǡ("D3"));return true;}}class ˮ:ŵ{public ˮ(){Ɏ=1;ɒ="CmdDateTime";}public override bool Ɨ(bool ë){bool ˬ=(ƚ.
  364. ʸ.StartsWith("datetime"));bool ˤ=(ƚ.ʸ.StartsWith("date"));bool ˣ=ƚ.ʸ.Contains("c");int ˢ=ƚ.ʸ.IndexOf('+');if(ˢ<0)ˢ=ƚ.ʸ.
  365. IndexOf('-');float ˡ=0;if(ˢ>=0)float.TryParse(ƚ.ʸ.Substring(ˢ),out ˡ);DateTime ˠ=DateTime.Now.AddHours(ˡ);string ĸ="";int ͷ=ƚ.ʺ
  366. .IndexOf(' ');if(ͷ>=0)ĸ=ƚ.ʺ.Substring(ͷ+1);if(!ˬ){if(!ˤ)ĸ+=ˠ.ToShortTimeString();else ĸ+=ˠ.ToShortDateString();}else{if(ĸ
  367. =="")ĸ=String.Format("{0:d} {0:t}");else{ĸ=ĸ.Replace("/","\\/");ĸ=ĸ.Replace(":","\\:");ĸ=ĸ.Replace("\"","\\\"");ĸ=ĸ.
  368. Replace("'","\\'");ĸ=ˠ.ToString(ĸ+' ');ĸ=ĸ.Substring(0.Length-1);}}if(ˣ)o.Ƣ(ĸ);else o.Ǎ(ĸ);return true;}}class ˑ:ŵ{public ˑ()
  369. {Ɏ=5;ɒ="CmdDetails";}string Α="";β Ķ;public override void Ʌ(){Ķ=new β(Ɠ,o.ő);if(ƚ.ˋ.Count>0)Α=ƚ.ˋ[0].ij.Trim();}int Y=0;
  370. int ì=1;bool ΐ=false;IMyTerminalBlock å;public override bool Ɨ(bool ë){if(ƚ.ʣ==""||ƚ.ʣ=="*"){o.Ǎ("Details: "+Ď.ǡ("D1"));
  371. return true;}if(!ë){Ķ.Ŧ();ΐ=ƚ.ʸ.Contains("non");Y=0;ì=1;}if(Y==0){if(!Ķ.μ(ƚ.ʣ,ë))return true;if(Ķ.ϲ()<=0){o.Ǎ("Details: "+Ď.ǡ(
  372. "D2"));return true;}Y++;ë=false;}int Ώ=(ƚ.ʸ.EndsWith("x")?1:0);if(Y==1){if(!ë){å=Ķ.ί[0];if(!ΐ)o.Ǎ(å.CustomName);}if(!Ί(å,Ώ,ë
  373. ))return false;Y++;ë=false;}for(;ì<Ķ.ϲ();ì++){if(!ë){å=Ķ.ί[ì];if(!ΐ){o.Ǎ("");o.Ǎ(å.CustomName);}}if(!Ί(å,Ώ,ë))return
  374. false;ë=false;}return true;}string[]lj;int Ύ=0;bool Ό=false;ʌ ƫ=new ʌ();bool Ί(IMyTerminalBlock å,int Ή,bool ë){if(!ë){lj=ƫ.Ŧ()
  375. .ʆ(å.DetailedInfo).ʆ('\n').ʆ(å.CustomInfo).ɕ().Split('\n');Ύ=Ή;Ό=(Α.Length==0);}for(;Ύ<lj.Length;Ύ++){if(!Ɠ.Ȝ(5))return
  376. false;if(lj[Ύ].Length==0)continue;if(!Ό){if(!lj[Ύ].Contains(Α))continue;Ό=true;}o.Ǎ(ƫ.Ŧ().ʆ("  ").ʆ(lj[Ύ]));}return true;}}class
  377. Έ:ŵ{public Έ(){Ɏ=1;ɒ="CmdDistance";}string Ά="";string[]ͽ;Vector3D ͼ;string ͻ="";bool ͺ=false;public override void Ʌ(){ͺ=
  378. false;if(ƚ.ˋ.Count<=0)return;Ά=ƚ.ˋ[0].ij.Trim();ͽ=Ά.Split(':');if(ͽ.Length<5||ͽ[0]!="GPS")return;double θ,Ћ,Ѽ;if(!double.
  379. TryParse(ͽ[2],out θ))return;if(!double.TryParse(ͽ[3],out Ћ))return;if(!double.TryParse(ͽ[4],out Ѽ))return;ͼ=new Vector3D(θ,Ћ,Ѽ);
  380. ͻ=ͽ[1];ͺ=true;}public override bool Ɨ(bool ë){if(!ͺ){o.Ǎ("Distance: "+Ď.ǡ("DTU")+" '"+Ά+"'.");return true;}
  381. IMyTerminalBlock å=k.E.å;if(ƚ.ʣ!=""&&ƚ.ʣ!="*"){å=o.ƿ.GetBlockWithName(ƚ.ʣ);if(å==null){o.Ǎ("Distance: "+Ď.ǡ("P1")+": "+ƚ.ʣ);return true;
  382. }}double ъ=Vector3D.Distance(å.GetPosition());o.ƃ(ͻ+": ");o.ƴ(o.ȅ(ъ)+"m ");return true;}}class Ҙ:ŵ{β Ķ;public Ҙ(){Ɏ=2;ɒ
  383. ="CmdDocked";}public override void Ʌ(){Ķ=new β(Ɠ,o.ő);}int Y=0;int җ=0;bool Җ=false;bool ҕ=false;IMyShipConnector œ;
  384. public override bool Ɨ(bool ë){if(!ë){if(ƚ.ʸ.EndsWith("e"))Җ=true;if(ƚ.ʸ.Contains("cn"))ҕ=true;Ķ.Ŧ();Y=0;}if(Y==0){if(!Ķ.ϼ(
  385. "connector".ʣ,ë))return false;Y++;җ=0;ë=false;}if(Ķ.ϲ()<=0){o.Ǎ("Docked: "+Ď.ǡ("DO1"));return true;}for(;җ<Ķ.ϲ();җ++){œ=Ķ.ί[җ]as
  386. IMyShipConnector;if(œ.Status==MyShipConnectorStatus.Connected){if(ҕ){o.ƃ(œ.CustomName+":");o.ƴ(œ.OtherConnector.CubeGrid.CustomName);}
  387. else{o.Ǎ(œ.OtherConnector.CubeGrid.CustomName);}}else{if(Җ){if(ҕ){o.ƃ(œ.CustomName+":");o.ƴ("-");}else o.Ǎ("-");}}}return
  388. true;}}class Ҕ:ŵ{public Ҕ(){Ɏ=30;ɒ="CmdEcho";}public override bool Ɨ(bool ë){string ʐ=(ƚ.ʸ=="center"?"c":(ƚ.ʸ=="right"?"r":
  389. "n"));switch(ʐ){case"c":o.Ƣ(ƚ.ˏ);break;case"r":o.ƴ(ƚ.ˏ);break;default:o.Ǎ(ƚ.ˏ);break;}return true;}}class Ғ:ŵ{public Ғ(){Ɏ=
  390. 1;ɒ="CmdGravity";}public override bool Ɨ(bool ë){string ʐ=(ƚ.ʸ.Contains("nat")?"n":(ƚ.ʸ.Contains("art")?"a":(ƚ.ʸ.Contains
  391. ("tot")?"t":"s")));Vector3D ϕ;if(o.ǀ.ɲ==null){o.Ǎ("Gravity: "+Ď.ǡ("GNC"));return true;}switch(ʐ){case"n":o.ƃ(Ď.ǡ("G2")+
  392. " ");ϕ=o.ǀ.ɲ.GetNaturalGravity();o.ƴ(ϕ.Length().ToString("F1")+" m/s²");break;case"a":o.ƃ(Ď.ǡ("G3")+" ");ϕ=o.ǀ.ɲ.
  393. GetArtificialGravity();o.ƴ(ϕ.Length().ToString("F1")+" m/s²");break;case"t":o.ƃ(Ď.ǡ("G1")+" ");ϕ=o.ǀ.ɲ.GetTotalGravity();o.ƴ(ϕ.Length().
  394. ToString("F1")+" m/s²");break;default:o.ƃ(Ď.ǡ("GN"));o.Ʃ(" | ",0.33f);o.Ʃ(Ď.ǡ("GA")+" | ",0.66f);o.ƴ(Ď.ǡ("GT"),1.0f);o.ƃ("");ϕ=o
  395. .ǀ.ɲ.GetNaturalGravity();o.Ʃ(ϕ.Length().ToString("F1")+" | ",0.33f);ϕ=o.ǀ.ɲ.GetArtificialGravity();o.Ʃ(ϕ.Length().
  396. ToString("F1")+" | ",0.66f);ϕ=o.ǀ.ɲ.GetTotalGravity();o.ƴ(ϕ.Length().ToString("F1")+" ");break;}return true;}}class ґ:ŵ{public ґ
  397. (){Ɏ=0.5;ɒ="CmdHScroll";}ʌ ғ=new ʌ();int ҙ=1;public override bool Ɨ(bool ë){if(ғ.ʊ==0){string ĸ=ƚ.ˏ+"  ";if(ĸ.Length==0)
  398. return true;float ҡ=o.ɠ;float Ʀ=o.Ǟ(ĸ,o.ƹ);float ю=ҡ/Ʀ;if(ю>1)ғ.ʆ(string.Join("",Enumerable.Repeat(ĸ,(int)Math.Ceiling(ю))));
  399. else ғ.ʆ(ĸ);if(ĸ.Length>40)ҙ=3;else if(ĸ.Length>5)ҙ=2;else ҙ=1;o.Ǎ(ғ);return true;}bool Ϋ=ƚ.ʸ.EndsWith("r");if(Ϋ){ғ.ƫ.Insert
  400. (0.ɕ(ғ.ʊ-ҙ,ҙ));ғ.ʅ(ғ.ʊ-ҙ,ҙ);}else{ғ.ʆ(ғ.ɕ(0));ғ.ʅ(0);}o.Ǎ(ғ);return true;}}class Ҡ:ŵ{public Ҡ(){Ɏ=7;ɒ="CmdInvList";
  401. }float ҟ=-1;float Ҟ=-1;public override void Ʌ(){Ķ=new β(Ɠ,o.ő);ѱ=new Ɩ(Ɠ,o);}ʌ ƫ=new ʌ(100);Dictionary<string,string>ҝ=
  402. new Dictionary<string,string>();void Ң(string ȥ,double ѳ,int ć){if(ć>0){if(!Ҍ)o.Ƶ(Math.Min(100,100*ѳ/ć),0.3f);string Ͱ;if(ҝ
  403. .ContainsKey(ȥ)){Ͱ=ҝ[ȥ];}else{if(!ҍ)Ͱ=o.ǜ(ȥ,o.ɠ*0.5f-қ-Ҟ);else{if(!Ҍ)Ͱ=o.ǜ(ȥ,o.ɠ*0.5f);else Ͱ=o.ǜ(ȥ,o.ɠ*0.9f);}ҝ[ȥ]=Ͱ;}ƫ.
  404. Ŧ();if(!Ҍ)ƫ.ʆ(' ');if(!ҍ){o.ƃ(ƫ.ʆ(Ͱ).ʆ(' '));o.Ʃ(o.ȅ(ѳ),1.0f,қ+Ҟ);o.Ǎ(ƫ.Ŧ().ʆ(" / ").ʆ(o.ȅ(ć)));}else{o.Ǎ(ƫ.ʆ(Ͱ));}}else{
  405. if(!ҍ){o.ƃ(ƫ.Ŧ().ʆ(ȥ).ʆ(':'));o.ƴ(o.ȅ(ѳ),1.0f,ҟ);}else o.Ǎ(ƫ.Ŧ().ʆ(ȥ));}}void Ҝ(string ȥ,double ѳ,double Ѳ,int ć){if(ć>0){
  406. if(!ҍ){o.ƃ(ƫ.Ŧ().ʆ(ȥ).ʆ(' '));o.Ʃ(o.ȅ(ѳ),0.51f);o.ƃ(ƫ.Ŧ().ʆ(" / ").ʆ(o.ȅ(ć)));o.ƴ(ƫ.Ŧ().ʆ(" +").ʆ(o.ȅ(Ѳ)).ʆ(" ").ʆ(Ď.ǡ(
  407. "I1")),1.0f);}else o.Ǎ(ƫ.Ŧ().ʆ(ȥ));if(!Ҍ)o.Ư(Math.Min(100,100*ѳ/ć));}else{if(!ҍ){o.ƃ(ƫ.Ŧ().ʆ(ȥ).ʆ(':'));o.Ʃ(o.ȅ(ѳ),0.51f);o.
  408. ƴ(ƫ.Ŧ().ʆ(" +").ʆ(o.ȅ(Ѳ)).ʆ(" ").ʆ(Ď.ǡ("I1")),1.0f);}else{o.Ǎ(ƫ.Ŧ().ʆ(ȥ));}}}float қ=0;bool Қ(Ÿ ż){int ć=(ҏ?ż.ŷ:ż.Ŷ);if(ć
  409. <0)return true;float Ʋ=o.Ǟ(o.ȅ(ć),o.ƹ);if(Ʋ>қ)қ=Ʋ;return true;}List<Ÿ>Ѿ;int ѻ=0;int Ѻ=0;bool ѹ(bool ë,bool Ѹ,string Ï,
  410. string П){if(!ë){Ѻ=0;ѻ=0;}if(Ѻ==0){if(ҁ){if((Ѿ=ѱ.ž(Ï,ë,Қ))==null)return false;}else{if((Ѿ=ѱ.ž(Ï,ë))==null)return false;}Ѻ++;ë=
  411. false;}if(Ѿ.Count>0){if(!Ѹ&&!ë){if(!o.Ƹ)o.Ǎ();o.Ƣ(ƫ.Ŧ().ʆ("<< ").ʆ(П).ʆ(" ").ʆ(Ď.ǡ("I2")).ʆ(" >>"));}for(;ѻ<Ѿ.Count;ѻ++){if(!
  412. Ɠ.Ȝ(30))return false;double ѳ=Ѿ[ѻ].ƌ;if(ҏ&&ѳ>=Ѿ[ѻ].ŷ)continue;int ć=Ѿ[ѻ].Ŷ;if(ҏ)ć=Ѿ[ѻ].ŷ;string ȥ=o.Dz(Ѿ[ѻ].Ð,Ѿ[ѻ].Ï);Ң(ȥ,
  413. ѳ,ć);}}return true;}List<Ÿ>ѷ;int Ѷ=0;int ѵ=0;bool Ѵ(bool ë){if(!ë){Ѷ=0;ѵ=0;}if(ѵ==0){if((ѷ=ѱ.ž("Ingot"))==null)return
  414. false;ѵ++;ë=false;}if(ѷ.Count>0){if(!Ҏ&&!ë){if(!o.Ƹ)o.Ǎ();o.Ƣ(ƫ.Ŧ().ʆ("<< ").ʆ(Ď.ǡ("I4")).ʆ(" ").ʆ(Ď.ǡ("I2")).ʆ(" >>"));}for(
  415. ;Ѷ<ѷ.Count;Ѷ++){if(!Ɠ.Ȝ(40))return false;double ѳ=ѷ[Ѷ].ƌ;if(ҏ&&ѳ>=ѷ[Ѷ].ŷ)continue;int ć=ѷ[Ѷ].Ŷ;if(ҏ)ć=ѷ[Ѷ].ŷ;string ȥ=o.Dz
  416. (ѷ[Ѷ].Ð,ѷ[Ѷ].Ï);if(ѷ[Ѷ].Ð!="Scrap"){double Ѳ=ѱ.Ɓ(ѷ[Ѷ].Ð+" Ore"[Ѷ].Ð,"Ore").ƌ;Ҝ(ȥ,ѳ,Ѳ,ć);}else Ң(ȥ,ѳ,ć);}}return true;}β
  417. Ķ=null;Ɩ ѱ;List<ˀ>ˋ;bool Ѱ,ʗ,ҏ,Ҏ,ҍ,Ҍ;int ĵ,ı;string ҋ="";float Ҋ=0;bool ҁ=true;void Ҁ(){if(o.ƹ!=ҋ||Ҋ!=o.ɠ){ҝ.Clear();Ҋ=o.
  418. ɠ;}if(o.ƹ!=ҋ){Ҟ=o.Ǟ(" / ",o.ƹ);ҟ=o.Ǹ(' ',o.ƹ);ҋ=o.ƹ;}Ķ.Ŧ();Ѱ=ƚ.ʸ.EndsWith("x")||ƚ.ʸ.EndsWith("xs");ʗ=ƚ.ʸ.EndsWith("s")||ƚ
  419. .ʸ.EndsWith("sx");ҏ=ƚ.ʸ.StartsWith("missing");Ҏ=ƚ.ʸ.Contains("list");Ҍ=ƚ.ʸ.Contains("nb");ҍ=ƚ.ʸ.Contains("nn");ѱ.Ŧ();ˋ=ƚ.
  420. ˋ;if(ˋ.Count==0)ˋ.Add(new ˀ("all"));}bool ѿ(bool ë){if(!ë)ĵ=0;for(;ĵ<ˋ.Count;ĵ++){ˀ ij=ˋ[ĵ];ij.ʻ();string Ï=ij.ʾ;if(!ë)ı=0;
  421. else ë=false;for(;ı<ij.ʽ.Count;ı++){if(!Ɠ.Ȝ(30))return false;string[]Ą=ij.ʽ[ı].Split(':');double Ȃ;if(string.Compare(Ą[0],
  422. "all",true)==0)Ą[0]="";int ŷ=1;int Ŷ=-1;if(Ą.Length>1){if(Double.TryParse(Ą[1],out Ȃ)){if(ҏ)ŷ=(int)Math.Ceiling(Ȃ);else Ŷ=(
  423. int)Math.Ceiling(Ȃ);}}string Ơ=Ą[0];if(!string.IsNullOrEmpty(Ï))Ơ+=' '+Ï;ѱ.ơ(Ơ,ij.ʿ=="-",ŷ,Ŷ);}}return true;}int Л=0;int ς=0
  424. ;int ѽ=0;List<MyInventoryItem>Ɔ=new List<MyInventoryItem>();bool Ґ(bool ë){β ϳ=Ķ;if(!ë)Л=0;for(;Л<ϳ.ί.Count;Л++){if(!ë)ς=
  425. 0;for(;ς<ϳ.ί[Л].InventoryCount;ς++){IMyInventory ρ=ϳ.ί[Л].GetInventory(ς);if(!ë){ѽ=0;Ɔ.Clear();ρ.GetItems(Ɔ);}else ë=
  426. false;for(;ѽ<Ɔ.Count;ѽ++){if(!Ɠ.Ȝ(40))return false;MyInventoryItem À=Ɔ[ѽ];string Ò=o.ǵ(À);string Ð,Ï;o.dz(Ò,out Ð,out Ï);if(
  427. string.Compare(Ï,"ore",true)==0){if(ѱ.Ɲ(Ð+" ingot",Ð,"Ingot")&&ѱ.Ɲ(Ò,Ð,Ï))continue;}else{if(ѱ.Ɲ(Ò,Ð,Ï))continue;}o.dz(Ò,out Ð,
  428. out Ï);Ÿ Ź=ѱ.Ɓ(Ò,Ð,Ï);Ź.ƌ+=(double)À.Amount;}}}return true;}int Y=0;public override bool Ɨ(bool ë){if(!ë){Ҁ();Y=0;}for(;Y<=
  429. 10;Y++){switch(Y){case 0:if(!Ķ.μ(ƚ.ʣ,ë))return false;break;case 1:if(!ѿ(ë))return false;if(Ѱ)Y++;break;case 2:if(!ѱ.ź(ë))
  430. return false;break;case 3:if(!Ґ(ë))return false;break;case 4:if(!ѹ(ë,Ҏ,"Ore".ǡ("I3")))return false;break;case 5:if(ʗ){if(!ѹ(
  431. ë,Ҏ,"Ingot".ǡ("I4")))return false;}else{if(!Ѵ(ë))return false;}break;case 6:if(!ѹ(ë,Ҏ,"Component".ǡ("I5")))return
  432. false;break;case 7:if(!ѹ(ë,Ҏ,"OxygenContainerObject".ǡ("I6")))return false;break;case 8:if(!ѹ(ë,true,"GasContainerObject",
  433. ""))return false;break;case 9:if(!ѹ(ë,Ҏ,"AmmoMagazine".ǡ("I7")))return false;break;case 10:if(!ѹ(ë,Ҏ,"PhysicalGunObject"
  434. .ǡ("I8")))return false;break;}ë=false;}ҁ=false;return true;}}class Ҽ:ŵ{public Ҽ(){Ɏ=2;ɒ="CmdAmount";}β Ķ;public
  435. override void Ʌ(){Ķ=new β(Ɠ,o.ő);}bool ҽ;bool һ=false;int IJ=0;int ĵ=0;int ı=0;public override bool Ɨ(bool ë){if(!ë){ҽ=!ƚ.ʸ.
  436. EndsWith("x");һ=ƚ.ʸ.EndsWith("bar");if(һ)ҽ=true;if(ƚ.ˋ.Count==0)ƚ.ˋ.Add(new ˀ(
  437. "reactor,gatlingturret,missileturret,interiorturret,gatlinggun,launcherreload,launcher,oxygenerator"));ĵ=0;}for(;ĵ<ƚ.ˋ.Count;ĵ++){ˀ ij=ƚ.ˋ[ĵ];if(!ë){ij.ʻ();IJ=0;ı=0;}for(;ı<ij.ʽ.Count;ı++){if(IJ==0){if(!ë){if(ij.ʽ[ı]=="")
  438. continue;Ķ.Ŧ();}string į=ij.ʽ[ı];if(!Ķ.ϼ(į,ƚ.ʣ,ë))return false;IJ++;ë=false;}if(!ӂ(ë))return false;ë=false;IJ=0;}}return true;}int
  439. ҹ=0;int ĭ=0;double Ź=0;double Ҹ=0;double Һ=0;int ѽ=0;IMyTerminalBlock Ҿ;IMyInventory ӄ;List<MyInventoryItem>Ɔ=new List<
  440. MyInventoryItem>();string Ӄ="";bool ӂ(bool ë){if(!ë){ҹ=0;ĭ=0;}for(;ҹ<Ķ.ϲ();ҹ++){if(ĭ==0){if(!Ɠ.Ȝ(50))return false;Ҿ=Ķ.ί[ҹ];ӄ=Ҿ.
  441. GetInventory(0);if(ӄ==null)continue;ĭ++;ë=false;}if(!ë){Ɔ.Clear();ӄ.GetItems(Ɔ);Ӄ=(Ɔ.Count>0?Ɔ[0].Type.ToString():"");ѽ=0;Ź=0;Ҹ=0;Һ=
  442. 0;}for(;ѽ<Ɔ.Count;ѽ++){if(!Ɠ.Ȝ(30))return false;MyInventoryItem À=Ɔ[ѽ];if(À.Type.ToString()!=Ӄ)Һ+=(double)À.Amount;else Ź
  443. +=(double)À.Amount;}string Ӂ=Ď.ǡ("A1");string ŀ=Ҿ.CustomName;if(Ź>0&&(double)ӄ.CurrentVolume>0){double Ӏ=Һ*(double)ӄ.
  444. CurrentVolume/(Ź+Һ);Ҹ=Math.Floor(Ź*((double)ӄ.MaxVolume-Ӏ)/((double)ӄ.CurrentVolume-Ӏ));Ӂ=o.ȅ(Ź)+" / "+(Һ>0?"~":"")+o.ȅ(Ҹ);}if(!һ||Ҹ
  445. <=0){ŀ=o.ǜ(ŀ,o.ɠ*0.8f);o.ƃ(ŀ);o.ƴ(Ӂ);}if(ҽ&&Ҹ>0){double ʒ=100*Ź/Ҹ;o.Ư(ʒ);}ĭ=0;ë=false;}return true;}}class ҿ:ŵ{β Ķ;public
  446. ҿ(){Ɏ=2;ɒ="CmdMass";}public override void Ʌ(){Ķ=new β(Ɠ,o.ő);}bool ʗ=false;bool ʕ=false;int Y=0;public override bool Ɨ(
  447. bool ë){if(!ë){Ķ.Ŧ();ʗ=(ƚ.ʸ[ƚ.ʸ.Length-1]=='x');ʕ=(ƚ.ʸ[ƚ.ʸ.Length-1]=='p');Y=0;}if(Y==0){if(!Ķ.μ(ƚ.ʣ,ë))return false;Y++;ë=
  448. false;}double È=Ķ.σ(ë);if(Double.IsNaN(È))return false;double ʓ=0;int Ѧ=ƚ.ˋ.Count;if(Ѧ>0){double.TryParse(ƚ.ˋ[0].ij.Trim(),out
  449. ʓ);if(Ѧ>1){string ѥ=ƚ.ˋ[1].ij.Trim();char э=' ';if(ѥ.Length>0)э=Char.ToLower(ѥ[0]);int Ѥ="kmgtpezy".IndexOf(э);if(Ѥ>=0)ʓ*=
  450. Math.Pow(1000.0);}ʓ*=1000.0;}o.ƃ(Ď.ǡ("M1")+" ");if(ʓ<=0){o.ƴ(o.ȃ(È,false));return true;}double ʒ=È/ʓ*100;if(!ʗ&&!ʕ){o.ƴ(o.
  451. ȃ(È)+" / "+o.ȃ(ʓ));o.Ƶ(ʒ,1.0f,o.ə);o.Ǎ(' '+o.Ǽ(ʒ)+"%");}else if(ʕ){o.ƴ(o.Ǽ(ʒ)+"%");o.Ư(ʒ);}else o.ƴ(o.Ǽ(ʒ)+"%");return
  452. true;}}class ҷ:ŵ{ȳ ǁ;β Ķ;public ҷ(){Ɏ=3;ɒ="CmdOxygen";}public override void Ʌ(){ǁ=o.ǁ;Ķ=new β(Ɠ,o.ő);}int Y=0;int ì=0;bool Ɯ
  453. =false;int ҩ=0;double ȵ=0;double ȶ=0;double Ʈ;public override bool Ɨ(bool ë){if(!ë){Ķ.Ŧ();Y=0;ì=0;Ʈ=0;}if(Y==0){if(!Ķ.ϼ(
  454. "airvent".ʣ,ë))return false;Ɯ=(Ķ.ϲ()>0);Y++;ë=false;}if(Y==1){for(;ì<Ķ.ϲ();ì++){if(!Ɠ.Ȝ(8))return false;IMyAirVent ŏ=Ķ.ί[ì]as
  455. IMyAirVent;Ʈ=Math.Max(ŏ.GetOxygenLevel()*100,0f);o.ƃ(ŏ.CustomName);if(ŏ.CanPressurize)o.ƴ(o.Ǽ(Ʈ)+"%");else o.ƴ(Ď.ǡ("O1"));o.Ư(Ʈ);}
  456. Y++;ë=false;}if(Y==2){if(!ë)Ķ.Ŧ();if(!Ķ.ϼ("oxyfarm".ʣ,ë))return false;ҩ=Ķ.ϲ();Y++;ë=false;}if(Y==3){if(ҩ>0){if(!ë)ì=0;
  457. double Ҩ=0;for(;ì<ҩ;ì++){if(!Ɠ.Ȝ(4))return false;IMyOxygenFarm ҧ=Ķ.ί[ì]as IMyOxygenFarm;Ҩ+=ҧ.GetOutput()*100;}Ʈ=Ҩ/ҩ;if(Ɯ)o.Ǎ(
  458. "");Ɯ|=(ҩ>0);o.ƃ(Ď.ǡ("O2"));o.ƴ(o.Ǽ(Ʈ)+"%");o.Ư(Ʈ);}Y++;ë=false;}if(Y==4){if(!ë)Ķ.Ŧ();if(!Ķ.ϼ("oxytank".ʣ,ë))return
  459. false;ҩ=Ķ.ϲ();if(ҩ==0){if(!Ɯ)o.Ǎ(Ď.ǡ("O3"));return true;}Y++;ë=false;}if(Y==5){if(!ë){ȵ=0;ȶ=0;ì=0;}if(!ǁ.ȸ(Ķ.ί,"oxygen",ref ȶ
  460. ,ref ȵ,ë))return false;if(ȵ==0){if(!Ɯ)o.Ǎ(Ď.ǡ("O3"));return true;}Ʈ=ȶ/ȵ*100;if(Ɯ)o.Ǎ("");o.ƃ(Ď.ǡ("O4"));o.ƴ(o.Ǽ(Ʈ)+"%");o
  461. .Ư(Ʈ);Y++;}return true;}}class Ҧ:ŵ{public Ҧ(){Ɏ=1;ɒ="CmdPosition";}public override bool Ɨ(bool ë){bool ҥ=(ƚ.ʸ=="posxyz");
  462. bool Ά=(ƚ.ʸ=="posgps");IMyTerminalBlock å=k.E.å;if(ƚ.ʣ!=""&&ƚ.ʣ!="*"){å=o.ƿ.GetBlockWithName(ƚ.ʣ);if(å==null){o.Ǎ("Pos: "+Ď.
  463. ǡ("P1")+": "+ƚ.ʣ);return true;}}if(Ά){Vector3D Ū=å.GetPosition();o.Ǎ("GPS:"+Ď.ǡ("P2")+":"+Ū.GetDim(0).ToString("F2")+":"+
  464. Ū.GetDim(1).ToString("F2")+":"+Ū.GetDim(2).ToString("F2")+":");return true;}o.ƃ(Ď.ǡ("P2")+": ");if(!ҥ){o.ƴ(å.GetPosition(
  465. ).ToString("F0"));return true;}o.Ǎ("");o.ƃ(" X: ");o.ƴ(å.GetPosition().GetDim(0).ToString("F0"));o.ƃ(" Y: ");o.ƴ(å.
  466. GetPosition().GetDim(1).ToString("F0"));o.ƃ(" Z: ");o.ƴ(å.GetPosition().GetDim(2).ToString("F0"));return true;}}class Ҥ:ŵ{public Ҥ(
  467. ){Ɏ=3;ɒ="CmdPower";}ȳ ǁ;β ң;β Ҫ;β Ҷ;β Ш;β Ҵ;β Ķ;public override void Ʌ(){ң=new β(Ɠ,o.ő);Ҫ=new β(Ɠ,o.ő);Ҷ=new β(Ɠ,o.ő);Ш=
  468. new β(Ɠ,o.ő);Ҵ=new β(Ɠ,o.ő);Ķ=new β(Ɠ,o.ő);ǁ=o.ǁ;}string П;bool ҳ;string Ц;string Ҳ;int ұ;int Y=0;public override bool Ɨ(
  469. bool ë){if(!ë){П=(ƚ.ʸ.EndsWith("x")?"s":(ƚ.ʸ.EndsWith("p")?"p":(ƚ.ʸ.EndsWith("v")?"v":"n")));ҳ=(ƚ.ʸ.StartsWith(
  470. "powersummary"));Ц="a";Ҳ="";if(ƚ.ʸ.Contains("stored"))Ц="s";else if(ƚ.ʸ.Contains("in"))Ц="i";else if(ƚ.ʸ.Contains("out"))Ц="o";Y=0;ң.Ŧ
  471. ();Ҫ.Ŧ();Ҷ.Ŧ();Ш.Ŧ();Ҵ.Ŧ();}if(Ц=="a"){if(Y==0){if(!ң.ϼ("reactor".ʣ,ë))return false;ë=false;Y++;}if(Y==1){if(!Ҫ.ϼ(
  472. "hydrogenengine".ʣ,ë))return false;ë=false;Y++;}if(Y==2){if(!Ҷ.ϼ("solarpanel".ʣ,ë))return false;ë=false;Y++;}if(Y==3){if(!Ҵ.ϼ(
  473. "windturbine".ʣ,ë))return false;ë=false;Y++;}}else if(Y==0)Y=4;if(Y==4){if(!Ш.ϼ("battery".ʣ,ë))return false;ë=false;Y++;}int ҵ=ң.
  474. ϲ();int Ұ=Ҫ.ϲ();int ү=Ҷ.ϲ();int Ү=Ш.ϲ();int ҭ=Ҵ.ϲ();if(Y==5){ұ=0;if(ҵ>0)ұ++;if(Ұ>0)ұ++;if(ү>0)ұ++;if(ҭ>0)ұ++;if(Ү>0)ұ++;
  475. if(ұ<1){o.Ǎ(Ď.ǡ("P6"));return true;}if(ƚ.ˋ.Count>0){if(ƚ.ˋ[0].ij.Length>0)Ҳ=ƚ.ˋ[0].ij;}Y++;ë=false;}if(Ц!="a"){if(!Щ(Ш,(Ҳ==
  476. ""?Ď.ǡ("P7"):Ҳ),Ц,П,ë))return false;return true;}string Ч=Ď.ǡ("P8");if(!ҳ){if(Y==6){if(ҵ>0)if(!в(ң,(Ҳ==""?Ď.ǡ("P9"):Ҳ),П,ë
  477. ))return false;Y++;ë=false;}if(Y==7){if(Ұ>0)if(!в(Ҫ,(Ҳ==""?Ď.ǡ("P12"):Ҳ),П,ë))return false;Y++;ë=false;}if(Y==8){if(ү>0)
  478. if(!в(Ҷ,(Ҳ==""?Ď.ǡ("P10"):Ҳ),П,ë))return false;Y++;ë=false;}if(Y==9){if(ҭ>0)if(!в(Ҵ,(Ҳ==""?Ď.ǡ("P13"):Ҳ),П,ë))return false
  479. ;Y++;ë=false;}if(Y==10){if(Ү>0)if(!Щ(Ш,(Ҳ==""?Ď.ǡ("P7"):Ҳ),Ц,П,ë))return false;Y++;ë=false;}}else{Ч=Ď.ǡ("P11");ұ=10;if(Y
  480. ==6)Y=11;}if(ұ==1)return true;if(!ë){Ķ.Ŧ();Ķ.ϴ(ң);Ķ.ϴ(Ҫ);Ķ.ϴ(Ҷ);Ķ.ϴ(Ҵ);Ķ.ϴ(Ш);}if(!в(Ķ,Ч,П,ë))return false;return true;}
  481. void Н(double ˆ,double Ŷ){double М=(Ŷ>0?ˆ/Ŷ*100:0);switch(П){case"s":o.ƴ(ƫ.Ŧ().ʆ(' ').ʆ(М.ToString("F1")).ʆ("%"));break;case
  482. "v":o.ƴ(ƫ.Ŧ().ʆ(o.ȅ(ˆ)).ʆ("W / ").ʆ(o.ȅ(Ŷ)).ʆ("W"));break;case"c":o.ƴ(ƫ.Ŧ().ʆ(o.ȅ(ˆ)).ʆ("W"));break;case"p":o.ƴ(ƫ.Ŧ().ʆ(' '
  483. ).ʆ(М.ToString("F1")).ʆ("%"));o.Ư(М);break;default:o.ƴ(ƫ.Ŧ().ʆ(o.ȅ(ˆ)).ʆ("W / ").ʆ(o.ȅ(Ŷ)).ʆ("W"));o.Ƶ(М,1.0f,o.ə);o.ƴ(ƫ.
  484. Ŧ().ʆ(' ').ʆ(М.ToString("F1")).ʆ("%"));break;}}double Ҭ=0;double З=0=0;int ѯ=0;bool в(β ј,string Ч,string ʐ,bool ë){if(
  485. !ë){З=0;ҫ=0;ѯ=0;}if(ѯ==0){if(!ǁ.Ƚ(ј.ί,ǁ.ȱ,ref Ҭ,ref Ҭ,ref З,ref ҫ,ë))return false;ѯ++;ë=false;}if(!Ɠ.Ȝ(50))return false;
  486. double М=(ҫ>0?З/ҫ*100:0);o.ƃ(Ч+": ");Н(З*1000000*1000000);return true;}double а=0=0=0=0;double Ь=0=0;int Ъ=0;ʌ ƫ=new
  487. ʌ(100);bool Щ(β Ш,string Ч,string Ц,string ʐ,bool ë){if(!ë){а=Я=0;Ю=Э=0;Ь=Ы=0;Ъ=0;}if(Ъ==0){if(!ǁ.ȭ(Ш.ί,ref Ю,ref Э,ref а
  488. ,ref Я,ref Ь,ref Ы,ë))return false;Ю*=1000000;Э*=1000000;а*=1000000;Я*=1000000;Ь*=1000000;Ы*=1000000;Ъ++;ë=false;}double
  489. Х=(Ы>0?Ь/Ы*100:0);double Ф=(Я>0?а/Я*100:0);double У=(Э>0?Ю/Э*100:0);bool б=Ц=="a";if(Ъ==1){if(!Ɠ.Ȝ(50))return false;if(б)
  490. {if(ʐ!="p"){o.ƃ(ƫ.Ŧ().ʆ(Ч).ʆ(": "));o.ƴ(ƫ.Ŧ().ʆ("(IN ").ʆ(o.ȅ(Ю)).ʆ("W / OUT ").ʆ(o.ȅ(а)).ʆ("W)"));}else o.Ǎ(ƫ.Ŧ().ʆ(Ч).ʆ
  491. (": "));o.ƃ(ƫ.Ŧ().ʆ("  ").ʆ(Ď.ǡ("P3")).ʆ(": "));}else o.ƃ(ƫ.Ŧ().ʆ(Ч).ʆ(": "));if(б||Ц=="s")switch(ʐ){case"s":o.ƴ(ƫ.Ŧ().ʆ(
  492. ' ').ʆ(Х.ToString("F1")).ʆ("%"));break;case"v":o.ƴ(ƫ.Ŧ().ʆ(o.ȅ(Ь)).ʆ("Wh / ").ʆ(o.ȅ(Ы)).ʆ("Wh"));break;case"p":o.ƴ(ƫ.Ŧ().ʆ(
  493. ' ').ʆ(Х.ToString("F1")).ʆ("%"));o.Ư(Х);break;default:o.ƴ(ƫ.Ŧ().ʆ(o.ȅ(Ь)).ʆ("Wh / ").ʆ(o.ȅ(Ы)).ʆ("Wh"));o.Ƶ(Х,1.0f,o.ə);o.ƴ
  494. (ƫ.Ŧ().ʆ(' ').ʆ(Х.ToString("F1")).ʆ("%"));break;}if(Ц=="s")return true;Ъ++;ë=false;}if(Ъ==2){if(!Ɠ.Ȝ(50))return false;if(
  495. б)o.ƃ(ƫ.Ŧ().ʆ("  ").ʆ(Ď.ǡ("P4")).ʆ(": "));if(б||Ц=="o")switch(ʐ){case"s":o.ƴ(ƫ.Ŧ().ʆ(' ').ʆ(Ф.ToString("F1")).ʆ("%"));
  496. break;case"v":o.ƴ(ƫ.Ŧ().ʆ(o.ȅ(а)).ʆ("W / ").ʆ(o.ȅ(Я)).ʆ("W"));break;case"p":o.ƴ(ƫ.Ŧ().ʆ(' ').ʆ(Ф.ToString("F1")).ʆ("%"));o.Ư(
  497. Ф);break;default:o.ƴ(ƫ.Ŧ().ʆ(o.ȅ(а)).ʆ("W / ").ʆ(o.ȅ(Я)).ʆ("W"));o.Ƶ(Ф,1.0f,o.ə);o.ƴ(ƫ.Ŧ().ʆ(' ').ʆ(Ф.ToString("F1")).ʆ(
  498. "%"));break;}if(Ц=="o")return true;Ъ++;ë=false;}if(!Ɠ.Ȝ(50))return false;if(б)o.ƃ(ƫ.Ŧ().ʆ("  ").ʆ(Ď.ǡ("P5")).ʆ(": "));if(б
  499. ||Ц=="i")switch(ʐ){case"s":o.ƴ(ƫ.Ŧ().ʆ(' ').ʆ(У.ToString("F1")).ʆ("%"));break;case"v":o.ƴ(ƫ.Ŧ().ʆ(o.ȅ(Ю)).ʆ("W / ").ʆ(o.ȅ(
  500. Э)).ʆ("W"));break;case"p":o.ƴ(ƫ.Ŧ().ʆ(' ').ʆ(У.ToString("F1")).ʆ("%"));o.Ư(У);break;default:o.ƴ(ƫ.Ŧ().ʆ(o.ȅ(Ю)).ʆ("W / ")
  501. .ʆ(o.ȅ(Э)).ʆ("W"));o.Ƶ(У,1.0f,o.ə);o.ƴ(ƫ.Ŧ().ʆ(' ').ʆ(У.ToString("F1")).ʆ("%"));break;}return true;}}class Т:ŵ{public Т()
  502. {Ɏ=7;ɒ="CmdPowerTime";}class х{public TimeSpan Ċ=new TimeSpan(-1);public double А=-1;public double у=0;}х т=new х();β с;β
  503. р;public override void Ʌ(){с=new β(Ɠ,o.ő);р=new β(Ɠ,o.ő);}int п=0;double о=0;double н=0=0;double ф=0=0=0;double и=0
  504. =0;int ж=0;private bool е(string ʣ,out TimeSpan д,out double г,bool ë){MyResourceSourceComponent Ⱥ;
  505. MyResourceSinkComponent Ȫ;double к=ɏ;х С=т;д=С.Ċ;г=С.А;if(!ë){с.Ŧ();р.Ŧ();С.А=0;п=0;о=0;н=м=0;ф=0;л=й=0;и=з=0;ж=0;}if(п==0){if(!с.ϼ("reactor"
  506. ))return false;ë=false;п++;}if(п==1){for(;ж<с.ί.Count;ж++){if(!Ɠ.Ȝ(6))return false;IMyReactor å=с.ί[ж]as IMyReactor;if(
  507. å==null||!å.IsWorking)continue;if(å.Components.TryGet<MyResourceSourceComponent>(out Ⱥ)){н+=Ⱥ.CurrentOutputByType(o.ǁ.ȱ);
  508. м+=Ⱥ.MaxOutputByType(o.ǁ.ȱ);}о+=(double)å.GetInventory(0).CurrentMass;}ë=false;п++;}if(п==2){if(!р.ϼ("battery",ʣ,ë))
  509. return false;ë=false;п++;}if(п==3){if(!ë)ж=0;for(;ж<р.ί.Count;ж++){if(!Ɠ.Ȝ(15))return false;IMyBatteryBlock å=р.ί[ж]as
  510. IMyBatteryBlock;if(å==null||!å.IsWorking)continue;if(å.Components.TryGet<MyResourceSourceComponent>(out Ⱥ)){л=Ⱥ.CurrentOutputByType(o.ǁ
  511. .ȱ);й=Ⱥ.MaxOutputByType(o.ǁ.ȱ);}if(å.Components.TryGet<MyResourceSinkComponent>(out Ȫ)){л-=Ȫ.CurrentInputByType(o.ǁ.ȱ);}
  512. double И=(л<0?(å.MaxStoredPower-å.CurrentStoredPower)/(-л/3600):0);if(И>С.А)С.А=И;if(å.ChargeMode==ChargeMode.Recharge)
  513. continue;и+=л;з+=й;ф+=å.CurrentStoredPower;}ë=false;п++;}double З=н+и;if(З<=0)С.Ċ=TimeSpan.FromSeconds(-1);else{double Ж=С.Ċ.
  514. TotalSeconds;double Е;double Д=(С.у-о)/к;if(н<=0)Д=Math.Min(З,м)/3600000;double Г=0;if(з>0)Г=Math.Min(З,з)/3600;if(Д<=0&&Г<=0)Е=-1;
  515. else if(Д<=0)Е=ф/Г;else if(Г<=0)Е=о/Д;else{double В=Г;double Б=(н<=0?З/3600:Д*З/н);Е=ф/В+о/Б;}if(Ж<=0||Е<0)Ж=Е;else Ж=(Ж+Е)/
  516. 2;try{С.Ċ=TimeSpan.FromSeconds(Ж);}catch{С.Ċ=TimeSpan.FromSeconds(-1);}}С.у=о;г=С.А;д=С.Ċ;return true;}int Y=0;bool ʖ=
  517. false;bool ʗ=false;bool ʕ=false;double А=0;TimeSpan Ȕ;int Џ=0=0=0;int ǰ=0;int Ќ=0;public override bool Ɨ(bool ë){if(!ë){ʖ
  518. =ƚ.ʸ.EndsWith("bar");ʗ=(ƚ.ʸ[ƚ.ʸ.Length-1]=='x');ʕ=(ƚ.ʸ[ƚ.ʸ.Length-1]=='p');Y=0;Џ=Ў=Ѝ=ǰ=0;Ќ=0;А=0;}if(Y==0){if(ƚ.ˋ.Count>0
  519. ){for(;Ќ<ƚ.ˋ.Count;Ќ++){if(!Ɠ.Ȝ(100))return false;ƚ.ˋ[Ќ].ʻ();if(ƚ.ˋ[Ќ].ʽ.Count<=0)continue;string ij=ƚ.ˋ[Ќ].ʽ[0];int.
  520. TryParse(ij,out ǰ);if(Ќ==0)Џ=ǰ;else if(Ќ==1)Ў=ǰ;else if(Ќ==2)Ѝ=ǰ;}}Y++;ë=false;}if(Y==1){if(!е(ƚ.ʣ,out Ȕ,out А,ë))return false;Y
  521. ++;ë=false;}if(!Ɠ.Ȝ(30))return false;double Ċ=0;TimeSpan Й;try{Й=new TimeSpan(Џ,Ў,Ѝ);}catch{Й=TimeSpan.FromSeconds(-1);}
  522. string ĸ;if(Ȕ.TotalSeconds>0||А<=0){if(!ʖ)o.ƃ(Ď.ǡ("PT1")+" ");ĸ=o.ǁ.ȕ(Ȕ);Ċ=Ȕ.TotalSeconds;}else{if(!ʖ)o.ƃ(Ď.ǡ("PT2")+" ");ĸ=o.
  523. ǁ.ȕ(TimeSpan.FromSeconds(А));if(Й.TotalSeconds>=А)Ċ=Й.TotalSeconds-А;else Ċ=0;}if(Й.Ticks<=0){o.ƴ(ĸ);return true;}double
  524. ʒ=Ċ/Й.TotalSeconds*100;if(ʒ>100)ʒ=100;if(ʖ){o.Ư(ʒ);return true;}if(!ʗ&&!ʕ){o.ƴ(ĸ);o.Ƶ(ʒ,1.0f,o.ə);o.Ǎ(' '+ʒ.ToString(
  525. "0.0")+"%");}else if(ʕ){o.ƴ(ʒ.ToString("0.0")+"%");o.Ư(ʒ);}else o.ƴ(ʒ.ToString("0.0")+"%");return true;}}class Р:ŵ{public Р()
  526. {Ɏ=7;ɒ="CmdPowerUsed";}ȳ ǁ;β Ķ;public override void Ʌ(){Ķ=new β(Ɠ,o.ő);ǁ=o.ǁ;}string П;string О;string ϝ;void Н(double ˆ,
  527. double Ŷ){double М=(Ŷ>0?ˆ/Ŷ*100:0);switch(П){case"s":o.ƴ(М.ToString("0.0")+"%",1.0f);break;case"v":o.ƴ(o.ȅ(ˆ)+"W / "+o.ȅ(Ŷ)+
  528. "W",1.0f);break;case"c":o.ƴ(o.ȅ(ˆ)+"W",1.0f);break;case"p":o.ƴ(М.ToString("0.0")+"%",1.0f);o.Ư(М);break;default:o.ƴ(o.ȅ(ˆ)+
  529. "W / "+o.ȅ(Ŷ)+"W");o.Ƶ(М,1.0f,o.ə);o.ƴ(' '+М.ToString("0.0")+"%");break;}}double Ȭ=0=0;int Л=0;int Y=0;ѡ К=new ѡ();public
  530. override bool Ɨ(bool ë){if(!ë){П=(ƚ.ʸ.EndsWith("x")?"s":(ƚ.ʸ.EndsWith("usedp")||ƚ.ʸ.EndsWith("topp")?"p":(ƚ.ʸ.EndsWith("v")?"v":
  531. (ƚ.ʸ.EndsWith("c")?"c":"n"))));О=(ƚ.ʸ.Contains("top")?"top":"");ϝ=(ƚ.ˋ.Count>0?ƚ.ˋ[0].ij:Ď.ǡ("PU1"));Ȭ=Ȳ=0;Y=0;Л=0;Ķ.Ŧ();К
  532. .w();}if(Y==0){if(!Ķ.μ(ƚ.ʣ,ë))return false;ë=false;Y++;}MyResourceSinkComponent Ȫ;MyResourceSourceComponent Ⱥ;switch(О){
  533. case"top":if(Y==1){for(;Л<Ķ.ί.Count;Л++){if(!Ɠ.Ȝ(20))return false;IMyTerminalBlock å=Ķ.ί[Л];if(å.Components.TryGet<
  534. MyResourceSinkComponent>(out Ȫ)){ListReader<MyDefinitionId>Ȗ=Ȫ.AcceptedResources;if(Ȗ.IndexOf(ǁ.ȱ)<0)continue;Ȭ=Ȫ.CurrentInputByType(ǁ.ȱ)*
  535. 1000000;}else continue;К.A(Ȭ,å);}ë=false;Y++;}if(К.º()<=0){o.Ǎ("PowerUsedTop: "+Ď.ǡ("D2"));return true;}int Ľ=10;if(ƚ.ˋ.Count>0
  536. )if(!int.TryParse(ϝ,out Ľ)){Ľ=10;}if(Ľ>К.º())Ľ=К.º();if(Y==2){if(!ë){Л=К.º()-1;К.Ã();}for(;Л>=К.º()-Ľ;Л--){if(!Ɠ.Ȝ(30))
  537. return false;IMyTerminalBlock å=К.ª(Л);string ŀ=o.ǜ(å.CustomName,o.ɠ*0.4f);if(å.Components.TryGet<MyResourceSinkComponent>(out
  538. Ȫ)){Ȭ=Ȫ.CurrentInputByType(ǁ.ȱ)*1000000;Ȳ=Ȫ.MaxRequiredInputByType(ǁ.ȱ)*1000000;}o.ƃ(ŀ+" ");Н(Ȭ,Ȳ);}}break;default:for(;Л
  539. <Ķ.ί.Count;Л++){if(!Ɠ.Ȝ(10))return false;double Ѣ;IMyTerminalBlock å=Ķ.ί[Л];if(å.Components.TryGet<
  540. MyResourceSinkComponent>(out Ȫ)){ListReader<MyDefinitionId>Ȗ=Ȫ.AcceptedResources;if(Ȗ.IndexOf(ǁ.ȱ)<0)continue;Ѣ=Ȫ.CurrentInputByType(ǁ.ȱ);Ȳ+=Ȫ.
  541. MaxRequiredInputByType(ǁ.ȱ);}else continue;if(å.Components.TryGet<MyResourceSourceComponent>(out Ⱥ)&&(å as IMyBatteryBlock!=null)){Ѣ-=Ⱥ.
  542. CurrentOutputByType(ǁ.ȱ);if(Ѣ<=0)continue;}Ȭ+=Ѣ;}o.ƃ(ϝ);Н(Ȭ*1000000*1000000);break;}return true;}public class ѡ{List<KeyValuePair<double,
  543. IMyTerminalBlock>>Ѡ=new List<KeyValuePair<double,IMyTerminalBlock>>();public void A(double џ,IMyTerminalBlock å){Ѡ.Add(new KeyValuePair<
  544. double,IMyTerminalBlock>(џ,å));}public int º(){return Ѡ.Count;}public IMyTerminalBlock ª(int z){return Ѡ[z].Value;}public void
  545. w(){Ѡ.Clear();}public void Ã(){Ѡ.Sort((Ђ,ѝ)=>(Ђ.Key.CompareTo(ѝ.Key)));}}}class ќ:ŵ{β Ķ;public ќ(){Ɏ=1;ɒ="CmdProp";}
  546. public override void Ʌ(){Ķ=new β(Ɠ,o.ő);}int Y=0;int Л=0;bool ћ=false;string њ=null;string љ=null;string ў=null;string ѣ=null;
  547. public override bool Ɨ(bool ë){if(!ë){ћ=ƚ.ʸ.StartsWith("props");њ=љ=ў=ѣ=null;Л=0;Y=0;}if(ƚ.ˋ.Count<1){o.Ǎ(ƚ.ʸ+": "+
  548. "Missing property name.");return true;}if(Y==0){if(!ë)Ķ.Ŧ();if(!Ķ.μ(ƚ.ʣ,ë))return false;Ѯ();Y++;ë=false;}if(Y==1){int Ľ=Ķ.ϲ();if(Ľ==0){o.Ǎ(ƚ.ʸ+
  549. ": "+"No blocks found.");return true;}for(;Л<Ľ;Л++){if(!Ɠ.Ȝ(50))return false;IMyTerminalBlock å=Ķ.ί[Л];if(å.GetProperty(њ)!=
  550. null){if(љ==null){string ϝ=o.ǜ(å.CustomName,o.ɠ*0.7f);o.ƃ(ϝ);}else o.ƃ(љ);o.ƴ(ѭ(å,њ,ў,ѣ));if(!ћ)return true;}}}return true;}
  551. void Ѯ(){њ=ƚ.ˋ[0].ij;if(ƚ.ˋ.Count>1){if(!ћ)љ=ƚ.ˋ[1].ij;else ў=ƚ.ˋ[1].ij;if(ƚ.ˋ.Count>2){if(!ћ)ў=ƚ.ˋ[2].ij;else ѣ=ƚ.ˋ[2].ij;if(ƚ.ˋ
  552. .Count>3&&!ћ)ѣ=ƚ.ˋ[3].ij;}}}string ѭ(IMyTerminalBlock å,string Ѭ,string ѫ=null,string Ѫ=null){return(å.GetValue<bool>(Ѭ)?(
  553. ѫ!=null?ѫ:Ď.ǡ("W9")):(Ѫ!=null?Ѫ:Ď.ǡ("W1")));}}class ѩ:ŵ{public ѩ(){Ɏ=5;ɒ="CmdShipCtrl";}β Ķ;public override void Ʌ(){Ķ=
  554. new β(Ɠ,o.ő);}public override bool Ɨ(bool ë){if(!ë)Ķ.Ŧ();if(!Ķ.ϼ("shipctrl".ʣ,ë))return false;if(Ķ.ϲ()<=0){if(ƚ.ʣ!=""&&ƚ.
  555. ʣ!="*")o.Ǎ(ƚ.ʸ+": "+Ď.ǡ("SC1")+" ("+ƚ.ʣ+")");else o.Ǎ(ƚ.ʸ+": "+Ď.ǡ("SC1"));return true;}if(ƚ.ʸ.StartsWith("damp")){bool Ѝ
  556. =(Ķ.ί[0]as IMyShipController).DampenersOverride;o.ƃ(Ď.ǡ("SCD"));o.ƴ(Ѝ?"ON":"OFF");}else{bool Ѝ=(Ķ.ί[0]as
  557. IMyShipController).IsUnderControl;o.ƃ(Ď.ǡ("SCO"));o.ƴ(Ѝ?"YES":"NO");}return true;}}class Ѩ:ŵ{public Ѩ(){Ɏ=1;ɒ="CmdShipMass";}public
  558. override bool Ɨ(bool ë){bool ѧ=ƚ.ʸ.EndsWith("base");double ʓ=0;if(ƚ.ʣ!="")double.TryParse(ƚ.ʣ.Trim(),out ʓ);int Ѧ=ƚ.ˋ.Count;if(Ѧ
  559. >0){string ѥ=ƚ.ˋ[0].ij.Trim();char э=' ';if(ѥ.Length>0)э=Char.ToLower(ѥ[0]);int Ѥ="kmgtpezy".IndexOf(э);if(Ѥ>=0)ʓ*=Math.
  560. Pow(1000.0);}double ɺ=(ѧ?o.ǀ.ɸ:o.ǀ.ɹ);if(!ѧ)o.ƃ(Ď.ǡ("SM1")+" ");else o.ƃ(Ď.ǡ("SM2")+" ");o.ƴ(o.ȃ(ɺ,true,'k')+" ");if(ʓ>0)
  561. o.Ư(ɺ/ʓ*100);return true;}}class я:ŵ{public я(){Ɏ=0.5;ɒ="CmdSpeed";}public override bool Ɨ(bool ë){double ʓ=0;double ю=1;
  562. string э="m/s";if(ƚ.ʸ.Contains("kmh")){ю=3.6;э="km/h";}else if(ƚ.ʸ.Contains("mph")){ю=2.23694;э="mph";}if(ƚ.ʣ!="")double.
  563. TryParse(ƚ.ʣ.Trim(),out ʓ);o.ƃ(Ď.ǡ("S1")+" ");o.ƴ((o.ǀ.ʃ*ю).ToString("F1")+" "+э+" ");if(ʓ>0)o.Ư(o.ǀ.ʃ/ʓ*100);return true;}}
  564. class ь:ŵ{public ь(){Ɏ=1;ɒ="CmdStopTask";}public override bool Ɨ(bool ë){double ы=0;if(ƚ.ʸ.Contains("best"))ы=o.ǀ.ʃ/o.ǀ.ɾ;
  565. else ы=o.ǀ.ʃ/o.ǀ.ɻ;double ъ=o.ǀ.ʃ/2*ы;if(ƚ.ʸ.Contains("time")){o.ƃ(Ď.ǡ("ST"));if(double.IsNaN(ы)){o.ƴ("N/A");return true;}
  566. string ĸ="";try{TimeSpan ˠ=TimeSpan.FromSeconds(ы);if((int)ˠ.TotalDays>0)ĸ=" > 24h";else{if(ˠ.Hours>0)ĸ=ˠ.Hours+"h ";if(ˠ.
  567. Minutes>0||ĸ!="")ĸ+=ˠ.Minutes+"m ";ĸ+=ˠ.Seconds+"s";}}catch{ĸ="N/A";}o.ƴ(ĸ);return true;}o.ƃ(Ď.ǡ("SD"));if(!double.IsNaN(ъ)&&!
  568. double.IsInfinity(ъ))o.ƴ(o.ȅ(ъ)+"m ");else o.ƴ("N/A");return true;}}class щ:ŵ{ȳ ǁ;β Ķ;public щ(){Ɏ=2;ɒ="CmdTanks";}public
  569. override void Ʌ(){ǁ=o.ǁ;Ķ=new β(Ɠ,o.ő);}int Y=0;char П='n';string ш;double ч=0;double ц=0;double Ʈ;bool ʖ=false;public override
  570. bool Ɨ(bool ë){List<ˀ>ˋ=ƚ.ˋ;if(ˋ.Count==0){o.Ǎ(Ď.ǡ("T4"));return true;}if(!ë){П=(ƚ.ʸ.EndsWith("x")?'s':(ƚ.ʸ.EndsWith("p")?
  571. 'p':(ƚ.ʸ.EndsWith("v")?'v':'n')));ʖ=ƚ.ʸ.EndsWith("bar");Y=0;if(ш==null){ш=ˋ[0].ij.Trim();ш=char.ToUpper(ш[0])+ш.Substring(1)
  572. .ToLower();}Ķ.Ŧ();ч=0;ц=0;}if(Y==0){if(!Ķ.ϼ("oxytank".ʣ,ë))return false;ë=false;Y++;}if(Y==1){if(!Ķ.ϼ("hydrogenengine",
  573. ƚ.ʣ,ë))return false;ë=false;Y++;}if(Y==2){if(!ǁ.ȸ(Ķ.ί,ш,ref ч,ref ц,ë))return false;ë=false;Y++;}if(ц==0){o.Ǎ(String.
  574. Format(Ď.ǡ("T5")));return true;}Ʈ=ч/ц*100;if(ʖ){o.Ư(Ʈ);return true;}o.ƃ(ш);switch(П){case's':o.ƴ(' '+o.Ǽ(Ʈ)+"%");break;case
  575. 'v':o.ƴ(o.ȅ(ч)+"L / "+o.ȅ(ц)+"L");break;case'p':o.ƴ(' '+o.Ǽ(Ʈ)+"%");o.Ư(Ʈ);break;default:o.ƴ(o.ȅ(ч)+"L / "+o.ȅ(ц)+"L");o.Ƶ(
  576. Ʈ,1.0f,o.ə);o.ƴ(' '+Ʈ.ToString("0.0")+"%");break;}return true;}}class ї{ɖ o=null;public string J="Debug";public float і=
  577. 1.0f;public List<ʌ>lj=new List<ʌ>();public int Ŗ=0;public float ѕ=0;public ї(ɖ Û){o=Û;lj.Add(new ʌ());}public void є(string ĸ)
  578. {lj[Ŗ].ʆ(ĸ);}public void є(ʌ ƪ){lj[Ŗ].ʆ(ƪ);}public void ѓ(){lj.Add(new ʌ());Ŗ++;ѕ=0;}public void ѓ(string ǎ){lj[Ŗ].ʆ(ǎ);ѓ();}
  579. public void ђ(List<ʌ>ё){if(lj[Ŗ].ʊ==0)lj.RemoveAt(Ŗ);else Ŗ++;lj.AddList(ё);Ŗ+=ё.Count-1;ѓ();}public List<ʌ>ţ(){if(lj[Ŗ].ʊ==0)
  580. return lj.GetRange(0);else return lj;}public void ѐ(string Nj,string P=""){string[]lj=Nj.Split('\n');for(int F=0;F<lj.Length;F++)ѓ
  581. (P+lj[F]);}public void Ƭ(){lj.Clear();ѓ();Ŗ=0;}public int ť(){return Ŗ+(lj[Ŗ].ʊ>0?1:0);}public string Ų(){return String.Join
  582. ("\n");}public void ţ(List<ʌ>Ţ,int š,int Š){int ş=š+Š;int Ş=ť();if(ş>Ş)ş=Ş;for(int F=š;F<ş;F++)Ţ.Add(lj[F]);}}class ŝ{ɖ
  583. o=null;public float Ŝ=1.0f;public int ś=17;public int Ś=0;int ř=1;int Ř=1;public List<ї>ŗ=new List<ї>();public int Ŗ=0;
  584. public ŝ(ɖ Û){o=Û;}public void ŕ(int Ľ){Ř=Ľ;}public void Ŕ(){ś=(int)Math.Floor(ɖ.ɪ*Ŝ*Ř/ɖ.ɨ);}public void Ť(ї ĸ){ŗ.Add(ĸ);}
  585. public void Ŧ(){ŗ.Clear();}public int ť(){int Ľ=0;foreach(var ĸ in ŗ){Ľ+=ĸ.ť();}return Ľ;}ʌ ų=new ʌ(256);public ʌ Ų(){ų.Ŧ();
  586. int Ľ=ŗ.Count;for(int F=0;F<Ľ-1;F++){ų.ʆ(ŗ[F].Ų());ų.ʆ("\n");}if(Ľ>0)ų.ʆ(ŗ[Ľ-1].Ų());return ų;}List<ʌ>ű=new List<ʌ>(20);
  587. public ʌ Ű(int ů=0){ų.Ŧ();ű.Clear();if(Ř<=0)return ų;int Ů=ŗ.Count;int Ŵ=0;int ŭ=(ś/Ř);int ū=(ů*ŭ);int Ū=Ś+ū;int ũ=Ū+ŭ;bool Ũ=
  588. false;for(int F=0;F<Ů;F++){ї ĸ=ŗ[F];int Ş=ĸ.ť();int ŧ=Ŵ;Ŵ+=Ş;if(!Ũ&&Ŵ>Ū){int š=Ū-ŧ;if(Ŵ>=ũ){ĸ.ţ(ű,š,ũ-ŧ-š);break;}Ũ=true;ĸ.ţ(
  589. ű,š,Ş);continue;}if(Ũ){if(Ŵ>=ũ){ĸ.ţ(ű,0-ŧ);break;}ĸ.ţ(ű,0);}}int Ľ=ű.Count;for(int F=0;F<Ľ-1;F++){ų.ʆ(ű[F]);ų.ʆ("\n")
  590. ;}if(Ľ>0)ų.ʆ(ű[Ľ-1]);return ų;}public bool Ŭ(int Ľ=-1){if(Ľ<=0)Ľ=o.ɦ;if(Ś-Ľ<=0){Ś=0;return true;}Ś-=Ľ;return false;}
  591. public bool ň(int Ľ=-1){if(Ľ<=0)Ľ=o.ɦ;int ļ=ť();if(Ś+Ľ+ś>=ļ){Ś=Math.Max(ļ-ś,0);return true;}Ś+=Ľ;return false;}public int Ļ=0;
  592. public void ĺ(){if(Ļ>0){Ļ--;return;}if(ť()<=ś){Ś=0;ř=1;return;}if(ř>0){if(ň()){ř=-1;Ļ=2;}}else{if(Ŭ()){ř=1;Ļ=2;}}}}class Ĺ:ŵ{
  593. public Ĺ(){Ɏ=1;ɒ="CmdTextLCD";}public override bool Ɨ(bool ë){string ĸ="";if(ƚ.ʣ!=""&&ƚ.ʣ!="*"){IMyTextPanel ý=o.ƿ.
  594. GetBlockWithName(ƚ.ʣ)as IMyTextPanel;if(ý==null){o.Ǎ("TextLCD: "+Ď.ǡ("T1")+ƚ.ʣ);return true;}ĸ=ý.GetText();}else{o.Ǎ("TextLCD:"+Ď.ǡ("T2"
  595. ));return true;}if(ĸ.Length==0)return true;o.nj(ĸ);return true;}}class ķ:ŵ{public ķ(){Ɏ=5;ɒ="CmdWorking";}β Ķ;public
  596. override void Ʌ(){Ķ=new β(Ɠ,o.ő);}int Y=0;int ĵ=0;bool Ĵ;public override bool Ɨ(bool ë){if(!ë){Y=0;Ĵ=(ƚ.ʸ=="workingx");ĵ=0;}if(ƚ
  597. .ˋ.Count==0){if(Y==0){if(!ë)Ķ.Ŧ();if(!Ķ.μ(ƚ.ʣ,ë))return false;Y++;ë=false;}if(!Ń(Ķ,Ĵ,""))return false;return true;}for(
  598. ;ĵ<ƚ.ˋ.Count;ĵ++){ˀ ij=ƚ.ˋ[ĵ];if(!ë)ij.ʻ();if(!Į(ij,ë))return false;ë=false;}return true;}int IJ=0;int ı=0;string[]İ;string į
  599. ;string ľ;bool Į(ˀ ij,bool ë){if(!ë){IJ=0;ı=0;}for(;ı<ij.ʽ.Count;ı++){if(IJ==0){if(!ë){if(string.IsNullOrEmpty(ij.ʽ[ı]))
  600. continue;Ķ.Ŧ();İ=ij.ʽ[ı].Split(':');į=İ[0];ľ=(İ.Length>1?İ[1]:"");}if(!string.IsNullOrEmpty(į)){if(!Ķ.ϼ(į,ƚ.ʣ,ë))return false;}
  601. else{if(!Ķ.μ(ƚ.ʣ,ë))return false;}IJ++;ë=false;}if(!Ń(Ķ,Ĵ,ľ,ë))return false;IJ=0;ë=false;}return true;}string Œ(
  602. IMyTerminalBlock å){ϵ ő=o.ő;if(!å.IsWorking)return Ď.ǡ("W1");IMyProductionBlock Ő=å as IMyProductionBlock;if(Ő!=null)if(Ő.IsProducing)
  603. return Ď.ǡ("W2");else return Ď.ǡ("W3");IMyAirVent ŏ=å as IMyAirVent;if(ŏ!=null){if(ŏ.CanPressurize)return(ŏ.GetOxygenLevel()*
  604. 100).ToString("F1")+"%";else return Ď.ǡ("W4");}IMyGasTank Ŏ=å as IMyGasTank;if(Ŏ!=null)return(Ŏ.FilledRatio*100).ToString(
  605. "F1")+"%";IMyBatteryBlock ō=å as IMyBatteryBlock;if(ō!=null)return ő.Ϫ(ō);IMyJumpDrive Ō=å as IMyJumpDrive;if(Ō!=null)return
  606. ő.ϙ(Ō).ToString("0.0")+"%";IMyLandingGear ŋ=å as IMyLandingGear;if(ŋ!=null){switch((int)ŋ.LockMode){case 0:return Ď.ǡ(
  607. "W8");case 1:return Ď.ǡ("W10");case 2:return Ď.ǡ("W7");}}IMyDoor Ŋ=å as IMyDoor;if(Ŋ!=null){if(Ŋ.Status==DoorStatus.Open)
  608. return Ď.ǡ("W5");return Ď.ǡ("W6");}IMyShipConnector œ=å as IMyShipConnector;if(œ!=null){if(œ.Status==MyShipConnectorStatus.
  609. Unconnected)return Ď.ǡ("W8");if(œ.Status==MyShipConnectorStatus.Connected)return Ď.ǡ("W7");else return Ď.ǡ("W10");}IMyLaserAntenna
  610. ʼn=å as IMyLaserAntenna;if(ʼn!=null)return ő.ϛ(ʼn);IMyRadioAntenna Ň=å as IMyRadioAntenna;if(Ň!=null)return o.ȅ(Ň.Radius)+
  611. "m";IMyBeacon ņ=å as IMyBeacon;if(ņ!=null)return o.ȅ(ņ.Radius)+"m";IMyThrust Ņ=å as IMyThrust;if(Ņ!=null&&Ņ.ThrustOverride>
  612. 0)return o.ȅ(Ņ.ThrustOverride)+"N";return Ď.ǡ("W9");}int ń=0;bool Ń(β Ā,bool ł,string Ł,bool ë){if(!ë)ń=0;for(;ń<Ā.ϲ();ń
  613. ++){if(!Ɠ.Ȝ(20))return false;IMyTerminalBlock å=Ā.ί[ń];string Ŀ=(ł?(å.IsWorking?Ď.ǡ("W9"):Ď.ǡ("W1")):Œ(å));if(!string.
  614. IsNullOrEmpty(Ł)&&String.Compare(Ŀ,Ł,true)!=0)continue;if(ł)Ŀ=Œ(å);string ŀ=å.CustomName;ŀ=o.ǜ(ŀ,o.ɠ*0.7f);o.ƃ(ŀ);o.ƴ(Ŀ);}return true
  615. ;}}class ŵ:ɓ{public ї ĸ=null;protected ʤ ƚ;protected ɖ o;protected Ę k;protected ǒ Ď;public ŵ(){Ɏ=3600;ɒ="CommandTask";}
  616. public void ƙ(Ę j,ʤ Ƙ){k=j;o=k.o;ƚ=Ƙ;Ď=o.Ď;}public virtual bool Ɨ(bool ë){o.Ǎ(Ď.ǡ("UC")+": '"+ƚ.ʺ+"'");return true;}public
  617. override bool Ʉ(bool ë){ĸ=o.Lj(ĸ,k.E);if(!ë)o.Ƭ();return Ɨ(ë);}}class Ɩ{Dictionary<string,string>Ɣ=new Dictionary<string,string>(
  618. StringComparer.InvariantCultureIgnoreCase){{"ingot","ingot"},{"ore","ore"},{"component","component"},{"tool","physicalgunobject"},{
  619. "ammo","ammomagazine"},{"oxygen","oxygencontainerobject"},{"gas","gascontainerobject"}};ȓ Ɠ;ɖ o;ƈ ƒ;ƈ Ƒ;ƈ Ɛ;Ƈ Ə;bool Ǝ;public
  620. ƈ ƍ;public Ɩ(ȓ ƕ,ɖ Û,int K=20){ƒ=new ƈ();Ƒ=new ƈ();Ɛ=new ƈ();Ǝ=false;ƍ=new ƈ();Ɠ=ƕ;o=Û;Ə=o.Ə;}public void Ŧ(){Ɛ.w();Ƒ.w()
  621. ;ƒ.w();Ǝ=false;ƍ.w();}public void ơ(string Ơ,bool Ƃ=false,int ŷ=1,int Ŷ=-1){if(string.IsNullOrEmpty(Ơ)){Ǝ=true;return;}
  622. string[]Ɵ=Ơ.Split(' ');string Ï="";Ÿ ż=new Ÿ(Ƃ,ŷ,Ŷ);if(Ɵ.Length==2){if(!Ɣ.TryGetValue(Ɵ[1],out Ï))Ï=Ɵ[1];}string Ð=Ɵ[0];if(Ɣ.
  623. TryGetValue(Ð,out ż.Ï)){Ƒ.A(ż.Ï,ż);return;}o.DZ(ref Ð,ref Ï);if(string.IsNullOrEmpty(Ï)){ż.Ð=Ð;ƒ.A(ż.Ð,ż);return;}ż.Ð=Ð;ż.Ï=Ï;Ɛ.A(Ð+
  624. ' '+Ï,ż);}public Ÿ ƞ(string Ò,string Ð,string Ï){Ÿ ż;ż=Ɛ.µ(Ò);if(ż!=null)return ż;ż=ƒ.µ(Ð);if(ż!=null)return ż;ż=Ƒ.µ(Ï);if(
  625. ż!=null)return ż;return null;}public bool Ɲ(string Ò,string Ð,string Ï){Ÿ ż;bool Ɯ=false;ż=Ƒ.µ(Ï);if(ż!=null){if(ż.Ƃ)
  626. return true;Ɯ=true;}ż=ƒ.µ(Ð);if(ż!=null){if(ż.Ƃ)return true;Ɯ=true;}ż=Ɛ.µ(Ò);if(ż!=null){if(ż.Ƃ)return true;Ɯ=true;}return!(Ǝ
  627. ||Ɯ);}public Ÿ ƛ(string Ò,string Ð,string Ï){Ÿ Ź=new Ÿ();Ÿ ż=ƞ(Ò,Ð,Ï);if(ż!=null){Ź.ŷ=ż.ŷ;Ź.Ŷ=ż.Ŷ;}Ź.Ð=Ð;Ź.Ï=Ï;ƍ.A(Ò,Ź);
  628. return Ź;}public Ÿ Ɓ(string Ò,string Ð,string Ï){Ÿ Ź=ƍ.µ(Ò);if(Ź==null)Ź=ƛ(Ò,Ð,Ï);return Ź;}int ƀ=0;List<Ÿ>ſ;public List<Ÿ>ž(
  629. string Ï,bool ë,Func<Ÿ,bool>Ž=null){if(!ë){ſ=new List<Ÿ>();ƀ=0;}for(;ƀ<ƍ.º();ƀ++){if(!Ɠ.Ȝ(5))return null;Ÿ ż=ƍ.ª(ƀ);if(Ɲ(ż.Ð+
  630. ' '+ż.Ï,ż.Ð,ż.Ï))continue;if((string.Compare(ż.Ï,Ï,true)==0)&&(Ž==null||Ž(ż)))ſ.Add(ż);}return ſ;}int Ż=0;public bool ź(
  631. bool ë){if(!ë){Ż=0;}for(;Ż<Ə.V.Count;Ż++){if(!Ɠ.Ȝ(10))return false;Î À=Ə.Ɔ[Ə.V[Ż]];if(!À.È)continue;string Ò=À.Í+' '+À.Ì;if(
  632. Ɲ(Ò,À.Í,À.Ì))continue;Ÿ Ź=Ɓ(Ò,À.Í,À.Ì);if(Ź.Ŷ==-1)Ź.Ŷ=À.Ë;}return true;}}class Ÿ{public int ŷ;public int Ŷ;public string
  633. Ð="";public string Ï="";public bool Ƃ;public double ƌ;public Ÿ(bool Ƌ=false,int Ɗ=1,int Ɖ=-1){ŷ=Ɗ;Ƃ=Ƌ;Ŷ=Ɖ;}}class ƈ{
  634. Dictionary<string>ú=new Dictionary<string>(StringComparer.InvariantCultureIgnoreCase);List<string>V=new List<string>();public
  635. void A(string X,Ÿ À){if(!ú.ContainsKey(X)){V.Add(X);ú.Add(X,À);}}public int º(){return ú.Count;}public Ÿ µ(string X){if(ú.
  636. ContainsKey(X))return ú[X];return null;}public Ÿ ª(int z){return ú[V[z]];}public void w(){V.Clear();ú.Clear();}public void Ã(){V.
  637. Sort();}}class Ƈ{public Dictionary<string>Ɔ=new Dictionary<string>(StringComparer.InvariantCultureIgnoreCase);Dictionary
  638. <string>ƅ=new Dictionary<string>(StringComparer.InvariantCultureIgnoreCase);public List<string>V=new List<string>();
  639. public Dictionary<string>Ƅ=new Dictionary<string>(StringComparer.InvariantCultureIgnoreCase);public void ƃ(string Ð,string
  640. Ï,int ć,string Ô,string Ó,bool È){if(Ï=="Ammo")Ï="AmmoMagazine";else if(Ï=="Tool")Ï="PhysicalGunObject";string Ò=Ð+' '+Ï;
  641. Î À=new Î(Ð,Ï,ć,Ô,Ó,È);Ɔ.Add(Ò,À);if(!ƅ.ContainsKey(Ð))ƅ.Add(Ð,À);if(Ó!="")Ƅ.Add(Ó,À);V.Add(Ò);}public Î Ñ(string Ð="",
  642. string Ï=""){if(Ɔ.ContainsKey(Ð+" "+Ï))return Ɔ[Ð+" "+Ï];if(string.IsNullOrEmpty(Ï)){Î À=null;ƅ.TryGetValue(Ð,out À);return À;
  643. }if(string.IsNullOrEmpty(Ð))for(int F=0;F<Ɔ.Count;F++){Î À=Ɔ[V[F]];if(string.Compare(Ï,À.Ì,true)==0)return À;}return null
  644. ;}}class Î{public string Í;public string Ì;public int Ë;public string Ê;public string É;public bool È;public Î(string Ç,
  645. string Æ,int Õ=0,string Å="",string Ö="",bool ê=true){Í=Ç;Ì=Æ;Ë=Õ;Ê=Å;É=Ö;È=ê;}}class è{ɖ o=null;public D ç=new D();public ŝ æ
  646. ;public IMyTerminalBlock å;public IMyTextSurface ä;public int ã=0;public int â=0;public string á="";public string à="";
  647. public bool é=true;public IMyTextSurface ß=>(Ü?ä:å as IMyTextSurface);public int Ý=>(Ü?(o.LJ(å)?0:1):ç.º());public bool Ü=false
  648. ;public è(ɖ Û,string Ú){o=Û;à=Ú;}public è(ɖ Û,string Ú,IMyTerminalBlock Ù,IMyTextSurface G,int Ø){o=Û;à=Ú;å=Ù;ä=G;ã=Ø;Ü=
  649. true;}public bool Þ(){return æ.ť()>æ.ś||æ.Ś!=0;}float Ä=1.0f;bool r=false;public float U(){if(r)return Ä;r=true;if(å.
  650. BlockDefinition.SubtypeId.Contains("Corner_LCD")){Ä=0.15f;if(å.BlockDefinition.SubtypeId.Contains("Flat"))Ä=0.1765f;if(å.
  651. BlockDefinition.SubtypeId.Contains("Small"))Ä*=1.8f;}return Ä;}bool S=false;public void R(){if(S)return;if(!Ü){ç.Ã();å=ç.ª(0);}int Q=å.
  652. CustomName.IndexOf("!MARGIN:");if(Q<0||Q+8>=å.CustomName.Length){â=1;á=" ";}else{string P=å.CustomName.Substring(Q+8);int O=P.
  653. IndexOf(" ");if(O>=0)P=P.Substring(0,O);if(!int.TryParse(P,out â))â=1;á=new String(' ');}if(å.CustomName.Contains("!NOSCROLL"
  654. ))é=false;else é=true;S=true;}public void N(ŝ L=null){if(æ==null||å==null)return;if(L==null)L=æ;if(!Ü){IMyTextSurface G=å
  655. as IMyTextSurface;if(G!=null){float K=G.FontSize;string J=G.Font;for(int F=0;F<ç.º();F++){IMyTextSurface E=ç.ª(F)as
  656. IMyTextSurface;if(E==null)continue;E.Alignment=VRage.Game.GUI.TextPanel.TextAlignment.LEFT;E.FontSize=K;E.Font=J;string I=L.Ű(F).ɕ();E
  657. .ContentType=VRage.Game.GUI.TextPanel.ContentType.TEXT_AND_IMAGE;E.WriteText(I);}}}else{ä.Alignment=VRage.Game.GUI.
  658. TextPanel.TextAlignment.LEFT;ä.ContentType=VRage.Game.GUI.TextPanel.ContentType.TEXT_AND_IMAGE;ä.WriteText(L.Ű().ɕ());}S=false;}
  659. public void H(){if(å==null)return;if(Ü){ä.WriteText("");return;}IMyTextSurface G=å as IMyTextSurface;if(G==null)return;for(int
  660. F=0;F<ç.º();F++){IMyTextSurface E=ç.ª(F)as IMyTextSurface;if(E==null)continue;E.WriteText("");}}}class D{Dictionary<
  661. string,IMyTerminalBlock>C=new Dictionary<string,IMyTerminalBlock>();Dictionary<IMyTerminalBlock,string>B=new Dictionary<
  662. IMyTerminalBlock,string>();List<string>V=new List<string>();public void A(string X,IMyTerminalBlock À){if(!V.Contains(X)){V.Add(X);C.Add
  663. (X,À);B.Add(À,X);}}public void Â(string X){if(V.Contains(X)){V.Remove(X);B.Remove(C[X]);C.Remove(X);}}public void Á(
  664. IMyTerminalBlock À){if(B.ContainsKey(À)){V.Remove(B[À]);C.Remove(B[À]);B.Remove(À);}}public int º(){return C.Count;}public
  665. IMyTerminalBlock µ(string X){if(V.Contains(X))return C[X];return null;}public IMyTerminalBlock ª(int z){return C[V[z]];}public void w(){
  666. V.Clear();C.Clear();B.Clear();}public void Ã(){V.Sort();}}class v:ɓ{public ɖ o;public è n;Ę k;public v(Ę j){k=j;o=k.o;n=k
  667. .E;Ɏ=0.5;ɒ="PanelDisplay";}double f=0;public void e(){f=0;}int b=0;int a=0;bool Z=true;double W=double.MaxValue;int Y=0;
  668. public override bool Ʉ(bool ë){ŵ Ě;if(!ë&&(k.Ē==false||k.Ĕ==null||k.Ĕ.Count<=0))return true;if(k.ē.Ġ>3)return Ɉ(0);if(!ë){a=0;
  669. Z=false;W=double.MaxValue;Y=0;}if(Y==0){while(a<k.Ĕ.Count){if(!Ɠ.Ȝ(5))return false;if(k.ĕ.TryGetValue(k.Ĕ[a],out Ě)){if(!
  670. Ě.ɋ)return Ɉ(Ě.ɑ-Ɠ.ȏ+0.001);if(Ě.ɐ>f)Z=true;if(Ě.ɑ<W)W=Ě.ɑ;}a++;}Y++;ë=false;}double ę=W-Ɠ.ȏ+0.001;if(!Z&&!n.Þ())return Ɉ
  671. (ę);o.Ǐ(n.æ,n);if(Z){if(!ë){f=Ɠ.ȏ;n.æ.Ŧ();b=0;}while(b<k.Ĕ.Count){if(!Ɠ.Ȝ(7))return false;if(!k.ĕ.TryGetValue(k.Ĕ[b],out
  672. Ě)){n.æ.ŗ.Add(o.Lj(null,n));o.Ƭ();o.Ǎ("ERR: No cmd task ("+k.Ĕ[b]+")");b++;continue;}n.æ.Ť(Ě.ĸ);b++;}}o.Ǒ(n);k.ē.Ġ++;if(Ɏ<
  673. ę&&!n.Þ())return Ɉ(ę);return true;}}class Ę:ɓ{public ɖ o;public è E;public v ė=null;string Ė="N/A";public Dictionary<
  674. string>ĕ=new Dictionary<string>();public List<string>Ĕ=null;public Ģ ē;public bool Ē{get{return ē.Ć;}}public Ę(Ģ đ,è ď){Ɏ=
  675. 5;E=ď;ē=đ;o=đ.o;ɒ="PanelProcess";}ǒ Ď;public override void Ʌ(){Ď=o.Ď;}ʤ č=null;ŵ Č(string ċ,bool ë){if(!ë)č=new ʤ(Ɠ);if(!
  676. č.ʻ(ċ,ë))return null;ŵ Ċ=č.ˌ();Ċ.ƙ(this);Ɠ.Ȉ(Ċ,0);return Ċ;}string ĉ="";void Ĉ(){try{ĉ=E.å.ǧ(E.ã,o.ɧ);}catch{ĉ="";
  677. return;}ĉ=ĉ?.Replace("\\\n","");}int b=0;int Đ=0;List<string>ě=null;HashSet<string>Ĥ=new HashSet<string>();int ĭ=0;bool ī(bool
  678. ë){if(!ë){char[]Ī={';','\n'};string ĩ=ĉ.Replace("\\;","\f");if(ĩ.StartsWith("@")){int Ĩ=ĩ.IndexOf("\n");if(Ĩ<0){ĩ="";}
  679. else{ĩ=ĩ.Substring(Ĩ+1);}}ě=new List<string>(ĩ.Split(Ī,StringSplitOptions.RemoveEmptyEntries));Ĥ.Clear();b=0;Đ=0;ĭ=0;}while(
  680. b<ě.Count){if(!Ɠ.Ȝ(500))return false;if(ě[b].StartsWith("//")){ě.RemoveAt(b);continue;}ě[b]=ě[b].Replace('\f',';');if(!ĕ.
  681. ContainsKey(ě[b])){if(ĭ!=1)ë=false;ĭ=1;ŵ Ě=Č(ě[b]);if(Ě==null)return false;ë=false;ĕ.Add(ě[b]);ĭ=0;}if(!Ĥ.Contains(ě[b]))Ĥ.Add(
  682. ě[b]);b++;}if(Ĕ!=null){ŵ Ċ;while(Đ<Ĕ.Count){if(!Ɠ.Ȝ(7))return false;if(!Ĥ.Contains(Ĕ[Đ]))if(ĕ.TryGetValue(Ĕ[Đ],out Ċ)){Ċ.
  683. Ɇ();ĕ.Remove(Ĕ[Đ]);}Đ++;}}Ĕ=ě;return true;}public override void Ƀ(){if(Ĕ!=null){ŵ Ċ;for(int ħ=0;ħ<Ĕ.Count;ħ++){if(ĕ.
  684. TryGetValue(Ĕ[ħ],out Ċ))Ċ.Ɇ();}Ĕ=null;}if(ė!=null){ė.Ɇ();ė=null;}else{}}ŝ Ħ=null;string Ĭ="";bool ĥ=false;public override bool Ʉ(
  685. bool ë){if(E.Ý<=0){Ɇ();return true;}if(!ë){E.æ=o.Ǐ(E.æ,E);Ħ=o.Ǐ(Ħ,E);Ĉ();if(ĉ==null){if(E.Ü){ē.ò(E.ä,E.å as IMyTextPanel);}
  686. else{Ɇ();}return true;}if(E.å.CustomName!=Ĭ){ĥ=true;}else{ĥ=false;}Ĭ=E.å.CustomName;}if(ĉ!=Ė){if(!ī(ë))return false;if(ĉ==""
  687. ){Ė="";if(ē.Ć){if(Ħ.ŗ.Count<=0)Ħ.ŗ.Add(o.Lj(null,E));else o.Lj(Ħ.ŗ[0],E);o.Ƭ();o.Ǎ(Ď.ǡ("H1"));bool ģ=E.é;E.é=false;o.Ǒ(E,Ħ)
  688. ;E.é=ģ;return true;}return this.Ɉ(2);}ĥ=true;}Ė=ĉ;if(ė!=null&&ĥ){Ɠ.Ȩ(ė);ė.e();Ɠ.Ȉ(ė,0);}else if(ė==null){ė=new v(this);Ɠ.
  689. Ȉ(ė,0);}return true;}}class Ģ:ɓ{const string ġ="T:!LCD!";public int Ġ=0;public ɖ o;public û ç=new û();β ğ;β Ğ;Dictionary<
  690. è,Ę>ĝ=new Dictionary<è,Ę>();public Dictionary<IMyTextSurface,è>Ĝ=new Dictionary<IMyTextSurface,è>();public bool Ć=false;Ϙ
  691. ù=null;public Ģ(ɖ Û){Ɏ=5;o=Û;ɒ="ProcessPanels";}public override void Ʌ(){ğ=new β(Ɠ,o.ő);Ğ=new β(Ɠ,o.ő);ù=new Ϙ(o,this);}
  692. int ö=0;bool õ(bool ë){if(!ë)ö=0;if(ö==0){if(!ğ.μ(o.ɧ,ë))return false;ö++;ë=false;}if(ö==1){if(o.ɧ=="T:[LCD]"&&ġ!="")if(!ğ.
  693. μ(ġ,ë))return false;ö++;ë=false;}return true;}string ô(IMyTerminalBlock å){int ó=å.CustomName.IndexOf("!LINK:");if(ó>=0&&
  694. å.CustomName.Length>ó+6){return å.CustomName.Substring(ó+6)+' '+å.Position.ToString();}return å.EntityId.ToString();}
  695. public void ò(IMyTextSurface G,IMyTextPanel E){è n;if(G==null)return;if(!Ĝ.TryGetValue(G,out n))return;if(E!=null){n.ç.Á(E);}Ĝ
  696. .Remove(G);if(n.Ý<=0||n.Ü){Ę ñ;if(ĝ.TryGetValue(n,out ñ)){ç.Á(n.à);ĝ.Remove(n);ñ.Ɇ();}}}void ð(IMyTerminalBlock å){
  697. IMyTextSurfaceProvider ï=å as IMyTextSurfaceProvider;IMyTextSurface G=å as IMyTextSurface;if(G!=null){ò(G,å as IMyTextPanel);return;}if(ï==
  698. null)return;for(int F=0;F<ï.SurfaceCount;F++){G=ï.GetSurface(F);ò(G,null);}}string Ú;string î;bool í;int ì=0;int ø=0;public
  699. override bool Ʉ(bool ë){if(!ë){ğ.Ŧ();ì=0;ø=0;}if(!õ(ë))return false;while(ì<ğ.ϲ()){if(!Ɠ.Ȝ(20))return false;IMyTerminalBlock å=(
  700. ğ.ί[ì]as IMyTerminalBlock);if(å==null||!å.IsWorking){ğ.ί.RemoveAt(ì);continue;}IMyTextSurfaceProvider ï=å as
  701. IMyTextSurfaceProvider;IMyTextSurface G=å as IMyTextSurface;IMyTextPanel E=å as IMyTextPanel;è n;Ú=ô(å);string[]Ą=Ú.Split(' ');î=Ą[0];í=Ą.
  702. Length>1;if(E!=null){if(Ĝ.ContainsKey(G)){n=Ĝ[G];if(n.à==Ú+"@0"||(í&&n.à==î)){ì++;continue;}ð(å);}if(!í){n=new è(o,Ú+"@0",å,G,
  703. 0);Ę ñ=new Ę(this,n);Ɠ.Ȉ(ñ,0);ĝ.Add(n,ñ);ç.A(n.à,n);Ĝ.Add(G,n);ì++;continue;}n=ç.µ(î);if(n==null){n=new è(o,î);ç.A(î,n);Ę
  704. ñ=new Ę(this,n);Ɠ.Ȉ(ñ,0);ĝ.Add(n,ñ);}n.ç.A(Ú,å);Ĝ.Add(G,n);}else{if(ï==null){ì++;continue;}for(int F=0;F<ï.SurfaceCount;F
  705. ++){G=ï.GetSurface(F);if(Ĝ.ContainsKey(G)){n=Ĝ[G];if(n.à==Ú+'@'+F.ToString()){continue;}ò(G,null);}if(å.ǧ(F,o.ɧ)==null)
  706. continue;n=new è(o,Ú+"@"+F.ToString(),å,G,F);Ę ñ=new Ę(this,n);Ɠ.Ȉ(ñ,0);ĝ.Add(n,ñ);ç.A(n.à,n);Ĝ.Add(G,n);}}ì++;}while(ø<Ğ.ϲ()){
  707. if(!Ɠ.Ȝ(300))return false;IMyTerminalBlock å=Ğ.ί[ø];if(å==null)continue;if(!ğ.ί.Contains(å)){ð(å);}ø++;}Ğ.Ŧ();Ğ.ϴ(ğ);if(!ù
  708. .Ɍ&&ù.ϫ())Ɠ.Ȉ(ù,0);return true;}public bool ă(string ą){if(string.Compare(ą,"clear",true)==0){ù.ϖ();if(!ù.Ɍ)Ɠ.Ȉ(ù,0);
  709. return true;}if(string.Compare(ą,"boot",true)==0){ù.ϗ=0;if(!ù.Ɍ)Ɠ.Ȉ(ù,0);return true;}if(ą.ǭ("scroll")){ζ Ă=new ζ(o,this);Ɠ.
  710. Ȉ(Ă,0);return true;}if(string.Compare(ą,"props",true)==0){ϵ ā=o.ő;List<IMyTerminalBlock>Ā=new List<IMyTerminalBlock>();
  711. List<ITerminalAction>ÿ=new List<ITerminalAction>();List<ITerminalProperty>þ=new List<ITerminalProperty>();IMyTextPanel ý=Ɠ.ǂ
  712. .GridTerminalSystem.GetBlockWithName("DEBUG")as IMyTextPanel;if(ý==null){return true;}ý.WriteText("Properties: ");foreach
  713. (var À in ā.І){ý.WriteText(À.Key+" =============="+"\n",true);À.Value(Ā,null);if(Ā.Count<=0){ý.WriteText("No blocks\n",
  714. true);continue;}Ā[0].GetProperties(þ,(n)=>{return n.Id!="Name"&&n.Id!="OnOff"&&!n.Id.StartsWith("Show");});foreach(var ü in
  715. þ){ý.WriteText("P "+ü.Id+" "+ü.TypeName+"\n",true);}þ.Clear();Ā.Clear();}}return false;}}class û{Dictionary<string>ú=
  716. new Dictionary<string>();List<string>V=new List<string>();public void A(string X,è À){if(!ú.ContainsKey(X)){V.Add(X);ú.
  717. Add(X,À);}}public int º(){return ú.Count;}public è µ(string X){if(ú.ContainsKey(X))return ú[X];return null;}public è ª(int
  718. z){return ú[V[z]];}public void Á(string X){ú.Remove(X);V.Remove(X);}public void w(){V.Clear();ú.Clear();}public void Ã(){
  719. V.Sort();}}class ȳ{ȓ Ɠ;ɖ o;public MyDefinitionId ȱ=new MyDefinitionId(typeof(VRage.Game.ObjectBuilders.Definitions.
  720. MyObjectBuilder_GasProperties),"Electricity");public MyDefinitionId Ȱ=new MyDefinitionId(typeof(VRage.Game.ObjectBuilders.Definitions.
  721. MyObjectBuilder_GasProperties),"Oxygen");public MyDefinitionId ȯ=new MyDefinitionId(typeof(VRage.Game.ObjectBuilders.Definitions.
  722. MyObjectBuilder_GasProperties),"Hydrogen");public ȳ(ȓ ƕ,ɖ Û){Ɠ=ƕ;o=Û;}int Ȯ=0;public bool ȭ(List<IMyTerminalBlock>Ā,ref double Ȭ,ref double Ȳ,ref
  723. double ȴ,ref double Ȼ,ref double Ɂ,ref double ɀ,bool ë){if(!ë)Ȯ=0;MyResourceSinkComponent Ȫ;MyResourceSourceComponent Ⱥ;for(;Ȯ
  724. <Ā.Count;Ȯ++){if(!Ɠ.Ȝ(8))return false;if(Ā[Ȯ].Components.TryGet<MyResourceSinkComponent>(out Ȫ)){Ȭ+=Ȫ.CurrentInputByType(
  725. ȱ);Ȳ+=Ȫ.MaxRequiredInputByType(ȱ);}if(Ā[Ȯ].Components.TryGet<MyResourceSourceComponent>(out Ⱥ)){ȴ+=Ⱥ.CurrentOutputByType(
  726. ȱ);Ȼ+=Ⱥ.MaxOutputByType(ȱ);}IMyBatteryBlock ȿ=(Ā[Ȯ]as IMyBatteryBlock);Ɂ+=ȿ.CurrentStoredPower;ɀ+=ȿ.MaxStoredPower;}
  727. return true;}int Ⱦ=0;public bool Ƚ(List<IMyTerminalBlock>Ā,MyDefinitionId ȼ,ref double Ȭ,ref double Ȳ,ref double ȴ,ref double
  728. Ȼ,bool ë){if(!ë)Ⱦ=0;MyResourceSinkComponent Ȫ;MyResourceSourceComponent Ⱥ;for(;Ⱦ<Ā.Count;Ⱦ++){if(!Ɠ.Ȝ(6))return false;if(
  729. Ā[Ⱦ].Components.TryGet<MyResourceSinkComponent>(out Ȫ)){Ȭ+=Ȫ.CurrentInputByType(ȼ);Ȳ+=Ȫ.MaxRequiredInputByType(ȼ);}if(Ā[Ⱦ
  730. ].Components.TryGet<MyResourceSourceComponent>(out Ⱥ)){ȴ+=Ⱥ.CurrentOutputByType(ȼ);Ȼ+=Ⱥ.MaxOutputByType(ȼ);}}return true;
  731. }int ȹ=0;public bool ȸ(List<IMyTerminalBlock>Ā,string ȷ,ref double ȶ,ref double ȵ,bool ë){if(!ë){ȹ=0;ȵ=0;ȶ=0;}
  732. MyResourceSinkComponent Ȫ;for(;ȹ<Ā.Count;ȹ++){if(!Ɠ.Ȝ(30))return false;IMyGasTank Ŏ=Ā[ȹ]as IMyGasTank;if(Ŏ==null)continue;double ȡ=0;if(Ŏ.
  733. Components.TryGet<MyResourceSinkComponent>(out Ȫ)){ListReader<MyDefinitionId>Ȗ=Ȫ.AcceptedResources;int F=0;for(;F<Ȗ.Count;F++){if(
  734. string.Compare(Ȗ[F].SubtypeId.ToString(),ȷ,true)==0){ȡ=Ŏ.Capacity;ȵ+=ȡ;ȶ+=ȡ*Ŏ.FilledRatio;break;}}}}return true;}public string
  735. ȕ(TimeSpan Ȕ){string ĸ="";if(Ȕ.Ticks<=0)return"-";if((int)Ȕ.TotalDays>0)ĸ+=(long)Ȕ.TotalDays+" "+o.Ď.ǡ("C5")+" ";if(Ȕ.
  736. Hours>0||ĸ!="")ĸ+=Ȕ.Hours+"h ";if(Ȕ.Minutes>0||ĸ!="")ĸ+=Ȕ.Minutes+"m ";return ĸ+Ȕ.Seconds+"s";}}class ȓ{public const double Ȓ
  737. =0.05;public const int ȑ=1000;public const int Ȑ=10000;public double ȏ{get{return ȍ;}}int Ȏ=ȑ;double ȍ=0;List<ɓ>Ȍ=new
  738. List<ɓ>(100);public MyGridProgram ǂ;public bool ȋ=false;int Ȋ=0;public ȓ(MyGridProgram Ƽ,int ƻ=1,bool ȉ=false){ǂ=Ƽ;Ȋ=ƻ;ȋ=ȉ;}
  739. public void Ȉ(ɓ ñ,double ȇ,bool ȗ=false){ñ.Ɍ=true;ñ.ɉ(this);if(ȗ){ñ.ɑ=ȏ;Ȍ.Insert(0);return;}if(ȇ<=0)ȇ=0.001;ñ.ɑ=ȏ+ȇ;for(int
  740. F=0;F<Ȍ.Count;F++){if(Ȍ[F].ɑ>ñ.ɑ){Ȍ.Insert(F,ñ);return;}if(ñ.ɑ-Ȍ[F].ɑ<Ȓ)ñ.ɑ=Ȍ[F].ɑ+Ȓ;}Ȍ.Add(ñ);}public void Ȩ(ɓ ñ){if(Ȍ.
  741. Contains(ñ)){Ȍ.Remove(ñ);ñ.Ɍ=false;}}public void Ȧ(ʌ ȧ,int Ȥ=1){if(Ȋ==Ȥ)ǂ.Echo(ȧ.ɕ());}public void Ȧ(string ȥ,int Ȥ=1){if(Ȋ==Ȥ)ǂ
  742. .Echo(ȥ);}const double ȣ=(16.66666666/16);double Ȣ=0;public void ȩ(){Ȣ+=ǂ.Runtime.TimeSinceLastRun.TotalSeconds*ȣ;}ʌ ƫ=
  743. new ʌ();public void Ƞ(){double ȟ=ǂ.Runtime.TimeSinceLastRun.TotalSeconds*ȣ+Ȣ;Ȣ=0;ȍ+=ȟ;Ȏ=(int)Math.Min((ȟ*60)*ȑ/(ȋ?5:1)-
  744. 1000);while(Ȍ.Count>=1){ɓ ñ=Ȍ[0];if(Ȏ-ǂ.Runtime.CurrentInstructionCount<=0)break;if(ñ.ɑ>ȍ){int Ȟ=(int)(60*(ñ.ɑ-ȍ));if(Ȟ>=100
  745. ){ǂ.Runtime.UpdateFrequency=UpdateFrequency.Update100;}else{if(Ȟ>=10||ȋ)ǂ.Runtime.UpdateFrequency=UpdateFrequency.
  746. Update10;else ǂ.Runtime.UpdateFrequency=UpdateFrequency.Update1;}break;}Ȍ.Remove(ñ);if(!ñ.ɇ())break;}}public int ȝ(){return(Ȑ-ǂ.
  747. Runtime.CurrentInstructionCount);}public bool Ȝ(int ț){return((Ȏ-ǂ.Runtime.CurrentInstructionCount)>=ț);}public void Ț(){Ȧ(ƫ.Ŧ(
  748. ).ʆ("Remaining Instr: ").ʆ(ȝ()));}}class ș:ɓ{MyShipVelocities Ș;public Vector3D ȫ{get{return Ș.LinearVelocity;}}public
  749. Vector3D ɂ{get{return Ș.AngularVelocity;}}double ɮ=0;public double ʃ{get{if(ɴ!=null)return ɴ.GetShipSpeed();else return ɮ;}}
  750. double ʁ=0;public double ʀ{get{return ʁ;}}double ɿ=0;public double ɾ{get{return ɿ;}}double ɽ=0;double ɼ=0;public double ɻ{get{
  751. return ɽ;}}MyShipMass ɺ;public double ɹ{get{return ɺ.TotalMass;}}public double ɸ{get{return ɺ.BaseMass;}}double ʂ=double.NaN;
  752. public double ɷ{get{return ʂ;}}double ɶ=double.NaN;public double ɵ{get{return ɶ;}}IMyShipController ɴ=null;IMySlimBlock ɳ=null
  753. ;public IMyShipController ɲ{get{return ɴ;}}Vector3D ɱ;public ș(ȓ ƕ){ɒ="ShipMgr";Ɠ=ƕ;ɱ=Ɠ.ǂ.Me.GetPosition();Ɏ=0.5;}List<
  754. IMyTerminalBlock>ɰ=new List<IMyTerminalBlock>();int ɯ=0;public override bool Ʉ(bool ë){if(!ë){ɰ.Clear();Ɠ.ǂ.GridTerminalSystem.
  755. GetBlocksOfType<IMyShipController>(ɰ);ɯ=0;if(ɴ!=null&&ɴ.CubeGrid.GetCubeBlock(ɴ.Position)!=ɳ)ɴ=null;}if(ɰ.Count>0){for(;ɯ<ɰ.Count;ɯ++){
  756. if(!Ɠ.Ȝ(20))return false;IMyShipController ʄ=ɰ[ɯ]as IMyShipController;if(ʄ.IsMainCockpit||ʄ.IsUnderControl){ɴ=ʄ;ɳ=ʄ.
  757. CubeGrid.GetCubeBlock(ʄ.Position);if(ʄ.IsMainCockpit){ɯ=ɰ.Count;break;}}}if(ɴ==null){ɴ=ɰ[0]as IMyShipController;ɳ=ɴ.CubeGrid.
  758. GetCubeBlock(ɴ.Position);}ɺ=ɴ.CalculateShipMass();if(!ɴ.TryGetPlanetElevation(MyPlanetElevation.Sealevel,out ʂ))ʂ=double.NaN;if(!ɴ.
  759. TryGetPlanetElevation(MyPlanetElevation.Surface,out ɶ))ɶ=double.NaN;Ș=ɴ.GetShipVelocities();}double ʈ=ɮ;ɮ=ȫ.Length();ʁ=(ɮ-ʈ)/ɏ;if(-ʁ>ɿ)ɿ=-ʁ;
  760. if(-ʁ>ɽ){ɽ=-ʁ;ɼ=Ɠ.ȏ;}if(Ɠ.ȏ-ɼ>5&&-ʁ>0.1)ɽ-=(ɽ+ʁ)*0.3f;return true;}}class ʌ{public StringBuilder ƫ;public ʌ(int ʋ=0){ƫ=new
  761. StringBuilder(ʋ);}public int ʊ{get{return ƫ.Length;}}public ʌ Ŧ(){ƫ.Clear();return this;}public ʌ ʆ(string ĩ){ƫ.Append(ĩ);return this
  762. ;}public ʌ ʆ(double ʉ){ƫ.Append(ʉ);return this;}public ʌ ʆ(char ǰ){ƫ.Append(ǰ);return this;}public ʌ ʆ(ʌ ʇ){ƫ.Append(ʇ.ƫ)
  763. ;return this;}public ʌ ʆ(string ĩ,int Ǿ,int ɔ){ƫ.Append(ĩ,Ǿ,ɔ);return this;}public ʌ ʆ(char ǰ,int Š){ƫ.Append(ǰ,Š);return
  764. this;}public ʌ ʅ(int Ǿ,int ɔ){ƫ.Remove(Ǿ,ɔ);return this;}public string ɕ(){return ƫ.ToString();}public string ɕ(int Ǿ,int ɔ)
  765. {return ƫ.ToString(Ǿ,ɔ);}public char this[int X]{get{return ƫ[X];}}}class ɓ{public string ɒ="MMTask";public double ɑ=0;
  766. public double ɐ=0;public double ɏ=0;public double Ɏ=-1;double ɍ=-1;public bool Ɍ=false;public bool ɋ=false;double Ɋ=0;
  767. protected ȓ Ɠ;public void ɉ(ȓ ƕ){Ɠ=ƕ;if(Ɠ.ȋ){if(ɍ==-1){ɍ=Ɏ;Ɏ*=2;}else{Ɏ=ɍ*2;}}else{if(ɍ!=-1){Ɏ=ɍ;ɍ=-1;}}}protected bool Ɉ(double
  768. ȇ){Ɋ=Math.Max(ȇ,0.0001);return true;}public bool ɇ(){if(ɐ>0){ɏ=Ɠ.ȏ-ɐ;Ɠ.Ȧ((ɋ?"Running":"Resuming")+" task: "+ɒ);ɋ=Ʉ(!ɋ);}
  769. else{ɏ=0;Ɠ.Ȧ("Init task: "+ɒ);Ʌ();Ɠ.Ȧ("Running..");ɋ=Ʉ(false);if(!ɋ)ɐ=0.001;}if(ɋ){ɐ=Ɠ.ȏ;if((Ɏ>=0||Ɋ>0)&&Ɍ)Ɠ.Ȉ(this,(Ɋ>0?Ɋ:Ɏ
  770. ));else{Ɍ=false;ɐ=0;}}else{if(Ɍ)Ɠ.Ȉ(this,0,true);}Ɠ.Ȧ("Task "+(ɋ?"":"NOT ")+"finished. "+(Ɍ?(Ɋ>0?"Postponed by "+Ɋ.
  771. ToString("F1")+"s":"Scheduled after "+Ɏ.ToString("F1")+"s"):"Stopped."));Ɋ=0;return ɋ;}public void Ɇ(){Ɠ.Ȩ(this);Ƀ();Ɍ=false;ɋ=
  772. false;ɐ=0;}public virtual void Ʌ(){}public virtual bool Ʉ(bool ë){return true;}public virtual void Ƀ(){}}class ɖ{public const
  773. float ɭ=512;public const float ɫ=ɭ/0.7783784f;public const float ɪ=ɭ/0.7783784f;public const float ɩ=ɫ;public const float ɨ=
  774. 37;public string ɧ="T:[LCD]";public int ɦ=1;public bool ɥ=true;public List<string>ɤ=null;public bool ɣ=true;public int Ȋ=0
  775. ;public float ɬ=1.0f;public float ɢ=1.0f;public float ɡ{get{return ɩ*ƺ.і;}}public float ɠ{get{return(float)ɡ-2*ɘ[ƹ]*â;}}
  776. string ɟ;string ɞ;float ɝ=-1;Dictionary<string,float>ɜ=new Dictionary<string,float>(2);Dictionary<string,float>ɛ=new
  777. Dictionary<string,float>(2);Dictionary<string,float>ɚ=new Dictionary<string,float>(2);public float ə{get{return ɚ[ƹ];}}Dictionary<
  778. string,float>ɘ=new Dictionary<string,float>(2);Dictionary<string,float>ɗ=new Dictionary<string,float>(2);Dictionary<string,
  779. float>Ȇ=new Dictionary<string,float>(2);int â=0;string á="";Dictionary<string,char>dž=new Dictionary<string,char>(2);
  780. Dictionary<string,char>Dž=new Dictionary<string,char>(2);Dictionary<string,char>DŽ=new Dictionary<string,char>(2);Dictionary<string,
  781. char>ǃ=new Dictionary<string,char>(2);public ȓ Ɠ;public MyGridProgram ǂ;public ȳ ǁ;public ϵ ő;public ș ǀ;public Ƈ Ə;public ǒ
  782. Ď;public IMyGridTerminalSystem ƿ{get{return ǂ.GridTerminalSystem;}}public IMyProgrammableBlock ƾ{get{return ǂ.Me;}}public
  783. Action<string>ƽ{get{return ǂ.Echo;}}public ɖ(MyGridProgram Ƽ,int ƻ,ȓ ƕ){Ɠ=ƕ;Ȋ=ƻ;ǂ=Ƽ;Ď=new ǒ();ǁ=new ȳ(ƕ,this);ő=new ϵ(ƕ,this);
  784. ő.Ѕ();ǀ=new ș(Ɠ);Ɠ.Ȉ(ǀ,0);}ї ƺ=null;public string ƹ{get{return ƺ.J;}}public bool Ƹ{get{return(ƺ.ť()==0);}}public bool LJ(
  785. IMyTerminalBlock å){if(å==null||å.WorldMatrix==MatrixD.Identity)return true;return ƿ.GetBlockWithId(å.EntityId)==null;}public ї Lj(ї ǐ,è
  786. n){n.R();IMyTextSurface G=n.ß;if(ǐ==null)ǐ=new ї(this);ǐ.J=G.Font;if(!ɘ.ContainsKey(ǐ.J))ǐ.J=ɟ;ǐ.і=(G.SurfaceSize.X/G.
  787. TextureSize.X)*(G.TextureSize.X/G.TextureSize.Y)*ɬ/G.FontSize*(100f-G.TextPadding*2)/100;á=n.á;â=n.â;ƺ=ǐ;return ǐ;}public ŝ Ǐ(ŝ æ,è
  788. n){n.R();IMyTextSurface G=n.ß;if(æ==null)æ=new ŝ(this);æ.ŕ(n.Ý);æ.Ŝ=n.U()*(G.SurfaceSize.Y/G.TextureSize.Y)*ɢ/G.FontSize*
  789. (100f-G.TextPadding*2)/100;æ.Ŕ();á=n.á;â=n.â;return æ;}public void Ǎ(){ƺ.ѓ();}public void Ǎ(ʌ ǎ){if(ƺ.ѕ<=0)ƺ.є(á);ƺ.є(ǎ);
  790. ƺ.ѓ();}public void Ǎ(string ǎ){if(ƺ.ѕ<=0)ƺ.є(á);ƺ.ѓ(ǎ);}public void nj(string Nj){ƺ.ѐ(Nj,á);}public void NJ(List<ʌ>lj){ƺ.ђ(lj);
  791. }public void ƃ(ʌ ƪ,bool Ƴ=true){if(ƺ.ѕ<=0)ƺ.є(á);ƺ.є(ƪ);if(Ƴ)ƺ.ѕ+=Ǟ(ƪ,ƺ.J);}public void ƃ(string ĸ,bool Ƴ=true){if(ƺ.ѕ<=0
  792. )ƺ.є(á);ƺ.є(ĸ);if(Ƴ)ƺ.ѕ+=Ǟ(ĸ,ƺ.J);}public void ƴ(ʌ ƪ,float ƨ=1.0f,float Ƨ=0f){Ʃ(ƪ,ƨ,Ƨ);ƺ.ѓ();}public void ƴ(string ĸ,
  793. float ƨ=1.0f,float Ƨ=0f){Ʃ(ĸ,ƨ,Ƨ);ƺ.ѓ();}ʌ ƫ=new ʌ();public void Ʃ(ʌ ƪ,float ƨ=1.0f,float Ƨ=0f){float Ʀ=Ǟ(ƪ,ƺ.J);float ƥ=ƨ*ɩ*
  794. ƺ.і-ƺ.ѕ-Ƨ;if(â>0)ƥ-=2*ɘ[ƺ.J]*â;if(ƥ<Ʀ){ƺ.є(ƪ);ƺ.ѕ+=Ʀ;return;}ƥ-=Ʀ;int Ƥ=(int)Math.Floor(ƥ/ɘ[ƺ.J]);float ƣ=Ƥ*ɘ[ƺ.J];ƫ.Ŧ().
  795. ʆ(' ').ʆ(ƪ);ƺ.є(ƫ);ƺ.ѕ+=ƣ+Ʀ;}public void Ʃ(string ĸ,float ƨ=1.0f,float Ƨ=0f){float Ʀ=Ǟ(ĸ,ƺ.J);float ƥ=ƨ*ɩ*ƺ.і-ƺ.ѕ-Ƨ;if(
  796. â>0)ƥ-=2*ɘ[ƺ.J]*â;if(ƥ<Ʀ){ƺ.є(ĸ);ƺ.ѕ+=Ʀ;return;}ƥ-=Ʀ;int Ƥ=(int)Math.Floor(ƥ/ɘ[ƺ.J]);float ƣ=Ƥ*ɘ[ƺ.J];ƫ.Ŧ().ʆ(' ').ʆ(ĸ)
  797. ;ƺ.є(ƫ);ƺ.ѕ+=ƣ+Ʀ;}public void Ƣ(ʌ ƪ){Ʒ(ƪ);ƺ.ѓ();}public void Ƣ(string ĸ){Ʒ(ĸ);ƺ.ѓ();}public void Ʒ(ʌ ƪ){float Ʀ=Ǟ(ƪ,ƺ.J);
  798. float ƶ=ɩ/2*ƺ.і-ƺ.ѕ;if(ƶ<Ʀ/2){ƺ.є(ƪ);ƺ.ѕ+=Ʀ;return;}ƶ-=Ʀ/2;int Ƥ=(int)Math.Round(ƶ/ɘ[ƺ.J],MidpointRounding.AwayFromZero);
  799. float ƣ=Ƥ*ɘ[ƺ.J];ƫ.Ŧ().ʆ(' ').ʆ(ƪ);ƺ.є(ƫ);ƺ.ѕ+=ƣ+Ʀ;}public void Ʒ(string ĸ){float Ʀ=Ǟ(ĸ,ƺ.J);float ƶ=ɩ/2*ƺ.і-ƺ.ѕ;if(ƶ<Ʀ/2){
  800. ƺ.є(ĸ);ƺ.ѕ+=Ʀ;return;}ƶ-=Ʀ/2;int Ƥ=(int)Math.Round(ƶ/ɘ[ƺ.J],MidpointRounding.AwayFromZero);float ƣ=Ƥ*ɘ[ƺ.J];ƫ.Ŧ().ʆ(' '
  801. ).ʆ(ĸ);ƺ.є(ƫ);ƺ.ѕ+=ƣ+Ʀ;}public void Ƶ(double Ʈ,float ƭ=1.0f,float Ƨ=0f,bool Ƴ=true){if(â>0)Ƨ+=2*â*ɘ[ƺ.J];float Ʋ=ɩ*ƭ*ƺ.і-
  802. ƺ.ѕ-Ƨ;if(Double.IsNaN(Ʈ))Ʈ=0;int Ʊ=(int)(Ʋ/ɗ[ƺ.J])-2;if(Ʊ<=0)Ʊ=2;int ư=Math.Min((int)(Ʈ*Ʊ)/100);if(ư<0)ư=0;if(ƺ.ѕ<=0)ƺ.
  803. є(á);ƫ.Ŧ().ʆ(dž[ƺ.J]).ʆ(ǃ[ƺ.J]).ʆ(DŽ[ƺ.J]-ư).ʆ(Dž[ƺ.J]);ƺ.є(ƫ);if(Ƴ)ƺ.ѕ+=ɗ[ƺ.J]*Ʊ+2*Ȇ[ƺ.J];}public void Ư(double Ʈ,float
  804. ƭ=1.0f,float Ƨ=0f){Ƶ(Ʈ,ƭ,Ƨ,false);ƺ.ѓ();}public void Ƭ(){ƺ.Ƭ();}public void Ǒ(è E,ŝ L=null){E.N(L);if(E.é)E.æ.ĺ();}public
  805. void Ƿ(string Ƕ,string ĸ){IMyTextPanel E=ǂ.GridTerminalSystem.GetBlockWithName(Ƕ)as IMyTextPanel;if(E==null)return;E.
  806. WriteText(ĸ+"\n",true);}public string ǵ(MyInventoryItem À){string Ǵ=À.Type.TypeId.ToString();Ǵ=Ǵ.Substring(Ǵ.LastIndexOf('_')+1);
  807. return À.Type.SubtypeId+" "+Ǵ;}public void dz(string Ò,out string Ð,out string Ï){int š=Ò.LastIndexOf(' ');if(š>=0){Ð=Ò.
  808. Substring(0);Ï=Ò.Substring(š+1);return;}Ð=Ò;Ï="";}public string Dz(string Ò){string Ð,Ï;dz(Ò,out Ð,out Ï);return Dz(Ð,Ï);}public
  809. string Dz(string Ð,string Ï){Î À=Ə.Ñ(Ð,Ï);if(À!=null){if(À.Ê.Length>0)return À.Ê;return À.Í;}return System.Text.
  810. RegularExpressions.Regex.Replace(Ð,"([a-z])([A-Z])","$1 $2");}public void DZ(ref string Ð,ref string Ï){Î À;if(Ə.Ƅ.TryGetValue(Ð,out À)){Ð=
  811. À.Í;Ï=À.Ì;return;}À=Ə.Ñ(Ð,Ï);if(À!=null){Ð=À.Í;if((string.Compare(Ï,"Ore",true)==0)||(string.Compare(Ï,"Ingot",true)==0))
  812. return;Ï=À.Ì;}}public string ȅ(double Ȃ,bool ȁ=true,char Ȅ=' '){if(!ȁ)return Ȃ.ToString(
  813. "#,###,###,###,###,###,###,###,###,###");string Ȁ=" kMGTPEZY";double ǿ=Ȃ;int Ǿ=Ȁ.IndexOf(Ȅ);var ǽ=(Ǿ<0?0:Ǿ);while(ǿ>=1000&&ǽ+1<Ȁ.Length){ǿ/=1000;ǽ++;}ƫ.Ŧ().ʆ(
  814. Math.Round(ǿ,1,MidpointRounding.AwayFromZero));if(ǽ>0)ƫ.ʆ(" ").ʆ(Ȁ[ǽ]);return ƫ.ɕ();}public string ȃ(double Ȃ,bool ȁ=true,
  815. char Ȅ=' '){if(!ȁ)return Ȃ.ToString("#,###,###,###,###,###,###,###,###,###");string Ȁ=" ktkMGTPEZY";double ǿ=Ȃ;int Ǿ=Ȁ.
  816. IndexOf(Ȅ);var ǽ=(Ǿ<0?0:Ǿ);while(ǿ>=1000&&ǽ+1<Ȁ.Length){ǿ/=1000;ǽ++;}ƫ.Ŧ().ʆ(Math.Round(ǿ,1,MidpointRounding.AwayFromZero));if(
  817. ǽ==1)ƫ.ʆ(" kg");else if(ǽ==2)ƫ.ʆ(" t");else if(ǽ>2)ƫ.ʆ(" ").ʆ(Ȁ[ǽ]).ʆ("t");return ƫ.ɕ();}public string Ǽ(double Ʈ){return
  818. (Math.Floor(Ʈ*10)/10).ToString("F1");}Dictionary<char,float>ǻ=new Dictionary<char,float>();void Ǻ(string ǹ,float K){K+=1;
  819. for(int F=0;F<ǹ.Length;F++){if(K>ɜ[ɟ])ɜ[ɟ]=K;ǻ.Add(ǹ[F],K);}}public float Ǹ(char ǰ,string J){float Ʋ;if(J==ɞ||!ǻ.
  820. TryGetValue(ǰ,out Ʋ))return ɜ[J];return Ʋ;}public float Ǟ(ʌ ǟ,string J){if(J==ɞ)return ǟ.ʊ*ɜ[J];float ǝ=0;for(int F=0;F<ǟ.ʊ;F++)ǝ+=
  821. Ǹ(ǟ[F],J);return ǝ;}public float Ǟ(string ĩ,string J){if(J==ɞ)return ĩ.Length*ɜ[J];float ǝ=0;for(int F=0;F<ĩ.Length;F++)ǝ
  822. +=Ǹ(ĩ[F],J);return ǝ;}public string ǜ(string ĸ,float Ǜ){if(Ǜ/ɜ[ƺ.J]>=ĸ.Length)return ĸ;float ǚ=Ǟ(ĸ,ƺ.J);if(ǚ<=Ǜ)return ĸ;
  823. float Ǚ=ǚ/ĸ.Length;Ǜ-=ɛ[ƺ.J];int ǘ=(int)Math.Max(Ǜ/Ǚ,1);if(ǘ<ĸ.Length/2){ƫ.Ŧ().ʆ(ĸ,0);ǚ=Ǟ(ƫ,ƺ.J);}else{ƫ.Ŧ().ʆ(ĸ);ǘ=ĸ.
  824. Length;}while(ǚ>Ǜ&&ǘ>1){ǘ--;ǚ-=Ǹ(ĸ[ǘ].J);}if(ƫ.ʊ>ǘ)ƫ.ʅ(ǘ,ƫ.ʊ-ǘ);return ƫ.ʆ("..").ɕ();}void Ǘ(string ǖ){ɟ=ǖ;dž[ɟ]=MMStyle.
  825. BAR_START;Dž[ɟ]=MMStyle.BAR_END;DŽ[ɟ]=MMStyle.BAR_EMPTY;ǃ[ɟ]=MMStyle.BAR_FILL;ɜ[ɟ]=0f;}void Ǖ(string ǔ,float Ǔ){ɞ=ǔ;ɝ=Ǔ;ɜ[ɞ]=ɝ+1;ɛ[
  826. ɞ]=2*(ɝ+1);dž[ɞ]=MMStyle.BAR_MONO_START;Dž[ɞ]=MMStyle.BAR_MONO_END;DŽ[ɞ]=MMStyle.BAR_MONO_EMPTY;ǃ[ɞ]=MMStyle.BAR_MONO_FILL;ɘ
  827. [ɞ]=Ǹ(' ');ɗ[ɞ]=Ǹ(DŽ[ɞ]);Ȇ[ɞ]=Ǹ(dž[ɞ]);ɚ[ɞ]=Ǟ(" 100.0%");}public void Ǡ(){if(ǻ.Count>0)return;
  828. // Monospace font name, width of single character
  829. // Change this if you want to use different (modded) monospace font
  830. Ǖ("Monospace", 24f);
  831.  
  832. // Classic/Debug font name (uses widths of characters below)
  833. // Change this if you want to use different font name (non-monospace)
  834. Ǘ("Debug");
  835. // Font characters width (font "aw" values here)
  836. Ǻ("3FKTabdeghknopqsuy£µÝàáâãäåèéêëðñòóôõöøùúûüýþÿāăąďđēĕėęěĝğġģĥħĶķńņňʼnōŏőśŝşšŢŤŦũūŭůűųŶŷŸșȚЎЗКЛбдекруцяёђћўџ", 17f);
  837. Ǻ("ABDNOQRSÀÁÂÃÄÅÐÑÒÓÔÕÖØĂĄĎĐŃŅŇŌŎŐŔŖŘŚŜŞŠȘЅЊЖф□", 21f);
  838. Ǻ("#0245689CXZ¤¥ÇßĆĈĊČŹŻŽƒЁЌАБВДИЙПРСТУХЬ€", 19f);
  839. Ǻ("¥$&GHPUVY§ÙÚÛÜÞĀĜĞĠĢĤĦŨŪŬŮŰŲОФЦЪЯжы†‡", 20f);
  840. Ǻ("! !I`ijl ¡¨¯´¸ÌÍÎÏìíîïĨĩĪīĮįİıĵĺļľłˆˇ˘˙˚˛˜˝ІЇії‹›∙", 8f);
  841. Ǻ("?7?Jcz¢¿çćĉċčĴźżžЃЈЧавийнопсъьѓѕќ", 16f);
  842. Ǻ("():《》,。、;【】(),.1:;[]ft{}·ţťŧț", 9f);
  843. Ǻ("+<=>E^~¬±¶ÈÉÊË×÷ĒĔĖĘĚЄЏЕНЭ−", 18f);
  844. Ǻ("L_vx«»ĹĻĽĿŁГгзлхчҐ–•", 15f);
  845. Ǻ("\"-rª­ºŀŕŗř", 10f);
  846. Ǻ("WÆŒŴ—…‰", 31f);
  847. Ǻ("'|¦ˉ‘’‚", 6f);
  848. Ǻ("@©®мшњ", 25f);
  849. Ǻ("mw¼ŵЮщ", 27f);
  850. Ǻ("/ijтэє", 14f);
  851. Ǻ("\\°“”„", 12f);
  852. Ǻ("*²³¹", 11f);
  853. Ǻ("¾æœЉ", 28f);
  854. Ǻ("%IJЫ", 24f);
  855. Ǻ("MМШ", 26f);
  856. Ǻ("½Щ", 29f);
  857. Ǻ("ю", 23f);
  858. Ǻ("ј", 7f);
  859. Ǻ("љ", 22f);
  860. Ǻ("ґ", 13f);
  861. Ǻ("™", 30f);
  862. // End of font characters width
  863.         ɘ[ɟ]=Ǹ(' ');ɗ[ɟ]=Ǹ(DŽ[ɟ]);Ȇ[ɟ]=Ǹ(dž[ɟ]);ɚ[ɟ]=Ǟ(" 100.0%");ɛ[ɟ]=Ǹ('.')*2;}}class ǒ{public string ǡ(string
  864. ǯ){return TT[ǯ];}
  865. readonly Dictionary<string, string> TT = new Dictionary<string, string>
  866. {
  867. // TRANSLATION STRINGS
  868. // msg id, text
  869. { "AC1", "Acceleration:" },
  870. // amount
  871. { "A1", "EMPTY" },
  872. { "ALT1", "Altitude:"},
  873. { "ALT2", "Ground:"},
  874. { "B1", "Uruchamianie..." },
  875. { "C1", "count:" },
  876. { "C2", "Cargo Used:" },
  877. { "C3", "Invalid countdown format, use:" },
  878. { "C4", "EXPIRED" },
  879. { "C5", "dni" },
  880. // customdata
  881. { "CD1", "Block not found: " },
  882. { "CD2", "Missing block name" },
  883. { "D1", "You need to enter name." },
  884. { "D2", "No blocks found." },
  885. { "D3", "No damaged blocks found." },
  886. { "DO1", "No connectors found." }, // NEW
  887. { "DTU", "Invalid GPS format" },
  888. { "GA", "Artif."}, // (not more than 5 characters)
  889. { "GN", "Natur."}, // (not more than 5 characters)
  890. { "GT", "Total"}, // (not more than 5 characters)
  891. { "G1", "Total Gravity:"},
  892. { "G2", "Natur. Gravity:"},
  893. { "G3", "Artif. Gravity:"},
  894. { "GNC", "No cockpit!"},
  895. { "H1", "Write commands to Custom Data of this panel." },
  896. // inventory
  897. { "I1", "ruda" },
  898. { "I2", "" },
  899. { "I3", "Rudy" },
  900. { "I4", "Sztabki" },
  901. { "I5", "Komponenty" },
  902. { "I6", "Gas" },
  903. { "I7", "Amunicja"},
  904. { "I8", "Narzędzia" },
  905. { "M1", "Masa lad.:" },
  906. // oxygen
  907. { "O1", "Leaking" },
  908. { "O2", "Oxygen Farms" },
  909. { "O3", "No oxygen blocks found." },
  910. { "O4", "Oxygen Tanks" },
  911. // position
  912. { "P1", "Block not found" },
  913. { "P2", "Location" },
  914. // power
  915. { "P3", "Stored" },
  916. { "P4", "Output" },
  917. { "P5", "Input" },
  918. { "P6", "Brak zrodl. zasil." },
  919. { "P7", "Baterie"},
  920. { "P8", "Total Output" },
  921. { "P9", "Reactors" },
  922. { "P10", "Solars" },
  923. { "P11", "Power" },
  924. { "P12", "Engines" }, // NEW!
  925. { "P13", "Turbines" }, // NEW!
  926. { "PT1", "Czas Zasilania:" },
  927. { "PT2", "Czas Ladowania:" },
  928. { "PU1", "Power Used:" },
  929. { "S1", "Prędkość:" },
  930. { "SM1", "Masa Statku:" },
  931. { "SM2", "Masa Podst. Statku:" },
  932. { "SD", "Dystans zatrzym.:" },
  933. { "ST", "Czas zatrzym.:" },
  934. // text
  935. { "T1", "Source LCD not found: " },
  936. { "T2", "Missing source LCD name" },
  937. // tanks
  938. { "T4", "Missing tank type. eg: 'Tanks * Hydrogen'" },
  939. { "T5", "No {0} tanks found." }, // {0} is tank type
  940. { "UC", "Unknown command" },
  941. // occupied & dampeners
  942. { "SC1", "Cannot find control block." },
  943. { "SCD", "Dampeners: " },
  944. { "SCO", "Occupied: " },
  945. // working
  946. { "W1", "OFF" },
  947. { "W2", "WORK" },
  948. { "W3", "IDLE" },
  949. { "W4", "LEAK" },
  950. { "W5", "OPEN" },
  951. { "W6", "CLOSED" },
  952. { "W7", "LOCK" },
  953. { "W8", "UNLOCK" },
  954. { "W9", "ON" },
  955. { "W10", "READY" }
  956. };
  957.     }
  958. }static class Ǯ{public static bool ǭ(this string ĩ,string ǫ){return ĩ.StartsWith(ǫ,StringComparison.
  959. InvariantCultureIgnoreCase);}public static bool Ǭ(this string ĩ,string ǫ){if(ĩ==null)return false;return ĩ.IndexOf(ǫ,StringComparison.
  960. InvariantCultureIgnoreCase)>=0;}public static bool Ǫ(this string ĩ,string ǫ){return ĩ.EndsWith(ǫ,StringComparison.InvariantCultureIgnoreCase);}}
  961. static class ǩ{public static string Ǩ(this IMyTerminalBlock å){int Ū=å.CustomData.IndexOf("\n---\n");if(Ū<0){if(å.CustomData.
  962. StartsWith("---\n"))return å.CustomData.Substring(4);return å.CustomData;}return å.CustomData.Substring(Ū+5);}public static string
  963. ǧ(this IMyTerminalBlock å,int š,string Ǧ){string ǥ=å.Ǩ();string Ǥ="@"+š.ToString()+" AutoLCD";string ǣ='\n'+Ǥ;int Ū=0;if(
  964. !ǥ.StartsWith(Ǥ,StringComparison.InvariantCultureIgnoreCase)){Ū=ǥ.IndexOf(ǣ,StringComparison.InvariantCultureIgnoreCase);
  965. }if(Ū<0){if(š==0){if(ǥ.Length==0)return"";if(ǥ[0]=='@')return null;Ū=ǥ.IndexOf("\n@");if(Ū<0)return ǥ;return ǥ.Substring(
  966. 0);}else return null;}int Ǣ=ǥ.IndexOf("\n@"+1);if(Ǣ<0){if(Ū==0)return ǥ;return ǥ.Substring(Ū+1);}if(Ū==0)return ǥ.
  967. Substring(0);return ǥ.Substring(Ū+1-Ū);}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement