Split off StreamingHelp module

This commit is contained in:
2022-06-28 12:26:37 +01:00
parent 0cb6657f35
commit e770fba7bf
7 changed files with 50 additions and 41 deletions
+3 -3
View File
@@ -20,13 +20,14 @@ import Dodge.Creature.Volition
import Dodge.Base
import Dodge.Zone
import Geometry
import FoldableHelp
import qualified Data.IntMap.Strict as IM
import Control.Lens
import Control.Applicative
import Data.Maybe
import Data.Bifunctor
--import StreamingHelp
import qualified Streaming.Prelude as S
overrideMeleeCloseTarget :: Creature -> Creature
overrideMeleeCloseTarget cr = maybe cr (tryMeleeAttack cr) (_targetCr $ _crIntention cr)
@@ -76,8 +77,7 @@ flockACC w cr = case cr ^? crIntention . targetCr . _Just of
isFarACC cr' = _crGroup cr' == _crGroup cr
&& _crID cr' /= _crID cr
&& dist (_crPos cr') tpos > dist cpos tpos
nearACCs = IM.filter isFarACC $ creaturesNearPointI 5 cpos w
macr = safeMinimumOn (dist cpos . _crPos) nearACCs
macr = minStreamOn (dist cpos . _crPos) . S.filter isFarACC $ crsInsideCirc cpos 50 w
in case macr of
Nothing -> cr
Just acr ->