mirror of
				https://github.com/tobspr/shapez.io.git
				synced 2025-06-13 13:04:03 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			558 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			558 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import { randomChoice } from "../core/utils";
 | |
| import { T } from "../translations";
 | |
| 
 | |
| const hintsShown = [];
 | |
| 
 | |
| /**
 | |
|  * Finds a new hint to show about the game which the user hasn't seen within this session
 | |
|  */
 | |
| export function getRandomHint() {
 | |
|     let maxTries = 100 * T.tips.length;
 | |
| 
 | |
|     while (maxTries-- > 0) {
 | |
|         const hint = randomChoice(T.tips);
 | |
|         if (!hintsShown.includes(hint)) {
 | |
|             hintsShown.push(hint);
 | |
|             return hint;
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     // All tips shown so far
 | |
|     return randomChoice(T.tips);
 | |
| }
 |