diff --git a/desktop/resources/castle-gate/stash-closed.png b/desktop/resources/castle-gate/stash-closed.png new file mode 100644 index 00000000..f4013b45 Binary files /dev/null and b/desktop/resources/castle-gate/stash-closed.png differ diff --git a/desktop/resources/outside-jail/open-stash.png b/desktop/resources/outside-jail/open-stash.png index 1369c725..9d21e4d3 100644 Binary files a/desktop/resources/outside-jail/open-stash.png and b/desktop/resources/outside-jail/open-stash.png differ diff --git a/desktop/resources/outside-jail/open-stash.pxa/0.pxi b/desktop/resources/outside-jail/open-stash.pxa/0.pxi new file mode 100644 index 00000000..d281b26a Binary files /dev/null and b/desktop/resources/outside-jail/open-stash.pxa/0.pxi differ diff --git a/desktop/resources/outside-jail/open-stash.pxa/1.pxi b/desktop/resources/outside-jail/open-stash.pxa/1.pxi new file mode 100644 index 00000000..da50a8c4 Binary files /dev/null and b/desktop/resources/outside-jail/open-stash.pxa/1.pxi differ diff --git a/desktop/resources/outside-jail/open-stash.pxa/2.pxi b/desktop/resources/outside-jail/open-stash.pxa/2.pxi new file mode 100644 index 00000000..26cce9ca Binary files /dev/null and b/desktop/resources/outside-jail/open-stash.pxa/2.pxi differ diff --git a/desktop/resources/outside-jail/open-stash.pxa/3.pxi b/desktop/resources/outside-jail/open-stash.pxa/3.pxi new file mode 100644 index 00000000..a9666a22 Binary files /dev/null and b/desktop/resources/outside-jail/open-stash.pxa/3.pxi differ diff --git a/desktop/resources/outside-jail/open-stash.pxa/4.pxi b/desktop/resources/outside-jail/open-stash.pxa/4.pxi new file mode 100644 index 00000000..04e4e8f2 Binary files /dev/null and b/desktop/resources/outside-jail/open-stash.pxa/4.pxi differ diff --git a/desktop/resources/outside-jail/open-stash.pxa/CelData.plist b/desktop/resources/outside-jail/open-stash.pxa/CelData.plist new file mode 100644 index 00000000..1ff35422 --- /dev/null +++ b/desktop/resources/outside-jail/open-stash.pxa/CelData.plist @@ -0,0 +1,26 @@ + + + + + + duration + 1 + + + duration + 1 + + + duration + 1 + + + duration + 1 + + + duration + 1 + + + diff --git a/desktop/resources/outside-jail/rope.png b/desktop/resources/outside-jail/rope.png new file mode 100644 index 00000000..7e2057de Binary files /dev/null and b/desktop/resources/outside-jail/rope.png differ diff --git a/desktop/src-common/advent/screens/rooms/outside_jail.clj b/desktop/src-common/advent/screens/rooms/outside_jail.clj index 3995d180..ea654faf 100644 --- a/desktop/src-common/advent/screens/rooms/outside_jail.clj +++ b/desktop/src-common/advent/screens/rooms/outside_jail.clj @@ -22,12 +22,20 @@ (assoc-in entities [:room :entities :watch] (get-in entities [:room :watch])) entities)) +(defn add-rope-if-necessary [entities] + (if (and (actions/has-obtained? entities :rope) + (not (actions/has-item? entities :rope)) + (get-in entities [:state :knows-about-stash?])) + (assoc-in entities [:room :entities :rope] (get-in entities [:room :rope])) + entities)) + (defn make-night [entities] (-> entities (assoc-in [:room :entities :guard] (get-in entities [:room :guard])) add-spear-if-necessary add-watch-if-necessary - (assoc-in [:room :entities :stash] (get-in entities [:room :stash])))) + (assoc-in [:room :entities :stash] (get-in entities [:room :stash])) + add-rope-if-necessary)) (defn search-guard [entities] (actions/walk-to entities :ego [121 75] :face :left) @@ -46,14 +54,38 @@ (actions/give entities :spear) (actions/talk entities :ego "I guess he won't need this anymore.")) +(defn interact-with-lever [entities] + (cond (get-in @entities [:room :entities :rope]) + (do (actions/walk-to entities :ego [48 36] :face :left) + (actions/play-animation entities :ego :reach) + (actions/give entities :rope) + (actions/remove-entity entities :rope)) + (get-in @entities [:state :knows-about-stash?]) + (do + (actions/walk-to entities :ego [48 36] :face :left) + (actions/play-animation entities :ego :reach-start :stop? false) + (actions/play-animation entities :stash :open :stop? false) + (Thread/sleep 500) + (actions/play-animation entities :ego :reach-stop :stop? false) + (actions/play-animation entities :stash :close :stop? false) + (actions/talk entities :ego "That trapdoor closes as soon as I let the lever go!")))) + +(defn try-to-go-in-stash [entities] + (when (get-in @entities [:room :entities :rope]) + (actions/walk-to entities :ego [167 100] :face :right) + (actions/talk entities :ego "Here goes nothing!") + (actions/play-animation entities :ego :squat) + (actions/play-animation entities :stash :open :stop? false) + (actions/walk-straight-to entities :ego [212 97]))) + (defn make [screen] (let [fountain (utils/make-anim "outside-jail/fountain.png" [42 50] 0.2 (range 3)) guard-sheet (texture! (texture "inside-cafeteria/ladder-guard.png") :split 37 87) guard-stand (animation 0.1 [(aget guard-sheet 0 0)]) guard-talk (animation 0.2 (for [i [0 0 0 0 1 0 0 1]] (aget guard-sheet 0 i))) guard-sleep (utils/make-anim "outside-jail/guard-sleep.png" [43 67] 0.1 (range 4)) - open-stash (animation 0.1 [(texture "outside-jail/closed-stash.png") (texture "outside-jail/open-stash.png")]) - close-stash (animation 0.1 [(texture "outside-jail/open-stash.png") (texture "outside-jail/closed-stash.png")])] + open-stash (utils/make-anim "outside-jail/open-stash.png" [58 41] 0.075 (reverse (range 5))) + close-stash (utils/make-anim "outside-jail/open-stash.png" [58 41] 0.075 (range 5))] (rooms/make :music {:day :town-1 :night :night} :interactions {:down-dir {:box [30 0 227 20] :script (actions/get-script entities @@ -113,14 +145,15 @@ (actions/give entities :broken-watch)))}} :lever {:box [10 72 17 85] :script (actions/get-script entities - (when (get-in @entities [:state :knows-about-stash?]) - (actions/walk-to entities :ego [48 36] :face :left) - (actions/play-animation entities :ego :reach-start :stop? false) - (actions/play-animation entities :stash :open :stop? false) - (Thread/sleep 500) - (actions/play-animation entities :ego :reach-stop :stop? false) - (actions/play-animation entities :stash :close :stop? false) - (actions/talk entities :ego "That trapdoor closes as soon as I let the lever go!")))}} + (interact-with-lever entities)) + :scripts {:rope (actions/get-script entities + (when (get-in @entities [:state :knows-about-stash?]) + (actions/walk-to entities :ego [48 36] :face :left) + (actions/play-animation entities :ego :reach) + (actions/remove-item entities :rope) + (actions/add-entity entities :rope (get-in @entities [:room :rope]))))}} + :end-of-rope {:box [177 101 185 108] + :script (actions/get-script entities (try-to-go-in-stash entities))}} :layers {:day [(assoc (texture "outside-jail/background.png") :x 0 :y 0 :baseline 0)] :night [(assoc (texture "outside-jail/background-dark.png") :x 0 :y 0 :baseline 0)]} :entities {:fountain (assoc (animation->texture screen fountain) @@ -151,6 +184,8 @@ :talk guard-talk :sleep guard-sleep :script (actions/get-script entities (search-guard entities)))) + :rope (rooms/make-entity :rope (assoc (texture "outside-jail/rope.png") + :x 14 :y 20 :baseline 1)) :spear (rooms/make-entity :spear (assoc (texture "outside-jail/spear.png") :x 60 :y 65 :baseline 180 :script (actions/get-script entities (grab-spear entities))))