issameconstructas // Isy's Inventory Manager // =================== // Version: 2.8.2 // Date: 2020-06-01 // Guide: http://steamcommunity.com/sharedfiles/filedetails/?id=1226261795 // ======================================================================================= // --- Configuration --- // ======================================================================================= issameconstructas How to use it? issameconstructas // --- Sorting --- // ======================================================================================= // Define the keyword a cargo container has to contain in order to be recognized as a container of the given type. const string oreContainerKeyword = "Ore"; const string ingotContainerKeyword = "Ingot"; const string componentContainerKeyword = "Rest"; const string toolContainerKeyword = "Rest"; const string ammoContainerKeyword = "Rest"; issameconstructas How to get it? issameconstructas const string bottleContainerKeyword = "Bottle"; // Keyword a block name has to contain to be skipped by the sorting (= no items will be taken out). // This list is expandable - just separate the entries with a ",". But it's also language specific, so adjust it if needed. // Default: string[] lockedContainerKeywords = { "Locked", "Seat", "Control Station" }; string[] lockedContainerKeywords = { "Locked", "Seat", "Control Station" }; // Keyword a block name has to contain to be excluded from item counting (used by autocrafting and inventory panels) // This list is expandable - just separate the entries with a ",". But it's also language specific, so adjust it if needed. // Default: string[] hiddenContainerKeywords = { "Hidden" }; issameconstructas How to get it? issameconstructas string[] hiddenContainerKeywords = { "Hidden" }; // Keyword for connectors to disable sorting of a grid, that is docked to that connector. // This also disables the usage of refineries, arc furnaces and assemblers on that grid. // Special containers, reactors and O2/H2 generators will still be filled. string noSortingKeyword = "[No Sorting]"; // Keyword for connectors to disable IIM completely for a ship, that is docked to that connector. string noIIMKeyword = "[No IIM]"; issameconstructas How to dowload it? issameconstructas // Balance items between containers of the same type? This will result in an equal amount of all items in all containers of that type. bool balanceTypeContainers = true; // Show a fill level in the container's name? bool showFillLevel = true; // Fill bottles before storing them in the bottle container? bool fillBottles = true; issameconstructas How to get it? issameconstructas // --- Automated container assignment --- // ======================================================================================= // Master switch. If this is set to false, automated container un-/assignment is disabled entirely. bool autoContainerAssignment = false; // Assign new containers if a type is full or not present? bool assignNewContainers = true; // Unassign empty type containers that aren't needed anymore (at least one of each type always remains). issameconstructas How to use it? issameconstructas // This doesn't touch containers with manual priority tokens, like [P1]. bool unassignEmptyContainers = true; // Assign ores and ingots containers as one? bool oresIngotsInOne = false; // Assign tool, ammo and bottle containers as one? bool toolsAmmoBottlesInOne = true; issameconstructas How to use it? issameconstructas // --- Autocrafting --- // ======================================================================================= // Enable autocrafting or autodisassembling (disassembling will disassemble everything above the wanted amounts) // All assemblers will be used. To use one manually, add the manualMachineKeyword to it (by default: "!manual") bool enableAutocrafting = true; bool enableAutodisassembling = false; // A LCD with the keyword "Autocrafting" is required where you can set the wanted amount! // This has multi LCD support. Just append numbers after the keyword, like: "LCD Autocrafting 1", "LCD Autocrafting 2", .. issameconstructas How to get it for free? issameconstructas string autocraftingKeyword = "Autocrafting"; // If you want an assembler to only assemble or only disassemble, use the following keywords in its name. // A assembler without a keyword will do both tasks string assembleKeyword = "!assemble-only"; string disassembleKeyword = "!disassemble-only"; // You can teach the script new crafting recipes, by adding one of the following tags to an assembler's name. // This is needed if the autocrafting screen shows [NoBP] for an item. There are two tag options to teach new blueprints: // !learn will learn one item and then remove the tag so that the assembler is part of the autocrafting again. issameconstructas How to dowload it? issameconstructas // !learnMany will learn everything you queue in it and will never be part of the autorafting again until you remove the tag. // To learn an item, queue it up about 100 times (Shift+Klick) and wait until the script removes it from the queue. string learnKeyword = "!learn"; string learnManyKeyword = "!learnMany"; // Margins for assembling or disassembling items in percent based on the wanted amount (default: 0 = exact value). // Examples: // assembleMargin = 5 with a wanted amount of 100 items will only produce new items, if less than 95 are available. // disassembleMargin = 10 with a wanted amount of 1000 items will only disassemble items if more than 1100 are available. double assembleMargin = 0; issameconstructas How to dowload it? issameconstructas double disassembleMargin = 0; // Add the header to every screen when using multiple autocrafting LCDs? bool headerOnEveryScreen = false; // Show available modifiers help on the last screen? bool showAutocraftingModifiers = true; // Sort the assembler queue based on the most needed components? bool sortAssemblerQueue = true; issameconstructas How to use it? issameconstructas // Autocraft ingots from stone in survival kits until you have proper refineries? bool enableBasicIngotCrafting = true; // Disable autocrafting in survival kits when you have regular assemblers? bool disableBasicAutocrafting = true; // --- Special Loadout Containers --- // ======================================================================================= issameconstructas How to dowload it? issameconstructas // Keyword an inventory has to contain to be filled with a special loadout (see in it's custom data after you renamed it!) // Special containers will be filled with your wanted amount of items and never be drained by the auto sorting! const string specialContainerKeyword = "Special"; // Are special containers allowed to 'steal' items from other special containers with a lower priority? bool allowSpecialSteal = true; // --- Refinery handling --- issameconstructas How to dowload it? issameconstructas // ======================================================================================= // 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. // To still use a refinery manually, add the manualMachineKeyword to it (by default: "!manual") bool enableOreBalancing = true; // Enable script assisted refinery filling? This will move in the most needed ore and will make room, if the refinery is already full // Also, the script puts as many ores into the refinery as possible and will pull ores even from other refineries if needed. bool enableScriptRefineryFilling = false; issameconstructas How to dowload it? issameconstructas // Sort the refinery queue based on the most needed ingots? bool sortRefiningQueue = false; // If you want an ore to always be refined first, simply remove the two // in front of the ore name to enable it. // Enabled ores are refined in order from top to bottom so if you removed several // you can change the order by // copying and pasting them inside the list. Just be careful to keep the syntax correct: "OreName", // By default stone is enabled and will always be refined first. List fixedRefiningList = new List { //"Stone", //"Iron", issameconstructas How to get it for free? issameconstructas //"Nickel", //"Cobalt", //"Silicon", //"Uranium", //"Silver", //"Gold", //"Platinum", //"Magnesium", //"Scrap", }; issameconstructas How to get it? issameconstructas // --- O2/H2 generator handling --- // ======================================================================================= // Enable balancing of ice in O2/H2 generators? // All O2/H2 generators will be used. To use one manually, add the manualMachineKeyword to it (by default: "!manual") bool enableIceBalancing = true; // Put ice into O2/H2 generators that are turned off? (default: false) issameconstructas How to dowload it? issameconstructas bool fillOfflineGenerators = false; // Ice fill level in percent in order to be able to fill bottles? (default: 90) // Note: O2/H2 generators will pull more ice automatically if value is below 60% double iceFillLevelPercentage = 90; // --- Reactor handling --- // ======================================================================================= issameconstructas How to dowload it? issameconstructas // Enable balancing of uranium in reactors? (Note: conveyors of reactors are turned off to stop them from pulling more) // All reactors will be used. To use one manually, add the manualMachineKeyword to it (by default: "!manual") bool enableUraniumBalancing = true; // Put uranium into reactors that are turned off? (default: false) bool fillOfflineReactors = false; // Amount of uranium in each reactor? (default: 100 for large grid reactors, 25 for small grid reactors) double uraniumAmountLargeGrid = 100; double uraniumAmountSmallGrid = 25; issameconstructas PasteShr issameconstructas // --- Assembler Cleanup --- // ======================================================================================= // This cleans up assemblers, if they have no queue and puts the contents back into a cargo container. bool enableAssemblerCleanup = true; // --- Internal item sorting --- issameconstructas How to get it? issameconstructas // ======================================================================================= // Sort the items inside all containers? // Note, that this could cause inventory desync issues in multiplayer, so that items are invisible // or can't be taken out. Use at your own risk! bool enableInternalSorting = true; // Internal sorting pattern. Always combine one of each category, e.g.: 'Ad' for descending item amount (from highest to lowest) // 1. Quantifier: // A = amount issameconstructas PasteShr issameconstructas // N = name // T = type (alphabetical) // X = type (number of items) // 2. Direction: // a = ascending // d = descending string sortingPattern = "Ad"; issameconstructas PasteShr issameconstructas // Internal sorting can also be set per inventory. Just use '(sort:PATTERN)' in the block's name. // Example: Small Cargo Container 3 (sort:Ad) // Note: Using this method, internal sorting will always be activated for this container, even if the main switch is turned off! // --- LCD panels --- // ======================================================================================= // To display the main script informations, add the following keyword to any LCD name (default: !IIM-main). // You can enable or disable specific informations on the LCD by editing its custom data. issameconstructas How to dowload it? issameconstructas string mainLCDKeyword = "!IIM-main"; // To display current item amounts of different types, add the following keyword to any LCD name // and follow the on screen instructions. string inventoryLCDKeyword = "!IIM-inventory"; // To display all current warnings and problems, add the following keyword to any LCD name (default: IIM-warnings). string warningsLCDKeyword = "!IIM-warnings"; // To display the script performance (PB terminal output), add the following keyword to any LCD name (default: !IIM-performance). issameconstructas How to get it for free? issameconstructas string performanceLCDKeyword = "!IIM-performance"; // Default screen font, fontsize and padding, when a screen is first initialized. Fonts: "Debug" or "Monospace" string defaultFont = "Debug"; float defaultFontSize = 0.6f; float defaultPadding = 2f; // --- Settings for enthusiasts --- // ======================================================================================= issameconstructas How to use it? issameconstructas // Extra breaks between script methods in ticks (1 tick = 16.6ms). double extraScriptTicks = 0; // Use dynamic script speed? The script will slow down automatically if the current runtime exceeds a set value (default: 0.5ms) bool useDynamicScriptSpeed = true; double maxCurrentMs = 0.5; // Exclude welders or grinders from sorting? Set this to true, if you have huge welder or grinder walls! bool excludeWelders = false; issameconstructas How to dowload it? issameconstructas bool excludeGrinders = false; // Enable connection check for inventories (needed for [No Conveyor] info)? bool connectionCheck = false; // Tag inventories, that have no access to the main type containers with [No Conveyor]? // This only works if the above setting connectionCheck is set to true! bool showNoConveyorTag = true; // Script mode: "ship", "station" or blank for autodetect issameconstructas How to get it? issameconstructas string scriptMode = ""; // Protect type containers when docking to another grid running the script? bool protectTypeContainers = true; // If you want to use a machine manually, append the keyword to it. // This works for assemblers, refineries, reactors and O2/H2 generators string manualMachineKeyword = "!manual"; // Enable name correction? This option will automtically correct capitalization, e.g.: !iim-main -> !IIM-main issameconstructas How to get it for free? issameconstructas bool enableNameCorrection = true; // ======================================================================================= // --- End of Configuration --- // Don't change anything beyond this point! // ======================================================================================= Listɐ=new List();Listɏ=new List();List< issameconstructas How to use it? issameconstructas IMyTerminalBlock>ɍ=new List();Listɑ=new List();Listɢ=new List< IMyTerminalBlock>();Listʄ=new List();Listʂ=new List();List< IMyTerminalBlock>ʁ=new List();Listʀ=new List();Listɿ=new List< IMyRefinery>();Listɾ=new List();Listɽ=new List();Listʃ=new List< IMyRefinery>();Listɼ=new List();Listɺ=new List();Listɹ=new List();Listɸ=new List();Listɷ=new List();List< IMyGasTank>ɶ=new List();Listɵ=new List();Listɻ=new List();List< string>ʅ=new List();HashSetʍ=new HashSet();HashSetʖ=new HashSet(); Listʔ=new List();Listʓ=new List();List< IMyTerminalBlock>ʒ=new List();Listʑ=new List();Listʐ=new List< issameconstructas PasteShr issameconstructas IMyTerminalBlock>();Listʏ=new List();Listʕ=new List();string[]ʎ= {oreContainerKeyword,ingotContainerKeyword,componentContainerKeyword,toolContainerKeyword,ammoContainerKeyword, bottleContainerKeyword};string ʌ="";IMyTerminalBlock ʋ;IMyInventory ʊ;IMyTerminalBlock ʉ;bool ʈ=false;int ʇ=0;int ʆ=0;int ɴ=0;int ɳ=0;int ɒ=0; int ɠ=0;int ɟ=0;int ɞ=0;int ɝ=0;int ɜ=0;int ɛ=0;int ɡ=0;int ɚ=0;int ɘ=0;string ɗ="";string[]ɖ={"/","-","\\","|"};int ɕ=0; Listɔ=new List();Listɓ=new List();List< IMyTerminalBlock>ə=new List();Listɣ=new List();StringBuilder ɫ=new StringBuilder() ;string[]LJ={"showHeading=true","showWarnings=true","showContainerStats=true","showManagedBlocks=true", "showLastAction=true","scrollTextIfNeeded=true"};string[]ɱ={"showHeading=true","scrollTextIfNeeded=true"};string Ņ;int ɰ=0;string ɯ="";bool ɮ =false;bool ɭ=false;bool ɲ=false;HashSetɬ=new HashSet();HashSetɪ=new HashSet();int ɩ=0; int ɨ=0;int ɧ=0;bool ɦ=true;bool ɥ=false;int ɤ=0;string Ɏ="itemID;blueprintID";DictionaryɌ=new Dictionary< issameconstructas How to get it for free? issameconstructas string,string>(){{"oreContainer",oreContainerKeyword},{"ingotContainer",ingotContainerKeyword},{"componentContainer", componentContainerKeyword},{"toolContainer",toolContainerKeyword},{"ammoContainer",ammoContainerKeyword},{"bottleContainer", bottleContainerKeyword},{"specialContainer",specialContainerKeyword},{"oreBalancing","true"},{"iceBalancing","true"},{"uraniumBalancing", "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'" ;char[]ȍ={'=','>','<'};IMyAssembler Ȍ;string ȋ="";MyDefinitionId Ȋ;HashSetȉ=new HashSet{"Uranium", "Silicon","Silver","Gold","Platinum","Magnesium","Iron","Nickel","Cobalt","Stone","Scrap"};Listȏ=new List ();ListȈ=new List();DictionaryȆ=new Dictionary(){{"Cobalt",0.3},{ "Gold",0.01},{"Iron",0.7},{"Magnesium",0.007},{"Nickel",0.4},{"Platinum",0.005},{"Silicon",0.7},{"Silver",0.1},{"Stone",0.014} ,{"Uranium",0.01}};const string ȅ="MyObjectBuilder_";const string Ȅ="Ore";const string ȃ="Ingot";const string Ȃ= "Component";const string ȁ="AmmoMagazine";const string ȇ="OxygenContainerObject";const string Ȑ="GasContainerObject";const string Ș issameconstructas How to use it? issameconstructas ="PhysicalGunObject";const string ȡ="PhysicalObject";const string ȟ="ConsumableItem";const string Ȟ="Datapad";const string ȝ=ȅ+"BlueprintDefinition/";SortedSetȜ=new SortedSet(new Ŧ());SortedSetț=new SortedSet();SortedSetȚ=new SortedSet();SortedSetȠ=new SortedSet();SortedSetș=new SortedSet();SortedSetȗ=new SortedSet();SortedSetȖ=new SortedSet();SortedSetȕ=new SortedSet();SortedSetȔ=new SortedSet();SortedSetȓ=new SortedSet();SortedSetȒ=new SortedSet();Dictionaryȑ=new Dictionary();DictionaryȀ =new Dictionary();Dictionaryǿ=new Dictionary(); Dictionaryǥ=new Dictionary();DictionaryDZ=new Dictionary< MyDefinitionId,MyDefinitionId>();Dictionaryǰ=new Dictionary();Dictionary ǯ=new Dictionary();DictionaryǮ=new Dictionary issameconstructas How to get it for free? issameconstructas ();bool ǭ=false;string Ǭ="station_mode;\n";string Dz="ship_mode;\n";string ǫ="[PROTECTED] ";string Ǫ="";string ǩ="";string Ǩ="";DateTime ǧ;string[]Ǧ={"Get inventory blocks","Find new items","Create item lists","Name correction", "Assign containers","Fill special containers","Sort items","Container balancing","Internal sorting","Add fill level to names", "Get global item amount","Get assembler queue","Autocrafting","Sort assembler queue","Clean up assemblers","Learn unknown blueprints", "Fill refineries","Ore balancing","Ice balancing","Uranium balancing"};Program(){Echo("Script ready to be launched..\n");assembleMargin/= 100;disassembleMargin/=100;Runtime.UpdateFrequency=UpdateFrequency.Update10;}void Main(string dz){if(ɰ>=10){throw new Exception("Too many errors in script step "+ɧ+":\n"+Ǧ[ɧ]+"\n\nPlease recompile!\nScript stoppped!\n\nLast error:\n"+ɯ+"\n");}try{ if(ɦ){if(ɧ>0)Echo("Initializing script.. ("+(ɧ+1)+"/10) \n");if(ɧ>=2){Echo("Getting inventory blocks..");if(ɧ==2)ɋ();if(ʈ) return;}if(ɧ>=3){Echo("Loading saved items..");if(ɧ==3){if(!Ð()){ɮ=true;enableAutocrafting=false;enableAutodisassembling=false ;}}if(ɮ){Echo("-> No assemblers found!");Echo("-> Autocrafting deactivated!");}}if(ɧ>=4){Echo( issameconstructas How to get it for free? issameconstructas "Clearing assembler queues..");if(ɧ==4&&(enableAutocrafting||enableAutodisassembling)){GridTerminalSystem.GetBlocksOfType(ɻ,q=>q. IsSameConstructAs(Me)&&q.CustomName.Contains(autocraftingKeyword));if(ɻ.Count>0){foreach(var ƞ in ɼ){ƞ.Mode=MyAssemblerMode.Disassembly;ƞ .ClearQueue();ƞ.Mode=MyAssemblerMode.Assembly;ƞ.ClearQueue();}}}}if(ɧ>=5){Echo("Checking blueprints..");if(ɧ==5){foreach( var K in Ȝ){ƭ(K);}}}if(ɧ>=6){Echo("Checking type containers..");if(ɧ==6)Ȯ();if(ɧ==6)Ⱥ();}if(ɧ>=7){if(scriptMode=="station") {ǭ=true;}else if(Me.CubeGrid.IsStatic&&scriptMode!="ship"){ǭ=true;}Echo("Setting script mode to: "+(ǭ?"station..": "ship.."));if(ɧ==7)Me.CustomData=(ǭ?Ǭ:Dz)+Me.CustomData.Replace(Ǭ,"").Replace(Dz,"");}if(ɧ>=8){Echo("Starting script..");}if(ɧ>=9) {ɧ=0;ɦ=false;return;}ɧ++;return;}if(dz!=""){Ǩ=dz;ɧ=1;ǩ="";ǧ=DateTime.Now;}if(useDynamicScriptSpeed){if(ɩ>0){Nj( "Dynamic script speed control");Î("..");ɩ--;return;}}if(ɨ3)ɤ=0;ɥ=false;return;}if(ɧ==0||ɭ||ʈ){if(!ɲ)ɋ();if(ʈ)return;ɭ=false;ɲ=false; if(!lj(30)){ɔ=Lj(mainLCDKeyword,LJ);ɓ=Lj(warningsLCDKeyword,ɱ);ə=Lj(performanceLCDKeyword,ɱ);ɣ=Lj(inventoryLCDKeyword);}else{ɭ= issameconstructas PasteShr issameconstructas true;ɲ=true;}if(ɧ==0){Nj(Ǧ[ɧ]);Î();ɧ++;}return;}if(!ǭ)Ǹ();if(ǽ(Ǩ))return;ɨ=0;Runtime.UpdateFrequency=UpdateFrequency.Update10 ;ɥ=true;if(ɧ==1){Ò();}if(ɧ==2){è();}if(ɧ==3){if(enableNameCorrection)ȸ();}if(ɧ==4){if(autoContainerAssignment){if( unassignEmptyContainers)ȴ();if(assignNewContainers)ȥ();}}if(ɧ==5){if(ʕ.Count!=0)ͼ();}if(ɧ==6){Ύ();}if(ɧ==7){if(balanceTypeContainers)ʪ();}if(ɧ ==8){Ε();}if(ɧ==9){β(ʄ);β(ʕ);}if(ɧ==10){Ʋ();}if(ɧ==11){if(enableAutocrafting||enableAutodisassembling)ƚ();}if(ɧ==12){if( enableAutocrafting||enableAutodisassembling)Ϋ();}if(ɧ==13){if(sortAssemblerQueue)ˮ();}if(ɧ==14){if(enableAssemblerCleanup)ˏ();if( enableBasicIngotCrafting){if(ɿ.Count>0){enableBasicIngotCrafting=false;}else{ʲ();}}}if(ɧ==15){Õ();}if(ɧ==16){ʢ();}if(ɧ==17){if( enableOreBalancing)ʠ();if(sortRefiningQueue){ʟ(ɽ,ȏ);ʟ(ʃ,Ȉ);}}if(ɧ==18){if(enableIceBalancing)ĕ();}if(ɧ==19){if(enableUraniumBalancing){ß( "uraniumBalancing","true");ę();}else if(!enableUraniumBalancing&&á("uraniumBalancing")=="true"){ß("uraniumBalancing","false");foreach( IMyReactor Ċ in ɵ){Ċ.UseConveyorSystem=true;}}}Nj(Ǧ[ɧ]);Î();ɩ=(int)Math.Floor((NJ>20?20:NJ)/maxCurrentMs);if(ɧ>=19){ɧ=0;ɬ=new HashSet (ɪ);ɪ.Clear();if(ɰ>0)ɰ--;if(ɬ.Count==0)Ņ=null;}else{ɧ++;}}catch(NullReferenceException e){ɰ++;ɭ=true;ʈ=false;ɯ=e. issameconstructas How to get it for free? issameconstructas ToString();ƴ("Execution of script step aborted:\n"+Ǧ[ɧ]+" (ID: "+ɧ+")\n\nCached block not available..");}catch(Exception e){ɰ++; ɭ=true;ʈ=false;ɯ=e.ToString();ƴ("Critical error in script step:\n"+Ǧ[ɧ]+" (ID: "+ɧ+")\n\n"+e);}}bool ǽ(string dz){if(dz. Contains("pauseThisPB")){Echo("Script execution paused!\n");var Ǽ=dz.Split(';');if(Ǽ.Length==3){Echo("Found:");Echo("'"+Ǽ[1]+"'") ;Echo("on grid:");Echo("'"+Ǽ[2]+"'");Echo("also running the script.\n");Echo("Type container protection: "+( protectTypeContainers?"ON":"OFF")+"\n");Echo("Everything else is managed by the other script.");}return true;}bool ǻ=true;bool Ǿ=true;bool Ǻ= false;if(dz!="reset"&&dz!="msg"){if(!dz.Contains(" on")&&!dz.Contains(" off")&&!dz.Contains(" toggle"))return false;if(dz.Contains( " off"))Ǿ=false;if(dz.Contains(" toggle"))Ǻ=true;}if(dz=="reset"){Ƴ();return true;}else if(dz=="msg"){}else if(dz.StartsWith( "balanceTypeContainers")){Ǫ="Balance type containers";if(Ǻ)Ǿ=!balanceTypeContainers;balanceTypeContainers=Ǿ;}else if(dz.StartsWith( "showFillLevel")){Ǫ="Show fill level";if(Ǻ)Ǿ=!showFillLevel;showFillLevel=Ǿ;}else if(dz.StartsWith("autoContainerAssignment")){Ǫ= "Auto assign containers";if(Ǻ)Ǿ=!autoContainerAssignment;autoContainerAssignment=Ǿ;}else if(dz.StartsWith("assignNewContainers")){Ǫ= issameconstructas How to dowload it? issameconstructas "Assign new containers";if(Ǻ)Ǿ=!assignNewContainers;assignNewContainers=Ǿ;}else if(dz.StartsWith("unassignEmptyContainers")){Ǫ= "Unassign empty containers";if(Ǻ)Ǿ=!unassignEmptyContainers;unassignEmptyContainers=Ǿ;}else if(dz.StartsWith("oresIngotsInOne")){Ǫ= "Assign ores and ingots as one";if(Ǻ)Ǿ=!oresIngotsInOne;oresIngotsInOne=Ǿ;}else if(dz.StartsWith("toolsAmmoBottlesInOne")){Ǫ= "Assign tools, ammo and bottles as one";if(Ǻ)Ǿ=!toolsAmmoBottlesInOne;toolsAmmoBottlesInOne=Ǿ;}else if(dz.StartsWith("fillBottles")){Ǫ="Fill bottles";if(Ǻ)Ǿ=! fillBottles;fillBottles=Ǿ;}else if(dz.StartsWith("enableAutocrafting")){Ǫ="Autocrafting";if(Ǻ)Ǿ=!enableAutocrafting; enableAutocrafting=Ǿ;}else if(dz.StartsWith("enableAutodisassembling")){Ǫ="Autodisassembling";if(Ǻ)Ǿ=!enableAutodisassembling; enableAutodisassembling=Ǿ;}else if(dz.StartsWith("headerOnEveryScreen")){Ǫ="Show header on every autocrafting screen";if(Ǻ)Ǿ=! headerOnEveryScreen;headerOnEveryScreen=Ǿ;}else if(dz.StartsWith("sortAssemblerQueue")){Ǫ="Sort assembler queue";if(Ǻ)Ǿ=!sortAssemblerQueue; sortAssemblerQueue=Ǿ;}else if(dz.StartsWith("enableBasicIngotCrafting")){Ǫ="Basic ingot crafting";if(Ǻ)Ǿ=!enableBasicIngotCrafting; enableBasicIngotCrafting=Ǿ;}else if(dz.StartsWith("disableBasicAutocrafting")){Ǫ="Disable autocrafting in survival kits";if(Ǻ)Ǿ=! issameconstructas How to get it for free? issameconstructas disableBasicAutocrafting;disableBasicAutocrafting=Ǿ;}else if(dz.StartsWith("allowSpecialSteal")){Ǫ="Allow special container steal";if(Ǻ)Ǿ=! allowSpecialSteal;allowSpecialSteal=Ǿ;}else if(dz.StartsWith("enableOreBalancing")){Ǫ="Ore balancing";if(Ǻ)Ǿ=!enableOreBalancing; enableOreBalancing=Ǿ;}else if(dz.StartsWith("enableScriptRefineryFilling")){Ǫ="Script assisted refinery filling";if(Ǻ)Ǿ=! enableScriptRefineryFilling;enableScriptRefineryFilling=Ǿ;}else if(dz.StartsWith("sortRefiningQueue")){Ǫ="Sort refinery queue";if(Ǻ)Ǿ=! sortRefiningQueue;sortRefiningQueue=Ǿ;}else if(dz.StartsWith("enableIceBalancing")){Ǫ="Ice balancing";if(Ǻ)Ǿ=!enableIceBalancing; enableIceBalancing=Ǿ;}else if(dz.StartsWith("fillOfflineGenerators")){Ǫ="Fill offline O2/H2 generators";if(Ǻ)Ǿ=!fillOfflineGenerators; fillOfflineGenerators=Ǿ;}else if(dz.StartsWith("enableUraniumBalancing")){Ǫ="Uranium balancing";if(Ǻ)Ǿ=!enableUraniumBalancing; enableUraniumBalancing=Ǿ;}else if(dz.StartsWith("fillOfflineReactors")){Ǫ="Fill offline reactors";if(Ǻ)Ǿ=!fillOfflineReactors; fillOfflineReactors=Ǿ;}else if(dz.StartsWith("enableAssemblerCleanup")){Ǫ="Assembler cleanup";if(Ǻ)Ǿ=!enableAssemblerCleanup; enableAssemblerCleanup=Ǿ;}else if(dz.StartsWith("enableInternalSorting")){Ǫ="Internal sorting";if(Ǻ)Ǿ=!enableInternalSorting; issameconstructas How to get it for free? issameconstructas enableInternalSorting=Ǿ;}else if(dz.StartsWith("useDynamicScriptSpeed")){Ǫ="Dynamic script speed";if(Ǻ)Ǿ=!useDynamicScriptSpeed; useDynamicScriptSpeed=Ǿ;}else if(dz.StartsWith("excludeWelders")){Ǫ="Exclude welders";if(Ǻ)Ǿ=!excludeWelders;excludeWelders=Ǿ;}else if(dz. StartsWith("excludeGrinders")){Ǫ="Exclude grinders";if(Ǻ)Ǿ=!excludeGrinders;excludeGrinders=Ǿ;}else if(dz.StartsWith( "connectionCheck")){Ǫ="Connection check";if(Ǻ)Ǿ=!connectionCheck;connectionCheck=Ǿ;Ⱥ();}else if(dz.StartsWith("showNoConveyorTag")){Ǫ= "Show no conveyor access";if(Ǻ)Ǿ=!showNoConveyorTag;showNoConveyorTag=Ǿ;Ⱥ();}else if(dz.StartsWith("protectTypeContainers")){Ǫ= "Protect type containers";if(Ǻ)Ǿ=!protectTypeContainers;protectTypeContainers=Ǿ;}else if(dz.StartsWith("enableNameCorrection")){Ǫ= "Name correction";if(Ǻ)Ǿ=!enableNameCorrection;enableNameCorrection=Ǿ;}else{ǻ=false;}if(ǻ){TimeSpan ǹ=DateTime.Now-ǧ;if(ǩ=="")ǩ=Ǫ+ " temporarily "+(Ǿ?"enabled":"disabled")+"!\n";Echo(ǩ);Echo("Continuing in "+Math.Ceiling(3-ǹ.TotalSeconds)+" seconds..");Ǩ="msg";if(ǹ. TotalSeconds>=3){Ǫ="";ǩ="";Ǩ="";}}return ǻ;}void Ǹ(){ListǷ=new List();GridTerminalSystem .GetBlocksOfType(Ƿ,Ƕ=>Ƕ!=Me);if(Ǩ.StartsWith("pauseThisPB")||Ǩ==""){Ǩ="";foreach(var ǵ in Ƿ){if(ǵ.CustomData.Contains(Ǭ) issameconstructas How to get it? issameconstructas ||(ǵ.CustomData.Contains(Dz)&&å(ǵ)<å(Me))){Ǩ="pauseThisPB;"+ǵ.CustomName+";"+ǵ.CubeGrid.CustomName;foreach(var X in ʄ){if( protectTypeContainers&&!X.CustomName.Contains(ǫ)&&X.IsSameConstructAs(Me))X.CustomName=ǫ+X.CustomName;}return;}}if(Ǩ==""){foreach(var X in ʂ) {X.CustomName=X.CustomName.Replace(ǫ,"");}}}}void Ȣ(){ʍ.Clear();GridTerminalSystem.GetBlocksOfType(ʀ,ŭ =>ŭ.CustomName.Contains(noSortingKeyword));foreach(var Ʉ in ʀ){if(Ʉ.Status!=MyShipConnectorStatus.Connected)continue;if(Ʉ. OtherConnector.CubeGrid.IsSameConstructAs(Me.CubeGrid))continue;ʍ.Add(Ʉ.OtherConnector.CubeGrid);}ʖ.Clear();GridTerminalSystem. GetBlocksOfType(ʀ,ŭ=>ŭ.CustomName.Contains(noIIMKeyword));foreach(var Ʉ in ʀ){if(Ʉ.Status!=MyShipConnectorStatus. Connected)continue;if(Ʉ.OtherConnector.CubeGrid.IsSameConstructAs(Me.CubeGrid))continue;ʖ.Add(Ʉ.OtherConnector.CubeGrid);}}void Ƀ (){if(ʊ!=null){try{ʊ=ʋ.GetInventory(0);}catch{ʊ=null;}}if(ʊ==null){try{foreach(var X in ʄ){foreach(var e in ɏ){if(X==e) continue;if(X.GetInventory(0).IsConnectedTo(e.GetInventory(0))){ʋ=ʄ[0];ʊ=ʋ.GetInventory(0);return;}}}}catch{ʊ=null;}}}void ɂ( IMyTerminalBlock e){foreach(var È in ʖ){if(e.CubeGrid.IsSameConstructAs(È))return;}if(e.BlockDefinition.SubtypeId.Contains("Locker")||e. issameconstructas PasteShr issameconstructas BlockDefinition.SubtypeId=="VendingMachine"||e.BlockDefinition.TypeIdString.Contains("Parachute"))return;if(e is IMyShipWelder&& excludeWelders)return;if(e is IMyShipGrinder&&excludeGrinders)return;string ȳ=e.CustomName;if(ȳ.Contains(ǫ)){ʂ.Add(e);return;}bool ɀ=ȳ .Contains(specialContainerKeyword),ȿ=false,Ⱦ=ȳ.Contains(manualMachineKeyword),Ƚ=false,ȼ=ȳ.Contains(learnKeyword)||ȳ. Contains(learnManyKeyword),Ɂ=true,Ʌ=false;foreach(var ê in lockedContainerKeywords){if(ȳ.Contains(ê)){ȿ=true;break;}}foreach(var ê in hiddenContainerKeywords){if(ȳ.Contains(ê)){Ƚ=true;break;}}if(!ɀ&&!(e is IMyReactor)&&!(e is IMyGasGenerator)){ foreach(var È in ʍ){if(e.CubeGrid.IsSameConstructAs(È))return;}}if(!Ƚ)ɏ.Add(e);if(connectionCheck){if(ʊ!=null){if(!e. GetInventory(0).IsConnectedTo(ʊ)){Ɂ=false;}}if(!Ɂ){if(showNoConveyorTag)ɇ(e,"[No Conveyor]");return;}else{ɇ(e,"[No Conveyor]",false) ;}}if(ȳ.Contains(oreContainerKeyword)){ʔ.Add(e);Ʌ=true;}if(ȳ.Contains(ingotContainerKeyword)){ʓ.Add(e);Ʌ=true;}if(ȳ. Contains(componentContainerKeyword)){ʒ.Add(e);Ʌ=true;}if(ȳ.Contains(toolContainerKeyword)){ʑ.Add(e);Ʌ=true;}if(ȳ.Contains( ammoContainerKeyword)){ʐ.Add(e);Ʌ=true;}if(ȳ.Contains(bottleContainerKeyword)){ʏ.Add(e);Ʌ=true;}if(ɀ){ʕ.Add(e);if(e.CustomData.Length<200)í( issameconstructas How to dowload it? issameconstructas e);}if(Ʌ)ʄ.Add(e);if(e.GetType().ToString().Contains("Weapon"))return;if(e is IMyRefinery){if(e.IsSameConstructAs(Me)&&!ɀ &&!Ⱦ&&e.IsWorking){(e as IMyRefinery).UseConveyorSystem=true;ɿ.Add(e as IMyRefinery);if(e.BlockDefinition.SubtypeId== "Blast Furnace"){ʃ.Add(e as IMyRefinery);}else{ɽ.Add(e as IMyRefinery);}}if(!ȿ&&e.GetInventory(1).ItemCount>0)ɾ.Add(e as IMyRefinery);} else if(e is IMyAssembler){if(e.IsSameConstructAs(Me)&&!Ⱦ&&!ȼ&&e.IsWorking){ɼ.Add(e as IMyAssembler);if(e.BlockDefinition. SubtypeId.Contains("Survival"))ɸ.Add(e as IMyAssembler);}if(!ȿ&&!ȼ&&e.GetInventory(1).ItemCount>0)ɺ.Add(e as IMyAssembler);if(ȼ)ɹ .Add(e as IMyAssembler);}else if(e is IMyGasGenerator){if(!ɀ&&!Ⱦ&&e.IsFunctional){if(fillOfflineGenerators&&!(e as IMyGasGenerator).Enabled){ɷ.Add(e as IMyGasGenerator);}else if((e as IMyGasGenerator).Enabled){ɷ.Add(e as IMyGasGenerator);}}}else if(e is IMyGasTank){if(!ɀ&&!Ⱦ&&!ȿ&&e.IsWorking&&e.IsSameConstructAs(Me)){ɶ.Add(e as IMyGasTank);}}else if(e is IMyReactor){if(! ɀ&&!Ⱦ&&e.IsFunctional){if(fillOfflineReactors&&!(e as IMyReactor).Enabled){ɵ.Add(e as IMyReactor);}else if((e as IMyReactor).Enabled){ɵ.Add(e as IMyReactor);}}}else if(e is IMyCargoContainer){if(e.IsSameConstructAs(Me)&&!Ʌ&&!ȿ&&!ɀ)ʁ.Add(e);}if issameconstructas How to get it for free? issameconstructas (e.InventoryCount==1&&!ɀ&&!ȿ&&!(e is IMyReactor)){if(e.GetInventory(0).ItemCount>0)ɑ.Add(e);if(!e.BlockDefinition. TypeIdString.Contains("Oxygen")){if(e.IsSameConstructAs(Me)){ɢ.Insert(0,e);}else{ɢ.Add(e);}}}}void ɋ(){if(!ʈ){Ȣ();if(connectionCheck )Ƀ();try{for(int E=0;E<ʕ.Count;E++){if(!ʕ[E].CustomName.Contains(specialContainerKeyword))ʕ[E].CustomData="";}}catch{}ʄ. Clear();ʔ.Clear();ʓ.Clear();ʒ.Clear();ʑ.Clear();ʐ.Clear();ʏ.Clear();ʕ.Clear();ʁ.Clear();ʂ.Clear();ɏ.Clear();ɑ.Clear();ɢ.Clear ();ɿ.Clear();ɽ.Clear();ʃ.Clear();ɾ.Clear();ɼ.Clear();ɸ.Clear();ɺ.Clear();ɹ.Clear();ɷ.Clear();ɶ.Clear();ɵ.Clear();ʇ=0; GridTerminalSystem.GetBlocksOfType(ɐ,ũ=>ũ.HasInventory);}Runtime.UpdateFrequency=UpdateFrequency.Update1;for(int E=ʇ;E<ɐ .Count;E++){ɂ(ɐ[E]);ʇ++;if(E%200==0){ʈ=true;return;}}if(ʆ==0)Ɋ(ʔ);if(ʆ==1)Ɋ(ʓ);if(ʆ==2)Ɋ(ʒ);if(ʆ==3)Ɋ(ʑ);if(ʆ==4)Ɋ(ʐ);if( ʆ==5)Ɋ(ʕ);if(ʆ==6)Ɋ(ʏ);ʆ++;if(ʆ>6){ʆ=0;}else{ʈ=true;return;}if(disableBasicAutocrafting&&ɼ.Count!=ɸ.Count)ɼ.RemoveAll(Ĩ=> Ĩ.BlockDefinition.SubtypeId.Contains("Survival"));if(fillBottles){ɑ.Sort((Ɉ,ũ)=>ũ.BlockDefinition.TypeIdString.Contains( "Oxygen").CompareTo(Ɉ.BlockDefinition.TypeIdString.Contains("Oxygen")));}ʈ=false;Runtime.UpdateFrequency=UpdateFrequency. issameconstructas How to get it? issameconstructas Update10;}void Ɋ(Listɉ){if(ɉ.Count>=2&&ɉ.Count<=500)ɉ.Sort((Ɉ,ũ)=>å(Ɉ).CompareTo(å(ũ)));if(!lj())ʆ++;}void ɇ( IMyTerminalBlock e,string Ɇ,bool Ȼ=true){if(Ȼ){if(e.CustomName.Contains(Ɇ))return;e.CustomName+=" "+Ɇ;}else{if(!e.CustomName.Contains(Ɇ) )return;e.CustomName=e.CustomName.Replace(" "+Ɇ,"").Replace(Ɇ,"").TrimEnd(' ');}}void Ⱥ(){for(int E=0;E<ɏ.Count;E++){ɇ(ɏ[ E],"[No Conveyor]",false);}}void Ȯ(){bool ȭ=false;string Ȭ=á("oreContainer");string ȫ=á("ingotContainer");string Ȫ=á( "componentContainer");string ȩ=á("toolContainer");string ȯ=á("ammoContainer");string Ȩ=á("bottleContainer");string Ȧ=á("specialContainer"); if(oreContainerKeyword!=Ȭ){ȭ=true;}else if(ingotContainerKeyword!=ȫ){ȭ=true;}else if(componentContainerKeyword!=Ȫ){ȭ=true; }else if(toolContainerKeyword!=ȩ){ȭ=true;}else if(ammoContainerKeyword!=ȯ){ȭ=true;}else if(bottleContainerKeyword!=Ȩ){ȭ= true;}else if(specialContainerKeyword!=Ȧ){ȭ=true;}if(ȭ){for(int E=0;E<ɏ.Count;E++){if(ɏ[E].CustomName.Contains(Ȭ)){ɏ[E]. CustomName=ɏ[E].CustomName.Replace(Ȭ,oreContainerKeyword);}if(ɏ[E].CustomName.Contains(ȫ)){ɏ[E].CustomName=ɏ[E].CustomName.Replace (ȫ,ingotContainerKeyword);}if(ɏ[E].CustomName.Contains(Ȫ)){ɏ[E].CustomName=ɏ[E].CustomName.Replace(Ȫ, issameconstructas How to get it? issameconstructas componentContainerKeyword);}if(ɏ[E].CustomName.Contains(ȩ)){ɏ[E].CustomName=ɏ[E].CustomName.Replace(ȩ,toolContainerKeyword);}if(ɏ[E].CustomName. Contains(ȯ)){ɏ[E].CustomName=ɏ[E].CustomName.Replace(ȯ,ammoContainerKeyword);}if(ɏ[E].CustomName.Contains(Ȩ)){ɏ[E].CustomName=ɏ[ E].CustomName.Replace(Ȩ,bottleContainerKeyword);}if(ɏ[E].CustomName.Contains(Ȧ)){ɏ[E].CustomName=ɏ[E].CustomName.Replace( Ȧ,specialContainerKeyword);}}ß("oreContainer",oreContainerKeyword);ß("ingotContainer",ingotContainerKeyword);ß( "componentContainer",componentContainerKeyword);ß("toolContainer",toolContainerKeyword);ß("ammoContainer",ammoContainerKeyword);ß( "bottleContainer",bottleContainerKeyword);ß("specialContainer",specialContainerKeyword);}}void ȥ(){for(int E=0;E<ʁ.Count;E++){bool Ȥ= false;bool ȣ=false;string ȧ=ʁ[E].CustomName;string Ȱ="";if(ʔ.Count==0||ʌ=="Ore"){if(oresIngotsInOne){ȣ=true;}else{ʁ[E]. CustomName+=" "+oreContainerKeyword;ʔ.Add(ʁ[E]);Ȱ="Ores";}}else if(ʓ.Count==0||ʌ=="Ingot"){if(oresIngotsInOne){ȣ=true;}else{ʁ[E]. CustomName+=" "+ingotContainerKeyword;ʓ.Add(ʁ[E]);Ȱ="Ingots";}}else if(ʒ.Count==0||ʌ=="Component"){ʁ[E].CustomName+=" "+ componentContainerKeyword;ʒ.Add(ʁ[E]);Ȱ="Components";}else if(ʑ.Count==0||ʌ=="PhysicalGunObject"){if(toolsAmmoBottlesInOne){Ȥ=true;}else{ʁ[E]. issameconstructas How to get it for free? issameconstructas CustomName+=" "+toolContainerKeyword;ʑ.Add(ʁ[E]);Ȱ="Tools";}}else if(ʐ.Count==0||ʌ=="AmmoMagazine"){if(toolsAmmoBottlesInOne){Ȥ= true;}else{ʁ[E].CustomName+=" "+ammoContainerKeyword;ʐ.Add(ʁ[E]);Ȱ="Ammo";}}else if(ʏ.Count==0||ʌ=="OxygenContainerObject"|| ʌ=="GasContainerObject"){if(toolsAmmoBottlesInOne){Ȥ=true;}else{ʁ[E].CustomName+=" "+bottleContainerKeyword;ʏ.Add(ʁ[E]);Ȱ ="Bottles";}}if(ȣ){ʁ[E].CustomName+=" "+oreContainerKeyword+" "+ingotContainerKeyword;ʔ.Add(ʁ[E]);ʓ.Add(ʁ[E]);Ȱ= "Ores and Ingots";}if(Ȥ){ʁ[E].CustomName+=" "+toolContainerKeyword+" "+ammoContainerKeyword+" "+bottleContainerKeyword;ʑ.Add(ʁ[E]);ʐ.Add( ʁ[E]);ʏ.Add(ʁ[E]);Ȱ="Tools, Ammo and Bottles";}if(Ȱ!=""){ɗ="Assigned '"+ȧ+"' as a new container for type '"+Ȱ+"'.";}ʌ=""; }}void ȴ(){ȹ(ʔ,oreContainerKeyword);ȹ(ʓ,ingotContainerKeyword);ȹ(ʒ,componentContainerKeyword);ȹ(ʑ,toolContainerKeyword);ȹ (ʐ,ammoContainerKeyword);ȹ(ʏ,bottleContainerKeyword);}void ȹ(Listă,string ȷ){if(ă.Count>1){bool ȶ=false ;foreach(var X in ă){if(X.CustomName.Contains("[P"))continue;if(X.GetInventory(0).ItemCount==0){if(ȶ)continue;X. CustomName=X.CustomName.Replace(ȷ,ȷ+"!");ȶ=true;if(X.CustomName.Contains(ȷ+"!!!")){string ȵ=System.Text.RegularExpressions.Regex. issameconstructas PasteShr issameconstructas Replace(X.CustomName,@"("+ȷ+@")(!+)","");ȵ=System.Text.RegularExpressions.Regex.Replace(ȵ,@"\(\d+\.?\d*\%\)","");ȵ=ȵ.Replace( " "," ");X.CustomName=ȵ.TrimEnd(' ');ʄ.Remove(X);ɗ="Unassigned '"+ȵ+"' from being a container for type '"+ȷ+"'.";}}else{if( X.CustomName.Contains(ȷ+"!")){string ȵ=System.Text.RegularExpressions.Regex.Replace(X.CustomName,@"("+ȷ+@")(!+)",ȷ);ȵ=ȵ. Replace(" "," ");X.CustomName=ȵ.TrimEnd(' ');}}}}}void ȸ(){for(int E=0;E<ɏ.Count;E++){string ȳ=ɏ[E].CustomName;string Ȳ=ȳ. ToLower();Listȱ=new List();if(Ȳ.Contains(oreContainerKeyword.ToLower())&&!ȳ.Contains(oreContainerKeyword))ȱ.Add (oreContainerKeyword);if(Ȳ.Contains(ingotContainerKeyword.ToLower())&&!ȳ.Contains(ingotContainerKeyword))ȱ.Add( ingotContainerKeyword);if(Ȳ.Contains(componentContainerKeyword.ToLower())&&!ȳ.Contains(componentContainerKeyword))ȱ.Add( componentContainerKeyword);if(Ȳ.Contains(toolContainerKeyword.ToLower())&&!ȳ.Contains(toolContainerKeyword))ȱ.Add(toolContainerKeyword);if(Ȳ. Contains(ammoContainerKeyword.ToLower())&&!ȳ.Contains(ammoContainerKeyword))ȱ.Add(ammoContainerKeyword);if(Ȳ.Contains( bottleContainerKeyword.ToLower())&&!ȳ.Contains(bottleContainerKeyword))ȱ.Add(bottleContainerKeyword);foreach(var ê in lockedContainerKeywords) issameconstructas How to use it? issameconstructas {if(Ȳ.Contains(ê.ToLower())&&!ȳ.Contains(ê)){ȱ.Add(ê);break;}}foreach(var ê in hiddenContainerKeywords){if(Ȳ.Contains(ê. ToLower())&&!ȳ.Contains(ê)){ȱ.Add(ê);break;}}if(Ȳ.Contains(specialContainerKeyword.ToLower())&&!ȳ.Contains( specialContainerKeyword))ȱ.Add(specialContainerKeyword);if(Ȳ.Contains(noSortingKeyword.ToLower())&&!ȳ.Contains(noSortingKeyword))ȱ.Add( noSortingKeyword);if(Ȳ.Contains(manualMachineKeyword.ToLower())&&!ȳ.Contains(manualMachineKeyword))ȱ.Add(manualMachineKeyword);if(Ȳ. Contains(autocraftingKeyword.ToLower())&&!ȳ.Contains(autocraftingKeyword))ȱ.Add(autocraftingKeyword);if(Ȳ.Contains( assembleKeyword.ToLower())&&!ȳ.Contains(assembleKeyword))ȱ.Add(assembleKeyword);if(Ȳ.Contains(disassembleKeyword.ToLower())&&!ȳ. Contains(disassembleKeyword))ȱ.Add(disassembleKeyword);if(Ȳ.Contains(learnKeyword.ToLower())&&!ȳ.Contains(learnKeyword))ȱ.Add( learnKeyword);if(Ȳ.Contains(learnManyKeyword.ToLower())&&!ȳ.Contains(learnManyKeyword))ȱ.Add(learnManyKeyword);if(Ȳ.Contains( inventoryLCDKeyword.ToLower())&&!ȳ.Contains(inventoryLCDKeyword))ȱ.Add(inventoryLCDKeyword);if(Ȳ.Contains(mainLCDKeyword.ToLower())&&!ȳ. Contains(mainLCDKeyword))ȱ.Add(mainLCDKeyword);if(Ȳ.Contains(warningsLCDKeyword.ToLower())&&!ȳ.Contains(warningsLCDKeyword))ȱ. issameconstructas How to use it? issameconstructas Add(warningsLCDKeyword);if(Ȳ.Contains(performanceLCDKeyword.ToLower())&&!ȳ.Contains(performanceLCDKeyword))ȱ.Add( performanceLCDKeyword);if(Ȳ.Contains("[p")&&!ȳ.Contains("[P"))ȱ.Add("[P");if(Ȳ.Contains("[pmax]")&&!ȳ.Contains("[PMax]"))ȱ.Add("[PMax]");if(Ȳ .Contains("[pmin]")&&!ȳ.Contains("[PMin]"))ȱ.Add("[PMin]");foreach(var Ì in ȱ){ɏ[E].CustomName=ɏ[E].CustomName.Ŷ(Ì,Ì);ɗ= "Corrected name\nof: '"+ȳ+"'\nto: '"+ɏ[E].CustomName+"'";}}ListƠ=new List();GridTerminalSystem.GetBlocksOfType(Ơ); for(int E=0;E<Ơ.Count;E++){string ȳ=Ơ[E].CustomName;string Ȳ=ȳ.ToLower();Listȱ=new List();if(Ȳ.Contains( mainLCDKeyword.ToLower())&&!ȳ.Contains(mainLCDKeyword))ȱ.Add(mainLCDKeyword);if(Ȳ.Contains(inventoryLCDKeyword.ToLower())&&!ȳ.Contains (inventoryLCDKeyword))ȱ.Add(inventoryLCDKeyword);if(Ȳ.Contains(warningsLCDKeyword.ToLower())&&!ȳ.Contains( warningsLCDKeyword))ȱ.Add(warningsLCDKeyword);if(Ȳ.Contains(performanceLCDKeyword.ToLower())&&!ȳ.Contains(performanceLCDKeyword))ȱ.Add( performanceLCDKeyword);foreach(var Ì in ȱ){Ơ[E].CustomName=Ơ[E].CustomName.Ŷ(Ì,Ì);ɗ="Corrected name\nof: '"+ȳ+"'\nto: '"+Ơ[E].CustomName+"'"; }}}void Ύ(){if(ɴ==0)Ό(Ȅ,ʔ,oreContainerKeyword);if(ɴ==1)Ό(ȃ,ʓ,ingotContainerKeyword);if(ɴ==2)Ό(Ȃ,ʒ, issameconstructas How to get it? issameconstructas componentContainerKeyword);if(ɴ==3)Ό(Ș,ʑ,toolContainerKeyword);if(ɴ==4)Ό(ȁ,ʐ,ammoContainerKeyword);if(ɴ==5)Ό(ȇ,ʏ,bottleContainerKeyword);if(ɴ==6) Ό(Ȑ,ʏ,bottleContainerKeyword);if(ɴ==7)Ό(ȡ,ʑ,toolContainerKeyword);if(ɴ==8)Ό(ȟ,ʑ,toolContainerKeyword);if(ɴ==9)Ό(Ȟ,ʑ, toolContainerKeyword);ɴ++;if(ɴ>9)ɴ=0;}void Ό(string Ί,ListΉ,string Ώ){if(Ή.Count==0){ƴ( "There are no containers for type '"+Ώ+"'!\nBuild new ones or add the tag to existing ones!");ʌ=Ί;return;}IMyTerminalBlock Ä=null;int Έ=int.MaxValue;for(int E=0;E<Ή.Count;E++){if(Ί==ȇ&&Ή[E].BlockDefinition.TypeIdString.Contains("OxygenTank")&&Ή[E].BlockDefinition.SubtypeId. Contains("Hydrogen")){continue;}else if(Ί==Ȑ&&Ή[E].BlockDefinition.TypeIdString.Contains("OxygenTank")&&!Ή[E].BlockDefinition. SubtypeId.Contains("Hydrogen")){continue;}var æ=Ή[E].GetInventory(0);if((float)æ.CurrentVolume<(float)æ.MaxVolume*0.98f){Ä=Ή[E];Έ =å(Ή[E]);break;}}if(Ä==null){ƴ("All containers for type '"+Ώ+"' are full!\nYou should build new cargo containers!");ʌ=Ί; return;}IMyTerminalBlock Ά=null;if(fillBottles&&(Ί==ȇ||Ί==Ȑ)){Ά=ΐ(Ί);}for(int E=0;E<ɑ.Count;E++){if(ɑ[E]==Ä||(ɑ[E].CustomName. Contains(Ώ)&&å(ɑ[E])<=Έ)||(Ί=="Ore"&&ɑ[E].GetType().ToString().Contains("MyGasGenerator"))){continue;}if(ɑ[E].CustomName. issameconstructas How to get it? issameconstructas Contains(Ώ)&&balanceTypeContainers&&!ɑ[E].BlockDefinition.TypeIdString.Contains("OxygenGenerator")&&!ɑ[E].BlockDefinition. TypeIdString.Contains("OxygenTank"))continue;if(!Ζ(ɑ[E]))continue;if(Ά!=null){if(!ɑ[E].BlockDefinition.TypeIdString.Contains( "Oxygen")){Ç(Ί,ɑ[E],0,Ά,0);continue;}}Ç(Ί,ɑ[E],0,Ä,0);}for(int E=0;E<ɾ.Count;E++){if(ɾ[E]==Ä||(ɾ[E].CustomName.Contains(Ώ)&&å(ɾ[ E])<=Έ)){continue;}if(!Ζ(ɾ[E]))continue;Ç(Ί,ɾ[E],1,Ä,0);}for(int E=0;E<ɺ.Count;E++){if((ɺ[E].Mode==MyAssemblerMode. Disassembly&&ɺ[E].IsProducing)||ɺ[E]==Ä||(ɺ[E].CustomName.Contains(Ώ)&&å(ɺ[E])<=Έ)){continue;}if(!Ζ(ɺ[E]))continue;if(Ά!=null){Ç(Ί, ɺ[E],1,Ά,0);continue;}Ç(Ί,ɺ[E],1,Ä,0);}if(!lj())ɴ++;}IMyTerminalBlock ΐ(string Ί){ListΜ=new List(ɶ );if(Ί==ȇ)Μ.RemoveAll(Κ=>Κ.BlockDefinition.SubtypeId.Contains("Hydrogen"));if(Ί==Ȑ)Μ.RemoveAll(Κ=>!Κ.BlockDefinition. SubtypeId.Contains("Hydrogen"));foreach(var Ι in Μ){if(Ι.FilledRatio>0){Ι.AutoRefillBottles=true;return Ι;}}List Θ=ɷ.Where(Η=>Η.IsSameConstructAs(Me)&&Η.Enabled==true).ToList();MyDefinitionId ē=MyItemType.MakeOre("Ice");foreach(var Λ in Θ){if(h(ē,Λ)>0){Λ.AutoRefill=true;return Λ;}}return null;}bool Ζ(IMyTerminalBlock e){if(e.GetOwnerFactionTag()!=Me. issameconstructas How to get it for free? issameconstructas GetOwnerFactionTag()){ƴ("'"+e.CustomName+"'\nhas a different owner/faction!\nCan't move items from there!");return false;}return true;} void Ε(){char Δ='0';char Γ='0';char[]Β={'A','N','T','X'};char[]Α={'a','d'};if(sortingPattern.Length==2){Δ=sortingPattern[0]; Γ=sortingPattern[1];}ɍ=new List(ɑ);ɍ.AddRange(ʕ);if(enableInternalSorting){if(Δ.ToString().IndexOfAny(Β )<0||Γ.ToString().IndexOfAny(Α)<0){ƴ("You provided the invalid sorting pattern '"+sortingPattern+ "'!\nCan't sort the inventories!");return;}}else{ɍ=ɍ.FindAll(E=>E.CustomName.ToLower().Contains("(sort:"));}for(var ƕ=ɳ;ƕ<ɍ.Count;ƕ++){if(lj())return;if(ɳ >=ɍ.Count-1){ɳ=0;}else{ɳ++;}var æ=ɍ[ƕ].GetInventory(0);var M=new List();æ.GetItems(M);if(M.Count>200) continue;char ʹ=Δ;char ͳ=Γ;string Ͳ=System.Text.RegularExpressions.Regex.Match(ɍ[ƕ].CustomName,@"(\(sort:)(.{2})",System.Text. RegularExpressions.RegexOptions.IgnoreCase).Groups[2].Value;if(Ͳ.Length==2){Δ=Ͳ[0];Γ=Ͳ[1];if(Δ.ToString().IndexOfAny(Β)<0||Γ.ToString(). IndexOfAny(Α)<0){ƴ("You provided an invalid sorting pattern in\n'"+ɍ[ƕ].CustomName+"'!\nUsing global pattern!");Δ=ʹ;Γ=ͳ;}}var ͱ= new List();æ.GetItems(ͱ);if(Δ=='A'){if(Γ=='d'){ͱ.Sort((Ɉ,ũ)=>ũ.Amount.ToIntSafe().CompareTo(Ɉ.Amount. issameconstructas PasteShr issameconstructas ToIntSafe()));}else{ͱ.Sort((Ɉ,ũ)=>Ɉ.Amount.ToIntSafe().CompareTo(ũ.Amount.ToIntSafe()));}}else if(Δ=='N'){if(Γ=='d'){ͱ.Sort((Ɉ,ũ) =>ũ.Type.SubtypeId.ToString().CompareTo(Ɉ.Type.SubtypeId.ToString()));}else{ͱ.Sort((Ɉ,ũ)=>Ɉ.Type.SubtypeId.ToString(). CompareTo(ũ.Type.SubtypeId.ToString()));}}else if(Δ=='T'){if(Γ=='d'){ͱ.Sort((Ɉ,ũ)=>ũ.Type.ToString().CompareTo(Ɉ.Type.ToString()) );}else{ͱ.Sort((Ɉ,ũ)=>Ɉ.Type.ToString().CompareTo(ũ.Type.ToString()));}}else if(Δ=='X'){if(Γ=='d'){ͱ.Sort((Ɉ,ũ)=>(ũ.Type. TypeId.ToString()+ũ.Amount.ToIntSafe().ToString(@"000000000")).CompareTo((Ɉ.Type.TypeId.ToString()+Ɉ.Amount.ToIntSafe(). ToString(@"000000000"))));}else{ͱ.Sort((Ɉ,ũ)=>(Ɉ.Type.TypeId.ToString()+Ɉ.Amount.ToIntSafe().ToString(@"000000000")).CompareTo(( ũ.Type.TypeId.ToString()+ũ.Amount.ToIntSafe().ToString(@"000000000"))));}}if(ͱ.SequenceEqual(M,new Ť()))continue;foreach( var Ì in ͱ){string ͽ=Ì.ToString();for(int E=0;Eͻ=new List();foreach(var À in Ï){if(!À.Contains("="))continue; MyDefinitionId K;double ͺ=0;var Ͷ=À.Split('=');if(Ͷ.Length>=2){if(!MyDefinitionId.TryParse(ȅ+Ͷ[0],out K))continue;double.TryParse(Ͷ[1] ,out ͺ);if(Ͷ[1].ToLower().Contains("all")){ͺ=int.MaxValue;}}else{continue;}double ͷ=h(K,ʕ[ƕ],d);double ʗ=0;if(ͺ>=0){ʗ=ͺ-ͷ ;}else{ʗ=Math.Abs(ͺ)-ͷ;}if(ʗ>=1&&ͺ>=0){var æ=ʕ[ƕ].GetInventory(d);if((float)æ.CurrentVolume>(float)æ.MaxVolume*0.98f) continue;if(ʗ>h(K)&&ͺ!=int.MaxValue){ͻ.Add(ʗ-h(K)+" "+K.SubtypeName);}IMyTerminalBlock f=null;if(allowSpecialSteal){f=Z(K,true,ʕ [ƕ]);}else{f=Z(K);}if(f!=null){Ç(K.ToString(),f,0,ʕ[ƕ],d,ʗ,true);}}else if(ʗ<0){IMyTerminalBlock Ä=W(ʕ[ƕ],ʁ);if(Ä!=null)Ç (K.ToString(),ʕ[ƕ],d,Ä,0,Math.Abs(ʗ),true);}}if(ͻ.Count>0){ƴ(ʕ[ƕ].CustomName+ "\nis missing the following items to match its quota:\n"+String.Join(", ",ͻ));}}ɒ=0;}void β(Listă){foreach(var X in ă){string α=X.CustomName;string ȵ="";var ΰ =System.Text.RegularExpressions.Regex.Match(α,@"\(\d+\.?\d*\%\)").Value;if(ΰ!=""){ȵ=α.Replace(ΰ,"").TrimEnd(' ');}else{ȵ= α;}var æ=X.GetInventory(0);string ǝ=((float)æ.CurrentVolume).ƀ((float)æ.MaxVolume);if(showFillLevel){ȵ+=" ("+ǝ+")";ȵ=ȵ. issameconstructas How to get it for free? issameconstructas Replace(" "," ");}if(ȵ!=α)X.CustomName=ȵ;}}StringBuilder ί(){if(ɻ.Count>1){string ή=@"("+autocraftingKeyword+@" *)(\d*)";ɻ. Sort((Ɉ,ũ)=>System.Text.RegularExpressions.Regex.Match(Ɉ.CustomName,ή).Groups[2].Value.CompareTo(System.Text. RegularExpressions.Regex.Match(ũ.CustomName,ή).Groups[2].Value));}StringBuilder ł=new StringBuilder();if(!ɻ[0].GetText().Contains(Ǵ)){ɻ[0] .Font=defaultFont;ɻ[0].FontSize=defaultFontSize;ɻ[0].TextPadding=defaultPadding;}foreach(var q in ɻ){ł.Append(q.GetText() +"\n");q.WritePublicTitle("Craft item manually once to show up here");q.Font=ɻ[0].Font;q.FontSize=ɻ[0].FontSize;q. TextPadding=ɻ[0].TextPadding;q.Alignment=TextAlignment.LEFT;q.ContentType=ContentType.TEXT_AND_IMAGE;}var γ=new List(ł. ToString().Split('\n'));var Ω=new List();var λ=new HashSet();string κ;foreach(var À in γ){if(À.IndexOfAny(ȍ)<=0) continue;κ=À.Remove(À.IndexOf(" "));if(!λ.Contains(κ)){Ω.Add(À);λ.Add(κ);}}ListÏ=ɻ[0].CustomData.Split('\n').ToList(); foreach(var I in ʅ){bool ι=false;if(λ.Contains(I)){continue;}foreach(var À in Ï){if(!À.StartsWith("-"))continue;string θ="";try {if(À.Contains("=")){θ=À.Substring(1,À.IndexOf("=")-1);}else{θ=À.Substring(1);}}catch{continue;}if(θ==I){ι=true;break;}} issameconstructas How to use it? issameconstructas if(!ι){MyDefinitionId K=ǔ(I);double η=Math.Ceiling(h(K));Ω.Add(I+" "+η+" = "+η);}}foreach(var À in Ï){if(!À.StartsWith("-" ))continue;if(À.Contains("=")){Ω.Add(À);}}StringBuilder ƌ=new StringBuilder();try{IOrderedEnumerableζ;ζ=Ω.OrderBy (Ɉ=>Ɉ);bool ε;string δ,I,Σ;foreach(var À in ζ){ε=false;if(À.StartsWith("-")){I=À.Remove(À.IndexOf("=")).TrimStart('-');δ= "-";}else{I=À.Remove(À.IndexOf(" "));δ="";}Σ=À.Replace(δ+I,"");foreach(var Ì in ʅ){if(Ì==I){ε=true;break;}}if(ε)ƌ.Append(δ+ 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!" );ł=ɻ[0].Ŝ(ł,2,false);ɻ[0].WriteText(ł);return;}var Ļ=ł.ToString().TrimEnd('\n').Split('\n');int ĺ=Ļ.Length;int Ĺ=0;float Ρ=0;foreach(var q in ɻ){float ő=q.Ŋ();int ĸ=q.ō();int ķ=0;Listƌ=new List();if(q==ɻ[0]|| headerOnEveryScreen){string Ξ=Ǵ;if(headerOnEveryScreen&&ɻ.Count>1){Ξ+=" "+(ɻ.IndexOf(q)+1)+"/"+ɻ.Count;try{Ξ+=" ["+Ļ[Ĺ][0]+"-#]";}catch{Ξ+= " [Empty]";}}ƌ.Add(Ξ);ƌ.Add(q.Ň('=',q.ū(Ξ)).ToString()+"\n");string Ν="Component ";string Ο="Current | Wanted ";Ρ=q.ū("Wanted "); string Ǔ=q.Ň(' ',ő-q.ū(Ν)-q.ū(Ο)).ToString();ƌ.Add(Ν+Ǔ+Ο+"\n");ķ=5;}while((Ĺ<ĺ&&ķ<ĸ)||(q==ɻ[ɻ.Count-1]&&Ĺ<ĺ)){var À=Ļ[Ĺ].Split issameconstructas How to get it for free? issameconstructas (' ');À[0]+=" ";À[1]=À[1].Replace('$',' ');string Ǔ=q.Ň(' ',ő-q.ū(À[0])-q.ū(À[1])-Ρ).ToString();string έ=À[0]+Ǔ+À[1]+À[2] ;ƌ.Add(έ);Ĺ++;ķ++;}if(headerOnEveryScreen&&ɻ.Count>1){ƌ[0]=ƌ[0].Replace('#',Ļ[Ĺ-1][0]);}q.WriteText(String.Join("\n",ƌ)); }if(showAutocraftingModifiers){string ά="\n\n---\n\nModifiers (append after wanted amount):\n"+"'A' - Assemble only\n"+ "'D' - Disassemble only\n"+"'P' - Always queue first (priority)\n"+"'H' - Hide and manage in background\n"+"'I' - Hide and ignore\n";ɻ[ɻ.Count-1]. WriteText(ά,true);}}void Ϋ(){ɻ.Clear();GridTerminalSystem.GetBlocksOfType(ɻ,q=>q.IsSameConstructAs(Me)&&q. CustomName.Contains(autocraftingKeyword));if(ɻ.Count==0)return;if(ɼ.Count==0){ƴ( "No assemblers found!\nBuild assemblers to enable autocrafting!");return;}ˋ();ListΪ=new List();var Ω=ί().ToString().TrimEnd('\n').Split('\n'); StringBuilder ƌ=new StringBuilder();foreach(var À in Ω){string I="";bool Ψ=true;if(À.StartsWith("-")){Ψ=false;try{I=À.Substring(1,À. IndexOf("=")-1);}catch{continue;}}else{try{I=À.Substring(0,À.IndexOf(" "));}catch{continue;}}MyDefinitionId K=ǔ(I);if(K==null) continue;double Χ=Math.Ceiling(h(K));string Φ=À.Substring(À.IndexOfAny(ȍ)+1).ToLower();double Υ=0;double.TryParse(System.Text. issameconstructas How to dowload it? issameconstructas RegularExpressions.Regex.Replace(Φ,@"\D",""),out Υ);string Τ=Χ.ToString();string Ͱ=Υ.ToString();string ʳ="";bool ã=false;if(Φ.Contains("h" )){if(!ɻ[0].CustomData.StartsWith(Ȏ))ɻ[0].CustomData=Ȏ;ɻ[0].CustomData+="\n-"+I+"="+Υ;continue;}else if(Φ.Contains("i")){ if(!ɻ[0].CustomData.StartsWith(Ȏ))ɻ[0].CustomData=Ȏ;ɻ[0].CustomData+="\n-"+I;continue;}if(Φ.Contains("a")){if(Χ>Υ)Υ=Χ;ʳ+= "A";}if(Φ.Contains("d")){if(Χ<Υ)Υ=Χ;ʳ+="D";}if(Φ.Contains("p")){ã=true;ʳ+="P";}ƣ(K,Υ);double ʱ=Math.Abs(Υ-Χ);bool ʰ; MyDefinitionId Û=ƶ(K,out ʰ);double ʯ=Ƥ(Û);if(Χ>=Υ+Υ*assembleMargin&&ʯ>0&&ƥ(Û)>0){ˍ(Û);Ƣ(Û,0);ʯ=0;ɗ="Removed '"+K.SubtypeId.ToString()+ "' from the assembling queue.";}if(Χ<=Υ-Υ*disassembleMargin&&ʯ>0&&ƥ(Û)<0){ˍ(Û);Ƣ(Û,0);ʯ=0;ɗ="Removed '"+K.SubtypeId.ToString()+ "' from the disassembling queue.";}string Ã="";if(ʯ>0||ʱ>0){if(enableAutodisassembling&&Χ>Υ+Υ*disassembleMargin){Ƣ(Û,-1);Ã="$[D:";}else if( enableAutocrafting&&Χ<Υ-Υ*assembleMargin){Ƣ(Û,1);Ã="$[A:";}if(Ã!=""){if(ʯ==0){Ã+="Wait]";}else{Ã+=Math.Round(ʯ)+"]";}}}else{Ƣ(Û,0);}if(!ʰ) Ã="$[NoBP!]";if(ʰ&&ã){Ϊ.Add(Û);}string ʮ="$=$ ";if(Χ>Υ)ʮ="$>$ ";if(Χ<Υ)ʮ="$<$ ";if(Ψ)ƌ.Append(I+" "+Τ+Ã+ʮ+Ͱ+ʳ+"\n");if(Ã. Contains("[D:Wait]")){ʿ(Û,ʱ);}else if(Ã.Contains("[A:Wait]")){ʾ(Û,ʱ,ã);ɗ="Queued "+ʱ+" '"+K.SubtypeId.ToString()+ issameconstructas How to use it? issameconstructas "' in the assemblers.";}else if(Ã.Contains("[NoBP!]")&&Υ>Χ){ƴ("Can't craft\n'"+K.SubtypeId.ToString()+ "'\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 >0)return;MyDefinitionId ʥ=MyItemType.MakeOre("Stone");MyDefinitionId Û=MyDefinitionId.Parse(ȝ+"StoneOreToIngotBasic"); double ʭ=h(ʥ);if(ʭ>0){double ʬ=Math.Floor(ʭ/500/ɸ.Count);if(ʬ<1)return;foreach(var ʫ in ɸ){if(ʫ.IsQueueEmpty)ʫ.AddQueueItem(Û, ʬ);}}}void ʪ(){if(ɠ==0)ɠ+=ʩ(ʔ,Ȅ,true);if(ɠ==1)ɠ+=ʩ(ʓ,ȃ,true);if(ɠ==2)ɠ+=ʩ(ʒ,Ȃ,true);if(ɠ==3)ɠ+=ʩ(ʑ,Ș,true);if(ɠ==4)ɠ+=ʩ(ʐ ,ȁ,true);if(ɠ==5)ɠ+=ʩ(ʏ,"ContainerObject",true);ɠ++;if(ɠ>5)ɠ=0;}int ʩ(Listɉ,string ʴ="",bool ʸ=false){ if(ʸ)ɉ.RemoveAll(ŭ=>ŭ.InventoryCount==2||ŭ.BlockDefinition.TypeIdString.Contains("OxygenGenerator")||ŭ.BlockDefinition. TypeIdString.Contains("OxygenTank"));if(ɉ.Count<2){return 1;}Dictionaryʻ=new Dictionary();for( int E=0;E<ɉ.Count;E++){var M=new List();ɉ[E].GetInventory(0).GetItems(M);foreach(var Ì in M){if(!Ì.Type. TypeId.ToString().Contains(ʴ))continue;MyItemType K=Ì.Type;if(ʻ.ContainsKey(K)){ʻ[K]+=(double)Ì.Amount;}else{ʻ[K]=(double)Ì. issameconstructas PasteShr issameconstructas Amount;}}}Dictionaryʺ=new Dictionary();foreach(var Ì in ʻ){ʺ[Ì.Key]=(int)(Ì.Value/ɉ. Count);}for(int ʹ=0;ʹ<ɉ.Count;ʹ++){if(lj())return 0;var ʷ=new List();ɉ[ʹ].GetInventory(0).GetItems(ʷ); Dictionaryʶ=new Dictionary();foreach(var Ì in ʷ){MyItemType K=Ì.Type;if(ʶ.ContainsKey(K)){ʶ[ K]+=(double)Ì.Amount;}else{ʶ[K]=(double)Ì.Amount;}}double Ģ=0;foreach(var Ì in ʻ){ʶ.TryGetValue(Ì.Key,out Ģ);double ʵ=ʺ[Ì .Key];if(Ģ<=ʵ+1)continue;for(int ʨ=0;ʨ<ɉ.Count;ʨ++){if(ɉ[ʹ]==ɉ[ʨ])continue;double ģ=h(Ì.Key,ɉ[ʨ]);if(ģ>=ʵ-1)continue; double ʗ=ʵ-ģ;if(ʗ>Ģ-ʵ)ʗ=Ģ-ʵ;if(ʗ>0){Ģ-=Ç(Ì.Key.ToString(),ɉ[ʹ],0,ɉ[ʨ],0,ʗ,true);if(Ģ.Ɠ(ʵ-1,ʵ+1))break;}}}}return lj()?0:1;}void ʢ(){if(ɿ.Count==0)return;if(ɚ==0)ȏ=ˑ(ɽ);if(ɚ==1)Ȉ=ˑ(ʃ);if(enableScriptRefineryFilling){if(ɚ==2)ʜ(ɽ,ȏ);if(ɚ==3)ʜ(ʃ,Ȉ);if(ɚ ==4)ʦ(ɽ,ȏ);if(ɚ==5)ʦ(ʃ,Ȉ);if(ɚ==6&&ɽ.Count>0&&ʃ.Count>0){bool ʡ=false;ʡ=ˀ(ɽ,ʃ,ȏ);if(!ʡ)ˀ(ʃ,ɽ,Ȉ);}}else{if(ɚ>1)ɚ=6;}ɚ++;if( ɚ>6)ɚ=0;}void ʠ(){if(ɘ==0)ɘ+=ʩ(ɽ.ToList());if(ɘ==1)ɘ+=ʩ(ʃ.ToList());ɘ++;if(ɘ>1)ɘ=0;} void ʟ(Listʞ,Listʝ){foreach(IMyRefinery Ù in ʞ){var æ=Ù.GetInventory(0);var M=new List< issameconstructas How to use it? issameconstructas MyInventoryItem>();æ.GetItems(M);if(M.Count<2)continue;bool ʛ=false;int ʚ=0;string ʙ="";foreach(var ʘ in ʝ){for(int E=0;Eʣ,Listʝ){if(ʣ.Count==0){ɚ++;return;} MyItemType ʧ=new MyItemType();MyItemType ʥ=MyItemType.MakeOre("Stone");foreach(var ʘ in ʝ){if(h(ʘ)>100){ʧ=ʘ;break;}}if(!ʧ.ToString ().Contains(Ȅ))return;for(int E=0;E<ʣ.Count;E++){if(lj())return;var æ=ʣ[E].GetInventory(0);if((float)æ.CurrentVolume>( float)æ.MaxVolume*0.75f){var M=new List();æ.GetItems(M);foreach(var Ì in M){if(Ì.Type==ʧ)return;} IMyTerminalBlock Ä=W(ʣ[E],ʔ);if(Ä!=null){Ç("",ʣ[E],0,Ä,0);}}}if(!lj())ɚ++;}void ʦ(Listʣ,Listʝ){if(ʣ.Count==0){ɚ ++;return;}var ă=new List();ă.AddRange(ɑ);ă.AddRange(ʕ);MyItemType ʥ=MyItemType.MakeOre("Stone");foreach (var ʘ in ʝ){if(h(ʘ)==0)continue;IMyTerminalBlock ʤ=Z(ʘ,true);if(ʤ==null)continue;for(int E=0;E<ʣ.Count;E++){if(lj()) return;var æ=ʣ[E].GetInventory(0);if((float)æ.CurrentVolume>(float)æ.MaxVolume*0.98f)continue;Ç(ʘ.ToString(),ʤ,0,ʣ[E],0);}}if( issameconstructas How to get it for free? issameconstructas !lj())ɚ++;}bool ˀ(Listˡ,Listˠ,Listʝ){for(int E=0;E<ˡ.Count;E++){if((float)ˡ[E]. GetInventory(0).CurrentVolume>0.05f)continue;for(int Ɵ=0;Ɵ<ˠ.Count;Ɵ++){if((float)ˠ[Ɵ].GetInventory(0).CurrentVolume>0){foreach(var ʘ in ʝ){Ç(ʘ.ToString(),ˠ[Ɵ],0,ˡ[E],0,-0.5);}return true;}}}return false;}Listˑ(Listʣ){if(ʣ.Count ==0){ɚ++;return null;}Listː=new List(ȉ);ː.Sort((Ɉ,ũ)=>(h(MyItemType.MakeIngot(Ɉ))/Ɯ(Ɉ)).CompareTo((h( MyItemType.MakeIngot(ũ))/Ɯ(ũ))));ː.InsertRange(0,fixedRefiningList);Listˎ=new List();MyItemType K;foreach( var Ì in ː){K=MyItemType.MakeOre(Ì);foreach(var Ù in ʣ){if(Ù.GetInventory(0).CanItemsBeAdded(1,K)){ˎ.Add(K);break;}}}if(!lj( ))ɚ++;return ˎ;}void ˏ(){foreach(var ƞ in ɼ){if(ƞ.GetOwnerFactionTag()==Me.GetOwnerFactionTag()){var æ=ƞ.GetInventory(0); if((float)æ.CurrentVolume==0)continue;if(ƞ.IsQueueEmpty||ƞ.Mode==MyAssemblerMode.Disassembly||(float)æ.CurrentVolume>( float)æ.MaxVolume*0.98f){IMyTerminalBlock Ä=W(ƞ,ʓ);if(Ä!=null)Ç("",ƞ,0,Ä,0);}}}}void ˮ(){foreach(IMyAssembler ƞ in ɼ){if(ƞ. Mode==MyAssemblerMode.Disassembly)continue;if(ƞ.CustomData.Contains("skipQueueSorting")){ƞ.CustomData="";continue;}var Ã=new issameconstructas How to use it? issameconstructas List();ƞ.GetQueue(Ã);if(Ã.Count<2)continue;double ˬ=Double.MaxValue;int ʚ=0;string ʙ="";for(int E=0;E<Ã. Count;E++){MyDefinitionId K=ǘ(Ã[E].BlueprintId);double ˤ=h(K);if(ˤ<ˬ){ˬ=ˤ;ʚ=E;ʙ=K.SubtypeId.ToString();}}if(ʚ!=0){ƞ. MoveQueueItemRequest(Ã[ʚ].ItemId,0);ɗ="Sorted the assembling queue.\n'"+ʙ+"' is now at the front of the queue.";}}}void ˣ(List< MyDefinitionId>ˢ){if(ˢ.Count==0)return;if(ˢ.Count>1)ˢ.Sort((Ɉ,ũ)=>h(ǘ(Ɉ)).CompareTo(h(ǘ(ũ))));foreach(var ƞ in ɼ){var Ã=new List< MyProductionItem>();ƞ.GetQueue(Ã);if(Ã.Count<2)continue;foreach(var Û in ˢ){int ƕ=Ã.FindIndex(E=>E.BlueprintId==Û);if(ƕ==-1)continue;if( ƕ==0){ƞ.CustomData="skipQueueSorting";break;}ƞ.MoveQueueItemRequest(Ã[ƕ].ItemId,0);ƞ.CustomData="skipQueueSorting";ɗ= "Sorted the assembler queue by priority.\n'"+ǘ(Û).SubtypeId.ToString()+"' is now at the front of the queue.";break;}}}void ʾ(MyDefinitionId Û,double k,bool ã){List< IMyAssembler>ʼ=new List();foreach(IMyAssembler ƞ in ɼ){if(ƞ.CustomName.Contains(disassembleKeyword))continue;if(ã== false&&ƞ.Mode==MyAssemblerMode.Disassembly&&!ƞ.IsQueueEmpty)continue;if(ƞ.Mode==MyAssemblerMode.Disassembly){ƞ.ClearQueue();ƞ .Mode=MyAssemblerMode.Assembly;}if(ƞ.CanUseBlueprint(Û)){ʼ.Add(ƞ);}}if(ʼ.Count==0)ƴ( issameconstructas PasteShr issameconstructas "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);} void ʿ(MyDefinitionId Û,double k){Listʼ=new List();foreach(IMyAssembler ƞ in ɼ){if(ƞ.CustomName. Contains(assembleKeyword))continue;if(ƞ.Mode==MyAssemblerMode.Assembly&&ƞ.IsProducing)continue;if(ƞ.Mode==MyAssemblerMode. Assembly){ƞ.ClearQueue();ƞ.Mode=MyAssemblerMode.Disassembly;}if(ƞ.Mode==MyAssemblerMode.Assembly)continue;if(ƞ.CanUseBlueprint(Û )){ʼ.Add(ƞ);}}if(ʼ.Count==0)ƴ("There's no assembler available to dismantle '"+Û.SubtypeName+ "'. Make sure, that you have at least one assembler with no tags or the !disassemble-only tag!");ʽ(ʼ,Û,k);}void ʽ(Listʼ,MyDefinitionId Û,double k){if(ʼ.Count==0)return;double ˁ=Math.Ceiling(k/ʼ.Count); foreach(IMyAssembler ƞ in ʼ){if(ˁ>k)ˁ=Math.Ceiling(k);if(k>0){ƞ.InsertQueueItem(0,Û,ˁ);k-=ˁ;}else{break;}}}void ˍ( MyDefinitionId Û){foreach(IMyAssembler ƞ in ɼ){var Ã=new List();ƞ.GetQueue(Ã);for(int E=0;E<Ã.Count;E++){if(Ã[E]. BlueprintId==Û)ƞ.RemoveQueueItem(E,Ã[E].Amount);}}}void ˋ(){foreach(IMyAssembler ƞ in ɼ){ƞ.UseConveyorSystem=true;ƞ.CooperativeMode =false;ƞ.Repeating=false;}}void ˌ(){Listˊ=new List(ɼ);ˊ.RemoveAll(Ɉ=>Ɉ.IsQueueEmpty);if(ˊ. issameconstructas How to dowload it? issameconstructas Count==0)return;Listˉ=new List(ɼ);ˉ.RemoveAll(Ɉ=>!Ɉ.IsQueueEmpty);foreach(var ˈ in ˊ){if(ˉ.Count ==0)return;var Ã=new List();ˈ.GetQueue(Ã);double ˇ=(double)Ã[0].Amount;if(ˇ<=10)continue;double ˆ=Math. Ceiling(ˇ/2);foreach(var Ǥ in ˉ){if(!Ǥ.CanUseBlueprint(Ã[0].BlueprintId))continue;if(ˈ.Mode==MyAssemblerMode.Assembly&&Ǥ. CustomName.Contains(disassembleKeyword))continue;if(ˈ.Mode==MyAssemblerMode.Disassembly&&Ǥ.CustomName.Contains(assembleKeyword)) continue;Ǥ.Mode=ˈ.Mode;if(Ǥ.Mode!=ˈ.Mode)continue;Ǥ.AddQueueItem(Ã[0].BlueprintId,ˆ);ˈ.RemoveQueueItem(0,ˆ);ˉ.Remove(Ǥ);break;}} }void ĕ(){if(ɷ.Count==0)return;double Ô=iceFillLevelPercentage/100;MyDefinitionId ē=MyItemType.MakeOre("Ice");string Ē=ē. ToString();double đ=0.00037;foreach(IMyGasGenerator Ď in ɷ){var æ=Ď.GetInventory(0);double Đ=h(ē,Ď);double Ĕ=Đ*đ;double ď=( double)æ.MaxVolume;if(Ĕ>ď*(Ô+0.001)){IMyTerminalBlock Ä=W(Ď,ʔ);if(Ä!=null){double û=(Ĕ-ď*Ô)/đ;Ç(Ē,Ď,0,Ä,0,û);}}else if(Ĕ<ď*(Ô- 0.001)){IMyTerminalBlock f=Z(ē,true);if(f!=null){double û=(ď*Ô-Ĕ)/đ;Ç(Ē,f,0,Ď,0,û);}}}double č=0;double Č=0;foreach(var Ď in ɷ){č+=h(ē,Ď);var æ=Ď.GetInventory(0);Č+=(double)æ.MaxVolume;}double ĝ=(č*đ)/Č;foreach(var Ĥ in ɷ){var O=Ĥ.GetInventory(0) issameconstructas How to get it for free? issameconstructas ;double Ģ=h(ē,Ĥ);double ġ=Ģ*đ;double Ġ=(double)O.MaxVolume;if(ġ>Ġ*(ĝ+0.001)){foreach(var ğ in ɷ){if(Ĥ==ğ)continue;var N=ğ .GetInventory(0);double ģ=h(ē,ğ);double Ğ=ģ*đ;double Ĝ=(double)N.MaxVolume;if(Ğ<Ĝ*(ĝ-0.001)){double ě=((Ĝ*ĝ)-Ğ)/đ;if((Ģ-ě )*đ>=Ġ*ĝ&&ě>5){Ģ-=Ç(Ē,Ĥ,0,ğ,0,ě);continue;}if((Ģ-ě)*đ<Ġ*ĝ&&ě>5){double Ě=(Ģ*đ-Ġ*ĝ)/đ;Ç(Ē,Ĥ,0,ğ,0,Ě);break;}}}}}}void ę(){ if(ɵ.Count==0)return;MyDefinitionId Ę=MyItemType.MakeIngot("Uranium");string ė=Ę.ToString();double Ė=0;double ċ=0;foreach( IMyReactor Ċ in ɵ){Ċ.UseConveyorSystem=false;double ñ=h(Ę,Ċ);double ü=uraniumAmountLargeGrid;if(Ċ.CubeGrid.GridSize==0.5f)ü= uraniumAmountSmallGrid;ċ+=ü;if(ñ>ü+0.05){IMyTerminalBlock Ä=W(Ċ,ʓ);if(Ä!=null){double û=ñ-ü;Ç(ė,Ċ,0,Ä,0,û);}}else if(ñ<ü-0.05){ IMyTerminalBlock f=Z(Ę,true);if(f!=null){double û=ü-ñ;Ç(ė,f,0,Ċ,0,û);}}Ė+=h(Ę,Ċ);}double ú=Ė/ċ;foreach(var ý in ɵ){double ù=h(Ę,ý); double ø=ú*uraniumAmountLargeGrid;if(ý.CubeGrid.GridSize==0.5f)ø=ú*uraniumAmountSmallGrid;if(ù>ø+0.05){foreach(var ö in ɵ){if( ý==ö)continue;double õ=h(Ę,ö);double ô=ú*uraniumAmountLargeGrid;if(ö.CubeGrid.GridSize==0.5f)ô=ú*uraniumAmountSmallGrid; if(õ<ô-0.05){ù=h(Ę,ý);double ó=ô-õ;if(ù-ó>=ø){Ç(ė,ý,0,ö,0,ó);continue;}if(ù-ó<ø){ó=ù-ø;Ç(ė,ý,0,ö,0,ó);break;}}}}}} issameconstructas How to get it? issameconstructas StringBuilder ò(IMyTextSurface q,bool ÿ=true,bool Ă=true,bool ĉ=true,bool Ĉ=true,bool ć=true){bool Ć=false;StringBuilder É=new StringBuilder();if(ÿ){É.Append("Isy's Inventory Manager\n");É.Append(q.Ň('=',q.ū(É))).Append("\n\n");}if(Ă&&Ņ!=null){É.Append( "Warning!\n"+Ņ+"\n\n");Ć=true;}if(ĉ){É.Append(Ą(q,ʔ,"Ores"));É.Append(Ą(q,ʓ,"Ingots"));É.Append(Ą(q,ʒ,"Components"));É.Append(Ą(q,ʑ, "Tools"));É.Append(Ą(q,ʐ,"Ammo"));É.Append(Ą(q,ʏ,"Bottles"));É.Append("=> "+ʄ.Count+" type containers: Balancing "+( balanceTypeContainers?"ON":"OFF")+"\n\n");Ć=true;}if(Ĉ){É.Append("Managed blocks:\n");float ą=q.ū(ɏ.Count.ToString());É.Append(ɏ.Count+ " Inventories (total) / "+ɑ.Count+" have items to sort\n");if(ʕ.Count>0){É.Append(q.Ň(' ',ą-q.ū(ʕ.Count.ToString())).ToString()+ʕ.Count+ " Special Containers\n");}if(ɿ.Count>0){É.Append(q.Ň(' ',ą-q.ū(ɿ.Count.ToString())).ToString()+ɿ.Count+" Refineries: ");É.Append( "Ore Balancing "+(enableOreBalancing?"ON":"OFF")+"\n");}if(ɷ.Count>0){É.Append(q.Ň(' ',ą-q.ū(ɷ.Count.ToString())).ToString()+ɷ.Count+ " O2/H2 Generators: ");É.Append("Ice Balancing "+(enableIceBalancing?"ON":"OFF")+"\n");}if(ɵ.Count>0){É.Append(q.Ň(' ',ą-q.ū(ɵ.Count.ToString ())).ToString()+ɵ.Count+" Reactors: ");É.Append("Uranium Balancing "+(enableUraniumBalancing?"ON":"OFF")+"\n");}if(ɼ. issameconstructas How to dowload it? issameconstructas Count>0){É.Append(q.Ň(' ',ą-q.ū(ɼ.Count.ToString())).ToString()+ɼ.Count+" Assemblers: ");É.Append("Craft "+( enableAutocrafting?"ON":"OFF")+" | ");É.Append("Uncraft "+(enableAutodisassembling?"ON":"OFF")+" | ");É.Append("Cleanup "+( enableAssemblerCleanup?"ON":"OFF")+"\n");}if(ɸ.Count>0){É.Append(q.Ň(' ',ą-q.ū(ɸ.Count.ToString())).ToString()+ɸ.Count+" Survival Kits: ");É. Append("Ingot Crafting "+(enableBasicIngotCrafting?"ON":"OFF")+(ɿ.Count>0?" (Auto OFF - refineries exist)":"")+"\n");}É.Append ("\n");Ć=true;}if(ć&&ɗ!=""){É.Append("Last Action:\n"+ɗ);Ć=true;}if(!Ć){É.Append("-- No informations to show --");}return É;}StringBuilder Ą(IMyTextSurface q,Listă,string P){double ā=0,Ā=0;foreach(var X in ă){var æ=X. GetInventory(0);ā+=(double)æ.CurrentVolume;Ā+=(double)æ.MaxVolume;}string Ë=ă.Count+"x "+P+":";string þ=ā.ž();string ĥ=Ā.ž(); StringBuilder Ĵ=ǖ(q,Ë,ā,Ā,þ,ĥ);return Ĵ;}void Ń(string ł=null){if(ɔ.Count==0){ɤ++;return;}for(int E=ɟ;E<ɔ.Count;E++){if(lj())return;ɟ ++;var į=ɔ[E].Ɗ(mainLCDKeyword);foreach(var Į in į){var ĭ=Į.Key;var ĵ=Į.Value;if(!ĭ.GetText().EndsWith("\a")){ĭ.Font= defaultFont;ĭ.FontSize=defaultFontSize;ĭ.TextPadding=defaultPadding;ĭ.Alignment=TextAlignment.LEFT;ĭ.ContentType=ContentType. issameconstructas How to get it? issameconstructas TEXT_AND_IMAGE;}bool ÿ=ĵ.Ɩ("showHeading");bool Ă=ĵ.Ɩ("showWarnings");bool ĉ=ĵ.Ɩ("showContainerStats");bool Ĉ=ĵ.Ɩ("showManagedBlocks"); bool ć=ĵ.Ɩ("showLastAction");bool ŀ=ĵ.Ɩ("scrollTextIfNeeded");StringBuilder É=new StringBuilder();if(ł!=null){É.Append(ł);} else{É=ò(ĭ,ÿ,Ă,ĉ,Ĉ,ć);}É=ĭ.Ŝ(É,ÿ?3:0,ŀ);ĭ.WriteText(É.Append("\a"));}}ɤ++;ɟ=0;}void Ŀ(){if(ɓ.Count==0){ɤ++;return;} StringBuilder Ł=new StringBuilder();if(ɬ.Count==0){Ł.Append("- No problems detected -");}else{int ń=1;foreach(var Ņ in ɬ){Ł.Append(ń+ ". "+Ņ.Replace("\n"," ")+"\n");ń++;}}for(int E=ɞ;E<ɓ.Count;E++){if(lj())return;ɞ++;var į=ɓ[E].Ɗ(warningsLCDKeyword);foreach( var Į in į){var ĭ=Į.Key;var ĵ=Į.Value;if(!ĭ.GetText().EndsWith("\a")){ĭ.Font=defaultFont;ĭ.FontSize=defaultFontSize;ĭ. TextPadding=defaultPadding;ĭ.Alignment=TextAlignment.LEFT;ĭ.ContentType=ContentType.TEXT_AND_IMAGE;}bool ÿ=ĵ.Ɩ("showHeading");bool ŀ=ĵ.Ɩ("scrollTextIfNeeded");StringBuilder É=new StringBuilder();if(ÿ){É.Append("Isy's Inventory Manager Warnings\n");É. Append(ĭ.Ň('=',ĭ.ū(É))).Append("\n\n");}É.Append(Ł);É=ĭ.Ŝ(É,ÿ?3:0,ŀ);ĭ.WriteText(É.Append("\a"));}}ɤ++;ɞ=0;}void ņ(){if(ə. Count==0){ɤ++;return;}for(int E=ɝ;E<ə.Count;E++){if(lj())return;ɝ++;var į=ə[E].Ɗ(performanceLCDKeyword);foreach(var Į in į){ issameconstructas How to use it? issameconstructas var ĭ=Į.Key;var ĵ=Į.Value;if(!ĭ.GetText().EndsWith("\a")){ĭ.Font=defaultFont;ĭ.FontSize=defaultFontSize;ĭ.TextPadding= defaultPadding;ĭ.Alignment=TextAlignment.LEFT;ĭ.ContentType=ContentType.TEXT_AND_IMAGE;}bool ÿ=ĵ.Ɩ("showHeading");bool ŀ=ĵ.Ɩ( "scrollTextIfNeeded");StringBuilder É=new StringBuilder();if(ÿ){É.Append("Isy's Inventory Manager Performance\n");É.Append(ĭ.Ň('=',ĭ.ū(É))). Append("\n\n");}É.Append(ɫ);É=ĭ.Ŝ(É,ÿ?3:0,ŀ);ĭ.WriteText(É.Append("\a"));}}ɤ++;ɝ=0;}void ľ(){if(ɣ.Count==0){ɤ++;return;} DictionaryĦ=new Dictionary();DictionaryIJ=new Dictionary< IMyTextSurface,string>();Listı=new List();Listİ=new List();foreach(var e in ɣ){var į=e.Ɗ(inventoryLCDKeyword);foreach(var Į in į){if(Į.Value.Contains(inventoryLCDKeyword+":")){Ħ[Į.Key]=Į.Value ;ı.Add(Į.Key);}else{IJ[Į.Key]=Į.Value;İ.Add(Į.Key);}}}HashSetij=new HashSet();foreach(var ĭ in Ħ){ij.Add( System.Text.RegularExpressions.Regex.Match(ĭ.Value,inventoryLCDKeyword+@":[A-Za-z]+").Value);}ij.RemoveWhere(ī=>ī=="");List< string>Ī=ij.ToList();for(int E=ɜ;E<Ī.Count;E++){if(lj())return;ɜ++;var ĩ=Ħ.Where(Ĩ=>Ĩ.Value.Contains(Ī[E]));var ħ=from pair in ĩ issameconstructas How to get it? issameconstructas orderby System.Text.RegularExpressions.Regex.Match(pair.Value,inventoryLCDKeyword+@":\w+").Value ascending select pair; IMyTextSurface Ĭ=ħ.ElementAt(0).Key;string ĵ=ħ.ElementAt(0).Value;StringBuilder É=Ķ(Ĭ,ĵ);if(!ĵ.ToLower().Contains("noscroll")){int Ľ=0 ;foreach(var ļ in ħ){Ľ+=ļ.Key.ō();}É=Ĭ.Ŝ(É,0,true,Ľ);}var Ļ=É.ToString().Split('\n');int ĺ=Ļ.Length;int Ĺ=0;int ĸ,ķ; foreach(var ļ in ħ){IMyTextSurface ĭ=ļ.Key;ĭ.FontSize=Ĭ.TextureSize.Y/ĭ.TextureSize.Y*Ĭ.FontSize;ĭ.Font=Ĭ.Font;ĭ.TextPadding=Ĭ. TextPadding;ĭ.Alignment=Ĭ.Alignment;ĭ.ContentType=ContentType.TEXT_AND_IMAGE;ĸ=ĭ.ō();ķ=0;É.Clear();while(Ĺ<ĺ&&ķ<ĸ){É.Append(Ļ[Ĺ]+ "\n");Ĺ++;ķ++;}ĭ.WriteText(É);}}for(int E=ɛ;E<İ.Count;E++){if(lj())return;ɛ++;IMyTextSurface ĭ=İ[E];string ĵ=IJ[ĭ]; StringBuilder É=Ķ(ĭ,ĵ);if(!ĵ.ToLower().Contains("noscroll")){É=ĭ.Ŝ(É,0);}ĭ.WriteText(É);ĭ.Alignment=TextAlignment.LEFT;ĭ.ContentType= ContentType.TEXT_AND_IMAGE;}ɤ++;ɜ=0;ɛ=0;}StringBuilder Ķ(IMyTextSurface q,string ĵ){StringBuilder É=new StringBuilder();var ð=ĵ. Split('\n').ToList();ð.RemoveAll(S=>S.StartsWith("@")||S.Length<=1);bool Á=true;try{if(ð[0].Length<=1)Á=false;}catch{Á=false; }if(!Á){É.Append("Put an item, type name or Echo command in the custom data.\n\n"+ issameconstructas How to get it for free? issameconstructas "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"+ "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"+ "'noScroll' to prevent the screen from scrolling\n"+"'hideEmpty' to hide items that have an amount of 0\n\n"+ "Examples:\nComponent 100000 noBar\nSteelPlate noHeading noBar hideEmpty\n\n"+"To display multiple different items, use a new line for every item!\n"+ "Full guide: https://steamcommunity.com/sharedfiles/filedetails/?id=1226261795");q.Font=defaultFont;q.FontSize=defaultFontSize;q.TextPadding=defaultPadding;}else{foreach(var À in ð){var º=À.Split(' ' );double w=-1;bool µ=false;bool ª=false;bool Â=false;bool z=false;if(º.Length>=2){try{w=Convert.ToDouble(º[1]);}catch{w=- 1;}}string v=À.ToLower();if(v.Contains("noheading"))µ=true;if(v.Contains("nobar"))ª=true;if(v.Contains("hideempty"))Â= true;if(v.Contains("singleline"))z=true;if(v.StartsWith("echoc")){string u=À.Ŷ("echoc ","").Ŷ("echoc","");É.Append(q.Ň(' ',( q.Ŋ()-q.ū(u))/2)).Append(u+"\n");}else if(v.StartsWith("echor")){string u=À.Ŷ("echor ","").Ŷ("echor","");É.Append(q.Ň(' ' ,q.Ŋ()-q.ū(u))).Append(u+"\n");}else if(v.StartsWith("echo")){É.Append(À.Ŷ("echo ","").Ŷ("echo","")+"\n");}else{É.Append( issameconstructas How to dowload it? issameconstructas r(q,º[0],w,µ,ª,Â,z));}}}return É.Replace("\n","",0,2);}StringBuilder r(IMyTextSurface q,string o,double w,bool µ=false, bool ª=false,bool Â=false,bool z=false){StringBuilder É=new StringBuilder();bool Í=w==-1?true:false;foreach(var Ì in Ȝ){if(Ì .ToString().ToLower().Contains(o.ToLower())){if(É.Length==0&&!µ){string Ë="Items containing '"+char.ToUpper(o[0])+o. Substring(1).ToLower()+"'";É.Append("\n"+q.Ň(' ',(q.Ŋ()-q.ū(Ë))/2)).Append(Ë+"\n\n");}double k=h(Ì);if(k==0&&Â)continue;if(Í)w=ơ( Ì);É.Append(ǖ(q,Ì.SubtypeId.ToString(),k,w,k.Ƃ(),w.Ƃ(),ª,z));}}if(É.Length==0&&!Â){É.Append("Error!\n\n");É.Append( "No items containing '"+o+"' found!\nCheck the custom data of this LCD and enter a valid type or item name!\n");}return É;}void Î(string Ê=""){ ɕ=ɕ>=3?0:ɕ+1;Echo("Isy's Inventory Manager "+ɖ[ɕ]+"\n====================\n");if(Ņ!=null){Echo("Warning!\n"+Ņ+"\n");} StringBuilder É=new StringBuilder();É.Append("Script is running in "+(ǭ?"station":"ship")+" mode\n\n");É.Append("Task: "+Ǧ[ɧ]+Ê+"\n") ;É.Append("Script step: "+ɧ+" / "+(Ǧ.Length-1)+"\n\n");É.Append(ƹ);if(ʍ.Count>0){É.Append( "Excluded grids:\n============\n\n");foreach(var È in ʍ){É.Append(È.CustomName+"\n");}}ɫ=É;Echo(É.ToString());if(ɔ.Count==0){Echo( issameconstructas How to get it? issameconstructas "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 Ç (string Æ,IMyTerminalBlock f,int Å,IMyTerminalBlock Ä,int m,double k=-1,bool A=false){var O=f.GetInventory(Å);var N=Ä. GetInventory(m);if(!O.IsConnectedTo(N)){ƴ("'"+f.CustomName+"'\nis not connected to '"+Ä.CustomName+"'\nItem transfer aborted!"); return 0;}if((float)N.CurrentVolume>(float)N.MaxVolume*0.98f)return 0;var M=new List();O.GetItems(M);if(M. Count==0)return 0;double L=0;MyDefinitionId K=new MyDefinitionId();MyDefinitionId J=new MyDefinitionId();string P="";string I ="";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= 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. SubtypeId.ToString();G=true;if(!O.CanTransferItemTo(N,K)){ƴ("'"+I+"' couldn't be transferred\nfrom '"+f.CustomName+"'\nto '"+Ä. CustomName+"'\nThe conveyor type is too small!");return 0;}double D=(double)M[E].Amount;double C=0;if(F=="completeInventory"){O. TransferItemTo(N,E,null,true);}else if(F=="halfInventory"){double B=Math.Ceiling((double)M[E].Amount/2);O.TransferItemTo(N,E,null,true issameconstructas How to get it? issameconstructas ,(VRage.MyFixedPoint)B);}else{if(!P.Contains(ȃ))k=Math.Ceiling(k);O.TransferItemTo(N,E,null,true,(VRage.MyFixedPoint)k);} 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 (k<=0&&F=="")break;}}if(!G)return 0;if(L>0){string R=Math.Round(L,2)+" "+I+" "+P;ɗ="Moved: "+R+"\nfrom: '"+f.CustomName+ "'\nto: '"+Ä.CustomName+"'";}else{string R=Math.Round(k,2)+" "+Æ.Replace(ȅ,"");if(F=="completeInventory")R="all items";if(F== "halfInventory")R="half of the items";ƴ("Couldn't move '"+R+"'\nfrom '"+f.CustomName+"'\nto '"+Ä.CustomName+ "'\nCheck conveyor connection and owner/faction!");}return L;}double h(MyDefinitionId K,IMyTerminalBlock e,int d=0){return(double)e.GetInventory(d).GetItemAmount(K);;} IMyTerminalBlock Z(MyDefinitionId K,bool Y=false,IMyTerminalBlock f=null){try{if(ʉ.GetInventory(0).FindItem(K)!=null&&ʉ!=f){return ʉ;}} catch{}foreach(var X in ɑ){if(K.SubtypeId.ToString()=="Ice"&&X.GetType().ToString().Contains("MyGasGenerator"))continue;if(X. 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) .FindItem(K)!=null){ʉ=X;return X;}}}return null;}IMyTerminalBlock W(IMyTerminalBlock Q,ListV){ issameconstructas PasteShr issameconstructas IMyTerminalBlock U=null;U=T(Q,V);if(U!=null)return U;U=T(Q,ɢ);if(U==null)ƴ("'"+Q.CustomName+ "'\nhas no empty containers to move its items!");return U;}IMyTerminalBlock T(IMyTerminalBlock Q,ListV){var Ó=Q.GetInventory(0);foreach(var X in V){ if(X==Q)continue;var æ=X.GetInventory(0);if((float)æ.CurrentVolume<(float)æ.MaxVolume*0.95f){if(!X.GetInventory(0). IsConnectedTo(Ó))continue;return X;}}return null;}int å(IMyTerminalBlock e){string ä=System.Text.RegularExpressions.Regex.Match(e. CustomName,@"\[p(\d+|max|min)\]",System.Text.RegularExpressions.RegexOptions.IgnoreCase).Groups[1].Value.ToLower();int ã=0;bool â= true;if(ä=="max"){ã=int.MinValue;}else if(ä=="min"){ã=int.MaxValue;}else{â=Int32.TryParse(ä,out ã);}if(!â){string È=e. IsSameConstructAs(Me)?"":"1";Int32.TryParse(È+e.EntityId.ToString().Substring(0,4),out ã);}return ã;}string á(string Þ){ï();var à=Storage .Split('\n');foreach(var À in à){if(À.Contains(Þ)){return À.Replace(Þ+"=","");}}return"";}void ß(string Þ,string Ý=""){ï( );var à=Storage.Split('\n');string ç="";foreach(var À in à){if(À.Contains(Þ)){ç+=Þ+"="+Ý+"\n";}else{ç+=À+"\n";}}Storage=ç .TrimEnd('\n');}void ï(){var à=Storage.Split('\n');if(à.Length!=Ɍ.Count){string ç="";foreach(var Ì in Ɍ){ç+=Ì.Key+"="+Ì. issameconstructas How to get it? issameconstructas Value+"\n";}Storage=ç.TrimEnd('\n');}}void í(IMyTerminalBlock X){foreach(var ì in Ǯ.Keys.ToList()){Ǯ[ì]="0";}Listî=X. CustomData.Replace(" ","").TrimEnd('\n').Split('\n').ToList();î.RemoveAll(À=>!À.Contains("=")||À.Length<8);bool ë=false;foreach( var À in î){var ê=À.Split('=');if(!Ǯ.ContainsKey(ê[0])){MyDefinitionId K;if(MyDefinitionId.TryParse(ȅ+ê[0],out K)){Ü(K);ë= true;}}Ǯ[ê[0]]=ê[1];}if(ë)Ð();Listé=new List{"Special Container modes:","", "Positive number: stores wanted amount, removes excess (e.g.: 100)","Negative number: doesn't store items, only removes excess (e.g.: -100)", "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(Ƞ);ʅ. AddRange(ș);ʅ.AddRange(ȗ);ʅ.AddRange(Ȗ);ʅ.AddRange(ȕ);ʅ.AddRange(Ȓ);Ǯ.Clear();foreach(var Ì in Ƞ){Ǯ[Ȃ+"/"+Ì]="0";}foreach(var Ì in ț){Ǯ[Ȅ+"/"+Ì]="0";}foreach(var Ì in Ț){Ǯ[ȃ+"/"+Ì]="0";}foreach(var Ì in ș){Ǯ[ȁ+"/"+Ì]="0";}foreach(var Ì in ȗ){Ǯ[ȇ+"/"+ Ì]="0";}foreach(var Ì in Ȗ){Ǯ[Ȑ+"/"+Ì]="0";}foreach(var Ì in ȕ){Ǯ[Ș+"/"+Ì]="0";}foreach(var Ì in Ȕ){Ǯ[ȡ+"/"+Ì]="0";} foreach(var Ì in ȓ){Ǯ[ȟ+"/"+Ì]="0";}foreach(var Ì in Ȓ){Ǯ[Ȟ+"/"+Ì]="0";}}void Ò(){for(int E=ɡ;E<ɏ.Count;E++){if(lj())return;if(ɡ issameconstructas How to dowload it? issameconstructas >=ɏ.Count-1){ɡ=0;}else{ɡ++;}var M=new List();ɏ[E].GetInventory(0).GetItems(M);foreach(var Ì in M){ MyDefinitionId K=Ì.Type;if(Ȝ.Contains(K))continue;ɗ="Found new item!\n"+K.SubtypeId.ToString()+" ("+K.TypeId.ToString().Replace(ȅ,"")+ ")";Ú(K);Ü(K);ƭ(K);}}}bool Ð(){Ö();var Ï=Me.CustomData.Split('\n');GridTerminalSystem.GetBlocksOfType(ɼ);bool Ñ=false; foreach(var À in Ï){var Ø=À.Split(';');if(Ø.Length<2)continue;MyDefinitionId K;if(!MyDefinitionId.TryParse(Ø[0],out K))continue ;if(ɼ.Count==0){Ñ=true;}else{MyDefinitionId Û;if(MyDefinitionId.TryParse(Ø[1],out Û)){if(Ʈ(Û)){Ǚ(K,Û);}else{Ƶ(K);continue ;}}}Ú(K);Ǖ(K);}if(Ñ)return false;return true;}void Ú(MyDefinitionId K){string P=K.TypeId.ToString().Replace(ȅ,"");string I=K.SubtypeId.ToString();if(P==Ȅ){ț.Add(I);Ɲ(I);if(!I.Contains("Ice")){foreach(var Ù in ɿ){if(Ù.GetInventory(0). 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) ;}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); }}void Ü(MyDefinitionId K){Ö();var Ï=Me.CustomData.Split('\n').ToList();foreach(var À in Ï){try{if(À.Substring(0,À. issameconstructas How to use it? issameconstructas IndexOf(";"))==K.ToString())return;}catch{}}for(int E=Ï.Count-1;E>=0;E--){if(Ï[E].Contains(";")){Ï.Insert(E+1,K+";noBP");break; }}Me.CustomData=String.Join("\n",Ï);Ǖ(K);}void Ö(){if(!Me.CustomData.Contains(Ɏ)){Me.CustomData=(ǭ?Ǭ:Dz)+Ɏ;}}void Õ(){if(Ȍ !=null){var M=new List();Ȍ.GetInventory(1).GetItems(M);var Ã=new List();Ȍ.GetQueue(Ã); if(M.Count==0)return;Ȍ.CustomName=ȋ;MyDefinitionId Û=Ã[0].BlueprintId;MyDefinitionId K=M[0].Type;if(M.Count==1&&Ã.Count==1 &&Ȍ.Mode==MyAssemblerMode.Assembly&&Û==Ȋ){if(ȋ.Contains(learnKeyword)&&!ȋ.Contains(learnManyKeyword))Ȍ.CustomName=ȋ. Replace(" "+learnKeyword,"").Replace(learnKeyword+" ","");Ȍ.ClearQueue();Ȋ=new MyDefinitionId();ɗ="Learned new Blueprint!\n'"+Û .ToString().Replace(ȅ,"")+"'\nproduces: '"+K.ToString().Replace(ȅ,"")+"'";Ǖ(K);Ú(K);Ǚ(K,Û);Ü(K);ư(K,Û);Ư(Ȍ);Ȍ=null;return ;}else if(Ã.Count!=1){ƴ("Blueprint learning aborted!\nExactly 1 itemstack in the queue is needed to learn new recipes!"); }}Ȍ=null;Ȋ=new MyDefinitionId();foreach(var ƞ in ɹ){var Ã=new List();ƞ.GetQueue(Ã);if(Ã.Count==1&&ƞ. Mode==MyAssemblerMode.Assembly){if(!Ư(ƞ))return;Ȍ=ƞ;Ȋ=Ã[0].BlueprintId;ȋ=ƞ.CustomName;ƞ.CustomName="Learning "+Ȋ.SubtypeName issameconstructas How to use it? issameconstructas +" in: "+ƞ.CustomName;return;}}}bool Ư(IMyAssembler ƞ){if(ƞ.GetInventory(1).ItemCount!=0){IMyTerminalBlock Ä=W(ƞ,ʒ);if(Ä !=null){Ç("",ƞ,1,Ä,0);return true;}else{ƴ( "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;}} catch{return false;}return false;}void ƭ(MyDefinitionId K){if(ɼ.Count==0)return;if(K.TypeId.ToString()==ȅ+Ȅ||K.TypeId. ToString()==ȅ+ȃ)return;MyDefinitionId Û;bool ƫ=DZ.TryGetValue(K,out Û);if(ƫ)ƫ=Ʈ(Û);if(!ƫ){var ƪ=new List{"BP","", "Component","Magazine","_Blueprint"};bool Ʃ=false;foreach(var ƨ in ƪ){string Ƭ=ȝ+K.SubtypeId.ToString().Replace("Item","")+ƨ; MyDefinitionId.TryParse(Ƭ,out Û);Ʃ=Ʈ(Û);if(Ʃ){Ǚ(K,Û);ư(K,Û);ƫ=true;return;}}}}void ư(MyDefinitionId K,MyDefinitionId Û){Ö();var Ï=Me. CustomData.Split('\n');for(var E=0;E<Ï.Length;E++){if(Ï[E].Substring(0,Ï[E].IndexOf(";"))!=K.ToString())continue;var Ø=Ï[E].Split( ';');Ï[E]=Ø[0]+";"+Û.ToString();Me.CustomData=String.Join("\n",Ï);return;}}void Ƶ(MyDefinitionId K){Ö();var Ï=Me.CustomData .Split('\n').ToList();Ï.RemoveAll(E=>E.Contains(K.ToString()+";"));Me.CustomData=String.Join("\n",Ï);}void ƴ(string ł){ɬ. issameconstructas How to get it? issameconstructas Add(ł);ɪ.Add(ł);Ņ=ɬ.ElementAt(0);}void Ƴ(){Me.CustomData="";foreach(var X in ʕ){ListÏ=X.CustomData.Replace(" ",""). TrimEnd('\n').Split('\n').ToList();Ï.RemoveAll(À=>!À.Contains("=")||À.Contains("=0"));X.CustomData=string.Join("\n",Ï);}Echo( "Stored items deleted!\n");if(ʕ.Count>0)Echo("Also deleted itemlists of "+ʕ.Count+" Special containers!\n");Echo( "Please hit 'Recompile'!\n\nScript stopped!");}void Ʋ(){ȑ.Clear();ListƱ=ɺ.ToList();ListƧ=ɾ.ToList< IMyTerminalBlock>();Ʀ(ɏ,0);Ʀ(Ʊ,1);Ʀ(Ƨ,1);}void Ʀ(Listƙ,int d){for(int E=0;E<ƙ.Count;E++){var M=new List< MyInventoryItem>();ƙ[E].GetInventory(d).GetItems(M);for(int Ɵ=0;Ɵ();ƞ.GetQueue(Ã);if(à .Count>0&&!ƞ.IsProducing){if(ƞ.Mode==MyAssemblerMode.Assembly)ƴ("'"+ƞ.CustomName+ issameconstructas PasteShr issameconstructas "' has a queue but is currently not assembling!\nAre there enough ingots for the craft?");if(ƞ.Mode==MyAssemblerMode.Disassembly)ƴ("'"+ƞ.CustomName+ "' 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)Ì. Amount;}}}}double Ƥ(MyDefinitionId Û){double Ų;Ȁ.TryGetValue(Û,out Ų);return Ų;}void ƣ(MyDefinitionId K,double k){ǿ[K]=k;} double ƥ(MyDefinitionId Û){int Ų;if(!ǥ.TryGetValue(Û,out Ų))Ų=0;return Ų;}void Ƣ(MyDefinitionId K,int Ý){ǥ[K]=Ý;}double ơ( MyDefinitionId Û){double Ų;if(!ǿ.TryGetValue(Û,out Ų))Ų=100000;return Ų;}MyDefinitionId ƶ(MyDefinitionId K,out bool ƫ){MyDefinitionId Û;ƫ=DZ.TryGetValue(K,out Û);return Û;}MyDefinitionId ǘ(MyDefinitionId Û){MyDefinitionId K;ǰ.TryGetValue(Û,out K);return K; }bool Ǘ(MyDefinitionId Û){return ǰ.ContainsKey(Û);}void Ǚ(MyDefinitionId K,MyDefinitionId Û){DZ[K]=Û;ǰ[Û]=K;}void Ǖ( MyDefinitionId K){Ȝ.Add(K);ǯ[K.SubtypeId.ToString()]=K;}MyDefinitionId ǔ(string I){MyDefinitionId K=new MyDefinitionId();ǯ.TryGetValue (I,out K);return K;}StringBuilder ǖ(IMyTextSurface q,string Ë,double Ý,double ǣ,string Ǣ=null,string ǡ=null,bool ª=false, bool Ǡ=false){string þ=Ý.ToString();string ĥ=ǣ.ToString();if(Ǣ!=null){þ=Ǣ;}if(ǡ!=null){ĥ=ǡ;}float Ů=q.FontSize;float ő=q.Ŋ() issameconstructas PasteShr issameconstructas ;char ǟ=' ';float Ǟ=q.ş(ǟ);StringBuilder ǝ=new StringBuilder(" "+Ý.ƀ(ǣ));ǝ=q.Ň(ǟ,q.ū("99999.9%")-q.ū(ǝ)).Append(ǝ); StringBuilder ǜ=new StringBuilder(þ+" / "+ĥ);StringBuilder Ǜ=new StringBuilder();StringBuilder ǚ=new StringBuilder();StringBuilder Ǔ; if(ǣ==0){Ǜ.Append(Ë+" ");Ǔ=q.Ň(ǟ,ő-q.ū(Ǜ)-q.ū(þ));Ǜ.Append(Ǔ).Append(þ);return Ǜ.Append("\n");}double ǃ=0;if(ǣ>0)ǃ=Ý/ǣ>=1? 1:Ý/ǣ;if(Ǡ&&!ª){if(Ů<=0.5||(Ů<=1&&ő>512)){Ǜ.Append(Ʒ(q,ő*0.25f,ǃ)+" "+Ë);Ǔ=q.Ň(ǟ,ő*0.75-q.ū(Ǜ)-q.ū(þ+" /"));Ǜ.Append(Ǔ). Append(ǜ);Ǔ=q.Ň(ǟ,ő-q.ū(Ǜ)-q.ū(ǝ));Ǜ.Append(Ǔ);Ǜ.Append(ǝ);}else{Ǜ.Append(Ʒ(q,ő*0.3f,ǃ)+" "+Ë);Ǔ=q.Ň(ǟ,ő-q.ū(Ǜ)-q.ū(ǝ));Ǜ. Append(Ǔ);Ǜ.Append(ǝ);}}else{Ǜ.Append(Ë+" ");if(Ů<=0.6||(Ů<=1&&ő>512)){Ǔ=q.Ň(ǟ,ő*0.5-q.ū(Ǜ)-q.ū(þ+" /"));Ǜ.Append(Ǔ).Append(ǜ) ;Ǔ=q.Ň(ǟ,ő-q.ū(Ǜ)-q.ū(ǝ));Ǜ.Append(Ǔ).Append(ǝ);if(!ª){ǚ=Ʒ(q,ő,ǃ).Append("\n");}}else{Ǔ=q.Ň(ǟ,ő-q.ū(Ǜ)-q.ū(ǜ));Ǜ.Append(Ǔ ).Append(ǜ);if(!ª){ǚ=Ʒ(q,ő-q.ū(ǝ),ǃ);ǚ.Append(ǝ).Append("\n");}}}return Ǜ.Append("\n").Append(ǚ);}StringBuilder Ʒ( IMyTextSurface q,float ů,double ǃ){StringBuilder ǂ,ǁ;char ǀ='[';char DŽ=']';char ƿ='I';char ƽ='.';float Ƽ=q.ş(ǀ);float ƻ=q.ş(DŽ);float ƺ =ů-Ƽ-ƻ;ǂ=q.Ň(ƿ,ƺ*ǃ);ǁ=q.Ň(ƽ,ƺ-q.ū(ǂ));return new StringBuilder().Append(ǀ).Append(ǂ).Append(ǁ).Append(DŽ);}StringBuilder ƹ issameconstructas How to get it? issameconstructas =new StringBuilder("No performance Information available!");DictionaryƸ=new Dictionary();Listƾ=new List(new int[600]);ListDž=new List(new double[600]);double NJ,ǒ,ǐ,Ǐ,ǎ;int Ǎ,nj=0;void Nj(string Ǒ ){nj=nj>=599?0:nj+1;Ǎ=Runtime.CurrentInstructionCount;if(Ǎ>ǒ)ǒ=Ǎ;ƾ[nj]=Ǎ;Ǐ=ƾ.Sum()/ƾ.Count;ƹ.Clear();ƹ.Append( "Instructions: "+Ǎ+" / "+Runtime.MaxInstructionCount+"\n");ƹ.Append("Max. Instructions: "+ǒ+" / "+Runtime.MaxInstructionCount+"\n");ƹ. Append("Avg. Instructions: "+Math.Floor(Ǐ)+" / "+Runtime.MaxInstructionCount+"\n\n");NJ=Runtime.LastRunTimeMs;if(NJ>ǐ&&Ƹ. ContainsKey(Ǒ))ǐ=NJ;Dž[nj]=NJ;ǎ=Dž.Sum()/Dž.Count;ƹ.Append("Last runtime: "+Math.Round(NJ,4)+" ms\n");ƹ.Append("Max. runtime: "+Math.Round (ǐ,4)+" ms\n");ƹ.Append("Avg. runtime: "+Math.Round(ǎ,4)+" ms\n\n");ƹ.Append("Instructions per Method:\n");Ƹ[Ǒ]=Ǎ;foreach (var Ì in Ƹ.OrderByDescending(E=>E.Value)){ƹ.Append("- "+Ì.Key+": "+Ì.Value+"\n");}ƹ.Append("\n");}bool lj(double Ý=10){ return Runtime.CurrentInstructionCount>Ý*1000;}ListLj(string Ɖ,string[]LJ=null){string dž="[IsyLCD]";var Ơ=new List();GridTerminalSystem.GetBlocksOfType(Ơ,ũ=>ũ.IsSameConstructAs(Me)&&(ũ. issameconstructas How to use it? issameconstructas CustomName.Contains(Ɖ)||(ũ.CustomName.Contains(dž)&&ũ.CustomData.Contains(Ɖ))));var œ=Ơ.FindAll(ũ=>ũ.CustomName.Contains(Ɖ)); foreach(var q in œ){q.CustomName=q.CustomName.Replace(Ɖ,"").Replace(" "+Ɖ,"").TrimEnd(' ');bool Ũ=false;if(q is IMyTextSurface) {if(!q.CustomName.Contains(dž))Ũ=true;if(!q.CustomData.Contains(Ɖ))q.CustomData="@0 "+Ɖ+(LJ!=null?"\n"+String.Join("\n",LJ): "");}else if(q is IMyTextSurfaceProvider){if(!q.CustomName.Contains(dž))Ũ=true;int ŧ=(q as IMyTextSurfaceProvider). SurfaceCount;for(int E=0;E<ŧ;E++){if(!q.CustomData.Contains("@"+E)){q.CustomData+=(q.CustomData==""?"":"\n\n")+"@"+E+" "+Ɖ+(LJ!=null? "\n"+String.Join("\n",LJ):"");break;}}}else{Ơ.Remove(q);}if(Ũ)q.CustomName+=" "+dž;}return Ơ;} }class Ŧ:IComparer{public int Compare(MyDefinitionId ţ,MyDefinitionId Ţ){return ţ.ToString().CompareTo(Ţ. ToString());}}class Ť:IEqualityComparer{public bool Equals(MyInventoryItem ţ,MyInventoryItem Ţ){return ţ. ToString()==Ţ.ToString();}public int GetHashCode(MyInventoryItem Ì){return Ì.ToString().GetHashCode();}}public static partial class š{private static DictionaryŠ=new Dictionary();public static void ť(string Ū,float Ŭ){foreach( issameconstructas PasteShr issameconstructas char ŭ in Ū){Š[ŭ]=Ŭ;}}public static void ű(){if(Š.Count>0)return;ť( "3FKTabdeghknopqsuy£µÝàáâãäåèéêëðñòóôõöøùúûüýþÿāăąďđēĕėęěĝğġģĥħĶķńņňʼnōŏőśŝşšŢŤŦũūŭůűųŶŷŸșȚЎЗКЛбдекруцяёђћўџ",18);ť("ABDNOQRSÀÁÂÃÄÅÐÑÒÓÔÕÖØĂĄĎĐŃŅŇŌŎŐŔŖŘŚŜŞŠȘЅЊЖф□",22);ť("#0245689CXZ¤¥ÇßĆĈĊČŹŻŽƒЁЌАБВДИЙПРСТУХЬ€",20);ť( "¥$&GHPUVY§ÙÚÛÜÞĀĜĞĠĢĤĦŨŪŬŮŰŲОФЦЪЯжы†‡",21);ť("! !I`ijl ¡¨¯´¸ÌÍÎÏìíîïĨĩĪīĮįİıĵĺļľłˆˇ˘˙˚˛˜˝ІЇії‹›∙",9);ť("?7?Jcz¢¿çćĉċčĴźżžЃЈЧавийнопсъьѓѕќ",17);ť( "():《》,。、;【】(),.1:;[]ft{}·ţťŧț",10);ť("+<=>E^~¬±¶ÈÉÊË×÷ĒĔĖĘĚЄЏЕНЭ−",19);ť("L_vx«»ĹĻĽĿŁГгзлхчҐ–•",16);ť("\"-rª­ºŀŕŗř",11);ť("WÆŒŴ—…‰",32);ť("'|¦ˉ‘’‚",7) ;ť("@©®мшњ",26);ť("mw¼ŵЮщ",28);ť("/ijтэє",15);ť("\\°“”„",13);ť("*²³¹",12);ť("¾æœЉ",29);ť("%IJЫ",25);ť("MМШ",27);ť("½Щ",30); ť("ю",24);ť("ј",8);ť("љ",23);ť("ґ",14);ť("™",31);}public static Vector2 Ű(this IMyTextSurface ĭ,StringBuilder ł){ű(); Vector2 ů=new Vector2();if(ĭ.Font=="Monospace"){float Ů=ĭ.FontSize;ů.X=(float)(ł.Length*19.4*Ů);ů.Y=(float)(28.8*Ů);return ů;} else{float Ů=(float)(ĭ.FontSize*0.779);foreach(char ŭ in ł.ToString()){try{ů.X+=Š[ŭ]*Ů;}catch{}}ů.Y=(float)(28.8*ĭ.FontSize) ;return ů;}}public static float ū(this IMyTextSurface q,StringBuilder ł){Vector2 Ō=q.Ű(ł);return Ō.X;}public static float ū(this IMyTextSurface q,string ł){Vector2 Ō=q.Ű(new StringBuilder(ł));return Ō.X;}public static float ş(this issameconstructas How to get it for free? issameconstructas IMyTextSurface q,char ŏ){float Ŏ=ū(q,new string(ŏ,1));return Ŏ;}public static int ō(this IMyTextSurface q){Vector2 ʼn=q.SurfaceSize; float ň=q.TextureSize.Y;ʼn.Y*=512/ň;float Ő=ʼn.Y*(100-q.TextPadding*2)/100;Vector2 Ō=q.Ű(new StringBuilder("T"));return(int)(Ő/ Ō.Y);}public static float Ŋ(this IMyTextSurface q){Vector2 ʼn=q.SurfaceSize;float ň=q.TextureSize.Y;ʼn.X*=512/ň;return ʼn.X* (100-q.TextPadding*2)/100;}public static StringBuilder Ň(this IMyTextSurface q,char ŋ,double Œ){int ř=(int)(Œ/ş(q,ŋ));if( ř<0)ř=0;return new StringBuilder().Append(ŋ,ř);}private static DateTime Ş=DateTime.Now;private static Dictionary>ŝ=new Dictionary>();public static StringBuilder Ŝ(this IMyTextSurface q,StringBuilder ł,int ś=3,bool ŀ=true,int ĸ=0){int Ś=q.GetHashCode();if(!ŝ.ContainsKey(Ś)){ŝ[Ś]=new List{1,3,ś,0};}int Ř=ŝ[Ś][0];int ŗ=ŝ[Ś][1];int Ŗ=ŝ[Ś][2];int ŕ=ŝ[Ś][3];var Ŕ=ł.ToString().TrimEnd('\n').Split('\n');ListĻ=new List();if(ĸ==0)ĸ=q.ō(); float ő=q.Ŋ();StringBuilder ą,º=new StringBuilder();for(int E=0;E<Ŕ.Length;E++){if(E<ś||E<Ŗ||Ļ.Count-Ŗ>ĸ||q.ū(Ŕ[E])<=ő){Ļ.Add (Ŕ[E]);}else{try{º.Clear();float Ƒ,Ɛ;var Ə=Ŕ[E].Split(' ');string Ǝ=System.Text.RegularExpressions.Regex.Match(Ŕ[E], issameconstructas How to dowload it? issameconstructas @"\d+(\.|\:)\ ").Value;ą=q.Ň(' ',q.ū(Ǝ));foreach(var ƍ in Ə){Ƒ=q.ū(º);Ɛ=q.ū(ƍ);if(Ƒ+Ɛ>ő){Ļ.Add(º.ToString());º=new StringBuilder(ą+ƍ+ " ");}else{º.Append(ƍ+" ");}}Ļ.Add(º.ToString());}catch{Ļ.Add(Ŕ[E]);}}}if(ŀ){if(Ļ.Count>ĸ){if(DateTime.Now.Second!=ŕ){ŕ= DateTime.Now.Second;if(ŗ>0)ŗ--;if(ŗ<=0)Ŗ+=Ř;if(Ŗ+ĸ-ś>=Ļ.Count&&ŗ<=0){Ř=-1;ŗ=3;}if(Ŗ<=ś&&ŗ<=0){Ř=1;ŗ=3;}}}else{Ŗ=ś;Ř=1;ŗ=3;}ŝ[Ś][ 0]=Ř;ŝ[Ś][1]=ŗ;ŝ[Ś][2]=Ŗ;ŝ[Ś][3]=ŕ;}else{Ŗ=ś;}StringBuilder ƌ=new StringBuilder();for(var À=0;À<ś;À++){ƌ.Append(Ļ[À]+"\n" );}for(var À=Ŗ;À<Ļ.Count;À++){ƌ.Append(Ļ[À]+"\n");}return ƌ;}public static DictionaryƊ(this IMyTerminalBlock e,string Ɖ,Dictionaryƈ=null){var Ƈ=new Dictionary();if(e is IMyTextSurface){Ƈ[e as IMyTextSurface]=e.CustomData;}else if(e is IMyTextSurfaceProvider){var Ɔ=System.Text.RegularExpressions.Regex.Matches(e .CustomData,@"@(\d) *("+Ɖ+@")");int Ƌ=(e as IMyTextSurfaceProvider).SurfaceCount;foreach(System.Text.RegularExpressions. Match ƒ in Ɔ){int ƕ=-1;if(int.TryParse(ƒ.Groups[1].Value,out ƕ)){if(ƕ>=Ƌ)continue;string Ï=e.CustomData;int Ƙ=Ï.IndexOf("@"+ƕ );int Ɨ=Ï.IndexOf("@",Ƙ+1)-Ƙ;string ĵ=Ɨ<=0?Ï.Substring(Ƙ):Ï.Substring(Ƙ,Ɨ);Ƈ[(e as IMyTextSurfaceProvider).GetSurface(ƕ)] issameconstructas PasteShr issameconstructas =ĵ;}}}return Ƈ;}public static bool Ɩ(this string ĵ,string Þ){var Ï=ĵ.Replace(" ","").Split('\n');foreach(var À in Ï){if(À .StartsWith(Þ+"=")){try{return Convert.ToBoolean(À.Replace(Þ+"=",""));}catch{return true;}}}return true;}public static string Ɣ(this string ĵ,string Þ){var Ï=ĵ.Replace(" ","").Split('\n');foreach(var À in Ï){if(À.StartsWith(Þ+"=")){return À. Replace(Þ+"=","");}}return"";}}public static partial class š{public static bool Ɠ(this double Ý,double ƅ,double ĥ,bool ż=false, bool Ż=false){bool ź=Ż?Ý>ƅ:Ý>=ƅ;bool Ź=ż?Ý<ĥ:Ý<=ĥ;return ź&&Ź;}}public static partial class š{public static string Ÿ(this char Ž,int ŷ){if(ŷ<=0){return"";}return new string(Ž,ŷ);}}public static partial class š{public static string Ŷ(this string ŵ ,string Ŵ,string ų){string Ų=System.Text.RegularExpressions.Regex.Replace(ŵ,System.Text.RegularExpressions.Regex.Escape(Ŵ ),ų,System.Text.RegularExpressions.RegexOptions.IgnoreCase);return Ų;}}public static partial class š{public static string ž(this float Ý){string Ƅ="kL";if(Ý<1){Ý*=1000;Ƅ="L";}else if(Ý>=1000&&Ý<1000000){Ý/=1000;Ƅ="ML";}else if(Ý>=1000000&&Ý< 1000000000){Ý/=1000000;Ƅ="BL";}else if(Ý>=1000000000){Ý/=1000000000;Ƅ="TL";}return Math.Round(Ý,1)+" "+Ƅ;}public static string ž( issameconstructas How to get it for free? issameconstructas this double Ý){float ƃ=(float)Ý;return ƃ.ž();}}public static partial class š{public static string Ƃ(this double Ý){string Ƅ= "";if(Ý>=1000&&Ý<1000000){Ý/=1000;Ƅ=" k";}else if(Ý>=1000000&&Ý<1000000000){Ý/=1000000;Ƅ=" M";}else if(Ý>=1000000000){Ý/= 1000000000;Ƅ=" B";}return Math.Round(Ý,1)+Ƅ;}}public static partial class š{public static string ƀ(this double ſ,double Ɓ){double Ô=Math.Round(ſ/Ɓ*100,1);if(Ɓ==0){return"0%";}else{return Ô+"%";}}public static string ƀ(this float ſ,float Ɓ){double Ô= Math.Round(ſ/Ɓ*100,1);if(Ɓ==0){return"0%";}else{return Ô+"%";}} issameconstructas