mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-02 02:47:52 +01:00
add /break value
This commit is contained in:
parent
8e90e2a0e4
commit
6193b6590e
@ -1,3 +1,7 @@
|
||||
import { SlashCommandExecutor } from './SlashCommandExecutor.js';
|
||||
|
||||
export class SlashCommandBreak extends SlashCommandExecutor {}
|
||||
export class SlashCommandBreak extends SlashCommandExecutor {
|
||||
get value() {
|
||||
return this.unnamedArgumentList[0]?.value;
|
||||
}
|
||||
}
|
||||
|
@ -218,6 +218,7 @@ export class SlashCommandClosure {
|
||||
console.log('encountered SlashCommandBreak');
|
||||
if (this.breakController) {
|
||||
this.breakController?.break();
|
||||
this.scope.pipe = step.value.value ?? this.scope.pipe;
|
||||
break;
|
||||
}
|
||||
} else if (!step.done && this.debugController?.testStepping(this)) {
|
||||
@ -260,6 +261,7 @@ export class SlashCommandClosure {
|
||||
yield executor;
|
||||
} else if (executor instanceof SlashCommandBreak) {
|
||||
done += this.executorList.length - this.executorList.indexOf(executor);
|
||||
this.scope.pipe = executor.value ?? this.scope.pipe;
|
||||
yield executor;
|
||||
} else {
|
||||
/**@type {import('./SlashCommand.js').NamedArguments} */
|
||||
|
@ -727,6 +727,10 @@ export class SlashCommandParser {
|
||||
cmd.command = this.commands['break'];
|
||||
cmd.start = this.index + 1;
|
||||
this.take('/break'.length);
|
||||
this.discardWhitespace();
|
||||
if (this.testUnnamedArgument()) {
|
||||
cmd.unnamedArgumentList.push(...this.parseUnnamedArgument());
|
||||
}
|
||||
cmd.end = this.index;
|
||||
this.commandIndex.push(cmd);
|
||||
this.scopeIndex.push(this.scope.getCopy());
|
||||
|
Loading…
x
Reference in New Issue
Block a user