Add pistolCrit file, tweak shell spin params

This commit is contained in:
2021-05-13 19:21:52 +02:00
parent 2402e1e868
commit eed7865192
7 changed files with 147 additions and 45 deletions
+15 -6
View File
@@ -68,7 +68,8 @@ followImpulse cr w imp = case imp of
DropItem -> undefined
ChangeStrategy strat -> (id, cr & crActionPlan . crStrategy .~ strat)
AddGoal gl -> (id, cr & crActionPlan . crGoal %~ (gl :) )
ArbitraryCreatureImpulse f -> (id, f w cr)
ArbitraryImpulseFunction f -> (id, f w cr)
ArbitraryImpulse f -> followImpulse cr w (f cr w)
ImpulseUseTargetCID f -> case cr ^? crTarget . _Just of
Just tcid -> followImpulse cr w (f tcid)
_ -> (id,cr)
@@ -130,17 +131,18 @@ performAction cr w ac = case ac of
DoActionThen ac ac' -> case performAction cr w ac of
(imps , Just ac'') -> (imps, Just (DoActionThen ac'' ac'))
(imps , Nothing ) -> (imps, Just ac')
DoActionWhile ac f
| f (w,cr) -> (fst $ performAction cr w ac, Just $ DoActionWhile ac f)
| otherwise -> ([], Nothing)
DoActionWhile f ac -> performAction cr w $ DoActionWhilePartial ac f ac
DoActionWhilePartial partAc f resetAc
| f (w,cr) -> case performAction cr w partAc of
(imps, Just ac) -> (imps, Just $ DoActionWhilePartial ac f resetAc)
(imps, _) -> (imps, Just $ DoActionWhilePartial resetAc f resetAc)
| otherwise -> performAction cr w partAc
DoActionIfElse ac f ac'
| f (w,cr) -> performAction cr w ac
| otherwise -> performAction cr w ac'
DoActionWhileThen ac f ac'
| f (w,cr) -> (fst $ performAction cr w ac, Just $ DoActionWhileThen ac f ac')
| otherwise -> performAction cr w ac'
DoReplicateThen ac 0 ac' -> performAction cr w ac'
DoReplicateThen ac t ac' -> (fst $ performAction cr w ac, Just $ DoReplicateThen ac (t-1) ac')
DoActions [] -> ([], Nothing)
DoActions acs ->
let (imps, newAcs) = unzip $ map (performAction cr w) acs
@@ -161,6 +163,13 @@ performAction cr w ac = case ac of
Just tcid -> performAction cr w (f tcid)
_ -> ([],Nothing)
UseAheadPos f -> performAction cr w (f (_crPos cr +.+ 20 *.* unitVectorAtAngle (_crDir cr)))
ArbitraryAction f -> performAction cr w (f cr w)
DoImpulsesAlongside sideImpulses mainAc -> undefined
DoReplicate t ac -> performAction cr w $ DoReplicatePartial ac t ac
DoReplicatePartial _ 0 ac' -> performAction cr w ac'
DoReplicatePartial ac t ac' -> case performAction cr w ac' of
(imps , Just ac'') -> (imps, Just $ DoReplicatePartial ac t ac'')
(imps , _) -> (imps, Just $ DoReplicatePartial ac (t-1) ac)
_ -> ([], Nothing)
where
cpos = _crPos cr