From 9c7c5e1133904d50a730e9ee1d359ee660a04f84 Mon Sep 17 00:00:00 2001 From: justin Date: Fri, 1 Jul 2022 19:05:46 +0100 Subject: [PATCH] Zone creatures (casues slowdown) --- src/Dodge/Update/UsingInput.hs | 2 +- src/Dodge/WorldEvent/ThingsHit.hs | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Dodge/Update/UsingInput.hs b/src/Dodge/Update/UsingInput.hs index 89d4b1866..fe3639f4d 100644 --- a/src/Dodge/Update/UsingInput.hs +++ b/src/Dodge/Update/UsingInput.hs @@ -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 diff --git a/src/Dodge/WorldEvent/ThingsHit.hs b/src/Dodge/WorldEvent/ThingsHit.hs index 18214e99e..882938247 100644 --- a/src/Dodge/WorldEvent/ThingsHit.hs +++ b/src/Dodge/WorldEvent/ThingsHit.hs @@ -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)