Quick Nav


Back To Top

Description

This script will automatically manage the inventories of cargo containers and production blocks - including refineries (vanilla and many modded ones), assemblers, and oxygen generators - on the ship. It can move ores around, ensuring they only into the most useful refinery; For example, you will no longer have refineries pulling uranium - and costing you yield - when you have dedicated centrifuges for that ore.

It will also automatically empty the output inventories of both processing and assembling machines alike.

This means that there is no longer a need to try and achieve automated item transport with conveyor sorters, which can rarely accomplish this task to the same level, especially without accidentally making it so that half your cargo ports cannot transfer between them, or having an endless loop of items being pushed in a circle.

There are additional capabilities as well; it can be configured to prioritize the refinement of ores you are running low on. It can additionally filter which cargo containers are loaded first when emptying refineries and assemblers, and what items those containers can accept, to allow item-specific sorting. It also has the enabled-by-default option to collect cargo from small containers into large ones. This is useful if you use them like I do, where large containers are the main storage, and small containers are "access ports".

There are also functions for prioritizing ore by type (so that 1000kg of gold ore can be refined before the 2000000kg of iron when you really need some gold right now), for sorting produced items into containers by type, and for dumping excess of certain materials (especially useful on mining ships).

Script Options

The script contains the following configurable variables/functions to adapt the script to your ship configuration or needs:

DISPLAY_TAG

Type: string
Current Default Value:
"CargoManagerDisplay"
Any LCD panel with this in its name is overridden to show status.

EJECTION_GROUP

Type: string
Current Default Value:
"Excess Cargo Ejection"
The group with all collectors/ejectors which are set to eject their contents.

ENABLE_ORE_SORTING

Type: bool
Current Default Value:
true
Whether ore should be sorted automatically between refinery types; useful if you have mods for specialized processing.

MOVE_FROM_SMALL_TO_LARGE

Type: bool
Current Default Value:
true
Whether items should be moved from small to large containers if possible.

SKIP_OFFLINE_REFINERIES

Type: bool
Current Default Value:
true
Whether offline refineries should be ignored for the purposes of ore routing; this allows choosing between either holding onto the ore until a "better" refinery is available or ignoring those refineries and just using the most applicable enabled one.

ENABLE_O2_GENS

Type: bool
Current Default Value:
false
Whether offline O2/H2 generators should be ignored, vs turned on as long as there is work for them.

EJECT_OVERFULL_ITEMS

Type: string[]
Current Default Value:
{"ore/stone", "ingot/stone"}
Which items to eject if they get too full. Empty list for none.

EJECTION_THRESHOLD

Type: float
Current Default Value:
0.9F
To be ejected, the cargo space must be at least this fraction full, and the item must represent at least this fraction of all stored items.

ORE_PRIORITY

Type: string[]
Current Default Value:
{"Iron/50000", "Nickel/10000", "Silicon/5000", "Cobalt/2500", "Silver/1000", "Gold/200"}
Ore types and the ingot threshold at which they are given priority (ie if you have less than this amount of refined metal). If multiple "priority" ores are applicable, the ordering of this list determines priority among them.

SORTING

Type: string[]
Current Default Value:
{""}
Which item types to sort, and where. Empty list for none.

NO_PROCESS

Type: string[]
Current Default Value:
{}
Ores to keep as ore, preventing any processing. Useful if this script is running on a mining ship and needs to cart the ore back to base for specialized processing.

isActualProcessingRefinery(string name)

Return Type: bool
Current Default Code:
return !name.Contains("shieldgenerator"); //Shields ignored by default
Some mods use blocks which are refineries internally, but have no cargo handling nor ore processing. Use this to filter them out.

cargoBoxSortOrder(IMyCargoContainer box1, IMyCargoContainer box2)

Return Type: int
Current Default Code:
return box1.CustomName.CompareTo(box2.CustomName); //Default string comparison on their terminal names, which will end up being based on their autogenned numbers
Standard Java/C# Comparator format, used to determine the sorting order of cargo containers, and thus filling priority.

isItemValidForContainer(string itemCategory, string itemType, string containerName)

Return Type: bool
Current Default Code:
return true;
Whether the given cargo container can accept this item when emptied from other locations. This allows item-type-specific sorting.

isSharedGrid(string name)

Return Type: bool
Current Default Code:
return false;
Whether cargo, refineries, etc on this grid should be counted as part of the main grid.

shutdownWhenDockedTo(string connector, string other, string grid)

Return Type: bool
Current Default Code:
return false;
Whether to pause all execution when the given connector is connected to the given grid by the given other connector, perhaps so its copy of this script can take precedence.

Source Code

The source code for Refinery and Cargo Manager can be found here:GitHub

Downloads

Via Steam Workshop