mirror of
https://github.com/tobspr-games/shapez.io.git
synced 2026-01-09 18:51:30 -08:00
Make CycleBuildings select last used item when empty
This commit is contained in:
parent
eb87550b36
commit
6a5d1a0890
1 changed files with 2 additions and 2 deletions
|
|
@ -110,8 +110,8 @@ export class HUDBuildingsToolbar extends BaseHUDPart {
|
|||
|
||||
cycleBuildings() {
|
||||
let newIndex = this.lastSelectedIndex;
|
||||
for (let i = 0; i < toolbarBuildings.length; ++i) {
|
||||
newIndex = (newIndex + 1) % toolbarBuildings.length;
|
||||
for (let i = 0; i < toolbarBuildings.length; ++i, ++newIndex) {
|
||||
newIndex %= toolbarBuildings.length;
|
||||
const metaBuilding = gMetaBuildingRegistry.findByClass(toolbarBuildings[newIndex]);
|
||||
const handle = this.buildingHandles[metaBuilding.id];
|
||||
if (!handle.selected && handle.unlocked) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue