mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 09:46:53 -04:00
Fix fully upgraded relays being slower than they should be. Closes #1525.
This commit is contained in:
parent
90087b2448
commit
4b49cc6d2a
@ -951,7 +951,7 @@ opencomputers {
|
|||||||
|
|
||||||
# The amount of ticks the delay is *reduced* by per tier of the CPU
|
# The amount of ticks the delay is *reduced* by per tier of the CPU
|
||||||
# inserted into a switch.
|
# inserted into a switch.
|
||||||
relayDelayUpgrade: 1
|
relayDelayUpgrade: 1.5
|
||||||
|
|
||||||
# This is the size of the queue of a not upgraded switch. Increasing it
|
# This is the size of the queue of a not upgraded switch. Increasing it
|
||||||
# avoids packets being dropped when many messages are sent in a single
|
# avoids packets being dropped when many messages are sent in a single
|
||||||
|
@ -286,7 +286,7 @@ class Settings(val config: Config) {
|
|||||||
val switchDefaultMaxQueueSize = config.getInt("switch.defaultMaxQueueSize") max 1
|
val switchDefaultMaxQueueSize = config.getInt("switch.defaultMaxQueueSize") max 1
|
||||||
val switchQueueSizeUpgrade = config.getInt("switch.queueSizeUpgrade") max 0
|
val switchQueueSizeUpgrade = config.getInt("switch.queueSizeUpgrade") max 0
|
||||||
val switchDefaultRelayDelay = config.getInt("switch.defaultRelayDelay") max 1
|
val switchDefaultRelayDelay = config.getInt("switch.defaultRelayDelay") max 1
|
||||||
val switchRelayDelayUpgrade = config.getInt("switch.relayDelayUpgrade") max 0
|
val switchRelayDelayUpgrade = config.getDouble("switch.relayDelayUpgrade") max 0
|
||||||
val switchDefaultRelayAmount = config.getInt("switch.defaultRelayAmount") max 1
|
val switchDefaultRelayAmount = config.getInt("switch.defaultRelayAmount") max 1
|
||||||
val switchRelayAmountUpgrade = config.getInt("switch.relayAmountUpgrade") max 0
|
val switchRelayAmountUpgrade = config.getInt("switch.relayAmountUpgrade") max 0
|
||||||
|
|
||||||
@ -493,6 +493,10 @@ object Settings {
|
|||||||
"power.value.IndustrialCraft2",
|
"power.value.IndustrialCraft2",
|
||||||
"power.value.Mekanism",
|
"power.value.Mekanism",
|
||||||
"power.value.RedstoneFlux"
|
"power.value.RedstoneFlux"
|
||||||
|
),
|
||||||
|
// Upgrading to version 1.5.20, changed relay delay default.
|
||||||
|
VersionRange.createFromVersionSpec("[0.0, 1.5.20)") -> Array(
|
||||||
|
"switch.relayDelayUpgrade"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ class Relay extends traits.SwitchLike with traits.ComponentInventory with traits
|
|||||||
private def updateLimits(slot: Int, stack: ItemStack) {
|
private def updateLimits(slot: Int, stack: ItemStack) {
|
||||||
Option(Driver.driverFor(stack, getClass)) match {
|
Option(Driver.driverFor(stack, getClass)) match {
|
||||||
case Some(driver) if driver.slot(stack) == Slot.CPU =>
|
case Some(driver) if driver.slot(stack) == Slot.CPU =>
|
||||||
relayDelay = math.max(1, relayBaseDelay - ((driver.tier(stack) + 1) * relayDelayPerUpgrade))
|
relayDelay = math.max(1, relayBaseDelay - ((driver.tier(stack) + 1) * relayDelayPerUpgrade).toInt)
|
||||||
case Some(driver) if driver.slot(stack) == Slot.Memory =>
|
case Some(driver) if driver.slot(stack) == Slot.Memory =>
|
||||||
relayAmount = math.max(1, relayBaseAmount + (Delegator.subItem(stack) match {
|
relayAmount = math.max(1, relayBaseAmount + (Delegator.subItem(stack) match {
|
||||||
case Some(ram: item.Memory) => (ram.tier + 1) * relayAmountPerUpgrade
|
case Some(ram: item.Memory) => (ram.tier + 1) * relayAmountPerUpgrade
|
||||||
|
@ -56,7 +56,7 @@ class ServerRack extends traits.PowerAcceptor with traits.Hub with traits.PowerB
|
|||||||
var lastAccess = Array.fill(4)(0L)
|
var lastAccess = Array.fill(4)(0L)
|
||||||
|
|
||||||
val builtInSwitchTier = Settings.get.serverRackSwitchTier
|
val builtInSwitchTier = Settings.get.serverRackSwitchTier
|
||||||
relayDelay = math.max(1, relayBaseDelay - (builtInSwitchTier + 1) * relayDelayPerUpgrade)
|
relayDelay = math.max(1, relayBaseDelay - ((builtInSwitchTier + 1) * relayDelayPerUpgrade).toInt)
|
||||||
relayAmount = math.max(1, relayBaseAmount + (builtInSwitchTier + 1) * relayAmountPerUpgrade)
|
relayAmount = math.max(1, relayBaseAmount + (builtInSwitchTier + 1) * relayAmountPerUpgrade)
|
||||||
maxQueueSize = math.max(1, queueBaseSize + (builtInSwitchTier + 1) * queueSizePerUpgrade)
|
maxQueueSize = math.max(1, queueBaseSize + (builtInSwitchTier + 1) * queueSizePerUpgrade)
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ class Switch extends traits.SwitchLike with traits.NotAnalyzable with traits.Com
|
|||||||
private def updateLimits(slot: Int, stack: ItemStack) {
|
private def updateLimits(slot: Int, stack: ItemStack) {
|
||||||
Option(Driver.driverFor(stack, getClass)) match {
|
Option(Driver.driverFor(stack, getClass)) match {
|
||||||
case Some(driver) if driver.slot(stack) == Slot.CPU =>
|
case Some(driver) if driver.slot(stack) == Slot.CPU =>
|
||||||
relayDelay = math.max(1, relayBaseDelay - ((driver.tier(stack) + 1) * relayDelayPerUpgrade))
|
relayDelay = math.max(1, relayBaseDelay - ((driver.tier(stack) + 1) * relayDelayPerUpgrade).toInt)
|
||||||
case Some(driver) if driver.slot(stack) == Slot.Memory =>
|
case Some(driver) if driver.slot(stack) == Slot.Memory =>
|
||||||
relayAmount = math.max(1, relayBaseAmount + (Delegator.subItem(stack) match {
|
relayAmount = math.max(1, relayBaseAmount + (Delegator.subItem(stack) match {
|
||||||
case Some(ram: item.Memory) => (ram.tier + 1) * relayAmountPerUpgrade
|
case Some(ram: item.Memory) => (ram.tier + 1) * relayAmountPerUpgrade
|
||||||
|
@ -71,7 +71,7 @@ trait Hub extends traits.Environment with SidedEnvironment {
|
|||||||
relayPacket(sourceSide, packet)
|
relayPacket(sourceSide, packet)
|
||||||
}
|
}
|
||||||
if (queue.nonEmpty) {
|
if (queue.nonEmpty) {
|
||||||
relayCooldown = relayDelay
|
relayCooldown = relayDelay - 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (world.getTotalWorldTime % relayDelay == 0) {
|
else if (world.getTotalWorldTime % relayDelay == 0) {
|
||||||
@ -84,7 +84,7 @@ trait Hub extends traits.Environment with SidedEnvironment {
|
|||||||
if (packet.ttl > 0 && queue.size < maxQueueSize) {
|
if (packet.ttl > 0 && queue.size < maxQueueSize) {
|
||||||
queue += sourceSide -> packet.hop()
|
queue += sourceSide -> packet.hop()
|
||||||
if (relayCooldown < 0) {
|
if (relayCooldown < 0) {
|
||||||
relayCooldown = relayDelay
|
relayCooldown = relayDelay - 1
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user