the finally opened up to failure again.

This commit is contained in:
Bryce Covert
2015-08-14 21:53:07 -07:00
parent c181b4f7e6
commit 05600f7930
3 changed files with 20 additions and 16 deletions

View File

@@ -14,8 +14,6 @@
+ sometimes you can walk on stuff (like gandarf's door) + sometimes you can walk on stuff (like gandarf's door)
+ Should be able to put back or give back antique shops stuff + Should be able to put back or give back antique shops stuff
+ Computer cooks when I go in the wizards house
+ Some games you have to try multiple times (make a joke about the multi click puzzles)
+ putting out the candle in jail + putting out the candle in jail
+ lighting the hay on fire in jail + lighting the hay on fire in jail
+ mark the squeaky board a bit + mark the squeaky board a bit

View File

@@ -81,13 +81,10 @@
(put! (get-in starting-entities# [:actions :script-chan]) (put! (get-in starting-entities# [:actions :script-chan])
(fn [starting-entities#] (fn [starting-entities#]
(let [~entities (atom starting-entities#)] (let [~entities (atom starting-entities#)]
(thread (do (thread (do
(try ~@forms
~@forms (change-script-state ~entities false)
(finally (utils/save @~entities))))))))
(change-script-state ~entities false)
(utils/save @~entities)
)))))))))
(defmacro get-unsaved-script [entities & forms] (defmacro get-unsaved-script [entities & forms]
`(fn [starting-entities#] `(fn [starting-entities#]
@@ -95,10 +92,8 @@
(fn [starting-entities#] (fn [starting-entities#]
(let [~entities (atom starting-entities#)] (let [~entities (atom starting-entities#)]
(thread (do (thread (do
(try ~@forms
~@forms (change-script-state ~entities false))))))))
(finally
(change-script-state ~entities false))))))))))
(defn bound-to-camera [x length zoom] (defn bound-to-camera [x length zoom]
(min (- length (* length 0.5 zoom )) (min (- length (* length 0.5 zoom ))

View File

@@ -172,7 +172,9 @@
(:script %)) (:script %))
(get-in entities [:room :interactions]))))) (get-in entities [:room :interactions])))))
(defn hovering-ego [entities [x y]]
(when-let [mouse-in (get-in entities [:room :entities :ego :mouse-in?])]
(mouse-in entities x y)))
(defn remove-interaction [entities id] (defn remove-interaction [entities id]
(update-in entities [:room :interactions] (fn [i] (remove #(= id (:id %)) i)))) (update-in entities [:room :interactions] (fn [i] (remove #(= id (:id %)) i))))
@@ -249,7 +251,9 @@
mouse-override (find-override entities last-pos) mouse-override (find-override entities last-pos)
out-of-bounds (not (contains-point? (.getScreenX viewport) (.getScreenY viewport) out-of-bounds (not (contains-point? (.getScreenX viewport) (.getScreenY viewport)
(.getScreenWidth viewport) (.getScreenHeight viewport) (.getScreenWidth viewport) (.getScreenHeight viewport)
(first raw-pos) (last raw-pos)))] (first raw-pos) (last raw-pos)))
hovering-ego (hovering-ego entities last-pos)]
(cond (cond
out-of-bounds out-of-bounds
(update-in entities [:cursor] assoc :override nil :active false ) (update-in entities [:cursor] assoc :override nil :active false )
@@ -269,12 +273,19 @@
(-> entities (-> entities
(assoc-in [:cursor :override] nil) (assoc-in [:cursor :override] nil)
(assoc-in [:cursor :active] false)) (assoc-in [:cursor :active] false))
(and hovering-ego (not= :main (get-in entities [:cursor :current])))
(-> entities
(assoc-in [:cursor :override] (or (:cursor mouse-override) (when (#{:main :active-main} (get-in entities [:cursor :last])) :active-main)))
(assoc-in [:cursor :active] true))
mouse-override mouse-override
(-> entities (-> entities
(assoc-in [:cursor :override] (or (:cursor mouse-override) (when (#{:main :active-main} (get-in entities [:cursor :last])) :active-main))) (assoc-in [:cursor :override] (or (:cursor mouse-override) (when (#{:main :active-main} (get-in entities [:cursor :last])) :active-main)))
(assoc-in [:cursor :active] true)) (assoc-in [:cursor :active] true))
:else :else
(-> entities (-> entities
(assoc-in [:cursor :override] nil) (assoc-in [:cursor :override] nil)