Tweak wall collisions

This commit is contained in:
2021-11-19 00:45:45 +00:00
parent b1a49bbdc3
commit da83bd06a6
+5 -2
View File
@@ -23,11 +23,14 @@ colCrWall :: World -> Creature -> Creature
colCrWall w c
| noclipIsOn && _crID c == 0 = c -- for noclip
| p1 == p2 = pushOrCrush ls c
| otherwise = c & crPos %~
| _crPos c' == _crPos c'' = c'
| otherwise = c & crPos .~ _crOldPos c
where
c'' = c & crPos %~ pushOutFromWalls rad ls
c' = c & crPos %~
pushOutFromWalls rad (reverse ls)
. pushOutFromWalls rad ls
. flip (collidePointWalls p1) wls -- check push throughs
where
rad = _crRad c + wallBuffer
p1 = _crOldPos c
p2 = _crPos c