From 182216e711ad4e475ed9cd62cda3052c9b34ab7b Mon Sep 17 00:00:00 2001
From: Cohee <18619528+Cohee1207@users.noreply.github.com>
Date: Thu, 14 Sep 2023 18:37:13 +0300
Subject: [PATCH] /costume slash command
---
public/scripts/extensions/expressions/index.js | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/public/scripts/extensions/expressions/index.js b/public/scripts/extensions/expressions/index.js
index f799c7fec..a10e66c6b 100644
--- a/public/scripts/extensions/expressions/index.js
+++ b/public/scripts/extensions/expressions/index.js
@@ -710,6 +710,18 @@ async function sendExpressionCall(name, expression, force, vnMode) {
}
}
+async function setSpriteSetCommand(_, folder) {
+ if (!folder) {
+ console.log('Clearing sprite set');
+ folder = '';
+ }
+
+ $("#expression_override").val(folder.trim());
+ onClickExpressionOverrideButton();
+ removeExpression();
+ moduleWorker();
+}
+
async function setSpriteSlashCommand(_, spriteId) {
if (!spriteId) {
console.log('No sprite id provided');
@@ -1360,4 +1372,5 @@ function setExpressionOverrideHtml(forceClear = false) {
eventSource.on(event_types.MOVABLE_PANELS_RESET, updateVisualNovelModeDebounced);
eventSource.on(event_types.GROUP_UPDATED, updateVisualNovelModeDebounced);
registerSlashCommand('sprite', setSpriteSlashCommand, ['emote'], 'spriteId – force sets the sprite for the current character', true, true);
+ registerSlashCommand('spriteoverride', setSpriteSetCommand, ['costume'], 'folder – sets an override sprite folder for the current character. Empty value to reset to default.', true, true);
})();