talkinghead mode: don't check for existence of static emote sprite

This commit is contained in:
Juha Jeronen
2024-01-06 02:10:09 +02:00
parent a7c6f4f56e
commit 2d85d7e1e1

View File

@ -736,18 +736,22 @@ async function setSpriteSlashCommand(_, spriteId) {
spriteId = spriteId.trim().toLowerCase(); spriteId = spriteId.trim().toLowerCase();
const currentLastMessage = getLastCharacterMessage(); // In talkinghead mode, don't check for the existence of the sprite
const spriteFolderName = getSpriteFolderName(currentLastMessage, currentLastMessage.name); // (emotion names are the same as for sprites, but it only needs "talkinghead.png").
await validateImages(spriteFolderName); if (extension_settings.expressions.local || !extension_settings.expressions.talkinghead) {
const currentLastMessage = getLastCharacterMessage();
const spriteFolderName = getSpriteFolderName(currentLastMessage, currentLastMessage.name);
await validateImages(spriteFolderName);
// Fuzzy search for sprite // Fuzzy search for sprite
const fuse = new Fuse(spriteCache[spriteFolderName], { keys: ['label'] }); const fuse = new Fuse(spriteCache[spriteFolderName], { keys: ['label'] });
const results = fuse.search(spriteId); const results = fuse.search(spriteId);
const spriteItem = results[0]?.item; const spriteItem = results[0]?.item;
if (!spriteItem) { if (!spriteItem) {
console.log('No sprite found for search term ' + spriteId); console.log('No sprite found for search term ' + spriteId);
return; return;
}
} }
const vnMode = isVisualNovelMode(); const vnMode = isVisualNovelMode();