Cleanup (remove momentum code)

This commit is contained in:
2025-06-19 13:51:57 +01:00
parent add192741c
commit c035f82b0e
+5 -20
View File
@@ -62,10 +62,8 @@ crUpdate f =
foldCr
[ doDamage -- these two
, checkDeath -- must be in this order 24/7/22
-- , internalCreatureUpdate
, footstepSideEffect
, f
-- , footstepSideEffect
-- , updateInv -- upInv must be called before invSideEff 22.05.23
, invRootItemEffs
, invSideEff
@@ -119,9 +117,6 @@ scorchSPic = _1 %~ overColSH (mixColors 0.9 0.1 black . normalizeColor)
poisonSPic :: SPic -> SPic
poisonSPic = _1 %~ overColSH (mixColors 0.5 0.5 green . normalizeColor)
internalCreatureUpdate :: Creature -> World -> World
internalCreatureUpdate cr = cWorld . lWorld . creatures . ix (_crID cr) %~ updateMovement
{- | Drop items according to the creature state.
TODO make sure this doesn't mess up any ItemPosition
-}
@@ -421,18 +416,8 @@ setRBCreatureTargeting cr w ituse
cpos <- w ^? cWorld . lWorld . creatures . ix cid . crPos
Just $ hasLOS cpos (_crPos cr) w
updateMovement :: Creature -> Creature
updateMovement cr
| isFrictionless cr = over crPos (+.+ momentum) cr
| otherwise = cr & crStance %~ updateWalkCycle
where
momentum' = 0.98 *.* (_crPos cr - _crOldPos cr)
momentum
| magV momentum' > 1 = normalizeV momentum'
| otherwise = momentum'
isFrictionless :: Creature -> Bool
isFrictionless cr = case cr ^? crStance . carriage of
Just (Boosting _) -> True
Just Floating -> True
_ -> False
--isFrictionless :: Creature -> Bool
--isFrictionless cr = case cr ^? crStance . carriage of
-- Just (Boosting _) -> True
-- Just Floating -> True
-- _ -> False