Returning failure reason of first attempt in robot.swing(), closes #555.

This commit is contained in:
Florian Nücke 2014-09-21 18:05:39 +02:00
parent e75b25c06e
commit 9d9d3f1639
3 changed files with 5 additions and 3 deletions

View File

@ -37,8 +37,8 @@ object OpenComputers {
@EventHandler @EventHandler
def preInit(e: FMLPreInitializationEvent) { def preInit(e: FMLPreInitializationEvent) {
proxy.preInit(e)
log = e.getModLog log = e.getModLog
proxy.preInit(e)
} }
@EventHandler @EventHandler

View File

@ -521,7 +521,7 @@ class Robot extends traits.Computer with traits.PowerInformation with api.machin
case _ => false case _ => false
}) })
def isUpgradeSlot(slot: Int) = false // slot == 3 TODO upgrade synching for rendering def isUpgradeSlot(slot: Int) = containerSlotType(slot) == Slot.Upgrade
// ----------------------------------------------------------------------- // // ----------------------------------------------------------------------- //

View File

@ -312,6 +312,7 @@ class Robot(val robot: tileentity.Robot) extends ManagedComponent {
(broke, "block") (broke, "block")
} }
var reason: Option[String] = None
for (side <- sides) { for (side <- sides) {
val player = robot.player(facing, side) val player = robot.player(facing, side)
player.setSneaking(sneaky) player.setSneaking(sneaky)
@ -341,9 +342,10 @@ class Robot(val robot: tileentity.Robot) extends ManagedComponent {
if (success) { if (success) {
return result(true, what) return result(true, what)
} }
reason = reason.orElse(Option(what))
} }
result(false) result(false, reason.orNull)
} }
@Callback @Callback