module Dodge.Placement.Shift 
    ( shiftPlacement
    , shiftPSBy
    ) where
import Dodge.LevelGen.Data
import Dodge.ShiftPoint
import Geometry
import Control.Lens
shiftPSBy :: (Point2,Float) -> PlacementSpot -> PlacementSpot
shiftPSBy (pos,rot) ps = ps
    & psPos %~ shiftPointBy (pos,rot)
    & psRot %~ (+ rot)
shiftPlacement :: (Point2,Float) -> Placement -> Placement
shiftPlacement shift plmnt = case plmnt of
    Placement {} -> plmnt & plSpot %~ shiftPSBy shift 
        & plIDCont %~ fmap (fmap $ shiftPlacement shift)
    PlacementUsingPos p f -> PlacementUsingPos (shiftPoint3By shift p)
        (fmap (shiftPlacement shift) f)
    RandomPlacement rpl -> RandomPlacement $ fmap (shiftPlacement shift) rpl
    PickOnePlacement i pl -> PickOnePlacement i (shiftPlacement shift pl)
