diff --git a/desktop/resources/cursor.png b/desktop/resources/cursor.png index 5bd547e8..f80b5379 100644 Binary files a/desktop/resources/cursor.png and b/desktop/resources/cursor.png differ diff --git a/desktop/resources/cursor_light.png b/desktop/resources/cursor_light.png index 157f8f5a..cf8f23cf 100644 Binary files a/desktop/resources/cursor_light.png and b/desktop/resources/cursor_light.png differ diff --git a/desktop/src-common/advent/actions.clj b/desktop/src-common/advent/actions.clj index 96160ac3..1cc5f61c 100644 --- a/desktop/src-common/advent/actions.clj +++ b/desktop/src-common/advent/actions.clj @@ -101,12 +101,14 @@ (utils/save @~entities "autosave" "Autosave")))))))) (defn force-end [entities current-action key] - (do (put! (get-channel current-action) :end) + (do (when current-action + (put! (get-channel current-action) :end)) (screen! dialogue/talking-screen :stop-talk :id key) (-> entities (assoc-in [key :script-running?] false) (assoc-in [key :current] nil) - (assoc-in [key :started?] false)))) + (assoc-in [key :started?] false) + (assoc-in [key :channel] (chan))))) (defmacro get-unsaved-script [entities & forms] `(fn [starting-entities#] diff --git a/desktop/src-common/advent/screens/rooms/inside_castle.clj b/desktop/src-common/advent/screens/rooms/inside_castle.clj index 341319af..2dda3ce6 100644 --- a/desktop/src-common/advent/screens/rooms/inside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/inside_castle.clj @@ -345,6 +345,16 @@ (update-in [:room :entities] #(dissoc % :game-player :books)) add-monocle-if-necessary)) +(defn offer-solution [entities riddle] + (condp = (get-in @entities [:state :current-riddle]) + riddle true + :done (do (actions/do-dialogue entities :game-player "I've gotten all the help I need with riddles today.") + nil) + nil (do (actions/do-dialogue entities :game-player "Why are you offering me this?") + nil) + (do (actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking.") + nil))) + (defn make [screen] (let [sign (utils/make-anim-seq "inside-castle/sign" [44 20] 0.3 (flatten [(repeat 20 0) 1 0 2 0 1 0 2 0 1 0 2 0 1])) game-player-talk-sheet (texture! (utils/get-texture "inside-castle/game-player-talk.png") :split 40 44) @@ -549,7 +559,7 @@ :scripts #(condp = % :wool (actions/get-script entities (walk-to-player entities) - (if (= :wool (get-in @entities [:state :current-riddle])) + (when (offer-solution entities :wool) (do (actions/play-animation entities :ego :idea) (brian-pause-from-work entities) (actions/update-state entities (fn [s] (assoc s :current-riddle :balloon))) @@ -559,11 +569,10 @@ :game-player "Good job, Tick! Now for your second riddle:" :game-player "\"Filled with air, light as a feather,\nWant to keep it? Best have a tether.\"" :ego "Okay. Be back soon.") - (brian-get-to-work entities)) - (actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking."))) + (brian-get-to-work entities)))) :balloon (actions/get-script entities (walk-to-player entities) - (if (= :balloon (get-in @entities [:state :current-riddle])) + (when (offer-solution entities :baloon) (do (actions/play-animation entities :ego :idea) (brian-pause-from-work entities) (actions/update-state entities (fn [s] (assoc s :current-riddle :frog-legs))) @@ -573,30 +582,30 @@ :game-player "That's right, Tick! Now for your third riddle:" :game-player "\"Hippity-hop, I'd jump so high,\nWithout these springs, can't harm a fly.\"" :ego "Okay. Be back soon.") - (brian-get-to-work entities)) - (actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking."))) + (brian-get-to-work entities)))) :frog-legs (actions/get-script entities (walk-to-player entities) - (if (= :frog-legs (get-in @entities [:state :current-riddle])) - (do (actions/play-animation entities :ego :idea) - (brian-pause-from-work entities) - (actions/update-state entities (fn [s] (assoc s :current-riddle :done))) - - (actions/remove-item entities :frog-legs) - (actions/do-dialogue entities - :ego "What about these frog legs? They jump pretty far." - :game-player "Wow! That's right!" - :game-player "You, Tick, have proven yourself worthy of my trophy." - :game-player "Even I, Brian O'Brainy, am impressed with your wisdom." - :game-player "Take it, and go in wisdom.") - (actions/give entities :trophy) - (actions/remove-entity entities :trophy) - (actions/glad entities) - (actions/talk entities :ego "Thanks!") - (steam/set-achievement "WISE_UP") - ) - (actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking.")) + (when (offer-solution entities :frog-legs) + (if (= :frog-legs (get-in @entities [:state :current-riddle])) + (do (actions/play-animation entities :ego :idea) + (brian-pause-from-work entities) + (actions/update-state entities (fn [s] (assoc s :current-riddle :done))) + + (actions/remove-item entities :frog-legs) + (actions/do-dialogue entities + :ego "What about these frog legs? They jump pretty far." + :game-player "Wow! That's right!" + :game-player "You, Tick, have proven yourself worthy of my trophy." + :game-player "Even I, Brian O'Brainy, am impressed with your wisdom." + :game-player "Take it, and go in wisdom.") + (actions/give entities :trophy) + (actions/remove-entity entities :trophy) + (actions/glad entities) + (actions/talk entities :ego "Thanks!") + (steam/set-achievement "WISE_UP") + ) + )) (brian-get-to-work entities)) :trophy (actions/get-script entities (walk-to-player entities)