progress on interactions with cursors
This commit is contained in:
@@ -45,13 +45,13 @@
|
||||
(let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})]
|
||||
(log/info (:input-x screen) (:input-y screen) "->" x y)))
|
||||
|
||||
(def ^:const +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :ladder :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength :medal :kiss :sword :hourglass :mandrake :ball-n-chain :key :rope :crowbar :note-1 :ash :sack-lunch :flies :spear :monocle :feather :spell-component :money :charcoal :broken-clock :slingshot :camera :walkie-talkies :alarm-clock :walkie-talkie :flask-water :flask-water-stuff :flask-water-stuff-2 :note-2 :magic-slingshot :active-main :shovel :broom :tune])
|
||||
(def ^:const +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :ladder :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength :medal :kiss :sword :hourglass :mandrake :ball-n-chain :key :rope :crowbar :note-1 :ash :sack-lunch :flies :spear :monocle :feather :spell-component :money :charcoal :broken-clock :slingshot :camera :walkie-talkies :alarm-clock :walkie-talkie :flask-water :flask-water-stuff :flask-water-stuff-2 :note-2 :magic-slingshot :active-main :shovel :broom :tune :hand :hand-depressed :talk :talk-depressed :look :look-depressed])
|
||||
|
||||
(def settings (atom {:music-volume 50.0
|
||||
:sound-volume 75.0
|
||||
:fullscreen true}))
|
||||
|
||||
(def selected-save (atom nil))
|
||||
(defonce selected-save (atom nil))
|
||||
|
||||
(defn current-music-volume [& [^double factor]]
|
||||
(-> (Math/pow (unchecked-multiply (:music-volume @settings) 0.01) 2)
|
||||
@@ -271,8 +271,7 @@
|
||||
(assoc entity :x (vector-2! v :x) :y (vector-2! v :y)))))))
|
||||
|
||||
(defn path-point [speed screen entities entity]
|
||||
(* (- (:total-time screen) (:path-start-time entity 0.0)) speed)
|
||||
)
|
||||
(* (- (:total-time screen) (:path-start-time entity 0.0)) speed))
|
||||
|
||||
(defn update-path-location [speed screen entities entity]
|
||||
(if (:path entity)
|
||||
@@ -291,10 +290,10 @@
|
||||
(filter #(and (:mouse-in? %)
|
||||
((:mouse-in? %) entities x y)
|
||||
(not= "ego" (:id %))
|
||||
(:script %))
|
||||
(:get-script %))
|
||||
(vals (get-in entities [:room :entities])))
|
||||
(filter #(and ((:mouse-in? %) entities x y)
|
||||
(:script %))
|
||||
(:get-script %))
|
||||
(get-in entities [:room :interactions])))))
|
||||
|
||||
(defn hovering-ego [entities [x y]]
|
||||
@@ -388,7 +387,8 @@
|
||||
(.getScreenWidth viewport) (.getScreenHeight viewport)
|
||||
(first raw-pos) (last raw-pos)))
|
||||
hovering-ego (hovering-ego entities last-pos)
|
||||
current (get-in entities [:cursor :current])]
|
||||
current (get-in entities [:cursor :current])
|
||||
selected-inventory-item (@(resolve 'advent.screens.scene/get-selected-inventory-item))]
|
||||
|
||||
(cond
|
||||
out-of-bounds
|
||||
@@ -397,35 +397,27 @@
|
||||
|
||||
(not (get-in entities [:state :active?]))
|
||||
(-> entities
|
||||
(assoc-in [:cursor :override] nil)
|
||||
(assoc-in [:cursor :active] false))
|
||||
(assoc-in [:cursor :override] nil))
|
||||
|
||||
(is-unstoppable-script-running screen entities)
|
||||
(-> entities
|
||||
(assoc-in [:cursor :override] :hourglass)
|
||||
(assoc-in [:cursor :active] false))
|
||||
(assoc-in [:cursor :override] :hourglass))
|
||||
|
||||
(get-in entities [:state :hud-active?])
|
||||
(-> entities
|
||||
(assoc-in [:cursor :override] nil)
|
||||
(assoc-in [:cursor :active] false))
|
||||
(assoc-in [:cursor :override] nil))
|
||||
|
||||
(and hovering-ego (not @(resolve 'advent.screens.scene/get-selected-inventory-item)))
|
||||
(-> entities
|
||||
(assoc-in [:cursor :override] (or (:cursor mouse-override) (when (#{:main :active-main} (get-in entities [:cursor :last])) :active-main)))
|
||||
(assoc-in [:cursor :active] true))
|
||||
(and mouse-override (:only-script mouse-override))
|
||||
(assoc-in entities [:cursor :override] (:cursor mouse-override))
|
||||
|
||||
selected-inventory-item
|
||||
(assoc-in entities [:cursor :override] selected-inventory-item)
|
||||
|
||||
mouse-override
|
||||
(-> entities
|
||||
(assoc-in [:cursor :override] (or (:cursor mouse-override) (when (#{:main :active-main} (get-in entities [:cursor :last])) :active-main)))
|
||||
(assoc-in [:cursor :active] true))
|
||||
|
||||
|
||||
(assoc-in entities [:cursor :override] (:cursor mouse-override))
|
||||
|
||||
:else
|
||||
(-> entities
|
||||
(assoc-in [:cursor :override] nil)
|
||||
(assoc-in [:cursor :active] false)))))
|
||||
(assoc-in entities [:cursor :override] :main))))
|
||||
|
||||
(def default-night-merge {:r 0.08 :g 0.1 :b 0.36 :multiply-amount 1.0 :hue-amount 1.0})
|
||||
(def default-night-merge-sprite {:r 0.08 :g 0.1 :b 0.36 :multiply-amount 0.3 :hue-amount 0.4})
|
||||
|
||||
Reference in New Issue
Block a user