Commit before door refactor
This commit is contained in:
@@ -4,6 +4,7 @@ module Dodge.Wall.Move
|
||||
, moveWallIDUnsafe
|
||||
, moveWall
|
||||
, moveWallIDToward
|
||||
, translateWallID
|
||||
, mvPs
|
||||
) where
|
||||
import Dodge.Data
|
||||
@@ -11,6 +12,7 @@ import Dodge.Base
|
||||
import Geometry
|
||||
import Dodge.Wall.Zone
|
||||
|
||||
import Data.Maybe
|
||||
import Control.Lens
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
|
||||
@@ -29,6 +31,16 @@ moveWall wlid wl wlline w = w & walls . ix wlid .~ newwl
|
||||
& insertWallInZones newwl
|
||||
where
|
||||
newwl = wl {_wlLine = wlline}
|
||||
|
||||
translateWallID :: Int -> Point2 -> World -> World
|
||||
translateWallID wlid p w = fromMaybe w $ do
|
||||
oldwl <- w ^? walls . ix wlid
|
||||
let newwl = oldwl & wlLine . each +~ p
|
||||
return $ w
|
||||
& walls . ix wlid .~ newwl
|
||||
& deleteWallFromZones oldwl
|
||||
& insertWallInZones newwl
|
||||
|
||||
moveWallIDToward :: Int -> Float -> (Point2,Point2) -> World -> World
|
||||
moveWallIDToward wlid speed ep w = moveWall wlid wl newwlline w
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user