Apply clock announcement spatial range from server

This commit is contained in:
Jage9
2026-02-27 01:12:24 -05:00
parent 47a7aa0a83
commit 3b414b1f89
7 changed files with 12 additions and 8 deletions

View File

@@ -13,14 +13,14 @@ export class ClockAnnouncer {
private readonly getListenerPosition: ListenerPositionGetter,
) {}
async playSequence(sounds: string[], sourceX: number, sourceY: number): Promise<void> {
async playSequence(sounds: string[], sourceX: number, sourceY: number, range?: number): Promise<void> {
if (sounds.length === 0) return;
const token = ++this.playToken;
const effectiveRange = Number.isFinite(range) && (range as number) > 0 ? (range as number) : undefined;
for (const sound of sounds) {
if (token !== this.playToken) return;
const listener = this.getListenerPosition();
await this.audio.playSpatialSampleAndWait(sound, { x: sourceX, y: sourceY }, listener, 1);
await this.audio.playSpatialSampleAndWait(sound, { x: sourceX, y: sourceY }, listener, 1, effectiveRange);
}
}
}