Conflicts:
	src/main/scala/li/cil/oc/server/component/robot/Player.scala
	src/main/scala/li/cil/oc/server/component/robot/Robot.scala
This commit is contained in:
Florian Nücke 2014-02-12 13:26:06 +01:00
commit fde1488578
6 changed files with 44 additions and 27 deletions

View File

@ -103,7 +103,7 @@ oc:gui.ServerRack.Bottom=Снизу
oc:gui.ServerRack.Left=Слева
oc:gui.ServerRack.Right=Справа
oc:gui.ServerRack.Top=Сверху
oc:gui.ServerRack.WirelessRange=Радиус беспроводной сети
oc:gui.ServerRack.WirelessRange=Радиус
oc:gui.Terminal.InvalidKey=Неверный ключ, возможно к серверу уже подключен другой терминал.
oc:gui.Terminal.OutOfRange=Нет сигнала от сервера.
@ -131,7 +131,7 @@ oc:tooltip.CuttingWire=Используется для нарезки глиня
oc:tooltip.Disk=Примитивный носитель, который может быть использован для создания постоянных запоминающих устройств.
oc:tooltip.DiskDrive.CC=§aПоддерживаются§7 дискеты из ComputerCraft.
oc:tooltip.DiskDrive=Позволяет читать и записывать дискеты.
oc:tooltip.GraphicsCard=Передаёт изображение на дисплей.[nl] Максимальное разрешение: §f%sx%s§7.[nl] Максимальная г лубина цвета:§f%s§7.[nl] Операций/тик: §f%s§7.
oc:tooltip.GraphicsCard=Передаёт изображение на дисплей.[nl] Максимальное разрешение: §f%sx%s§7.[nl] Максимальная глубина цвета:§f%s§7.[nl] Операций/тик: §f%s§7.
oc:tooltip.InternetCard=Эта карта позволяет создавать HTTP-запросы и использует реальные TCP сокеты.
oc:tooltip.IronNugget=Самородок, созданный из железа. Может именно поэтому он и назван железным самородком, нет?
oc:tooltip.Keyboard=Может быть прикреплена к дисплеям, позволяя вводить информацию.

View File

@ -5,9 +5,9 @@ SYNOPSIS
wget URL [FILE]
DESCRIPTION
The pastebin program allows downloading programs from pastebin, identified by their paste ID. I can also be used to upload programs to pastebin.
The wget program allows downloading programs from the interwebs, given the URL to download from.
The pastebin program requires an internet card and internet access to be enabled in the mod's configuration.
The wget program requires an internet card and internet access to be enabled in the mod's configuration.
OPTIONS
-f
@ -16,8 +16,8 @@ OPTIONS
only print errors, no status messages
EXAMPLES
pastebin get AbCdEfGh test
Downloads the paste with ID `AbCdEfGh` and writes it to file `test`.
wget http://example.com/data.zip
Downloads the file `data.zip` and saves it as `data.zip`.
pastebin put prog.lua
Uploads the program `prog.lua` to pastebin.
wget http://example.com/data.zip blah.zip
Downloads the file `data.zip` and saves it as `blah.zip`.

View File

@ -491,7 +491,7 @@ class Robot(isRemote: Boolean) extends Computer(isRemote) with ISidedInventory w
// ----------------------------------------------------------------------- //
override def installedMemory = 64 * 1024
override def installedMemory = 96 * 1024
override def tier = 0

View File

@ -4,7 +4,7 @@ import com.mojang.authlib.GameProfile
import cpw.mods.fml.common.eventhandler.Event
import li.cil.oc.common.tileentity
import li.cil.oc.Settings
import li.cil.oc.util.mods.PortalGun
import li.cil.oc.util.mods.{TinkersConstruct, PortalGun}
import net.minecraft.block.{BlockPistonBase, Block}
import net.minecraft.enchantment.EnchantmentHelper
import net.minecraft.entity.item.EntityItem
@ -259,9 +259,17 @@ class Player(val robot: tileentity.Robot) extends EntityPlayer(robot.world, Play
}
val stack = getCurrentEquippedItem
if (TinkersConstruct.isInfiTool(stack)) {
posY -= 1.62
prevPosY = posY
}
if (stack != null && stack.getItem.onBlockStartBreak(stack, x, y, z, this)) {
return 0
}
if (TinkersConstruct.isInfiTool(stack)) {
posY += 1.62
prevPosY = posY
}
world.playAuxSFXAtEntity(this, 2001, x, y, z, Block.getIdFromBlock(block) + (metadata << 12))

View File

