Cleanup
This commit is contained in:
+1
-19
@@ -993,7 +993,6 @@ canSpring cr =
|
|||||||
CrIsCorpse{} -> True
|
CrIsCorpse{} -> True
|
||||||
CrDestroyed{} -> False
|
CrDestroyed{} -> False
|
||||||
|
|
||||||
-- should possibly limit how big this can get
|
|
||||||
crCrSpring :: Creature -> Creature -> World -> World
|
crCrSpring :: Creature -> Creature -> World -> World
|
||||||
crCrSpring c1 c2
|
crCrSpring c1 c2
|
||||||
| id1 == id2 = id
|
| id1 == id2 = id
|
||||||
@@ -1011,7 +1010,6 @@ crCrSpring c1 c2
|
|||||||
| Just t <- c1 ^? crType . slimeSplitTimer
|
| Just t <- c1 ^? crType . slimeSplitTimer
|
||||||
, slimeFood c2
|
, slimeFood c2
|
||||||
, t <= 0 = slimeSuck c1 c2
|
, t <= 0 = slimeSuck c1 c2
|
||||||
-- cWorld . lWorld . creatures %~ (rolap . rolap')
|
|
||||||
| SlimeCrit{} <- c1 ^. crType = id
|
| SlimeCrit{} <- c1 ^. crType = id
|
||||||
| SlimeCrit{} <- c2 ^. crType = id
|
| SlimeCrit{} <- c2 ^. crType = id
|
||||||
| otherwise = cWorld . lWorld . creatures %~ ( olap c1 c2 . olap' c2 c1)
|
| otherwise = cWorld . lWorld . creatures %~ ( olap c1 c2 . olap' c2 c1)
|
||||||
@@ -1024,10 +1022,6 @@ crCrSpring c1 c2
|
|||||||
return $ z c1 > h2 || z c2 > h1
|
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
|
||||||
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))) ^ (2:: Int)
|
|
||||||
-- 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)
|
|
||||||
f = min (distance xy1 xy2/2)
|
|
||||||
id1 = _crID c1
|
id1 = _crID c1
|
||||||
id2 = _crID c2
|
id2 = _crID c2
|
||||||
xy1 = c1 ^. crPos . _xy
|
xy1 = c1 ^. crPos . _xy
|
||||||
@@ -1039,8 +1033,6 @@ crCrSpring c1 c2
|
|||||||
comRad = crRad (c1 ^. crType) + crRad (c2 ^. crType)
|
comRad = crRad (c1 ^. crType) + crRad (c2 ^. crType)
|
||||||
overlap c = ((comRad - diff) * crMass (_crType c) * 0.5 / massT) *^ signorm vec
|
overlap c = ((comRad - diff) * crMass (_crType c) * 0.5 / massT) *^ signorm vec
|
||||||
massT = crMass (_crType c1) + crMass (_crType c2)
|
massT = crMass (_crType c1) + crMass (_crType c2)
|
||||||
m1 = crMass $ c1 ^. crType
|
|
||||||
m2 = crMass $ c2 ^. crType
|
|
||||||
|
|
||||||
slimeSuck :: Creature -> Creature -> World -> World
|
slimeSuck :: Creature -> Creature -> World -> World
|
||||||
slimeSuck c1 c2 = cWorld . lWorld . creatures %~ (rolap . rolap')
|
slimeSuck c1 c2 = cWorld . lWorld . creatures %~ (rolap . rolap')
|
||||||
@@ -1082,17 +1074,7 @@ feedSlime s c w = fromMaybe w $ do
|
|||||||
& crType . slimeCompression %~ ((r/r1) *^)
|
& crType . slimeCompression %~ ((r/r1) *^)
|
||||||
r1 = s ^?! crType . slimeRad
|
r1 = s ^?! crType . slimeRad
|
||||||
r2 = c ^. crType . to crRad
|
r2 = c ^. crType . to crRad
|
||||||
r = sqrt (r1*r1 + 4*r2*r2)
|
r = sqrt (r1*r1 + 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 :: Creature -> Creature -> World -> World
|
||||||
fuseSlimes c1 c2 = (cWorld . lWorld . creatures . ix mini .~ c)
|
fuseSlimes c1 c2 = (cWorld . lWorld . creatures . ix mini .~ c)
|
||||||
|
|||||||
Reference in New Issue
Block a user