27 lines
691 B
Haskell
27 lines
691 B
Haskell
--{-# LANGUAGE BangPatterns #-}
|
|
{- |
|
|
Creation of doors that open when creatures approach them.
|
|
-}
|
|
module Dodge.LevelGen.AutoDoor
|
|
where
|
|
import Dodge.Data
|
|
import Dodge.Base
|
|
import Dodge.Creature.Property
|
|
--import Dodge.LevelGen.MoveDoor
|
|
import Dodge.LevelGen.TriggerDoor
|
|
--import Geometry
|
|
import Picture
|
|
import Geometry.Data
|
|
--import qualified DoubleStack as DS
|
|
import qualified IntMapHelp as IM
|
|
|
|
|
|
addAutoDoor
|
|
:: Point2 -- ^ Left point
|
|
-> Point2 -- ^ Right point (though the two points should be symmetric)
|
|
-> World
|
|
-> World
|
|
addAutoDoor a b = insertDoubleDoor True (dim yellow) cond a b 3
|
|
where
|
|
cond = any (crNearSeg 40 a b) . IM.filter isAnimate . _creatures
|