mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-12 16:57:32 -04:00
allow the robot to swing at anything that would block its movement
closes #1840
This commit is contained in:
parent
0095f33522
commit
4a83d4426d
@ -150,6 +150,17 @@ trait Agent extends traits.WorldControl with traits.InventoryControl with traits
|
||||
reason = reason.orElse(Option(what))
|
||||
}
|
||||
|
||||
// all side attempts failed - but there could be a partial block that is hard to "see"
|
||||
val (hasBlock, _) = blockContent(facing)
|
||||
if (hasBlock) {
|
||||
val blockPos = position.offset(facing)
|
||||
val player = rotatedPlayer(facing, facing)
|
||||
player.setSneaking(sneaky)
|
||||
val (ok, why) = click(player, blockPos.x, blockPos.y, blockPos.z, facing.ordinal())
|
||||
player.setSneaking(false)
|
||||
return result(ok, why)
|
||||
}
|
||||
|
||||
result(false, reason.orNull)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user