Don't try to load live2d if variable is disabled or module is not loaded to Extras

This commit is contained in:
Cohee 2023-08-01 16:33:30 +03:00
parent c5d87e4808
commit 7f86551ab4

View File

@ -397,6 +397,16 @@ function onExpressionsShowDefaultInput() {
}
function loadLiveChar(value_name) {
if (!live2d_var) {
console.debug('live2d is disabled');
return;
}
if (!modules.includes('live2d')) {
console.debug('live2d module is disabled');
return;
}
let url = `${getApiUrl()}/api/live2d/load?loadchar=${location.origin}/characters/${value_name}`;
doExtrasFetch(url, {
method: 'GET',
@ -473,7 +483,9 @@ async function moduleWorker() {
imgElement.src = "";
//Load new char
loadLiveChar(context.name2 + ".png");
if (live2d_var) {
loadLiveChar(context.name2 + ".png");
}
}
const vnMode = isVisualNovelMode();