Stop tracking aim twist amount, use fixed number

This commit is contained in:
2025-05-30 10:31:21 +01:00
parent 0bcf263db7
commit cdf300b824
6 changed files with 14 additions and 25 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ import Geometry
holsterWeapon, drawWeapon :: Action
holsterWeapon = DoImpulses [ChangePosture AtEase, MakeSound whiteNoiseFadeOutS]
drawWeapon = DoImpulses [ChangePosture (Aiming 0), MakeSound whiteNoiseFadeInS]
drawWeapon = DoImpulses [ChangePosture Aiming, MakeSound whiteNoiseFadeInS]
shootTillEmpty :: Action
--shootTillEmpty = (crCanShoot `DoActionWhile` DoImpulses [UseItem])
+10 -20
View File
@@ -162,21 +162,19 @@ setAimPosture cr = fromMaybe cr $ do
astance <- cr ^? crInv . ix itRef . itUse . heldAim . aimStance
case astance of
TwoHandUnder ->
return $ cr & crStance . posture .~ Aiming (twistamount * pi)
& crDir -~ (twistamount * pi)
return $ cr & crStance . posture .~ Aiming
& crDir -~ twoHandTwistAmount
TwoHandOver ->
return $ cr & crStance . posture .~ Aiming (twistamount * pi)
& crDir -~ (twistamount * pi)
_ -> return $ cr & crStance . posture .~ Aiming 0
where
twistamount :: Float
twistamount = 1.6
return $ cr & crStance . posture .~ Aiming
& crDir -~ twoHandTwistAmount
_ -> return $ cr & crStance . posture .~ Aiming
twoHandTwistAmount :: Float
twoHandTwistAmount = 1.6 * pi
removeAimPosture :: Creature -> Creature
removeAimPosture cr = fromMaybe cr $ do
x <- cr ^? crStance . posture . aimTwist
return $ cr
& crDir +~ x
removeAimPosture cr = cr
& crDir +~ twoHandTwistAmount
& crStance . posture .~ AtEase
wasdMovement :: Input -> Camera -> Float -> Creature -> Creature
@@ -198,14 +196,6 @@ aimTurn a cr = creatureTurnTowardDir a (x * 0.2) cr
itRef <- cr ^? crManipulation . manObject . imRootSelectedItem
cr ^? crInv . ix itRef . itUse . heldAim . aimTurnSpeed
{- | Set posture according to mouse presses.
(should you be aiming without a selected item?)
-}
setCrPosture :: M.Map SDL.MouseButton Int -> Creature -> Creature
setCrPosture pkeys
| SDL.ButtonRight `M.member` pkeys = crStance . posture .~ Aiming 0
| otherwise = crStance . posture .~ AtEase
tryClickUse :: M.Map SDL.MouseButton Int -> World -> World
tryClickUse pkeys w = fromMaybe w $ do
ltime <- pkeys ^? ix SDL.ButtonLeft