Hlint, cleanup

This commit is contained in:
2026-03-30 09:29:50 +01:00
parent 1919757fca
commit 4598deb70f
8 changed files with 59 additions and 47 deletions
+4 -7
View File
@@ -958,7 +958,7 @@ radiusSpring r a b
simpleCrSprings :: World -> World
simpleCrSprings w =
IM.foldl' (flip crSpring) w $
IM.filter (canSpring) $ w ^. cWorld . lWorld . creatures
IM.filter canSpring $ w ^. cWorld . lWorld . creatures
-- note that this may in rare cases not push creatures away from each other
crSpring :: Creature -> World -> World
@@ -979,13 +979,10 @@ crCrSpring c1 c2
| id1 == id2 = id
| vec == V2 0 0 = id
| diff >= comRad = id
| otherwise =
( cWorld . lWorld . creatures
%~ ( (ix id1 . crPos . _xy +~ overlap c2)
. (ix id2 . crPos . _xy -~ overlap c1)
)
)
| otherwise = cWorld . lWorld . creatures %~ ( olap c1 c2 . olap c2 c1)
where
olap a b = ix (a ^. crID) . crPos . _xy +~ overlap b
id1 = _crID c1
id2 = _crID c2
vec = c1 ^. crPos . _xy - c2 ^. crPos . _xy