Commit before unifying positions

This commit is contained in:
2021-11-03 19:01:19 +00:00
parent 903a79cf85
commit f45d19a787
7 changed files with 54 additions and 23 deletions
+7 -6
View File
@@ -28,16 +28,17 @@ data PSType = PutCrit {_unPutCrit :: Creature}
| PutNothing
| PutID { _putID :: Int}
-- maybe there is a monadic implementation of this?
data PlacementSpot = PS
{ _psPos :: Point2
, _psRot :: Float
}
data PlacementSpot
= PS { _psPos :: Point2 , _psRot :: Float }
| PSLnk { _psLinkTest :: (Point2,Float) -> Bool
, _psLinkShift :: (Point2,Float) -> (Point2,Float)
}
data Placement = Placement
{ _placementSpot :: PlacementSpot
, _psType :: PSType
, _idPlacement :: Int -> Maybe Placement
}
| PlacementPos Point3 (Point3 -> Placement)
| PlacementUsingPos Point3 (Point3 -> Placement) -- allows a placement to use a shifted position
sPS :: Point2 -> Float -> PSType -> Placement
sPS p a pt = Placement (PS p a) pt (const Nothing)
@@ -58,7 +59,7 @@ jsps0J :: PSType -> Placement -> Maybe Placement
jsps0J pst plm = Just $ Placement (PS (V2 0 0) 0) pst $ \_ -> Just plm
ps0 :: PSType -> (Int -> Maybe Placement) -> Placement
ps0 pst = Placement (PS (V2 0 0) 0) pst
ps0 = Placement (PS (V2 0 0) 0)
jps0 :: PSType -> (Int -> Maybe Placement) -> Maybe Placement
jps0 pst = Just . Placement (PS (V2 0 0) 0) pst