background script pt 1

This commit is contained in:
Bryce Covert
2015-11-19 17:39:24 -08:00
parent 462abe747b
commit ff04d07a0f
8 changed files with 70 additions and 53 deletions

View File

@@ -50,7 +50,7 @@
(defmacro run-action [entities & forms]
`(let [c# (chan)]
(do
(put! (get-in (deref ~entities) [:actions :channel])
(put! (get-in (deref ~entities) [:fg-actions :channel])
(reify IAction
(get-channel [_] c#)
~@forms))
@@ -64,7 +64,7 @@
(defn change-script-state [entities state]
(run-action entities
(begin [this screen entities]
(update-in entities [:actions] assoc :script-running? state :last-skip-type (if state :end nil)))
(update-in entities [:fg-actions] assoc :script-running? state :last-skip-type (if state :end nil)))
(continue [this screen entities] entities)
@@ -78,7 +78,7 @@
(defmacro get-script [entities & forms]
`(fn [starting-entities#]
(put! (get-in starting-entities# [:actions :script-chan])
(put! (get-in starting-entities# [:fg-actions :script-chan])
(fn [starting-entities#]
(let [~entities (atom starting-entities#)]
(thread (do
@@ -88,7 +88,7 @@
(defmacro get-unsaved-script [entities & forms]
`(fn [starting-entities#]
(put! (get-in starting-entities# [:actions :script-chan])
(put! (get-in starting-entities# [:fg-actions :script-chan])
(fn [starting-entities#]
(let [~entities (atom starting-entities#)]
(thread (do