aboutsummaryrefslogtreecommitdiff
path: root/webAO/client.js
diff options
context:
space:
mode:
authorstonedDiscord <10584181+stonedDiscord@users.noreply.github.com>2020-09-12 20:55:13 +0200
committerstonedDiscord <10584181+stonedDiscord@users.noreply.github.com>2020-09-12 20:55:13 +0200
commit197a1d92cfa29f01a1f26139a08a3e54ab7769e1 (patch)
treee4e621efdf9467b7e1d41714d01589d2ea258213 /webAO/client.js
parent6b2bdb25496d132f6730180bd6e4641c1bfb7c6e (diff)
enable looping sfx
oh god what have i done
Diffstat (limited to 'webAO/client.js')
-rw-r--r--webAO/client.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/webAO/client.js b/webAO/client.js
index 4127a5d..f196dac 100644
--- a/webAO/client.js
+++ b/webAO/client.js
@@ -1526,8 +1526,9 @@ class Viewport {
*
* @param {string} sfxname
*/
- async playSFX(sfxname) {
+ async playSFX(sfxname, looping) {
this.sfxaudio.pause();
+ this.sfxaudio.loop = looping;
this.sfxaudio.src = sfxname;
this.sfxaudio.play();
}
@@ -1975,12 +1976,12 @@ async changeBackground(position) {
// Effect stuff
if (this.chatmsg.screenshake === 1) {
// Shake screen
- this.playSFX(AO_HOST + "sounds/general/sfx-stab.wav");
+ this.playSFX(AO_HOST + "sounds/general/sfx-stab.wav", false);
gamewindow.style.animation = "shake 0.2s 1";
}
if (this.chatmsg.flash === 1) {
// Flash screen
- this.playSFX(AO_HOST + "sounds/general/sfx-realization.wav");
+ this.playSFX(AO_HOST + "sounds/general/sfx-realization.wav", false);
effectlayer.style.animation = "flash 0.4s 1";
}
@@ -2091,7 +2092,7 @@ async changeBackground(position) {
if (!this.sfxplayed && this.chatmsg.snddelay + this.shoutTimer >= this.textTimer) {
this.sfxplayed = 1;
if (this.chatmsg.sound !== "0" && this.chatmsg.sound !== "1" && this.chatmsg.sound !== "" && this.chatmsg.sound !== undefined) {
- this.playSFX(AO_HOST + "sounds/general/" + encodeURI(this.chatmsg.sound.toLowerCase()) + ".wav");
+ this.playSFX(AO_HOST + "sounds/general/" + encodeURI(this.chatmsg.sound.toLowerCase()) + ".wav", this.chatmsg.looping_sfx);
}
}
this.textTimer = this.textTimer + UPDATE_INTERVAL;