Skip to content

Commit

Permalink
fix: frame motors starting moves while already in motion
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTJP committed Dec 27, 2024
1 parent b2fb003 commit 8cbc17e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ protected void beginMove() {
assert level != null;
BlockPos blockInFront = getBlockPos().relative(Direction.values()[getFrontSide()]);
if (level.isEmptyBlock(blockInFront)) return;
// If target block already moving, or if we are moving, we cannot start a new move
if (MovementManager.getInstance(level).getMovementInfo(blockInFront).isMoving()) return;
if (MovementManager.getInstance(level).getMovementInfo(getBlockPos()).isMoving()) return;

assert ProjectRedAPI.expansionAPI != null;
Set<BlockPos> blocks = ProjectRedAPI.expansionAPI.getStructure(level, blockInFront, getBlockPos());
Expand Down Expand Up @@ -144,13 +146,13 @@ public int weakPowerLevel(int side, int mask) {

@Override
public boolean canGrab(Level w, BlockPos pos, Direction side) {
// If this block is moved, it will come along with whatever structure is on its front face
// If this block is moved, it will bring along whatever structure is touching its front face
return side.ordinal() == getFrontSide();
}

@Override
public boolean canBeGrabbed(Level w, BlockPos pos, Direction side) {
// If a structure on the front face is moved by something else, it may not bring this block along
// If a structure touching front face is moved by something else, it may not bring this block along
return side.ordinal() != getFrontSide();
}

Expand Down

0 comments on commit 8cbc17e

Please sign in to comment.