Move zoning up world spheres
This commit is contained in:
@@ -7,14 +7,13 @@ import qualified IntMapHelp as IM
|
||||
import Dodge.Zoning.Common
|
||||
|
||||
clsNearPoint :: Point2 -> World -> [Cloud]
|
||||
--clsNearPoint p w = zoneExtract (zoneOfPoint clZoneSize p) (w ^. cWorld . lWorld . clZoning)
|
||||
clsNearPoint = nearPoint clZoneSize _clZoning
|
||||
clsNearPoint = nearPoint' clZoneSize _clZoning
|
||||
|
||||
clsNearSeg :: Point2 -> Point2 -> World -> [Cloud]
|
||||
clsNearSeg = nearSeg clZoneSize _clZoning
|
||||
clsNearSeg = nearSeg' clZoneSize _clZoning
|
||||
|
||||
clsNearRect :: Point2 -> Point2 -> World -> [Cloud]
|
||||
clsNearRect = nearRect clZoneSize _clZoning
|
||||
clsNearRect = nearRect' clZoneSize _clZoning
|
||||
|
||||
clsNearCirc :: Point2 -> Float -> World -> [Cloud]
|
||||
clsNearCirc p r = clsNearRect (p +.+ V2 r r) (p -.- V2 r r)
|
||||
|
||||
@@ -10,10 +10,22 @@ nearPoint :: Monoid m => Float -> (LWorld -> IM.IntMap (IM.IntMap m)) -> Point2
|
||||
{-# INLINE nearPoint #-}
|
||||
nearPoint size f p w = zoneExtract (zoneOfPoint size p) (f $ w ^. cWorld . lWorld)
|
||||
|
||||
nearPoint' :: Monoid m => Float -> (World -> IM.IntMap (IM.IntMap m)) -> Point2 -> World -> m
|
||||
{-# INLINE nearPoint' #-}
|
||||
nearPoint' size f p w = zoneExtract (zoneOfPoint size p) (f w)
|
||||
|
||||
nearSeg :: Monoid m => Float -> (LWorld -> IM.IntMap (IM.IntMap m)) -> Point2 -> Point2 -> World -> m
|
||||
{-# INLINE nearSeg #-}
|
||||
nearSeg size f sp ep w = zonesExtract (f $ w ^. cWorld . lWorld) (zoneOfSeg size sp ep)
|
||||
|
||||
nearSeg' :: Monoid m => Float -> (World -> IM.IntMap (IM.IntMap m)) -> Point2 -> Point2 -> World -> m
|
||||
{-# INLINE nearSeg' #-}
|
||||
nearSeg' size f sp ep w = zonesExtract (f w) (zoneOfSeg size sp ep)
|
||||
|
||||
nearRect :: Monoid m => Float -> (LWorld -> IM.IntMap (IM.IntMap m)) -> Point2 -> Point2 -> World -> m
|
||||
{-# INLINE nearRect #-}
|
||||
nearRect size f sp ep w = zonesExtract (f $ w ^. cWorld . lWorld) (zoneOfRect size sp ep)
|
||||
|
||||
nearRect' :: Monoid m => Float -> (World -> IM.IntMap (IM.IntMap m)) -> Point2 -> Point2 -> World -> m
|
||||
{-# INLINE nearRect' #-}
|
||||
nearRect' size f sp ep w = zonesExtract (f w) (zoneOfRect size sp ep)
|
||||
|
||||
@@ -12,7 +12,7 @@ import Dodge.Zoning.Common
|
||||
|
||||
crIXsNearPoint :: Point2 -> World -> IS.IntSet
|
||||
--crIXsNearPoint p w = zoneExtract (zoneOfPoint crZoneSize p) (w ^. cWorld . lWorld . crZoning)
|
||||
crIXsNearPoint = nearPoint crZoneSize _crZoning
|
||||
crIXsNearPoint = nearPoint' crZoneSize _crZoning
|
||||
|
||||
crsNearPoint :: Point2 -> World -> [Creature]
|
||||
crsNearPoint p w = mapMaybe (\cid -> w ^? cWorld . lWorld . creatures . ix cid) . IS.toList $ crIXsNearPoint p w
|
||||
@@ -24,7 +24,7 @@ crsNearSeg sp ep w =
|
||||
$ crixsNearSeg sp ep w
|
||||
|
||||
crixsNearSeg :: Point2 -> Point2 -> World -> IS.IntSet
|
||||
crixsNearSeg = nearSeg crZoneSize _crZoning
|
||||
crixsNearSeg = nearSeg' crZoneSize _crZoning
|
||||
--crixsNearSeg sp ep w = zonesExtract (w ^. cWorld . lWorld . crZoning) (zoneOfSeg crZoneSize sp ep)
|
||||
|
||||
crIXsNearCirc :: Point2 -> Float -> World -> IS.IntSet
|
||||
@@ -34,7 +34,7 @@ crsNearCirc :: Point2 -> Float -> World -> [Creature]
|
||||
crsNearCirc p r w = mapMaybe (\cid -> w ^? cWorld . lWorld . creatures . ix cid) . IS.toList $ crIXsNearCirc p r w
|
||||
|
||||
crsNearRect :: Point2 -> Point2 -> World -> IS.IntSet
|
||||
crsNearRect = nearRect crZoneSize _crZoning
|
||||
crsNearRect = nearRect' crZoneSize _crZoning
|
||||
|
||||
crZoneSize :: Float
|
||||
crZoneSize = 15
|
||||
|
||||
@@ -10,13 +10,13 @@ import qualified Data.Set as Set
|
||||
import Dodge.Zoning.Common
|
||||
|
||||
pnsNearPoint :: Point2 -> World -> [(Int, Point2)]
|
||||
pnsNearPoint = nearPoint pnZoneSize _pnZoning
|
||||
pnsNearPoint = nearPoint' pnZoneSize _pnZoning
|
||||
|
||||
pnsNearSeg :: Point2 -> Point2 -> World -> [(Int, Point2)]
|
||||
pnsNearSeg = nearSeg pnZoneSize _pnZoning
|
||||
pnsNearSeg = nearSeg' pnZoneSize _pnZoning
|
||||
|
||||
pnsNearRect :: Point2 -> Point2 -> World -> [(Int, Point2)]
|
||||
pnsNearRect = nearRect pnZoneSize _pnZoning
|
||||
pnsNearRect = nearRect' pnZoneSize _pnZoning
|
||||
|
||||
pnsNearCirc :: Point2 -> Float -> World -> [(Int, Point2)]
|
||||
pnsNearCirc p r = pnsNearRect (p +.+ V2 r r) (p -.- V2 r r)
|
||||
@@ -31,14 +31,14 @@ zonePn :: (Int, Point2) -> IM.IntMap (IM.IntMap [(Int, Point2)]) -> IM.IntMap (I
|
||||
zonePn pn = zoneMonoid (zoneOfPn pn) [pn]
|
||||
|
||||
pesNearPoint :: Point2 -> World -> Set PathEdgeNodes
|
||||
pesNearPoint = nearPoint peZoneSize _peZoning
|
||||
pesNearPoint = nearPoint' peZoneSize _peZoning
|
||||
--pesNearPoint p w = zoneExtract (zoneOfPoint peZoneSize p) (w ^. cWorld . lWorld . peZoning)
|
||||
|
||||
pesNearSeg :: Point2 -> Point2 -> World -> Set PathEdgeNodes
|
||||
pesNearSeg = nearSeg peZoneSize _peZoning
|
||||
pesNearSeg = nearSeg' peZoneSize _peZoning
|
||||
|
||||
pesNearRect :: Point2 -> Point2 -> World -> Set PathEdgeNodes
|
||||
pesNearRect = nearRect peZoneSize _peZoning
|
||||
pesNearRect = nearRect' peZoneSize _peZoning
|
||||
|
||||
pesNearCirc :: Point2 -> Float -> World -> Set PathEdgeNodes
|
||||
pesNearCirc p r = pesNearRect (p +.+ V2 r r) (p -.- V2 r r)
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
module Dodge.Zoning.Wall where
|
||||
module Dodge.Zoning.Wall
|
||||
( wlsNearSeg
|
||||
, wlsNearPoint
|
||||
, wlsNearRect
|
||||
, wlsNearCirc
|
||||
, wlsFromIXs
|
||||
, wlZoneSize
|
||||
, zoneWall
|
||||
, deZoneWall
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import qualified Data.IntSet as IS
|
||||
@@ -11,14 +20,14 @@ import qualified IntMapHelp as IM
|
||||
import Dodge.Zoning.Common
|
||||
|
||||
wlIXsNearPoint :: Point2 -> World -> IS.IntSet
|
||||
wlIXsNearPoint = nearPoint wlZoneSize _wlZoning
|
||||
wlIXsNearPoint = nearPoint' wlZoneSize _wlZoning
|
||||
|
||||
wlIXsNearSeg :: Point2 -> Point2 -> World -> IS.IntSet
|
||||
{-# INLINE wlIXsNearSeg #-}
|
||||
wlIXsNearSeg = nearSeg wlZoneSize _wlZoning
|
||||
wlIXsNearSeg = nearSeg' wlZoneSize _wlZoning
|
||||
|
||||
wlIXsNearRect :: Point2 -> Point2 -> World -> IS.IntSet
|
||||
wlIXsNearRect = nearRect wlZoneSize _wlZoning
|
||||
wlIXsNearRect = nearRect' wlZoneSize _wlZoning
|
||||
|
||||
wlIXsNearCirc :: Point2 -> Float -> World -> IS.IntSet
|
||||
wlIXsNearCirc p r = wlIXsNearRect (p +.+ V2 r r) (p -.- V2 r r)
|
||||
|
||||
Reference in New Issue
Block a user