From 197a1d92cfa29f01a1f26139a08a3e54ab7769e1 Mon Sep 17 00:00:00 2001 From: stonedDiscord <10584181+stonedDiscord@users.noreply.github.com> Date: Sat, 12 Sep 2020 20:55:13 +0200 Subject: enable looping sfx oh god what have i done --- webAO/client.js | 9 +++++---- 1 file 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; -- cgit