Skip to content

Commit 0aecd4d

Browse files
committed
fix: play music on interact
1 parent ed32d84 commit 0aecd4d

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# UnderScript Changelog
22

3+
## Version 0.56.2 (2024-03-31)
4+
1. Fixed broken sound code
5+
1. Fixed broken backgrounds
6+
37
## Version 0.56.1 (2024-01-21)
48
1. Add support for older browsers
59

src/base/game/restoreSound.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@ import * as settings from '../../utils/settings/index.js';
33
import { global } from '../../utils/global.js';
44

55
// Restore sound on refresh
6-
eventManager.on('getReconnection connect', () => {
7-
if (settings.value('gameMusicDisabled')) return;
6+
eventManager.once('getReconnection connect', () => {
87
let playing = false;
9-
const music = global('music');
10-
music.addEventListener('play', () => {
8+
global('music').addEventListener('play', () => {
119
playing = true;
1210
});
1311
function restoreSound() {
14-
if (playing) return;
15-
music.play();
12+
if (playing || settings.value('gameMusicDisabled')) return;
13+
global('music').play();
1614
}
1715
document.addEventListener('click', restoreSound, { once: true, passive: true });
1816
});

0 commit comments

Comments
 (0)