Continue placement refactor

This commit is contained in:
2021-09-28 15:44:32 +01:00
parent b8af2ce9d8
commit 6b937b115e
10 changed files with 46 additions and 78 deletions
+10 -15
View File
@@ -9,7 +9,6 @@ module Dodge.LevelGen
, makeSwitch
) where
import Dodge.Data
--import Dodge.Room.Data
import Dodge.LevelGen.Block
import Dodge.LevelGen.LineBlock
import Dodge.LevelGen.Pathing
@@ -21,26 +20,22 @@ import Dodge.LevelGen.Data
import Geometry
import Geometry.Vector3D
import Shape
--import Geometry.Data
import Picture
import qualified IntMapHelp as IM
--import System.Random
import Control.Monad.State
--import Control.Applicative
import Control.Lens
import Data.List.Extra
--import Data.Function
--import Data.Maybe
--import qualified Data.Set as S
--import qualified Data.Map as M
placeSpots :: [Placement] -> World -> World
placeSpots pss w = foldr (placeSpot . _placementSpot) w simplePlacements
where
(simplePlacements, idPlacements ) = partition isSimple pss
isSimple SimplePlacement{} = True
isSimple _ = False
placeSpot' :: ((Point2,Float) , Placement) -> World -> World
placeSpot' (shift, plmnt) = placeSpot $ shiftPSBy' shift (_placementSpot plmnt)
shiftPSBy'
:: (Point2,Float)
-> PlacementSpot
-> PlacementSpot
shiftPSBy' (pos,rot) ps = ps
& psPos %~ shiftPointBy (pos,rot)
& psRot %~ (+ rot)
placeSpot :: PlacementSpot -> World -> World
placeSpot ps w = case _psType ps of