Improve falling, remove stride advance while falling

This commit is contained in:
2026-04-03 21:25:05 +01:00
parent 348a1d7537
commit 615295ca3e
3 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ updateCarriage' cid cr w = \case
%~ if cr ^. crPos . _z < 17 then min 0.05 . (+0.001) else max (-0.05) . subtract 0.001
Boosting {} -> w
Falling {} ->
let v = 0.9 *^ (cr ^. crOldPos - oop & _z -~ 0.5)
let v = 0.95 *^ (cr ^. crOldPos - oop & _z -~ 0.5)
ep = cr ^. crPos + v
in if ep ^. _z < 0 && not (any (pointInPoly (ep ^. _xy)) (w ^. cWorld . chasms))
then w & tocr . crPos .~ (ep & _z .~ 0)
+1 -1
View File
@@ -39,7 +39,7 @@ import ShapePicture.Data
-- allow for knockbacks etc to be determined as well as intended movements
updateCreature :: Creature -> World -> World
updateCreature cr
| cr ^. crPos . _z < negate 100 = (tocr . crHP .~ CrIsPitted) . destroyAllInvItems cr
| cr ^. crPos . _z < negate 300 = (tocr . crHP .~ CrIsPitted) . destroyAllInvItems cr
| CrIsCorpse _ <- cr ^. crHP = updateCarriage (_crID cr) . chasmTestCorpse cr
| null (cr ^? crHP . _HP) = id
| otherwise = updateLivingCreature cr
+3 -1
View File
@@ -372,7 +372,9 @@ updateCreatureStrides :: World -> World
updateCreatureStrides = cWorld . lWorld . creatures . each %~ updateCreatureStride
updateCreatureStride :: Creature -> Creature
updateCreatureStride cr = cr & crType . strideAmount +~ d
updateCreatureStride cr
| Walking <- cr ^. crStance . carriage = cr & crType . strideAmount +~ d
| otherwise = cr
where
s = 2 * fromMaybe 1 (crMvType cr ^? mvSpeed)
-- d = min s . norm $ cr ^. crPos - cr ^. crOldPos