diff --git a/src/Dodge/Creature/Action.hs b/src/Dodge/Creature/Action.hs index fdb292e97..950a462c6 100644 --- a/src/Dodge/Creature/Action.hs +++ b/src/Dodge/Creature/Action.hs @@ -3,13 +3,11 @@ -- | Actions performed by creatures within the world module Dodge.Creature.Action ( performActions, --- setMinInvSize, dropExcept, dropItem, blinkActionMousePos, blinkActionFail, unsafeBlinkAction, --- sizeSelf, youDropItem, ) where @@ -25,7 +23,6 @@ import Data.Maybe import Dodge.Base import Dodge.Creature.Action.Blink import Dodge.CreatureEffect ---import Dodge.Data.SelectionList import Dodge.Data.World import Dodge.FloatFunction import Dodge.FloorItem @@ -197,7 +194,6 @@ youDropItem w = fromMaybe w $ do curpos <- cr ^? crManipulation . manObject . imSelectedItem . unNInt <|> fmap fst (IM.lookupMax (cr ^. crInv . unNIntMap)) - --guard $ not $ _crInvLock cr guard $ not $ w ^. cWorld . lWorld . lInvLock return $ case cr ^. crStance . posture of Aiming {} -> throwItem w @@ -209,26 +205,3 @@ youDropItem w = fromMaybe w $ do -- should throw all attached items? throwItem :: World -> World throwItem = id - ---sizeSelf :: Float -> Creature -> World -> Maybe World ---sizeSelf x cr w --- | not (crOnWall cr1 w) = --- Just $ --- w --- & soundMultiFrom [TeleSound 0, TeleSound 1] cpos teleS Nothing --- & cWorld . lWorld . distortions .:~ distortionBulge --- & cWorld . lWorld . creatures . ix cid --- %~ ( (crRad .~ 10 * x) --- . (crMvType . mvSpeed .~ yourDefaultSpeed * x) --- . (crStance . strideLength .~ ceiling (fromIntegral yourDefaultStrideLength * x)) --- ) --- | otherwise = Nothing --- where --- cr1 = colCrWall w (cr{_crRad = 10 * x}) --- distR = 120 --- distortionBulge --- | _crRad cr < 10 * x = raddist 1.9 --- | otherwise = raddist 0.1 --- raddist = RadialDistortion cpos (cpos +.+ V2 distR 0) (cpos +.+ V2 0 distR) --- cid = _crID cr --- cpos = _crPos cr diff --git a/src/Dodge/Creature/Impulse/Movement.hs b/src/Dodge/Creature/Impulse/Movement.hs index ef942a0a0..3d804016a 100644 --- a/src/Dodge/Creature/Impulse/Movement.hs +++ b/src/Dodge/Creature/Impulse/Movement.hs @@ -44,11 +44,11 @@ crMvForward :: Float -> LWorld -> Creature -> Creature crMvForward speed = crMvBy (V2 speed 0) advanceStepCounter :: Float -> Creature -> Creature -advanceStepCounter speed = crStance . carriage %~ f +advanceStepCounter speed cr = cr & crStance . carriage %~ f where f car = case car of Standing -> f (Walking 0 RightForward) - Walking i ff -> Walking (i + speed) ff + Walking i ff -> Walking (min (cr ^. crStance . strideLength) (i + speed)) ff _ -> car creatureTurnTo :: Point2 -> Creature -> Creature diff --git a/src/Dodge/Creature/State/WalkCycle.hs b/src/Dodge/Creature/State/WalkCycle.hs index 3878f6f77..593519364 100644 --- a/src/Dodge/Creature/State/WalkCycle.hs +++ b/src/Dodge/Creature/State/WalkCycle.hs @@ -12,7 +12,7 @@ updateWalkCycle :: Int -> World -> World updateWalkCycle cid w | Just cr <- w ^? cWorld . lWorld . creatures . ix 0 , Walking x ff <- cr ^. crStance . carriage - , x > cr ^. crStance . strideLength = + , x >= cr ^. crStance . strideLength = w & soundMultiFrom [FootstepSound i | i <- [0 .. 10]] diff --git a/src/Dodge/Data/Creature/Stance.hs b/src/Dodge/Data/Creature/Stance.hs index 46d74025a..7510a4d65 100644 --- a/src/Dodge/Data/Creature/Stance.hs +++ b/src/Dodge/Data/Creature/Stance.hs @@ -22,10 +22,7 @@ data Stance = Stance deriving (Eq, Ord, Show, Read) --Generic, Flat) data Carriage - = Walking - { _strideAmount :: Float - , _currentFoot :: FootForward - } + = Walking { _strideAmount :: Float , _currentFoot :: FootForward } | Standing | Floating | Flying