Continue work on using links for placement positions

This commit is contained in:
2021-11-04 14:40:53 +00:00
parent a9b802b883
commit 6933c4d3b3
3 changed files with 39 additions and 21 deletions
+7 -6
View File
@@ -102,11 +102,11 @@ addSouthPillars x h r = do
addButtonSlowDoor :: RandomGen g => Float -> Float -> Room -> State g Room
addButtonSlowDoor x h rm = do
(butPos,butRot) <- takeOne
[( V2 (x/2-50) 5,0)
,( V2 (x/2+50) 5,0)
[( V2 (x/2-50) 5,0::Float)
,( V2 (x/2+50) 5,0::Float)
]
thePlacement <- takeOne [butDoor butPos butRot ]
filterLinks aboveH =<< changeLinkTo belowH (rm
changeLinkFrom aboveH =<< changeLinkTo belowH (rm
& rmPS %~ (thePlacement :)
& rmBound %~ (openDoorBound :)
)
@@ -114,10 +114,11 @@ addButtonSlowDoor x h rm = do
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 _ _ = putLitButtonID' col butPosCond
butDoor bpos brot = putLitButtonID col bpos brot
butDoor _ _ = putLitButtonID' col butPosCond
--butDoor bpos brot = putLitButtonID col bpos brot
$ \btid -> Just $ putDoubleDoor False col (cond' btid) (V2 0 h) (V2 x h) 2
--butPosCond (V2 _ y,_) = y < h
butPosCond (V2 _ y,_) = y < h
--butPosCond _ = True -- y < h
col = dim $ light red
cond' btid w = w ^? buttons . ix btid . btState /= Just BtOff