Flywheel config values

This commit is contained in:
DBotThePony 2025-02-14 21:36:25 +07:00
parent 3eec0f4419
commit b8e57fb130
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 27 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
import ru.dbotthepony.mc.otm.capability.FlowDirection import ru.dbotthepony.mc.otm.capability.FlowDirection
import ru.dbotthepony.mc.otm.capability.energy.IMatteryEnergyStorage import ru.dbotthepony.mc.otm.capability.energy.IMatteryEnergyStorage
import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage
import ru.dbotthepony.mc.otm.config.MachinesConfig
import ru.dbotthepony.mc.otm.core.getBlockStateNow import ru.dbotthepony.mc.otm.core.getBlockStateNow
import ru.dbotthepony.mc.otm.core.math.Decimal import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.core.math.plus import ru.dbotthepony.mc.otm.core.math.plus
@ -116,10 +117,10 @@ class FlywheelBatteryBlockEntity(blockPos: BlockPos, blockState: BlockState) : M
val material = FlywheelMaterials[entry.key]!! val material = FlywheelMaterials[entry.key]!!
energy.parent.maxBatteryLevel = material.storage * entry.intValue energy.parent.maxBatteryLevel = material.storage * entry.intValue
cachedChargeEfficiency = material.receiveEfficiency cachedChargeEfficiency = material.receiveEfficiency
energy.extractEnergy(energy.parent.batteryLevel * Decimal("0.000004") * material.momentumLossSpeed, false) energy.extractEnergy(energy.parent.batteryLevel * MachinesConfig.Flywheel.PASSIVE_LOSS * material.momentumLossSpeed, false)
} else { } else {
energy.parent.maxBatteryLevel = Decimal.ZERO energy.parent.maxBatteryLevel = Decimal.ZERO
energy.extractEnergy(energy.parent.batteryLevel * Decimal("0.0004"), false) energy.extractEnergy(energy.parent.batteryLevel * MachinesConfig.Flywheel.ACTIVE_LOSS, false)
} }
} }

View File

@ -312,4 +312,28 @@ object MachinesConfig : AbstractConfig("machines") {
EssenceStorage EssenceStorage
BriefcaseGrill BriefcaseGrill
} }
object Flywheel {
init {
builder.push("flywheel")
}
val PASSIVE_LOSS: Decimal by builder
.comment("Amount of energy lost per tick in % of energy stored")
.defineDecimal("PASSIVE_LOSS", Decimal("0.000001"), Decimal.ZERO)
val ACTIVE_LOSS: Decimal by builder
.comment("Amount of energy lost per tick in % of energy stored if Flywheel configuration is invalid")
.comment("Keep in mind that all stored energy is instantly lost when controller is broken by any means")
.comment("unless using mod which fully preserve blockentity metadata such as Mekanism cardboard box or Carry On")
.defineDecimal("ACTIVE_LOSS", Decimal("0.0004"), Decimal.ZERO)
init {
builder.pop()
}
}
init {
Flywheel
}
} }