@@ -309,6 +309,7 @@ function switchShowOwnedUpgrades() {  
		
	
		
			
			function displayUpgrades(owned) {  
		
	
		
			
			  if (owned) {  
		
	
		
			
			    Object.entries(ownedUpgrades).forEach(([key, val]) => {  
		
	
		
			
			 
		
	
		
			
			      let button = cache.upgradeButtons[key];  
		
	
		
			
			      if (val) {  
		
	
		
			
			        button.classList.remove("hidden");  
		
	
	
		
			
				
				
				
				
					 
			
			@@ -320,20 +321,29 @@ function displayUpgrades(owned) {  
		
	
		
			
			  else {  
		
	
		
			
			    for (let id of remainingUpgrades) {  
		
	
		
			
			      let button = cache.upgradeButtons[id];  
		
	
		
			
			      let visible = states.upgrades[id].visible;  
		
	
		
			
			      let available = states.upgrades[id].available;  
		
	
		
			
			 
		
	
		
			
			      if (ownedUpgrades[id]) {  
		
	
		
			
			      if (ownedUpgrades[id] && visible !== false ) {  
		
	
		
			
			        button.classList.add("hidden");  
		
	
		
			
			        states.upgrades[id].visible = false;  
		
	
		
			
			        continue;  
		
	
		
			
			      }  
		
	
		
			
			      if (upgradeReachable(id)) {  
		
	
		
			
			 
		
	
		
			
			      if (upgradeReachable(id) && visible !== true) {  
		
	
		
			
			        button.classList.remove("hidden");  
		
	
		
			
			      } else {  
		
	
		
			
			        states.upgrades[id].visible = true;  
		
	
		
			
			      } else if (!upgradeReachable(id) && visible !== false) {  
		
	
		
			
			        button.classList.add("hidden");  
		
	
		
			
			        states.upgrades[id].visible = false;  
		
	
		
			
			      }  
		
	
		
			
			      if (upgradeAvailable(id)) {  
		
	
		
			
			 
		
	
		
			
			      if (upgradeAvailable(id) && available !== true) {  
		
	
		
			
			        button.classList.remove("upgrade-button-inactive");  
		
	
		
			
			      } else {  
		
	
		
			
			        states.upgrades[id].available = true;  
		
	
		
			
			      } else if (!upgradeAvailable(id) && available !== false) {  
		
	
		
			
			        button.classList.add("upgrade-button-inactive");  
		
	
		
			
			        states.upgrades[id].available = false;  
		
	
		
			
			      }  
		
	
		
			
			    }  
		
	
		
			
			 
		
	
	
		
			
				
				
					 
			
			@@ -419,6 +429,7 @@ function setup() {  
		
	
		
			
			  load();  
		
	
		
			
			  unlockAtStart();  
		
	
		
			
			  initializeCaches();  
		
	
		
			
			  initializeStates();  
		
	
		
			
			  updateAll();  
		
	
		
			
			 
		
	
		
			
			}  
		
	
	
		
			
				
				
					 
			
			@@ -453,6 +464,25 @@ function initializeCaches() {  
		
	
		
			
			  cache.upgradeButtons = upgradeButtons;  
		
	
		
			
			}  
		
	
		
			
			 
		
	
		
			
			const states = {};  
		
	
		
			
			 
		
	
		
			
			// we can keep track of some things, like whether  
		
	
		
			
			// specific upgrades are currently visible. this  
		
	
		
			
			// way, we don't have to set them visible every tick;  
		
	
		
			
			// we can just check if they've been handled already  
		
	
		
			
			 
		
	
		
			
			function initializeStates() {  
		
	
		
			
			  const upgradeStates = {};  
		
	
		
			
			 
		
	
		
			
			  Object.keys(upgrades).forEach(key => {  
		
	
		
			
			    upgradeStates[key] = {  
		
	
		
			
			      visible: undefined,  
		
	
		
			
			      available: undefined  
		
	
		
			
			    }  
		
	
		
			
			  });  
		
	
		
			
			 
		
	
		
			
			  states.upgrades = upgradeStates;  
		
	
		
			
			}  
		
	
		
			
			function unlockAtStart() {  
		
	
		
			
			  unlockBuilding("micro");