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 Control.Monad.State
|
||||||
import Data.Bifunctor
|
import Data.Bifunctor
|
||||||
import Dodge.Creature.Impulse.Movement
|
import Dodge.Creature.Impulse.Movement
|
||||||
import Dodge.Creature.Impulse.UseItem
|
--import Dodge.Creature.Impulse.UseItem
|
||||||
import Dodge.Creature.Vocalization
|
import Dodge.Creature.Vocalization
|
||||||
import Dodge.CreatureEffect
|
import Dodge.CreatureEffect
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
@@ -47,7 +47,9 @@ followImpulse cr w imp = case imp of
|
|||||||
TurnToward p a -> crup $ creatureTurnToward p a cr
|
TurnToward p a -> crup $ creatureTurnToward p a cr
|
||||||
TurnTo p -> crup $ creatureTurnTo p cr
|
TurnTo p -> crup $ creatureTurnTo p cr
|
||||||
ChangePosture post -> crup $ cr & crStance . posture .~ post
|
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
|
SwitchToItem i -> crup $ cr & crManipulation . manObject .~ SelectedItem i i mempty
|
||||||
Melee cid' ->
|
Melee cid' ->
|
||||||
( hitCr cid'
|
( hitCr cid'
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
module Dodge.Creature.Impulse.UseItem (
|
module Dodge.Creature.Impulse.UseItem (
|
||||||
useSelectedItem,
|
useItem,
|
||||||
|
-- useSelectedItem,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
|
|||||||
@@ -177,9 +177,15 @@ pressedMBEffectsTopInventory pkeys w
|
|||||||
, Just rtime <- pkeys ^? ix SDL.ButtonRight
|
, Just rtime <- pkeys ^? ix SDL.ButtonRight
|
||||||
, ltime <= rtime && inTopInv =
|
, ltime <= rtime && inTopInv =
|
||||||
--youhammerdown $
|
--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
|
| otherwise = w
|
||||||
where
|
where
|
||||||
|
f 0 = InitialPress
|
||||||
|
f _ = ShortPress
|
||||||
-- youhammerdown = set (cWorld . lWorld . creatures . ix 0 . crHammerPosition) HammerDown
|
-- youhammerdown = set (cWorld . lWorld . creatures . ix 0 . crHammerPosition) HammerDown
|
||||||
inTopInv = case w ^. hud . hudElement of
|
inTopInv = case w ^. hud . hudElement of
|
||||||
DisplayInventory{_subInventory = NoSubInventory{}} -> True
|
DisplayInventory{_subInventory = NoSubInventory{}} -> True
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ rotateCamera :: Configuration -> World -> World
|
|||||||
rotateCamera cfig w
|
rotateCamera cfig w
|
||||||
| Just ltime <- pkeys ^? ix SDL.ButtonLeft
|
| Just ltime <- pkeys ^? ix SDL.ButtonLeft
|
||||||
, Just rtime <- pkeys ^? ix SDL.ButtonRight
|
, 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
|
| otherwise = ifConfigWallRotate cfig (w ^. input . mouseButtons) w
|
||||||
where
|
where
|
||||||
pkeys = w ^. input . mouseButtons
|
pkeys = w ^. input . mouseButtons
|
||||||
|
|||||||
Reference in New Issue
Block a user