Add forgotten files, many updates concerning turrets and shields

This commit is contained in:
2021-11-05 19:58:55 +00:00
parent 2c768845b2
commit 5a52b646e1
21 changed files with 380 additions and 34 deletions
+7 -13
View File
@@ -6,9 +6,9 @@ import Dodge.LevelGen
import Dodge.LevelGen.Data
import Dodge.LevelGen.StaticWalls
import Dodge.LevelGen.Pathing
import Dodge.Wall.Zone
import Dodge.Placements.Spot
import Dodge.RandomHelp
import Dodge.Base
import Dodge.Zone
import Dodge.GameRoom
import Dodge.Bounds
@@ -41,7 +41,7 @@ import Data.Maybe
generateLevelFromRoomList :: State StdGen [Room] -> World -> World
generateLevelFromRoomList gr w
= updateWallZoning
= initWallZoning
. setupWorldBounds
. flip (foldr $ flip placeSpot) plmnts
$ w { _walls = wallsFromRooms rs
@@ -102,17 +102,11 @@ setupWorldBounds w = w
polyhedrasToEdges :: [Polyhedra] -> [Point3]
polyhedrasToEdges = concatMap tflat4 . concatMap polyToEdges
updateWallZoning :: World -> World
updateWallZoning w = set (wallsZone . znObjects) (foldl' (flip wallInZone) IM.empty (_walls w)) w
where
wallInZone wl
| uncurry dist (_wlLine wl) <= 2*zoneSize = insertIMInZone x y wlid wl
| otherwise = flip (foldl' (flip $ \(a,b) -> insertIMInZone a b wlid wl)) ips
where
(x,y) = zoneOfPoint $ uncurry pHalf (_wlLine wl)
wlid = _wlID wl
ips = map zoneOfPoint $ uncurry (divideLine zoneSize) (_wlLine wl)
initWallZoning :: World -> World
initWallZoning w = foldl' (flip insertWallInZones) (w & wallsZone . znObjects .~ IM.empty) (_walls w)
--initWallZoning w = set (wallsZone . znObjects) (foldl' (flip wallInZone) IM.empty (_walls w)) w
-- where
-- wallInZone wl = flip (foldl' (flip $ \(a,b) -> insertIMInZone a b (_wlID wl) wl)) (zoneOfWall wl)
makePath :: Tree Room -> [(Point2,Point2)]
makePath = concatMap _rmPath . flatten