Add stretch animation to feeding bees
This commit is contained in:
@@ -12,7 +12,6 @@ module Dodge.Creature (
|
||||
module Dodge.Creature.Perception,
|
||||
module Dodge.Creature.ReaderUpdate,
|
||||
module Dodge.Creature.State,
|
||||
module Dodge.Creature.Strategy,
|
||||
module Dodge.Creature.Test,
|
||||
module Dodge.Creature.Volition,
|
||||
module Dodge.Creature.YourControl,
|
||||
@@ -35,7 +34,6 @@ import Dodge.Creature.Perception
|
||||
import Dodge.Creature.ReaderUpdate
|
||||
import Dodge.Creature.SpreadGunCrit
|
||||
import Dodge.Creature.State
|
||||
import Dodge.Creature.Strategy
|
||||
import Dodge.Creature.Test
|
||||
import Dodge.Creature.Volition
|
||||
import Dodge.Creature.YourControl
|
||||
|
||||
@@ -7,6 +7,7 @@ module Dodge.Creature.Picture (
|
||||
drawCreature,
|
||||
) where
|
||||
|
||||
import Geometry.Zone
|
||||
import Data.Foldable
|
||||
import qualified Data.Strict.Tuple as ST
|
||||
import RandomHelp
|
||||
@@ -121,7 +122,7 @@ drawHive = noPic $ upperPrismPolyHalfMI 25 $ polyCirc 6 20
|
||||
|
||||
drawBeeCrit :: Creature -> Shape
|
||||
drawBeeCrit cr = colorSH col
|
||||
(upperPrismPolyHalfMI 3 $ polyCirc 6 r)
|
||||
(f . upperPrismPolyHalfMI 3 $ polyCirc 6 r)
|
||||
<>
|
||||
colorSH (dark col) (overPosSH (Q.apply (beakpos)) $ upperPrismPolyHalfST 1 $ [V2 0 (-2), V2 4 0,V2 0 2])
|
||||
where
|
||||
@@ -129,6 +130,11 @@ drawBeeCrit cr = colorSH col
|
||||
beakpos = (V3 (r-1) 0 0, Q.qid)
|
||||
col | cr ^?! crType . beeAggro > 0 = red
|
||||
| otherwise = yellow
|
||||
f | Mounted {} <- cr ^. crStance . carriage
|
||||
= each . sfVs . each . _xy %~ scaleAlong (V2 0 1) (1 + g ( modTo 1 (cr ^?! crType . beeSlime)))
|
||||
| otherwise = id
|
||||
g x | x > 0.5 = 1 - x
|
||||
| otherwise = x
|
||||
|
||||
drawCrabCrit :: World -> Creature -> Shape
|
||||
drawCrabCrit w cr = mconcat
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
module Dodge.Creature.Strategy (
|
||||
goToPostStrat,
|
||||
) where
|
||||
|
||||
import Data.List
|
||||
import Dodge.Creature.Test
|
||||
import Dodge.Creature.Volition
|
||||
import Dodge.Data.Creature
|
||||
|
||||
goToPostStrat :: Creature -> Strategy
|
||||
goToPostStrat cr = case find sentinelGoal $ _apGoal $ _crActionPlan cr of
|
||||
Just (SentinelAt p _) ->
|
||||
SetStrategyAction
|
||||
(GetTo p)
|
||||
( DoActionThen (WaitThen 150 holsterIfAiming) $
|
||||
DoActionThen
|
||||
(PathTo p NoAction)
|
||||
NoAction
|
||||
-- $ DoImpulses [ChangeStrategy WatchAndWait]
|
||||
)
|
||||
_ -> WatchAndWait
|
||||
where
|
||||
sentinelGoal (SentinelAt _ _) = True
|
||||
sentinelGoal _ = False
|
||||
holsterIfAiming
|
||||
| crIsAiming cr = holsterWeapon
|
||||
| otherwise = NoAction
|
||||
@@ -128,10 +128,13 @@ updateAggroBee cr cid w
|
||||
| Just tcr <- listToMaybe . sortOn (distance cxy . (^. crPos . _xy)) . IM.elems . IM.filter istarget $ crsNearCirc cxy 100 w = w & tocr . crActionPlan . apStrategy .~ CloseToMelee (tcr ^. crID)
|
||||
& tocr . crActionPlan . apAction .~ PathTo (tcr ^. crPos . _xy) NoAction
|
||||
& tocr . crType . meleeCooldown %~ (max 0 . subtract 1)
|
||||
| Just PathTo{} <- cr ^? crActionPlan . apAction = w & tocr . crType . beeAggro -~ 1
|
||||
& tocr . crType . meleeCooldown %~ (max 0 . subtract 1)
|
||||
| otherwise = w & tocr . crType . beeAggro -~ 1
|
||||
& tocr . crActionPlan . apStrategy .~ Search
|
||||
& tocr . crType . meleeCooldown %~ (max 0 . subtract 1)
|
||||
where
|
||||
|
||||
vdir = unitVectorAtAngle (cr ^. crDir)
|
||||
cxy = cr ^. crPos . _xy
|
||||
tocr = cWorld . lWorld . creatures . ix cid
|
||||
|
||||
Reference in New Issue
Block a user