public static bool IsValidGasConnection(MyCubeBlock factoryBlock, IMySlimBlock gasTankBlock, out IMyGasTank gasTank) { gasTank = null; try { if (gasTankBlock.FatBlock == null || gasTankBlock.FatBlock as IMyGasTank == null) { return(false); } gasTank = gasTankBlock.FatBlock as IMyGasTank; if (gasTank.GetInventory() == null || !((IMyInventory)factoryBlock.GetInventory()).IsConnectedTo(gasTank.GetInventory()) || !MyRelationsBetweenPlayerAndBlockExtensions.IsFriendly(factoryBlock.GetUserRelationToOwner(gasTank.OwnerId))) { return(false); } return(true); } catch (Exception e) { Logging.Instance.WriteLine($"IsValidGasConnection exception:\n{e}."); return(false); } }
public override void UpdateAfterSimulation10() { base.UpdateAfterSimulation10(); bool running = shouldUsePower(); if (running) { //check for gas; if has gas, make "internal processable" item which the centrifuge can refine to ore; try to move it there if possible //appears to be impossible to take gas from the tank; what about secret bottle refilling? IMyGasTank tank = thisBlock as IMyGasTank; IMyInventory inv = tank.GetInventory(); List <MyInventoryItem> li = new List <MyInventoryItem>(); inv.GetItems(li, isFullUraniumBottle); } else { } sync(); thisBlock.RefreshCustomInfo(); }