@ -201,6 +201,7 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
result(tryDropIntoInventory(inventory,
slot => inventory.isItemValidForSlot(slot, dropped)))
case _ =>
val player = robot.player(facing)
for (entity <- player.entitiesOnSide[EntityMinecartContainer](facing) if entity.isUseableByPlayer(player)) {
if (tryDropIntoInventory(entity, slot => entity.isItemValidForSlot(slot, dropped))) {
return result(true)
@ -292,6 +293,7 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
case inventory: IInventory if inventory.isUseableByPlayer(player) =>
result(trySuckFromInventory(inventory, slot => true))
case _ =>
val player = robot.player(facing)
for (entity <- player.entitiesOnSide[EntityMinecartContainer](facing) if entity.isUseableByPlayer(player)) {
if (trySuckFromInventory(entity, slot => true)) {
return result(true)
@ -315,7 +317,7 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
@Callback
def detect(context: Context, args: Arguments): Array[AnyRef] = {
val side = checkSideForAction(args, 0)
val (something, what) = blockContent(side)
val (something, what) = blockContent(robot.player(side), side)
result(something, what)
}
@ -338,7 +340,7 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
context.pause(delay)
robot.animateSwing(Settings.get.swingDelay)
}
def attack(entity: Entity) = {
def attack(player: Player, entity: Entity) = {
beginConsumeDrops(entity)
player.attackTargetEntityWithCurrentItem(entity)
// Mine carts have to be hit quickly in succession to break, so we click
@ -349,11 +351,11 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
}
case _ =>
}
endConsumeDrops(entity)
endConsumeDrops(player, entity)
triggerDelay()
(true, "entity")
}
def click(x: Int, y: Int, z: Int, side: Int) = {
def click(player: Player, x: Int, y: Int, z: Int, side: Int) = {
val breakTime = player.clickBlock(x, y, z, side)
val broke = breakTime > 0
if (broke) {
@ -376,14 +378,14 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
case _ => MovingObjectType.MISS
}) match {
case MovingObjectType.ENTITY =>
attack(hit.entityHit)
attack(player, hit.entityHit)
case MovingObjectType.BLOCK =>
click(hit.blockX, hit.blockY, hit.blockZ, hit.sideHit)
click(player, hit.blockX, hit.blockY, hit.blockZ, hit.sideHit)
case _ =>
// Retry with full block bounds, disregarding swing range.
player.closestEntity[EntityLivingBase]() match {
case Some(entity) =>
attack(entity)
attack(player, entity)
case _ =>
if (world.extinguishFire(player, x, y, z, facing.ordinal)) {
triggerDelay()
@ -435,19 +437,19 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
(true, "item_used")
case _ => (false, "")
}
def interact(player: Player, entity: Entity) = {
beginConsumeDrops(entity)
val result = player.interactWith(entity)
endConsumeDrops(player, entity)
result
}
for (side <- sides) {
val player = robot.player(facing, side)
player.setSneaking(sneaky)
def interact(entity: Entity) = {
beginConsumeDrops(entity)
val result = player.interactWith(entity)
endConsumeDrops(entity)
result
}
val (success, what) = Option(pick(player, Settings.get.useAndPlaceRange)) match {
case Some(hit) if hit.typeOfHit == MovingObjectType.ENTITY && interact(hit.entityHit) =>
case Some(hit) if hit.typeOfHit == MovingObjectType.ENTITY && interact(player, hit.entityHit) =>
triggerDelay()
(true, "item_interacted")
case Some(hit) if hit.typeOfHit == MovingObjectType.BLOCK =>
@ -500,7 +502,7 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
result(false, "already moving")
}
else {
val (something, what) = blockContent(direction)
val (something, what) = blockContent(robot.player(direction), direction)
if (something) {
result(false, what)
}
@ -563,7 +565,7 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
entity.captureDrops = true
}
private def endConsumeDrops(entity: Entity) {
private def endConsumeDrops(player: Player, entity: Entity) {
entity.captureDrops = false
for (drop <- entity.capturedDrops) {
val stack = drop.getEntityItem
@ -577,7 +579,7 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
// ----------------------------------------------------------------------- //
private def blockContent(side: ForgeDirection) = {
private def blockContent(player: Player, side: ForgeDirection) = {
player.closestEntity[Entity](side) match {
case Some(_@(_: EntityLivingBase | _: EntityMinecart)) =>
(true, "entity")

View File

@ -0,0 +1,7 @@
package li.cil.oc.util.mods
import net.minecraft.item.ItemStack
object TinkersConstruct {
def isInfiTool(stack: ItemStack) = stack != null && stack.getItem.getClass.getName.startsWith("""tconstruct.""")
}