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)
+ 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
+ lighting the hay on fire in jail
+ mark the squeaky board a bit

View File

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

View File

@@ -172,7 +172,9 @@
(:script %))
(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]
(update-in entities [:room :interactions] (fn [i] (remove #(= id (:id %)) i))))
@@ -249,7 +251,9 @@
mouse-override (find-override entities last-pos)
out-of-bounds (not (contains-point? (.getScreenX viewport) (.getScreenY 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
out-of-bounds
(update-in entities [:cursor] assoc :override nil :active false )
@@ -269,12 +273,19 @@
(-> entities
(assoc-in [:cursor :override] nil)
(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
(-> 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))
:else
(-> entities
(assoc-in [:cursor :override] nil)