Slow down slime feeding

This commit is contained in:
2026-04-16 08:43:53 +01:00
parent a0ff15fe61
commit 9e215b474f
5 changed files with 22 additions and 7 deletions
+2 -1
View File
@@ -58,6 +58,7 @@ slinkCrit = defaultCreature
& crType .~ SlinkCrit
{ _meleeCooldown = 0
, _slinkSpine = replicate 15 (V3 0 0 2, Q.axisAngle (V3 0 1 0) (pi/15))
, _slinkHeadPos = (V3 20 0 15, Q.axisAngle (V3 0 1 0) (pi/2))
}
& crFaction .~ ColorFaction red
& crPerception . cpVision . viFOV .~ FloatFOV pi
@@ -66,7 +67,7 @@ slimeCrit :: Creature
slimeCrit = defaultCreature
& crName .~ "slimeCrit"
& crHP .~ HP 1000
& crType .~ SlimeCrit r 0 0 (V2 r 0) False
& crType .~ SlimeCrit r 0 0 (V2 r 0) False 0
& crFaction .~ ColorFaction (light green)
& crPerception . cpVision . viFOV .~ FloatFOV pi
& crActionPlan .~ SlimeIntelligence
+7 -2
View File
@@ -54,7 +54,8 @@ drawCreature w m cr = translateSP (_crPos cr) . fallrot . rotateSP (_crDir cr) $
_ -> id
drawSlimeCrit :: Creature -> Shape
drawSlimeCrit cr = colorSH green $ upperPrismPolyHalf Medium Typical r $ polyCirc 6 r
drawSlimeCrit cr = colorSH green
$ upperPrismPolyHalf Medium Typical (cr ^?! crType . slimeFeedProgress + min 10 r) $ polyCirc 6 r
& each %~ scaleAlong d s
& each %~ scaleAlong (vNormal d) (1 / s)
& each %~ rotateV (-cr ^. crDir)
@@ -93,11 +94,15 @@ basicCrShape cr
drawSlinkCrit :: Creature -> Shape
drawSlinkCrit cr = snd (foldl' f ((V3 0 0 0,Q.qid), mempty) $ cr ^?! crType . slinkSpine)
<> shead
& each . sfColor .~ cskin ^?! skinUpper
where
shead = polyCirc 6 15
& upperPrismPoly Medium Important 10
& each . sfVs . each %~ Q.apply (cr ^?! crType . slinkHeadPos)
cskin = crShape $ _crType cr
f ((p,q),sh) (p',q') = ((p,q) `Q.comp` (p',q'), sh <> (g p' & each . sfVs . each %~ Q.apply (p,q)))
g _ = upperPrismPoly Medium Important 2 $ polyCirc 6 10
g _ = upperPrismPoly Medium Important 2 $ polyCirc 6 15
drawHoverCrit :: Creature -> Shape
drawHoverCrit cr = colorSH (_skinHead cskin)
+2
View File
@@ -87,6 +87,7 @@ slimeCritUpdate cid w
& cWorld . lWorld . creatures . ix cid . crDamage .~ []
& tocr %~ doSlimeRadChange
& tocr . crType . slimeSplitTimer %~ (max 0 . subtract 1)
& tocr . crType . slimeFeedProgress %~ (max 0 . subtract 0.5)
where
tocr = cWorld . lWorld . creatures . ix cid
cr = w ^?! cWorld . lWorld . creatures . ix cid
@@ -160,6 +161,7 @@ splitSlimeCrit p v cr = do
& crType . slimeRad .~ r2
& crType . slimeCompression .~ rotateV (argV (-mvdir)) (V2 r2 0)
& crDir .~ argV (-mvdir)
& crType . slimeFeedProgress .~ 0
)
where
cxy = cr ^. crPos . _xy
+2
View File
@@ -69,6 +69,7 @@ data CreatureType
| SlinkCrit
{ _meleeCooldown :: Int
, _slinkSpine :: [Point3Q]
, _slinkHeadPos :: Point3Q
}
| SlimeCrit
{ _slimeRad :: Float
@@ -76,6 +77,7 @@ data CreatureType
, _slimeSplitTimer :: Int
, _slimeCompression :: Point2
, _slimeIsCompressing :: Bool
, _slimeFeedProgress :: Float
}
| SwarmCrit
| AutoCrit
+9 -4
View File
@@ -1049,10 +1049,15 @@ slimeFood cr = case cr ^. crType of
_ -> False
feedSlime :: Creature -> Creature -> World -> World
feedSlime s c w = w
& cWorld . lWorld . creatures . ix (c ^. crID) . crHP .~ CrDestroyed Swallowed
& cWorld . lWorld . creatures . ix (s ^. crID) %~ f
& slimeEatSound (s ^. crID) (s ^. crPos . _xy)
feedSlime s c w = fromMaybe w $ do
ch <- crHeight c
return $ if min 10 r1 + s ^?! crType . slimeFeedProgress < ch + 2
then w & cWorld . lWorld . creatures . ix (s ^. crID) . crType . slimeFeedProgress %~ (min r1 . (+0.7))
else
w
& cWorld . lWorld . creatures . ix (c ^. crID) . crHP .~ CrDestroyed Swallowed
& cWorld . lWorld . creatures . ix (s ^. crID) %~ f
& slimeEatSound (s ^. crID) (s ^. crPos . _xy)
where
f cr = cr & crType . slimeRad .~ r
& crType . slimeRadWobble +~ r - r1