mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 04:18:12 +02:00
fix for restart API in lobby script
This commit is contained in:
parent
060b0bbfd6
commit
5715642e04
1 changed files with 24 additions and 20 deletions
|
@ -179,6 +179,26 @@ function changeLobbyTextures() {
|
||||||
|
|
||||||
var MUZAK_VOLUME = 0.1;
|
var MUZAK_VOLUME = 0.1;
|
||||||
|
|
||||||
|
function playCurrentSound(secondOffset) {
|
||||||
|
if (currentSound == latinSound) {
|
||||||
|
if (!latinInjector) {
|
||||||
|
latinInjector = Audio.playSound(latinSound, { localOnly: true, secondOffset: secondOffset, volume: MUZAK_VOLUME });
|
||||||
|
} else {
|
||||||
|
latinInjector.restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
currentMuzakInjector = latinInjector;
|
||||||
|
} else if (currentSound == elevatorSound) {
|
||||||
|
if (!elevatorInjector) {
|
||||||
|
elevatorInjector = Audio.playSound(elevatorSound, { localOnly: true, secondOffset: secondOffset, volume: MUZAK_VOLUME });
|
||||||
|
} else {
|
||||||
|
elevatorInjector.restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
currentMuzakInjector = elevatorInjector;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function playNextMuzak() {
|
function playNextMuzak() {
|
||||||
if (panelWall) {
|
if (panelWall) {
|
||||||
if (currentSound == latinSound) {
|
if (currentSound == latinSound) {
|
||||||
|
@ -190,8 +210,8 @@ function playNextMuzak() {
|
||||||
currentSound = latinSound;
|
currentSound = latinSound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
currentMuzakInjector = Audio.playSound(currentSound, { localOnly: true, volume: MUZAK_VOLUME });
|
playCurrentSound(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,27 +226,11 @@ function playRandomMuzak() {
|
||||||
currentSound = elevatorSound;
|
currentSound = elevatorSound;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentSound) {
|
if (currentSound) {
|
||||||
// pick a random number of seconds from 0-10 to offset the muzak
|
// pick a random number of seconds from 0-10 to offset the muzak
|
||||||
var secondOffset = Math.random() * 10;
|
var secondOffset = Math.random() * 10;
|
||||||
|
|
||||||
if (currentSound == latinSound) {
|
playCurrentSound(secondOffset);
|
||||||
if (!latinInjector) {
|
|
||||||
latinInjector = Audio.playSound(latinSound, { localOnly: true, secondOffset: secondOffset, volume: MUZAK_VOLUME });
|
|
||||||
} else {
|
|
||||||
latinInjector.restart();
|
|
||||||
}
|
|
||||||
|
|
||||||
currentMuzakInjector = latinInjector;
|
|
||||||
} else if (currentSound == elevatorSound) {
|
|
||||||
if (!elevatorInjector) {
|
|
||||||
elevatorInjector = Audio.playSound(elevatorSound, { localOnly: true, secondOffset: secondOffset, volume: MUZAK_VOLUME });
|
|
||||||
} else {
|
|
||||||
elevatorInjector.restart();
|
|
||||||
}
|
|
||||||
|
|
||||||
currentMuzakInjector = elevatorInjector;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
currentMuzakInjector = null;
|
currentMuzakInjector = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue