Cleanup, tweak aiming

This commit is contained in:
2023-01-11 19:28:37 +00:00
parent af24c5bc9c
commit 25912fe3eb
3 changed files with 11 additions and 6 deletions
+10 -4
View File
@@ -39,11 +39,10 @@ wasdWithAiming ::
Creature -> Creature ->
Creature Creature
wasdWithAiming w speed cr wasdWithAiming w speed cr
-- | isAiming = addAnyTwist $ set crDir mouseDir $ theMovement cr
| isAiming = addAnyTwist $ aimTurn mouseDir $ theMovement $ setMvAim cr | isAiming = addAnyTwist $ aimTurn mouseDir $ theMovement $ setMvAim cr
| crIsReloading cr && SDL.ButtonRight `M.member` _mouseButtons (_input w) = | crIsReloading cr && SDL.ButtonRight `M.member` _mouseButtons (_input w) =
addAnyTwist $ aimTurn (mouseDir + anytwist) $ theMovement $ setMvAim cr --addAnyTwist $ aimTurn (mouseDir + anytwist) $ theMovement $ setMvAim cr
-- | otherwise = theMovement $ theTurn $ removeTwist $ setMvAim cr aimTurn mouseDir $ removeTwist $ theMovement $ setMvAim cr
| otherwise = noaimmove $ theTurn $ removeTwist $ setMvAim cr | otherwise = noaimmove $ theTurn $ removeTwist $ setMvAim cr
where where
setMvAim = maybe id (crMvAim .~) dir setMvAim = maybe id (crMvAim .~) dir
@@ -55,7 +54,14 @@ wasdWithAiming w speed cr
anytwist = case cr ^? crInv . ix (crSel cr) . itUse . heldAim . aimStance of anytwist = case cr ^? crInv . ix (crSel cr) . itUse . heldAim . aimStance of
Just TwoHandTwist -> twistamount * pi Just TwoHandTwist -> twistamount * pi
_ -> 0 _ -> 0
addAnyTwist = crTwist .~ anytwist --addAnyTwist = crTwist .~ anytwist
addAnyTwist = case cr ^? crInv . ix (crSel cr) . itUse . heldAim . aimStance of
Just TwoHandTwist -> case cr ^. crTwist of
0 -> (crTwist .~ twistamount * pi)
. (crDir -~ twistamount * pi)
_ -> id
_ -> id
theMovement theMovement
| movDir == V2 0 0 = id | movDir == V2 0 0 = id
| otherwise = crMvAbsolute (speed *.* movAbs) | otherwise = crMvAbsolute (speed *.* movAbs)
-1
View File
@@ -16,7 +16,6 @@ import Dodge.Data.Item.Use.Consumption
data ItemType = ItemType data ItemType = ItemType
{ _iyBase :: ItemBaseType { _iyBase :: ItemBaseType
, _iyModules :: M.Map ModuleSlot ItemModuleType , _iyModules :: M.Map ModuleSlot ItemModuleType
, _iyStack :: Stack
} }
deriving (Eq,Ord,Show,Read) deriving (Eq,Ord,Show,Read)
--deriving (Eq, Ord, Show, Read) --Generic, Flat) --deriving (Eq, Ord, Show, Read) --Generic, Flat)
+1 -1
View File
@@ -57,7 +57,7 @@ defaultCraftItem =
& itInvColor .~ green & itInvColor .~ green
defaultItemType :: ItemType defaultItemType :: ItemType
defaultItemType = ItemType NoItemType mempty NoStack defaultItemType = ItemType NoItemType mempty
defaultBulletWeapon :: Item defaultBulletWeapon :: Item
defaultBulletWeapon = defaultBulletWeapon =