mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 18:55:03 -04:00
Merge branch 'master' of github.com:MightyPirates/OpenComputers into master-MC1.7.10
Conflicts: src/main/scala/li/cil/oc/common/template/TabletTemplate.scala
This commit is contained in:
commit
9863521870
@ -616,6 +616,13 @@ opencomputers {
|
||||
# each point of complexity.
|
||||
robotAssemblyComplexity: 10000
|
||||
|
||||
# The base energy cost for assembling a tablet.
|
||||
tabletAssemblyBase: 20000
|
||||
|
||||
# The additional amount of energy required to assemble a tablet for
|
||||
# each point of complexity.
|
||||
tabletAssemblyComplexity: 5000
|
||||
|
||||
# The amount of energy it takes to extract one ingredient from an
|
||||
# item that is being disassembled. For example, if an item that was
|
||||
# crafted from three other items gets disassembled, a total of 15000
|
||||
|
@ -11,6 +11,11 @@ terminal {
|
||||
["oc:circuitChip3", "oc:screen2", "oc:wlanCard"]
|
||||
[nuggetIron, "oc:keyboard", nuggetIron]]
|
||||
}
|
||||
tabletCase {
|
||||
input: [[ingotGold, button, ingotGold]
|
||||
["oc:componentBus1", "oc:screen2", "oc:circuitChip3"]
|
||||
[ingotGold, "oc:materialCircuitBoardPrinted", ingotGold]]
|
||||
}
|
||||
|
||||
server1 {
|
||||
input: [[obsidian, "oc:ram4", obsidian]
|
||||
|
@ -258,10 +258,8 @@ object Items extends ItemAPI {
|
||||
Recipes.addItem(new item.ComponentBus(multi, Tier.Three), "componentBus3", "oc:componentBus3")
|
||||
registerItem(new item.DebugCard(multi), "debugCard")
|
||||
|
||||
// 1.3.?
|
||||
registerItem(new item.TabletCase(multi), "tabletCase")
|
||||
|
||||
// 1.3.5
|
||||
Recipes.addItem(new item.TabletCase(multi), "tabletCase", "oc:tabletCase")
|
||||
Recipes.addItem(new item.UpgradePiston(multi), "pistonUpgrade", "oc:pistonUpgrade")
|
||||
}
|
||||
}
|
@ -161,6 +161,8 @@ class Settings(config: Config) {
|
||||
val geolyzerScanCost = config.getDouble("power.cost.geolyzerScan") max 0
|
||||
val robotBaseCost = config.getDouble("power.cost.robotAssemblyBase") max 0
|
||||
val robotComplexityCost = config.getDouble("power.cost.robotAssemblyComplexity") max 0
|
||||
val tabletBaseCost = config.getDouble("power.cost.tabletAssemblyBase") max 0
|
||||
val tabletComplexityCost = config.getDouble("power.cost.tabletAssemblyComplexity") max 0
|
||||
val disassemblerItemCost = config.getDouble("power.cost.disassemblerPerItem") max 0
|
||||
val chunkloaderCost = config.getDouble("power.cost.chunkloaderCost") max 0
|
||||
val pistonCost = config.getDouble("power.cost.pistonPush") max 0
|
||||
|
@ -14,6 +14,7 @@ import li.cil.oc.api.{Machine, Rotatable}
|
||||
import li.cil.oc.common.GuiType
|
||||
import li.cil.oc.common.inventory.ComponentInventory
|
||||
import li.cil.oc.server.component
|
||||
import li.cil.oc.util.ExtendedNBT._
|
||||
import li.cil.oc.util.ItemUtils.TabletData
|
||||
import li.cil.oc.util.{ItemUtils, RotationHelper}
|
||||
import li.cil.oc.{OpenComputers, Settings, api}
|
||||
@ -123,8 +124,8 @@ class TabletWrapper(var stack: ItemStack, var holder: EntityPlayer) extends Comp
|
||||
val data = stack.getTagCompound
|
||||
load(data)
|
||||
if (!world.isRemote) {
|
||||
computer.load(data.getCompoundTag(Settings.namespace + "data"))
|
||||
tablet.load(data.getCompoundTag(Settings.namespace + "component"))
|
||||
computer.load(data.getCompoundTag(Settings.namespace + "data"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -138,8 +139,8 @@ class TabletWrapper(var stack: ItemStack, var holder: EntityPlayer) extends Comp
|
||||
if (!data.hasKey(Settings.namespace + "data")) {
|
||||
data.setTag(Settings.namespace + "data", new NBTTagCompound())
|
||||
}
|
||||
computer.save(data.getCompoundTag(Settings.namespace + "data"))
|
||||
tablet.save(data.getCompoundTag(Settings.namespace + "component"))
|
||||
data.setNewCompoundTag(Settings.namespace + "component", tablet.save)
|
||||
data.setNewCompoundTag(Settings.namespace + "data", computer.save)
|
||||
|
||||
// Force tablets into stopped state to avoid errors when trying to
|
||||
// load deleted machine states.
|
||||
@ -232,13 +233,7 @@ class TabletWrapper(var stack: ItemStack, var holder: EntityPlayer) extends Comp
|
||||
case _ => 0
|
||||
}))
|
||||
|
||||
override def maxComponents = items.foldLeft(0)((acc, itemOption) => acc + (itemOption match {
|
||||
case Some(item) => Option(api.Driver.driverFor(item)) match {
|
||||
case Some(driver: api.driver.Processor) => driver.supportedComponents(item)
|
||||
case _ => 0
|
||||
}
|
||||
case _ => 0
|
||||
}))
|
||||
override def maxComponents = 32
|
||||
|
||||
override def markAsChanged() {}
|
||||
|
||||
|
@ -25,7 +25,7 @@ object RobotTemplate extends Template {
|
||||
val data = new ItemUtils.RobotData()
|
||||
data.tier = ItemUtils.caseTier(inventory.getStackInSlot(0))
|
||||
data.name = ItemUtils.RobotData.randomName
|
||||
data.robotEnergy = 50000
|
||||
data.robotEnergy = Settings.get.bufferRobot.toInt
|
||||
data.totalEnergy = data.robotEnergy
|
||||
data.containers = items.slice(1, 4).filter(_ != null).toArray
|
||||
data.components = items.drop(4).filter(_ != null).toArray
|
||||
@ -33,7 +33,7 @@ object RobotTemplate extends Template {
|
||||
data.save(stack)
|
||||
val energy = Settings.get.robotBaseCost + complexity(inventory) * Settings.get.robotComplexityCost
|
||||
|
||||
Array(stack, energy: java.lang.Double)
|
||||
Array(stack, double2Double(energy))
|
||||
}
|
||||
|
||||
def register() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package li.cil.oc.common.template
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms
|
||||
import li.cil.oc.api
|
||||
import li.cil.oc.{Settings, api}
|
||||
import li.cil.oc.common.{Slot, Tier}
|
||||
import li.cil.oc.server.driver.item
|
||||
import li.cil.oc.util.ExtendedNBT._
|
||||
@ -23,22 +23,24 @@ object TabletTemplate extends Template {
|
||||
|
||||
def validateUpgrade(inventory: IInventory, slot: Int, tier: Int, stack: ItemStack): Boolean = Option(api.Driver.driverFor(stack)) match {
|
||||
case Some(driver) if Slot(driver, stack) == Slot.Upgrade =>
|
||||
driver != item.Keyboard && driver != item.Screen &&
|
||||
driver != item.Screen &&
|
||||
Slot(driver, stack) == Slot.Upgrade && driver.tier(stack) <= tier
|
||||
case _ => false
|
||||
}
|
||||
|
||||
def assemble(inventory: IInventory): Array[AnyRef] = {
|
||||
val items = mutable.ArrayBuffer(
|
||||
Option(api.Items.get("screen1").createItemStack(1)),
|
||||
Option(api.Items.get("keyboard").createItemStack(1))
|
||||
Option(api.Items.get("screen1").createItemStack(1))
|
||||
) ++ (1 until inventory.getSizeInventory).map(slot => Option(inventory.getStackInSlot(slot)))
|
||||
val data = new ItemUtils.TabletData()
|
||||
data.items = items.filter(_.isDefined).toArray
|
||||
data.energy = Settings.get.bufferTablet
|
||||
data.maxEnergy = data.energy
|
||||
val stack = api.Items.get("tablet").createItemStack(1)
|
||||
data.save(stack)
|
||||
val energy = Settings.get.tabletBaseCost + complexity(inventory) * Settings.get.tabletComplexityCost
|
||||
|
||||
Array(stack)
|
||||
Array(stack, double2Double(energy))
|
||||
}
|
||||
|
||||
def register() {
|
||||
|
@ -83,6 +83,7 @@ class Disassembler extends traits.Environment with traits.PowerAcceptor with tra
|
||||
else if (api.Items.get(stack) == api.Items.get("server1")) enqueueServer(stack, 0)
|
||||
else if (api.Items.get(stack) == api.Items.get("server2")) enqueueServer(stack, 1)
|
||||
else if (api.Items.get(stack) == api.Items.get("server3")) enqueueServer(stack, 2)
|
||||
else if (api.Items.get(stack) == api.Items.get("tablet")) enqueueTablet(stack)
|
||||
else if (api.Items.get(stack) == api.Items.get("navigationUpgrade")) {
|
||||
enqueueNavigationUpgrade(stack)
|
||||
}
|
||||
@ -115,6 +116,15 @@ class Disassembler extends traits.Environment with traits.PowerAcceptor with tra
|
||||
queue ++= getIngredients(server)
|
||||
}
|
||||
|
||||
private def enqueueTablet(tablet: ItemStack) {
|
||||
val info = new ItemUtils.TabletData(tablet)
|
||||
queue += api.Items.get("tabletCase").createItemStack(1)
|
||||
queue ++= info.items.collect {
|
||||
case Some(stack) => stack
|
||||
}.drop(1) // Screen.
|
||||
node.changeBuffer(info.energy)
|
||||
}
|
||||
|
||||
private def enqueueNavigationUpgrade(stack: ItemStack) {
|
||||
val info = new ItemUtils.NavigationUpgradeData(stack)
|
||||
val parts = getIngredients(stack)
|
||||
@ -224,5 +234,6 @@ class Disassembler extends traits.Environment with traits.PowerAcceptor with tra
|
||||
|
||||
override def isItemValidForSlot(i: Int, stack: ItemStack) =
|
||||
api.Items.get(stack) == api.Items.get("robot") ||
|
||||
((Settings.get.disassembleAllTheThings || api.Items.get(stack) != null) && !getIngredients(stack).isEmpty)
|
||||
api.Items.get(stack) == api.Items.get("tablet") ||
|
||||
((Settings.get.disassembleAllTheThings || api.Items.get(stack) != null) && getIngredients(stack).nonEmpty)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user