enhanced box.
This commit is contained in:
@@ -30,14 +30,16 @@
|
||||
(or (scripts (:value cursor)) (scripts :default)))))})))
|
||||
(defn make [& {:keys [collision interactions entities] :as params}]
|
||||
(let [interactions-as-list (for [[id spec] interactions]
|
||||
(merge spec {:mouse-in? (fn [_ x y]
|
||||
((apply zone/box (:box spec)) x y))
|
||||
:get-script (fn [cursor [x y]]
|
||||
(if (= :main cursor)
|
||||
(:script spec)
|
||||
(when-let [scripts (:scripts spec)]
|
||||
(or (scripts (:value cursor)) (scripts :default)))))
|
||||
:id id}))
|
||||
(merge spec
|
||||
(when (:box spec)
|
||||
{:mouse-in? (fn [_ x y]
|
||||
((apply zone/box (:box spec)) x y))})
|
||||
{:get-script (fn [cursor [x y]]
|
||||
(if (= :main cursor)
|
||||
(:script spec)
|
||||
(when-let [scripts (:scripts spec)]
|
||||
(or (scripts (:value cursor)) (scripts :default)))))
|
||||
:id id}))
|
||||
entities (into {} (for [[id entity] entities]
|
||||
[id (make-entity id entity)]))]
|
||||
(merge params {:collision (advent.pathfind/map-from-resource collision)
|
||||
|
||||
Reference in New Issue
Block a user