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