mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-02-18 22:09:20 +00:00
Reverse cycle when pressing shift key
This commit is contained in:
parent
390135574d
commit
e631c6a072
@ -108,9 +108,16 @@ export class HUDBaseToolbar extends BaseHUDPart {
|
||||
return;
|
||||
}
|
||||
|
||||
let addIndex;
|
||||
if (this.root.keyMapper.getBinding(KEYMAPPINGS.placement.rotateInverseModifier).pressed) {
|
||||
addIndex = this.supportedBuildings.length - 1;
|
||||
} else {
|
||||
addIndex = 1;
|
||||
}
|
||||
|
||||
let process = false;
|
||||
let newIndex = this.lastSelectedIndex;
|
||||
for (let i = 0; i < this.supportedBuildings.length; ++i, ++newIndex) {
|
||||
for (let i = 0; i < this.supportedBuildings.length; ++i, newIndex += addIndex) {
|
||||
newIndex %= this.supportedBuildings.length;
|
||||
const metaBuilding = gMetaBuildingRegistry.findByClass(this.supportedBuildings[newIndex]);
|
||||
const handle = this.buildingHandles[metaBuilding.id];
|
||||
|
||||
@ -504,7 +504,15 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
index >= 0,
|
||||
"Current variant was invalid: " + this.currentVariant.get() + " out of " + availableVariants
|
||||
);
|
||||
const newIndex = (index + 1) % availableVariants.length;
|
||||
|
||||
let addIndex;
|
||||
if (this.root.keyMapper.getBinding(KEYMAPPINGS.placement.rotateInverseModifier).pressed) {
|
||||
addIndex = availableVariants.length - 1;
|
||||
} else {
|
||||
addIndex = 1;
|
||||
}
|
||||
|
||||
const newIndex = (index + addIndex) % availableVariants.length;
|
||||
const newVariant = availableVariants[newIndex];
|
||||
this.currentVariant.set(newVariant);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user