1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

Fix Belt planner Overlay

This commit is contained in:
isaisstillalive 2020-06-22 23:33:00 +09:00
parent f3d034d4b4
commit c3aed48dae
2 changed files with 25 additions and 1 deletions

View File

@ -175,6 +175,21 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
}
}
/**
* Returns if the direction lock is available
* @returns {boolean}
*/
get isDirectionLockAvailable() {
const metaBuilding = this.currentMetaBuilding.get();
if (!(metaBuilding && metaBuilding.getHasDirectionLockAvailable())) {
return false;
}
if (this.currentlyDirectionLock !== null) {
return false;
}
return !this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.lockBeltDirection).pressed;
}
/**
* Returns if the direction lock is currently active
* @returns {boolean}

View File

@ -78,6 +78,15 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
return placer && !!placer.currentBlueprint.get();
}
/**
* HELPER / Returns if the belt planner is available
* @returns {boolean}
*/
get beltPlannerAvailable() {
const placer = this.root.hud.parts.buildingPlacer;
return !this.mapOverviewActive && placer && placer.isDirectionLockAvailable;
}
/**
* HELPER / Returns if the belt planner is currently active
* @returns {boolean}
@ -225,7 +234,7 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
// Belt planner
label: T.ingame.keybindingsOverlay.lockBeltDirection,
keys: [k.placementModifiers.lockBeltDirection],
condition: () => this.buildingPlacementSupportsBeltPlanner && !this.beltPlannerActive,
condition: () => this.buildingPlacementSupportsBeltPlanner && this.beltPlannerAvailable,
},
{