Continue item use refactor
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -8,7 +8,7 @@ import Data.Foldable
|
||||
import Control.Monad.State
|
||||
import Data.Bifunctor
|
||||
import Dodge.Creature.Impulse.Movement
|
||||
import Dodge.Creature.Impulse.UseItem
|
||||
--import Dodge.Creature.Impulse.UseItem
|
||||
import Dodge.Creature.Vocalization
|
||||
import Dodge.CreatureEffect
|
||||
import Dodge.Data.World
|
||||
@@ -47,7 +47,9 @@ followImpulse cr w imp = case imp of
|
||||
TurnToward p a -> crup $ creatureTurnToward p a cr
|
||||
TurnTo p -> crup $ creatureTurnTo p cr
|
||||
ChangePosture post -> crup $ cr & crStance . posture .~ post
|
||||
UseItem -> (useSelectedItem $ _crID cr, cr)
|
||||
UseItem -> undefined
|
||||
-- UseItem -> (useSelectedItem $ _crID cr
|
||||
-- , cr)
|
||||
SwitchToItem i -> crup $ cr & crManipulation . manObject .~ SelectedItem i i mempty
|
||||
Melee cid' ->
|
||||
( hitCr cid'
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
module Dodge.Creature.Impulse.UseItem (
|
||||
useSelectedItem,
|
||||
useItem,
|
||||
-- useSelectedItem,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
|
||||
@@ -177,9 +177,15 @@ pressedMBEffectsTopInventory pkeys w
|
||||
, Just rtime <- pkeys ^? ix SDL.ButtonRight
|
||||
, ltime <= rtime && inTopInv =
|
||||
--youhammerdown $
|
||||
useSelectedItem 0 w
|
||||
--useSelectedItem 0 w
|
||||
fromMaybe w $ do
|
||||
invid <- w ^? cWorld . lWorld . creatures . ix 0
|
||||
. crManipulation . manObject . imSelectedItem
|
||||
return $ useItem invid (f ltime) w
|
||||
| otherwise = w
|
||||
where
|
||||
f 0 = InitialPress
|
||||
f _ = ShortPress
|
||||
-- youhammerdown = set (cWorld . lWorld . creatures . ix 0 . crHammerPosition) HammerDown
|
||||
inTopInv = case w ^. hud . hudElement of
|
||||
DisplayInventory{_subInventory = NoSubInventory{}} -> True
|
||||
|
||||
@@ -166,7 +166,7 @@ rotateCamera :: Configuration -> World -> World
|
||||
rotateCamera cfig w
|
||||
| Just ltime <- pkeys ^? ix SDL.ButtonLeft
|
||||
, Just rtime <- pkeys ^? ix SDL.ButtonRight
|
||||
, rtime > ltime = w & wCam . camRot -~ rotation
|
||||
, ltime > rtime = w & wCam . camRot -~ rotation
|
||||
| otherwise = ifConfigWallRotate cfig (w ^. input . mouseButtons) w
|
||||
where
|
||||
pkeys = w ^. input . mouseButtons
|
||||
|
||||
Reference in New Issue
Block a user