diff --git a/desktop/src-common/advent/actions.clj b/desktop/src-common/advent/actions.clj index f785a1f8..395d0b97 100644 --- a/desktop/src-common/advent/actions.clj +++ b/desktop/src-common/advent/actions.clj @@ -513,22 +513,24 @@ (skip-type [this screen entities] :none))) -(defn play-sound [entities sound-file] - (let [m (music sound-file)] - (run-action entities - (begin [this screen entities] - (music! m :play) - entities) +(defn play-sound + ([entities sound-file vol] + (let [s (sound sound-file)] + (run-action entities + (begin [this screen entities] + (utils/play-sound! screen entities s (constantly vol))) - (continue [this screen entities] entities) + (continue [this screen entities] entities) - (done? [this screen entities] - (not (music! m :is-playing))) + (done? [this screen entities] + (not (seq (filter + #(= s (:sound %)) + (get-in entities [:current-sounds :value]))))) - (terminate [this screen entities] - entities) - (skip-type [this screen entities] - :none)))) + (terminate [this screen entities] + entities) + (skip-type [this screen entities] + :none))))) (defn give [entities item] (run-action entities diff --git a/desktop/src-common/advent/screens/rooms/behind_house.clj b/desktop/src-common/advent/screens/rooms/behind_house.clj index c3b9d1ad..cc17f80c 100644 --- a/desktop/src-common/advent/screens/rooms/behind_house.clj +++ b/desktop/src-common/advent/screens/rooms/behind_house.clj @@ -75,7 +75,7 @@ (actions/play-animation entities :ego :start-squat :stop? false) (actions/talk entities :ego "I can see Gandarf, the wizard inside." :animate? false :stop? false) (actions/talk entities :ego "It looks like he's opening his Magi-safe." :animate? false :stop? false) - (actions/play-sound entities "safe-sound.ogg") + (actions/play-sound entities "safe-sound.ogg" 0.1) (actions/talk entities :ego "So that's the code to his safe..." :animate? false :stop? false) (actions/play-animation entities :ego :end-squat) (actions/talk entities :ego "A lot of good it'll do me to know his password while he's still there."))