mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 19:25:20 -04:00
Changed most things noted on in last PR
This commit is contained in:
parent
cce4239a0e
commit
6580ce490c
@ -759,6 +759,23 @@ opencomputers {
|
||||
threads: 4
|
||||
}
|
||||
|
||||
switch {
|
||||
# This is the size of a queue of a not upgraded switch.
|
||||
# Increasing it allows to send more messages in a single burst
|
||||
defaultMaxQueueSize: 20
|
||||
|
||||
# This is the amount of additional queue spaces per half upgrade tier
|
||||
# For tier 1 this is multiplied with 1, for 1.5 its muliplied with 2 and so on
|
||||
queueSizeUpgrade: 5
|
||||
|
||||
# The delay a Switch has by default (in ticks). WARNING: A too
|
||||
# low value can cause lag lag on the server.
|
||||
defaultRelayDelay: 5
|
||||
|
||||
# The amount of ticks the delay is *reduced* by per level
|
||||
relayDelayUpgrade: 1
|
||||
}
|
||||
|
||||
# Other settings that you might find useful to tweak.
|
||||
misc {
|
||||
# The maximum width of multi-block screens, in blocks.
|
||||
|
@ -155,7 +155,7 @@ oc:container.Disassembler=Recycler
|
||||
oc:container.DiskDrive=Diskettenlaufwerk
|
||||
oc:container.Rack=Serverschrank
|
||||
oc:container.Server=Server
|
||||
oc:container.Router=Switch
|
||||
oc:container.Switch=Switch
|
||||
|
||||
# Keybinds
|
||||
key.materialCosts=Materialkosten anzeigen
|
||||
|
@ -154,7 +154,7 @@ oc:container.Case=Computer
|
||||
oc:container.Disassembler=Disassembler
|
||||
oc:container.DiskDrive=Disk Drive
|
||||
oc:container.Rack=Server Rack
|
||||
oc:container.Router=Switch
|
||||
oc:container.Switch=Switch
|
||||
oc:container.Server=Server
|
||||
|
||||
# Keybinds
|
||||
|
@ -197,6 +197,13 @@ class Settings(config: Config) {
|
||||
val maxConnections = config.getInt("internet.maxTcpConnections") max 0
|
||||
val internetThreads = config.getInt("internet.threads") max 1
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
// switch
|
||||
val switchDefaultMaxQueueSize = config.getInt("switch.defaultMaxQueueSize") max 1
|
||||
val switchQueueSizeUpgrade = config.getInt("switch.queueSizeUpgrade") max 0
|
||||
val switchRelayDelayUpgrade = config.getInt("switch.relayDelayUpgrade") max 0
|
||||
val switchDefaultRelayDelay = config.getInt("switch.defaultRelayDelay") max switchRelayDelayUpgrade * 3
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
// misc
|
||||
val maxScreenWidth = config.getInt("misc.maxScreenWidth") max 1
|
||||
|
@ -13,7 +13,7 @@ object GuiType extends Enumeration {
|
||||
Server,
|
||||
Tablet,
|
||||
Terminal,
|
||||
Router
|
||||
Switch
|
||||
|
||||
= Value
|
||||
}
|
||||
|
@ -47,10 +47,10 @@ class Switch(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
override def rightClick(world: World, x: Int, y: Int, z: Int, player: EntityPlayer,
|
||||
side: ForgeDirection, hitX: Float, hitY: Float, hitZ: Float) = {
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
case drive: tileentity.Router =>
|
||||
case switch: tileentity.Router =>
|
||||
if (!player.isSneaking) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(OpenComputers, GuiType.Router.id, world, x, y, z)
|
||||
player.openGui(OpenComputers, GuiType.Switch.id, world, x, y, z)
|
||||
}
|
||||
true
|
||||
}
|
||||
|
@ -163,12 +163,13 @@ class Router extends traits.Hub with traits.NotAnalyzable with IPeripheral with
|
||||
super.onItemAdded(slot, stack)
|
||||
slot match {
|
||||
case 1 =>
|
||||
maxQueueSize = 20 + (Items.multi.subItem(stack) match {
|
||||
case Some(ram: item.Memory) => (ram.tier + 1) * 5
|
||||
case _ => (Driver.driverFor(stack).tier(stack) + 1) * 10
|
||||
maxQueueSize = queueDefaultSize + (Items.multi.subItem(stack) match {
|
||||
case Some(ram: item.Memory) => (ram.tier + 1) * queueUpgradeSize
|
||||
case _ => (Driver.driverFor(stack).tier(stack) + 1) * (queueUpgradeSize * 2)
|
||||
})
|
||||
case 0 =>
|
||||
relayDelay = 5 - Driver.driverFor(stack).tier(stack)
|
||||
relayDelay = relayDefaultDelay -
|
||||
(Driver.driverFor(stack).tier(stack) * relayUpgradeDelay)
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,8 +177,8 @@ class Router extends traits.Hub with traits.NotAnalyzable with IPeripheral with
|
||||
override protected def onItemRemoved(slot: Int, stack: ItemStack) {
|
||||
super.onItemRemoved(slot, stack)
|
||||
slot match {
|
||||
case 0 => relayDelay = 5
|
||||
case 1 => maxQueueSize = 20
|
||||
case 0 => relayDelay = Settings.get.switchDefaultRelayDelay
|
||||
case 1 => maxQueueSize = Settings.get.switchDefaultMaxQueueSize
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,11 +19,16 @@ trait Hub extends traits.Environment with SidedEnvironment {
|
||||
|
||||
protected val queue = mutable.Queue.empty[(ForgeDirection, Packet)]
|
||||
|
||||
protected var maxQueueSize = 20
|
||||
protected val queueDefaultSize = Settings.get.switchDefaultMaxQueueSize
|
||||
protected val queueUpgradeSize = Settings.get.switchQueueSizeUpgrade
|
||||
protected val relayDefaultDelay = Settings.get.switchDefaultRelayDelay
|
||||
protected val relayUpgradeDelay = Settings.get.switchRelayDelayUpgrade
|
||||
|
||||
protected var maxQueueSize = Settings.get.switchDefaultMaxQueueSize
|
||||
|
||||
protected var relayCooldown = -1
|
||||
|
||||
protected var relayDelay = 5
|
||||
protected var relayDelay = Settings.get.switchDefaultRelayDelay
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user