Hlint, cleanup
This commit is contained in:
+4
-7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user