added setting for number of components for the different cpu tiers, closes #113

This commit is contained in:
Florian Nücke 2014-02-04 17:26:47 +01:00
parent b462f1f606
commit 6aa72939b8
4 changed files with 33 additions and 19 deletions

View File

@ -43,6 +43,13 @@ class Settings(config: Config) {
Array(64, 128, 256, 512, 1024)
}
val ramScaleFor64Bit = config.getDouble("computer.ramScaleFor64Bit") max 1
val cpuComponentSupport = Array(config.getIntList("computer.cpuComponentCount"): _*) match {
case Array(tier1, tier2, tier3) =>
Array(tier1: Int, tier2: Int, tier3: Int)
case _ =>
OpenComputers.log.warning("Bad number of CPU component counts, ignoring.")
Array(8, 12, 16)
}
val canComputersBeOwned = config.getBoolean("computer.canComputersBeOwned")
val maxUsers = config.getInt("computer.maxUsers") max 0
val maxUsernameLength = config.getInt("computer.maxUsernameLength") max 0
@ -169,7 +176,6 @@ object Settings {
val scriptPath = "/assets/" + resourceDomain + "/lua/"
val screenResolutionsByTier = Array((50, 16), (80, 25), (160, 50))
val screenDepthsByTier = Array(PackedColor.Depth.OneBit, PackedColor.Depth.FourBit, PackedColor.Depth.EightBit)
val componentCountByTier = Array(8, 12, 16)
// From UniversalElectricity's CompatibilityType class, to avoid having to
// ship the UE API (causes weird issues because the way we build the mod it

View File

@ -15,7 +15,7 @@ class CPU(val parent: Delegator, val tier: Int) extends Delegate {
override def rarity = Array(EnumRarity.common, EnumRarity.uncommon, EnumRarity.rare).apply(tier max 0 min 2)
override def tooltipLines(stack: ItemStack, player: EntityPlayer, tooltip: util.List[String], advanced: Boolean) {
tooltip.addAll(Tooltip.get(baseName, Settings.componentCountByTier(tier)))
tooltip.addAll(Tooltip.get(baseName, Settings.get.cpuComponentSupport(tier)))
super.tooltipLines(stack, player, tooltip, advanced)
}

View File

@ -22,7 +22,7 @@ object Processor extends Item with driver.Processor {
def supportedComponents(stack: ItemStack) =
Items.multi.subItem(stack) match {
case Some(cpu: item.CPU) => Settings.componentCountByTier(cpu.tier)
case Some(cpu: item.CPU) => Settings.get.cpuComponentSupport(cpu.tier)
case _ => 0
}
}

View File

@ -12,10 +12,10 @@ opencomputers {
# List of block IDs the mod uses for different types of blocks. This list
# must contain exactly four entries, or it will be ignored.
block: [
3650
3651
3652
3653
3650
3651
3652
3653
]
}
@ -102,11 +102,11 @@ opencomputers {
# The sizes of the three tiers of RAM, in kilobytes. This list must
# contain exactly three entries, or it will be ignored.
ramSizes: [
64
128
256
512
1024
64
128
256
512
1024
]
# This setting allows you to fine-tune how RAM sizes are scaled internally
@ -125,6 +125,14 @@ opencomputers {
# are really 45KB free, `computer.freeMemory` will return 32KB.
ramScaleFor64Bit: 1.8
# The number of components the different CPU tiers support. This list
# must contain exactly three entries, or it will be ignored.
cpuComponentCount: [
8
12
16
]
# This determines whether computers can only be used by players that are
# registered as users on them. Per default a newly placed computer has no
# users. Whenever there are no users the computer is free for all. Users
@ -549,9 +557,9 @@ opencomputers {
# The sizes of the three tiers of hard drives, in kilobytes. This list
# must contain exactly three entries, or it will be ignored.
hddSizes: [
1024
2048
4096
1024
2048
4096
]
# The size of writable floppy disks, in kilobytes.
@ -596,10 +604,10 @@ opencomputers {
# All entries are regular expression patterns, but they will only be
# applied to the host name (domain) of a given URL.
blacklist: [
"^127\\.0\\.0\\.1$"
"^10\\.\\d+\\.\\d+\\.\\d+$"
"^192\\.\\d+\\.\\d+\\.\\d+$"
"^localhost$"
"^127\\.0\\.0\\.1$"
"^10\\.\\d+\\.\\d+\\.\\d+$"
"^192\\.\\d+\\.\\d+\\.\\d+$"
"^localhost$"
]
# This is a list of whitelisted domain names. Requests may only be made to