Slow down slime feeding
This commit is contained in:
@@ -58,6 +58,7 @@ slinkCrit = defaultCreature
|
|||||||
& crType .~ SlinkCrit
|
& crType .~ SlinkCrit
|
||||||
{ _meleeCooldown = 0
|
{ _meleeCooldown = 0
|
||||||
, _slinkSpine = replicate 15 (V3 0 0 2, Q.axisAngle (V3 0 1 0) (pi/15))
|
, _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
|
& crFaction .~ ColorFaction red
|
||||||
& crPerception . cpVision . viFOV .~ FloatFOV pi
|
& crPerception . cpVision . viFOV .~ FloatFOV pi
|
||||||
@@ -66,7 +67,7 @@ slimeCrit :: Creature
|
|||||||
slimeCrit = defaultCreature
|
slimeCrit = defaultCreature
|
||||||
& crName .~ "slimeCrit"
|
& crName .~ "slimeCrit"
|
||||||
& crHP .~ HP 1000
|
& 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)
|
& crFaction .~ ColorFaction (light green)
|
||||||
& crPerception . cpVision . viFOV .~ FloatFOV pi
|
& crPerception . cpVision . viFOV .~ FloatFOV pi
|
||||||
& crActionPlan .~ SlimeIntelligence
|
& crActionPlan .~ SlimeIntelligence
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ drawCreature w m cr = translateSP (_crPos cr) . fallrot . rotateSP (_crDir cr) $
|
|||||||
_ -> id
|
_ -> id
|
||||||
|
|
||||||
drawSlimeCrit :: Creature -> Shape
|
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 d s
|
||||||
& each %~ scaleAlong (vNormal d) (1 / s)
|
& each %~ scaleAlong (vNormal d) (1 / s)
|
||||||
& each %~ rotateV (-cr ^. crDir)
|
& each %~ rotateV (-cr ^. crDir)
|
||||||
@@ -93,11 +94,15 @@ basicCrShape cr
|
|||||||
|
|
||||||
drawSlinkCrit :: Creature -> Shape
|
drawSlinkCrit :: Creature -> Shape
|
||||||
drawSlinkCrit cr = snd (foldl' f ((V3 0 0 0,Q.qid), mempty) $ cr ^?! crType . slinkSpine)
|
drawSlinkCrit cr = snd (foldl' f ((V3 0 0 0,Q.qid), mempty) $ cr ^?! crType . slinkSpine)
|
||||||
|
<> shead
|
||||||
& each . sfColor .~ cskin ^?! skinUpper
|
& each . sfColor .~ cskin ^?! skinUpper
|
||||||
where
|
where
|
||||||
|
shead = polyCirc 6 15
|
||||||
|
& upperPrismPoly Medium Important 10
|
||||||
|
& each . sfVs . each %~ Q.apply (cr ^?! crType . slinkHeadPos)
|
||||||
cskin = crShape $ _crType cr
|
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)))
|
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 :: Creature -> Shape
|
||||||
drawHoverCrit cr = colorSH (_skinHead cskin)
|
drawHoverCrit cr = colorSH (_skinHead cskin)
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ slimeCritUpdate cid w
|
|||||||
& cWorld . lWorld . creatures . ix cid . crDamage .~ []
|
& cWorld . lWorld . creatures . ix cid . crDamage .~ []
|
||||||
& tocr %~ doSlimeRadChange
|
& tocr %~ doSlimeRadChange
|
||||||
& tocr . crType . slimeSplitTimer %~ (max 0 . subtract 1)
|
& tocr . crType . slimeSplitTimer %~ (max 0 . subtract 1)
|
||||||
|
& tocr . crType . slimeFeedProgress %~ (max 0 . subtract 0.5)
|
||||||
where
|
where
|
||||||
tocr = cWorld . lWorld . creatures . ix cid
|
tocr = cWorld . lWorld . creatures . ix cid
|
||||||
cr = w ^?! 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 . slimeRad .~ r2
|
||||||
& crType . slimeCompression .~ rotateV (argV (-mvdir)) (V2 r2 0)
|
& crType . slimeCompression .~ rotateV (argV (-mvdir)) (V2 r2 0)
|
||||||
& crDir .~ argV (-mvdir)
|
& crDir .~ argV (-mvdir)
|
||||||
|
& crType . slimeFeedProgress .~ 0
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
cxy = cr ^. crPos . _xy
|
cxy = cr ^. crPos . _xy
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ data CreatureType
|
|||||||
| SlinkCrit
|
| SlinkCrit
|
||||||
{ _meleeCooldown :: Int
|
{ _meleeCooldown :: Int
|
||||||
, _slinkSpine :: [Point3Q]
|
, _slinkSpine :: [Point3Q]
|
||||||
|
, _slinkHeadPos :: Point3Q
|
||||||
}
|
}
|
||||||
| SlimeCrit
|
| SlimeCrit
|
||||||
{ _slimeRad :: Float
|
{ _slimeRad :: Float
|
||||||
@@ -76,6 +77,7 @@ data CreatureType
|
|||||||
, _slimeSplitTimer :: Int
|
, _slimeSplitTimer :: Int
|
||||||
, _slimeCompression :: Point2
|
, _slimeCompression :: Point2
|
||||||
, _slimeIsCompressing :: Bool
|
, _slimeIsCompressing :: Bool
|
||||||
|
, _slimeFeedProgress :: Float
|
||||||
}
|
}
|
||||||
| SwarmCrit
|
| SwarmCrit
|
||||||
| AutoCrit
|
| AutoCrit
|
||||||
|
|||||||
+6
-1
@@ -1049,7 +1049,12 @@ slimeFood cr = case cr ^. crType of
|
|||||||
_ -> False
|
_ -> False
|
||||||
|
|
||||||
feedSlime :: Creature -> Creature -> World -> World
|
feedSlime :: Creature -> Creature -> World -> World
|
||||||
feedSlime s c w = w
|
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 (c ^. crID) . crHP .~ CrDestroyed Swallowed
|
||||||
& cWorld . lWorld . creatures . ix (s ^. crID) %~ f
|
& cWorld . lWorld . creatures . ix (s ^. crID) %~ f
|
||||||
& slimeEatSound (s ^. crID) (s ^. crPos . _xy)
|
& slimeEatSound (s ^. crID) (s ^. crPos . _xy)
|
||||||
|
|||||||
Reference in New Issue
Block a user