mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 17:56:34 -04:00
Finished Power Advantage integration, looks like it works the way it should! Closes #1248.
This commit is contained in:
parent
7366d8d07a
commit
94fd8d14b1
@ -780,6 +780,7 @@ opencomputers {
|
||||
Galacticraft: 48.0
|
||||
IndustrialCraft2: 400.0
|
||||
Mekanism: 1333.33
|
||||
PowerAdvantage: 31.25
|
||||
RedstoneFlux: 100.0
|
||||
}
|
||||
}
|
||||
|
@ -218,6 +218,7 @@ class Settings(val config: Config) {
|
||||
private val valueGalacticraft = config.getDouble("power.value.Galacticraft")
|
||||
private val valueIndustrialCraft2 = config.getDouble("power.value.IndustrialCraft2")
|
||||
private val valueMekanism = config.getDouble("power.value.Mekanism")
|
||||
private val valuePowerAdvantage = config.getDouble("power.value.PowerAdvantage")
|
||||
private val valueRedstoneFlux = config.getDouble("power.value.RedstoneFlux")
|
||||
|
||||
private val valueInternal = 1000
|
||||
@ -227,6 +228,7 @@ class Settings(val config: Config) {
|
||||
val ratioGalacticraft = valueGalacticraft / valueInternal
|
||||
val ratioIndustrialCraft2 = valueIndustrialCraft2 / valueInternal
|
||||
val ratioMekanism = valueMekanism / valueInternal
|
||||
val ratioPowerAdvantage = valuePowerAdvantage / valueInternal
|
||||
val ratioRedstoneFlux = valueRedstoneFlux / valueInternal
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
@ -24,23 +24,23 @@ object LightWeightPowerAcceptor extends ILightWeightPowerAcceptor {
|
||||
|
||||
def getEnergyDemand(tileEntity: TileEntity, powerType: ConduitType) = tileEntity match {
|
||||
case acceptor: PowerAcceptor if canAcceptEnergyType(powerType) =>
|
||||
EnumFacing.values().map(side => {
|
||||
val capacity = (acceptor.globalBufferSize(side) / Settings.get.ratioRedstoneFlux).toInt
|
||||
val stored = (acceptor.globalBuffer(side) / Settings.get.ratioRedstoneFlux).toInt
|
||||
(EnumFacing.values().map(side => {
|
||||
val capacity = acceptor.globalBufferSize(side)
|
||||
val stored = acceptor.globalBuffer(side)
|
||||
capacity - stored
|
||||
}).max
|
||||
}).max / Settings.get.ratioPowerAdvantage).toInt
|
||||
case _ => 0
|
||||
}
|
||||
|
||||
def addEnergy(tileEntity: TileEntity, amountAdded: Float, powerType: ConduitType) = tileEntity match {
|
||||
case acceptor: PowerAcceptor if canAcceptEnergyType(powerType) =>
|
||||
var remainingEnergy = math.min(amountAdded, acceptor.energyThroughput)
|
||||
var remainingEnergy = math.min(amountAdded, acceptor.energyThroughput) * Settings.get.ratioPowerAdvantage
|
||||
// .exists() for early exit.
|
||||
EnumFacing.values().exists(side => {
|
||||
remainingEnergy -= acceptor.tryChangeBuffer(side, remainingEnergy)
|
||||
remainingEnergy <= 0
|
||||
})
|
||||
amountAdded - remainingEnergy.toFloat
|
||||
amountAdded - (remainingEnergy / Settings.get.ratioPowerAdvantage).toFloat
|
||||
case _ => 0
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user