Add rooms, placements and room positions
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
module Dodge.Room.Tanks where
|
||||
import Dodge.Data
|
||||
import Dodge.LevelGen.Data
|
||||
import Dodge.RandomHelp
|
||||
import Dodge.Room.Procedural
|
||||
import Dodge.Room.Foreground
|
||||
--import Dodge.Room.RoadBlock
|
||||
import Dodge.Placement.Instance
|
||||
import Dodge.PlacementSpot
|
||||
--import Padding
|
||||
import Color
|
||||
--import Shape
|
||||
import LensHelp
|
||||
|
||||
--import Data.Maybe
|
||||
--import Data.Tree
|
||||
import Control.Monad.State
|
||||
import System.Random
|
||||
import qualified Data.Set as S
|
||||
|
||||
randomTank :: RandomGen g => State g Placement
|
||||
randomTank = takeOne $ map (\f -> f (dim orange) orange)
|
||||
[ tankSquareEmboss4
|
||||
, tankSquareEmboss
|
||||
, tankSquare
|
||||
, roundTank
|
||||
, roundTankCross
|
||||
, tankSquareCross
|
||||
]
|
||||
|
||||
tanksRoom :: RandomGen g => [Creature] -> [Item] -> State g Room
|
||||
tanksRoom crs its = do
|
||||
w <- state $ randomR (100,400)
|
||||
h <- state $ randomR (200,400)
|
||||
ntanks <- state $ randomR (3,6)
|
||||
thetank <- randomTank <&> plSpot .~ unusedOffPathAwayFromLink 50
|
||||
let room = roomRectAutoLinks w h
|
||||
nwestlnks = length $ filter ((OnEdge West `S.member`) . _rlType) $ _rmLinks room
|
||||
let plmnts =
|
||||
--[ twoRoomPoss (isUnusedLinkType (OnEdge West)) (isUnusedLinkType (OnEdge East)) $ \ps1 ps2 ->
|
||||
[ twoRoomPoss (isUnusedLinkType (FromSouth i)) (isUnusedLinkType (FromSouth i)) $ \ps1 ps2 ->
|
||||
sps0 $ PutShape $ girderV 96 20 10 (_psPos ps1) (_psPos ps2)
|
||||
| i <- [1 .. nwestlnks - 2]]
|
||||
++ map (\it -> sps0 (PutFlIt it) & plSpot .~ anyUnusedSpot) its
|
||||
++ map (\cr -> sps0 (PutCrit cr) & plSpot .~ unusedSpotAwayFromLink 50) crs
|
||||
++ replicate ntanks thetank
|
||||
-- , sps0 $ PutShape $ colorSH orange $ pipePP 2 (V3 50 50 25) (V3 50 120 25)
|
||||
return $ room & rmPmnts .++~ plmnts
|
||||
Reference in New Issue
Block a user