Add no weapon start
This commit is contained in:
+23
-21
@@ -118,11 +118,11 @@ ppEvents w = IM.foldr (\pp w -> _ppEvent pp pp w) w $ _pressPlates w
|
||||
|
||||
updateSeenWalls :: World -> World
|
||||
updateSeenWalls w = foldr markSeen w wallsToUpdate
|
||||
where yPos = _crPos $ _creatures w IM.! 0
|
||||
-- wallsToUpdate = map _wlID $ IM.elems $ wallsNearPoint yPos w
|
||||
wallsToUpdate = concatMap (\p -> collidePointFindWalls yPos (yPos +.+p) $ wallsAlongLine yPos (yPos +.+ p) w)
|
||||
$ nRays 60
|
||||
markSeen i = set (walls . ix i . wlSeen) True
|
||||
where
|
||||
vPos = _cameraViewFrom w
|
||||
wallsToUpdate = concatMap (\p -> visibleWalls vPos (vPos +.+p) $ wallsAlongLine vPos (vPos +.+ p) w)
|
||||
$ nRays 20
|
||||
markSeen i = set (walls . ix i . wlSeen) True
|
||||
|
||||
setTestStringIO :: IO World -> IO World
|
||||
setTestStringIO = fmap (\ w -> set testString (show $ s w) w)
|
||||
@@ -186,20 +186,22 @@ crCrSpring c1 c2 w
|
||||
overlap2 = ((comRad - diff) * _crMass c1 * 0.5 / massT) *.* errorNormalizeV 56 vec
|
||||
massT = _crMass c1 + _crMass c2
|
||||
|
||||
collidePointFindWall :: Point2 -> Point2 -> IM.IntMap Wall -> Maybe Int
|
||||
collidePointFindWall p1 p2 ws = fmap fst $ listToMaybe $ sortBy f
|
||||
$ IM.toList
|
||||
$ IM.mapMaybe ((\(x:y:_) -> intersectSegSeg' p1 p2 x y) . _wlLine) ws
|
||||
where f (_,a) (_,b) = compare (magV (p1 -.- a)) (magV (p1 -.- b))
|
||||
|
||||
collidePointFindWalls :: Point2 -> Point2 -> IM.IntMap Wall -> [Int]
|
||||
collidePointFindWalls p1 p2 ws
|
||||
-- = map fst . takeWhileAnd g . map snd . sortBy (compare `on` (dist p1 . fst . fromJust)) . filter ((/=) Nothing . fst) . map f $ IM.toList ws
|
||||
= map fst . takeWhileAnd g . map snd . sortBy (compare `on` (dist p1 . fromJust . fst)) . filter ((/=) Nothing . fst) . map f $ IM.toList ws
|
||||
where f (i,wl) = (intersectSegSeg' (_wlLine wl !! 0) (_wlLine wl !! 1) p1 p2, (i,wl))
|
||||
g (_,wl) = _wlIsSeeThrough wl
|
||||
takeWhileAnd h xs = let (ys,zs) = span h xs
|
||||
in ys ++ tf zs
|
||||
where tf (x:_) = [x]
|
||||
tf _ = []
|
||||
{-
|
||||
Finds the IDs of visible walls from a point to another point.
|
||||
-}
|
||||
visibleWalls :: Point2 -> Point2 -> IM.IntMap Wall -> [Int]
|
||||
visibleWalls p1 p2 ws
|
||||
= map fst
|
||||
. takeUntil (_wlIsSeeThrough . snd)
|
||||
. map snd
|
||||
. sortOn (dist p1 . fromJust . fst)
|
||||
. filter ((/=) Nothing . fst)
|
||||
. map f
|
||||
$ IM.toList ws
|
||||
where
|
||||
f (i,wl) = (intersectSegSeg' (_wlLine wl !! 0) (_wlLine wl !! 1) p1 p2, (i,wl))
|
||||
takeUntil h xs = let (ys,zs) = span h xs
|
||||
in ys ++ tf zs
|
||||
where tf (x:_) = [x]
|
||||
tf _ = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user