add `/th` (alias `/talkinghead`) to toggle Talkinghead on/off

This commit is contained in:
Juha Jeronen 2024-02-05 00:46:23 +02:00
parent 5ad2a0d064
commit 91c4de6605
1 changed files with 12 additions and 0 deletions

View File

@ -58,6 +58,17 @@ function isTalkingHeadEnabled() {
return extension_settings.expressions.talkinghead && !extension_settings.expressions.local;
}
/**
* Toggles Talkinghead mode on/off.
*
* Implements the `/th` slash command, which is meant to be bound to a Quick Reply button
* as a quick way to switch Talkinghead on or off (e.g. to conserve GPU resources when AFK
* for a long time).
*/
function toggleTalkingHeadCommand(_) {
setTalkingHeadState(!extension_settings.expressions.talkinghead);
}
function isVisualNovelMode() {
return Boolean(!isMobile() && power_user.waifuMode && getContext().groupId);
}
@ -1711,4 +1722,5 @@ async function fetchImagesNoCache() {
registerSlashCommand('sprite', setSpriteSlashCommand, ['emote'], '<span class="monospace">(spriteId)</span> force sets the sprite for the current character', true, true);
registerSlashCommand('spriteoverride', setSpriteSetCommand, ['costume'], '<span class="monospace">(optional folder)</span> sets an override sprite folder for the current character. If the name starts with a slash or a backslash, selects a sub-folder in the character-named folder. Empty value to reset to default.', true, true);
registerSlashCommand('lastsprite', (_, value) => lastExpression[value.trim()] ?? '', [], '<span class="monospace">(charName)</span> Returns the last set sprite / expression for the named character.', true, true);
registerSlashCommand('th', toggleTalkingHeadCommand, ['talkinghead'], ' Character Expressions: toggles <i>Image Type - talkinghead (extras)</i> on/off.');
})();