Remove reified impulses from creature record
This commit is contained in:
@@ -33,11 +33,9 @@ import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
|
||||
performActions :: World -> Creature -> Creature
|
||||
performActions w cr =
|
||||
cr
|
||||
& crActionPlan . apImpulse .~ concat iss
|
||||
& crActionPlan . apAction .~ catMaybes mayas
|
||||
performActions :: World -> Creature -> ([Impulse],Creature)
|
||||
performActions w cr = (concat iss
|
||||
, cr & crActionPlan . apAction .~ catMaybes mayas)
|
||||
where
|
||||
(iss, mayas) = unzip $ map (performAction cr w) $ cr ^. crActionPlan . apAction
|
||||
|
||||
@@ -125,7 +123,7 @@ performAction cr w ac = case ac of
|
||||
LeadTarget p -> fromMaybe ([],Nothing) $ do
|
||||
i <- cr ^? crIntention . targetCr . _Just
|
||||
tcr <- w ^? cWorld . lWorld . creatures . ix i
|
||||
return $ ([TurnTo (tcr ^. crPos . _xy +.+ rotateV (_crDir tcr) p)], Nothing)
|
||||
return ([TurnTo (tcr ^. crPos . _xy +.+ rotateV (_crDir tcr) p)], Nothing)
|
||||
UseSelf f -> performAction cr w $ doCrAc f cr
|
||||
ArbitraryAction f -> performAction cr w (doCrWdAc f cr w)
|
||||
DoImpulsesAlongside sideImp mainAc -> case performAction cr w mainAc of
|
||||
|
||||
Reference in New Issue
Block a user