Advertisement
L0v0lup

Untitled

Nov 16th, 2020
639
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 94.36 KB | None | 0 0
  1.  
  2. // Isy's Inventory Manager
  3. // ===================
  4. // Version: 2.8.2
  5. // Date: 2020-06-01
  6.  
  7. // Guide: http://steamcommunity.com/sharedfiles/filedetails/?id=1226261795
  8.  
  9. // =======================================================================================
  10. // --- Configuration ---
  11. // =======================================================================================
  12.  
  13. // --- Sorting ---
  14. // =======================================================================================
  15.  
  16. // Define the keyword a cargo container has to contain in order to be recognized as a container of the given type.
  17. const string oreContainerKeyword = "Ore";
  18. const string ingotContainerKeyword = "Ingot";
  19. const string componentContainerKeyword = "Rest";
  20. const string toolContainerKeyword = "Rest";
  21. const string ammoContainerKeyword = "Rest";
  22. const string bottleContainerKeyword = "Bottle";
  23.  
  24. // Keyword a block name has to contain to be skipped by the sorting (= no items will be taken out).
  25. // This list is expandable - just separate the entries with a ",". But it's also language specific, so adjust it if needed.
  26. // Default: string[] lockedContainerKeywords = { "Locked", "Seat", "Control Station" };
  27. string[] lockedContainerKeywords = { "Locked", "Seat", "Control Station" };
  28.  
  29. // Keyword a block name has to contain to be excluded from item counting (used by autocrafting and inventory panels)
  30. // This list is expandable - just separate the entries with a ",". But it's also language specific, so adjust it if needed.
  31. // Default: string[] hiddenContainerKeywords = { "Hidden" };
  32. string[] hiddenContainerKeywords = { "Hidden" };
  33.  
  34. // Keyword for connectors to disable sorting of a grid, that is docked to that connector.
  35. // This also disables the usage of refineries, arc furnaces and assemblers on that grid.
  36. // Special containers, reactors and O2/H2 generators will still be filled.
  37. string noSortingKeyword = "[No Sorting]";
  38.  
  39. // Keyword for connectors to disable IIM completely for a ship, that is docked to that connector.
  40. string noIIMKeyword = "[No IIM]";
  41.  
  42. // Balance items between containers of the same type? This will result in an equal amount of all items in all containers of that type.
  43. bool balanceTypeContainers = true;
  44.  
  45. // Show a fill level in the container's name?
  46. bool showFillLevel = true;
  47.  
  48. // Fill bottles before storing them in the bottle container?
  49. bool fillBottles = true;
  50.  
  51.  
  52. // --- Automated container assignment ---
  53. // =======================================================================================
  54.  
  55. // Master switch. If this is set to false, automated container un-/assignment is disabled entirely.
  56. bool autoContainerAssignment = false;
  57.  
  58. // Assign new containers if a type is full or not present?
  59. bool assignNewContainers = true;
  60.  
  61. // Unassign empty type containers that aren't needed anymore (at least one of each type always remains).
  62. // This doesn't touch containers with manual priority tokens, like [P1].
  63. bool unassignEmptyContainers = true;
  64.  
  65. // Assign ores and ingots containers as one?
  66. bool oresIngotsInOne = false;
  67.  
  68. // Assign tool, ammo and bottle containers as one?
  69. bool toolsAmmoBottlesInOne = true;
  70.  
  71.  
  72. // --- Autocrafting ---
  73. // =======================================================================================
  74.  
  75. // Enable autocrafting or autodisassembling (disassembling will disassemble everything above the wanted amounts)
  76. // All assemblers will be used. To use one manually, add the manualMachineKeyword to it (by default: "!manual")
  77. bool enableAutocrafting = true;
  78. bool enableAutodisassembling = false;
  79.  
  80. // A LCD with the keyword "Autocrafting" is required where you can set the wanted amount!
  81. // This has multi LCD support. Just append numbers after the keyword, like: "LCD Autocrafting 1", "LCD Autocrafting 2", ..
  82. string autocraftingKeyword = "Autocrafting";
  83.  
  84. // If you want an assembler to only assemble or only disassemble, use the following keywords in its name.
  85. // A assembler without a keyword will do both tasks
  86. string assembleKeyword = "!assemble-only";
  87. string disassembleKeyword = "!disassemble-only";
  88.  
  89. // You can teach the script new crafting recipes, by adding one of the following tags to an assembler's name.
  90. // This is needed if the autocrafting screen shows [NoBP] for an item. There are two tag options to teach new blueprints:
  91. // !learn will learn one item and then remove the tag so that the assembler is part of the autocrafting again.
  92. // !learnMany will learn everything you queue in it and will never be part of the autorafting again until you remove the tag.
  93. // To learn an item, queue it up about 100 times (Shift+Klick) and wait until the script removes it from the queue.
  94. string learnKeyword = "!learn";
  95. string learnManyKeyword = "!learnMany";
  96.  
  97. // Margins for assembling or disassembling items in percent based on the wanted amount (default: 0 = exact value).
  98. // Examples:
  99. // assembleMargin = 5 with a wanted amount of 100 items will only produce new items, if less than 95 are available.
  100. // disassembleMargin = 10 with a wanted amount of 1000 items will only disassemble items if more than 1100 are available.
  101. double assembleMargin = 0;
  102. double disassembleMargin = 0;
  103.  
  104. // Add the header to every screen when using multiple autocrafting LCDs?
  105. bool headerOnEveryScreen = false;
  106.  
  107. // Show available modifiers help on the last screen?
  108. bool showAutocraftingModifiers = true;
  109.  
  110. // Sort the assembler queue based on the most needed components?
  111. bool sortAssemblerQueue = true;
  112.  
  113. // Autocraft ingots from stone in survival kits until you have proper refineries?
  114. bool enableBasicIngotCrafting = true;
  115.  
  116. // Disable autocrafting in survival kits when you have regular assemblers?
  117. bool disableBasicAutocrafting = true;
  118.  
  119.  
  120. // --- Special Loadout Containers ---
  121. // =======================================================================================
  122.  
  123. // Keyword an inventory has to contain to be filled with a special loadout (see in it's custom data after you renamed it!)
  124. // Special containers will be filled with your wanted amount of items and never be drained by the auto sorting!
  125. const string specialContainerKeyword = "Special";
  126.  
  127. // Are special containers allowed to 'steal' items from other special containers with a lower priority?
  128. bool allowSpecialSteal = true;
  129.  
  130.  
  131. // --- Refinery handling ---
  132. // =======================================================================================
  133.  
  134. // By enabling ore balancing, the script will balance the ores between all refinieres so that every refinery has the same amount of ore in it.
  135. // To still use a refinery manually, add the manualMachineKeyword to it (by default: "!manual")
  136. bool enableOreBalancing = true;
  137.  
  138. // Enable script assisted refinery filling? This will move in the most needed ore and will make room, if the refinery is already full
  139. // Also, the script puts as many ores into the refinery as possible and will pull ores even from other refineries if needed.
  140. bool enableScriptRefineryFilling = false;
  141.  
  142. // Sort the refinery queue based on the most needed ingots?
  143. bool sortRefiningQueue = false;
  144.  
  145. // If you want an ore to always be refined first, simply remove the two // in front of the ore name to enable it.
  146. // Enabled ores are refined in order from top to bottom so if you removed several // you can change the order by
  147. // copying and pasting them inside the list. Just be careful to keep the syntax correct: "OreName",
  148. // By default stone is enabled and will always be refined first.
  149. List<String> fixedRefiningList = new List<string> {
  150. //"Stone",
  151. //"Iron",
  152. //"Nickel",
  153. //"Cobalt",
  154. //"Silicon",
  155. //"Uranium",
  156. //"Silver",
  157. //"Gold",
  158. //"Platinum",
  159. //"Magnesium",
  160. //"Scrap",
  161. };
  162.  
  163.  
  164. // --- O2/H2 generator handling ---
  165. // =======================================================================================
  166.  
  167. // Enable balancing of ice in O2/H2 generators?
  168. // All O2/H2 generators will be used. To use one manually, add the manualMachineKeyword to it (by default: "!manual")
  169. bool enableIceBalancing = true;
  170.  
  171. // Put ice into O2/H2 generators that are turned off? (default: false)
  172. bool fillOfflineGenerators = false;
  173.  
  174. // Ice fill level in percent in order to be able to fill bottles? (default: 90)
  175. // Note: O2/H2 generators will pull more ice automatically if value is below 60%
  176. double iceFillLevelPercentage = 90;
  177.  
  178.  
  179. // --- Reactor handling ---
  180. // =======================================================================================
  181.  
  182. // Enable balancing of uranium in reactors? (Note: conveyors of reactors are turned off to stop them from pulling more)
  183. // All reactors will be used. To use one manually, add the manualMachineKeyword to it (by default: "!manual")
  184. bool enableUraniumBalancing = true;
  185.  
  186. // Put uranium into reactors that are turned off? (default: false)
  187. bool fillOfflineReactors = false;
  188.  
  189. // Amount of uranium in each reactor? (default: 100 for large grid reactors, 25 for small grid reactors)
  190. double uraniumAmountLargeGrid = 100;
  191. double uraniumAmountSmallGrid = 25;
  192.  
  193.  
  194. // --- Assembler Cleanup ---
  195. // =======================================================================================
  196.  
  197. // This cleans up assemblers, if they have no queue and puts the contents back into a cargo container.
  198. bool enableAssemblerCleanup = true;
  199.  
  200.  
  201. // --- Internal item sorting ---
  202. // =======================================================================================
  203.  
  204. // Sort the items inside all containers?
  205. // Note, that this could cause inventory desync issues in multiplayer, so that items are invisible
  206. // or can't be taken out. Use at your own risk!
  207. bool enableInternalSorting = true;
  208.  
  209. // Internal sorting pattern. Always combine one of each category, e.g.: 'Ad' for descending item amount (from highest to lowest)
  210. // 1. Quantifier:
  211. // A = amount
  212. // N = name
  213. // T = type (alphabetical)
  214. // X = type (number of items)
  215.  
  216. // 2. Direction:
  217. // a = ascending
  218. // d = descending
  219.  
  220. string sortingPattern = "Ad";
  221.  
  222. // Internal sorting can also be set per inventory. Just use '(sort:PATTERN)' in the block's name.
  223. // Example: Small Cargo Container 3 (sort:Ad)
  224. // Note: Using this method, internal sorting will always be activated for this container, even if the main switch is turned off!
  225.  
  226.  
  227. // --- LCD panels ---
  228. // =======================================================================================
  229.  
  230. // To display the main script informations, add the following keyword to any LCD name (default: !IIM-main).
  231. // You can enable or disable specific informations on the LCD by editing its custom data.
  232. string mainLCDKeyword = "!IIM-main";
  233.  
  234. // To display current item amounts of different types, add the following keyword to any LCD name
  235. // and follow the on screen instructions.
  236. string inventoryLCDKeyword = "!IIM-inventory";
  237.  
  238. // To display all current warnings and problems, add the following keyword to any LCD name (default: IIM-warnings).
  239. string warningsLCDKeyword = "!IIM-warnings";
  240.  
  241. // To display the script performance (PB terminal output), add the following keyword to any LCD name (default: !IIM-performance).
  242. string performanceLCDKeyword = "!IIM-performance";
  243.  
  244. // Default screen font, fontsize and padding, when a screen is first initialized. Fonts: "Debug" or "Monospace"
  245. string defaultFont = "Debug";
  246. float defaultFontSize = 0.6f;
  247. float defaultPadding = 2f;
  248.  
  249.  
  250. // --- Settings for enthusiasts ---
  251. // =======================================================================================
  252.  
  253. // Extra breaks between script methods in ticks (1 tick = 16.6ms).
  254. double extraScriptTicks = 0;
  255.  
  256. // Use dynamic script speed? The script will slow down automatically if the current runtime exceeds a set value (default: 0.5ms)
  257. bool useDynamicScriptSpeed = true;
  258. double maxCurrentMs = 0.5;
  259.  
  260. // Exclude welders or grinders from sorting? Set this to true, if you have huge welder or grinder walls!
  261. bool excludeWelders = false;
  262. bool excludeGrinders = false;
  263.  
  264. // Enable connection check for inventories (needed for [No Conveyor] info)?
  265. bool connectionCheck = false;
  266.  
  267. // Tag inventories, that have no access to the main type containers with [No Conveyor]?
  268. // This only works if the above setting connectionCheck is set to true!
  269. bool showNoConveyorTag = true;
  270.  
  271. // Script mode: "ship", "station" or blank for autodetect
  272. string scriptMode = "";
  273.  
  274. // Protect type containers when docking to another grid running the script?
  275. bool protectTypeContainers = true;
  276.  
  277. // If you want to use a machine manually, append the keyword to it.
  278. // This works for assemblers, refineries, reactors and O2/H2 generators
  279. string manualMachineKeyword = "!manual";
  280.  
  281. // Enable name correction? This option will automtically correct capitalization, e.g.: !iim-main -> !IIM-main
  282. bool enableNameCorrection = true;
  283.  
  284.  
  285. // =======================================================================================
  286. // --- End of Configuration ---
  287. // Don't change anything beyond this point!
  288. // =======================================================================================
  289.  
  290.  
  291. List<IMyTerminalBlock>ɐ=new List<IMyTerminalBlock>();List<IMyTerminalBlock>ɏ=new List<IMyTerminalBlock>();List<
  292. IMyTerminalBlock>ɍ=new List<IMyTerminalBlock>();List<IMyTerminalBlock>ɑ=new List<IMyTerminalBlock>();List<IMyTerminalBlock>ɢ=new List<
  293. IMyTerminalBlock>();List<IMyTerminalBlock>ʄ=new List<IMyTerminalBlock>();List<IMyTerminalBlock>ʂ=new List<IMyTerminalBlock>();List<
  294. IMyTerminalBlock>ʁ=new List<IMyTerminalBlock>();List<IMyShipConnector>ʀ=new List<IMyShipConnector>();List<IMyRefinery>ɿ=new List<
  295. IMyRefinery>();List<IMyRefinery>ɾ=new List<IMyRefinery>();List<IMyRefinery>ɽ=new List<IMyRefinery>();List<IMyRefinery>ʃ=new List<
  296. IMyRefinery>();List<IMyAssembler>ɼ=new List<IMyAssembler>();List<IMyAssembler>ɺ=new List<IMyAssembler>();List<IMyAssembler>ɹ=new
  297. List<IMyAssembler>();List<IMyAssembler>ɸ=new List<IMyAssembler>();List<IMyGasGenerator>ɷ=new List<IMyGasGenerator>();List<
  298. IMyGasTank>ɶ=new List<IMyGasTank>();List<IMyReactor>ɵ=new List<IMyReactor>();List<IMyTextPanel>ɻ=new List<IMyTextPanel>();List<
  299. string>ʅ=new List<string>();HashSet<IMyCubeGrid>ʍ=new HashSet<IMyCubeGrid>();HashSet<IMyCubeGrid>ʖ=new HashSet<IMyCubeGrid>();
  300. List<IMyTerminalBlock>ʔ=new List<IMyTerminalBlock>();List<IMyTerminalBlock>ʓ=new List<IMyTerminalBlock>();List<
  301. IMyTerminalBlock>ʒ=new List<IMyTerminalBlock>();List<IMyTerminalBlock>ʑ=new List<IMyTerminalBlock>();List<IMyTerminalBlock>ʐ=new List<
  302. IMyTerminalBlock>();List<IMyTerminalBlock>ʏ=new List<IMyTerminalBlock>();List<IMyTerminalBlock>ʕ=new List<IMyTerminalBlock>();string[]ʎ=
  303. {oreContainerKeyword,ingotContainerKeyword,componentContainerKeyword,toolContainerKeyword,ammoContainerKeyword,
  304. bottleContainerKeyword};string ʌ="";IMyTerminalBlock ʋ;IMyInventory ʊ;IMyTerminalBlock ʉ;bool ʈ=false;int ʇ=0;int ʆ=0;int ɴ=0;int ɳ=0;int ɒ=0;
  305. int ɠ=0;int ɟ=0;int ɞ=0;int ɝ=0;int ɜ=0;int ɛ=0;int ɡ=0;int ɚ=0;int ɘ=0;string ɗ="";string[]ɖ={"/","-","\\","|"};int ɕ=0;
  306. List<IMyTerminalBlock>ɔ=new List<IMyTerminalBlock>();List<IMyTerminalBlock>ɓ=new List<IMyTerminalBlock>();List<
  307. IMyTerminalBlock>ə=new List<IMyTerminalBlock>();List<IMyTerminalBlock>ɣ=new List<IMyTerminalBlock>();StringBuilder ɫ=new StringBuilder()
  308. ;string[]LJ={"showHeading=true","showWarnings=true","showContainerStats=true","showManagedBlocks=true",
  309. "showLastAction=true","scrollTextIfNeeded=true"};string[]ɱ={"showHeading=true","scrollTextIfNeeded=true"};string Ņ;int ɰ=0;string ɯ="";bool ɮ
  310. =false;bool ɭ=false;bool ɲ=false;HashSet<string>ɬ=new HashSet<string>();HashSet<string>ɪ=new HashSet<string>();int ɩ=0;
  311. int ɨ=0;int ɧ=0;bool ɦ=true;bool ɥ=false;int ɤ=0;string Ɏ="itemID;blueprintID";Dictionary<string,string>Ɍ=new Dictionary<
  312. string,string>(){{"oreContainer",oreContainerKeyword},{"ingotContainer",ingotContainerKeyword},{"componentContainer",
  313. componentContainerKeyword},{"toolContainer",toolContainerKeyword},{"ammoContainer",ammoContainerKeyword},{"bottleContainer",
  314. bottleContainerKeyword},{"specialContainer",specialContainerKeyword},{"oreBalancing","true"},{"iceBalancing","true"},{"uraniumBalancing",
  315. "true"}};string Ǵ="IIM Autocrafting";string Ȏ="Remove a line to show this item on the LCD again!\nAdd an amount to manage the item without being on the LCD.\nExample: '-SteelPlate=1000'"
  316. ;char[]ȍ={'=','>','<'};IMyAssembler Ȍ;string ȋ="";MyDefinitionId Ȋ;HashSet<string>ȉ=new HashSet<string>{"Uranium",
  317. "Silicon","Silver","Gold","Platinum","Magnesium","Iron","Nickel","Cobalt","Stone","Scrap"};List<MyItemType>ȏ=new List<MyItemType>
  318. ();List<MyItemType>Ȉ=new List<MyItemType>();Dictionary<string,double>Ȇ=new Dictionary<string,double>(){{"Cobalt",0.3},{
  319. "Gold",0.01},{"Iron",0.7},{"Magnesium",0.007},{"Nickel",0.4},{"Platinum",0.005},{"Silicon",0.7},{"Silver",0.1},{"Stone",0.014}
  320. ,{"Uranium",0.01}};const string ȅ="MyObjectBuilder_";const string Ȅ="Ore";const string ȃ="Ingot";const string Ȃ=
  321. "Component";const string ȁ="AmmoMagazine";const string ȇ="OxygenContainerObject";const string Ȑ="GasContainerObject";const string Ș
  322. ="PhysicalGunObject";const string ȡ="PhysicalObject";const string ȟ="ConsumableItem";const string Ȟ="Datapad";const
  323. string ȝ=ȅ+"BlueprintDefinition/";SortedSet<MyDefinitionId>Ȝ=new SortedSet<MyDefinitionId>(new Ŧ());SortedSet<string>ț=new
  324. SortedSet<string>();SortedSet<string>Ț=new SortedSet<string>();SortedSet<string>Ƞ=new SortedSet<string>();SortedSet<string>ș=new
  325. SortedSet<string>();SortedSet<string>ȗ=new SortedSet<string>();SortedSet<string>Ȗ=new SortedSet<string>();SortedSet<string>ȕ=new
  326. SortedSet<string>();SortedSet<string>Ȕ=new SortedSet<string>();SortedSet<string>ȓ=new SortedSet<string>();SortedSet<string>Ȓ=new
  327. SortedSet<string>();Dictionary<MyDefinitionId,double>ȑ=new Dictionary<MyDefinitionId,double>();Dictionary<MyDefinitionId,double>Ȁ
  328. =new Dictionary<MyDefinitionId,double>();Dictionary<MyDefinitionId,double>ǿ=new Dictionary<MyDefinitionId,double>();
  329. Dictionary<MyDefinitionId,int>ǥ=new Dictionary<MyDefinitionId,int>();Dictionary<MyDefinitionId,MyDefinitionId>DZ=new Dictionary<
  330. MyDefinitionId,MyDefinitionId>();Dictionary<MyDefinitionId,MyDefinitionId>ǰ=new Dictionary<MyDefinitionId,MyDefinitionId>();Dictionary
  331. <string,MyDefinitionId>ǯ=new Dictionary<string,MyDefinitionId>();Dictionary<string,string>Ǯ=new Dictionary<string,string>
  332. ();bool ǭ=false;string Ǭ="station_mode;\n";string Dz="ship_mode;\n";string ǫ="[PROTECTED] ";string Ǫ="";string ǩ="";string
  333. Ǩ="";DateTime ǧ;string[]Ǧ={"Get inventory blocks","Find new items","Create item lists","Name correction",
  334. "Assign containers","Fill special containers","Sort items","Container balancing","Internal sorting","Add fill level to names",
  335. "Get global item amount","Get assembler queue","Autocrafting","Sort assembler queue","Clean up assemblers","Learn unknown blueprints",
  336. "Fill refineries","Ore balancing","Ice balancing","Uranium balancing"};Program(){Echo("Script ready to be launched..\n");assembleMargin/=
  337. 100;disassembleMargin/=100;Runtime.UpdateFrequency=UpdateFrequency.Update10;}void Main(string dz){if(ɰ>=10){throw new
  338. Exception("Too many errors in script step "+ɧ+":\n"+Ǧ[ɧ]+"\n\nPlease recompile!\nScript stoppped!\n\nLast error:\n"+ɯ+"\n");}try{
  339. if(ɦ){if(ɧ>0)Echo("Initializing script.. ("+(ɧ+1)+"/10) \n");if(ɧ>=2){Echo("Getting inventory blocks..");if(ɧ==2)ɋ();if(ʈ)
  340. return;}if(ɧ>=3){Echo("Loading saved items..");if(ɧ==3){if(!Ð()){ɮ=true;enableAutocrafting=false;enableAutodisassembling=false
  341. ;}}if(ɮ){Echo("-> No assemblers found!");Echo("-> Autocrafting deactivated!");}}if(ɧ>=4){Echo(
  342. "Clearing assembler queues..");if(ɧ==4&&(enableAutocrafting||enableAutodisassembling)){GridTerminalSystem.GetBlocksOfType<IMyTextPanel>(ɻ,q=>q.
  343. IsSameConstructAs(Me)&&q.CustomName.Contains(autocraftingKeyword));if(ɻ.Count>0){foreach(var ƞ in ɼ){ƞ.Mode=MyAssemblerMode.Disassembly;ƞ
  344. .ClearQueue();ƞ.Mode=MyAssemblerMode.Assembly;ƞ.ClearQueue();}}}}if(ɧ>=5){Echo("Checking blueprints..");if(ɧ==5){foreach(
  345. var K in Ȝ){ƭ(K);}}}if(ɧ>=6){Echo("Checking type containers..");if(ɧ==6)Ȯ();if(ɧ==6)Ⱥ();}if(ɧ>=7){if(scriptMode=="station")
  346. {ǭ=true;}else if(Me.CubeGrid.IsStatic&&scriptMode!="ship"){ǭ=true;}Echo("Setting script mode to: "+(ǭ?"station..":
  347. "ship.."));if(ɧ==7)Me.CustomData=(ǭ?Ǭ:Dz)+Me.CustomData.Replace(Ǭ,"").Replace(Dz,"");}if(ɧ>=8){Echo("Starting script..");}if(ɧ>=9)
  348. {ɧ=0;ɦ=false;return;}ɧ++;return;}if(dz!=""){Ǩ=dz;ɧ=1;ǩ="";ǧ=DateTime.Now;}if(useDynamicScriptSpeed){if(ɩ>0){Nj(
  349. "Dynamic script speed control");Î("..");ɩ--;return;}}if(ɨ<extraScriptTicks){Runtime.UpdateFrequency=UpdateFrequency.Update1;ɨ++;return;}if(ɥ){if(ɤ==0)
  350. Ń();if(ɤ==1)Ŀ();if(ɤ==2)ņ();if(ɤ==3)ľ();if(ɤ>3)ɤ=0;ɥ=false;return;}if(ɧ==0||ɭ||ʈ){if(!ɲ)ɋ();if(ʈ)return;ɭ=false;ɲ=false;
  351. if(!lj(30)){ɔ=Lj(mainLCDKeyword,LJ);ɓ=Lj(warningsLCDKeyword,ɱ);ə=Lj(performanceLCDKeyword,ɱ);ɣ=Lj(inventoryLCDKeyword);}else{ɭ=
  352. true;ɲ=true;}if(ɧ==0){Nj(Ǧ[ɧ]);Î();ɧ++;}return;}if(!ǭ)Ǹ();if(ǽ(Ǩ))return;ɨ=0;Runtime.UpdateFrequency=UpdateFrequency.Update10
  353. ;ɥ=true;if(ɧ==1){Ò();}if(ɧ==2){è();}if(ɧ==3){if(enableNameCorrection)ȸ();}if(ɧ==4){if(autoContainerAssignment){if(
  354. unassignEmptyContainers)ȴ();if(assignNewContainers)ȥ();}}if(ɧ==5){if(ʕ.Count!=0)ͼ();}if(ɧ==6){Ύ();}if(ɧ==7){if(balanceTypeContainers)ʪ();}if(ɧ
  355. ==8){Ε();}if(ɧ==9){β(ʄ);β(ʕ);}if(ɧ==10){Ʋ();}if(ɧ==11){if(enableAutocrafting||enableAutodisassembling)ƚ();}if(ɧ==12){if(
  356. enableAutocrafting||enableAutodisassembling)Ϋ();}if(ɧ==13){if(sortAssemblerQueue)ˮ();}if(ɧ==14){if(enableAssemblerCleanup)ˏ();if(
  357. enableBasicIngotCrafting){if(ɿ.Count>0){enableBasicIngotCrafting=false;}else{ʲ();}}}if(ɧ==15){Õ();}if(ɧ==16){ʢ();}if(ɧ==17){if(
  358. enableOreBalancing)ʠ();if(sortRefiningQueue){ʟ(ɽ,ȏ);ʟ(ʃ,Ȉ);}}if(ɧ==18){if(enableIceBalancing)ĕ();}if(ɧ==19){if(enableUraniumBalancing){ß(
  359. "uraniumBalancing","true");ę();}else if(!enableUraniumBalancing&&á("uraniumBalancing")=="true"){ß("uraniumBalancing","false");foreach(
  360. IMyReactor Ċ in ɵ){Ċ.UseConveyorSystem=true;}}}Nj(Ǧ[ɧ]);Î();ɩ=(int)Math.Floor((NJ>20?20:NJ)/maxCurrentMs);if(ɧ>=19){ɧ=0;ɬ=new HashSet
  361. <string>(ɪ);ɪ.Clear();if(ɰ>0)ɰ--;if(ɬ.Count==0)Ņ=null;}else{ɧ++;}}catch(NullReferenceException e){ɰ++;ɭ=true;ʈ=false;ɯ=e.
  362. ToString();ƴ("Execution of script step aborted:\n"+Ǧ[ɧ]+" (ID: "+ɧ+")\n\nCached block not available..");}catch(Exception e){ɰ++;
  363. ɭ=true;ʈ=false;ɯ=e.ToString();ƴ("Critical error in script step:\n"+Ǧ[ɧ]+" (ID: "+ɧ+")\n\n"+e);}}bool ǽ(string dz){if(dz.
  364. Contains("pauseThisPB")){Echo("Script execution paused!\n");var Ǽ=dz.Split(';');if(Ǽ.Length==3){Echo("Found:");Echo("'"+Ǽ[1]+"'")
  365. ;Echo("on grid:");Echo("'"+Ǽ[2]+"'");Echo("also running the script.\n");Echo("Type container protection: "+(
  366. protectTypeContainers?"ON":"OFF")+"\n");Echo("Everything else is managed by the other script.");}return true;}bool ǻ=true;bool Ǿ=true;bool Ǻ=
  367. false;if(dz!="reset"&&dz!="msg"){if(!dz.Contains(" on")&&!dz.Contains(" off")&&!dz.Contains(" toggle"))return false;if(dz.Contains(
  368. " off"))Ǿ=false;if(dz.Contains(" toggle"))Ǻ=true;}if(dz=="reset"){Ƴ();return true;}else if(dz=="msg"){}else if(dz.StartsWith(
  369. "balanceTypeContainers")){Ǫ="Balance type containers";if(Ǻ)Ǿ=!balanceTypeContainers;balanceTypeContainers=Ǿ;}else if(dz.StartsWith(
  370. "showFillLevel")){Ǫ="Show fill level";if(Ǻ)Ǿ=!showFillLevel;showFillLevel=Ǿ;}else if(dz.StartsWith("autoContainerAssignment")){Ǫ=
  371. "Auto assign containers";if(Ǻ)Ǿ=!autoContainerAssignment;autoContainerAssignment=Ǿ;}else if(dz.StartsWith("assignNewContainers")){Ǫ=
  372. "Assign new containers";if(Ǻ)Ǿ=!assignNewContainers;assignNewContainers=Ǿ;}else if(dz.StartsWith("unassignEmptyContainers")){Ǫ=
  373. "Unassign empty containers";if(Ǻ)Ǿ=!unassignEmptyContainers;unassignEmptyContainers=Ǿ;}else if(dz.StartsWith("oresIngotsInOne")){Ǫ=
  374. "Assign ores and ingots as one";if(Ǻ)Ǿ=!oresIngotsInOne;oresIngotsInOne=Ǿ;}else if(dz.StartsWith("toolsAmmoBottlesInOne")){Ǫ=
  375. "Assign tools, ammo and bottles as one";if(Ǻ)Ǿ=!toolsAmmoBottlesInOne;toolsAmmoBottlesInOne=Ǿ;}else if(dz.StartsWith("fillBottles")){Ǫ="Fill bottles";if(Ǻ)Ǿ=!
  376. fillBottles;fillBottles=Ǿ;}else if(dz.StartsWith("enableAutocrafting")){Ǫ="Autocrafting";if(Ǻ)Ǿ=!enableAutocrafting;
  377. enableAutocrafting=Ǿ;}else if(dz.StartsWith("enableAutodisassembling")){Ǫ="Autodisassembling";if(Ǻ)Ǿ=!enableAutodisassembling;
  378. enableAutodisassembling=Ǿ;}else if(dz.StartsWith("headerOnEveryScreen")){Ǫ="Show header on every autocrafting screen";if(Ǻ)Ǿ=!
  379. headerOnEveryScreen;headerOnEveryScreen=Ǿ;}else if(dz.StartsWith("sortAssemblerQueue")){Ǫ="Sort assembler queue";if(Ǻ)Ǿ=!sortAssemblerQueue;
  380. sortAssemblerQueue=Ǿ;}else if(dz.StartsWith("enableBasicIngotCrafting")){Ǫ="Basic ingot crafting";if(Ǻ)Ǿ=!enableBasicIngotCrafting;
  381. enableBasicIngotCrafting=Ǿ;}else if(dz.StartsWith("disableBasicAutocrafting")){Ǫ="Disable autocrafting in survival kits";if(Ǻ)Ǿ=!
  382. disableBasicAutocrafting;disableBasicAutocrafting=Ǿ;}else if(dz.StartsWith("allowSpecialSteal")){Ǫ="Allow special container steal";if(Ǻ)Ǿ=!
  383. allowSpecialSteal;allowSpecialSteal=Ǿ;}else if(dz.StartsWith("enableOreBalancing")){Ǫ="Ore balancing";if(Ǻ)Ǿ=!enableOreBalancing;
  384. enableOreBalancing=Ǿ;}else if(dz.StartsWith("enableScriptRefineryFilling")){Ǫ="Script assisted refinery filling";if(Ǻ)Ǿ=!
  385. enableScriptRefineryFilling;enableScriptRefineryFilling=Ǿ;}else if(dz.StartsWith("sortRefiningQueue")){Ǫ="Sort refinery queue";if(Ǻ)Ǿ=!
  386. sortRefiningQueue;sortRefiningQueue=Ǿ;}else if(dz.StartsWith("enableIceBalancing")){Ǫ="Ice balancing";if(Ǻ)Ǿ=!enableIceBalancing;
  387. enableIceBalancing=Ǿ;}else if(dz.StartsWith("fillOfflineGenerators")){Ǫ="Fill offline O2/H2 generators";if(Ǻ)Ǿ=!fillOfflineGenerators;
  388. fillOfflineGenerators=Ǿ;}else if(dz.StartsWith("enableUraniumBalancing")){Ǫ="Uranium balancing";if(Ǻ)Ǿ=!enableUraniumBalancing;
  389. enableUraniumBalancing=Ǿ;}else if(dz.StartsWith("fillOfflineReactors")){Ǫ="Fill offline reactors";if(Ǻ)Ǿ=!fillOfflineReactors;
  390. fillOfflineReactors=Ǿ;}else if(dz.StartsWith("enableAssemblerCleanup")){Ǫ="Assembler cleanup";if(Ǻ)Ǿ=!enableAssemblerCleanup;
  391. enableAssemblerCleanup=Ǿ;}else if(dz.StartsWith("enableInternalSorting")){Ǫ="Internal sorting";if(Ǻ)Ǿ=!enableInternalSorting;
  392. enableInternalSorting=Ǿ;}else if(dz.StartsWith("useDynamicScriptSpeed")){Ǫ="Dynamic script speed";if(Ǻ)Ǿ=!useDynamicScriptSpeed;
  393. useDynamicScriptSpeed=Ǿ;}else if(dz.StartsWith("excludeWelders")){Ǫ="Exclude welders";if(Ǻ)Ǿ=!excludeWelders;excludeWelders=Ǿ;}else if(dz.
  394. StartsWith("excludeGrinders")){Ǫ="Exclude grinders";if(Ǻ)Ǿ=!excludeGrinders;excludeGrinders=Ǿ;}else if(dz.StartsWith(
  395. "connectionCheck")){Ǫ="Connection check";if(Ǻ)Ǿ=!connectionCheck;connectionCheck=Ǿ;Ⱥ();}else if(dz.StartsWith("showNoConveyorTag")){Ǫ=
  396. "Show no conveyor access";if(Ǻ)Ǿ=!showNoConveyorTag;showNoConveyorTag=Ǿ;Ⱥ();}else if(dz.StartsWith("protectTypeContainers")){Ǫ=
  397. "Protect type containers";if(Ǻ)Ǿ=!protectTypeContainers;protectTypeContainers=Ǿ;}else if(dz.StartsWith("enableNameCorrection")){Ǫ=
  398. "Name correction";if(Ǻ)Ǿ=!enableNameCorrection;enableNameCorrection=Ǿ;}else{ǻ=false;}if(ǻ){TimeSpan ǹ=DateTime.Now-ǧ;if(ǩ=="")ǩ=Ǫ+
  399. " temporarily "+(Ǿ?"enabled":"disabled")+"!\n";Echo(ǩ);Echo("Continuing in "+Math.Ceiling(3-ǹ.TotalSeconds)+" seconds..");Ǩ="msg";if(ǹ.
  400. TotalSeconds>=3){Ǫ="";ǩ="";Ǩ="";}}return ǻ;}void Ǹ(){List<IMyProgrammableBlock>Ƿ=new List<IMyProgrammableBlock>();GridTerminalSystem
  401. .GetBlocksOfType(Ƿ,Ƕ=>Ƕ!=Me);if(Ǩ.StartsWith("pauseThisPB")||Ǩ==""){Ǩ="";foreach(var ǵ in Ƿ){if(ǵ.CustomData.Contains(Ǭ)
  402. ||(ǵ.CustomData.Contains(Dz)&&å(ǵ)<å(Me))){Ǩ="pauseThisPB;"+ǵ.CustomName+";"+ǵ.CubeGrid.CustomName;foreach(var X in ʄ){if(
  403. protectTypeContainers&&!X.CustomName.Contains(ǫ)&&X.IsSameConstructAs(Me))X.CustomName=ǫ+X.CustomName;}return;}}if(Ǩ==""){foreach(var X in ʂ)
  404. {X.CustomName=X.CustomName.Replace(ǫ,"");}}}}void Ȣ(){ʍ.Clear();GridTerminalSystem.GetBlocksOfType<IMyShipConnector>(ʀ,ŭ
  405. =>ŭ.CustomName.Contains(noSortingKeyword));foreach(var Ʉ in ʀ){if(Ʉ.Status!=MyShipConnectorStatus.Connected)continue;if(Ʉ.
  406. OtherConnector.CubeGrid.IsSameConstructAs(Me.CubeGrid))continue;ʍ.Add(Ʉ.OtherConnector.CubeGrid);}ʖ.Clear();GridTerminalSystem.
  407. GetBlocksOfType<IMyShipConnector>(ʀ,ŭ=>ŭ.CustomName.Contains(noIIMKeyword));foreach(var Ʉ in ʀ){if(Ʉ.Status!=MyShipConnectorStatus.
  408. Connected)continue;if(Ʉ.OtherConnector.CubeGrid.IsSameConstructAs(Me.CubeGrid))continue;ʖ.Add(Ʉ.OtherConnector.CubeGrid);}}void Ƀ
  409. (){if(ʊ!=null){try{ʊ=ʋ.GetInventory(0);}catch{ʊ=null;}}if(ʊ==null){try{foreach(var X in ʄ){foreach(var e in ɏ){if(X==e)
  410. continue;if(X.GetInventory(0).IsConnectedTo(e.GetInventory(0))){ʋ=ʄ[0];ʊ=ʋ.GetInventory(0);return;}}}}catch{ʊ=null;}}}void ɂ(
  411. IMyTerminalBlock e){foreach(var È in ʖ){if(e.CubeGrid.IsSameConstructAs(È))return;}if(e.BlockDefinition.SubtypeId.Contains("Locker")||e.
  412. BlockDefinition.SubtypeId=="VendingMachine"||e.BlockDefinition.TypeIdString.Contains("Parachute"))return;if(e is IMyShipWelder&&
  413. excludeWelders)return;if(e is IMyShipGrinder&&excludeGrinders)return;string ȳ=e.CustomName;if(ȳ.Contains(ǫ)){ʂ.Add(e);return;}bool ɀ=ȳ
  414. .Contains(specialContainerKeyword),ȿ=false,Ⱦ=ȳ.Contains(manualMachineKeyword),Ƚ=false,ȼ=ȳ.Contains(learnKeyword)||ȳ.
  415. Contains(learnManyKeyword),Ɂ=true,Ʌ=false;foreach(var ê in lockedContainerKeywords){if(ȳ.Contains(ê)){ȿ=true;break;}}foreach(var
  416. ê in hiddenContainerKeywords){if(ȳ.Contains(ê)){Ƚ=true;break;}}if(!ɀ&&!(e is IMyReactor)&&!(e is IMyGasGenerator)){
  417. foreach(var È in ʍ){if(e.CubeGrid.IsSameConstructAs(È))return;}}if(!Ƚ)ɏ.Add(e);if(connectionCheck){if(ʊ!=null){if(!e.
  418. GetInventory(0).IsConnectedTo(ʊ)){Ɂ=false;}}if(!Ɂ){if(showNoConveyorTag)ɇ(e,"[No Conveyor]");return;}else{ɇ(e,"[No Conveyor]",false)
  419. ;}}if(ȳ.Contains(oreContainerKeyword)){ʔ.Add(e);Ʌ=true;}if(ȳ.Contains(ingotContainerKeyword)){ʓ.Add(e);Ʌ=true;}if(ȳ.
  420. Contains(componentContainerKeyword)){ʒ.Add(e);Ʌ=true;}if(ȳ.Contains(toolContainerKeyword)){ʑ.Add(e);Ʌ=true;}if(ȳ.Contains(
  421. ammoContainerKeyword)){ʐ.Add(e);Ʌ=true;}if(ȳ.Contains(bottleContainerKeyword)){ʏ.Add(e);Ʌ=true;}if(ɀ){ʕ.Add(e);if(e.CustomData.Length<200)í(
  422. e);}if(Ʌ)ʄ.Add(e);if(e.GetType().ToString().Contains("Weapon"))return;if(e is IMyRefinery){if(e.IsSameConstructAs(Me)&&!ɀ
  423. &&!Ⱦ&&e.IsWorking){(e as IMyRefinery).UseConveyorSystem=true;ɿ.Add(e as IMyRefinery);if(e.BlockDefinition.SubtypeId==
  424. "Blast Furnace"){ʃ.Add(e as IMyRefinery);}else{ɽ.Add(e as IMyRefinery);}}if(!ȿ&&e.GetInventory(1).ItemCount>0)ɾ.Add(e as IMyRefinery);}
  425. else if(e is IMyAssembler){if(e.IsSameConstructAs(Me)&&!Ⱦ&&!ȼ&&e.IsWorking){ɼ.Add(e as IMyAssembler);if(e.BlockDefinition.
  426. SubtypeId.Contains("Survival"))ɸ.Add(e as IMyAssembler);}if(!ȿ&&!ȼ&&e.GetInventory(1).ItemCount>0)ɺ.Add(e as IMyAssembler);if(ȼ)ɹ
  427. .Add(e as IMyAssembler);}else if(e is IMyGasGenerator){if(!ɀ&&!Ⱦ&&e.IsFunctional){if(fillOfflineGenerators&&!(e as
  428. IMyGasGenerator).Enabled){ɷ.Add(e as IMyGasGenerator);}else if((e as IMyGasGenerator).Enabled){ɷ.Add(e as IMyGasGenerator);}}}else if(e
  429. is IMyGasTank){if(!ɀ&&!Ⱦ&&!ȿ&&e.IsWorking&&e.IsSameConstructAs(Me)){ɶ.Add(e as IMyGasTank);}}else if(e is IMyReactor){if(!
  430. ɀ&&!Ⱦ&&e.IsFunctional){if(fillOfflineReactors&&!(e as IMyReactor).Enabled){ɵ.Add(e as IMyReactor);}else if((e as
  431. IMyReactor).Enabled){ɵ.Add(e as IMyReactor);}}}else if(e is IMyCargoContainer){if(e.IsSameConstructAs(Me)&&!Ʌ&&!ȿ&&!ɀ)ʁ.Add(e);}if
  432. (e.InventoryCount==1&&!ɀ&&!ȿ&&!(e is IMyReactor)){if(e.GetInventory(0).ItemCount>0)ɑ.Add(e);if(!e.BlockDefinition.
  433. TypeIdString.Contains("Oxygen")){if(e.IsSameConstructAs(Me)){ɢ.Insert(0,e);}else{ɢ.Add(e);}}}}void ɋ(){if(!ʈ){Ȣ();if(connectionCheck
  434. )Ƀ();try{for(int E=0;E<ʕ.Count;E++){if(!ʕ[E].CustomName.Contains(specialContainerKeyword))ʕ[E].CustomData="";}}catch{}ʄ.
  435. Clear();ʔ.Clear();ʓ.Clear();ʒ.Clear();ʑ.Clear();ʐ.Clear();ʏ.Clear();ʕ.Clear();ʁ.Clear();ʂ.Clear();ɏ.Clear();ɑ.Clear();ɢ.Clear
  436. ();ɿ.Clear();ɽ.Clear();ʃ.Clear();ɾ.Clear();ɼ.Clear();ɸ.Clear();ɺ.Clear();ɹ.Clear();ɷ.Clear();ɶ.Clear();ɵ.Clear();ʇ=0;
  437. GridTerminalSystem.GetBlocksOfType<IMyTerminalBlock>(ɐ,ũ=>ũ.HasInventory);}Runtime.UpdateFrequency=UpdateFrequency.Update1;for(int E=ʇ;E<ɐ
  438. .Count;E++){ɂ(ɐ[E]);ʇ++;if(E%200==0){ʈ=true;return;}}if(ʆ==0)Ɋ(ʔ);if(ʆ==1)Ɋ(ʓ);if(ʆ==2)Ɋ(ʒ);if(ʆ==3)Ɋ(ʑ);if(ʆ==4)Ɋ(ʐ);if(
  439. ʆ==5)Ɋ(ʕ);if(ʆ==6)Ɋ(ʏ);ʆ++;if(ʆ>6){ʆ=0;}else{ʈ=true;return;}if(disableBasicAutocrafting&&ɼ.Count!=ɸ.Count)ɼ.RemoveAll(Ĩ=>
  440. Ĩ.BlockDefinition.SubtypeId.Contains("Survival"));if(fillBottles){ɑ.Sort((Ɉ,ũ)=>ũ.BlockDefinition.TypeIdString.Contains(
  441. "Oxygen").CompareTo(Ɉ.BlockDefinition.TypeIdString.Contains("Oxygen")));}ʈ=false;Runtime.UpdateFrequency=UpdateFrequency.
  442. Update10;}void Ɋ(List<IMyTerminalBlock>ɉ){if(ɉ.Count>=2&&ɉ.Count<=500)ɉ.Sort((Ɉ,ũ)=>å(Ɉ).CompareTo(å(ũ)));if(!lj())ʆ++;}void ɇ(
  443. IMyTerminalBlock e,string Ɇ,bool Ȼ=true){if(Ȼ){if(e.CustomName.Contains(Ɇ))return;e.CustomName+=" "+Ɇ;}else{if(!e.CustomName.Contains(Ɇ)
  444. )return;e.CustomName=e.CustomName.Replace(" "+Ɇ,"").Replace(Ɇ,"").TrimEnd(' ');}}void Ⱥ(){for(int E=0;E<ɏ.Count;E++){ɇ(ɏ[
  445. E],"[No Conveyor]",false);}}void Ȯ(){bool ȭ=false;string Ȭ=á("oreContainer");string ȫ=á("ingotContainer");string Ȫ=á(
  446. "componentContainer");string ȩ=á("toolContainer");string ȯ=á("ammoContainer");string Ȩ=á("bottleContainer");string Ȧ=á("specialContainer");
  447. if(oreContainerKeyword!=Ȭ){ȭ=true;}else if(ingotContainerKeyword!=ȫ){ȭ=true;}else if(componentContainerKeyword!=Ȫ){ȭ=true;
  448. }else if(toolContainerKeyword!=ȩ){ȭ=true;}else if(ammoContainerKeyword!=ȯ){ȭ=true;}else if(bottleContainerKeyword!=Ȩ){ȭ=
  449. true;}else if(specialContainerKeyword!=Ȧ){ȭ=true;}if(ȭ){for(int E=0;E<ɏ.Count;E++){if(ɏ[E].CustomName.Contains(Ȭ)){ɏ[E].
  450. CustomName=ɏ[E].CustomName.Replace(Ȭ,oreContainerKeyword);}if(ɏ[E].CustomName.Contains(ȫ)){ɏ[E].CustomName=ɏ[E].CustomName.Replace
  451. (ȫ,ingotContainerKeyword);}if(ɏ[E].CustomName.Contains(Ȫ)){ɏ[E].CustomName=ɏ[E].CustomName.Replace(Ȫ,
  452. componentContainerKeyword);}if(ɏ[E].CustomName.Contains(ȩ)){ɏ[E].CustomName=ɏ[E].CustomName.Replace(ȩ,toolContainerKeyword);}if(ɏ[E].CustomName.
  453. Contains(ȯ)){ɏ[E].CustomName=ɏ[E].CustomName.Replace(ȯ,ammoContainerKeyword);}if(ɏ[E].CustomName.Contains(Ȩ)){ɏ[E].CustomName=ɏ[
  454. E].CustomName.Replace(Ȩ,bottleContainerKeyword);}if(ɏ[E].CustomName.Contains(Ȧ)){ɏ[E].CustomName=ɏ[E].CustomName.Replace(
  455. Ȧ,specialContainerKeyword);}}ß("oreContainer",oreContainerKeyword);ß("ingotContainer",ingotContainerKeyword);ß(
  456. "componentContainer",componentContainerKeyword);ß("toolContainer",toolContainerKeyword);ß("ammoContainer",ammoContainerKeyword);ß(
  457. "bottleContainer",bottleContainerKeyword);ß("specialContainer",specialContainerKeyword);}}void ȥ(){for(int E=0;E<ʁ.Count;E++){bool Ȥ=
  458. false;bool ȣ=false;string ȧ=ʁ[E].CustomName;string Ȱ="";if(ʔ.Count==0||ʌ=="Ore"){if(oresIngotsInOne){ȣ=true;}else{ʁ[E].
  459. CustomName+=" "+oreContainerKeyword;ʔ.Add(ʁ[E]);Ȱ="Ores";}}else if(ʓ.Count==0||ʌ=="Ingot"){if(oresIngotsInOne){ȣ=true;}else{ʁ[E].
  460. CustomName+=" "+ingotContainerKeyword;ʓ.Add(ʁ[E]);Ȱ="Ingots";}}else if(ʒ.Count==0||ʌ=="Component"){ʁ[E].CustomName+=" "+
  461. componentContainerKeyword;ʒ.Add(ʁ[E]);Ȱ="Components";}else if(ʑ.Count==0||ʌ=="PhysicalGunObject"){if(toolsAmmoBottlesInOne){Ȥ=true;}else{ʁ[E].
  462. CustomName+=" "+toolContainerKeyword;ʑ.Add(ʁ[E]);Ȱ="Tools";}}else if(ʐ.Count==0||ʌ=="AmmoMagazine"){if(toolsAmmoBottlesInOne){Ȥ=
  463. true;}else{ʁ[E].CustomName+=" "+ammoContainerKeyword;ʐ.Add(ʁ[E]);Ȱ="Ammo";}}else if(ʏ.Count==0||ʌ=="OxygenContainerObject"||
  464. ʌ=="GasContainerObject"){if(toolsAmmoBottlesInOne){Ȥ=true;}else{ʁ[E].CustomName+=" "+bottleContainerKeyword;ʏ.Add(ʁ[E]);Ȱ
  465. ="Bottles";}}if(ȣ){ʁ[E].CustomName+=" "+oreContainerKeyword+" "+ingotContainerKeyword;ʔ.Add(ʁ[E]);ʓ.Add(ʁ[E]);Ȱ=
  466. "Ores and Ingots";}if(Ȥ){ʁ[E].CustomName+=" "+toolContainerKeyword+" "+ammoContainerKeyword+" "+bottleContainerKeyword;ʑ.Add(ʁ[E]);ʐ.Add(
  467. ʁ[E]);ʏ.Add(ʁ[E]);Ȱ="Tools, Ammo and Bottles";}if(Ȱ!=""){ɗ="Assigned '"+ȧ+"' as a new container for type '"+Ȱ+"'.";}ʌ="";
  468. }}void ȴ(){ȹ(ʔ,oreContainerKeyword);ȹ(ʓ,ingotContainerKeyword);ȹ(ʒ,componentContainerKeyword);ȹ(ʑ,toolContainerKeyword);ȹ
  469. (ʐ,ammoContainerKeyword);ȹ(ʏ,bottleContainerKeyword);}void ȹ(List<IMyTerminalBlock>ă,string ȷ){if(ă.Count>1){bool ȶ=false
  470. ;foreach(var X in ă){if(X.CustomName.Contains("[P"))continue;if(X.GetInventory(0).ItemCount==0){if(ȶ)continue;X.
  471. CustomName=X.CustomName.Replace(ȷ,ȷ+"!");ȶ=true;if(X.CustomName.Contains(ȷ+"!!!")){string ȵ=System.Text.RegularExpressions.Regex.
  472. Replace(X.CustomName,@"("+ȷ+@")(!+)","");ȵ=System.Text.RegularExpressions.Regex.Replace(ȵ,@"\(\d+\.?\d*\%\)","");ȵ=ȵ.Replace(
  473. " "," ");X.CustomName=ȵ.TrimEnd(' ');ʄ.Remove(X);ɗ="Unassigned '"+ȵ+"' from being a container for type '"+ȷ+"'.";}}else{if(
  474. X.CustomName.Contains(ȷ+"!")){string ȵ=System.Text.RegularExpressions.Regex.Replace(X.CustomName,@"("+ȷ+@")(!+)",ȷ);ȵ=ȵ.
  475. Replace(" "," ");X.CustomName=ȵ.TrimEnd(' ');}}}}}void ȸ(){for(int E=0;E<ɏ.Count;E++){string ȳ=ɏ[E].CustomName;string Ȳ=ȳ.
  476. ToLower();List<string>ȱ=new List<string>();if(Ȳ.Contains(oreContainerKeyword.ToLower())&&!ȳ.Contains(oreContainerKeyword))ȱ.Add
  477. (oreContainerKeyword);if(Ȳ.Contains(ingotContainerKeyword.ToLower())&&!ȳ.Contains(ingotContainerKeyword))ȱ.Add(
  478. ingotContainerKeyword);if(Ȳ.Contains(componentContainerKeyword.ToLower())&&!ȳ.Contains(componentContainerKeyword))ȱ.Add(
  479. componentContainerKeyword);if(Ȳ.Contains(toolContainerKeyword.ToLower())&&!ȳ.Contains(toolContainerKeyword))ȱ.Add(toolContainerKeyword);if(Ȳ.
  480. Contains(ammoContainerKeyword.ToLower())&&!ȳ.Contains(ammoContainerKeyword))ȱ.Add(ammoContainerKeyword);if(Ȳ.Contains(
  481. bottleContainerKeyword.ToLower())&&!ȳ.Contains(bottleContainerKeyword))ȱ.Add(bottleContainerKeyword);foreach(var ê in lockedContainerKeywords)
  482. {if(Ȳ.Contains(ê.ToLower())&&!ȳ.Contains(ê)){ȱ.Add(ê);break;}}foreach(var ê in hiddenContainerKeywords){if(Ȳ.Contains(ê.
  483. ToLower())&&!ȳ.Contains(ê)){ȱ.Add(ê);break;}}if(Ȳ.Contains(specialContainerKeyword.ToLower())&&!ȳ.Contains(
  484. specialContainerKeyword))ȱ.Add(specialContainerKeyword);if(Ȳ.Contains(noSortingKeyword.ToLower())&&!ȳ.Contains(noSortingKeyword))ȱ.Add(
  485. noSortingKeyword);if(Ȳ.Contains(manualMachineKeyword.ToLower())&&!ȳ.Contains(manualMachineKeyword))ȱ.Add(manualMachineKeyword);if(Ȳ.
  486. Contains(autocraftingKeyword.ToLower())&&!ȳ.Contains(autocraftingKeyword))ȱ.Add(autocraftingKeyword);if(Ȳ.Contains(
  487. assembleKeyword.ToLower())&&!ȳ.Contains(assembleKeyword))ȱ.Add(assembleKeyword);if(Ȳ.Contains(disassembleKeyword.ToLower())&&!ȳ.
  488. Contains(disassembleKeyword))ȱ.Add(disassembleKeyword);if(Ȳ.Contains(learnKeyword.ToLower())&&!ȳ.Contains(learnKeyword))ȱ.Add(
  489. learnKeyword);if(Ȳ.Contains(learnManyKeyword.ToLower())&&!ȳ.Contains(learnManyKeyword))ȱ.Add(learnManyKeyword);if(Ȳ.Contains(
  490. inventoryLCDKeyword.ToLower())&&!ȳ.Contains(inventoryLCDKeyword))ȱ.Add(inventoryLCDKeyword);if(Ȳ.Contains(mainLCDKeyword.ToLower())&&!ȳ.
  491. Contains(mainLCDKeyword))ȱ.Add(mainLCDKeyword);if(Ȳ.Contains(warningsLCDKeyword.ToLower())&&!ȳ.Contains(warningsLCDKeyword))ȱ.
  492. Add(warningsLCDKeyword);if(Ȳ.Contains(performanceLCDKeyword.ToLower())&&!ȳ.Contains(performanceLCDKeyword))ȱ.Add(
  493. performanceLCDKeyword);if(Ȳ.Contains("[p")&&!ȳ.Contains("[P"))ȱ.Add("[P");if(Ȳ.Contains("[pmax]")&&!ȳ.Contains("[PMax]"))ȱ.Add("[PMax]");if(Ȳ
  494. .Contains("[pmin]")&&!ȳ.Contains("[PMin]"))ȱ.Add("[PMin]");foreach(var Ì in ȱ){ɏ[E].CustomName=ɏ[E].CustomName.Ŷ(Ì,Ì);ɗ=
  495. "Corrected name\nof: '"+ȳ+"'\nto: '"+ɏ[E].CustomName+"'";}}List<IMyTextPanel>Ơ=new List<IMyTextPanel>();GridTerminalSystem.GetBlocksOfType(Ơ);
  496. for(int E=0;E<Ơ.Count;E++){string ȳ=Ơ[E].CustomName;string Ȳ=ȳ.ToLower();List<string>ȱ=new List<string>();if(Ȳ.Contains(
  497. mainLCDKeyword.ToLower())&&!ȳ.Contains(mainLCDKeyword))ȱ.Add(mainLCDKeyword);if(Ȳ.Contains(inventoryLCDKeyword.ToLower())&&!ȳ.Contains
  498. (inventoryLCDKeyword))ȱ.Add(inventoryLCDKeyword);if(Ȳ.Contains(warningsLCDKeyword.ToLower())&&!ȳ.Contains(
  499. warningsLCDKeyword))ȱ.Add(warningsLCDKeyword);if(Ȳ.Contains(performanceLCDKeyword.ToLower())&&!ȳ.Contains(performanceLCDKeyword))ȱ.Add(
  500. performanceLCDKeyword);foreach(var Ì in ȱ){Ơ[E].CustomName=Ơ[E].CustomName.Ŷ(Ì,Ì);ɗ="Corrected name\nof: '"+ȳ+"'\nto: '"+Ơ[E].CustomName+"'";
  501. }}}void Ύ(){if(ɴ==0)Ό(Ȅ,ʔ,oreContainerKeyword);if(ɴ==1)Ό(ȃ,ʓ,ingotContainerKeyword);if(ɴ==2)Ό(Ȃ,ʒ,
  502. componentContainerKeyword);if(ɴ==3)Ό(Ș,ʑ,toolContainerKeyword);if(ɴ==4)Ό(ȁ,ʐ,ammoContainerKeyword);if(ɴ==5)Ό(ȇ,ʏ,bottleContainerKeyword);if(ɴ==6)
  503. Ό(Ȑ,ʏ,bottleContainerKeyword);if(ɴ==7)Ό(ȡ,ʑ,toolContainerKeyword);if(ɴ==8)Ό(ȟ,ʑ,toolContainerKeyword);if(ɴ==9)Ό(Ȟ,ʑ,
  504. toolContainerKeyword);ɴ++;if(ɴ>9)ɴ=0;}void Ό(string Ί,List<IMyTerminalBlock>Ή,string Ώ){if(Ή.Count==0){ƴ(
  505. "There are no containers for type '"+Ώ+"'!\nBuild new ones or add the tag to existing ones!");ʌ=Ί;return;}IMyTerminalBlock Ä=null;int Έ=int.MaxValue;for(int
  506. E=0;E<Ή.Count;E++){if(Ί==ȇ&&Ή[E].BlockDefinition.TypeIdString.Contains("OxygenTank")&&Ή[E].BlockDefinition.SubtypeId.
  507. Contains("Hydrogen")){continue;}else if(Ί==Ȑ&&Ή[E].BlockDefinition.TypeIdString.Contains("OxygenTank")&&!Ή[E].BlockDefinition.
  508. SubtypeId.Contains("Hydrogen")){continue;}var æ=Ή[E].GetInventory(0);if((float)æ.CurrentVolume<(float)æ.MaxVolume*0.98f){Ä=Ή[E];Έ
  509. =å(Ή[E]);break;}}if(Ä==null){ƴ("All containers for type '"+Ώ+"' are full!\nYou should build new cargo containers!");ʌ=Ί;
  510. return;}IMyTerminalBlock Ά=null;if(fillBottles&&(Ί==ȇ||Ί==Ȑ)){Ά=ΐ(Ί);}for(int E=0;E<ɑ.Count;E++){if(ɑ[E]==Ä||(ɑ[E].CustomName.
  511. Contains(Ώ)&&å(ɑ[E])<=Έ)||(Ί=="Ore"&&ɑ[E].GetType().ToString().Contains("MyGasGenerator"))){continue;}if(ɑ[E].CustomName.
  512. Contains(Ώ)&&balanceTypeContainers&&!ɑ[E].BlockDefinition.TypeIdString.Contains("OxygenGenerator")&&!ɑ[E].BlockDefinition.
  513. TypeIdString.Contains("OxygenTank"))continue;if(!Ζ(ɑ[E]))continue;if(Ά!=null){if(!ɑ[E].BlockDefinition.TypeIdString.Contains(
  514. "Oxygen")){Ç(Ί,ɑ[E],0,Ά,0);continue;}}Ç(Ί,ɑ[E],0,Ä,0);}for(int E=0;E<ɾ.Count;E++){if(ɾ[E]==Ä||(ɾ[E].CustomName.Contains(Ώ)&&å(ɾ[
  515. E])<=Έ)){continue;}if(!Ζ(ɾ[E]))continue;Ç(Ί,ɾ[E],1,Ä,0);}for(int E=0;E<ɺ.Count;E++){if((ɺ[E].Mode==MyAssemblerMode.
  516. Disassembly&&ɺ[E].IsProducing)||ɺ[E]==Ä||(ɺ[E].CustomName.Contains(Ώ)&&å(ɺ[E])<=Έ)){continue;}if(!Ζ(ɺ[E]))continue;if(Ά!=null){Ç(Ί,
  517. ɺ[E],1,Ά,0);continue;}Ç(Ί,ɺ[E],1,Ä,0);}if(!lj())ɴ++;}IMyTerminalBlock ΐ(string Ί){List<IMyGasTank>Μ=new List<IMyGasTank>(ɶ
  518. );if(Ί==ȇ)Μ.RemoveAll(Κ=>Κ.BlockDefinition.SubtypeId.Contains("Hydrogen"));if(Ί==Ȑ)Μ.RemoveAll(Κ=>!Κ.BlockDefinition.
  519. SubtypeId.Contains("Hydrogen"));foreach(var Ι in Μ){if(Ι.FilledRatio>0){Ι.AutoRefillBottles=true;return Ι;}}List<IMyGasGenerator>
  520. Θ=ɷ.Where(Η=>Η.IsSameConstructAs(Me)&&Η.Enabled==true).ToList();MyDefinitionId ē=MyItemType.MakeOre("Ice");foreach(var Λ
  521. in Θ){if(h(ē,Λ)>0){Λ.AutoRefill=true;return Λ;}}return null;}bool Ζ(IMyTerminalBlock e){if(e.GetOwnerFactionTag()!=Me.
  522. GetOwnerFactionTag()){ƴ("'"+e.CustomName+"'\nhas a different owner/faction!\nCan't move items from there!");return false;}return true;}
  523. void Ε(){char Δ='0';char Γ='0';char[]Β={'A','N','T','X'};char[]Α={'a','d'};if(sortingPattern.Length==2){Δ=sortingPattern[0];
  524. Γ=sortingPattern[1];}ɍ=new List<IMyTerminalBlock>(ɑ);ɍ.AddRange(ʕ);if(enableInternalSorting){if(Δ.ToString().IndexOfAny(Β
  525. )<0||Γ.ToString().IndexOfAny(Α)<0){ƴ("You provided the invalid sorting pattern '"+sortingPattern+
  526. "'!\nCan't sort the inventories!");return;}}else{ɍ=ɍ.FindAll(E=>E.CustomName.ToLower().Contains("(sort:"));}for(var ƕ=ɳ;ƕ<ɍ.Count;ƕ++){if(lj())return;if(ɳ
  527. >=ɍ.Count-1){ɳ=0;}else{ɳ++;}var æ=ɍ[ƕ].GetInventory(0);var M=new List<MyInventoryItem>();æ.GetItems(M);if(M.Count>200)
  528. continue;char ʹ=Δ;char ͳ=Γ;string Ͳ=System.Text.RegularExpressions.Regex.Match(ɍ[ƕ].CustomName,@"(\(sort:)(.{2})",System.Text.
  529. RegularExpressions.RegexOptions.IgnoreCase).Groups[2].Value;if(Ͳ.Length==2){Δ=Ͳ[0];Γ=Ͳ[1];if(Δ.ToString().IndexOfAny(Β)<0||Γ.ToString().
  530. IndexOfAny(Α)<0){ƴ("You provided an invalid sorting pattern in\n'"+ɍ[ƕ].CustomName+"'!\nUsing global pattern!");Δ=ʹ;Γ=ͳ;}}var ͱ=
  531. new List<MyInventoryItem>();æ.GetItems(ͱ);if(Δ=='A'){if(Γ=='d'){ͱ.Sort((Ɉ,ũ)=>ũ.Amount.ToIntSafe().CompareTo(Ɉ.Amount.
  532. ToIntSafe()));}else{ͱ.Sort((Ɉ,ũ)=>Ɉ.Amount.ToIntSafe().CompareTo(ũ.Amount.ToIntSafe()));}}else if(Δ=='N'){if(Γ=='d'){ͱ.Sort((Ɉ,ũ)
  533. =>ũ.Type.SubtypeId.ToString().CompareTo(Ɉ.Type.SubtypeId.ToString()));}else{ͱ.Sort((Ɉ,ũ)=>Ɉ.Type.SubtypeId.ToString().
  534. CompareTo(ũ.Type.SubtypeId.ToString()));}}else if(Δ=='T'){if(Γ=='d'){ͱ.Sort((Ɉ,ũ)=>ũ.Type.ToString().CompareTo(Ɉ.Type.ToString())
  535. );}else{ͱ.Sort((Ɉ,ũ)=>Ɉ.Type.ToString().CompareTo(ũ.Type.ToString()));}}else if(Δ=='X'){if(Γ=='d'){ͱ.Sort((Ɉ,ũ)=>(ũ.Type.
  536. TypeId.ToString()+ũ.Amount.ToIntSafe().ToString(@"000000000")).CompareTo((Ɉ.Type.TypeId.ToString()+Ɉ.Amount.ToIntSafe().
  537. ToString(@"000000000"))));}else{ͱ.Sort((Ɉ,ũ)=>(Ɉ.Type.TypeId.ToString()+Ɉ.Amount.ToIntSafe().ToString(@"000000000")).CompareTo((
  538. ũ.Type.TypeId.ToString()+ũ.Amount.ToIntSafe().ToString(@"000000000"))));}}if(ͱ.SequenceEqual(M,new Ť()))continue;foreach(
  539. var Ì in ͱ){string ͽ=Ì.ToString();for(int E=0;E<M.Count;E++){if(M[E].ToString()==ͽ){æ.TransferItemTo(æ,E,M.Count,false);M.
  540. Clear();æ.GetItems(M);break;}}}Δ=ʹ;Γ=ͳ;}}void ͼ(){for(int ƕ=ɒ;ƕ<ʕ.Count;ƕ++){if(lj())return;ɒ++;í(ʕ[ƕ]);int d=0;if(ʕ[ƕ].
  541. BlockDefinition.SubtypeId.Contains("Assembler")){IMyAssembler ƞ=ʕ[ƕ]as IMyAssembler;if(ƞ.Mode==MyAssemblerMode.Disassembly)d=1;}var Ï=ʕ
  542. [ƕ].CustomData.Split('\n');List<string>ͻ=new List<string>();foreach(var À in Ï){if(!À.Contains("="))continue;
  543. MyDefinitionId K;double ͺ=0;var Ͷ=À.Split('=');if(Ͷ.Length>=2){if(!MyDefinitionId.TryParse(ȅ+Ͷ[0],out K))continue;double.TryParse(Ͷ[1]
  544. ,out ͺ);if(Ͷ[1].ToLower().Contains("all")){ͺ=int.MaxValue;}}else{continue;}double ͷ=h(K,ʕ[ƕ],d);double ʗ=0;if(ͺ>=0){ʗ=ͺ-ͷ
  545. ;}else{ʗ=Math.Abs(ͺ)-ͷ;}if(ʗ>=1&&ͺ>=0){var æ=ʕ[ƕ].GetInventory(d);if((float)æ.CurrentVolume>(float)æ.MaxVolume*0.98f)
  546. continue;if(ʗ>h(K)&&ͺ!=int.MaxValue){ͻ.Add(ʗ-h(K)+" "+K.SubtypeName);}IMyTerminalBlock f=null;if(allowSpecialSteal){f=Z(K,true,ʕ
  547. [ƕ]);}else{f=Z(K);}if(f!=null){Ç(K.ToString(),f,0,ʕ[ƕ],d,ʗ,true);}}else if(ʗ<0){IMyTerminalBlock Ä=W(ʕ[ƕ],ʁ);if(Ä!=null)Ç
  548. (K.ToString(),ʕ[ƕ],d,Ä,0,Math.Abs(ʗ),true);}}if(ͻ.Count>0){ƴ(ʕ[ƕ].CustomName+
  549. "\nis missing the following items to match its quota:\n"+String.Join(", ",ͻ));}}ɒ=0;}void β(List<IMyTerminalBlock>ă){foreach(var X in ă){string α=X.CustomName;string ȵ="";var ΰ
  550. =System.Text.RegularExpressions.Regex.Match(α,@"\(\d+\.?\d*\%\)").Value;if(ΰ!=""){ȵ=α.Replace(ΰ,"").TrimEnd(' ');}else{ȵ=
  551. α;}var æ=X.GetInventory(0);string ǝ=((float)æ.CurrentVolume).ƀ((float)æ.MaxVolume);if(showFillLevel){ȵ+=" ("+ǝ+")";ȵ=ȵ.
  552. Replace(" "," ");}if(ȵ!=α)X.CustomName=ȵ;}}StringBuilder ί(){if(ɻ.Count>1){string ή=@"("+autocraftingKeyword+@" *)(\d*)";ɻ.
  553. Sort((Ɉ,ũ)=>System.Text.RegularExpressions.Regex.Match(Ɉ.CustomName,ή).Groups[2].Value.CompareTo(System.Text.
  554. RegularExpressions.Regex.Match(ũ.CustomName,ή).Groups[2].Value));}StringBuilder ł=new StringBuilder();if(!ɻ[0].GetText().Contains(Ǵ)){ɻ[0]
  555. .Font=defaultFont;ɻ[0].FontSize=defaultFontSize;ɻ[0].TextPadding=defaultPadding;}foreach(var q in ɻ){ł.Append(q.GetText()
  556. +"\n");q.WritePublicTitle("Craft item manually once to show up here");q.Font=ɻ[0].Font;q.FontSize=ɻ[0].FontSize;q.
  557. TextPadding=ɻ[0].TextPadding;q.Alignment=TextAlignment.LEFT;q.ContentType=ContentType.TEXT_AND_IMAGE;}var γ=new List<string>(ł.
  558. ToString().Split('\n'));var Ω=new List<string>();var λ=new HashSet<string>();string κ;foreach(var À in γ){if(À.IndexOfAny(ȍ)<=0)
  559. continue;κ=À.Remove(À.IndexOf(" "));if(!λ.Contains(κ)){Ω.Add(À);λ.Add(κ);}}List<string>Ï=ɻ[0].CustomData.Split('\n').ToList();
  560. foreach(var I in ʅ){bool ι=false;if(λ.Contains(I)){continue;}foreach(var À in Ï){if(!À.StartsWith("-"))continue;string θ="";try
  561. {if(À.Contains("=")){θ=À.Substring(1,À.IndexOf("=")-1);}else{θ=À.Substring(1);}}catch{continue;}if(θ==I){ι=true;break;}}
  562. if(!ι){MyDefinitionId K=ǔ(I);double η=Math.Ceiling(h(K));Ω.Add(I+" "+η+" = "+η);}}foreach(var À in Ï){if(!À.StartsWith("-"
  563. ))continue;if(À.Contains("=")){Ω.Add(À);}}StringBuilder ƌ=new StringBuilder();try{IOrderedEnumerable<string>ζ;ζ=Ω.OrderBy
  564. (Ɉ=>Ɉ);bool ε;string δ,I,Σ;foreach(var À in ζ){ε=false;if(À.StartsWith("-")){I=À.Remove(À.IndexOf("=")).TrimStart('-');δ=
  565. "-";}else{I=À.Remove(À.IndexOf(" "));δ="";}Σ=À.Replace(δ+I,"");foreach(var Ì in ʅ){if(Ì==I){ε=true;break;}}if(ε)ƌ.Append(δ+
  566. I+Σ+"\n");}}catch{}return ƌ;}void Π(StringBuilder ł){if(ł.Length==0){ł.Append("Autocrafting error!\n\nNo items for crafting available!\n\nIf you hid all items, check the custom data of the first autocrafting panel and reenable some of them.\n\nOtherwise, store or build new items manually!"
  567. );ł=ɻ[0].Ŝ(ł,2,false);ɻ[0].WriteText(ł);return;}var Ļ=ł.ToString().TrimEnd('\n').Split('\n');int ĺ=Ļ.Length;int Ĺ=0;float
  568. Ρ=0;foreach(var q in ɻ){float ő=q.Ŋ();int ĸ=q.ō();int ķ=0;List<string>ƌ=new List<string>();if(q==ɻ[0]||
  569. headerOnEveryScreen){string Ξ=Ǵ;if(headerOnEveryScreen&&ɻ.Count>1){Ξ+=" "+(ɻ.IndexOf(q)+1)+"/"+ɻ.Count;try{Ξ+=" ["+Ļ[Ĺ][0]+"-#]";}catch{Ξ+=
  570. " [Empty]";}}ƌ.Add(Ξ);ƌ.Add(q.Ň('=',q.ū(Ξ)).ToString()+"\n");string Ν="Component ";string Ο="Current | Wanted ";Ρ=q.ū("Wanted ");
  571. string Ǔ=q.Ň(' ',ő-q.ū(Ν)-q.ū(Ο)).ToString();ƌ.Add(Ν+Ǔ+Ο+"\n");ķ=5;}while((Ĺ<ĺ&&ķ<ĸ)||(q==ɻ[ɻ.Count-1]&&Ĺ<ĺ)){var À=Ļ[Ĺ].Split
  572. (' ');À[0]+=" ";À[1]=À[1].Replace('$',' ');string Ǔ=q.Ň(' ',ő-q.ū(À[0])-q.ū(À[1])-Ρ).ToString();string έ=À[0]+Ǔ+À[1]+À[2]
  573. ;ƌ.Add(έ);Ĺ++;ķ++;}if(headerOnEveryScreen&&ɻ.Count>1){ƌ[0]=ƌ[0].Replace('#',Ļ[Ĺ-1][0]);}q.WriteText(String.Join("\n",ƌ));
  574. }if(showAutocraftingModifiers){string ά="\n\n---\n\nModifiers (append after wanted amount):\n"+"'A' - Assemble only\n"+
  575. "'D' - Disassemble only\n"+"'P' - Always queue first (priority)\n"+"'H' - Hide and manage in background\n"+"'I' - Hide and ignore\n";ɻ[ɻ.Count-1].
  576. WriteText(ά,true);}}void Ϋ(){ɻ.Clear();GridTerminalSystem.GetBlocksOfType<IMyTextPanel>(ɻ,q=>q.IsSameConstructAs(Me)&&q.
  577. CustomName.Contains(autocraftingKeyword));if(ɻ.Count==0)return;if(ɼ.Count==0){ƴ(
  578. "No assemblers found!\nBuild assemblers to enable autocrafting!");return;}ˋ();List<MyDefinitionId>Ϊ=new List<MyDefinitionId>();var Ω=ί().ToString().TrimEnd('\n').Split('\n');
  579. StringBuilder ƌ=new StringBuilder();foreach(var À in Ω){string I="";bool Ψ=true;if(À.StartsWith("-")){Ψ=false;try{I=À.Substring(1,À.
  580. IndexOf("=")-1);}catch{continue;}}else{try{I=À.Substring(0,À.IndexOf(" "));}catch{continue;}}MyDefinitionId K=ǔ(I);if(K==null)
  581. continue;double Χ=Math.Ceiling(h(K));string Φ=À.Substring(À.IndexOfAny(ȍ)+1).ToLower();double Υ=0;double.TryParse(System.Text.
  582. RegularExpressions.Regex.Replace(Φ,@"\D",""),out Υ);string Τ=Χ.ToString();string Ͱ=Υ.ToString();string ʳ="";bool ã=false;if(Φ.Contains("h"
  583. )){if(!ɻ[0].CustomData.StartsWith(Ȏ))ɻ[0].CustomData=Ȏ;ɻ[0].CustomData+="\n-"+I+"="+Υ;continue;}else if(Φ.Contains("i")){
  584. if(!ɻ[0].CustomData.StartsWith(Ȏ))ɻ[0].CustomData=Ȏ;ɻ[0].CustomData+="\n-"+I;continue;}if(Φ.Contains("a")){if(Χ>Υ)Υ=Χ;ʳ+=
  585. "A";}if(Φ.Contains("d")){if(Χ<Υ)Υ=Χ;ʳ+="D";}if(Φ.Contains("p")){ã=true;ʳ+="P";}ƣ(K,Υ);double ʱ=Math.Abs(Υ-Χ);bool ʰ;
  586. MyDefinitionId Û=ƶ(K,out ʰ);double ʯ=Ƥ(Û);if(Χ>=Υ+Υ*assembleMargin&&ʯ>0&&ƥ(Û)>0){ˍ(Û);Ƣ(Û,0);ʯ=0;ɗ="Removed '"+K.SubtypeId.ToString()+
  587. "' from the assembling queue.";}if(Χ<=Υ-Υ*disassembleMargin&&ʯ>0&&ƥ(Û)<0){ˍ(Û);Ƣ(Û,0);ʯ=0;ɗ="Removed '"+K.SubtypeId.ToString()+
  588. "' from the disassembling queue.";}string Ã="";if(ʯ>0||ʱ>0){if(enableAutodisassembling&&Χ>Υ+Υ*disassembleMargin){Ƣ(Û,-1);Ã="$[D:";}else if(
  589. enableAutocrafting&&Χ<Υ-Υ*assembleMargin){Ƣ(Û,1);Ã="$[A:";}if(Ã!=""){if(ʯ==0){Ã+="Wait]";}else{Ã+=Math.Round(ʯ)+"]";}}}else{Ƣ(Û,0);}if(!ʰ)
  590. Ã="$[NoBP!]";if(ʰ&&ã){Ϊ.Add(Û);}string ʮ="$=$ ";if(Χ>Υ)ʮ="$>$ ";if(Χ<Υ)ʮ="$<$ ";if(Ψ)ƌ.Append(I+" "+Τ+Ã+ʮ+Ͱ+ʳ+"\n");if(Ã.
  591. Contains("[D:Wait]")){ʿ(Û,ʱ);}else if(Ã.Contains("[A:Wait]")){ʾ(Û,ʱ,ã);ɗ="Queued "+ʱ+" '"+K.SubtypeId.ToString()+
  592. "' in the assemblers.";}else if(Ã.Contains("[NoBP!]")&&Υ>Χ){ƴ("Can't craft\n'"+K.SubtypeId.ToString()+
  593. "'\nThere's no blueprint stored for this item!\nTag an assembler with the '"+learnKeyword+"' keyword and queue\nit up about 100 times to learn the blueprint.");}}ˌ();ˣ(Ϊ);Π(ƌ);}void ʲ(){if(ɿ.Count
  594. >0)return;MyDefinitionId ʥ=MyItemType.MakeOre("Stone");MyDefinitionId Û=MyDefinitionId.Parse(ȝ+"StoneOreToIngotBasic");
  595. double ʭ=h(ʥ);if(ʭ>0){double ʬ=Math.Floor(ʭ/500/ɸ.Count);if(ʬ<1)return;foreach(var ʫ in ɸ){if(ʫ.IsQueueEmpty)ʫ.AddQueueItem(Û,
  596. ʬ);}}}void ʪ(){if(ɠ==0)ɠ+=ʩ(ʔ,Ȅ,true);if(ɠ==1)ɠ+=ʩ(ʓ,ȃ,true);if(ɠ==2)ɠ+=ʩ(ʒ,Ȃ,true);if(ɠ==3)ɠ+=ʩ(ʑ,Ș,true);if(ɠ==4)ɠ+=ʩ(ʐ
  597. ,ȁ,true);if(ɠ==5)ɠ+=ʩ(ʏ,"ContainerObject",true);ɠ++;if(ɠ>5)ɠ=0;}int ʩ(List<IMyTerminalBlock>ɉ,string ʴ="",bool ʸ=false){
  598. if(ʸ)ɉ.RemoveAll(ŭ=>ŭ.InventoryCount==2||ŭ.BlockDefinition.TypeIdString.Contains("OxygenGenerator")||ŭ.BlockDefinition.
  599. TypeIdString.Contains("OxygenTank"));if(ɉ.Count<2){return 1;}Dictionary<MyItemType,double>ʻ=new Dictionary<MyItemType,double>();for(
  600. int E=0;E<ɉ.Count;E++){var M=new List<MyInventoryItem>();ɉ[E].GetInventory(0).GetItems(M);foreach(var Ì in M){if(!Ì.Type.
  601. TypeId.ToString().Contains(ʴ))continue;MyItemType K=Ì.Type;if(ʻ.ContainsKey(K)){ʻ[K]+=(double)Ì.Amount;}else{ʻ[K]=(double)Ì.
  602. Amount;}}}Dictionary<MyItemType,double>ʺ=new Dictionary<MyItemType,double>();foreach(var Ì in ʻ){ʺ[Ì.Key]=(int)(Ì.Value/ɉ.
  603. Count);}for(int ʹ=0;ʹ<ɉ.Count;ʹ++){if(lj())return 0;var ʷ=new List<MyInventoryItem>();ɉ[ʹ].GetInventory(0).GetItems(ʷ);
  604. Dictionary<MyItemType,double>ʶ=new Dictionary<MyItemType,double>();foreach(var Ì in ʷ){MyItemType K=Ì.Type;if(ʶ.ContainsKey(K)){ʶ[
  605. K]+=(double)Ì.Amount;}else{ʶ[K]=(double)Ì.Amount;}}double Ģ=0;foreach(var Ì in ʻ){ʶ.TryGetValue(Ì.Key,out Ģ);double ʵ=ʺ[Ì
  606. .Key];if(Ģ<=ʵ+1)continue;for(int ʨ=0;ʨ<ɉ.Count;ʨ++){if(ɉ[ʹ]==ɉ[ʨ])continue;double ģ=h(Ì.Key,ɉ[ʨ]);if(ģ>=ʵ-1)continue;
  607. double ʗ=ʵ-ģ;if(ʗ>Ģ-ʵ)ʗ=Ģ-ʵ;if(ʗ>0){Ģ-=Ç(Ì.Key.ToString(),ɉ[ʹ],0,ɉ[ʨ],0,ʗ,true);if(Ģ.Ɠ(ʵ-1,ʵ+1))break;}}}}return lj()?0:1;}void
  608. ʢ(){if(ɿ.Count==0)return;if(ɚ==0)ȏ=ˑ(ɽ);if(ɚ==1)Ȉ=ˑ(ʃ);if(enableScriptRefineryFilling){if(ɚ==2)ʜ(ɽ,ȏ);if(ɚ==3)ʜ(ʃ,Ȉ);if(ɚ
  609. ==4)ʦ(ɽ,ȏ);if(ɚ==5)ʦ(ʃ,Ȉ);if(ɚ==6&&ɽ.Count>0&&ʃ.Count>0){bool ʡ=false;ʡ=ˀ(ɽ,ʃ,ȏ);if(!ʡ)ˀ(ʃ,ɽ,Ȉ);}}else{if(ɚ>1)ɚ=6;}ɚ++;if(
  610. ɚ>6)ɚ=0;}void ʠ(){if(ɘ==0)ɘ+=ʩ(ɽ.ToList<IMyTerminalBlock>());if(ɘ==1)ɘ+=ʩ(ʃ.ToList<IMyTerminalBlock>());ɘ++;if(ɘ>1)ɘ=0;}
  611. void ʟ(List<IMyRefinery>ʞ,List<MyItemType>ʝ){foreach(IMyRefinery Ù in ʞ){var æ=Ù.GetInventory(0);var M=new List<
  612. MyInventoryItem>();æ.GetItems(M);if(M.Count<2)continue;bool ʛ=false;int ʚ=0;string ʙ="";foreach(var ʘ in ʝ){for(int E=0;E<M.Count;E++){
  613. if(M[E].Type==ʘ){ʚ=E;ʙ=ʘ.SubtypeId;ʛ=true;break;}}if(ʛ)break;}if(ʚ!=0){æ.TransferItemTo(æ,ʚ,0,true);ɗ=
  614. "Sorted the refining queue.\n'"+ʙ+"' is now at the front of the queue.";}}}void ʜ(List<IMyRefinery>ʣ,List<MyItemType>ʝ){if(ʣ.Count==0){ɚ++;return;}
  615. MyItemType ʧ=new MyItemType();MyItemType ʥ=MyItemType.MakeOre("Stone");foreach(var ʘ in ʝ){if(h(ʘ)>100){ʧ=ʘ;break;}}if(!ʧ.ToString
  616. ().Contains(Ȅ))return;for(int E=0;E<ʣ.Count;E++){if(lj())return;var æ=ʣ[E].GetInventory(0);if((float)æ.CurrentVolume>(
  617. float)æ.MaxVolume*0.75f){var M=new List<MyInventoryItem>();æ.GetItems(M);foreach(var Ì in M){if(Ì.Type==ʧ)return;}
  618. IMyTerminalBlock Ä=W(ʣ[E],ʔ);if(Ä!=null){Ç("",ʣ[E],0,Ä,0);}}}if(!lj())ɚ++;}void ʦ(List<IMyRefinery>ʣ,List<MyItemType>ʝ){if(ʣ.Count==0){ɚ
  619. ++;return;}var ă=new List<IMyTerminalBlock>();ă.AddRange(ɑ);ă.AddRange(ʕ);MyItemType ʥ=MyItemType.MakeOre("Stone");foreach
  620. (var ʘ in ʝ){if(h(ʘ)==0)continue;IMyTerminalBlock ʤ=Z(ʘ,true);if(ʤ==null)continue;for(int E=0;E<ʣ.Count;E++){if(lj())
  621. return;var æ=ʣ[E].GetInventory(0);if((float)æ.CurrentVolume>(float)æ.MaxVolume*0.98f)continue;Ç(ʘ.ToString(),ʤ,0,ʣ[E],0);}}if(
  622. !lj())ɚ++;}bool ˀ(List<IMyRefinery>ˡ,List<IMyRefinery>ˠ,List<MyItemType>ʝ){for(int E=0;E<ˡ.Count;E++){if((float)ˡ[E].
  623. GetInventory(0).CurrentVolume>0.05f)continue;for(int Ɵ=0;Ɵ<ˠ.Count;Ɵ++){if((float)ˠ[Ɵ].GetInventory(0).CurrentVolume>0){foreach(var
  624. ʘ in ʝ){Ç(ʘ.ToString(),ˠ[Ɵ],0,ˡ[E],0,-0.5);}return true;}}}return false;}List<MyItemType>ˑ(List<IMyRefinery>ʣ){if(ʣ.Count
  625. ==0){ɚ++;return null;}List<string>ː=new List<string>(ȉ);ː.Sort((Ɉ,ũ)=>(h(MyItemType.MakeIngot(Ɉ))/Ɯ(Ɉ)).CompareTo((h(
  626. MyItemType.MakeIngot(ũ))/Ɯ(ũ))));ː.InsertRange(0,fixedRefiningList);List<MyItemType>ˎ=new List<MyItemType>();MyItemType K;foreach(
  627. var Ì in ː){K=MyItemType.MakeOre(Ì);foreach(var Ù in ʣ){if(Ù.GetInventory(0).CanItemsBeAdded(1,K)){ˎ.Add(K);break;}}}if(!lj(
  628. ))ɚ++;return ˎ;}void ˏ(){foreach(var ƞ in ɼ){if(ƞ.GetOwnerFactionTag()==Me.GetOwnerFactionTag()){var æ=ƞ.GetInventory(0);
  629. if((float)æ.CurrentVolume==0)continue;if(ƞ.IsQueueEmpty||ƞ.Mode==MyAssemblerMode.Disassembly||(float)æ.CurrentVolume>(
  630. float)æ.MaxVolume*0.98f){IMyTerminalBlock Ä=W(ƞ,ʓ);if(Ä!=null)Ç("",ƞ,0,Ä,0);}}}}void ˮ(){foreach(IMyAssembler ƞ in ɼ){if(ƞ.
  631. Mode==MyAssemblerMode.Disassembly)continue;if(ƞ.CustomData.Contains("skipQueueSorting")){ƞ.CustomData="";continue;}var Ã=new
  632. List<MyProductionItem>();ƞ.GetQueue(Ã);if(Ã.Count<2)continue;double ˬ=Double.MaxValue;int ʚ=0;string ʙ="";for(int E=0;E<Ã.
  633. Count;E++){MyDefinitionId K=ǘ(Ã[E].BlueprintId);double ˤ=h(K);if(ˤ<ˬ){ˬ=ˤ;ʚ=E;ʙ=K.SubtypeId.ToString();}}if(ʚ!=0){ƞ.
  634. MoveQueueItemRequest(Ã[ʚ].ItemId,0);ɗ="Sorted the assembling queue.\n'"+ʙ+"' is now at the front of the queue.";}}}void ˣ(List<
  635. MyDefinitionId>ˢ){if(ˢ.Count==0)return;if(ˢ.Count>1)ˢ.Sort((Ɉ,ũ)=>h(ǘ(Ɉ)).CompareTo(h(ǘ(ũ))));foreach(var ƞ in ɼ){var Ã=new List<
  636. MyProductionItem>();ƞ.GetQueue(Ã);if(Ã.Count<2)continue;foreach(var Û in ˢ){int ƕ=Ã.FindIndex(E=>E.BlueprintId==Û);if(ƕ==-1)continue;if(
  637. ƕ==0){ƞ.CustomData="skipQueueSorting";break;}ƞ.MoveQueueItemRequest(Ã[ƕ].ItemId,0);ƞ.CustomData="skipQueueSorting";ɗ=
  638. "Sorted the assembler queue by priority.\n'"+ǘ(Û).SubtypeId.ToString()+"' is now at the front of the queue.";break;}}}void ʾ(MyDefinitionId Û,double k,bool ã){List<
  639. IMyAssembler>ʼ=new List<IMyAssembler>();foreach(IMyAssembler ƞ in ɼ){if(ƞ.CustomName.Contains(disassembleKeyword))continue;if(ã==
  640. false&&ƞ.Mode==MyAssemblerMode.Disassembly&&!ƞ.IsQueueEmpty)continue;if(ƞ.Mode==MyAssemblerMode.Disassembly){ƞ.ClearQueue();ƞ
  641. .Mode=MyAssemblerMode.Assembly;}if(ƞ.CanUseBlueprint(Û)){ʼ.Add(ƞ);}}if(ʼ.Count==0)ƴ(
  642. "There's no assembler available to produce '"+Û.SubtypeName+"'. Make sure, that you have at least one assembler with no tags or the !assemble-only tag!");ʽ(ʼ,Û,k);}
  643. void ʿ(MyDefinitionId Û,double k){List<IMyAssembler>ʼ=new List<IMyAssembler>();foreach(IMyAssembler ƞ in ɼ){if(ƞ.CustomName.
  644. Contains(assembleKeyword))continue;if(ƞ.Mode==MyAssemblerMode.Assembly&&ƞ.IsProducing)continue;if(ƞ.Mode==MyAssemblerMode.
  645. Assembly){ƞ.ClearQueue();ƞ.Mode=MyAssemblerMode.Disassembly;}if(ƞ.Mode==MyAssemblerMode.Assembly)continue;if(ƞ.CanUseBlueprint(Û
  646. )){ʼ.Add(ƞ);}}if(ʼ.Count==0)ƴ("There's no assembler available to dismantle '"+Û.SubtypeName+
  647. "'. Make sure, that you have at least one assembler with no tags or the !disassemble-only tag!");ʽ(ʼ,Û,k);}void ʽ(List<IMyAssembler>ʼ,MyDefinitionId Û,double k){if(ʼ.Count==0)return;double ˁ=Math.Ceiling(k/ʼ.Count);
  648. foreach(IMyAssembler ƞ in ʼ){if(ˁ>k)ˁ=Math.Ceiling(k);if(k>0){ƞ.InsertQueueItem(0,Û,ˁ);k-=ˁ;}else{break;}}}void ˍ(
  649. MyDefinitionId Û){foreach(IMyAssembler ƞ in ɼ){var Ã=new List<MyProductionItem>();ƞ.GetQueue(Ã);for(int E=0;E<Ã.Count;E++){if(Ã[E].
  650. BlueprintId==Û)ƞ.RemoveQueueItem(E,Ã[E].Amount);}}}void ˋ(){foreach(IMyAssembler ƞ in ɼ){ƞ.UseConveyorSystem=true;ƞ.CooperativeMode
  651. =false;ƞ.Repeating=false;}}void ˌ(){List<IMyAssembler>ˊ=new List<IMyAssembler>(ɼ);ˊ.RemoveAll(Ɉ=>Ɉ.IsQueueEmpty);if(ˊ.
  652. Count==0)return;List<IMyAssembler>ˉ=new List<IMyAssembler>(ɼ);ˉ.RemoveAll(Ɉ=>!Ɉ.IsQueueEmpty);foreach(var ˈ in ˊ){if(ˉ.Count
  653. ==0)return;var Ã=new List<MyProductionItem>();ˈ.GetQueue(Ã);double ˇ=(double)Ã[0].Amount;if(ˇ<=10)continue;double ˆ=Math.
  654. Ceiling(ˇ/2);foreach(var Ǥ in ˉ){if(!Ǥ.CanUseBlueprint(Ã[0].BlueprintId))continue;if(ˈ.Mode==MyAssemblerMode.Assembly&&Ǥ.
  655. CustomName.Contains(disassembleKeyword))continue;if(ˈ.Mode==MyAssemblerMode.Disassembly&&Ǥ.CustomName.Contains(assembleKeyword))
  656. continue;Ǥ.Mode=ˈ.Mode;if(Ǥ.Mode!=ˈ.Mode)continue;Ǥ.AddQueueItem(Ã[0].BlueprintId,ˆ);ˈ.RemoveQueueItem(0,ˆ);ˉ.Remove(Ǥ);break;}}
  657. }void ĕ(){if(ɷ.Count==0)return;double Ô=iceFillLevelPercentage/100;MyDefinitionId ē=MyItemType.MakeOre("Ice");string Ē=ē.
  658. ToString();double đ=0.00037;foreach(IMyGasGenerator Ď in ɷ){var æ=Ď.GetInventory(0);double Đ=h(ē,Ď);double Ĕ=Đ*đ;double ď=(
  659. double)æ.MaxVolume;if(Ĕ>ď*(Ô+0.001)){IMyTerminalBlock Ä=W(Ď,ʔ);if(Ä!=null){double û=(Ĕ-ď*Ô)/đ;Ç(Ē,Ď,0,Ä,0,û);}}else if(Ĕ<ď*(Ô-
  660. 0.001)){IMyTerminalBlock f=Z(ē,true);if(f!=null){double û=(ď*Ô-Ĕ)/đ;Ç(Ē,f,0,Ď,0,û);}}}double č=0;double Č=0;foreach(var Ď in
  661. ɷ){č+=h(ē,Ď);var æ=Ď.GetInventory(0);Č+=(double)æ.MaxVolume;}double ĝ=(č*đ)/Č;foreach(var Ĥ in ɷ){var O=Ĥ.GetInventory(0)
  662. ;double Ģ=h(ē,Ĥ);double ġ=Ģ*đ;double Ġ=(double)O.MaxVolume;if(ġ>Ġ*(ĝ+0.001)){foreach(var ğ in ɷ){if(Ĥ==ğ)continue;var N=ğ
  663. .GetInventory(0);double ģ=h(ē,ğ);double Ğ=ģ*đ;double Ĝ=(double)N.MaxVolume;if(Ğ<Ĝ*(ĝ-0.001)){double ě=((Ĝ*ĝ)-Ğ)/đ;if((Ģ-ě
  664. )*đ>=Ġ*ĝ&&ě>5){Ģ-=Ç(Ē,Ĥ,0,ğ,0,ě);continue;}if((Ģ-ě)*đ<Ġ*ĝ&&ě>5){double Ě=(Ģ*đ-Ġ*ĝ)/đ;Ç(Ē,Ĥ,0,ğ,0,Ě);break;}}}}}}void ę(){
  665. if(ɵ.Count==0)return;MyDefinitionId Ę=MyItemType.MakeIngot("Uranium");string ė=Ę.ToString();double Ė=0;double ċ=0;foreach(
  666. IMyReactor Ċ in ɵ){Ċ.UseConveyorSystem=false;double ñ=h(Ę,Ċ);double ü=uraniumAmountLargeGrid;if(Ċ.CubeGrid.GridSize==0.5f)ü=
  667. uraniumAmountSmallGrid;ċ+=ü;if(ñ>ü+0.05){IMyTerminalBlock Ä=W(Ċ,ʓ);if(Ä!=null){double û=ñ-ü;Ç(ė,Ċ,0,Ä,0,û);}}else if(ñ<ü-0.05){
  668. IMyTerminalBlock f=Z(Ę,true);if(f!=null){double û=ü-ñ;Ç(ė,f,0,Ċ,0,û);}}Ė+=h(Ę,Ċ);}double ú=Ė/ċ;foreach(var ý in ɵ){double ù=h(Ę,ý);
  669. double ø=ú*uraniumAmountLargeGrid;if(ý.CubeGrid.GridSize==0.5f)ø=ú*uraniumAmountSmallGrid;if(ù>ø+0.05){foreach(var ö in ɵ){if(
  670. ý==ö)continue;double õ=h(Ę,ö);double ô=ú*uraniumAmountLargeGrid;if(ö.CubeGrid.GridSize==0.5f)ô=ú*uraniumAmountSmallGrid;
  671. if(õ<ô-0.05){ù=h(Ę,ý);double ó=ô-õ;if(ù-ó>=ø){Ç(ė,ý,0,ö,0,ó);continue;}if(ù-ó<ø){ó=ù-ø;Ç(ė,ý,0,ö,0,ó);break;}}}}}}
  672. StringBuilder ò(IMyTextSurface q,bool ÿ=true,bool Ă=true,bool ĉ=true,bool Ĉ=true,bool ć=true){bool Ć=false;StringBuilder É=new
  673. StringBuilder();if(ÿ){É.Append("Isy's Inventory Manager\n");É.Append(q.Ň('=',q.ū(É))).Append("\n\n");}if(Ă&&Ņ!=null){É.Append(
  674. "Warning!\n"+Ņ+"\n\n");Ć=true;}if(ĉ){É.Append(Ą(q,ʔ,"Ores"));É.Append(Ą(q,ʓ,"Ingots"));É.Append(Ą(q,ʒ,"Components"));É.Append(Ą(q,ʑ,
  675. "Tools"));É.Append(Ą(q,ʐ,"Ammo"));É.Append(Ą(q,ʏ,"Bottles"));É.Append("=> "+ʄ.Count+" type containers: Balancing "+(
  676. balanceTypeContainers?"ON":"OFF")+"\n\n");Ć=true;}if(Ĉ){É.Append("Managed blocks:\n");float ą=q.ū(ɏ.Count.ToString());É.Append(ɏ.Count+
  677. " Inventories (total) / "+ɑ.Count+" have items to sort\n");if(ʕ.Count>0){É.Append(q.Ň(' ',ą-q.ū(ʕ.Count.ToString())).ToString()+ʕ.Count+
  678. " Special Containers\n");}if(ɿ.Count>0){É.Append(q.Ň(' ',ą-q.ū(ɿ.Count.ToString())).ToString()+ɿ.Count+" Refineries: ");É.Append(
  679. "Ore Balancing "+(enableOreBalancing?"ON":"OFF")+"\n");}if(ɷ.Count>0){É.Append(q.Ň(' ',ą-q.ū(ɷ.Count.ToString())).ToString()+ɷ.Count+
  680. " O2/H2 Generators: ");É.Append("Ice Balancing "+(enableIceBalancing?"ON":"OFF")+"\n");}if(ɵ.Count>0){É.Append(q.Ň(' ',ą-q.ū(ɵ.Count.ToString
  681. ())).ToString()+ɵ.Count+" Reactors: ");É.Append("Uranium Balancing "+(enableUraniumBalancing?"ON":"OFF")+"\n");}if(ɼ.
  682. Count>0){É.Append(q.Ň(' ',ą-q.ū(ɼ.Count.ToString())).ToString()+ɼ.Count+" Assemblers: ");É.Append("Craft "+(
  683. enableAutocrafting?"ON":"OFF")+" | ");É.Append("Uncraft "+(enableAutodisassembling?"ON":"OFF")+" | ");É.Append("Cleanup "+(
  684. enableAssemblerCleanup?"ON":"OFF")+"\n");}if(ɸ.Count>0){É.Append(q.Ň(' ',ą-q.ū(ɸ.Count.ToString())).ToString()+ɸ.Count+" Survival Kits: ");É.
  685. Append("Ingot Crafting "+(enableBasicIngotCrafting?"ON":"OFF")+(ɿ.Count>0?" (Auto OFF - refineries exist)":"")+"\n");}É.Append
  686. ("\n");Ć=true;}if(ć&&ɗ!=""){É.Append("Last Action:\n"+ɗ);Ć=true;}if(!Ć){É.Append("-- No informations to show --");}return
  687. É;}StringBuilder Ą(IMyTextSurface q,List<IMyTerminalBlock>ă,string P){double ā=0,Ā=0;foreach(var X in ă){var æ=X.
  688. GetInventory(0);ā+=(double)æ.CurrentVolume;Ā+=(double)æ.MaxVolume;}string Ë=ă.Count+"x "+P+":";string þ=ā.ž();string ĥ=Ā.ž();
  689. StringBuilder Ĵ=ǖ(q,Ë,ā,Ā,þ,ĥ);return Ĵ;}void Ń(string ł=null){if(ɔ.Count==0){ɤ++;return;}for(int E=ɟ;E<ɔ.Count;E++){if(lj())return;ɟ
  690. ++;var į=ɔ[E].Ɗ(mainLCDKeyword);foreach(var Į in į){var ĭ=Į.Key;var ĵ=Į.Value;if(!ĭ.GetText().EndsWith("\a")){ĭ.Font=
  691. defaultFont;ĭ.FontSize=defaultFontSize;ĭ.TextPadding=defaultPadding;ĭ.Alignment=TextAlignment.LEFT;ĭ.ContentType=ContentType.
  692. TEXT_AND_IMAGE;}bool ÿ=ĵ.Ɩ("showHeading");bool Ă=ĵ.Ɩ("showWarnings");bool ĉ=ĵ.Ɩ("showContainerStats");bool Ĉ=ĵ.Ɩ("showManagedBlocks");
  693. bool ć=ĵ.Ɩ("showLastAction");bool ŀ=ĵ.Ɩ("scrollTextIfNeeded");StringBuilder É=new StringBuilder();if(ł!=null){É.Append(ł);}
  694. else{É=ò(ĭ,ÿ,Ă,ĉ,Ĉ,ć);}É=ĭ.Ŝ(É,ÿ?3:0,ŀ);ĭ.WriteText(É.Append("\a"));}}ɤ++;ɟ=0;}void Ŀ(){if(ɓ.Count==0){ɤ++;return;}
  695. StringBuilder Ł=new StringBuilder();if(ɬ.Count==0){Ł.Append("- No problems detected -");}else{int ń=1;foreach(var Ņ in ɬ){Ł.Append(ń+
  696. ". "+Ņ.Replace("\n"," ")+"\n");ń++;}}for(int E=ɞ;E<ɓ.Count;E++){if(lj())return;ɞ++;var į=ɓ[E].Ɗ(warningsLCDKeyword);foreach(
  697. var Į in į){var ĭ=Į.Key;var ĵ=Į.Value;if(!ĭ.GetText().EndsWith("\a")){ĭ.Font=defaultFont;ĭ.FontSize=defaultFontSize;ĭ.
  698. TextPadding=defaultPadding;ĭ.Alignment=TextAlignment.LEFT;ĭ.ContentType=ContentType.TEXT_AND_IMAGE;}bool ÿ=ĵ.Ɩ("showHeading");bool
  699. ŀ=ĵ.Ɩ("scrollTextIfNeeded");StringBuilder É=new StringBuilder();if(ÿ){É.Append("Isy's Inventory Manager Warnings\n");É.
  700. Append(ĭ.Ň('=',ĭ.ū(É))).Append("\n\n");}É.Append(Ł);É=ĭ.Ŝ(É,ÿ?3:0,ŀ);ĭ.WriteText(É.Append("\a"));}}ɤ++;ɞ=0;}void ņ(){if(ə.
  701. Count==0){ɤ++;return;}for(int E=ɝ;E<ə.Count;E++){if(lj())return;ɝ++;var į=ə[E].Ɗ(performanceLCDKeyword);foreach(var Į in į){
  702. var ĭ=Į.Key;var ĵ=Į.Value;if(!ĭ.GetText().EndsWith("\a")){ĭ.Font=defaultFont;ĭ.FontSize=defaultFontSize;ĭ.TextPadding=
  703. defaultPadding;ĭ.Alignment=TextAlignment.LEFT;ĭ.ContentType=ContentType.TEXT_AND_IMAGE;}bool ÿ=ĵ.Ɩ("showHeading");bool ŀ=ĵ.Ɩ(
  704. "scrollTextIfNeeded");StringBuilder É=new StringBuilder();if(ÿ){É.Append("Isy's Inventory Manager Performance\n");É.Append(ĭ.Ň('=',ĭ.ū(É))).
  705. Append("\n\n");}É.Append(ɫ);É=ĭ.Ŝ(É,ÿ?3:0,ŀ);ĭ.WriteText(É.Append("\a"));}}ɤ++;ɝ=0;}void ľ(){if(ɣ.Count==0){ɤ++;return;}
  706. Dictionary<IMyTextSurface,string>Ħ=new Dictionary<IMyTextSurface,string>();Dictionary<IMyTextSurface,string>IJ=new Dictionary<
  707. IMyTextSurface,string>();List<IMyTextSurface>ı=new List<IMyTextSurface>();List<IMyTextSurface>İ=new List<IMyTextSurface>();foreach(var
  708. e in ɣ){var į=e.Ɗ(inventoryLCDKeyword);foreach(var Į in į){if(Į.Value.Contains(inventoryLCDKeyword+":")){Ħ[Į.Key]=Į.Value
  709. ;ı.Add(Į.Key);}else{IJ[Į.Key]=Į.Value;İ.Add(Į.Key);}}}HashSet<string>ij=new HashSet<string>();foreach(var ĭ in Ħ){ij.Add(
  710. System.Text.RegularExpressions.Regex.Match(ĭ.Value,inventoryLCDKeyword+@":[A-Za-z]+").Value);}ij.RemoveWhere(ī=>ī=="");List<
  711. string>Ī=ij.ToList();for(int E=ɜ;E<Ī.Count;E++){if(lj())return;ɜ++;var ĩ=Ħ.Where(Ĩ=>Ĩ.Value.Contains(Ī[E]));var ħ=from pair in ĩ
  712. orderby System.Text.RegularExpressions.Regex.Match(pair.Value,inventoryLCDKeyword+@":\w+").Value ascending select pair;
  713. IMyTextSurface Ĭ=ħ.ElementAt(0).Key;string ĵ=ħ.ElementAt(0).Value;StringBuilder É=Ķ(Ĭ,ĵ);if(!ĵ.ToLower().Contains("noscroll")){int Ľ=0
  714. ;foreach(var ļ in ħ){Ľ+=ļ.Key.ō();}É=Ĭ.Ŝ(É,0,true,Ľ);}var Ļ=É.ToString().Split('\n');int ĺ=Ļ.Length;int Ĺ=0;int ĸ,ķ;
  715. foreach(var ļ in ħ){IMyTextSurface ĭ=ļ.Key;ĭ.FontSize=Ĭ.TextureSize.Y/ĭ.TextureSize.Y*Ĭ.FontSize;ĭ.Font=Ĭ.Font;ĭ.TextPadding=Ĭ.
  716. TextPadding;ĭ.Alignment=Ĭ.Alignment;ĭ.ContentType=ContentType.TEXT_AND_IMAGE;ĸ=ĭ.ō();ķ=0;É.Clear();while(Ĺ<ĺ&&ķ<ĸ){É.Append(Ļ[Ĺ]+
  717. "\n");Ĺ++;ķ++;}ĭ.WriteText(É);}}for(int E=ɛ;E<İ.Count;E++){if(lj())return;ɛ++;IMyTextSurface ĭ=İ[E];string ĵ=IJ[ĭ];
  718. StringBuilder É=Ķ(ĭ,ĵ);if(!ĵ.ToLower().Contains("noscroll")){É=ĭ.Ŝ(É,0);}ĭ.WriteText(É);ĭ.Alignment=TextAlignment.LEFT;ĭ.ContentType=
  719. ContentType.TEXT_AND_IMAGE;}ɤ++;ɜ=0;ɛ=0;}StringBuilder Ķ(IMyTextSurface q,string ĵ){StringBuilder É=new StringBuilder();var ð=ĵ.
  720. Split('\n').ToList();ð.RemoveAll(S=>S.StartsWith("@")||S.Length<=1);bool Á=true;try{if(ð[0].Length<=1)Á=false;}catch{Á=false;
  721. }if(!Á){É.Append("Put an item, type name or Echo command in the custom data.\n\n"+
  722. "Examples:\nComponent\nIngot\nSteelPlate\nEcho My cool text\n\n"+"Optionally, add a max amount for the bars as a 2nd parameter.\n\n"+"Example:\nIngot 100000\n\n"+
  723. "At last, add any of these 5 modifiers (optional):\n\n"+"'noHeading' to hide the heading\n"+"'singleLine' to force one line per item\n"+"'noBar' to hide the bars\n"+
  724. "'noScroll' to prevent the screen from scrolling\n"+"'hideEmpty' to hide items that have an amount of 0\n\n"+
  725. "Examples:\nComponent 100000 noBar\nSteelPlate noHeading noBar hideEmpty\n\n"+"To display multiple different items, use a new line for every item!\n"+
  726. "Full guide: https://steamcommunity.com/sharedfiles/filedetails/?id=1226261795");q.Font=defaultFont;q.FontSize=defaultFontSize;q.TextPadding=defaultPadding;}else{foreach(var À in ð){var º=À.Split(' '
  727. );double w=-1;bool µ=false;bool ª=false;bool Â=false;bool z=false;if(º.Length>=2){try{w=Convert.ToDouble(º[1]);}catch{w=-
  728. 1;}}string v=À.ToLower();if(v.Contains("noheading"))µ=true;if(v.Contains("nobar"))ª=true;if(v.Contains("hideempty"))Â=
  729. true;if(v.Contains("singleline"))z=true;if(v.StartsWith("echoc")){string u=À.Ŷ("echoc ","").Ŷ("echoc","");É.Append(q.Ň(' ',(
  730. q.Ŋ()-q.ū(u))/2)).Append(u+"\n");}else if(v.StartsWith("echor")){string u=À.Ŷ("echor ","").Ŷ("echor","");É.Append(q.Ň(' '
  731. ,q.Ŋ()-q.ū(u))).Append(u+"\n");}else if(v.StartsWith("echo")){É.Append(À.Ŷ("echo ","").Ŷ("echo","")+"\n");}else{É.Append(
  732. r(q,º[0],w,µ,ª,Â,z));}}}return É.Replace("\n","",0,2);}StringBuilder r(IMyTextSurface q,string o,double w,bool µ=false,
  733. bool ª=false,bool Â=false,bool z=false){StringBuilder É=new StringBuilder();bool Í=w==-1?true:false;foreach(var Ì in Ȝ){if(Ì
  734. .ToString().ToLower().Contains(o.ToLower())){if(É.Length==0&&!µ){string Ë="Items containing '"+char.ToUpper(o[0])+o.
  735. Substring(1).ToLower()+"'";É.Append("\n"+q.Ň(' ',(q.Ŋ()-q.ū(Ë))/2)).Append(Ë+"\n\n");}double k=h(Ì);if(k==0&&Â)continue;if(Í)w=ơ(
  736. Ì);É.Append(ǖ(q,Ì.SubtypeId.ToString(),k,w,k.Ƃ(),w.Ƃ(),ª,z));}}if(É.Length==0&&!Â){É.Append("Error!\n\n");É.Append(
  737. "No items containing '"+o+"' found!\nCheck the custom data of this LCD and enter a valid type or item name!\n");}return É;}void Î(string Ê=""){
  738. ɕ=ɕ>=3?0:ɕ+1;Echo("Isy's Inventory Manager "+ɖ[ɕ]+"\n====================\n");if(Ņ!=null){Echo("Warning!\n"+Ņ+"\n");}
  739. StringBuilder É=new StringBuilder();É.Append("Script is running in "+(ǭ?"station":"ship")+" mode\n\n");É.Append("Task: "+Ǧ[ɧ]+Ê+"\n")
  740. ;É.Append("Script step: "+ɧ+" / "+(Ǧ.Length-1)+"\n\n");É.Append(ƹ);if(ʍ.Count>0){É.Append(
  741. "Excluded grids:\n============\n\n");foreach(var È in ʍ){É.Append(È.CustomName+"\n");}}ɫ=É;Echo(É.ToString());if(ɔ.Count==0){Echo(
  742. "Hint:\nBuild a LCD and add the main LCD\nkeyword '"+mainLCDKeyword+"' to its name to get\nmore informations about your base\nand the current script actions.\n");}}double Ç
  743. (string Æ,IMyTerminalBlock f,int Å,IMyTerminalBlock Ä,int m,double k=-1,bool A=false){var O=f.GetInventory(Å);var N=Ä.
  744. GetInventory(m);if(!O.IsConnectedTo(N)){ƴ("'"+f.CustomName+"'\nis not connected to '"+Ä.CustomName+"'\nItem transfer aborted!");
  745. return 0;}if((float)N.CurrentVolume>(float)N.MaxVolume*0.98f)return 0;var M=new List<MyInventoryItem>();O.GetItems(M);if(M.
  746. Count==0)return 0;double L=0;MyDefinitionId K=new MyDefinitionId();MyDefinitionId J=new MyDefinitionId();string P="";string I
  747. ="";bool G=false;string F="";if(k==-0.5)F="halfInventory";if(k==-1)F="completeInventory";for(int E=M.Count-1;E>=0;E--){K=
  748. M[E].Type;if(A?K.ToString()==Æ:K.ToString().Contains(Æ)){if(F!=""&&K!=J)L=0;J=K;P=K.TypeId.ToString().Replace(ȅ,"");I=K.
  749. SubtypeId.ToString();G=true;if(!O.CanTransferItemTo(N,K)){ƴ("'"+I+"' couldn't be transferred\nfrom '"+f.CustomName+"'\nto '"+Ä.
  750. CustomName+"'\nThe conveyor type is too small!");return 0;}double D=(double)M[E].Amount;double C=0;if(F=="completeInventory"){O.
  751. TransferItemTo(N,E,null,true);}else if(F=="halfInventory"){double B=Math.Ceiling((double)M[E].Amount/2);O.TransferItemTo(N,E,null,true
  752. ,(VRage.MyFixedPoint)B);}else{if(!P.Contains(ȃ))k=Math.Ceiling(k);O.TransferItemTo(N,E,null,true,(VRage.MyFixedPoint)k);}
  753. M.Clear();O.GetItems(M);try{if((MyDefinitionId)M[E].Type==K){C=(double)M[E].Amount;}}catch{C=0;}double H=D-C;L+=H;k-=H;if
  754. (k<=0&&F=="")break;}}if(!G)return 0;if(L>0){string R=Math.Round(L,2)+" "+I+" "+P;ɗ="Moved: "+R+"\nfrom: '"+f.CustomName+
  755. "'\nto: '"+Ä.CustomName+"'";}else{string R=Math.Round(k,2)+" "+Æ.Replace(ȅ,"");if(F=="completeInventory")R="all items";if(F==
  756. "halfInventory")R="half of the items";ƴ("Couldn't move '"+R+"'\nfrom '"+f.CustomName+"'\nto '"+Ä.CustomName+
  757. "'\nCheck conveyor connection and owner/faction!");}return L;}double h(MyDefinitionId K,IMyTerminalBlock e,int d=0){return(double)e.GetInventory(d).GetItemAmount(K);;}
  758. IMyTerminalBlock Z(MyDefinitionId K,bool Y=false,IMyTerminalBlock f=null){try{if(ʉ.GetInventory(0).FindItem(K)!=null&&ʉ!=f){return ʉ;}}
  759. catch{}foreach(var X in ɑ){if(K.SubtypeId.ToString()=="Ice"&&X.GetType().ToString().Contains("MyGasGenerator"))continue;if(X.
  760. GetInventory(0).FindItem(K)!=null){ʉ=X;return X;}}if(Y){foreach(var X in ʕ){if(f!=null){if(å(X)<=å(f))continue;}if(X.GetInventory(0)
  761. .FindItem(K)!=null){ʉ=X;return X;}}}return null;}IMyTerminalBlock W(IMyTerminalBlock Q,List<IMyTerminalBlock>V){
  762. IMyTerminalBlock U=null;U=T(Q,V);if(U!=null)return U;U=T(Q,ɢ);if(U==null)ƴ("'"+Q.CustomName+
  763. "'\nhas no empty containers to move its items!");return U;}IMyTerminalBlock T(IMyTerminalBlock Q,List<IMyTerminalBlock>V){var Ó=Q.GetInventory(0);foreach(var X in V){
  764. if(X==Q)continue;var æ=X.GetInventory(0);if((float)æ.CurrentVolume<(float)æ.MaxVolume*0.95f){if(!X.GetInventory(0).
  765. IsConnectedTo(Ó))continue;return X;}}return null;}int å(IMyTerminalBlock e){string ä=System.Text.RegularExpressions.Regex.Match(e.
  766. CustomName,@"\[p(\d+|max|min)\]",System.Text.RegularExpressions.RegexOptions.IgnoreCase).Groups[1].Value.ToLower();int ã=0;bool â=
  767. true;if(ä=="max"){ã=int.MinValue;}else if(ä=="min"){ã=int.MaxValue;}else{â=Int32.TryParse(ä,out ã);}if(!â){string È=e.
  768. IsSameConstructAs(Me)?"":"1";Int32.TryParse(È+e.EntityId.ToString().Substring(0,4),out ã);}return ã;}string á(string Þ){ï();var à=Storage
  769. .Split('\n');foreach(var À in à){if(À.Contains(Þ)){return À.Replace(Þ+"=","");}}return"";}void ß(string Þ,string Ý=""){ï(
  770. );var à=Storage.Split('\n');string ç="";foreach(var À in à){if(À.Contains(Þ)){ç+=Þ+"="+Ý+"\n";}else{ç+=À+"\n";}}Storage=ç
  771. .TrimEnd('\n');}void ï(){var à=Storage.Split('\n');if(à.Length!=Ɍ.Count){string ç="";foreach(var Ì in Ɍ){ç+=Ì.Key+"="+Ì.
  772. Value+"\n";}Storage=ç.TrimEnd('\n');}}void í(IMyTerminalBlock X){foreach(var ì in Ǯ.Keys.ToList()){Ǯ[ì]="0";}List<string>î=X.
  773. CustomData.Replace(" ","").TrimEnd('\n').Split('\n').ToList();î.RemoveAll(À=>!À.Contains("=")||À.Length<8);bool ë=false;foreach(
  774. var À in î){var ê=À.Split('=');if(!Ǯ.ContainsKey(ê[0])){MyDefinitionId K;if(MyDefinitionId.TryParse(ȅ+ê[0],out K)){Ü(K);ë=
  775. true;}}Ǯ[ê[0]]=ê[1];}if(ë)Ð();List<string>é=new List<string>{"Special Container modes:","",
  776. "Positive number: stores wanted amount, removes excess (e.g.: 100)","Negative number: doesn't store items, only removes excess (e.g.: -100)",
  777. "Keyword 'all': stores all items of that subtype (like a type container)",""};foreach(var Ì in Ǯ){é.Add(Ì.Key+"="+Ì.Value);}X.CustomData=string.Join("\n",é);}void è(){ʅ.Clear();ʅ.AddRange(Ƞ);ʅ.
  778. AddRange(ș);ʅ.AddRange(ȗ);ʅ.AddRange(Ȗ);ʅ.AddRange(ȕ);ʅ.AddRange(Ȓ);Ǯ.Clear();foreach(var Ì in Ƞ){Ǯ[Ȃ+"/"+Ì]="0";}foreach(var Ì
  779. in ț){Ǯ[Ȅ+"/"+Ì]="0";}foreach(var Ì in Ț){Ǯ[ȃ+"/"+Ì]="0";}foreach(var Ì in ș){Ǯ[ȁ+"/"+Ì]="0";}foreach(var Ì in ȗ){Ǯ[ȇ+"/"+
  780. Ì]="0";}foreach(var Ì in Ȗ){Ǯ[Ȑ+"/"+Ì]="0";}foreach(var Ì in ȕ){Ǯ[Ș+"/"+Ì]="0";}foreach(var Ì in Ȕ){Ǯ[ȡ+"/"+Ì]="0";}
  781. foreach(var Ì in ȓ){Ǯ[ȟ+"/"+Ì]="0";}foreach(var Ì in Ȓ){Ǯ[Ȟ+"/"+Ì]="0";}}void Ò(){for(int E=ɡ;E<ɏ.Count;E++){if(lj())return;if(ɡ
  782. >=ɏ.Count-1){ɡ=0;}else{ɡ++;}var M=new List<MyInventoryItem>();ɏ[E].GetInventory(0).GetItems(M);foreach(var Ì in M){
  783. MyDefinitionId K=Ì.Type;if(Ȝ.Contains(K))continue;ɗ="Found new item!\n"+K.SubtypeId.ToString()+" ("+K.TypeId.ToString().Replace(ȅ,"")+
  784. ")";Ú(K);Ü(K);ƭ(K);}}}bool Ð(){Ö();var Ï=Me.CustomData.Split('\n');GridTerminalSystem.GetBlocksOfType(ɼ);bool Ñ=false;
  785. foreach(var À in Ï){var Ø=À.Split(';');if(Ø.Length<2)continue;MyDefinitionId K;if(!MyDefinitionId.TryParse(Ø[0],out K))continue
  786. ;if(ɼ.Count==0){Ñ=true;}else{MyDefinitionId Û;if(MyDefinitionId.TryParse(Ø[1],out Û)){if(Ʈ(Û)){Ǚ(K,Û);}else{Ƶ(K);continue
  787. ;}}}Ú(K);Ǖ(K);}if(Ñ)return false;return true;}void Ú(MyDefinitionId K){string P=K.TypeId.ToString().Replace(ȅ,"");string
  788. I=K.SubtypeId.ToString();if(P==Ȅ){ț.Add(I);Ɲ(I);if(!I.Contains("Ice")){foreach(var Ù in ɿ){if(Ù.GetInventory(0).
  789. CanItemsBeAdded(1,K)){ȉ.Add(I);break;}}}}else if(P==ȃ){Ț.Add(I);}else if(P==Ȃ){Ƞ.Add(I);}else if(P==ȁ){ș.Add(I);}else if(P==ȇ){ȗ.Add(I)
  790. ;}else if(P==Ȑ){Ȗ.Add(I);}else if(P==Ș){ȕ.Add(I);}else if(P==ȡ){Ȕ.Add(I);}else if(P==ȟ){ȓ.Add(I);}else if(P==Ȟ){Ȓ.Add(I);
  791. }}void Ü(MyDefinitionId K){Ö();var Ï=Me.CustomData.Split('\n').ToList();foreach(var À in Ï){try{if(À.Substring(0,À.
  792. IndexOf(";"))==K.ToString())return;}catch{}}for(int E=Ï.Count-1;E>=0;E--){if(Ï[E].Contains(";")){Ï.Insert(E+1,K+";noBP");break;
  793. }}Me.CustomData=String.Join("\n",Ï);Ǖ(K);}void Ö(){if(!Me.CustomData.Contains(Ɏ)){Me.CustomData=(ǭ?Ǭ:Dz)+Ɏ;}}void Õ(){if(Ȍ
  794. !=null){var M=new List<MyInventoryItem>();Ȍ.GetInventory(1).GetItems(M);var Ã=new List<MyProductionItem>();Ȍ.GetQueue(Ã);
  795. if(M.Count==0)return;Ȍ.CustomName=ȋ;MyDefinitionId Û=Ã[0].BlueprintId;MyDefinitionId K=M[0].Type;if(M.Count==1&&Ã.Count==1
  796. &&Ȍ.Mode==MyAssemblerMode.Assembly&&Û==Ȋ){if(ȋ.Contains(learnKeyword)&&!ȋ.Contains(learnManyKeyword))Ȍ.CustomName=ȋ.
  797. Replace(" "+learnKeyword,"").Replace(learnKeyword+" ","");Ȍ.ClearQueue();Ȋ=new MyDefinitionId();ɗ="Learned new Blueprint!\n'"+Û
  798. .ToString().Replace(ȅ,"")+"'\nproduces: '"+K.ToString().Replace(ȅ,"")+"'";Ǖ(K);Ú(K);Ǚ(K,Û);Ü(K);ư(K,Û);Ư(Ȍ);Ȍ=null;return
  799. ;}else if(Ã.Count!=1){ƴ("Blueprint learning aborted!\nExactly 1 itemstack in the queue is needed to learn new recipes!");
  800. }}Ȍ=null;Ȋ=new MyDefinitionId();foreach(var ƞ in ɹ){var Ã=new List<MyProductionItem>();ƞ.GetQueue(Ã);if(Ã.Count==1&&ƞ.
  801. Mode==MyAssemblerMode.Assembly){if(!Ư(ƞ))return;Ȍ=ƞ;Ȋ=Ã[0].BlueprintId;ȋ=ƞ.CustomName;ƞ.CustomName="Learning "+Ȋ.SubtypeName
  802. +" in: "+ƞ.CustomName;return;}}}bool Ư(IMyAssembler ƞ){if(ƞ.GetInventory(1).ItemCount!=0){IMyTerminalBlock Ä=W(ƞ,ʒ);if(Ä
  803. !=null){Ç("",ƞ,1,Ä,0);return true;}else{ƴ(
  804. "Can't learn blueprint!\nNo free containers to clear the output inventory found!");return false;}}return true;}bool Ʈ(MyDefinitionId Û){try{foreach(var ƞ in ɼ){if(ƞ.CanUseBlueprint(Û))return true;}}
  805. catch{return false;}return false;}void ƭ(MyDefinitionId K){if(ɼ.Count==0)return;if(K.TypeId.ToString()==ȅ+Ȅ||K.TypeId.
  806. ToString()==ȅ+ȃ)return;MyDefinitionId Û;bool ƫ=DZ.TryGetValue(K,out Û);if(ƫ)ƫ=Ʈ(Û);if(!ƫ){var ƪ=new List<string>{"BP","",
  807. "Component","Magazine","_Blueprint"};bool Ʃ=false;foreach(var ƨ in ƪ){string Ƭ=ȝ+K.SubtypeId.ToString().Replace("Item","")+ƨ;
  808. MyDefinitionId.TryParse(Ƭ,out Û);Ʃ=Ʈ(Û);if(Ʃ){Ǚ(K,Û);ư(K,Û);ƫ=true;return;}}}}void ư(MyDefinitionId K,MyDefinitionId Û){Ö();var Ï=Me.
  809. CustomData.Split('\n');for(var E=0;E<Ï.Length;E++){if(Ï[E].Substring(0,Ï[E].IndexOf(";"))!=K.ToString())continue;var Ø=Ï[E].Split(
  810. ';');Ï[E]=Ø[0]+";"+Û.ToString();Me.CustomData=String.Join("\n",Ï);return;}}void Ƶ(MyDefinitionId K){Ö();var Ï=Me.CustomData
  811. .Split('\n').ToList();Ï.RemoveAll(E=>E.Contains(K.ToString()+";"));Me.CustomData=String.Join("\n",Ï);}void ƴ(string ł){ɬ.
  812. Add(ł);ɪ.Add(ł);Ņ=ɬ.ElementAt(0);}void Ƴ(){Me.CustomData="";foreach(var X in ʕ){List<string>Ï=X.CustomData.Replace(" ","").
  813. TrimEnd('\n').Split('\n').ToList();Ï.RemoveAll(À=>!À.Contains("=")||À.Contains("=0"));X.CustomData=string.Join("\n",Ï);}Echo(
  814. "Stored items deleted!\n");if(ʕ.Count>0)Echo("Also deleted itemlists of "+ʕ.Count+" Special containers!\n");Echo(
  815. "Please hit 'Recompile'!\n\nScript stopped!");}void Ʋ(){ȑ.Clear();List<IMyTerminalBlock>Ʊ=ɺ.ToList<IMyTerminalBlock>();List<IMyTerminalBlock>Ƨ=ɾ.ToList<
  816. IMyTerminalBlock>();Ʀ(ɏ,0);Ʀ(Ʊ,1);Ʀ(Ƨ,1);}void Ʀ(List<IMyTerminalBlock>ƙ,int d){for(int E=0;E<ƙ.Count;E++){var M=new List<
  817. MyInventoryItem>();ƙ[E].GetInventory(d).GetItems(M);for(int Ɵ=0;Ɵ<M.Count;Ɵ++){MyDefinitionId K=M[Ɵ].Type;if(ȑ.ContainsKey(K)){ȑ[K]+=(
  818. double)M[Ɵ].Amount;}else{ȑ[K]=(double)M[Ɵ].Amount;}}}}double h(MyDefinitionId K){double Ų;ȑ.TryGetValue(K,out Ų);return Ų;}
  819. void Ɲ(string ƛ){if(!Ȇ.ContainsKey(ƛ)){Ȇ[ƛ]=0.5;}}double Ɯ(string ƛ){double Ų;ƛ=ƛ.Replace(ȅ+Ȅ+"/","");Ȇ.TryGetValue(ƛ,out Ų)
  820. ;return Ų!=0?Ų:0.5;}void ƚ(){Ȁ.Clear();foreach(IMyAssembler ƞ in ɼ){var Ã=new List<MyProductionItem>();ƞ.GetQueue(Ã);if(Ã
  821. .Count>0&&!ƞ.IsProducing){if(ƞ.Mode==MyAssemblerMode.Assembly)ƴ("'"+ƞ.CustomName+
  822. "' has a queue but is currently not assembling!\nAre there enough ingots for the craft?");if(ƞ.Mode==MyAssemblerMode.Disassembly)ƴ("'"+ƞ.CustomName+
  823. "' has a queue but is currently not disassembling!\nAre the items to disassemble missing?");}foreach(var Ì in Ã){MyDefinitionId Û=Ì.BlueprintId;if(Ȁ.ContainsKey(Û)){Ȁ[Û]+=(double)Ì.Amount;}else{Ȁ[Û]=(double)Ì.
  824. Amount;}}}}double Ƥ(MyDefinitionId Û){double Ų;Ȁ.TryGetValue(Û,out Ų);return Ų;}void ƣ(MyDefinitionId K,double k){ǿ[K]=k;}
  825. double ƥ(MyDefinitionId Û){int Ų;if(!ǥ.TryGetValue(Û,out Ų))Ų=0;return Ų;}void Ƣ(MyDefinitionId K,int Ý){ǥ[K]=Ý;}double ơ(
  826. MyDefinitionId Û){double Ų;if(!ǿ.TryGetValue(Û,out Ų))Ų=100000;return Ų;}MyDefinitionId ƶ(MyDefinitionId K,out bool ƫ){MyDefinitionId
  827. Û;ƫ=DZ.TryGetValue(K,out Û);return Û;}MyDefinitionId ǘ(MyDefinitionId Û){MyDefinitionId K;ǰ.TryGetValue(Û,out K);return K;
  828. }bool Ǘ(MyDefinitionId Û){return ǰ.ContainsKey(Û);}void Ǚ(MyDefinitionId K,MyDefinitionId Û){DZ[K]=Û;ǰ[Û]=K;}void Ǖ(
  829. MyDefinitionId K){Ȝ.Add(K);ǯ[K.SubtypeId.ToString()]=K;}MyDefinitionId ǔ(string I){MyDefinitionId K=new MyDefinitionId();ǯ.TryGetValue
  830. (I,out K);return K;}StringBuilder ǖ(IMyTextSurface q,string Ë,double Ý,double ǣ,string Ǣ=null,string ǡ=null,bool ª=false,
  831. bool Ǡ=false){string þ=Ý.ToString();string ĥ=ǣ.ToString();if(Ǣ!=null){þ=Ǣ;}if(ǡ!=null){ĥ=ǡ;}float Ů=q.FontSize;float ő=q.Ŋ()
  832. ;char ǟ=' ';float Ǟ=q.ş(ǟ);StringBuilder ǝ=new StringBuilder(" "+Ý.ƀ(ǣ));ǝ=q.Ň(ǟ,q.ū("99999.9%")-q.ū(ǝ)).Append(ǝ);
  833. StringBuilder ǜ=new StringBuilder(þ+" / "+ĥ);StringBuilder Ǜ=new StringBuilder();StringBuilder ǚ=new StringBuilder();StringBuilder Ǔ;
  834. if(ǣ==0){Ǜ.Append(Ë+" ");Ǔ=q.Ň(ǟ,ő-q.ū(Ǜ)-q.ū(þ));Ǜ.Append(Ǔ).Append(þ);return Ǜ.Append("\n");}double ǃ=0;if(ǣ>0)ǃ=Ý/ǣ>=1?
  835. 1:Ý/ǣ;if(Ǡ&&!ª){if(Ů<=0.5||(Ů<=1&&ő>512)){Ǜ.Append(Ʒ(q,ő*0.25f,ǃ)+" "+Ë);Ǔ=q.Ň(ǟ,ő*0.75-q.ū(Ǜ)-q.ū(þ+" /"));Ǜ.Append(Ǔ).
  836. Append(ǜ);Ǔ=q.Ň(ǟ,ő-q.ū(Ǜ)-q.ū(ǝ));Ǜ.Append(Ǔ);Ǜ.Append(ǝ);}else{Ǜ.Append(Ʒ(q,ő*0.3f,ǃ)+" "+Ë);Ǔ=q.Ň(ǟ,ő-q.ū(Ǜ)-q.ū(ǝ));Ǜ.
  837. Append(Ǔ);Ǜ.Append(ǝ);}}else{Ǜ.Append(Ë+" ");if(Ů<=0.6||(Ů<=1&&ő>512)){Ǔ=q.Ň(ǟ,ő*0.5-q.ū(Ǜ)-q.ū(þ+" /"));Ǜ.Append(Ǔ).Append(ǜ)
  838. ;Ǔ=q.Ň(ǟ,ő-q.ū(Ǜ)-q.ū(ǝ));Ǜ.Append(Ǔ).Append(ǝ);if(!ª){ǚ=Ʒ(q,ő,ǃ).Append("\n");}}else{Ǔ=q.Ň(ǟ,ő-q.ū(Ǜ)-q.ū(ǜ));Ǜ.Append(Ǔ
  839. ).Append(ǜ);if(!ª){ǚ=Ʒ(q,ő-q.ū(ǝ),ǃ);ǚ.Append(ǝ).Append("\n");}}}return Ǜ.Append("\n").Append(ǚ);}StringBuilder Ʒ(
  840. IMyTextSurface q,float ů,double ǃ){StringBuilder ǂ,ǁ;char ǀ='[';char DŽ=']';char ƿ='I';char ƽ='.';float Ƽ=q.ş(ǀ);float ƻ=q.ş(DŽ);float ƺ
  841. =ů-Ƽ-ƻ;ǂ=q.Ň(ƿ,ƺ*ǃ);ǁ=q.Ň(ƽ,ƺ-q.ū(ǂ));return new StringBuilder().Append(ǀ).Append(ǂ).Append(ǁ).Append(DŽ);}StringBuilder ƹ
  842. =new StringBuilder("No performance Information available!");Dictionary<string,int>Ƹ=new Dictionary<string,int>();List<int
  843. >ƾ=new List<int>(new int[600]);List<double>Dž=new List<double>(new double[600]);double NJ,ǒ,ǐ,Ǐ,ǎ;int Ǎ,nj=0;void Nj(string Ǒ
  844. ){nj=nj>=599?0:nj+1;Ǎ=Runtime.CurrentInstructionCount;if(Ǎ>ǒ)ǒ=Ǎ;ƾ[nj]=Ǎ;Ǐ=ƾ.Sum()/ƾ.Count;ƹ.Clear();ƹ.Append(
  845. "Instructions: "+Ǎ+" / "+Runtime.MaxInstructionCount+"\n");ƹ.Append("Max. Instructions: "+ǒ+" / "+Runtime.MaxInstructionCount+"\n");ƹ.
  846. Append("Avg. Instructions: "+Math.Floor(Ǐ)+" / "+Runtime.MaxInstructionCount+"\n\n");NJ=Runtime.LastRunTimeMs;if(NJ>ǐ&&Ƹ.
  847. ContainsKey(Ǒ))ǐ=NJ;Dž[nj]=NJ;ǎ=Dž.Sum()/Dž.Count;ƹ.Append("Last runtime: "+Math.Round(NJ,4)+" ms\n");ƹ.Append("Max. runtime: "+Math.Round
  848. (ǐ,4)+" ms\n");ƹ.Append("Avg. runtime: "+Math.Round(ǎ,4)+" ms\n\n");ƹ.Append("Instructions per Method:\n");Ƹ[Ǒ]=Ǎ;foreach
  849. (var Ì in Ƹ.OrderByDescending(E=>E.Value)){ƹ.Append("- "+Ì.Key+": "+Ì.Value+"\n");}ƹ.Append("\n");}bool lj(double Ý=10){
  850. return Runtime.CurrentInstructionCount>Ý*1000;}List<IMyTerminalBlock>Lj(string Ɖ,string[]LJ=null){string dž="[IsyLCD]";var Ơ=new
  851. List<IMyTerminalBlock>();GridTerminalSystem.GetBlocksOfType<IMyTextSurfaceProvider>(Ơ,ũ=>ũ.IsSameConstructAs(Me)&&(ũ.
  852. CustomName.Contains(Ɖ)||(ũ.CustomName.Contains(dž)&&ũ.CustomData.Contains(Ɖ))));var œ=Ơ.FindAll(ũ=>ũ.CustomName.Contains(Ɖ));
  853. foreach(var q in œ){q.CustomName=q.CustomName.Replace(Ɖ,"").Replace(" "+Ɖ,"").TrimEnd(' ');bool Ũ=false;if(q is IMyTextSurface)
  854. {if(!q.CustomName.Contains(dž))Ũ=true;if(!q.CustomData.Contains(Ɖ))q.CustomData="@0 "+Ɖ+(LJ!=null?"\n"+String.Join("\n",LJ):
  855. "");}else if(q is IMyTextSurfaceProvider){if(!q.CustomName.Contains(dž))Ũ=true;int ŧ=(q as IMyTextSurfaceProvider).
  856. SurfaceCount;for(int E=0;E<ŧ;E++){if(!q.CustomData.Contains("@"+E)){q.CustomData+=(q.CustomData==""?"":"\n\n")+"@"+E+" "+Ɖ+(LJ!=null?
  857. "\n"+String.Join("\n",LJ):"");break;}}}else{Ơ.Remove(q);}if(Ũ)q.CustomName+=" "+dž;}return Ơ;}
  858. }class Ŧ:IComparer<MyDefinitionId>{public int Compare(MyDefinitionId ţ,MyDefinitionId Ţ){return ţ.ToString().CompareTo(Ţ.
  859. ToString());}}class Ť:IEqualityComparer<MyInventoryItem>{public bool Equals(MyInventoryItem ţ,MyInventoryItem Ţ){return ţ.
  860. ToString()==Ţ.ToString();}public int GetHashCode(MyInventoryItem Ì){return Ì.ToString().GetHashCode();}}public static partial
  861. class š{private static Dictionary<char,float>Š=new Dictionary<char,float>();public static void ť(string Ū,float Ŭ){foreach(
  862. char ŭ in Ū){Š[ŭ]=Ŭ;}}public static void ű(){if(Š.Count>0)return;ť(
  863. "3FKTabdeghknopqsuy£µÝàáâãäåèéêëðñòóôõöøùúûüýþÿāăąďđēĕėęěĝğġģĥħĶķńņňʼnōŏőśŝşšŢŤŦũūŭůűųŶŷŸșȚЎЗКЛбдекруцяёђћўџ",18);ť("ABDNOQRSÀÁÂÃÄÅÐÑÒÓÔÕÖØĂĄĎĐŃŅŇŌŎŐŔŖŘŚŜŞŠȘЅЊЖф□",22);ť("#0245689CXZ¤¥ÇßĆĈĊČŹŻŽƒЁЌАБВДИЙПРСТУХЬ€",20);ť(
  864. "¥$&GHPUVY§ÙÚÛÜÞĀĜĞĠĢĤĦŨŪŬŮŰŲОФЦЪЯжы†‡",21);ť("! !I`ijl ¡¨¯´¸ÌÍÎÏìíîïĨĩĪīĮįİıĵĺļľłˆˇ˘˙˚˛˜˝ІЇії‹›∙",9);ť("?7?Jcz¢¿çćĉċčĴźżžЃЈЧавийнопсъьѓѕќ",17);ť(
  865. "():《》,。、;【】(),.1:;[]ft{}·ţťŧț",10);ť("+<=>E^~¬±¶ÈÉÊË×÷ĒĔĖĘĚЄЏЕНЭ−",19);ť("L_vx«»ĹĻĽĿŁГгзлхчҐ–•",16);ť("\"-rª­ºŀŕŗř",11);ť("WÆŒŴ—…‰",32);ť("'|¦ˉ‘’‚",7)
  866. ;ť("@©®мшњ",26);ť("mw¼ŵЮщ",28);ť("/ijтэє",15);ť("\\°“”„",13);ť("*²³¹",12);ť("¾æœЉ",29);ť("%IJЫ",25);ť("MМШ",27);ť("½Щ",30);
  867. ť("ю",24);ť("ј",8);ť("љ",23);ť("ґ",14);ť("™",31);}public static Vector2 Ű(this IMyTextSurface ĭ,StringBuilder ł){ű();
  868. Vector2 ů=new Vector2();if(ĭ.Font=="Monospace"){float Ů=ĭ.FontSize;ů.X=(float)(ł.Length*19.4*Ů);ů.Y=(float)(28.8*Ů);return ů;}
  869. else{float Ů=(float)(ĭ.FontSize*0.779);foreach(char ŭ in ł.ToString()){try{ů.X+=Š[ŭ]*Ů;}catch{}}ů.Y=(float)(28.8*ĭ.FontSize)
  870. ;return ů;}}public static float ū(this IMyTextSurface q,StringBuilder ł){Vector2 Ō=q.Ű(ł);return Ō.X;}public static float
  871. ū(this IMyTextSurface q,string ł){Vector2 Ō=q.Ű(new StringBuilder(ł));return Ō.X;}public static float ş(this
  872. IMyTextSurface q,char ŏ){float Ŏ=ū(q,new string(ŏ,1));return Ŏ;}public static int ō(this IMyTextSurface q){Vector2 ʼn=q.SurfaceSize;
  873. float ň=q.TextureSize.Y;ʼn.Y*=512/ň;float Ő=ʼn.Y*(100-q.TextPadding*2)/100;Vector2 Ō=q.Ű(new StringBuilder("T"));return(int)(Ő/
  874. Ō.Y);}public static float Ŋ(this IMyTextSurface q){Vector2 ʼn=q.SurfaceSize;float ň=q.TextureSize.Y;ʼn.X*=512/ň;return ʼn.X*
  875. (100-q.TextPadding*2)/100;}public static StringBuilder Ň(this IMyTextSurface q,char ŋ,double Œ){int ř=(int)(Œ/ş(q,ŋ));if(
  876. ř<0)ř=0;return new StringBuilder().Append(ŋ,ř);}private static DateTime Ş=DateTime.Now;private static Dictionary<int,List
  877. <int>>ŝ=new Dictionary<int,List<int>>();public static StringBuilder Ŝ(this IMyTextSurface q,StringBuilder ł,int ś=3,bool
  878. ŀ=true,int ĸ=0){int Ś=q.GetHashCode();if(!ŝ.ContainsKey(Ś)){ŝ[Ś]=new List<int>{1,3,ś,0};}int Ř=ŝ[Ś][0];int ŗ=ŝ[Ś][1];int
  879. Ŗ=ŝ[Ś][2];int ŕ=ŝ[Ś][3];var Ŕ=ł.ToString().TrimEnd('\n').Split('\n');List<string>Ļ=new List<string>();if(ĸ==0)ĸ=q.ō();
  880. float ő=q.Ŋ();StringBuilder ą,º=new StringBuilder();for(int E=0;E<Ŕ.Length;E++){if(E<ś||E<Ŗ||Ļ.Count-Ŗ>ĸ||q.ū(Ŕ[E])<=ő){Ļ.Add
  881. (Ŕ[E]);}else{try{º.Clear();float Ƒ,Ɛ;var Ə=Ŕ[E].Split(' ');string Ǝ=System.Text.RegularExpressions.Regex.Match(Ŕ[E],
  882. @"\d+(\.|\:)\ ").Value;ą=q.Ň(' ',q.ū(Ǝ));foreach(var ƍ in Ə){Ƒ=q.ū(º);Ɛ=q.ū(ƍ);if(Ƒ+Ɛ>ő){Ļ.Add(º.ToString());º=new StringBuilder(ą+ƍ+
  883. " ");}else{º.Append(ƍ+" ");}}Ļ.Add(º.ToString());}catch{Ļ.Add(Ŕ[E]);}}}if(ŀ){if(Ļ.Count>ĸ){if(DateTime.Now.Second!=ŕ){ŕ=
  884. DateTime.Now.Second;if(ŗ>0)ŗ--;if(ŗ<=0)Ŗ+=Ř;if(Ŗ+ĸ-ś>=Ļ.Count&&ŗ<=0){Ř=-1;ŗ=3;}if(Ŗ<=ś&&ŗ<=0){Ř=1;ŗ=3;}}}else{Ŗ=ś;Ř=1;ŗ=3;}ŝ[Ś][
  885. 0]=Ř;ŝ[Ś][1]=ŗ;ŝ[Ś][2]=Ŗ;ŝ[Ś][3]=ŕ;}else{Ŗ=ś;}StringBuilder ƌ=new StringBuilder();for(var À=0;À<ś;À++){ƌ.Append(Ļ[À]+"\n"
  886. );}for(var À=Ŗ;À<Ļ.Count;À++){ƌ.Append(Ļ[À]+"\n");}return ƌ;}public static Dictionary<IMyTextSurface,string>Ɗ(this
  887. IMyTerminalBlock e,string Ɖ,Dictionary<string,string>ƈ=null){var Ƈ=new Dictionary<IMyTextSurface,string>();if(e is IMyTextSurface){Ƈ[e
  888. as IMyTextSurface]=e.CustomData;}else if(e is IMyTextSurfaceProvider){var Ɔ=System.Text.RegularExpressions.Regex.Matches(e
  889. .CustomData,@"@(\d) *("+Ɖ+@")");int Ƌ=(e as IMyTextSurfaceProvider).SurfaceCount;foreach(System.Text.RegularExpressions.
  890. Match ƒ in Ɔ){int ƕ=-1;if(int.TryParse(ƒ.Groups[1].Value,out ƕ)){if(ƕ>=Ƌ)continue;string Ï=e.CustomData;int Ƙ=Ï.IndexOf("@"+ƕ
  891. );int Ɨ=Ï.IndexOf("@",Ƙ+1)-Ƙ;string ĵ=Ɨ<=0?Ï.Substring(Ƙ):Ï.Substring(Ƙ,Ɨ);Ƈ[(e as IMyTextSurfaceProvider).GetSurface(ƕ)]
  892. =ĵ;}}}return Ƈ;}public static bool Ɩ(this string ĵ,string Þ){var Ï=ĵ.Replace(" ","").Split('\n');foreach(var À in Ï){if(À
  893. .StartsWith(Þ+"=")){try{return Convert.ToBoolean(À.Replace(Þ+"=",""));}catch{return true;}}}return true;}public static
  894. string Ɣ(this string ĵ,string Þ){var Ï=ĵ.Replace(" ","").Split('\n');foreach(var À in Ï){if(À.StartsWith(Þ+"=")){return À.
  895. Replace(Þ+"=","");}}return"";}}public static partial class š{public static bool Ɠ(this double Ý,double ƅ,double ĥ,bool ż=false,
  896. bool Ż=false){bool ź=Ż?Ý>ƅ:Ý>=ƅ;bool Ź=ż?Ý<ĥ:Ý<=ĥ;return ź&&Ź;}}public static partial class š{public static string Ÿ(this
  897. char Ž,int ŷ){if(ŷ<=0){return"";}return new string(Ž,ŷ);}}public static partial class š{public static string Ŷ(this string ŵ
  898. ,string Ŵ,string ų){string Ų=System.Text.RegularExpressions.Regex.Replace(ŵ,System.Text.RegularExpressions.Regex.Escape(Ŵ
  899. ),ų,System.Text.RegularExpressions.RegexOptions.IgnoreCase);return Ų;}}public static partial class š{public static string
  900. ž(this float Ý){string Ƅ="kL";if(Ý<1){Ý*=1000;Ƅ="L";}else if(Ý>=1000&&Ý<1000000){Ý/=1000;Ƅ="ML";}else if(Ý>=1000000&&Ý<
  901. 1000000000){Ý/=1000000;Ƅ="BL";}else if(Ý>=1000000000){Ý/=1000000000;Ƅ="TL";}return Math.Round(Ý,1)+" "+Ƅ;}public static string ž(
  902. this double Ý){float ƃ=(float)Ý;return ƃ.ž();}}public static partial class š{public static string Ƃ(this double Ý){string Ƅ=
  903. "";if(Ý>=1000&&Ý<1000000){Ý/=1000;Ƅ=" k";}else if(Ý>=1000000&&Ý<1000000000){Ý/=1000000;Ƅ=" M";}else if(Ý>=1000000000){Ý/=
  904. 1000000000;Ƅ=" B";}return Math.Round(Ý,1)+Ƅ;}}public static partial class š{public static string ƀ(this double ſ,double Ɓ){double
  905. Ô=Math.Round(ſ/Ɓ*100,1);if(Ɓ==0){return"0%";}else{return Ô+"%";}}public static string ƀ(this float ſ,float Ɓ){double Ô=
  906. Math.Round(ſ/Ɓ*100,1);if(Ɓ==0){return"0%";}else{return Ô+"%";}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement