first stateful interaction.

This commit is contained in:
=
2014-09-15 20:31:30 -07:00
parent 01c5c91f66
commit c5cbb7387e
2 changed files with 23 additions and 1 deletions

View File

@@ -125,3 +125,21 @@
(run! dialogue/talking-screen :stop-talk :target-id target-id)
(stop screen entities target-id))))
(<!! c)))
(defn give [entities target-id item]
(let [c (chan)]
(put! (get-in entities [:actions :channel])
(reify
IAction
(begin [this screen entities]
(update-in entities [target-id :inventory] #(conj % item)))
(continue [this screen entities] entities)
(done? [this screen entities]
true)
(terminate [this screen entities]
(put! c entities)
entities)))
(<!! c)))