Merge branch 'master' of https://github.com/MightyPirates/OpenComputers into robot_components

This commit is contained in:
Florian Nücke 2013-12-24 14:08:28 +01:00
commit f8329df0ce
5 changed files with 19 additions and 12 deletions

View File

@ -117,19 +117,19 @@ function robot.durability()
end
function robot.swing(side)
function robot.swing(side, sneaky)
checkArg(1, side, "nil", "number")
return component.computer.swing(sides.front, side)
return component.computer.swing(sides.front, side, sneaky ~= nil and sneaky ~= false)
end
function robot.swingUp(side)
function robot.swingUp(side, sneaky)
checkArg(1, side, "nil", "number")
return component.computer.swing(sides.up, side)
return component.computer.swing(sides.up, side, sneaky ~= nil and sneaky ~= false)
end
function robot.swingDown(side)
function robot.swingDown(side, sneaky)
checkArg(1, side, "nil", "number")
return component.computer.swing(sides.down, side)
return component.computer.swing(sides.down, side, sneaky ~= nil and sneaky ~= false)
end
function robot.use(side, sneaky, duration)

View File

@ -94,7 +94,8 @@ object Cable {
world.getBlockTileEntity(x + side.offsetX, y + side.offsetY, z + side.offsetZ) match {
case robot: tileentity.RobotProxy =>
case host: SidedEnvironment =>
if (host.canConnect(side.getOpposite)) {
val connects = if (host.getWorldObj.isRemote) host.canConnect(side.getOpposite) else host.sidedNode(side.getOpposite) != null
if (connects) {
result |= side.flag
}
case host: Environment => result |= side.flag

View File

@ -324,6 +324,7 @@ class Robot(val robot: tileentity.Robot) extends Computer(robot) with RobotConte
else {
ForgeDirection.VALID_DIRECTIONS.filter(_ != facing.getOpposite).toIterable
}
val sneaky = args.isBoolean(2) && args.checkBoolean(2)
def triggerDelay(delay: Double = Settings.get.swingDelay) = {
context.pause(delay)
@ -358,6 +359,8 @@ class Robot(val robot: tileentity.Robot) extends Computer(robot) with RobotConte
for (side <- sides) {
val player = robot.player(facing, side)
player.setSneaking(sneaky)
val (success, what) = Option(pick(player, Settings.get.swingRange)) match {
case Some(hit) =>
hit.typeOfHit match {
@ -378,6 +381,8 @@ class Robot(val robot: tileentity.Robot) extends Computer(robot) with RobotConte
else (false, "air")
}
}
player.setSneaking(false)
if (success) {
return result(true, what)
}

View File

@ -12,6 +12,7 @@ import net.minecraft.server.MinecraftServer
import net.minecraft.tileentity.TileEntity
import scala.collection.convert.WrapAsScala._
import scala.language.implicitConversions
import java.nio.charset.MalformedInputException
class WirelessNetworkCard(val owner: TileEntity) extends NetworkCard {
override val node = api.Network.newNode(this, Visibility.Network).
@ -87,6 +88,8 @@ class WirelessNetworkCard(val owner: TileEntity) extends NetworkCard {
catch {
case e: FileNotFoundException =>
context.signal("http_response", address, Unit, "not found: " + Option(e.getMessage).getOrElse(e.toString))
case _: MalformedInputException =>
context.signal("http_response", address, Unit, "binary data not yet supported")
case e: Throwable =>
context.signal("http_response", address, Unit, Option(e.getMessage).getOrElse(e.toString))
}

View File

@ -579,11 +579,9 @@ opencomputers {
# blacklist is always applied, so if an entry is present in both the
# whitelist and the blacklist, the blacklist will win.
# All entries are regular expression patterns, but they will only be
# applied to the host name (domain) of a given URL.
whitelist: [
"^gist\\.github\\.com$"
"^(:?www\\.)?pastebin\\.com$"
]
# applied to the host name (domain) of a given URL. Examples:
# "^gist\\.github\\.com$", "^(:?www\\.)?pastebin\\.com$"
whitelist: []
}
# Other settings that you might find useful to tweak.