Simplify analyser machines somewhat

This commit is contained in:
2025-09-16 21:41:26 +01:00
parent 203919933c
commit 81d6727d8e
21 changed files with 418 additions and 464 deletions
+5 -3
View File
@@ -30,7 +30,7 @@ decontamRoom :: State LayoutVars Room
decontamRoom = do
return $
defaultRoom
& rmPolys .~ [rectNSWE 100 0 0 40, switchcut]
& rmPolys .~ cutps
& rmLinks .~ muout lnks ++ muin [last lnks]
& rmPath .~ foldMap doublePairSet [(V2 20 95, V2 20 45), (V2 20 45, V2 20 5)]
& rmPmnts
@@ -40,11 +40,13 @@ decontamRoom = do
\_ _ -> Just $ putDoubleDoor DoorObstacle thewall (WdBlBtOn btid) (V2 0 80) (V2 40 80) 2
, invisibleWall $ rectNSWE 60 40 (-40) (-30)
, spanLightI (V2 (-2) 30) (V2 (-2) 70)
--, analyser (RequireHealth 100) (PS 50 0) (PS (V2 70 50) 0)
, analyser (RequireNoItems $ square 50) (PS 50 0) (PS (V2 70 50) 0)
, analyser (RequireNoItems $ ps) (PS 50 0) (PS mcpos 0)
]
& rmBound .~ [rectNSWE 75 15 0 40, switchcut]
where
mcpos = V2 70 50
cutps = [rectNSWE 100 0 0 40, switchcut]
ps = (\p -> p - mcpos) <$> orderPolygon (concat cutps)
thewall = switchWallCol col
switchcut = rectNSWE 65 35 (-40) 80
lnks =
+3 -9
View File
@@ -44,15 +44,9 @@ linksAndPath lnks subpth = S.fromList subpth <> foldMap linkClosest lnks
linksAndPath' :: [RoomLink] -> [(Point2, Point2)] -> S.Set (Point2, Point2)
linksAndPath' = linksAndPath . map lnkPosDir
testCrossWalls ::
[(Point2, Point2)] ->
(Point2, Point2) ->
Bool
testCrossWalls :: [(Point2, Point2)] -> (Point2, Point2) -> Bool
testCrossWalls wls (a, b) = not $ any (isJust . uncurry (intersectSegSeg a b)) wls
--extra test whether both members of the path edge are in some poly
pairInPolys ::
[[Point2]] ->
(Point2, Point2) ->
Bool
pairInPolys polys (a, b) = any (pointInPolygon a) polys && any (pointInPolygon b) polys
pairInPolys :: [[Point2]] -> (Point2, Point2) -> Bool
pairInPolys polys (a, b) = any (pointInPoly a) polys && any (pointInPoly b) polys