Implement terminals

This commit is contained in:
2022-03-14 20:39:23 +00:00
parent 1b6f11709c
commit f16f32d9d3
30 changed files with 313 additions and 119 deletions
+9 -5
View File
@@ -51,6 +51,7 @@ roomRect
roomRect x y xn yn = defaultRoom
{ _rmPolys = [rectNSWE y 0 0 x ]
, _rmLinks = lnks
, _rmName = "rect"
, _rmPath = concatMap doublePair pth
, _rmPos = map (roomposat RoomPosOnPath) posps
++ map (roomposat RoomPosOffPath) interposps
@@ -77,7 +78,7 @@ roomRect x y xn yn = defaultRoom
++ m East FromSouth FromNorth elnks
++ m West FromSouth FromNorth wlnks
++ m South FromWest FromEast slnks
m edge edgefrom1 edgefrom2 = zipWith (lnkBothAnd' (OnEdge edge) edgefrom1 edgefrom2) [0..]
m edge edgefrom1 edgefrom2 = zipWith (lnkBothAnd (OnEdge edge) edgefrom1 edgefrom2) [0..]
. zipCountDown
pth = linksAndPath' lnks $ map (bimap (+.+ V2 20 20) (+.+ V2 20 20)) (makeGrid xd xn yd yn)
posps = map (+.+ V2 20 20) $ gridPoints xd (xn+1) yd (yn+1)
@@ -86,10 +87,10 @@ roomRect x y xn yn = defaultRoom
zipCountDown :: [a] -> [(Int,a)]
zipCountDown xs = zip [length xs - 1, length xs - 2 ..] xs
lnkBothAnd' :: RoomLinkType -> (Int -> RoomLinkType)
lnkBothAnd :: RoomLinkType -> (Int -> RoomLinkType)
-> (Int -> RoomLinkType)
-> Int -> (Int,(Point2,Float)) -> RoomLink
lnkBothAnd' rlt ltcon ltcon2 i (j,(p,a)) = RoomLink
lnkBothAnd rlt ltcon ltcon2 i (j,(p,a)) = RoomLink
{_rlType = S.fromList [OutLink,InLink,rlt,ltcon i,ltcon2 j]
,_rlPos = p
, _rlDir = a
@@ -98,10 +99,13 @@ lnkBothAnd' rlt ltcon ltcon2 i (j,(p,a)) = RoomLink
-- it is not clear to me that this works for very small rooms (but it does seem
-- to do so)
roomRectAutoLinks :: Float -> Float -> Room
roomRectAutoLinks x y = (roomRect x y (f x) (f y)) {_rmPmnts = plmnts}
roomRectAutoLinks x y = (roomRect x y (f x) (f y))
{_rmPmnts = plmnts
,_rmName = "autoRect"
}
where
f z = max 1 $ (ceiling z - 40) `div` 60
plmnts = [mntLightLnkCond $ resetPLUse $ rpBool isInLnk]
plmnts = [mntLightLnkCond $ resetPLUse $ rprBool $ \rp _ -> isInLnk rp]
{- Combines two rooms into one room.
- will have to work out exactly what to do with combining links
Mostly involves concatenation. -}