diff --git a/src/Dodge/Creature/Impulse/Movement.hs b/src/Dodge/Creature/Impulse/Movement.hs index 3c1653ffc..db5d0befa 100644 --- a/src/Dodge/Creature/Impulse/Movement.hs +++ b/src/Dodge/Creature/Impulse/Movement.hs @@ -120,16 +120,16 @@ creatureTurnToward p turnSpeed cr vToTarg = p -.- cr ^. crPos . _xy dirToTarget = argV vToTarg +-- I feel like this is inefficient mvTurnToward :: Point2 -> Float -> Creature -> Creature mvTurnToward p' turnSpeed cr | vToTarg == V2 0 0 = cr -- this should deal with the angleVV error --- | errorAngleVV 3 vToTarg (unitVectorAtAngle (_crDir cr)) <= turnSpeed = | angleVV vToTarg (unitVectorAtAngle (_crDir cr)) <= turnSpeed = cr & crDir .~ dirToTarget | isLeftOfA (normalizeAngle dirToTarget) (normalizeAngle $ _crDir cr) = cr & crDir +~ turnSpeed | otherwise = cr & crDir -~ turnSpeed where - -- when flying, inertia is high enough that overturning can be usefull + -- when flying, inertia is high enough that overturning can be useful p | Flying {} <- cr ^. crStance . carriage = let v = flyInertia cr *^ (cr ^. crOldPos . _xy - cr ^. crOldOldPos . _xy) -- u = normalize $ vNormal $ p' - cxy @@ -137,5 +137,5 @@ mvTurnToward p' turnSpeed cr in p' - v | otherwise = p' cxy = cr ^. crPos . _xy - vToTarg = p -.- cr ^. crPos . _xy + vToTarg = p -.- cxy dirToTarget = argV vToTarg diff --git a/src/Dodge/Creature/Update.hs b/src/Dodge/Creature/Update.hs index 0a620f03c..ea1d26d14 100644 --- a/src/Dodge/Creature/Update.hs +++ b/src/Dodge/Creature/Update.hs @@ -138,8 +138,13 @@ updateAggroBee cr cid w vdir = unitVectorAtAngle (cr ^. crDir) cxy = cr ^. crPos . _xy tocr = cWorld . lWorld . creatures . ix cid - istarget tcr = tcr ^. crID == 0 + istarget tcr = t (tcr ^. crType) + && isJust (tcr ^? crHP . _HP) && hasLOS cxy (tcr ^. crPos . _xy) w + t = \case + Avatar{} -> True + ChaseCrit{} -> True + _ -> False -- do bees need to be able to see slime targets? -- if no path can be made, reset harvest action