mirror of
				https://github.com/tobspr/shapez.io.git
				synced 2025-06-13 13:04:03 +00:00 
			
		
		
		
	Make CycleBuildings work properly
This commit is contained in:
		
							parent
							
								
									f434cbd6f4
								
							
						
					
					
						commit
						eb87550b36
					
				@ -109,7 +109,15 @@ export class HUDBuildingsToolbar extends BaseHUDPart {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    cycleBuildings() {
 | 
			
		||||
        const newIndex = (this.lastSelectedIndex + 1) % toolbarBuildings.length;
 | 
			
		||||
        let newIndex = this.lastSelectedIndex;
 | 
			
		||||
        for (let i = 0; i < toolbarBuildings.length; ++i) {
 | 
			
		||||
            newIndex = (newIndex + 1) % toolbarBuildings.length;
 | 
			
		||||
            const metaBuilding = gMetaBuildingRegistry.findByClass(toolbarBuildings[newIndex]);
 | 
			
		||||
            const handle = this.buildingHandles[metaBuilding.id];
 | 
			
		||||
            if (!handle.selected && handle.unlocked) {
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        const metaBuildingClass = toolbarBuildings[newIndex];
 | 
			
		||||
        const metaBuilding = gMetaBuildingRegistry.findByClass(metaBuildingClass);
 | 
			
		||||
        this.selectBuildingForPlacement(metaBuilding);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user