more good progress with inventory

This commit is contained in:
2016-07-28 19:59:14 -07:00
parent d857ae0511
commit aa081fa2ac
2 changed files with 80 additions and 2 deletions

View File

@@ -541,6 +541,7 @@
(defn remove-item [entities item]
(run-action entities
(begin [this screen entities]
(screen! @(resolve 'advent.screens.scene/hud) :on-remove-item :item item)
(-> entities
(update-in [:state :inventory] #(remove (partial = item) %))
(assoc-in [:cursor :current] :main)))
@@ -582,6 +583,7 @@
(run-action entities
(begin [this screen entities]
(utils/play-sound! screen entities :pickup (constantly 0.3))
(screen! @(resolve 'advent.screens.scene/hud) :on-give-item :item ((:all-items entities) item))
(-> entities
(update-in [:state :inventory] #(conj % item))
(update-in [:state :obtained-items] #(conj % item))