Refactor damages to materials

This commit is contained in:
2025-06-22 08:31:18 +01:00
parent df3fde5d3e
commit 9fa3e060d7
17 changed files with 576 additions and 609 deletions
+4 -9
View File
@@ -13,30 +13,25 @@ fallSmallBounceDamage :: Prop -> World -> World
fallSmallBounceDamage pr w =
w
& dodamage
& cWorld . lWorld . props . ix (_prID pr) %~ fallSmallBounce' w
& cWorld . lWorld . props . ix (_prID pr) %~ fallMovement w
where
p = _prPos pr
v = _prVel pr
dodamage
| _prPosZ pr < 25 = damageInCircle (const thedam) p 5
-- cWorld . lWorld . creatures . each %~ dodamage'
| otherwise = id
thedam = Crushing (floor . (* 10) . max 0 . subtract 5 . abs $ _prVelZ pr) v
fallSmallBounce :: Prop -> World -> World
fallSmallBounce pr w =
w
& cWorld . lWorld . props . ix (_prID pr) %~ fallSmallBounce' w
fallSmallBounce pr w = w & cWorld . lWorld . props . ix (_prID pr) %~ fallMovement w
fallSmallBounce' :: World -> Prop -> Prop
fallSmallBounce' w pr
fallMovement :: World -> Prop -> Prop
fallMovement w pr
| newposz < 0 && velz < (-2) =
pr
& prVelZ %~ ((* 0.5) . negate)
-- & pjPos +~ (0.5*.* vel)
& updateWithVel (0.5 *.* vel)
& prVel %~ (0.5 *.*)
-- & pjPos +~ (0.5*.* vel)
| newposz < 0 =
pr & prUpdate .~ PropUpdateId
& prPosZ .~ 0