Refactor creature ai

This commit is contained in:
2021-05-20 21:25:42 +02:00
parent 4463dc7716
commit 114335fdbe
32 changed files with 449 additions and 270 deletions
+12 -2
View File
@@ -5,10 +5,11 @@ module Dodge.Creature.SwarmCrit
import Dodge.Data
import Dodge.Default
import Dodge.Creature.Picture
import Dodge.Creature.Boid
--import Dodge.Creature.Test
--import Dodge.Creature.ActionRat
import Dodge.Creature.ImpulseRat
import Dodge.Creature.ChooseTarget
--import Dodge.Creature.ChooseTarget
--import Dodge.Creature.SetTarget
import Dodge.Creature.Rationality
import Dodge.Creature.ReaderUpdate
@@ -30,7 +31,7 @@ import Control.Monad.Reader
swarmCrit :: Creature
swarmCrit = defaultCreature
{ _crUpdate = stateUpdate $ impulsiveAIR $
flockPointTargetR encircle targetYouLOS
flockToPointUsing (encircleDistP (100)) (meleeHeadingMove 0.1 0.1 (pi/4) 3.9)
>=> return . (crMeleeCooldown . _Just %~ (max 0 . subtract 1))
>=> basicPerceptionUpdateR [0]
>=> doStrategyActionsR
@@ -46,3 +47,12 @@ swarmCrit = defaultCreature
, _crFaction = ColorFaction yellow
, _crMeleeCooldown = Just 0
}
--swarmCritMoveFunc :: Creature -> Point2 -> Creature -> Point2
--swarmCritMoveFunc tcr cenp cr
-- | targBehindCrit
-- where
-- cpos = _crPos cr
-- ypos = _crPos tcr