mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-12 08:50:04 -04:00
Piston upgrade. Seems to work. For the most part.
This commit is contained in:
parent
59b6b95a3a
commit
cbb08e3b1c
BIN
assets/items.psd
BIN
assets/items.psd
Binary file not shown.
@ -636,6 +636,9 @@ opencomputers {
|
|||||||
# The amount of energy the chunkloader upgrade draws per tick while
|
# The amount of energy the chunkloader upgrade draws per tick while
|
||||||
# it is enabled, i.e. actually loading a chunk.
|
# it is enabled, i.e. actually loading a chunk.
|
||||||
chunkloaderCost: 0.06
|
chunkloaderCost: 0.06
|
||||||
|
|
||||||
|
# The amount of energy pushing blocks with the piston upgrade costs.
|
||||||
|
pistonPush: 20
|
||||||
}
|
}
|
||||||
|
|
||||||
# Power values for different power systems.
|
# Power values for different power systems.
|
||||||
|
@ -100,7 +100,8 @@ oc:item.UpgradeExperience.name=Erfahrungs-Upgrade
|
|||||||
oc:item.UpgradeGenerator.name=Generator-Upgrade
|
oc:item.UpgradeGenerator.name=Generator-Upgrade
|
||||||
oc:item.UpgradeInventory.name=Inventar-Upgrade
|
oc:item.UpgradeInventory.name=Inventar-Upgrade
|
||||||
oc:item.UpgradeInventoryController.name=Inventarbedienungs-Upgrade
|
oc:item.UpgradeInventoryController.name=Inventarbedienungs-Upgrade
|
||||||
oc:item.UpgradeNavigation.name=Navigationsupgrade
|
oc:item.UpgradeNavigation.name=Navigations-Upgrade
|
||||||
|
oc:item.UpgradePiston.name=Kolben-Upgrade
|
||||||
oc:item.UpgradeSign.name=Schild-I/O-Upgrade
|
oc:item.UpgradeSign.name=Schild-I/O-Upgrade
|
||||||
oc:item.UpgradeSolarGenerator.name=Solargenerator-Upgrade
|
oc:item.UpgradeSolarGenerator.name=Solargenerator-Upgrade
|
||||||
oc:item.UpgradeTractorBeam.name=Traktorstrahl-Upgrade
|
oc:item.UpgradeTractorBeam.name=Traktorstrahl-Upgrade
|
||||||
@ -257,6 +258,7 @@ oc:tooltip.UpgradeGenerator=Kann verwendet werden, um unterwegs Energie aus Bren
|
|||||||
oc:tooltip.UpgradeInventory=Dieses Upgrade gibt Robotern ein internes Inventar. Ohne ein solches Upgrade können Roboter keine Gegenstände verwahren.
|
oc:tooltip.UpgradeInventory=Dieses Upgrade gibt Robotern ein internes Inventar. Ohne ein solches Upgrade können Roboter keine Gegenstände verwahren.
|
||||||
oc:tooltip.UpgradeInventoryController=Dieses Upgrade erlaubt es dem Roboter, präziser mit externen Inventaren zu interagieren, und erlaubt es ihm, das angelegte Werkzeug mit einem Gegenstand in seinem Inventar auszutauschen.
|
oc:tooltip.UpgradeInventoryController=Dieses Upgrade erlaubt es dem Roboter, präziser mit externen Inventaren zu interagieren, und erlaubt es ihm, das angelegte Werkzeug mit einem Gegenstand in seinem Inventar auszutauschen.
|
||||||
oc:tooltip.UpgradeNavigation=Erlaubt es Robotern, ihre Position und Ausrichtung zu bestimmen. Die Position ist relativ zur Mitte der Karte, die in diesem Upgrade verbaut wurde.
|
oc:tooltip.UpgradeNavigation=Erlaubt es Robotern, ihre Position und Ausrichtung zu bestimmen. Die Position ist relativ zur Mitte der Karte, die in diesem Upgrade verbaut wurde.
|
||||||
|
oc:tooltip.UpgradePiston=Dieses Upgrade erlaubt es zu drängeln. Es macht es möglich Blöcke zu verschieben, ähnlich dem Kolben. Es kann jedoch §lkeine§7 Entities bewegen.
|
||||||
oc:tooltip.UpgradeSign=Erlaubt das Lesen und Schreiben von Text auf Schildern.
|
oc:tooltip.UpgradeSign=Erlaubt das Lesen und Schreiben von Text auf Schildern.
|
||||||
oc:tooltip.UpgradeSolarGenerator=Kann verwendet werden, um unterwegs Energie aus Sonnenlicht zu generieren. Benötigt eine ungehinderte Sicht zum Himmel über dem Roboter. Generiert Energie mit %s%% der Geschwindigkeit eines Stirlingmotors.
|
oc:tooltip.UpgradeSolarGenerator=Kann verwendet werden, um unterwegs Energie aus Sonnenlicht zu generieren. Benötigt eine ungehinderte Sicht zum Himmel über dem Roboter. Generiert Energie mit %s%% der Geschwindigkeit eines Stirlingmotors.
|
||||||
oc:tooltip.UpgradeTractorBeam=Stattet den Roboter mit unglaublich fortschrittlicher Technologie - Kosename: "Gegenstandsmagnet" - aus. Erlaubt es dem Roboter, Gegenstände, innerhalb von 3 Blöcken um sich herum, einzusammeln.
|
oc:tooltip.UpgradeTractorBeam=Stattet den Roboter mit unglaublich fortschrittlicher Technologie - Kosename: "Gegenstandsmagnet" - aus. Erlaubt es dem Roboter, Gegenstände, innerhalb von 3 Blöcken um sich herum, einzusammeln.
|
||||||
|
@ -101,6 +101,7 @@ oc:item.UpgradeGenerator.name=Generator Upgrade
|
|||||||
oc:item.UpgradeInventory.name=Inventory Upgrade
|
oc:item.UpgradeInventory.name=Inventory Upgrade
|
||||||
oc:item.UpgradeInventoryController.name=Inventory Controller Upgrade
|
oc:item.UpgradeInventoryController.name=Inventory Controller Upgrade
|
||||||
oc:item.UpgradeNavigation.name=Navigation Upgrade
|
oc:item.UpgradeNavigation.name=Navigation Upgrade
|
||||||
|
oc:item.UpgradePiston.name=Piston Upgrade
|
||||||
oc:item.UpgradeSign.name=Sign I/O Upgrade
|
oc:item.UpgradeSign.name=Sign I/O Upgrade
|
||||||
oc:item.UpgradeSolarGenerator.name=Solar Generator Upgrade
|
oc:item.UpgradeSolarGenerator.name=Solar Generator Upgrade
|
||||||
oc:item.UpgradeTractorBeam.name=Tractor Beam Upgrade
|
oc:item.UpgradeTractorBeam.name=Tractor Beam Upgrade
|
||||||
@ -257,6 +258,7 @@ oc:tooltip.UpgradeGenerator=Can be used to generate energy from fuel on the go.
|
|||||||
oc:tooltip.UpgradeInventory=This upgrade provides inventory space to the robot. Without one of these, robots will not be able to store items internally.
|
oc:tooltip.UpgradeInventory=This upgrade provides inventory space to the robot. Without one of these, robots will not be able to store items internally.
|
||||||
oc:tooltip.UpgradeInventoryController=This upgrade allows the robot more control in how it interacts with external inventories, and allows it to swap its equipped tool with an item in its inventory.
|
oc:tooltip.UpgradeInventoryController=This upgrade allows the robot more control in how it interacts with external inventories, and allows it to swap its equipped tool with an item in its inventory.
|
||||||
oc:tooltip.UpgradeNavigation=Can be used to determine the position and orientation of the robot. The position is relative to the center of the map that was used to craft this upgrade.
|
oc:tooltip.UpgradeNavigation=Can be used to determine the position and orientation of the robot. The position is relative to the center of the map that was used to craft this upgrade.
|
||||||
|
oc:tooltip.UpgradePiston=This upgrade is very pushy. It allows moving blocks, similar to when using a piston. It does §lnot§7 move entities, however.
|
||||||
oc:tooltip.UpgradeSign=Allows reading text on and writing text to signs.
|
oc:tooltip.UpgradeSign=Allows reading text on and writing text to signs.
|
||||||
oc:tooltip.UpgradeSolarGenerator=Can be used to generate energy from sunlight on the go. Requires a clear line of sight to the sky above the robot. Generates energy at %s%% of the speed of a Stirling Engine.
|
oc:tooltip.UpgradeSolarGenerator=Can be used to generate energy from sunlight on the go. Requires a clear line of sight to the sky above the robot. Generates energy at %s%% of the speed of a Stirling Engine.
|
||||||
oc:tooltip.UpgradeTractorBeam=Equips the robot with extremely advanced technology, nicknamed the "Item Magnet". Allows it to pick up items anywhere within 3 blocks of its location.
|
oc:tooltip.UpgradeTractorBeam=Equips the robot with extremely advanced technology, nicknamed the "Item Magnet". Allows it to pick up items anywhere within 3 blocks of its location.
|
||||||
|
@ -176,6 +176,11 @@ navigationUpgrade {
|
|||||||
["oc:circuitChip2", {item=map, subID=any}, "oc:circuitChip2"]
|
["oc:circuitChip2", {item=map, subID=any}, "oc:circuitChip2"]
|
||||||
[ingotGold, potion, ingotGold]]
|
[ingotGold, potion, ingotGold]]
|
||||||
}
|
}
|
||||||
|
pistonUpgrade {
|
||||||
|
input: [[ingotIron, craftingPiston, ingotIron]
|
||||||
|
[stickWood, "oc:circuitChip1", stickWood]
|
||||||
|
[ingotIron, "oc:materialCircuitBoardPrinted", ingotIron]]
|
||||||
|
}
|
||||||
signUpgrade {
|
signUpgrade {
|
||||||
input: [[ingotIron, dyeBlack, ingotIron]
|
input: [[ingotIron, dyeBlack, ingotIron]
|
||||||
["oc:circuitChip1", stickWood, "oc:circuitChip1"]
|
["oc:circuitChip1", stickWood, "oc:circuitChip1"]
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 437 B |
@ -260,5 +260,8 @@ object Items extends ItemAPI {
|
|||||||
|
|
||||||
// 1.3.?
|
// 1.3.?
|
||||||
registerItem(new item.TabletCase(multi), "tabletCase")
|
registerItem(new item.TabletCase(multi), "tabletCase")
|
||||||
|
|
||||||
|
// 1.3.5
|
||||||
|
Recipes.addItem(new item.UpgradePiston(multi), "pistonUpgrade", "oc:pistonUpgrade")
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -171,6 +171,7 @@ class Settings(config: Config) {
|
|||||||
val robotComplexityCost = config.getDouble("power.cost.robotAssemblyComplexity") max 0
|
val robotComplexityCost = config.getDouble("power.cost.robotAssemblyComplexity") max 0
|
||||||
val disassemblerItemCost = config.getDouble("power.cost.disassemblerPerItem") max 0
|
val disassemblerItemCost = config.getDouble("power.cost.disassemblerPerItem") max 0
|
||||||
val chunkloaderCost = config.getDouble("power.cost.chunkloaderCost") max 0
|
val chunkloaderCost = config.getDouble("power.cost.chunkloaderCost") max 0
|
||||||
|
val pistonCost = config.getDouble("power.cost.pistonPush") max 0
|
||||||
|
|
||||||
// power.value
|
// power.value
|
||||||
private val valueBuildCraft = config.getDouble("power.value.BuildCraft")
|
private val valueBuildCraft = config.getDouble("power.value.BuildCraft")
|
||||||
|
@ -95,6 +95,7 @@ class Proxy {
|
|||||||
api.Driver.add(driver.item.UpgradeInventory)
|
api.Driver.add(driver.item.UpgradeInventory)
|
||||||
api.Driver.add(driver.item.UpgradeInventoryController)
|
api.Driver.add(driver.item.UpgradeInventoryController)
|
||||||
api.Driver.add(driver.item.UpgradeNavigation)
|
api.Driver.add(driver.item.UpgradeNavigation)
|
||||||
|
api.Driver.add(driver.item.UpgradePiston)
|
||||||
api.Driver.add(driver.item.UpgradeSign)
|
api.Driver.add(driver.item.UpgradeSign)
|
||||||
api.Driver.add(driver.item.UpgradeSolarGenerator)
|
api.Driver.add(driver.item.UpgradeSolarGenerator)
|
||||||
api.Driver.add(driver.item.UpgradeTractorBeam)
|
api.Driver.add(driver.item.UpgradeTractorBeam)
|
||||||
|
3
src/main/scala/li/cil/oc/common/item/UpgradePiston.scala
Normal file
3
src/main/scala/li/cil/oc/common/item/UpgradePiston.scala
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
package li.cil.oc.common.item
|
||||||
|
|
||||||
|
class UpgradePiston(val parent: Delegator) extends Delegate with ItemTier
|
@ -0,0 +1,32 @@
|
|||||||
|
package li.cil.oc.server.component
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.ReflectionHelper
|
||||||
|
import li.cil.oc.Settings
|
||||||
|
import li.cil.oc.api.driver.Container
|
||||||
|
import li.cil.oc.api.network.{Arguments, Callback, Context, Visibility}
|
||||||
|
import li.cil.oc.api.{Network, Rotatable}
|
||||||
|
import li.cil.oc.common.component
|
||||||
|
import net.minecraft.block.{Block, BlockPistonBase}
|
||||||
|
import net.minecraft.world.World
|
||||||
|
|
||||||
|
class UpgradePiston(val container: Rotatable with Container) extends component.ManagedComponent {
|
||||||
|
val node = Network.newNode(this, Visibility.Network).
|
||||||
|
withComponent("piston").
|
||||||
|
withConnector().
|
||||||
|
create()
|
||||||
|
|
||||||
|
private lazy val tryExtend = ReflectionHelper.findMethod(classOf[BlockPistonBase], null, Array("tryExtend", "func_72115_j", "f"), classOf[World], classOf[Int], classOf[Int], classOf[Int], classOf[Int])
|
||||||
|
|
||||||
|
@Callback(doc = """function(side:number):boolean -- Tries to push the block in front of the container of the upgrade.""")
|
||||||
|
def push(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
|
val (x, y, z) = (math.floor(container.xPosition).toInt, math.floor(container.yPosition).toInt, math.floor(container.zPosition).toInt)
|
||||||
|
val (bx, by, bz) = (x + container.facing.offsetX, y + container.facing.offsetY, z + container.facing.offsetZ)
|
||||||
|
if (!container.world.isAirBlock(bx, by, bz) && node.tryChangeBuffer(-Settings.get.pistonCost) && tryExtend.invoke(Block.pistonBase, container.world, x.underlying(), y.underlying(), z.underlying(), container.facing.ordinal.underlying()).asInstanceOf[Boolean]) {
|
||||||
|
container.world.setBlockToAir(bx, by, bz)
|
||||||
|
container.world.playSoundEffect(container.xPosition, container.yPosition, container.zPosition, "tile.piston.out", 0.5f, container.world.rand.nextFloat() * 0.25f + 0.6f)
|
||||||
|
context.pause(0.5)
|
||||||
|
result(true)
|
||||||
|
}
|
||||||
|
else result(false)
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package li.cil.oc.server.component.machine.luac
|
package li.cil.oc.server.component.machine.luac
|
||||||
|
|
||||||
import com.naef.jnlua.LuaState
|
|
||||||
import li.cil.oc.Settings
|
import li.cil.oc.Settings
|
||||||
import li.cil.oc.api.network.Connector
|
import li.cil.oc.api.network.Connector
|
||||||
import li.cil.oc.server.component.machine.NativeLuaArchitecture
|
import li.cil.oc.server.component.machine.NativeLuaArchitecture
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package li.cil.oc.server.driver.item
|
||||||
|
|
||||||
|
import li.cil.oc.api
|
||||||
|
import li.cil.oc.api.Rotatable
|
||||||
|
import li.cil.oc.api.driver.{Container, Slot}
|
||||||
|
import li.cil.oc.server.component
|
||||||
|
import net.minecraft.item.ItemStack
|
||||||
|
|
||||||
|
object UpgradePiston extends Item {
|
||||||
|
override def worksWith(stack: ItemStack) = isOneOf(stack, api.Items.get("pistonUpgrade"))
|
||||||
|
|
||||||
|
override def createEnvironment(stack: ItemStack, container: Container) = container match {
|
||||||
|
case rotatable: Rotatable with Container => new component.UpgradePiston(rotatable)
|
||||||
|
case _ => null
|
||||||
|
}
|
||||||
|
|
||||||
|
override def slot(stack: ItemStack) = Slot.Upgrade
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user