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
CombineInventory mi
| 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
| pkeys ^? ix ButtonLeft == Just False && inTermFocus 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.
-}
module Dodge.WorldEvent.ThingsHit
( thingsHit
-- , wallsHit
, thingHit
, thingsHitExceptCr
)
@@ -14,7 +13,7 @@ import Dodge.Base
import Dodge.Zone
import Geometry
import Data.Maybe
--import Data.Maybe
import Data.Bifunctor
import StreamingHelp
import qualified Streaming.Prelude as S
@@ -33,9 +32,7 @@ crsHit :: Point2 -> Point2 -> World -> StreamOf (Point2, Creature)
crsHit sp ep
| sp == ep = const mempty
| otherwise = sortStreamOn (dist sp . fst)
. S.mapMaybe
(\cr -> (, cr) <$> listToMaybe (intersectCircSeg (_crPos cr) (_crRad cr) sp ep))
-- . S.each . _creatures
. overlap1SegCrs sp ep
. crsNearSeg sp ep
thingHit :: Point2 -> Point2 -> World -> Maybe (Point2, Either Creature Wall)