mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-12 16:57:32 -04:00
Returning failure reason of first attempt in robot.swing(), closes #555.
This commit is contained in:
parent
e75b25c06e
commit
9d9d3f1639
@ -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
|
||||||
|
@ -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
|
||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
// ----------------------------------------------------------------------- //
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user