mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Add keybinding hint for direction lock
This commit is contained in:
parent
3ddc0de2c4
commit
fc883f1e5e
@ -75,6 +75,14 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:not(.hasDirectionLock) .binding.directionLock {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.hasDirectionLock .noDirectionLock {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.binding.placementOnly,
|
.binding.placementOnly,
|
||||||
&:not(.placementActive) .binding.noPlacementOnly {
|
&:not(.placementActive) .binding.noPlacementOnly {
|
||||||
transform-origin: 0% 50%;
|
transform-origin: 0% 50%;
|
||||||
|
@ -121,7 +121,7 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
|||||||
return (
|
return (
|
||||||
metaBuilding &&
|
metaBuilding &&
|
||||||
metaBuilding.getHasDirectionLockAvailable() &&
|
metaBuilding.getHasDirectionLockAvailable() &&
|
||||||
this.root.keyMapper.getBinding(KEYMAPPINGS.placement.lockBeltDirection).pressed
|
this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.lockBeltDirection).pressed
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +246,10 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
|||||||
* @param {any} args
|
* @param {any} args
|
||||||
*/
|
*/
|
||||||
checkForDirectionLockSwitch({ keyCode }) {
|
checkForDirectionLockSwitch({ keyCode }) {
|
||||||
if (keyCode === this.root.keyMapper.getBinding(KEYMAPPINGS.placement.lockBeltDirection).keyCode) {
|
if (
|
||||||
|
keyCode ===
|
||||||
|
this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.lockBeltDirection).keyCode
|
||||||
|
) {
|
||||||
this.abortDragging();
|
this.abortDragging();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import { T } from "../../../translations";
|
|||||||
import { getStringForKeyCode, KEYMAPPINGS } from "../../key_action_mapper";
|
import { getStringForKeyCode, KEYMAPPINGS } from "../../key_action_mapper";
|
||||||
import { BaseHUDPart } from "../base_hud_part";
|
import { BaseHUDPart } from "../base_hud_part";
|
||||||
import { TrackedState } from "../../../core/tracked_state";
|
import { TrackedState } from "../../../core/tracked_state";
|
||||||
|
import { MetaBuilding } from "../../meta_building";
|
||||||
|
|
||||||
export class HUDKeybindingOverlay extends BaseHUDPart {
|
export class HUDKeybindingOverlay extends BaseHUDPart {
|
||||||
initialize() {
|
initialize() {
|
||||||
@ -77,19 +78,34 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
|
|||||||
(this.root.app.settings.getAllSettings().alwaysMultiplace
|
(this.root.app.settings.getAllSettings().alwaysMultiplace
|
||||||
? ""
|
? ""
|
||||||
: `
|
: `
|
||||||
<div class="binding placementOnly">
|
<div class="binding placementOnly noDirectionLock">
|
||||||
<code class="keybinding builtinKey shift">${getKeycode(
|
<code class="keybinding builtinKey shift">${getKeycode(
|
||||||
KEYMAPPINGS.placementModifiers.placeMultiple
|
KEYMAPPINGS.placementModifiers.placeMultiple
|
||||||
)}</code>
|
)}</code>
|
||||||
<label>${T.ingame.keybindingsOverlay.placeMultiple}</label>
|
<label>${T.ingame.keybindingsOverlay.placeMultiple}</label>
|
||||||
</div>`) +
|
</div>`) +
|
||||||
`
|
`
|
||||||
|
|
||||||
|
<div class="binding placementOnly directionLock">
|
||||||
|
<code class="keybinding builtinKey shift">${getKeycode(
|
||||||
|
KEYMAPPINGS.placementModifiers.lockBeltDirection
|
||||||
|
)}</code>
|
||||||
|
<label>${T.ingame.keybindingsOverlay.lockBeltDirection}</label>
|
||||||
|
</div>
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {MetaBuilding} selectedMetaBuilding
|
||||||
|
*/
|
||||||
onSelectedBuildingForPlacementChanged(selectedMetaBuilding) {
|
onSelectedBuildingForPlacementChanged(selectedMetaBuilding) {
|
||||||
this.element.classList.toggle("placementActive", !!selectedMetaBuilding);
|
this.element.classList.toggle("placementActive", !!selectedMetaBuilding);
|
||||||
|
this.element.classList.toggle(
|
||||||
|
"hasDirectionLock",
|
||||||
|
selectedMetaBuilding && selectedMetaBuilding.getHasDirectionLockAvailable()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
applyCssClasses() {
|
applyCssClasses() {
|
||||||
|
@ -61,7 +61,6 @@ export const KEYMAPPINGS = {
|
|||||||
rotateInverseModifier: { keyCode: 16 }, // SHIFT
|
rotateInverseModifier: { keyCode: 16 }, // SHIFT
|
||||||
cycleBuildingVariants: { keyCode: key("T") },
|
cycleBuildingVariants: { keyCode: key("T") },
|
||||||
cycleBuildings: { keyCode: 9 }, // TAB
|
cycleBuildings: { keyCode: 9 }, // TAB
|
||||||
lockBeltDirection: { keyCode: 16 }, // SHIFT
|
|
||||||
},
|
},
|
||||||
|
|
||||||
massSelect: {
|
massSelect: {
|
||||||
@ -74,6 +73,7 @@ export const KEYMAPPINGS = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
placementModifiers: {
|
placementModifiers: {
|
||||||
|
lockBeltDirection: { keyCode: 16 }, // SHIFT
|
||||||
placementDisableAutoOrientation: { keyCode: 17 }, // CTRL
|
placementDisableAutoOrientation: { keyCode: 17 }, // CTRL
|
||||||
placeMultiple: { keyCode: 16 }, // SHIFT
|
placeMultiple: { keyCode: 16 }, // SHIFT
|
||||||
placeInverse: { keyCode: 18 }, // ALT
|
placeInverse: { keyCode: 18 }, // ALT
|
||||||
|
@ -283,6 +283,7 @@ ingame:
|
|||||||
createMarker: Create Marker
|
createMarker: Create Marker
|
||||||
delete: Destroy
|
delete: Destroy
|
||||||
pasteLastBlueprint: Paste last blueprint
|
pasteLastBlueprint: Paste last blueprint
|
||||||
|
lockBeltDirection: Enable belt planner
|
||||||
|
|
||||||
# Everything related to placing buildings (I.e. as soon as you selected a building
|
# Everything related to placing buildings (I.e. as soon as you selected a building
|
||||||
# from the toolbar)
|
# from the toolbar)
|
||||||
|
Loading…
Reference in New Issue
Block a user