Allow creatures to path around chasms
This commit is contained in:
@@ -148,11 +148,7 @@ placeSpotID rid ps pt w = case pt of
|
||||
PutNothing -> (0, w)
|
||||
PutID i -> (i, w)
|
||||
PutWorldUpdate f -> (0, w & f rid ps)
|
||||
PutChasm ps' ->
|
||||
( 0
|
||||
, w & gwWorld . cWorld . chasms .:~ map doShift ps'
|
||||
& genRooms . ix rid . rmPos %~ filter (\rp -> not $ pointInPoly (_rpPos rp) ps')
|
||||
)
|
||||
PutChasm ps' -> (0, placeChasm w rid ps' $ map doShift ps')
|
||||
PutLabel{} -> (0, w)
|
||||
where
|
||||
p@(V2 px py) = _psPos ps
|
||||
@@ -160,6 +156,15 @@ placeSpotID rid ps pt w = case pt of
|
||||
rot = _psRot ps
|
||||
doShift = shiftPointBy (p, rot)
|
||||
|
||||
placeChasm :: GenWorld -> Int -> [Point2] -> [Point2] -> GenWorld
|
||||
placeChasm gw rid ps shiftps =
|
||||
gw & gwWorld . cWorld . chasms .:~ shiftps
|
||||
& genRooms . ix rid . rmPos %~ filter (\rp -> not $ pointInPoly (_rpPos rp) ps)
|
||||
& gwWorld %~ f
|
||||
where
|
||||
f w = foldl' g w (loopPairs shiftps)
|
||||
g w (x,y) = fst $ obstructPathsCrossing ChasmObstacle x y w
|
||||
|
||||
--evaluateRandPS
|
||||
-- :: Int -> State StdGen PSType -> PlacementSpot -> GenWorld -> (Int, GenWorld)
|
||||
--evaluateRandPS rid rgen ps w = placeSpotID rid ps evaluatedType
|
||||
|
||||
Reference in New Issue
Block a user