private bool CheckTransfer(float testTransfer) { if (testTransfer == 0f) { return(false); } float remainingCapacity = SourceComp.RemainingCapacityByType(BlockDefinition.StoredGasId); float nextCapacity = remainingCapacity + testTransfer; float gasTransferPerUpdate = GasInputPerUpdate - GasOutputPerUpdate; return(nextCapacity + gasTransferPerUpdate * 10 <= 0f || nextCapacity + gasTransferPerUpdate * 10 >= Capacity); }
private bool CheckTransfer(float testTransfer) { if (testTransfer == 0f) { return(false); } float remainingCapacity = SourceComp.RemainingCapacityByType(m_oxygenGasId); float nextCapacity = remainingCapacity + testTransfer; float gasTransferPerUpdate = GasInputPerUpdate - GasOutputPerUpdate; float paddedNextCapacity = nextCapacity + gasTransferPerUpdate * 15; var maxCapacity = paddedNextCapacity + 1; var block = GetOxygenBlock(); if (block.Room != null) { maxCapacity = (float)block.Room.MaxOxygen(CubeGrid.GridSize); } return(paddedNextCapacity <= 0f || paddedNextCapacity >= maxCapacity); }