mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Add "Paste last blueprint" keybind. Last blueprint is not preserved on save/exit.
This commit is contained in:
parent
f34813392f
commit
e39a868998
@ -74,6 +74,7 @@ export class GameHUD {
|
||||
shapeUnpinRequested: /** @type {TypedSignal<[string]>} */ (new Signal()),
|
||||
notification: /** @type {TypedSignal<[string, enumNotificationType]>} */ (new Signal()),
|
||||
buildingsSelectedForCopy: /** @type {TypedSignal<[Array<number>]>} */ (new Signal()),
|
||||
pasteBlueprintRequested: new Signal(),
|
||||
};
|
||||
|
||||
if (!IS_MOBILE) {
|
||||
|
@ -29,6 +29,8 @@ export class HUDBlueprintPlacer extends BaseHUDPart {
|
||||
|
||||
/** @type {TypedTrackedState<Blueprint?>} */
|
||||
this.currentBlueprint = new TrackedState(this.onBlueprintChanged, this);
|
||||
/** @type {Blueprint?} */
|
||||
this.lastBlueprintUsed = null;
|
||||
|
||||
const keyActionMapper = this.root.keyMapper;
|
||||
keyActionMapper.getBinding(KEYMAPPINGS.general.back).add(this.abortPlacement, this);
|
||||
@ -36,9 +38,7 @@ export class HUDBlueprintPlacer extends BaseHUDPart {
|
||||
.getBinding(KEYMAPPINGS.placement.abortBuildingPlacement)
|
||||
.add(this.abortPlacement, this);
|
||||
keyActionMapper.getBinding(KEYMAPPINGS.placement.rotateWhilePlacing).add(this.rotateBlueprint, this);
|
||||
keyActionMapper
|
||||
.getBinding(KEYMAPPINGS.placement.abortBuildingPlacement)
|
||||
.add(this.abortPlacement, this);
|
||||
keyActionMapper.getBinding(KEYMAPPINGS.massSelect.pasteLastBlueprint).add(this.pasteBlueprint, this);
|
||||
|
||||
this.root.camera.downPreHandler.add(this.onMouseDown, this);
|
||||
this.root.camera.movePreHandler.add(this.onMouseMove, this);
|
||||
@ -73,6 +73,7 @@ export class HUDBlueprintPlacer extends BaseHUDPart {
|
||||
*/
|
||||
onBlueprintChanged(blueprint) {
|
||||
if (blueprint) {
|
||||
this.lastBlueprintUsed = blueprint;
|
||||
this.costDisplayText.innerText = "" + blueprint.getCost();
|
||||
}
|
||||
}
|
||||
@ -144,6 +145,15 @@ export class HUDBlueprintPlacer extends BaseHUDPart {
|
||||
}
|
||||
}
|
||||
|
||||
pasteBlueprint() {
|
||||
if (this.lastBlueprintUsed !== null) {
|
||||
this.root.hud.signals.pasteBlueprintRequested.dispatch();
|
||||
this.currentBlueprint.set(this.lastBlueprintUsed);
|
||||
} else {
|
||||
this.root.soundProxy.playUiError();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {DrawParameters} parameters
|
||||
|
@ -40,6 +40,7 @@ export class HUDBuildingPlacer extends BaseHUDPart {
|
||||
keyActionMapper.getBinding(KEYMAPPINGS.placement.cycleBuildingVariants).add(this.cycleVariants, this);
|
||||
|
||||
this.root.hud.signals.buildingsSelectedForCopy.add(this.abortPlacement, this);
|
||||
this.root.hud.signals.pasteBlueprintRequested.add(this.abortPlacement, this);
|
||||
|
||||
this.domAttach = new DynamicDomAttach(this.root, this.element, {});
|
||||
|
||||
|
@ -31,10 +31,10 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
|
||||
<code class="keybinding">${getKeycode(KEYMAPPINGS.navigation.mapMoveDown)}</code>
|
||||
<code class="keybinding">${getKeycode(KEYMAPPINGS.navigation.mapMoveRight)}</code>
|
||||
<label>${T.ingame.keybindingsOverlay.moveMap}</label>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="binding noPlacementOnly">
|
||||
<code class="keybinding rightMouse"></code>
|
||||
<label>${T.ingame.keybindingsOverlay.delete}</label>
|
||||
@ -47,13 +47,18 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
|
||||
<code class="keybinding leftMouse"></code>
|
||||
<label>${T.ingame.keybindingsOverlay.selectBuildings}</label>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="binding noPlacementOnly">
|
||||
<code class="keybinding">${getKeycode(KEYMAPPINGS.massSelect.pasteLastBlueprint)}</code>
|
||||
<label>${T.ingame.keybindingsOverlay.pasteLastBlueprint}</label>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="binding placementOnly">
|
||||
<code class="keybinding leftMouse"></code>
|
||||
<label>${T.ingame.keybindingsOverlay.placeBuilding}</label>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="binding placementOnly">
|
||||
<code class="keybinding rightMouse"></code><i></i>
|
||||
<code class="keybinding">${getKeycode(KEYMAPPINGS.placement.abortBuildingPlacement)}</code>
|
||||
|
@ -67,6 +67,7 @@ export const KEYMAPPINGS = {
|
||||
massSelectCopy: { keyCode: key("C") },
|
||||
massSelectCut: { keyCode: key("X") },
|
||||
confirmMassDelete: { keyCode: 46 }, // DEL
|
||||
pasteLastBlueprint: { keyCode: key("V") },
|
||||
},
|
||||
|
||||
placementModifiers: {
|
||||
|
@ -291,6 +291,7 @@ ingame:
|
||||
placeBuilding: Place building
|
||||
createMarker: Create Marker
|
||||
delete: Destroy
|
||||
pasteLastBlueprint: Paste last blueprint
|
||||
|
||||
# Everything related to placing buildings (I.e. as soon as you selected a building
|
||||
# from the toolbar)
|
||||
@ -710,6 +711,7 @@ keybindings:
|
||||
Modifier: Rotate CCW instead
|
||||
cycleBuildingVariants: Cycle Variants
|
||||
confirmMassDelete: Confirm Mass Delete
|
||||
pasteLastBlueprint: Paste last blueprint
|
||||
cycleBuildings: Cycle Buildings
|
||||
|
||||
massSelectStart: Hold and drag to start
|
||||
|
Loading…
Reference in New Issue
Block a user