Allow mouse click interaction for nearby objects
This commit is contained in:
@@ -2,6 +2,7 @@ module Dodge.Creature.YourControl (
|
||||
yourControl,
|
||||
) where
|
||||
|
||||
import Dodge.SelectedClose
|
||||
import Control.Monad
|
||||
import Data.Foldable
|
||||
import qualified Data.Map.Strict as M
|
||||
@@ -178,13 +179,12 @@ tryClickUse pkeys w = fromMaybe w $ do
|
||||
ltime <- pkeys ^? ix SDL.ButtonLeft
|
||||
rtime <- pkeys ^? ix SDL.ButtonRight
|
||||
guard $ ltime <= rtime
|
||||
invid <-
|
||||
w
|
||||
^? cWorld . lWorld . creatures . ix 0
|
||||
case w ^? cWorld . lWorld . creatures . ix 0
|
||||
. crManipulation
|
||||
. manObject
|
||||
. imSelectedItem
|
||||
useItem invid (f ltime) w
|
||||
. imSelectedItem of
|
||||
Just invid -> useItem invid (f ltime) w
|
||||
Nothing -> interactWithCloseObj <$> getSelectedCloseObj w ?? w
|
||||
where
|
||||
f 0 = InitialPress
|
||||
f _ = ShortPress
|
||||
|
||||
Reference in New Issue
Block a user