Skip to content

Commit

Permalink
[CHORE] Check for mute in container
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerdezartsmith committed Jul 31, 2024
1 parent 99aa47f commit 4717f07
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/features/world/containers/BumpkinContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import { InventoryItemName } from "features/game/types/game";
import { ITEM_DETAILS } from "features/game/types/images";
import { ITEM_IDS } from "features/game/types/bumpkin";
import { CONFIG } from "lib/config";
import {
AudioLocalStorageKeys,
getCachedAudioSetting,
} from "features/game/lib/audio";

const NAME_ALIASES: Partial<Record<NPCName, string>> = {
"pumpkin' pete": "pete",
Expand Down Expand Up @@ -691,7 +695,14 @@ export class BumpkinContainer extends Phaser.GameObjects.Container {
) {
try {
this.sprite.anims.play(this.digAnimationKey as string, true);
this.scene.sound.play("dig", { volume: 0.1 });
const audioMuted = getCachedAudioSetting<boolean>(
AudioLocalStorageKeys.audioMuted,
false,
);

if (!audioMuted) {
this.scene.sound.play("dig", { volume: 0.1 });
}
} catch (e) {
// eslint-disable-next-line no-console
console.log("Bumpkin Container: Error playing dig animation: ", e);
Expand All @@ -707,7 +718,14 @@ export class BumpkinContainer extends Phaser.GameObjects.Container {
) {
try {
this.sprite.anims.play(this.drillAnimationKey as string, true);
this.scene.sound.play("drill", { volume: 0.1 });
const audioMuted = getCachedAudioSetting<boolean>(
AudioLocalStorageKeys.audioMuted,
false,
);

if (!audioMuted) {
this.scene.sound.play("drill", { volume: 0.1 });
}
} catch (e) {
// eslint-disable-next-line no-console
console.log("Bumpkin Container: Error playing drill animation: ", e);
Expand Down

0 comments on commit 4717f07

Please sign in to comment.