ActionPlan refactor
This commit is contained in:
@@ -15,11 +15,9 @@ module Dodge.Creature.ReaderUpdate
|
||||
, setViewPos
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Creature.Test
|
||||
import Dodge.Creature.Volition
|
||||
import Dodge.Base
|
||||
import Dodge.Zone
|
||||
import Dodge.Path
|
||||
import Geometry
|
||||
|
||||
import qualified IntMapHelp as IM
|
||||
@@ -106,7 +104,7 @@ goToTarget w cr =
|
||||
_ -> viewTarget w cr
|
||||
|
||||
lookAroundSelf :: Action
|
||||
lookAroundSelf = UseSelf $ \cr -> TurnToPoint (_crPos cr -.- 10 *.* unitVectorAtAngle (_crDir cr))
|
||||
lookAroundSelf = UseSelf CrTurnAround -- $ \cr -> TurnToPoint (_crPos cr -.- 10 *.* unitVectorAtAngle (_crDir cr))
|
||||
|
||||
viewTarget :: World -> Creature -> Creature
|
||||
viewTarget w cr = do
|
||||
@@ -188,12 +186,13 @@ searchIfDamaged cr
|
||||
| otherwise = cr
|
||||
|
||||
bfsThenReturn :: Int -> Action
|
||||
bfsThenReturn t = ArbitraryAction theaction
|
||||
where
|
||||
theaction cr w = fromMaybe NoAction $ do
|
||||
n <- walkableNodeNear w (_crPos cr)
|
||||
let as = take 20 $ map PathTo $ bfsNodePoints n w
|
||||
return $ DoReplicate t $
|
||||
foldr DoActionThen NoAction as
|
||||
bfsThenReturn t = ArbitraryAction (CrWdBFSThenReturn t)
|
||||
-- theaction
|
||||
-- where
|
||||
-- theaction cr w = fromMaybe NoAction $ do
|
||||
-- n <- walkableNodeNear w (_crPos cr)
|
||||
-- let as = take 20 $ map PathTo $ bfsNodePoints n w
|
||||
-- return $ DoReplicate t $
|
||||
-- foldr DoActionThen NoAction as
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user