Example use of fallback in placement room positions
This commit is contained in:
@@ -37,6 +37,11 @@ unusedSpotAwayFromLink x = PSPos f (const id) Nothing
|
||||
-> Just (PS p a,UsedSpot p a t)
|
||||
_ -> Nothing
|
||||
|
||||
setFallback :: Placement -> Placement -> Placement
|
||||
setFallback fallback plmnt = plmnt
|
||||
& plSpot . psFallback .~ Just fallback
|
||||
& plIDCont %~ fmap (fmap $ setFallback fallback)
|
||||
|
||||
unusedOffPathAwayFromLink :: Float -> PlacementSpot
|
||||
unusedOffPathAwayFromLink x = PSPos f (const id) Nothing
|
||||
where
|
||||
|
||||
@@ -36,12 +36,14 @@ tanksRoom crs its = do
|
||||
thetank <- randomTank <&> plSpot .~ unusedOffPathAwayFromLink 50
|
||||
let room = roomRectAutoLinks w h
|
||||
nwestlnks = length $ filter ((OnEdge West `S.member`) . _rlType) $ _rmLinks room
|
||||
girderPosOrder <- shuffle [1 .. nwestlnks - 2]
|
||||
let plmnts =
|
||||
--[ twoRoomPoss (isUnusedLinkType (OnEdge West)) (isUnusedLinkType (OnEdge East)) $ \ps1 ps2 ->
|
||||
[ twoRoomPoss (isUnusedLinkType (FromSouth i)) (isUnusedLinkType (FromSouth i)) $ \ps1 ps2 ->
|
||||
--ok, this has become complicated
|
||||
foldr1 setFallback [ 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
|
||||
| i <- girderPosOrder]
|
||||
: 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)
|
||||
|
||||
Reference in New Issue
Block a user