Work on slime crit split/combining
This commit is contained in:
+9
-10
@@ -1004,11 +1004,11 @@ crCrSpring c1 c2
|
||||
, SlimeCrit{} <- c2 ^. crType
|
||||
, id2 > id1
|
||||
, distance xy1 xy2 < abs (r1 - r2) + 1 = fuseSlimes c1 c2
|
||||
| SlimeCrit{} <- c1 ^. crType =
|
||||
--cWorld . lWorld . creatures %~ (rolap c1 c2 . rolap' c2 c1)
|
||||
| Just t <- c1 ^? crType . slimeSplitTimer
|
||||
, t <= 0 =
|
||||
cWorld . lWorld . creatures %~ (rolap . rolap')
|
||||
| SlimeCrit{} <- c1 ^. crType = id
|
||||
| SlimeCrit{} <- c2 ^. crType = id
|
||||
-- cWorld . lWorld . creatures %~ ( rolap c1 c2 . rolap' c2 c1)
|
||||
| otherwise = cWorld . lWorld . creatures %~ ( olap c1 c2 . olap' c2 c1)
|
||||
where
|
||||
z c = c ^. crPos . _z
|
||||
@@ -1037,20 +1037,19 @@ crCrSpring c1 c2
|
||||
m2 = crMass $ c2 ^. crType
|
||||
|
||||
fuseSlimes :: Creature -> Creature -> World -> World
|
||||
fuseSlimes c1 c2 = (cWorld . lWorld . creatures . ix mini .~ (c & crID .~ mini))
|
||||
fuseSlimes c1 c2 = (cWorld . lWorld . creatures . ix mini .~ c)
|
||||
. (cWorld . lWorld . creatures . at maxi .~ Nothing)
|
||||
where
|
||||
c' | c1 ^?! crType . slimeRad > c2 ^?! crType . slimeRad = c1
|
||||
| otherwise = c2
|
||||
mini = min i1 i2
|
||||
maxi = max i1 i2
|
||||
i1 = c1 ^. crID
|
||||
i2 = c2 ^. crID
|
||||
c = c1 & crType . slimeRad .~ r
|
||||
c = c' & 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 .~ if r1 > r2 then xy1 else xy2
|
||||
xy1 = c1 ^. crPos . _xy
|
||||
xy2 = c2 ^. crPos . _xy
|
||||
& crType . slimeCompression %~ ((r/max r1 r2) *^)
|
||||
& crID .~ mini
|
||||
r1 = c1 ^?! crType . slimeRad
|
||||
r2 = c2 ^?! crType . slimeRad
|
||||
r = sqrt (r1*r1 + r2*r2)
|
||||
|
||||
Reference in New Issue
Block a user