mirror of
https://github.com/JulianGro/overte.git
synced 2025-07-13 15:17:40 +02:00
correct existing uses of the isPlaying property
This commit is contained in:
parent
ba77aaf7ef
commit
64720444cf
10 changed files with 155 additions and 157 deletions
|
@ -110,7 +110,7 @@ function updateBirds(deltaTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether to play a chirp
|
// Check whether to play a chirp
|
||||||
if (playSounds && (!birds[i].audioId || !birds[i].audioId.isPlaying) && (Math.random() < ((numPlaying > 0) ? SOUND_PROBABILITY / numPlaying : SOUND_PROBABILITY))) {
|
if (playSounds && (!birds[i].audioId || !birds[i].audioId.playing) && (Math.random() < ((numPlaying > 0) ? SOUND_PROBABILITY / numPlaying : SOUND_PROBABILITY))) {
|
||||||
var options = {
|
var options = {
|
||||||
position: properties.position,
|
position: properties.position,
|
||||||
volume: BIRD_MASTER_VOLUME
|
volume: BIRD_MASTER_VOLUME
|
||||||
|
@ -129,7 +129,7 @@ function updateBirds(deltaTime) {
|
||||||
|
|
||||||
} else if (birds[i].audioId) {
|
} else if (birds[i].audioId) {
|
||||||
// If bird is playing a chirp
|
// If bird is playing a chirp
|
||||||
if (!birds[i].audioId.isPlaying) {
|
if (!birds[i].audioId.playing) {
|
||||||
Entities.editEntity(birds[i].entityId, { dimensions: { x: BIRD_SIZE, y: BIRD_SIZE, z: BIRD_SIZE }});
|
Entities.editEntity(birds[i].entityId, { dimensions: { x: BIRD_SIZE, y: BIRD_SIZE, z: BIRD_SIZE }});
|
||||||
numPlaying--;
|
numPlaying--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,7 @@ function EntityDatum(entityIdentifier) { // Just the data of an entity that we n
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
that.injector.setOptions(options); // PLAYING => UPDATE POSITION ETC
|
that.injector.setOptions(options); // PLAYING => UPDATE POSITION ETC
|
||||||
if (!that.injector.isPlaying) { // Subtle: a looping sound will not check playbackGap.
|
if (!that.injector.playing) { // Subtle: a looping sound will not check playbackGap.
|
||||||
if (repeat()) { // WAITING => PLAYING
|
if (repeat()) { // WAITING => PLAYING
|
||||||
// Setup next play just once, now. Changes won't be looked at while we wait.
|
// Setup next play just once, now. Changes won't be looked at while we wait.
|
||||||
that.playAfter = randomizedNextPlay();
|
that.playAfter = randomizedNextPlay();
|
||||||
|
@ -208,7 +208,7 @@ function updateAllEntityData() { // A fast update of all entities we know about.
|
||||||
stats.entities++;
|
stats.entities++;
|
||||||
if (datum.url) {
|
if (datum.url) {
|
||||||
stats.sounds++;
|
stats.sounds++;
|
||||||
if (datum.injector && datum.injector.isPlaying) {
|
if (datum.injector && datum.injector.playing) {
|
||||||
stats.playing++;
|
stats.playing++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,7 +395,7 @@ function update(deltaTime) {
|
||||||
Overlays.editOverlay(descriptionText, { position: textOverlayPosition() });
|
Overlays.editOverlay(descriptionText, { position: textOverlayPosition() });
|
||||||
|
|
||||||
// if the reticle is up then we may need to play the next muzak
|
// if the reticle is up then we may need to play the next muzak
|
||||||
if (currentMuzakInjector && !currentMuzakInjector.isPlaying) {
|
if (currentMuzakInjector && !currentMuzakInjector.playing) {
|
||||||
playNextMuzak();
|
playNextMuzak();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ var CHATTER_VOLUME = 0.20
|
||||||
var EXTRA_VOLUME = 0.25
|
var EXTRA_VOLUME = 0.25
|
||||||
|
|
||||||
function playChatter() {
|
function playChatter() {
|
||||||
if (chatter.downloaded && !chatter.isPlaying) {
|
if (chatter.downloaded && !chatter.playing) {
|
||||||
Audio.playSound(chatter, { loop: true, volume: CHATTER_VOLUME });
|
Audio.playSound(chatter, { loop: true, volume: CHATTER_VOLUME });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ chatter.ready.connect(playChatter);
|
||||||
var currentInjector = null;
|
var currentInjector = null;
|
||||||
|
|
||||||
function playRandomExtras() {
|
function playRandomExtras() {
|
||||||
if ((!currentInjector || !currentInjector.isPlaying) && (Math.random() < (1.0 / 1800.0))) {
|
if ((!currentInjector || !currentInjector.playing) && (Math.random() < (1.0 / 1800.0))) {
|
||||||
// play a random extra sound about every 30s
|
// play a random extra sound about every 30s
|
||||||
currentInjector = Audio.playSound(
|
currentInjector = Audio.playSound(
|
||||||
extras[Math.floor(Math.random() * extras.length)],
|
extras[Math.floor(Math.random() * extras.length)],
|
||||||
|
|
|
@ -106,7 +106,7 @@ function checkHands(deltaTime) {
|
||||||
var chord = Controller.getValue(chordTrigger);
|
var chord = Controller.getValue(chordTrigger);
|
||||||
|
|
||||||
if (volume > 1.0) volume = 1.0;
|
if (volume > 1.0) volume = 1.0;
|
||||||
if ((chord > 0.1) && audioInjector && audioInjector.isPlaying) {
|
if ((chord > 0.1) && audioInjector && audioInjector.playing) {
|
||||||
// If chord finger trigger pulled, stop current chord
|
// If chord finger trigger pulled, stop current chord
|
||||||
print("stopping chord because cord trigger pulled");
|
print("stopping chord because cord trigger pulled");
|
||||||
audioInjector.stop();
|
audioInjector.stop();
|
||||||
|
@ -160,7 +160,7 @@ function checkHands(deltaTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopAudio(killInjector) {
|
function stopAudio(killInjector) {
|
||||||
if (audioInjector && audioInjector.isPlaying) {
|
if (audioInjector && audioInjector.playing) {
|
||||||
print("stopped sound");
|
print("stopped sound");
|
||||||
audioInjector.stop();
|
audioInjector.stop();
|
||||||
}
|
}
|
||||||
|
@ -212,4 +212,3 @@ function scriptEnding() {
|
||||||
Script.update.connect(checkHands);
|
Script.update.connect(checkHands);
|
||||||
Script.scriptEnding.connect(scriptEnding);
|
Script.scriptEnding.connect(scriptEnding);
|
||||||
Controller.keyPressEvent.connect(keyPressEvent);
|
Controller.keyPressEvent.connect(keyPressEvent);
|
||||||
|
|
||||||
|
|
|
@ -340,7 +340,7 @@ function moveRats() {
|
||||||
var metaRat = getMetaRatByRat(rat);
|
var metaRat = getMetaRatByRat(rat);
|
||||||
if (metaRat !== undefined) {
|
if (metaRat !== undefined) {
|
||||||
if (metaRat.injector !== undefined) {
|
if (metaRat.injector !== undefined) {
|
||||||
if (metaRat.injector.isPlaying === true) {
|
if (metaRat.injector.playing === true) {
|
||||||
metaRat.injector.options = {
|
metaRat.injector.options = {
|
||||||
loop: true,
|
loop: true,
|
||||||
position: ratPosition
|
position: ratPosition
|
||||||
|
|
|
@ -186,7 +186,7 @@
|
||||||
|
|
||||||
this.move = function(mouseEvent) {
|
this.move = function(mouseEvent) {
|
||||||
this.updatePosition(mouseEvent);
|
this.updatePosition(mouseEvent);
|
||||||
if (this.moveInjector === null || !this.moveInjector.isPlaying) {
|
if (this.moveInjector === null || !this.moveInjector.playing) {
|
||||||
this.playMoveSound();
|
this.playMoveSound();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -245,7 +245,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.turnInjector === null || !this.turnInjector.isPlaying) {
|
if (this.turnInjector === null || !this.turnInjector.playing) {
|
||||||
this.playTurnSound();
|
this.playTurnSound();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -75,7 +75,7 @@ function maybePlaySound(deltaTime) {
|
||||||
//print("number playing = " + numPlaying);
|
//print("number playing = " + numPlaying);
|
||||||
}
|
}
|
||||||
for (var i = 0; i < playing.length; i++) {
|
for (var i = 0; i < playing.length; i++) {
|
||||||
if (!playing[i].audioId.isPlaying) {
|
if (!playing[i].audioId.playing) {
|
||||||
Entities.deleteEntity(playing[i].entityId);
|
Entities.deleteEntity(playing[i].entityId);
|
||||||
if (useLights) {
|
if (useLights) {
|
||||||
Entities.deleteEntity(playing[i].lightId);
|
Entities.deleteEntity(playing[i].lightId);
|
||||||
|
|
|
@ -378,7 +378,7 @@ function update(deltaTime) {
|
||||||
Overlays.editOverlay(descriptionText, { position: textOverlayPosition() });
|
Overlays.editOverlay(descriptionText, { position: textOverlayPosition() });
|
||||||
|
|
||||||
// if the reticle is up then we may need to play the next muzak
|
// if the reticle is up then we may need to play the next muzak
|
||||||
if (currentMuzakInjector && !currentMuzakInjector.isPlaying) {
|
if (currentMuzakInjector && !currentMuzakInjector.playing) {
|
||||||
playNextMuzak();
|
playNextMuzak();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ function checkSound(deltaTime) {
|
||||||
volume: 1.0,
|
volume: 1.0,
|
||||||
loop: false } );
|
loop: false } );
|
||||||
started = true;
|
started = true;
|
||||||
} else if (!soundPlaying.isPlaying) {
|
} else if (!soundPlaying.playing) {
|
||||||
soundPlaying.restart();
|
soundPlaying.restart();
|
||||||
started = true;
|
started = true;
|
||||||
}
|
}
|
||||||
|
@ -93,4 +93,3 @@ function scriptEnding() {
|
||||||
// Connect a call back that happens every frame
|
// Connect a call back that happens every frame
|
||||||
Script.scriptEnding.connect(scriptEnding);
|
Script.scriptEnding.connect(scriptEnding);
|
||||||
Script.update.connect(checkSound);
|
Script.update.connect(checkSound);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue