Cleanup, change creature height from Maybe Float to Float
This commit is contained in:
+8
-15
@@ -1033,11 +1033,8 @@ crCrSpring c1 c2
|
||||
| otherwise = cWorld . lWorld . creatures %~ ( olap c1 c2 . olap' c2 c1)
|
||||
where
|
||||
z c = c ^. crPos . _z
|
||||
h c = fmap (+ z c) (crHeight c)
|
||||
diffheight = fromMaybe True $ do
|
||||
h1 <- h c1
|
||||
h2 <- h c2
|
||||
return $ z c1 > h2 || z c2 > h1
|
||||
h c = crHeight c + z c
|
||||
diffheight = z c1 > h c2 || z c2 > h c1
|
||||
olap a b = ix (a ^. crID) . crPos . _xy +~ overlap b
|
||||
olap' a b = ix (a ^. crID) . crPos . _xy -~ overlap b
|
||||
id1 = _crID c1
|
||||
@@ -1080,22 +1077,18 @@ slimeFood cr = case cr ^. crType of
|
||||
_ -> False
|
||||
|
||||
feedSlime :: Creature -> Creature -> World -> World
|
||||
feedSlime s c w = fromMaybe w $ do
|
||||
ch <- crHeight c
|
||||
return $ if min 10 r1 + s ^?! crType . slimeEngulfProgress < max 15 (ch + 2)
|
||||
feedSlime s c w = if min 10 r1 + s ^?! crType . slimeEngulfProgress < max 15 (ch + 2)
|
||||
then w & cWorld.lWorld.creatures.ix (s^.crID).crType.slimeEngulfProgress%~ (min r1.(+0.7))
|
||||
& slimeSuck s c
|
||||
else
|
||||
w
|
||||
else w
|
||||
& cWorld . lWorld . creatures . at (c ^. crID) %~ destroyCreature
|
||||
& cWorld . lWorld . creatures . ix (s ^. crID) %~ f
|
||||
& cWorld . lWorld . creatures . ix (s ^. crID) . crType . slimeSlime +~ x
|
||||
& cWorld . lWorld . creatures . ix (s ^. crID) . crType . slimeSlimeChange +~ x
|
||||
& slimeEatSound (s ^. crID) (s ^. crPos . _xy)
|
||||
where
|
||||
f cr = cr
|
||||
& crType . slimeSlime +~ round (r2^(2::Int) * 100)
|
||||
& crType . slimeSlimeChange +~ round (r2^(2::Int) * 100)
|
||||
ch = crHeight c
|
||||
x = round $ (c^.crType.to crRad)^(2::Int) * 100
|
||||
r1 = s ^?! crType . slimeSlime . to slimeToRad
|
||||
r2 = c ^. crType . to crRad
|
||||
|
||||
fuseSlimes :: Creature -> Creature -> World -> World
|
||||
fuseSlimes c1 c2 = (cWorld . lWorld . creatures . ix mini .~ c)
|
||||
|
||||
Reference in New Issue
Block a user