Cleanup, fix tank opacity

This commit is contained in:
2022-03-08 10:26:51 +00:00
parent 8179a2aa4f
commit 2e1c7f2687
5 changed files with 23 additions and 19 deletions
+2 -1
View File
@@ -53,7 +53,8 @@ tankRect w h col x y = shiftPlacement (V2 x y,0) $ ps0j
$ upperPrismPoly 31 therect $ upperPrismPoly 31 therect
<> foldMap f [(w',-w',h',h'),(w',-w',-h',-h'),(w',w',h',-h'),(-w',-w',h',-h')] <> foldMap f [(w',-w',h',h'),(w',-w',-h',-h'),(w',w',h',-h'),(-w',-w',h',-h')]
) )
$ sps0 $ PutWall therect defaultWall {_wlDraw = False, _wlColor = col, _wlRotateTo = False} $ sps0 $ PutWall therect defaultWall
{_wlDraw = False, _wlColor = col, _wlRotateTo = False, _wlOpacity = SeeAbove}
where where
therect = rectWH w h therect = rectWH w h
w' = w - 1.5 w' = w - 1.5
+1 -1
View File
@@ -59,4 +59,4 @@ glassLesson = do
glassLessonRunPast :: RandomGen g => State g (SubCompTree Room) glassLessonRunPast :: RandomGen g => State g (SubCompTree Room)
glassLessonRunPast = f <$> glassLesson glassLessonRunPast = f <$> glassLesson
where where
f (Node r rs) = Node r $ (return $ UseLabel 0 $ door & rmConnectsTo .~ S.singleton (OnEdge West)) : rs f (Node r rs) = Node r $ return (UseLabel 0 $ door & rmConnectsTo .~ S.singleton (OnEdge West)) : rs
+4 -3
View File
@@ -36,7 +36,8 @@ cenLasTur = roomNgon 8 200 & rmPmnts .~
lightSensInsideDoor :: Room -> Room lightSensInsideDoor :: Room -> Room
lightSensInsideDoor rm = rm lightSensInsideDoor rm = rm
& rmPmnts .:~ (psPt atFstLnkOut $ PutShape $ colorSH yellow $ & rmPmnts .:~ psPt atFstLnkOut
(PutShape $ colorSH yellow $
thinHighBar 0 (V2 20 (-1)) (V2 20 (-100)) thinHighBar 0 (V2 20 (-1)) (V2 20 (-100))
<> thinHighBar 0 (V2 0 (-100)) (V2 20 (-100)) <> thinHighBar 0 (V2 0 (-100)) (V2 20 (-100))
<> barPP 1.5 (V3 20 (-1) 0) (V3 20 (-1) 80)) <> barPP 1.5 (V3 20 (-1) 0) (V3 20 (-1) 80))
@@ -65,8 +66,8 @@ lightSensByDoor rm = rm
lasSensorTurretTest :: RandomGen g => Int -> State g (SubCompTree Room) lasSensorTurretTest :: RandomGen g => Int -> State g (SubCompTree Room)
lasSensorTurretTest n = do lasSensorTurretTest n = do
cenroom <- shuffleLinks $ lightSensInsideDoor cenLasTur & rmLabel .~ Just n cenroom <- shuffleLinks $ lightSensInsideDoor cenLasTur & rmLabel ?~ n
let doorroom = switchDoorRoom & rmTakeFrom .~ Just n let doorroom = switchDoorRoom & rmTakeFrom ?~ n
return $ treeFromPost [PassDown door,PassDown cenroom,PassDown doorroom] (UseAll door) return $ treeFromPost [PassDown door,PassDown cenroom,PassDown doorroom] (UseAll door)
lasCenSensEdge :: RandomGen g => Int -> State g (SubCompTree Room) lasCenSensEdge :: RandomGen g => Int -> State g (SubCompTree Room)
+1 -1
View File
@@ -55,6 +55,6 @@ longRoomRunPast = do
[ singleUseAll door [ singleUseAll door
--, return (UseLabel 0 $ door & rmConnectsTo .~ S.singleton InLink) --, return (UseLabel 0 $ door & rmConnectsTo .~ S.singleton InLink)
, treeFromPost [PassDown $ corridor & rmConnectsTo .~ S.singleton InLink, PassDown corridor] , treeFromPost [PassDown $ corridor & rmConnectsTo .~ S.singleton InLink, PassDown corridor]
(UseLabel 0 $ door) (UseLabel 0 door)
] ]
) )
+13 -11
View File
@@ -23,8 +23,8 @@ import Data.Bifunctor
type RoomInt = (Room,Int) type RoomInt = (Room,Int)
positionRoomsFromTree :: Tree RoomInt -> IO (Maybe [RoomInt]) positionRoomsFromTree :: Tree RoomInt -> IO (Maybe [RoomInt])
positionRoomsFromTree (Node (r,i) ts) = printHeader positionRoomsFromTree (Node (r,i) ts) = printColumnTitles
>> (fmap (fmap (map $ first createUnusedLinkPos))) >> fmap (fmap (map $ first createUnusedLinkPos))
(posRms (map pointsToPoly $ _rmBound r') (r',i) (zipCount ts) Empty) (posRms (map pointsToPoly $ _rmBound r') (r',i) (zipCount ts) Empty)
where where
r' = r & rmMID ?~ 0 r' = r & rmMID ?~ 0
@@ -46,15 +46,18 @@ posRms bounds parenti@(parent,_) ( (numChild,t@(Node childi _) ):its) tseq = do
. Prelude.filter (not . S.null . S.intersection (_rmConnectsTo child) . _rlType) . Prelude.filter (not . S.null . S.intersection (_rmConnectsTo child) . _rlType)
$ _rmLinks parent $ _rmLinks parent
tryParentLinks [] = putStrLn "no viable link pairs, backtrack" >> return Nothing tryParentLinks [] = putStrLn "no viable link pairs, backtrack" >> return Nothing
tryParentLinks ((j,outlnk):ls) = tryChildLinks $ zipCount (rmInLinks $ fst childi) tryParentLinks ((j,outlnk):ls) = tryChildLinks . zipCount . rmInLinks $ fst childi
where where
tryChildLinks [] = tryParentLinks ls tryChildLinks [] = tryParentLinks ls
tryChildLinks ((numinlink,il):ils) tryChildLinks ((numinlink,il):ils)
| clipping = tryChildLinks ils | clipping = tryChildLinks ils
| otherwise = do | otherwise = do
putStrLn $ show j ++ "-" ++ show numinlink putStrLn $ show j ++ "-" ++ show numinlink
mayrs <- posRms (newBounds ++ bounds) mayrs <- posRms
(first updateparent parenti) its (tseq |> shiftedt) (newBounds ++ bounds)
(first updateparent parenti)
its
(tseq |> shiftedt)
case mayrs of case mayrs of
Just rms -> return $ Just rms Just rms -> return $ Just rms
Nothing -> printInfo parenti numChild childi Nothing -> printInfo parenti numChild childi
@@ -71,11 +74,10 @@ posRms bounds parenti@(parent,_) ( (numChild,t@(Node childi _) ):its) tseq = do
& rmMParent ?~ snd parenti & rmMParent ?~ snd parenti
& rmMID ?~ snd childi & rmMID ?~ snd childi
& rmLinks %~ delete il & rmLinks %~ delete il
& rmPos %~ ( (uncurry (UsedInLink 0) (lnkPosDir il):) & rmPos .:~ uncurry (UsedInLink 0) (lnkPosDir il)
-- . (map (uncurry UnusedLink . lnkPosDir) (delete il (_rmLinks rm)) ++)
)
shiftedt = applyToRoot shiftedt = applyToRoot
(first $ updatechild . shiftRoomShiftToLink (lnkPosDir shiftedoutlink) (lnkPosDir il)) t (first $ updatechild . shiftRoomShiftToLink (lnkPosDir shiftedoutlink) (lnkPosDir il))
t
createUnusedLinkPos :: Room -> Room createUnusedLinkPos :: Room -> Room
createUnusedLinkPos rm = rm & rmPos .++~ map (uncurry UnusedLink . lnkPosDir) (_rmLinks rm) createUnusedLinkPos rm = rm & rmPos .++~ map (uncurry UnusedLink . lnkPosDir) (_rmLinks rm)
@@ -90,8 +92,8 @@ printColumns _ strs = putStrLn $ concat strs
theColumns :: [String] -> IO () theColumns :: [String] -> IO ()
theColumns = printColumns [20,5,20,20] theColumns = printColumns [20,5,20,20]
printHeader :: IO () printColumnTitles :: IO ()
printHeader = theColumns ["Parent","Cnum","Child","Link pair"] printColumnTitles = theColumns ["Parent","Cnum","Child","Link pair"]
printInfo :: RoomInt -> Int -> RoomInt -> IO () printInfo :: RoomInt -> Int -> RoomInt -> IO ()
printInfo (parentrm,parenti) childn (childrm,childi) = do printInfo (parentrm,parenti) childn (childrm,childi) = do