Add additional constructors to EnergyStorage to set values at load time.
This commit is contained in:
parent
55587fca08
commit
ef94421dc6
1 changed files with 8 additions and 2 deletions
|
@ -15,19 +15,25 @@ public class EnergyStorage implements IEnergyStorage
|
|||
|
||||
public EnergyStorage(int capacity)
|
||||
{
|
||||
this(capacity, capacity, capacity);
|
||||
this(capacity, capacity, capacity, 0);
|
||||
}
|
||||
|
||||
public EnergyStorage(int capacity, int maxTransfer)
|
||||
{
|
||||
this(capacity, maxTransfer, maxTransfer);
|
||||
this(capacity, maxTransfer, maxTransfer, 0);
|
||||
}
|
||||
|
||||
public EnergyStorage(int capacity, int maxReceive, int maxExtract)
|
||||
{
|
||||
this(capacity, maxReceive, maxExtract, 0);
|
||||
}
|
||||
|
||||
public EnergyStorage(int capacity, int maxReceive, int maxExtract, int energy)
|
||||
{
|
||||
this.capacity = capacity;
|
||||
this.maxReceive = maxReceive;
|
||||
this.maxExtract = maxExtract;
|
||||
this.energy = Math.max(0 , Math.min(capacity, energy));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue