mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Allow for cycling buildings backward with SHIFT
Uses the rotateInverseModifier key
This commit is contained in:
parent
21c9c3cee6
commit
b57cde7398
@ -160,9 +160,13 @@ export class HUDBaseToolbar extends BaseHUDPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let newBuildingFound = false;
|
let newBuildingFound = false;
|
||||||
|
let direction = !this.root.keyMapper.getBinding(KEYMAPPINGS.placement.rotateInverseModifier).pressed * 2 + 1;
|
||||||
let newIndex = this.lastSelectedIndex;
|
let newIndex = this.lastSelectedIndex;
|
||||||
for (let i = 0; i < this.primaryBuildings.length; ++i, ++newIndex) {
|
for (let i = 0; i < this.primaryBuildings.length; ++i, newIndex += direction) {
|
||||||
newIndex %= this.primaryBuildings.length;
|
newIndex %= this.primaryBuildings.length;
|
||||||
|
if (newIndex < 0) {
|
||||||
|
newIndex += this.primaryBuildings.length;
|
||||||
|
}
|
||||||
const metaBuilding = gMetaBuildingRegistry.findByClass(this.primaryBuildings[newIndex]);
|
const metaBuilding = gMetaBuildingRegistry.findByClass(this.primaryBuildings[newIndex]);
|
||||||
const handle = this.buildingHandles[metaBuilding.id];
|
const handle = this.buildingHandles[metaBuilding.id];
|
||||||
if (!handle.selected && handle.unlocked) {
|
if (!handle.selected && handle.unlocked) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user