Fix basic pathing
This commit is contained in:
@@ -10,6 +10,7 @@ module Dodge.Creature.Action
|
||||
, pickUpItem
|
||||
)
|
||||
where
|
||||
import Dodge.Path
|
||||
import Dodge.Creature.Stance.Data
|
||||
import Dodge.WorldEvent.Shockwave
|
||||
import Dodge.Data
|
||||
@@ -60,10 +61,13 @@ performAimAt cr w tcid p = ([TurnToward tpos aimSp], Just $ AimAt tcid tpos)
|
||||
performPathTo :: Creature -> World -> Point2 -> OutAction
|
||||
performPathTo cr w p
|
||||
| dist cpos p < 5 = ([], Nothing)
|
||||
| hasLOS cpos p w = ([MvTurnToward p,MvForward] , Just (PathTo p))
|
||||
| otherwise = ([], Nothing)
|
||||
| hasLOS cpos p w = ([MvTurnToward p,MvForward,RandomTurn jit] , Just (PathTo p))
|
||||
| otherwise = case pointTowardsImpulse cpos p w of
|
||||
Just q -> ([MvTurnToward q,MvForward,RandomTurn jit] , Just (PathTo p))
|
||||
_ -> ([],Nothing)
|
||||
where
|
||||
cpos = _crPos cr
|
||||
jit = _mvTurnJit $ _crMvType cr
|
||||
|
||||
{- | Performing an action means that a creature has some impulses for a frame, and
|
||||
updates or deletes the action itself.
|
||||
|
||||
Reference in New Issue
Block a user