mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Cycle backwards through building types
Use SHIFT+TAB to cycle backwards through the building types in the toolbar
This commit is contained in:
parent
18388541d5
commit
2230602295
@ -331,8 +331,11 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
);
|
||||
|
||||
// #51 Cycle backwards if SHIFT is pressed
|
||||
const cycleBackwards = this.root.keyMapper.getBinding(
|
||||
KEYMAPPINGS.placement.cycleBuildingVariantsInverseModifier
|
||||
).pressed;
|
||||
let newIndex;
|
||||
if (this.root.keyMapper.getBinding(KEYMAPPINGS.placement.cycleBuildingsInverseModifier).pressed) {
|
||||
if (cycleBackwards) {
|
||||
newIndex = (index - 1 + availableVariants.length) % availableVariants.length;
|
||||
} else {
|
||||
newIndex = (index + 1) % availableVariants.length;
|
||||
|
@ -109,8 +109,15 @@ export class HUDBuildingsToolbar extends BaseHUDPart {
|
||||
}
|
||||
|
||||
cycleBuildings() {
|
||||
const cycleBackwards = this.root.keyMapper.getBinding(
|
||||
KEYMAPPINGS.placement.cycleBuildingsInverseModifier
|
||||
).pressed;
|
||||
let newIndex = this.lastSelectedIndex;
|
||||
for (let i = 0; i < toolbarBuildings.length; ++i, ++newIndex) {
|
||||
for (
|
||||
let i = 0;
|
||||
i < toolbarBuildings.length;
|
||||
++i, newIndex += toolbarBuildings.length + (cycleBackwards ? -1 : 1)
|
||||
) {
|
||||
newIndex %= toolbarBuildings.length;
|
||||
const metaBuilding = gMetaBuildingRegistry.findByClass(toolbarBuildings[newIndex]);
|
||||
const handle = this.buildingHandles[metaBuilding.id];
|
||||
|
@ -60,6 +60,7 @@ export const KEYMAPPINGS = {
|
||||
rotateWhilePlacing: { keyCode: key("R") },
|
||||
rotateInverseModifier: { keyCode: 16 }, // SHIFT
|
||||
cycleBuildingVariants: { keyCode: key("T") },
|
||||
cycleBuildingVariantsInverseModifier: { keyCode: 16 }, // SHIFT
|
||||
cycleBuildings: { keyCode: 9 }, // TAB
|
||||
cycleBuildingsInverseModifier: { keyCode: 16 }, // SHIFT
|
||||
switchDirectionLockSide: { keyCode: key("R") },
|
||||
|
Loading…
Reference in New Issue
Block a user