solved issue with crash for using item on itself.

This commit is contained in:
Bryce Covert
2016-06-28 08:36:23 -07:00
parent 58f270a4c4
commit bd797e60be

View File

@@ -82,20 +82,24 @@
(declare items)
(defn mix-ingredients [base]
(fn [other]
(let [is-using-flask? (seq (filter (comp :flask? items) [base other]))]
(if is-using-flask?
(actions/get-script entities
(if (actions/has-item? entities :note-1)
(condp = #{base other}
#{:ash :flask-water} (make-water-and-ash entities)
#{:flies :flask-water} (make-water-and-flies entities)
#{:flies :flask-water-ash} (make-flies-ash entities)
#{:ash :flask-water-flies} (make-flies-ash entities)
#{:feather :flask-flies-ash} (make-finished-component entities)
(actions/talk entities :ego "I'm not sure if that goes in there."))
(let [is-using-flask? (seq (filter (comp :flask? items) [base other]))
items-used (set [base other])]
(cond (= 1 (count items-used))
nil
is-using-flask?
(actions/get-script entities
(if (actions/has-item? entities :note-1)
(condp = items-used
#{:ash :flask-water} (make-water-and-ash entities)
#{:flies :flask-water} (make-water-and-flies entities)
#{:flies :flask-water-ash} (make-flies-ash entities)
#{:ash :flask-water-flies} (make-flies-ash entities)
#{:feather :flask-flies-ash} (make-finished-component entities)
(actions/talk entities :ego "I'm not sure if that goes in there."))
(actions/talk entities :ego "I should really find out from Gandarf before I put anything in there.")))
nil))))
(actions/talk entities :ego "I should really find out from Gandarf before I put anything in there.")))
:else
nil))))
(def items
{:wool {:name "Wool" :value :wool :cursor :wool :scripts {:stick make-cat-toy}}