Start to implement lock and key system

This commit is contained in:
2021-04-26 11:41:04 +02:00
parent 5d8575b03f
commit 3bc57ff650
19 changed files with 276 additions and 98 deletions
+24 -7
View File
@@ -5,10 +5,14 @@ Typically dead ends.
module Dodge.Room.Treasure
where
import Geometry
import Dodge.Data
import Dodge.Room.Data
import Dodge.Room.Placement
import Dodge.LevelGen.Data
import Data.List
import Control.Monad.State
import Control.Lens
import System.Random
{-
@@ -21,18 +25,24 @@ triLootRoom
-> Float -- Height
-> State g Room
triLootRoom w h = pure $ Room
{ _rmPolys = [poly]
, _rmLinks = [((0,10),pi)]
, _rmPath = doublePair ((0,10),(0,h/2))
{ _rmPolys = [ tri
, base
]
, _rmLinks = [((0,-80),pi)]
, _rmPath = doublePair ((0,-80),(0,h/2))
, _rmPS =
[PS (15-w,15) 0 $ PutID 0
,PS (w-15,15) 0 $ PutID 0
,PS (0,h-15) 0 $ PutID 2
,PS (w-15,15) pi $ PutID 0
,PS (0,h-35) 0 $ PutID 2
,PS (-5,h-10) 0 putLamp
,PS (5,h-10) 0 putLamp
,PS (0,h-15) 0 putLamp
,PS (0,-60) 0 putLamp
]
, _rmBound = poly
, _rmBound = convexHull $ tri ++ base
}
where
poly =
tri =
[ ( -w,30)
, ( -w, 0)
, ( w, 0)
@@ -40,3 +50,10 @@ triLootRoom w h = pure $ Room
, ( 20, h)
, (-20, h)
]
base = rectNSWE 20 (-80) (-20) 20
lootRoom :: RandomGen g => [Creature] -> [Item] -> State g Room
lootRoom crs itms = do
let w = 300
h = 700
fmap (replacePutID 0 (map PutCrit crs) . replacePutID 2 (map PutFlIt itms)) $ triLootRoom w h