Move creature speed parameters into explicit data
This commit is contained in:
@@ -41,17 +41,18 @@ chaseTargetR targFunc cr = reader $ \w -> case targFunc cr w of
|
||||
Just crTarg -> cr & crActionPlan . crImpulse .~ chaseTarg cr crTarg
|
||||
|
||||
chaseTarg :: Creature -> Creature -> [Impulse]
|
||||
chaseTarg cr crT
|
||||
| dist tpos cpos < combinedRad + 5
|
||||
&& abs (_crDir cr - argV (tpos -.- cpos)) < pi/4
|
||||
= [ TurnToward tpos 0.05 ]
|
||||
| abs (_crDir cr - argV (tpos -.- cpos)) < pi/4
|
||||
= [MoveForward 2.5 , TurnToward tpos 0.2, RandomTurn 0.2 ]
|
||||
| otherwise = [MoveForward 2.5 , TurnToward tpos 0.05, RandomTurn 0.2 ]
|
||||
chaseTarg cr crT = [MoveForward speed, TurnToward tpos (trad dirOffset), RandomTurn jit]
|
||||
where
|
||||
cpos = _crPos cr
|
||||
tpos = _crPos crT
|
||||
combinedRad = _crRad cr + _crRad crT
|
||||
mvType = _crMvType cr
|
||||
speed = _chaseSpeed mvType
|
||||
trad = _chaseTurnRad mvType
|
||||
jit = _chaseTurnJit mvType
|
||||
dirOffset = abs (_crDir cr - argV (tpos -.- cpos))
|
||||
-- | abs (_crDir cr - argV (tpos -.- cpos)) < pi/4
|
||||
-- = [MoveForward 2.5 , TurnToward tpos 0.2, RandomTurn 0.2 ]
|
||||
-- | otherwise = [MoveForward 2.5 , TurnToward tpos 0.05, RandomTurn 0.2 ]
|
||||
|
||||
doStrategyActionsR
|
||||
:: Creature
|
||||
|
||||
Reference in New Issue
Block a user