Jester and coilhead sounds

This commit is contained in:
2026-11-22 07:54:31 -03:00
parent 8e587f6446
commit da44685f54
31 changed files with 249 additions and 62 deletions
+7 -6
View File
@@ -163,12 +163,10 @@ export class Sounds {
const at = options.follow !== undefined ? this.#entity_position(options.follow) : options.at;
const playing = new Playing(json, file, { ...options }, this.clock(), at && { ...at });
// an entity this client doesn't have can't be followed
if (options.follow !== undefined && !at) {
playing.done = true;
return playing;
}
this.#playing.push(playing);
// an entity this client doesn't have yet, like one whose animator is being made, has until the next frame to
// turn up
if (options.follow !== undefined && !at) return playing;
this.#start(playing);
if (!playing.voice && !options.loop) playing.done = true;
return playing;
@@ -205,7 +203,10 @@ export class Sounds {
}
this.#playing = this.#playing.filter((playing) => !playing.done);
for (const playing of this.#playing) {
if (!playing.voice) this.#start(playing);
if (playing.voice) continue;
this.#start(playing);
// one waiting for its entity that can't play now never will
if (!playing.voice && !playing.options.loop) playing.done = true;
}
}