hourglass when script cannot be ended.
This commit is contained in:
@@ -204,7 +204,7 @@ void main()
|
||||
(def default-interaction
|
||||
{:get-script (fn [cursor [x y]] (if (= :main cursor)
|
||||
(actions/get-script entities
|
||||
(actions/walk-to entities :ego [x y] :skip-type :skip))
|
||||
(actions/walk-to entities :ego [x y] :skip-type :end))
|
||||
(actions/get-script entities
|
||||
(actions/talk entities :ego "I don't know what to do with that."))))})
|
||||
|
||||
@@ -221,6 +221,24 @@ void main()
|
||||
(assoc-in [:cursor :override] nil)))
|
||||
(assoc-in entities [:cursor :current] :main))))
|
||||
|
||||
(defn skip-action [screen entities]
|
||||
(let [current-action (get-in entities [:actions :current])]
|
||||
(cond (= :skip (actions/skip-type current-action screen entities))
|
||||
(let [terminated-entities (actions/terminate current-action screen entities)]
|
||||
(do (put! (actions/get-channel current-action) terminated-entities)
|
||||
(-> terminated-entities
|
||||
(assoc-in [:actions :current] nil)
|
||||
(assoc-in [:actions :started?] false))))
|
||||
|
||||
(= :end (actions/skip-type current-action screen entities))
|
||||
(let [terminated-entities (actions/terminate current-action screen entities)]
|
||||
(do (put! (actions/get-channel current-action) :end)
|
||||
(-> terminated-entities
|
||||
(assoc-in [:actions :script-running?] false)
|
||||
(assoc-in [:actions :current] nil)
|
||||
(assoc-in [:actions :started?] false))))
|
||||
:else
|
||||
entities)))
|
||||
|
||||
(defn left-click [screen entities]
|
||||
(let [[x y] (utils/unproject screen)]
|
||||
@@ -238,13 +256,10 @@ void main()
|
||||
current-action (get-in entities [:actions :current])
|
||||
|
||||
;; TODO - hacky way of resetting queue
|
||||
entities (if (and current-action (= :skip (actions/skip-type current-action screen entities)))
|
||||
(let [terminated-entities (actions/terminate current-action screen entities)]
|
||||
(do (put! (actions/get-channel current-action) terminated-entities)
|
||||
(-> terminated-entities
|
||||
(assoc-in [:actions :current] nil)
|
||||
(assoc-in [:actions :started?] false))))
|
||||
entities)]
|
||||
|
||||
entities (if current-action
|
||||
(skip-action screen entities)
|
||||
entities)]
|
||||
|
||||
(if (get-in entities [:actions :script-running?])
|
||||
entities
|
||||
@@ -598,10 +613,12 @@ void main()
|
||||
(let [terminated (actions/terminate current screen entities)]
|
||||
(put! (actions/get-channel current) terminated)
|
||||
(recur screen (assoc terminated
|
||||
:actions {:channel channel :current nil :started? false :script-running? (get-in entities [:actions :script-running?])})))
|
||||
:actions {:channel channel :current nil :started? false :script-running? (get-in entities [:actions :script-running?]) :last-skip-type (get-in entities [:actions :last-skip-type])})))
|
||||
(assoc-in entities [:actions :started?] true)))
|
||||
(let [[current _] (alts!! [channel] :default nil)]
|
||||
(assoc entities :actions {:channel channel :current current :started? false :script-running? (get-in entities [:actions :script-running?])}))))
|
||||
(assoc entities :actions {:channel channel :current current :started? false :script-running? (get-in entities [:actions :script-running?]) :last-skip-type (if current
|
||||
(actions/skip-type current screen entities)
|
||||
(get-in entities [:actions :last-skip-type]))}))))
|
||||
|
||||
|
||||
(defn update-from-hotspots [screen entities]
|
||||
@@ -616,6 +633,8 @@ void main()
|
||||
(when-not (and (= new-current
|
||||
last)
|
||||
(= active was-active))
|
||||
(when (= :last :hourglass)
|
||||
(println new-current))
|
||||
(let [image-path (if active "cursor_light.png" "cursor.png")]
|
||||
(input! :set-cursor-image (utils/cursor image-path (or (:cursor new-current) new-current)) 0 0)))
|
||||
(assoc-in entities [:cursor :last] new-current)))
|
||||
|
||||
Reference in New Issue
Block a user