Tweak slime sucking
This commit is contained in:
+14
-3
@@ -1051,8 +1051,9 @@ slimeFood cr = case cr ^. crType of
|
||||
feedSlime :: Creature -> Creature -> World -> World
|
||||
feedSlime s c w = fromMaybe w $ do
|
||||
ch <- crHeight c
|
||||
return $ if min 10 r1 + s ^?! crType . slimeFeedProgress < ch + 2
|
||||
return $ if min 10 r1 + s ^?! crType . slimeFeedProgress < max 15 (ch + 2)
|
||||
then w & cWorld . lWorld . creatures . ix (s ^. crID) . crType . slimeFeedProgress %~ (min r1 . (+0.7))
|
||||
& cWorld . lWorld . creatures %~ (rolap . rolap')
|
||||
else
|
||||
w
|
||||
& cWorld . lWorld . creatures . ix (c ^. crID) . crHP .~ CrDestroyed Swallowed
|
||||
@@ -1063,8 +1064,18 @@ feedSlime s c w = fromMaybe w $ do
|
||||
& crType . slimeRadWobble +~ r - r1
|
||||
& crType . slimeCompression %~ ((r/r1) *^)
|
||||
r1 = s ^?! crType . slimeRad
|
||||
r2 = 2 * c ^. crType . to crRad
|
||||
r = sqrt (r1*r1 + r2*r2)
|
||||
r2 = c ^. crType . to crRad
|
||||
r = sqrt (r1*r1 + 4*r2*r2)
|
||||
id1 = s ^. crID
|
||||
id2 = c ^. crID
|
||||
rolap = ix id1 . crPos . _xy +~ f' (suckx * 1.5 * m2 / (m1+m2)) *^ normalize (xy2 - xy1)
|
||||
rolap' = ix id2 . crPos . _xy +~ f' (suckx * 1.5*m1 / (m1+m2)) *^ normalize (xy1 - xy2)
|
||||
m1 = crMass $ s ^. crType
|
||||
m2 = crMass $ c ^. crType
|
||||
suckx = (min 1 $ 2 * (1 - distance xy1 xy2 / (r1 + r2))) ^ (2:: Int)
|
||||
xy1 = s ^. crPos . _xy
|
||||
xy2 = c ^. crPos . _xy
|
||||
f' = min (distance xy1 xy2/2)
|
||||
|
||||
fuseSlimes :: Creature -> Creature -> World -> World
|
||||
fuseSlimes c1 c2 = (cWorld . lWorld . creatures . ix mini .~ c)
|
||||
|
||||
Reference in New Issue
Block a user