Merge branch 'master' of github.com:MightyPirates/OpenComputers into MC1.7

Conflicts:
	src/main/scala/li/cil/oc/Settings.scala
	src/main/scala/li/cil/oc/util/ItemCosts.scala
This commit is contained in:
Florian Nücke 2014-04-07 17:31:52 +02:00
commit 7208cf508b
31 changed files with 213 additions and 89 deletions

View File

@ -9,6 +9,7 @@ oc:tile.Capacitor.name=Kondensator
oc:tile.Case0.name=Computergehäuse (Stufe 1)
oc:tile.Case1.name=Computergehäuse (Stufe 2)
oc:tile.Case2.name=Computergehäuse (Stufe 3)
oc:tile.Case3.name=Computergehäuse (Creative)
oc:tile.Charger.name=Ladestation
oc:tile.DiskDrive.name=Diskettenlaufwerk
oc:tile.Keyboard.name=Tastatur
@ -51,10 +52,11 @@ oc:item.InternetCard.name=Internetkarte
oc:item.Interweb.name=Interweb
oc:item.IronNugget.name=Eisennugget
oc:item.Memory0.name=Speicher (Stufe 1)
oc:item.Memory1.name=Speicher (Stufe 2)
oc:item.Memory2.name=Speicher (Stufe 2.5)
oc:item.Memory3.name=Speicher (Stufe 3)
oc:item.Memory4.name=Speicher (Stufe 3.5)
oc:item.Memory1.name=Speicher (Stufe 1.5)
oc:item.Memory2.name=Speicher (Stufe 2)
oc:item.Memory3.name=Speicher (Stufe 2.5)
oc:item.Memory4.name=Speicher (Stufe 3)
oc:item.Memory5.name=Speicher (Stufe 3.5)
oc:item.Microchip0.name=Microchip (Stufe 1)
oc:item.Microchip1.name=Microchip (Stufe 2)
oc:item.Microchip2.name=Microchip (Stufe 3)

View File

@ -9,6 +9,7 @@ oc:tile.Capacitor.name=Capacitor
oc:tile.Case0.name=Computer Case (Tier 1)
oc:tile.Case1.name=Computer Case (Tier 2)
oc:tile.Case2.name=Computer Case (Tier 3)
oc:tile.Case3.name=Computer Case (Creative)
oc:tile.Charger.name=Charger
oc:tile.DiskDrive.name=Disk Drive
oc:tile.Keyboard.name=Keyboard
@ -51,10 +52,11 @@ oc:item.InternetCard.name=Internet Card
oc:item.Interweb.name=Interweb
oc:item.IronNugget.name=Iron Nugget
oc:item.Memory0.name=Memory (Tier 1)
oc:item.Memory1.name=Memory (Tier 2)
oc:item.Memory2.name=Memory (Tier 2.5)
oc:item.Memory3.name=Memory (Tier 3)
oc:item.Memory4.name=Memory (Tier 3.5)
oc:item.Memory1.name=Memory (Tier 1.5)
oc:item.Memory2.name=Memory (Tier 2)
oc:item.Memory3.name=Memory (Tier 2.5)
oc:item.Memory4.name=Memory (Tier 3)
oc:item.Memory5.name=Memory (Tier 3.5)
oc:item.Microchip0.name=Microchip (Tier 1)
oc:item.Microchip1.name=Microchip (Tier 2)
oc:item.Microchip2.name=Microchip (Tier 3)

View File

@ -41,10 +41,11 @@ oc:item.HardDiskDrive1.name=Disque dur (Niveau 2)
oc:item.HardDiskDrive2.name=Disque dur (Niveau 3)
oc:item.IronNugget.name=Pépite de fer
oc:item.Memory0.name=Mémoire (Niveau 1)
oc:item.Memory1.name=Mémoire (Niveau 2)
oc:item.Memory2.name=Mémoire (Niveau 2.5)
oc:item.Memory3.name=Mémoire (Niveau 3)
oc:item.Memory4.name=Mémoire (Niveau 3.5)
oc:item.Memory1.name=Mémoire (Niveau 1.5)
oc:item.Memory2.name=Mémoire (Niveau 2)
oc:item.Memory3.name=Mémoire (Niveau 2.5)
oc:item.Memory4.name=Mémoire (Niveau 3)
oc:item.Memory5.name=Mémoire (Niveau 3.5)
oc:item.Microchip0.name=Puce électronique (Niveau 1)
oc:item.Microchip1.name=Puce électronique (Niveau 2)
oc:item.Microchip2.name=Puce électronique (Niveau 3)

View File

