Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixing Text Speed, Binding, and Soft Locks
New:
- Exported "tsParticles" for legacy support.

Fixes:
- Text speed can now be set from the settings slider.
- Text speed will now update text-box "typeSpeed" configuration. (Prior, even if you changed the text speed, it wouldn't update until refresh)
- "Message" actions will no longer soft lock the screen.
- Fixed a bug that caused the "AutoPlaySpeed" to change every time the player modified it and refreshed the game. (Upon refresh, it would always be the opposite of what they chose)
  • Loading branch information
MidZM committed Dec 28, 2025
commit 130d2b839f9d5d4e30fade839f5f082eaad430db
5 changes: 4 additions & 1 deletion src/actions/Dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ export class Dialog extends Action {
static override async bind(selector: string): Promise<void> {
// Add listener for the text speed setting (TypeWriter reads from preference directly)
$_(`${selector} [data-action="set-text-speed"]`).on('change mouseover', function (this: HTMLInputElement) {
const textbox = Dialog.engine.element().find('[data-component="text-box"] [data-component="type-writer"]').get(0) as TypeWriter | undefined;
const maxTextSpeed = Dialog.engine.setting('maxTextSpeed') as number;
const value = maxTextSpeed - parseInt(this.value);
const value = maxTextSpeed + parseInt(this.value);

Dialog.engine.preference('TextSpeed', value);
textbox?.setState({ config: { typeSpeed: value } });
});

// Detect scroll on the text element to remove the unread class used when
Expand Down
2 changes: 1 addition & 1 deletion src/actions/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class Message extends Action {
// The close action removes the active class from the element it
// points to.
this.engine.on('click', '[data-component="message-modal"] [data-action="close"]', () => {
Message.blocking = true;
Message.blocking = false;
this.engine.element().find('[data-component="message-modal"]').remove();
this.engine.proceed({ userInitiated: true, skip: false, autoPlay: false });
});
Expand Down
3 changes: 2 additions & 1 deletion src/components/settings-screen/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ class SettingsScreen extends ScreenComponent<Properties, ScreenState> {
}

const engine = this.engine;
const clamp = (num: number, min: number, max: number) => Math.min(Math.max(num, min), max);
this.content('auto-play-speed-controller').on('change mouseover', function(this: HTMLInputElement) {
const value = (engine.setting('MaxAutoPlaySpeed') as number) - parseInt(this.value);
const value = clamp(parseInt(this.value), 0, engine.setting('MaxAutoPlaySpeed') as number);
engine.preference('AutoPlaySpeed', value);
});

Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import '@fortawesome/fontawesome-free/js/all';

export * from '@aegis-framework/artemis';

export { tsParticles } from '@tsparticles/engine';

export * from '@tsparticles/slim';

export * as RandomJS from 'random-js';
Expand Down
15 changes: 12 additions & 3 deletions src/monogatari.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3439,7 +3439,7 @@ class Monogatari {
// auto-play feature
this.registerListener ('auto-play', {
callback: () => {
this.autoPlay (this.global ('_auto_play_timer') === null);
this.autoPlay (this.global ('_auto_play_timer') === undefined);
}
});

Expand Down Expand Up @@ -3517,6 +3517,15 @@ class Monogatari {
screenElement?.setState ({
open: true
});

// If auto play or skip were enabled, disable them.
if (this.global ('_auto_play_timer')) {
this.autoPlay (false);
}

if (this.global ('skip')) {
this.skip (false);
}
}

static hideScreens (): void {
Expand Down Expand Up @@ -3685,11 +3694,11 @@ class Monogatari {
const promises = [];

for (const component of this.components ()) {
promises.push (component.bind ());
promises.push (component.bind (selector));
}

for (const action of this.actions ()) {
promises.push (action.bind ());
promises.push (action.bind (selector));
}

return Promise.all (promises).then (() => {
Expand Down