Slightly bulge slime when swallowing projectile

This commit is contained in:
2026-05-18 12:18:34 +01:00
parent e8738715e5
commit d29c2dbd0c
8 changed files with 75 additions and 51 deletions
+8 -8
View File
@@ -232,8 +232,8 @@ updateCalmBee cr cid w
cxy = cr ^. crPos . _xy
mountshakeoff mid = fromMaybe True $ do
mcr <- w ^? cWorld . lWorld . creatures . ix mid
SlimeCrit {_slimeSplitTimer = x} <- mcr ^? crType
return $ isJust x
x <- mcr ^? crType . slimeDistortion . sdTime
return $ x > 8
sspeed = 5
gettarg = do
i <- cr ^? crActionPlan . apStrategy . harvestTarget
@@ -263,11 +263,11 @@ updateSlimeCrit cid w
& cWorld . lWorld . creatures . ix cid %~ mvslime
& cWorld . lWorld . creatures . ix cid . crDamage .~ []
& tocr %~ doSlimeRadChange
& tocr . crType . slimeSplitTimer %~ fsst
& tocr . crType . slimeDistortion %~ fsst
& tocr . crType . slimeEngulfProgress %~ (max 0 . subtract 0.5)
where
fsst (Just (x,ps)) | x > 0 = Just (x-1,ps)
fsst _ = Nothing
fsst (SlimeDistortion x ps t) | x > 0 = SlimeDistortion (x-1) ps t
fsst _ = NoSlimeDistortion
tocr = cWorld . lWorld . creatures . ix cid
cr = w ^?! cWorld . lWorld . creatures . ix cid
mvslime cr' = cr' & crType . slimeCompression +~ f (0.1/r)
@@ -336,8 +336,8 @@ splitSlimeCrit p v cr = do
& crDir .~ argV (-mvdir)
c1ps = qs' & each +~ cxy - (mp + r1 *^ mvdir) & each %~ rotateV (- c1 ^. crDir)
c2ps = ps' & each +~ cxy - (mp - r2 *^ mvdir) & each %~ rotateV (- c2 ^. crDir)
return (c1 & crType . slimeSplitTimer . _Just . _2 .~ f c1ps c1
,c2 & crType . slimeSplitTimer . _Just . _2 .~ f c2ps c2
return (c1 & crType . slimeDistortion . sdShape .~ f c1ps c1
,c2 & crType . slimeDistortion . sdShape .~ f c2ps c2
)
where
f xs@(_:_) c = polyInPoly (centroid xs) xs (slimeOutline c)
@@ -346,7 +346,7 @@ splitSlimeCrit p v cr = do
r = cr ^?! crType . slimeSlime . to slimeToRad
cr' = cr & crDamage .~ []
& crType . slimeSlimeChange .~ 0
& crType . slimeSplitTimer ?~ (10, mempty)
& crType . slimeDistortion .~ SlimeDistortion 10 mempty True
& crType . slimeIsCompressing .~ False
& crType . slimeCompression .~ 1
(ps,qs) = cutPoly (p-cxy) (p+v-cxy) $ slimeOutline cr & each %~ rotateV (cr ^. crDir)