fixed funbox not working in tribe

This commit is contained in:
Jack 2021-05-06 21:00:53 +01:00
parent 603b2ac672
commit c30511e144
3 changed files with 13 additions and 9 deletions

View file

@ -91,10 +91,7 @@ export function toggleScript(...params) {
}
}
export async function activate(funbox, mode, mp = false) {
if (!Tribe.checkIfCanChangeConfig(mp)) {
return;
}
export async function activate(funbox, mode) {
if (funbox === undefined || funbox === null) {
funbox = funboxSaved;
}
@ -225,12 +222,17 @@ export async function activate(funbox, mode, mp = false) {
// Settings.groups.layout.updateButton();
// }
// }
Tribe.syncConfig();
TestUI.updateModesNotice();
return true;
}
export function setFunbox(funbox, mode) {
if (TestLogic.active || TestUI.resultVisible) {
export function setFunbox(funbox, mode, mp = false) {
if (!Tribe.checkIfCanChangeConfig(mp)) {
return;
}
if (
TestLogic.active ||
(TestUI.resultVisible && $(".page.pageTest").hasClass("active"))
) {
Notifications.add(
"You can only change the funbox before starting a test.",
0
@ -241,5 +243,6 @@ export function setFunbox(funbox, mode) {
funboxSaved = funbox;
modeSaved = mode;
active = funbox;
Tribe.syncConfig();
return true;
}

View file

@ -588,7 +588,7 @@ export async function init(mp = false) {
// } else {
TestUI.showWords();
// }
if ($(".pageTest").hasClass("active")) {
if ($(".pageTest").hasClass("active") || mp) {
Funbox.activate();
}
}

View file

@ -198,6 +198,7 @@ function refreshUserList() {
}
function playSound(sound) {
if (TestLogic.active) return;
tribeSounds[sound].currentTime = 0;
tribeSounds[sound].play();
}
@ -239,7 +240,7 @@ function applyRoomConfig(cfg) {
UpdateConfig.setDifficulty(cfg.difficulty, true, true);
UpdateConfig.setBlindMode(cfg.blindMode, true, true);
UpdateConfig.setLanguage(cfg.language, true, true);
Funbox.activate(cfg.funbox, null, true);
Funbox.setFunbox(cfg.funbox, null, true);
UpdateConfig.setStopOnError(cfg.stopOnError, true, true);
UpdateConfig.setConfidenceMode(cfg.confidenceMode, true, true);
UpdateConfig.setPunctuation(cfg.punctuation, true, true);