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

Delete building keybinding

This commit is contained in:
Lukáš Doležal 2020-12-26 21:31:31 +00:00
parent 4e6017698a
commit 83fa1f23ee
4 changed files with 15 additions and 4 deletions

View File

@ -117,7 +117,8 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
keyActionMapper.getBinding(KEYMAPPINGS.general.back).add(this.abortPlacement, this);
keyActionMapper.getBinding(KEYMAPPINGS.placement.pipette).add(this.startPipette, this);
this.root.gameState.inputReciever.keyup.add(this.checkForDirectionLockSwitch, this);
keyActionMapper.getBinding(KEYMAPPINGS.placement.placeBuilding).add(this.tryPlaceCurrentBuildingAtCursor, this)
keyActionMapper.getBinding(KEYMAPPINGS.placement.placeBuilding).add(this.tryPlaceCurrentBuildingAtCursor, this);
keyActionMapper.getBinding(KEYMAPPINGS.placement.delete).add(this.tryDeleteBelowCursor, this);
// BINDINGS TO GAME EVENTS
this.root.hud.signals.buildingsSelectedForCopy.add(this.abortPlacement, this);
@ -150,6 +151,14 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
this.tryPlaceCurrentBuildingAt(mouseTile);
}
tryDeleteBelowCursor() {
if (this.currentMetaBuilding.get()) {
return;
}
this.deleteBelowCursor();
}
/**
* Called when the edit mode got changed
* @param {Layer} layer

View File

@ -173,7 +173,7 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
{
// Delete with right click
label: T.ingame.keybindingsOverlay.delete,
keys: [KEYCODE_RMB],
keys: [KEYCODE_RMB, DIVIDER_TOKEN, k.placement.delete],
condition: () =>
!this.anyPlacementActive && !this.mapOverviewActive && !this.anythingSelectedOnMap,
},
@ -195,7 +195,7 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
{
// Place building
label: T.ingame.keybindingsOverlay.placeBuilding,
keys: [k.placement.placeBuilding],
keys: [KEYCODE_LMB, DIVIDER_TOKEN, k.placement.placeBuilding],
condition: () => this.anyPlacementActive,
},
@ -299,7 +299,7 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
break;
default:
html += `<code class="keybinding">${getStringForKeyCode(
mapper.getBinding(/** @type {KeyCode} */ (key)).keyCode
mapper.getBinding(/** @type {KeyCode} */(key)).keyCode
)}</code>`;
}
}

View File

@ -83,6 +83,7 @@ export const KEYMAPPINGS = {
placement: {
placeBuilding: { keyCode: KEYCODE_LMB },
delete: { keyCode: KEYCODE_RMB },
pipette: { keyCode: key("Q") },
rotateWhilePlacing: { keyCode: key("R") },
rotateInverseModifier: { keyCode: 16 }, // SHIFT

View File

@ -1181,6 +1181,7 @@ keybindings:
placementDisableAutoOrientation: Disable automatic orientation
placeMultiple: Stay in placement mode
placeInverse: Invert automatic belt orientation
delete: Delete Building
about:
title: About this Game