Cleanup, trying to diagnose space leak in crit update
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
module Dodge.Creature.SentinelAI
|
||||
( sentinelAI
|
||||
, sentinelFireType
|
||||
, sentinelFireTypeR
|
||||
, sentinelExtraWatchUpdate
|
||||
) where
|
||||
import Dodge.Data
|
||||
@@ -40,11 +41,40 @@ sentinelAI = sentinelExtraWatchUpdate
|
||||
tcid cr = _crID <$> _targetCr (_crIntention cr)
|
||||
lostest (w,cr) = maybe False (\cid -> canSee (_crID cr) cid w) (tcid cr)
|
||||
|
||||
sentinelFireType
|
||||
chainCreatureUpdates :: [World -> Creature -> Creature] -> World -> Creature -> Creature
|
||||
chainCreatureUpdates ls w cr = foldr (\f -> f w) cr ls
|
||||
|
||||
sentinelFireType :: (Int -> Action) -> World -> Creature -> Creature
|
||||
sentinelFireType f = chainCreatureUpdates
|
||||
[ performActions
|
||||
, watchUpdateStrat
|
||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
||||
[ drawwp `DoActionThen` f 0 `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait]
|
||||
, aiming
|
||||
]
|
||||
)
|
||||
, (crAwayFromPost, goToPostStrat)
|
||||
]
|
||||
, perceptionUpdate' [0]
|
||||
, doStrategyActions
|
||||
, reloadOverride
|
||||
, targetYouWhenCognizant
|
||||
, overrideInternal
|
||||
(\cr -> crHasTarget' cr && crStratConMatches' (GetTo (V2 0 0)) cr)
|
||||
((crActionPlan . crStrategy .~ WatchAndWait))
|
||||
]
|
||||
where
|
||||
drawwp = DoActionIfElse NoAction crIsAiming (DoActionThen drawWeapon (WaitThen 50 NoAction))
|
||||
aiming = AimAt
|
||||
{ _targetID = 0
|
||||
, _targetSeenAt = V2 0 0 -- hack
|
||||
}
|
||||
|
||||
sentinelFireTypeR
|
||||
:: (Int -> Action)
|
||||
-> Creature
|
||||
-> Reader World Creature
|
||||
sentinelFireType f = performActionsR
|
||||
sentinelFireTypeR f = performActionsR
|
||||
>=> watchUpdateStratR
|
||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
||||
[ drawwp `DoActionThen` f 0 `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait]
|
||||
|
||||
Reference in New Issue
Block a user