Disable automatic orientation when using belt lock

This commit is contained in:
tobspr 2020-06-16 20:02:52 +02:00
parent 215e35166a
commit 46ceefd0d8
1 changed files with 7 additions and 2 deletions

View File

@ -154,13 +154,13 @@ export class HUDBuildingPlacer extends BaseHUDPart {
const oldPos = this.lastDragTile;
let newPos = this.root.camera.screenToWorld(pos).toTileSpace();
// Check if camera is moving, since then we do nothing
if (this.root.camera.desiredCenter) {
// Camera is moving
this.lastDragTile = newPos;
return;
}
// Direction lock
// Check for direction lock
if (
this.root.keyMapper.getBinding(KEYMAPPINGS.placement.lockBeltDirection).isCurrentlyPressed()
) {
@ -171,10 +171,15 @@ export class HUDBuildingPlacer extends BaseHUDPart {
newPos = oldPos.add(delta);
}
// Check if anything changed
if (!oldPos.equals(newPos)) {
// Automatic Direction
if (
metaBuilding &&
metaBuilding.getRotateAutomaticallyWhilePlacing(this.currentVariant.get()) &&
!this.root.keyMapper
.getBinding(KEYMAPPINGS.placement.lockBeltDirection)
.isCurrentlyPressed() &&
!this.root.keyMapper
.getBinding(KEYMAPPINGS.placementModifiers.placementDisableAutoOrientation)
.isCurrentlyPressed()