Made Electrolytic Separators vent excess gas by default

This commit is contained in:
spookydonut (Ash Wiren) 2014-02-04 13:29:27 +08:00
parent c8002dda5f
commit 6400dfe3bb
2 changed files with 23 additions and 0 deletions

View file

@ -115,6 +115,21 @@ public class GasTank
return true; return true;
} }
/**
* If this GasTank can receive the specified type of gas. Will return TRUE if this tank does not need anymore gas.
* @param gas - gas to check
* @return if this GasTank can accept the defined gas
*/
public boolean canReceiveType(Gas gas)
{
if(stored != null && (gas != null && gas != stored.getGas()))
{
return false;
}
return true;
}
/** /**
* If this GasTank can be drawn of the specified type of gas. Will return false if this tank does not contain any gas. * If this GasTank can be drawn of the specified type of gas. Will return false if this tank does not contain any gas.
* @param gas - gas to check * @param gas - gas to check

View file

@ -63,6 +63,9 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
/** Type type of gas this block is dumping. */ /** Type type of gas this block is dumping. */
public boolean dumpRight = false; public boolean dumpRight = false;
/** Whether to dump excess gas when a tank is full */
public boolean dumpExcess = true; // default to true until gui elements added
public TileEntityElectrolyticSeparator() public TileEntityElectrolyticSeparator()
{ {
super("ElectrolyticSeparator", MachineType.ELECTROLYTIC_SEPARATOR.baseEnergy); super("ElectrolyticSeparator", MachineType.ELECTROLYTIC_SEPARATOR.baseEnergy);
@ -199,6 +202,11 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
public boolean canFill(ChemicalPair gases) public boolean canFill(ChemicalPair gases)
{ {
if(dumpExcess)
{
return (leftTank.canReceiveType(gases.leftGas.getGas()) && rightTank.canReceiveType(gases.rightGas.getGas()))
}
return (leftTank.canReceive(gases.leftGas.getGas()) && leftTank.getNeeded() >= gases.leftGas.amount return (leftTank.canReceive(gases.leftGas.getGas()) && leftTank.getNeeded() >= gases.leftGas.amount
&& rightTank.canReceive(gases.rightGas.getGas()) && rightTank.getNeeded() >= gases.rightGas.amount); && rightTank.canReceive(gases.rightGas.getGas()) && rightTank.getNeeded() >= gases.rightGas.amount);
} }