Work on slime crits

This commit is contained in:
2026-04-13 19:54:11 +01:00
parent 8a57aa2f2c
commit b8bec2c830
14 changed files with 294 additions and 260 deletions
+9 -5
View File
@@ -1019,8 +1019,8 @@ crCrSpring c1 c2
return $ z c1 > h2 || z c2 > h1
olap a b = ix (a ^. crID) . crPos . _xy +~ overlap b
olap' a b = ix (a ^. crID) . crPos . _xy -~ overlap b
suckx = min 1 (2 * (1 - distance xy1 xy2 / (r1 + r2)))
rolap = ix id1 . crPos . _xy +~ (2*m2 / (m1+m2)) *^ normalize (xy2 - xy1)
suckx = min 1 $ 2 * (1 - distance xy1 xy2 / (r1 + r2))
rolap = ix id1 . crPos . _xy +~ (suckx * 1.5 * m2 / (m1+m2)) *^ normalize (xy2 - xy1)
rolap' = ix id2 . crPos . _xy +~ (suckx * 1.5*m1 / (m1+m2)) *^ normalize (xy1 - xy2)
id1 = _crID c1
id2 = _crID c2
@@ -1037,14 +1037,18 @@ crCrSpring c1 c2
m2 = crMass $ c2 ^. crType
fuseSlimes :: Creature -> Creature -> World -> World
fuseSlimes c1 c2 = (cWorld . lWorld . creatures . ix i1 .~ c)
. (cWorld . lWorld . creatures . at i2 .~ Nothing)
fuseSlimes c1 c2 = (cWorld . lWorld . creatures . ix mini .~ (c & crID .~ mini))
. (cWorld . lWorld . creatures . at maxi .~ Nothing)
where
mini = min i1 i2
maxi = max i1 i2
i1 = c1 ^. crID
i2 = c2 ^. crID
c = c1 & crType . slimeRad .~ r
& crType . slimeRadWobble +~ r - max r1 r2
& crType . slimeCompression .~ V2 r 0
& crPos . _xy .~ (r1/(r1+r2)) *^ xy1 + (r2/(r1+r2)) *^ xy2
-- & crPos . _xy .~ (r1/(r1+r2)) *^ xy1 + (r2/(r1+r2)) *^ xy2
& crPos . _xy .~ if r1 > r2 then xy1 else xy2
xy1 = c1 ^. crPos . _xy
xy2 = c2 ^. crPos . _xy
r1 = c1 ^?! crType . slimeRad