Disable direction lock for everything but belts

pull/194/head
tobspr 4 years ago
parent e2d6d9d51d
commit 31ab5f3422

@ -22,6 +22,10 @@ export class MetaBeltBaseBuilding extends MetaBuilding {
return "#777";
}
getHasDirectionLockAvailable() {
return true;
}
/**
* @param {GameRoot} root
* @param {string} variant

@ -38,6 +38,10 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding {
return true;
}
getHasDirectionLockAvailable() {
return true;
}
getStayInPlacementMode() {
return true;
}

@ -162,6 +162,7 @@ export class HUDBuildingPlacer extends BaseHUDPart {
// Check for direction lock
if (
metaBuilding.getHasDirectionLockAvailable() &&
this.root.keyMapper.getBinding(KEYMAPPINGS.placement.lockBeltDirection).isCurrentlyPressed()
) {
const vector = enumDirectionToVector[enumAngleToDirection[this.currentBaseRotation]];
@ -177,9 +178,10 @@ export class HUDBuildingPlacer extends BaseHUDPart {
if (
metaBuilding &&
metaBuilding.getRotateAutomaticallyWhilePlacing(this.currentVariant.get()) &&
!this.root.keyMapper
.getBinding(KEYMAPPINGS.placement.lockBeltDirection)
.isCurrentlyPressed() &&
(!metaBuilding.getHasDirectionLockAvailable() ||
!this.root.keyMapper
.getBinding(KEYMAPPINGS.placement.lockBeltDirection)
.isCurrentlyPressed()) &&
!this.root.keyMapper
.getBinding(KEYMAPPINGS.placementModifiers.placementDisableAutoOrientation)
.isCurrentlyPressed()
@ -659,7 +661,10 @@ export class HUDBuildingPlacer extends BaseHUDPart {
// Draw direction lock
if (this.root.keyMapper.getBinding(KEYMAPPINGS.placement.lockBeltDirection).isCurrentlyPressed()) {
if (
metaBuilding.getHasDirectionLockAvailable() &&
this.root.keyMapper.getBinding(KEYMAPPINGS.placement.lockBeltDirection).isCurrentlyPressed()
) {
if (this.lastDragTile) {
parameters.context.fillStyle = THEME.map.selectionBackground;
parameters.context.strokeStyle = THEME.map.selectionOverlay;

@ -31,6 +31,13 @@ export class MetaBuilding {
return new Vector(1, 1);
}
/**
* Returns whether the building has the direction lock switch available
*/
getHasDirectionLockAvailable() {
return false;
}
/**
* Whether to stay in placement mode after having placed a building
*/

Loading…
Cancel
Save