Zone creatures (casues slowdown)

This commit is contained in:
2022-07-01 19:05:46 +01:00
parent ca40f315c0
commit 9c7c5e1133
2 changed files with 4 additions and 7 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ updatePressedButtons subinv pkeys w = case subinv of
| otherwise -> updatePressedButtons' pkeys w | otherwise -> updatePressedButtons' pkeys w
CombineInventory mi CombineInventory mi
| pkeys ^? ix ButtonLeft == Just False | pkeys ^? ix ButtonLeft == Just False
-> (maybeexitcombine $ maybe id doCombine mi w) & hammers . ix SubInvHam .~ HammerDown -> maybeexitcombine (maybe id doCombine mi w) & hammers . ix SubInvHam .~ HammerDown
DisplayTerminal tmid DisplayTerminal tmid
| pkeys ^? ix ButtonLeft == Just False && inTermFocus w | pkeys ^? ix ButtonLeft == Just False && inTermFocus w
-> doTerminalEffectLB (w ^?! terminals . ix tmid) w -> doTerminalEffectLB (w ^?! terminals . ix tmid) w
+3 -6
View File
@@ -1,10 +1,9 @@
{-# LANGUAGE TupleSections #-} --{-# LANGUAGE TupleSections #-}
{- | {- |
Find which objects lie upon a line. Find which objects lie upon a line.
-} -}
module Dodge.WorldEvent.ThingsHit module Dodge.WorldEvent.ThingsHit
( thingsHit ( thingsHit
-- , wallsHit
, thingHit , thingHit
, thingsHitExceptCr , thingsHitExceptCr
) )
@@ -14,7 +13,7 @@ import Dodge.Base
import Dodge.Zone import Dodge.Zone
import Geometry import Geometry
import Data.Maybe --import Data.Maybe
import Data.Bifunctor import Data.Bifunctor
import StreamingHelp import StreamingHelp
import qualified Streaming.Prelude as S import qualified Streaming.Prelude as S
@@ -33,9 +32,7 @@ crsHit :: Point2 -> Point2 -> World -> StreamOf (Point2, Creature)
crsHit sp ep crsHit sp ep
| sp == ep = const mempty | sp == ep = const mempty
| otherwise = sortStreamOn (dist sp . fst) | otherwise = sortStreamOn (dist sp . fst)
. S.mapMaybe . overlap1SegCrs sp ep
(\cr -> (, cr) <$> listToMaybe (intersectCircSeg (_crPos cr) (_crRad cr) sp ep))
-- . S.each . _creatures
. crsNearSeg sp ep . crsNearSeg sp ep
thingHit :: Point2 -> Point2 -> World -> Maybe (Point2, Either Creature Wall) thingHit :: Point2 -> Point2 -> World -> Maybe (Point2, Either Creature Wall)