Fix auto door opening

This commit is contained in:
jgk
2021-03-21 23:04:29 +01:00
parent abd7cd7ea9
commit c8a89163c1
3 changed files with 26 additions and 27 deletions
+22 -16
View File
@@ -26,30 +26,36 @@ autoDoorAt a b wls = IM.union wls $ IM.fromList $ zip is $ mkAutoDoor a b is
mkAutoDoor :: Point2 -> Point2 -> [Int] -> [Wall]
mkAutoDoor pl pr xs = addSound $ zipWith3 (autoDoorPane [pl,pr])
xs
[ [pld,hwd,hw,pl]
, [hwd,hwu]
, [hwu,plu,pl,hw]
, [pru,hwu,hw,pr]
, [hwu,hwd]
, [hwd,prd,pr,hw]
]
[ [plld,pld,pl,pl]
, [pld,plu]
, [plu,pllu,pl,pl]
, [prru,pru,pr,pr]
, [pru,prd]
, [prd,prrd,pr,pr]
]
where norm = 10 *.* errorNormalizeV 49 ( vNormal (pr -.- pl))
(lDoorClosed ++ rDoorClosed)
(map shiftL lDoorClosed ++ map shiftR rDoorClosed)
-- [ [plld,pld]
-- , [pld,plu]
-- , [plu,pllu]
-- , [prru,pru]
-- , [pru,prd]
-- , [prd,prrd]
-- ]
where lDoorClosed = [ [pld,hwd]
, [hwd,hwu]
, [hwu,plu]
]
rDoorClosed = [ [pru,hwu]
, [hwu,hwd]
, [hwd,prd]
]
norm = 10 *.* errorNormalizeV 49 ( vNormal (pr -.- pl))
hw = 0.5 *.* (pl +.+ pr)
--parallel = 15 *.* normalizeV (pl -.- pr)
parallel = 0.51 *.* (pl -.- pr)
parallel = 0.5 *.* (pl -.- pr)
plu = pl +.+ norm
pld = pl -.- norm
pru = pr +.+ norm
prd = pr -.- norm
hwu = hw +.+ norm
hwd = hw -.- norm
shiftL = map $ (+.+ parallel) . (-.- normalizeV parallel)
shiftR = map $ (-.- parallel) . (+.+ normalizeV parallel)
pllu = plu +.+ parallel
plld = pld +.+ parallel
prru = pru -.- parallel