Move stride/footforward datatypes
This commit is contained in:
@@ -18,14 +18,15 @@ updateCarriage cid w = fromMaybe w $ do
|
||||
|
||||
updateCarriage' :: Int -> Creature -> World -> Carriage -> World
|
||||
updateCarriage' cid cr w = \case
|
||||
Walking x ff | x >= strideLength cr -> w
|
||||
Walking -> case (cr ^? crType . strideAmount,cr ^? crType . footForward) of
|
||||
(Just x,Just ff) | x >= strideLength cr -> w
|
||||
& soundMultiFrom
|
||||
[FootstepSound i | i <- [0 .. 10]]
|
||||
(cr ^. crPos . _xy)
|
||||
(chooseFootSound ff)
|
||||
Nothing
|
||||
& over (cWorld . lWorld . creatures . ix cid . crStance . carriage) resetStride
|
||||
Walking {} -> w
|
||||
& over (cWorld . lWorld . creatures . ix cid . crType) resetStride
|
||||
_ -> w
|
||||
Floating -> w
|
||||
Flying {_zSpeed = dz, _flyInertia = x} ->
|
||||
w & cWorld . lWorld . creatures . ix cid . crPos . _xy +~ x *^ f (cr ^. crOldPos . _xy - oop ^. _xy)
|
||||
@@ -33,7 +34,7 @@ updateCarriage' cid cr w = \case
|
||||
& cWorld . lWorld . creatures . ix cid . crStance . carriage . zSpeed
|
||||
%~ if cr ^. crPos . _z < 17 then min 0.05 . (+0.001) else max (-0.05) . subtract 0.001
|
||||
Boosting {} -> w
|
||||
Falling _ _ ->
|
||||
Falling {} ->
|
||||
let v = 0.9 *^ (cr ^. crOldPos - oop & _z -~ 0.5)
|
||||
ep = cr ^. crPos + v
|
||||
in if ep ^. _z < 0 && not (any (pointInPoly (ep ^. _xy)) (w ^. cWorld . chasms))
|
||||
@@ -47,10 +48,10 @@ updateCarriage' cid cr w = \case
|
||||
| otherwise = v
|
||||
|
||||
|
||||
resetStride :: Carriage -> Carriage
|
||||
resetStride = \case
|
||||
Walking _ ff -> Walking 0 (normalGait ff)
|
||||
x -> x
|
||||
resetStride :: CreatureType -> CreatureType
|
||||
resetStride ct = case ct ^? footForward of
|
||||
Just _ -> ct & strideAmount .~ 0 & footForward %~ normalGait
|
||||
_ -> ct
|
||||
|
||||
normalGait :: FootForward -> FootForward
|
||||
normalGait = \case
|
||||
|
||||
Reference in New Issue
Block a user