Assign used links during room generation

This commit is contained in:
2021-11-02 22:27:19 +00:00
parent 0b058674ea
commit 903a79cf85
7 changed files with 28 additions and 23 deletions
+1
View File
@@ -19,6 +19,7 @@ assigning no bounds will allow rooms to overlap.
data Room = Room
{ _rmPolys :: [ [Point2] ]
, _rmLinks :: [(Point2,Float)]
, _rmUsedLinks :: [(Point2,Float)]
, _rmPath :: [(Point2, Point2)]
, _rmPS :: [Placement]
, _rmBound :: [ [Point2] ]
+5 -1
View File
@@ -106,8 +106,12 @@ addButtonSlowDoor x h rm = do
,( V2 (x/2+50) 5,0)
]
thePlacement <- takeOne [butDoor butPos butRot ]
filterLinks aboveH =<< changeLinkTo belowH (rm & rmPS %~ (thePlacement :))
filterLinks aboveH =<< changeLinkTo belowH (rm
& rmPS %~ (thePlacement :)
& rmBound %~ (openDoorBound :)
)
where
openDoorBound = rectNSEW (h + 5) (h - 5) (-x/2) (3*x/2)
belowH y = (sndV2 . fst) y < h - 40
aboveH y = (sndV2 . fst) y > h + 40
butDoor bpos brot = putLitButtonID col bpos brot