Implement randomness at the placement datatype level
This commit is contained in:
@@ -4,10 +4,12 @@ import Dodge.Data
|
||||
import Dodge.LightSources.Lamp
|
||||
import Dodge.LevelGen.Data
|
||||
import Dodge.Room.Foreground
|
||||
import Dodge.Placements.Spot
|
||||
import Geometry
|
||||
import Dodge.Creature.Inanimate
|
||||
import Shape.Data
|
||||
import Dodge.Default
|
||||
import Dodge.RandomHelp
|
||||
|
||||
mountLightOnShape
|
||||
:: (Point2 -> Point3 -> Shape) -- ^ function describing the mount shape
|
||||
@@ -82,6 +84,19 @@ mountLightAID = mountLightOnShape f
|
||||
mountLightA :: Point2 -> Point3 -> Placement
|
||||
mountLightA = redMID mountLightAID
|
||||
|
||||
mountLightACond :: ((Point2,Float) -> Bool) -> Placement
|
||||
mountLightACond f = updatePSToLevel 2 (const thePS) $ mountLightA 0 (V3 0 (-40) 40)
|
||||
where
|
||||
thePS = PSLnk f (\(p,a)->(p,a))
|
||||
|
||||
mountLightVCond :: ((Point2,Float) -> Bool) -> Placement
|
||||
mountLightVCond f = updatePSToLevel 2 (const thePS) $ mountLightV 0 (V3 0 (-20) 40)
|
||||
where
|
||||
thePS = PSLnk f id
|
||||
|
||||
mntLightCond :: ((Point2,Float) -> Bool) -> Placement
|
||||
mntLightCond f = RandomPlacement $ takeOne [mountLightVCond f,mountLightACond f]
|
||||
|
||||
mountLightVID :: LightSource -> Point2 -> Point3 -> (Int -> Maybe Placement) -> Placement
|
||||
mountLightVID = mountLightOnShape f
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user