You can't issue push/pull requests but you can move items from one inventory to another. The following script tries to balance the contents of all the reactors on (and connected to) a ship. It assumes that they are all connected by a conveyer system:
void Main()
{
List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
GridTerminalSystem.GetBlocksOfType<IMyReactor>(blocks);
BalanceInventory(blocks);
}
void BalanceInventory(List<IMyTerminalBlock> list)
{
long maxVolume = 0;
long currentVolume = 0;
// first pass determines target capacity
for (int i = 0; i < list.Count; i++)
{
IMyInventory inventory = list[i].GetInventory(0);
maxVolume += inventory.MaxVolume.RawValue;
currentVolume += inventory.CurrentVolume.RawValue;
}
float target = currentVolume / maxVolume;
// second pass moves items to the right
for (int i = 0; i < list.Count - 1; i++)
{
IMyInventory inventory = list[i].GetInventory(0);
IMyInventory next = list[i + 1].GetInventory(0);
float capacity = inventory.CurrentVolume.RawValue / inventory.MaxVolume.RawValue;
if (capacity > target)
for (var j = 0; j < inventory.GetItems().Count; j++)
inventory.TransferItemTo(next, j, null, true, inventory.GetItems()[j].Amount * (capacity - target));
}
// third pass moves items to the left
for (int i = list.Count - 1; i > 0; i--)
{
IMyInventory inventory = list[i].GetInventory(0);
IMyInventory next = list[i - 1].GetInventory(0);
float capacity = inventory.CurrentVolume.RawValue / inventory.MaxVolume.RawValue;
if (capacity > target)
for (var j = 0; j < inventory.GetItems().Count; j++)
inventory.TransferItemTo(next, j, null, true, inventory.GetItems()[j].Amount * (capacity - target));
}
}