multiple scritps, pt 3

This commit is contained in:
Bryce Covert
2015-11-19 18:51:05 -08:00
parent 5b12127ae3
commit 3c1d0171c9
3 changed files with 26 additions and 18 deletions

View File

@@ -102,6 +102,7 @@
(defn force-end [entities current-action key]
(do (put! (get-channel current-action) :end)
(screen! dialogue/talking-screen :stop-talk :id key)
(-> entities
(assoc-in [key :script-running?] false)
(assoc-in [key :current] nil)
@@ -386,7 +387,8 @@
(defn talk [entities target-id text & {:keys [stop? animate? anim wait color] :or {wait true}}]
(let [initial-time (atom nil)
stop? (if (nil? stop?) true stop?)
animate? (if (nil? animate?) true animate?)]
animate? (if (nil? animate?) true animate?)
fg-or-bg *fg-bg-key*]
(run-action entities
(begin [this screen entities]
(let [_ (swap! initial-time #(or % (:total-time screen)))
@@ -403,6 +405,7 @@
scale (get-in entities [:room :entities target-id :scale-y] 1)
height (* scale height)]
(screen! dialogue/talking-screen :on-talk :text text
:id fg-or-bg
:scene-viewport (:viewport screen)
:x target-x :y (+ target-y height)
:color (or color (get-in entities [:room :entities target-id :talk-color]))
@@ -425,7 +428,7 @@
(terminate [this screen entities]
(if wait
(do
(screen! dialogue/talking-screen :stop-talk :target-id target-id)
(screen! dialogue/talking-screen :stop-talk :id fg-or-bg)
(if stop?
(stop screen entities target-id)
entities))
@@ -691,7 +694,7 @@
entities)))
(skip-type [this screen entities]
:none))
(screen! dialogue/talking-screen :stop-talk)
(screen! dialogue/talking-screen :stop-talk :id :bg-actions)
(run-action entities
(begin [this screen entities]
(utils/stop-all-sounds! entities)