@ -51,10 +51,11 @@ oc:item.InternetCard.name=Интернет-плата
oc:item.Interweb.name=Интерсеть
oc:item.IronNugget.name=Железный самородок
oc:item.Memory0.name=ОЗУ (Ур. 1)
oc:item.Memory1.name=ОЗУ (Ур. 2)
oc:item.Memory2.name=ОЗУ (Ур. 2.5)
oc:item.Memory3.name=ОЗУ (Ур. 3)
oc:item.Memory4.name=ОЗУ (Ур. 3.5)
oc:item.Memory1.name=ОЗУ (Ур. 1.5)
oc:item.Memory2.name=ОЗУ (Ур. 2)
oc:item.Memory3.name=ОЗУ (Ур. 2.5)
oc:item.Memory4.name=ОЗУ (Ур. 3)
oc:item.Memory5.name=ОЗУ (Ур. 3.5)
oc:item.Microchip0.name=Микрочип (Ур. 1)
oc:item.Microchip1.name=Микрочип (Ур. 2)
oc:item.Microchip2.name=Микрочип (Ур. 3)

View File

@ -48,10 +48,11 @@ oc:item.HardDiskDrive2.name=硬碟機 (3級)
oc:item.InternetCard.name=上網卡
oc:item.IronNugget.name=鐵粒
oc:item.Memory0.name=記憶卡 (1級)
oc:item.Memory1.name=記憶卡 (2級)
oc:item.Memory2.name=記憶卡 (2.5級)
oc:item.Memory3.name=記憶卡 (3級)
oc:item.Memory4.name=記憶卡 (3.5級)
oc:item.Memory1.name=記憶卡 (1.5級)
oc:item.Memory2.name=記憶卡 (2級)
oc:item.Memory3.name=記憶卡 (2.5級)
oc:item.Memory4.name=記憶卡 (3級)
oc:item.Memory5.name=記憶卡 (3.5級)
oc:item.Microchip0.name=微晶片 (1級)
oc:item.Microchip1.name=微晶片 (2級)
oc:item.Microchip2.name=微晶片 (3級)

View File

@ -23,7 +23,9 @@ end
local result, reason = component.gpu.setResolution(w, h)
if not result then
io.stderr:write(reason)
if reason then -- otherwise we didn't change anything
io.stderr:write(reason)
end
return
end
term.clear()

View File

