properly handle non-5 custom words
This commit is contained in:
parent
8592d93446
commit
4bc83730ea
|
@ -28,10 +28,6 @@
|
||||||
let yellow_letters: string[] = [];
|
let yellow_letters: string[] = [];
|
||||||
let unfit_letters: string[] = [];
|
let unfit_letters: string[] = [];
|
||||||
|
|
||||||
for (let i = 0; i != guesses; i++) {
|
|
||||||
guessed.push(new Array(word.length).fill(''));
|
|
||||||
}
|
|
||||||
|
|
||||||
globalThis.ScriptInterface.gameState.set_current_word = word2 => {
|
globalThis.ScriptInterface.gameState.set_current_word = word2 => {
|
||||||
if (!globalThis.ScriptInterface.scriptsAllowed())
|
if (!globalThis.ScriptInterface.scriptsAllowed())
|
||||||
throw new Error('Scripts are not allowed');
|
throw new Error('Scripts are not allowed');
|
||||||
|
@ -79,7 +75,11 @@
|
||||||
|
|
||||||
function submitGuess() {
|
function submitGuess() {
|
||||||
if (word_position != word.length) return updateState();
|
if (word_position != word.length) return updateState();
|
||||||
if (!isIn(current_word()) && current_word() != word) {
|
if (
|
||||||
|
!isIn(current_word()) &&
|
||||||
|
current_word() != word &&
|
||||||
|
word.length > 3 && word.length < 11
|
||||||
|
) {
|
||||||
not_a_word = true;
|
not_a_word = true;
|
||||||
setTimeout(() => {not_a_word = false}, 1000);
|
setTimeout(() => {not_a_word = false}, 1000);
|
||||||
return updateState();
|
return updateState();
|
||||||
|
@ -142,6 +142,12 @@
|
||||||
|
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
word = await V1.decode(data);
|
word = await V1.decode(data);
|
||||||
|
|
||||||
|
guessed = [];
|
||||||
|
for (let i = 0; i != guesses; i++) {
|
||||||
|
guessed.push(new Array(word.length).fill(''));
|
||||||
|
}
|
||||||
|
|
||||||
updateState();
|
updateState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,6 +207,10 @@
|
||||||
unfit_letters = [];
|
unfit_letters = [];
|
||||||
updateState();
|
updateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i != guesses; i++) {
|
||||||
|
guessed.push(new Array(word.length).fill(''));
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<GameCreator bind:show={game_creator} />
|
<GameCreator bind:show={game_creator} />
|
||||||
|
|
Loading…
Reference in New Issue