diff --git a/desktop/src-common/advent/screens/rooms/dream.clj b/desktop/src-common/advent/screens/rooms/dream.clj index 3c1c431f..2b6823f1 100644 --- a/desktop/src-common/advent/screens/rooms/dream.clj +++ b/desktop/src-common/advent/screens/rooms/dream.clj @@ -272,18 +272,23 @@ :none))) (defn return-from-island [screen entities] + + (when (and (not (get-in entities [:actions :script-running?])) (get-in entities [:state :active?]) (get-in entities [:room :entities :fairy-godfather :distracted?])) - ((actions/get-script entities - (actions/update-entities entities (fn [e] (update-in e [:room :entities :fairy-godfather] dissoc :distracted?))) - (actions/walk-straight-to entities :fairy-godfather [240 120] :speed 3.0 :update-baseline? false :face :left) - (actions/update-entities entities (fn [e] (update-in e [:room :entities :fairy-godfather] assoc :path (catmull-rom-spline (map #(apply vector-2* %) [[240 120] [240 124]]) true)))) - (actions/do-dialogue entities - :fairy-godfather "Hey! I didn't see anything over there!" - :ego "Oh, yes, it must have flown off.")) - entities)) - nil) + (if (> (get-in entities [:room :entities :fairy-godfather :distracted-time] 0) 15) + (do + ((actions/get-script entities + (actions/update-entities entities (fn [e] (update-in e [:room :entities :fairy-godfather] dissoc :distracted?))) + (actions/walk-straight-to entities :fairy-godfather [240 120] :speed 3.0 :update-baseline? false :face :left) + (actions/update-entities entities (fn [e] (update-in e [:room :entities :fairy-godfather] assoc :path (catmull-rom-spline (map #(apply vector-2* %) [[240 120] [240 124]]) true)))) + (actions/do-dialogue entities + :fairy-godfather "Hey! I didn't see anything over there!" + :ego "Oh, yes, it must have flown off.")) + entities) + nil) + (update-in entities [:room :entities :fairy-godfather :distracted-time] (fnil inc 0))))) (defn distract [entities message subject] (actions/respond entities message @@ -297,7 +302,7 @@ :ego (str "Yes, that's it! There's a " subject " on that island!") :fairy-godfather "Let me go check it out.") (actions/update-entities entities (fn [e] (update-in e [:room :entities :fairy-godfather] dissoc :path))) - (actions/update-entities entities (fn [e] (update-in e [:room :entities :fairy-godfather] assoc :distracted? true))) + (actions/update-entities entities (fn [e] (update-in e [:room :entities :fairy-godfather] assoc :distracted? true :distracted-time 0))) (actions/walk-straight-to entities :fairy-godfather [211 210] :face :left)) (defn talk-to-fairy [entities] @@ -371,7 +376,7 @@ :ego "I can't bring myself to do it." :ego "It seems like misery!" :ego "Plus, how can I ever win the heart of my true love, Georgia McGorgeous?"))}}} - :timers {:return [15.0 15.0 return-from-island]} + :timers {:return [1.0 1.0 return-from-island]} :layers [(assoc (utils/get-texture "dream/clouds1.png") :x -10 :y 0 :baseline -1 :parallax 0.2 :scale-x 1.1 :scale-y 1.1) (assoc (utils/get-texture "dream/island.png") :x 180 :y 180 :baseline 0 :parallax 0.3 :scale-x 1.1 :scale-y 1.1) (assoc (utils/get-texture "dream/cliff.png") :x 50 :y 133 :baseline 1 :parallax 0.6 :scale-x 1.2 :scale-y 1.2)