Added setting for EEPROM size. Closes #742.

This commit is contained in:
Florian Nücke 2014-12-16 18:41:29 +01:00
parent ea6cc631ef
commit 27e74e2b63
4 changed files with 6 additions and 2 deletions

View File

@ -1,7 +1,7 @@
minecraft.version=1.7.10
forge.version=10.13.2.1236
oc.version=1.4.2
oc.version=1.4.3
oc.subversion=dev
ae2.version=rv1-stable-1

View File

@ -131,6 +131,9 @@ opencomputers {
# happen.
startupDelay: 0.25
# The maximum size of the byte array that can be stored on EEPROMs.
eepromSize: 4096
# The sizes of the six levels of RAM, in kilobytes. This list must
# contain exactly six entries, or it will be ignored. Note that while
# there are six levels of RAM, they still fall into the three tiers of

View File

@ -55,6 +55,7 @@ class Settings(val config: Config) {
val threads = config.getInt("computer.threads") max 1
val timeout = config.getDouble("computer.timeout") max 0
val startupDelay = config.getDouble("computer.startupDelay") max 0.05
val eepromSize = config.getInt("computer.eepromSize") max 0
val ramSizes = Array(config.getIntList("computer.ramSizes"): _*) match {
case Array(tier1, tier2, tier3, tier4, tier5, tier6) =>
Array(tier1: Int, tier2: Int, tier3: Int, tier4: Int, tier5: Int, tier6: Int)

View File

@ -30,7 +30,7 @@ class EEPROM extends prefab.ManagedEnvironment {
return result(Unit, "not enough energy")
}
val newData = args.checkByteArray(0)
if (newData.length > 4 * 1024) throw new IllegalArgumentException("not enough space")
if (newData.length > Settings.get.eepromSize) throw new IllegalArgumentException("not enough space")
data = newData
context.pause(2) // deliberately slow to discourage use as normal storage medium
null