Add jitter on chase crit bark

This commit is contained in:
2022-05-19 10:58:13 +01:00
parent 565a71a5a2
commit 41e5538eb7
5 changed files with 45 additions and 10 deletions
+4
View File
@@ -13,6 +13,7 @@ import LensHelp
import qualified Data.IntMap.Strict as IM
import System.Random
import Control.Monad.State
import Data.Bifunctor
--import Data.Maybe
--
@@ -49,6 +50,9 @@ followImpulses w cr = foldr f (id, cr) (_crImpulse $ _crActionPlan cr)
followImpulse :: Creature -> World -> Impulse -> (World -> World , Creature)
followImpulse cr w imp = case imp of
RandomImpulse rimp ->
let (newimp,newgen) = runState rimp (_randGen w)
in first ((randGen .~ newgen) .) $ followImpulse cr w newimp
Bark sid -> (soundStart (CrMouth cid) cpos sid Nothing, resetCrVocCoolDown cr)
Move p -> crup $ crMvBy p cr
MoveForward x -> crup $ crMvForward x cr