@ -13,17 +13,17 @@ terminal {
}
server1 {
input: [[obsidian, "oc:craftingRAMTier3", obsidian]
input: [[obsidian, "oc:craftingRAMTier4", obsidian]
["oc:circuitTier1", "oc:circuitTier2", "oc:circuitTier1"]
[obsidian, "oc:craftingCircuitBoardPrinted", obsidian]]
}
server2 {
input: [[obsidian, "oc:craftingRAMTier4", obsidian]
input: [[obsidian, "oc:craftingRAMTier5", obsidian]
["oc:circuitTier2", "oc:circuitTier3", "oc:circuitTier2"]
[obsidian, "oc:craftingCircuitBoardPrinted", obsidian]]
}
server3 {
input: [[obsidian, "oc:craftingRAMTier5", obsidian]
input: [[obsidian, "oc:craftingRAMTier6", obsidian]
["oc:circuitTier3", "oc:circuitTier3", "oc:circuitTier3"]
[obsidian, "oc:craftingCircuitBoardPrinted", obsidian]]
}
@ -33,18 +33,22 @@ ram1 {
["", "oc:craftingCircuitBoardPrinted", ""]]
}
ram2 {
input: [["oc:circuitTier2", "", "oc:circuitTier2"]
input: [["oc:circuitTier1", "oc:circuitTier1", "oc:circuitTier1"]
["", "oc:craftingCircuitBoardPrinted", ""]]
}
ram3 {
input: [["oc:circuitTier2", "oc:circuitTier2", "oc:circuitTier2"]
input: [["oc:circuitTier2", "", "oc:circuitTier2"]
["", "oc:craftingCircuitBoardPrinted", ""]]
}
ram4 {
input: [["oc:circuitTier3", "", "oc:circuitTier3"]
input: [["oc:circuitTier2", "oc:circuitTier2", "oc:circuitTier2"]
["", "oc:craftingCircuitBoardPrinted", ""]]
}
ram5 {
input: [["oc:circuitTier3", "", "oc:circuitTier3"]
["", "oc:craftingCircuitBoardPrinted", ""]]
}
ram6 {
input: [["oc:circuitTier3", "oc:circuitTier3", "oc:circuitTier3"]
["", "oc:craftingCircuitBoardPrinted", ""]]
}
@ -79,11 +83,11 @@ graphicsCard1 {
["", "oc:craftingCard", ""]]
}
graphicsCard2 {
input: [["oc:circuitTier2", "oc:craftingALU", "oc:craftingRAMTier2"]
input: [["oc:circuitTier2", "oc:craftingALU", "oc:craftingRAMTier3"]
["", "oc:craftingCard", ""]]
}
graphicsCard3 {
input: [["oc:circuitTier3", "oc:craftingALU", "oc:craftingRAMTier4"]
input: [["oc:circuitTier3", "oc:craftingALU", "oc:craftingRAMTier5"]
["", "oc:craftingCard", ""]]
}
internetCard {

View File

@ -9,8 +9,18 @@ analyzer {
[screwAluminium, craftingToolScrewdriver, screwAluminium]]
}
server {
input: [["oc:circuitTier3", "oc:craftingRAMTier4", "oc:circuitTier3"]
server1 {
input: [["oc:circuitTier1", "oc:craftingRAMTier4", "oc:circuitTier1"]
["oc:circuitTier1", "oc:craftingCaseTier1", "oc:circuitTier2"]
[craftingToolScrewdriver, "oc:craftingCircuitBoardPrinted", craftingToolWrench]]
}
server2 {
input: [["oc:circuitTier2", "oc:craftingRAMTier5", "oc:circuitTier2"]
["oc:circuitTier3", "oc:craftingCaseTier2", "oc:circuitTier3"]
[craftingToolScrewdriver, "oc:craftingCircuitBoardPrinted", craftingToolWrench]]
}
server3 {
input: [["oc:circuitTier3", "oc:craftingRAMTier6", "oc:circuitTier3"]
["oc:circuitTier3", "oc:craftingCaseTier3", "oc:circuitTier3"]
[craftingToolScrewdriver, "oc:craftingCircuitBoardPrinted", craftingToolWrench]]
}
@ -23,9 +33,9 @@ ram1 {
time: 250
}
ram2 {
input: [["oc:circuitTier2", "oc:circuitTier2", "oc:circuitTier2"]
["oc:craftingRAMTier1", "oc:craftingCircuitBoardPrinted", "oc:craftingRAMTier1"]
[Dataorb, craftingToolWrench, Dataorb]]
input: [["oc:circuitTier1", "oc:circuitTier1", "oc:circuitTier1"]
["", "oc:craftingRAMTier1", ""]
["", craftingToolWrench, ""]]
}
ram3 {
input: [["oc:circuitTier2", "oc:circuitTier2", "oc:circuitTier2"]
@ -33,7 +43,7 @@ ram3 {
[Dataorb, craftingToolWrench, Dataorb]]
}
ram4 {
input: [["oc:circuitTier3", "oc:circuitTier3", "oc:circuitTier3"]
input: [["oc:circuitTier2", "oc:circuitTier2", "oc:circuitTier2"]
["oc:craftingRAMTier3", "oc:craftingCircuitBoardPrinted", "oc:craftingRAMTier3"]
[Dataorb, craftingToolWrench, Dataorb]]
}
@ -42,6 +52,11 @@ ram5 {
["oc:craftingRAMTier4", "oc:craftingCircuitBoardPrinted", "oc:craftingRAMTier4"]
[Dataorb, craftingToolWrench, Dataorb]]
}
ram6 {
input: [["oc:circuitTier3", "oc:circuitTier3", "oc:circuitTier3"]
["oc:craftingRAMTier5", "oc:craftingCircuitBoardPrinted", "oc:craftingRAMTier5"]
[Dataorb, craftingToolWrench, Dataorb]]
}
floppy {
input: [[screwAluminium, lever, screwAluminium]
@ -174,12 +189,12 @@ cpu0 {
}
cpu1 {
input: [["oc:circuitTier2", plateStainlessSteel, "oc:circuitTier2"]
["oc:craftingRAMTier2", "oc:craftingCPUTier1", "oc:craftingRAMTier2"]
["oc:craftingRAMTier3", "oc:craftingCPUTier1", "oc:craftingRAMTier3"]
["oc:circuitTier2", craftingToolScrewdriver, "oc:circuitTier2"]]
}
cpu2 {
input: [["oc:circuitTier3", plateTitanium, "oc:circuitTier3"]
["oc:craftingRAMTier4", "oc:craftingCPUTier2", "oc:craftingRAMTier4"]
["oc:craftingRAMTier5", "oc:craftingCPUTier2", "oc:craftingRAMTier5"]
["oc:circuitTier3", craftingToolScrewdriver, "oc:circuitTier3"]]
}
cu {

View File

@ -15,17 +15,17 @@ terminal {
}
server1 {
input: [["oc:circuitTier1", "oc:craftingRAMTier3", "oc:circuitTier1"]
input: [["oc:circuitTier1", "oc:craftingRAMTier4", "oc:circuitTier1"]
["oc:circuitTier2", "oc:craftingCaseTier1", "oc:circuitTier2"]
["oc:craftingCircuitBoardPrinted", "oc:craftingCircuitBoardPrinted", "oc:craftingCircuitBoardPrinted"]]
}
server2 {
input: [["oc:circuitTier2", "oc:craftingRAMTier4", "oc:circuitTier2"]
input: [["oc:circuitTier2", "oc:craftingRAMTier5", "oc:circuitTier2"]
["oc:circuitTier3", "oc:craftingCaseTier2", "oc:circuitTier3"]
["oc:craftingCircuitBoardPrinted", "oc:craftingCircuitBoardPrinted", "oc:craftingCircuitBoardPrinted"]]
}
server3 {
input: [["oc:circuitTier3", "oc:craftingRAMTier5", "oc:circuitTier3"]
input: [["oc:circuitTier3", "oc:craftingRAMTier6", "oc:circuitTier3"]
["oc:circuitTier3", "oc:craftingCaseTier3", "oc:circuitTier3"]
["oc:craftingCircuitBoardPrinted", "oc:craftingCircuitBoardPrinted", "oc:craftingCircuitBoardPrinted"]]
}
@ -36,20 +36,24 @@ ram1 {
}
ram2 {
input: [["oc:circuitTier2", "oc:circuitTier2", "oc:circuitTier2"]
["oc:craftingRAMTier1", "oc:craftingCircuitBoardPrinted", "oc:craftingRAMTier1"]]
["", "oc:craftingRAMTier1", ""]]
}
ram3 {
input: [["oc:circuitTier2", "oc:circuitTier2", "oc:circuitTier2"]
["oc:craftingRAMTier2", "oc:craftingCircuitBoardPrinted", "oc:craftingRAMTier2"]]
}
ram4 {
input: [["oc:circuitTier3", "oc:circuitTier3", "oc:circuitTier3"]
input: [["oc:circuitTier2", "oc:circuitTier2", "oc:circuitTier2"]
["oc:craftingRAMTier3", "oc:craftingCircuitBoardPrinted", "oc:craftingRAMTier3"]]
}
ram5 {
input: [["oc:circuitTier3", "oc:circuitTier3", "oc:circuitTier3"]
["oc:craftingRAMTier4", "oc:craftingCircuitBoardPrinted", "oc:craftingRAMTier4"]]
}
ram6 {
input: [["oc:circuitTier3", "oc:circuitTier3", "oc:circuitTier3"]
["oc:craftingRAMTier5", "oc:craftingCircuitBoardPrinted", "oc:craftingRAMTier5"]]
}
floppy {
input: [[nuggetIron, lever, nuggetIron]
@ -81,11 +85,11 @@ graphicsCard1 {
["", "oc:craftingCard", ""]]
}
graphicsCard2 {
input: [["oc:circuitTier2", "oc:circuitTier2", "oc:craftingRAMTier2"]
input: [["oc:circuitTier2", "oc:circuitTier2", "oc:craftingRAMTier3"]
["", "oc:craftingGPUTier1", ""]]
}
graphicsCard3 {
input: [["oc:circuitTier3", "oc:circuitTier3", "oc:craftingRAMTier4"]
input: [["oc:circuitTier3", "oc:circuitTier3", "oc:craftingRAMTier5"]
["", "oc:craftingGPUTier2", ""]]
}
internetCard {
@ -193,14 +197,14 @@ cpu0 {
[nuggetIron, "oc:craftingALU", nuggetIron]]
}
cpu1 {
input: [[nuggetGold, "oc:craftingRAMTier2", nuggetGold]
input: [[nuggetGold, "oc:craftingRAMTier3", nuggetGold]
["oc:circuitTier2", "oc:craftingCPUTier1", "oc:circuitTier2"]
[nuggetGold, "oc:craftingRAMTier2", nuggetGold]]
[nuggetGold, "oc:craftingRAMTier3", nuggetGold]]
}
cpu2 {
input: [[diamond, "oc:craftingRAMTier4", diamond]
input: [[diamond, "oc:craftingRAMTier5", diamond]
["oc:circuitTier3", "oc:craftingCPUTier2", "oc:circuitTier3"]
[diamond, "oc:craftingRAMTier4", diamond]]
[diamond, "oc:craftingRAMTier5", diamond]]
}
cu {
input: [[nuggetGold, torchRedstoneActive, nuggetGold]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 308 B

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 B

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 B

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 B

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 B

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

View File

@ -96,12 +96,13 @@ opencomputers {
# run in a low-priority worker thread, this should be barely noticeable.
activeGC: true
# The sizes of the five levels of RAM, in kilobytes. This list must
# contain exactly five entries, or it will be ignored. Note that while
# there are five levels of RAM, they still fall into the three tiers of
# items (level 1 = tier 1, level 2, 3 = tier 2, level 4, 5 = tier 3).
# 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
# items (level 1, 2 = tier 1, level 3, 4 = tier 2, level 5, 6 = tier 3).
ramSizes: [
64
96
128
256
512

View File

@ -17,7 +17,7 @@ object Blocks {
var cable: Cable = _
var capacitor: Capacitor = _
var charger: Charger = _
var case1, case2, case3: Case = _
var case1, case2, case3, case4: Case = _
var diskDrive: DiskDrive = _
var keyboard: Keyboard = _
var keyboardDeprecated: KeyboardDeprecated = _
@ -108,6 +108,9 @@ object Blocks {
hologram = Recipes.addBlockDelegate(new Hologram(blockSpecial), "hologram")
wirelessRouter = Recipes.addBlockDelegate(new WirelessRouter(blockSimple), "wirelessRouter")
// v1.2.6
case4 = new Case.TierCreative(blockSimpleWithRedstone)
// Initialize API.
api.Blocks.AccessPoint = wirelessRouter.createItemStack()
api.Blocks.Adapter = adapter.createItemStack()

View File

@ -21,7 +21,7 @@ object Items {
// ----------------------------------------------------------------------- //
// Memory
var ram1, ram2, ram3, ram4, ram5: item.Memory = _
var ram1, ram2, ram3, ram4, ram5, ram6: item.Memory = _
// ----------------------------------------------------------------------- //
// Storage
@ -78,8 +78,8 @@ object Items {
analyzer = Recipes.addItemDelegate(new item.Analyzer(multi), "analyzer")
ram1 = Recipes.addItemDelegate(new item.Memory(multi, 0), "ram1")
ram2 = Recipes.addItemDelegate(new item.Memory(multi, 1), "ram2")
ram3 = Recipes.addItemDelegate(new item.Memory(multi, 2), "ram3")
ram4 = Recipes.addItemDelegate(new item.Memory(multi, 3), "ram4")
floppyDisk = Recipes.addItemDelegate(new item.FloppyDisk(multi), "floppy")
hdd1 = Recipes.addItemDelegate(new item.HardDiskDrive(multi, 0), "hdd1")
@ -129,8 +129,8 @@ object Items {
Recipes.addItemDelegate(abstractBus, "abstractBusCard")
}
ram4 = Recipes.addItemDelegate(new item.Memory(multi, 3), "ram4")
ram5 = Recipes.addItemDelegate(new item.Memory(multi, 4), "ram5")
ram6 = Recipes.addItemDelegate(new item.Memory(multi, 5), "ram6")
// v1.2.0
server3 = Recipes.addItemDelegate(new item.Server(multi, 2), "server3")
@ -149,6 +149,7 @@ object Items {
// v1.2.6
interweb = Recipes.addItemDelegate(new item.Interweb(multi), "interweb")
upgradeAngel = Recipes.addItemDelegate(new item.UpgradeAngel(multi), "angelUpgrade")
ram2 = Recipes.addItemDelegate(new item.Memory(multi, 1), "ram2")
// Initialize API.
api.Items.AbstractBusCard = abstractBus.createItemStack()
@ -210,6 +211,7 @@ object Items {
register("oc:craftingRAMTier3", ram3.createItemStack())
register("oc:craftingRAMTier4", ram4.createItemStack())
register("oc:craftingRAMTier5", ram5.createItemStack())
register("oc:craftingRAMTier6", ram6.createItemStack())
register("oc:craftingHDDTier1", hdd1.createItemStack())
register("oc:craftingHDDTier2", hdd2.createItemStack())

View File

@ -1,7 +1,6 @@
package li.cil.oc
import com.typesafe.config.{ConfigRenderOptions, Config, ConfigFactory}
import cpw.mods.fml.common.ModAPIManager
import java.io._
import java.util.logging.Level
import li.cil.oc.util.PackedColor
@ -34,11 +33,14 @@ class Settings(config: Config) {
case Array(tier1, tier2, tier3) =>
// For compatibility with older config files.
Array(tier1: Int, tier2: Int, tier3: Int, tier3 * 2: Int, tier3 * 4: Int)
case Array(tier1, tier2, tier3, tier4, tier5) =>
Array(tier1: Int, tier2: Int, tier3: Int, tier4: Int, tier5: Int)
case Array(tier1, tier3, tier4, tier5, tier6) =>
// For compatibility with older config files.
Array(tier1: Int, (tier1: Int) * 3 / 2, tier3: Int, tier4: Int, tier5: Int, tier6: Int)
case Array(tier1, tier2, tier3, tier4, tier5, tier6) =>
Array(tier1: Int, tier2: Int, tier3: Int, tier4: Int, tier5: Int, tier6: Int)
case _ =>
OpenComputers.log.warning("Bad number of RAM sizes, ignoring.")
Array(64, 128, 256, 512, 1024)
Array(64, 96, 128, 256, 512, 1024)
}
val ramScaleFor64Bit = config.getDouble("computer.ramScaleFor64Bit") max 1
val cpuComponentSupport = Array(config.getIntList("computer.cpuComponentCount"): _*) match {

View File

@ -22,7 +22,7 @@ abstract class Case(val parent: SimpleDelegator) extends RedstoneAware with Simp
def tier: Int
override def rarity = Array(EnumRarity.common, EnumRarity.uncommon, EnumRarity.rare).apply(tier)
override def rarity = Array(EnumRarity.common, EnumRarity.uncommon, EnumRarity.rare, EnumRarity.epic).apply(tier)
@SideOnly(Side.CLIENT)
override def color = Color.byTier(tier)
@ -31,7 +31,8 @@ abstract class Case(val parent: SimpleDelegator) extends RedstoneAware with Simp
val slots = tier match {
case 0 => "2/1/1"
case 1 => "2/2/2"
case 2 => "3/2/3"
case 2 | 3 => "3/2/3"
case _ => "0/0/0"
}
tooltip.addAll(Tooltip.get("Case", slots))
}
@ -119,4 +120,8 @@ object Case {
def tier = 2
}
class TierCreative(parent: SimpleDelegator) extends Case(parent) {
def tier = 3
}
}

View File

@ -71,7 +71,7 @@ class Buffer(val owner: Buffer.Owner) extends api.network.Environment {
def resolution_=(value: (Int, Int)) = {
val (w, h) = value
val (mw, mh) = maxResolution
if (w < 1 || w > mw || h < 1 || h > mh)
if (w < 1 || h < 1 || w > mw || h > mw || h * w > mw * mh)
throw new IllegalArgumentException("unsupported resolution")
if (buffer.size = value) {
if (node != null) {

View File

@ -5,7 +5,7 @@ import li.cil.oc.common.tileentity
import net.minecraft.entity.player.{EntityPlayer, InventoryPlayer}
class Case(playerInventory: InventoryPlayer, computer: tileentity.Case) extends Player(playerInventory, computer) {
for (i <- 0 to (if (computer.tier == 2) 2 else 1)) {
for (i <- 0 to (if (computer.tier >= 2) 2 else 1)) {
addSlotToContainer(98, 16 + i * slotSize, api.driver.Slot.Card, computer.maxComponentTierForSlot(getInventory.size))
}
@ -17,11 +17,11 @@ class Case(playerInventory: InventoryPlayer, computer: tileentity.Case) extends
addSlotToContainer(142, 16 + i * slotSize, api.driver.Slot.HardDiskDrive, computer.maxComponentTierForSlot(getInventory.size))
}
if (computer.tier == 2) {
if (computer.tier >= 2) {
addSlotToContainer(142, 16 + 2 * slotSize, api.driver.Slot.Disk)
}
addSlotToContainer(120, 16, api.driver.Slot.Processor, computer.tier)
addSlotToContainer(120, 16, api.driver.Slot.Processor, computer.maxComponentTierForSlot(getInventory.size))
if (computer.tier == 0) {
addSlotToContainer(120, 16 + 2 * slotSize, api.driver.Slot.Memory, computer.maxComponentTierForSlot(getInventory.size))

View File

@ -14,7 +14,7 @@ class Memory(val parent: Delegator, val tier: Int) extends Delegate {
val kiloBytes = Settings.get.ramSizes(tier)
override def rarity = Array(EnumRarity.common, EnumRarity.uncommon, EnumRarity.uncommon, EnumRarity.rare, EnumRarity.rare).apply(tier max 0 min 4)
override def rarity = Array(EnumRarity.common, EnumRarity.common, EnumRarity.uncommon, EnumRarity.uncommon, EnumRarity.rare, EnumRarity.rare).apply(tier max 0 min Settings.get.ramSizes.length)
override def displayName(stack: ItemStack) =
Some(parent.internalGetItemStackDisplayName(stack) + " (%dKB)".format(kiloBytes))

View File

@ -52,10 +52,18 @@ class Case(var tier: Int, val isRemote: Boolean) extends traits.PowerAcceptor wi
case _ => false
}
override def updateEntity() {
if (tier == 3 && isServer && world.getWorldTime % Settings.get.tickFrequency == 0) {
// Creative case, make it generate power.
node.asInstanceOf[Connector].changeBuffer(Double.PositiveInfinity)
}
super.updateEntity()
}
// ----------------------------------------------------------------------- //
override def readFromNBT(nbt: NBTTagCompound) {
tier = nbt.getByte(Settings.namespace + "tier") max 0 min 2
tier = nbt.getByte(Settings.namespace + "tier") max 0 min 3
color = Color.byTier(tier)
super.readFromNBT(nbt)
recomputeMaxComponents()
@ -79,6 +87,7 @@ class Case(var tier: Int, val isRemote: Boolean) extends traits.PowerAcceptor wi
case 0 => 6
case 1 => 7
case 2 => 9
case 3 => 9
case _ => 0
}
@ -114,6 +123,16 @@ class Case(var tier: Int, val isRemote: Boolean) extends traits.PowerAcceptor wi
case (7, Some(driver)) => driver.slot(stack) == Slot.Disk
case (8, Some(driver)) => driver.slot(stack) == Slot.Processor && driver.tier(stack) <= maxComponentTierForSlot(slot)
case _ => false // Invalid slot.
}
case 3 => (slot, Registry.itemDriverFor(stack)) match {
case (_, None) => false // Invalid item.
case (0 | 1 | 2, Some(driver)) => driver.slot(stack) == Slot.Card
case (3 | 4, Some(driver)) => driver.slot(stack) == Slot.Memory
case (5 | 6, Some(driver)) => driver.slot(stack) == Slot.HardDiskDrive
case (7, Some(driver)) => driver.slot(stack) == Slot.Disk
case (8, Some(driver)) => driver.slot(stack) == Slot.Processor
case _ => false // Invalid slot.
}
case _ => false
}
@ -139,6 +158,7 @@ class Case(var tier: Int, val isRemote: Boolean) extends traits.PowerAcceptor wi
case 8 => 2
case _ => -1 // Invalid slot.
}
case 3 => 2
case _ => -1
}
}

View File

@ -82,19 +82,13 @@ class Hologram extends traits.Environment with SidedEnvironment with Analyzable
@Callback(direct = true, doc = """function(x:number, z:number):number -- Returns the bit mask representing the specified column.""")
def get(computer: Context, args: Arguments): Array[AnyRef] = this.synchronized {
val x = args.checkInteger(0) - 1
if (x < 0 || x >= width) throw new ArrayIndexOutOfBoundsException()
val z = args.checkInteger(1) - 1
if (z < 0 || z >= width) throw new ArrayIndexOutOfBoundsException()
val (x, z) = checkCoordinates(args)
result(volume(x + z * width))
}
@Callback(direct = true, limit = 256, doc = """function(x:number, z:number, value:number) -- Set the bit mask for the specified column.""")
def set(computer: Context, args: Arguments): Array[AnyRef] = this.synchronized {
val x = args.checkInteger(0) - 1
if (x < 0 || x >= width) throw new ArrayIndexOutOfBoundsException()
val z = args.checkInteger(1) - 1
if (z < 0 || z >= width) throw new ArrayIndexOutOfBoundsException()
val (x, z) = checkCoordinates(args)
val value = args.checkDouble(2).longValue.intValue
volume(x + z * width) = value
setDirty(x, z)
@ -103,10 +97,7 @@ class Hologram extends traits.Environment with SidedEnvironment with Analyzable
@Callback(direct = true, limit = 128, doc = """function(x:number, z:number, height:number) -- Fills a column to the specified height.""")
def fill(computer: Context, args: Arguments): Array[AnyRef] = this.synchronized {
val x = args.checkInteger(0) - 1
if (x < 0 || x >= width) throw new ArrayIndexOutOfBoundsException()
val z = args.checkInteger(1) - 1
if (z < 0 || z >= width) throw new ArrayIndexOutOfBoundsException()
val (x, z) = checkCoordinates(args)
val height = math.min(32, math.max(0, args.checkInteger(2)))
// Bit shifts in the JVM only use the lowest five bits... so we have to
// manually check the height, to avoid the shift being a no-op.
@ -115,6 +106,58 @@ class Hologram extends traits.Environment with SidedEnvironment with Analyzable
null
}
@Callback(doc = """function(x:number, z:number, sx:number, sz:number, tx:number, tz:number) -- Copies an area of columns by the specified translation.""")
def copy(computer: Context, args: Arguments): Array[AnyRef] = this.synchronized {
val (x, z) = checkCoordinates(args)
val w = args.checkInteger(2)
val h = args.checkInteger(3)
val tx = args.checkInteger(4)
val tz = args.checkInteger(5)
// Anything to do at all?
if (w <= 0 || h <= 0) return null
if (tx == 0 && tz == 0) return null
// Loop over the target rectangle, starting from the directions away from
// the source rectangle and copy the data. This way we ensure we don't
// overwrite anything we still need to copy.
val (dx0, dx1) = (math.max(0, math.min(width - 1, x + tx + w - 1)), math.max(0, math.min(width, x + tx))) match {
case dx if tx > 0 => dx
case dx => dx.swap
}
val (dz0, dz1) = (math.max(0, math.min(width - 1, z + tz + h - 1)), math.max(0, math.min(width, z + tz))) match {
case dz if tz > 0 => dz
case dz => dz.swap
}
val (sx, sz) = (if (tx > 0) -1 else 1, if (tz > 0) -1 else 1)
// Copy values to destination rectangle if there source is valid.
for (nz <- dz0 to dz1 by sz) {
nz - tz match {
case oz if oz >= 0 && oz < width =>
for (nx <- dx0 to dx1 by sx) {
nx - tx match {
case ox if ox >= 0 && ox < width =>
volume(nz * width + nx) = volume(oz * width + ox)
case _ => /* Got no source column. */
}
}
case _ => /* Got no source row. */
}
}
// Mark target rectangle dirty.
setDirty(math.min(dx0, dx1), math.min(dz0, dz1))
setDirty(math.max(dx0, dx1), math.max(dz0, dz1))
// The reasoning here is: it'd take 18 ticks to do the whole are with fills,
// so make this slightly more efficient (15 ticks - 0.75 seconds). Make it
// 'free' if it's less than 0.25 seconds, i.e. for small copies.
val area = (math.max(dx0, dx1) - math.min(dx0, dx1)) * (math.max(dz0, dz1) - math.min(dz0, dz1))
val relativeArea = math.max(0, area / (width * width).toFloat - 0.25)
computer.pause(relativeArea)
null
}
@Callback(doc = """function():number -- Returns the render scale of the hologram.""")
def getScale(computer: Context, args: Arguments): Array[AnyRef] = {
result(scale)
@ -127,6 +170,14 @@ class Hologram extends traits.Environment with SidedEnvironment with Analyzable
null
}
private def checkCoordinates(args: Arguments) = {
val x = args.checkInteger(0) - 1
if (x < 0 || x >= width) throw new ArrayIndexOutOfBoundsException()
val z = args.checkInteger(1) - 1
if (z < 0 || z >= width) throw new ArrayIndexOutOfBoundsException()
(x, z)
}
// ----------------------------------------------------------------------- //
override def updateEntity() {

View File

@ -545,7 +545,7 @@ class Robot(val isRemote: Boolean) extends traits.Computer with traits.TextBuffe
// ----------------------------------------------------------------------- //
override def installedMemory = 96 * 1024
override def installedMemory = Settings.get.ramSizes(1) * 1024
override def tier = 0

View File

@ -123,8 +123,11 @@ abstract class GraphicsCard extends ManagedComponent {
val w = args.checkInteger(0)
val h = args.checkInteger(1)
val (mw, mh) = maxResolution
if (w > 0 && h > 0 && w <= mw && h <= mh) screen(s => result(s.resolution = (w, h)))
else throw new IllegalArgumentException("unsupported resolution")
// Even though the buffer itself checks this again, we need this here for
// the minimum of screen and GPU resolution.
if (w < 1 || h < 1 || w > mw || h > mw || h * w > mw * mh)
throw new IllegalArgumentException("unsupported resolution")
screen(s => result(s.resolution = (w, h)))
}
@Callback(direct = true)

View File

@ -13,7 +13,7 @@ object Memory extends Item with driver.Memory {
case _ => 0
}
override def worksWith(stack: ItemStack) = isOneOf(stack, Items.ram1, Items.ram2, Items.ram3, Items.ram4, Items.ram5)
override def worksWith(stack: ItemStack) = isOneOf(stack, Items.ram1, Items.ram2, Items.ram3, Items.ram4, Items.ram5, Items.ram6)
override def createEnvironment(stack: ItemStack, container: MCTileEntity) = null
@ -21,7 +21,7 @@ object Memory extends Item with driver.Memory {
override def tier(stack: ItemStack) =
Items.multi.subItem(stack) match {
case Some(memory: item.Memory) => (memory.tier + 1) / 2
case Some(memory: item.Memory) => memory.tier / 2
case _ => 0
}
}

View File

@ -47,7 +47,7 @@ object Color {
"dyeOrange" -> Orange,
"dyeWhite" -> White)
val byTier = Array(LightGray, Yellow, Cyan)
val byTier = Array(LightGray, Yellow, Cyan, Magenta)
def isDye(stack: ItemStack) = byOreName.contains(OreDictionary.getOreName(OreDictionary.getOreID(stack)))

View File

@ -115,5 +115,10 @@ object ItemCosts {
accumulate(what)
}
def fuzzyEquals(stack1: ItemStack, stack2: ItemStack) = stack1.isItemEqual(stack2) || (stack1.getItem == stack2.getItem && (stack1.getItemDamage == OreDictionary.WILDCARD_VALUE || stack2.getItemDamage == OreDictionary.WILDCARD_VALUE))
// In case you'd like to use this class for your items and your items use
// NBT data in the item stack to differentiate them uncomment the last part.
// We don't use this in OC because the NBT of items can change dynamically,
// for example by components being assigned an address, which will break the
// equals check.
private def fuzzyEquals(stack1: ItemStack, stack2: ItemStack) = stack1.isItemEqual(stack2) || (stack1.getItem == stack2.getItem && (stack1.getItemDamage == OreDictionary.WILDCARD_VALUE || stack2.getItemDamage == OreDictionary.WILDCARD_VALUE)) && ItemStack.areItemStackTagsEqual(stack1, stack2)
}

View File

@ -135,11 +135,11 @@ class TextBuffer(var width: Int, var height: Int, initialDepth: PackedColor.Dept
// Loop over the target rectangle, starting from the directions away from
// the source rectangle and copy the data. This way we ensure we don't
// overwrite anything we still need to copy.
val (dx0, dx1) = (math.max(col + tx + w - 1, math.min(0, width - 1)), math.max(col + tx, math.min(0, width))) match {
val (dx0, dx1) = (math.max(0, math.min(width - 1, col + tx + w - 1)), math.max(0, math.min(width, col + tx))) match {
case dx if tx > 0 => dx
case dx => dx.swap
}
val (dy0, dy1) = (math.max(row + ty + h - 1, math.min(0, height - 1)), math.max(row + ty, math.min(0, height))) match {
val (dy0, dy1) = (math.max(0, math.min(height - 1, row + ty + h - 1)), math.max(0, math.min(height, row + ty))) match {
case dy if ty > 0 => dy
case dy => dy.swap
}