Start to implement lock and key system
This commit is contained in:
@@ -3,18 +3,20 @@ module Dodge.Room.Placement
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.LevelGen.Data
|
||||
import Picture
|
||||
import Dodge.Room.Data
|
||||
import Dodge.Creature.Inanimate
|
||||
|
||||
import Picture
|
||||
import Geometry
|
||||
|
||||
import Data.List
|
||||
import Control.Lens
|
||||
|
||||
|
||||
putLamp = PutCrit lamp
|
||||
|
||||
singleBlock :: Point2 -> [PlacementSpot]
|
||||
singleBlock a = [PS a 0 $ PutBlock [5,20,20] (greyN 0.5)
|
||||
$ reverse $ rectNSWE 10 (-10) (-10) 10]
|
||||
|
||||
{-
|
||||
Places a line of blocks between two points.
|
||||
Width 9, also extends out from each point by 9.
|
||||
@@ -88,3 +90,31 @@ baseWindowPane = Block
|
||||
, _blShadows = []
|
||||
, _blDegrades = [5,5]
|
||||
}
|
||||
|
||||
{-
|
||||
Replaces instances of a given 'PutID' with 'PSType's drawn from a list.
|
||||
-}
|
||||
replacePutID
|
||||
:: Int -- ^ The id of 'PutID' to be replaced
|
||||
-> [PSType] -- ^ List of replacements
|
||||
-> Room
|
||||
-> Room
|
||||
replacePutID i psts r =
|
||||
r & rmPS %~ flip (subZipWith (isPutID i) (\ps pt -> ps & psType .~ pt)) psts
|
||||
|
||||
{-
|
||||
Partition a list by a predicate, apply a zip to those elements
|
||||
that satisfy the predicate, concatenate
|
||||
the new zipped list and the other (unchanged) half.
|
||||
-}
|
||||
subZipWith
|
||||
:: (a -> Bool) -- ^ Filter: elements to apply zip to
|
||||
-> (a -> b -> a) -- ^ Combining function
|
||||
-> [a] -- ^ List to be partition
|
||||
-> [b] -- ^ Modifying list
|
||||
-> [a]
|
||||
subZipWith f g xs ys =
|
||||
let (zs,ws) = partition f xs
|
||||
in zipWith g zs ys ++ ws
|
||||
|
||||
isPutID i ps = Just i == ps ^? psType . putID
|
||||
|
||||
Reference in New Issue
Block a user