This repository has been archived on 2021-02-20. You can view files and clone it, but cannot push or open issues or pull requests.
shapez.io/src/js/game/hints.js

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);
}