Migrate LDTs to DTs

This commit is contained in:
2025-07-10 22:13:47 +01:00
parent 9543c2c789
commit cd46f34787
9 changed files with 169 additions and 95 deletions
+11 -9
View File
@@ -29,8 +29,8 @@ transToHandle itm = (-.-.- V3 x y 0)
where
V2 x y = handlePos itm
handleOrient :: LocationLDT ItemLink CItem -> Point3Q
handleOrient loc = case loc ^. locLDT . ldtValue . _1 . itType of
handleOrient :: LocationDT CItem -> Point3Q
handleOrient loc = case loc ^. locDT . dtValue . _1 . itType of
HELD FLAMETHROWER -> (V3 (-1) 0 0, Q.qID)
_ -> (V3 (-3) 0 0, Q.qID)
@@ -54,20 +54,22 @@ handOrient cr = case cr ^. crStance . posture of
f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
sLen = _strideLength $ _crStance cr
locOrient :: LocationLDT ItemLink OItem -> Creature -> Point3Q
locOrient :: LocationDT OItem -> Creature -> Point3Q
locOrient loc cr =
handHandleOrient (fmap (\(x, y, _) -> (x, y)) $ locToTop loc) cr
`Q.comp` (loc ^. locLDT . ldtValue . _3)
handHandleOrient (fmap (\(x, y, _) -> (x, y)) $ locToTop' loc) cr
`Q.comp` (loc ^. locDT . dtValue . _3)
heldItemOffset :: LocationLDT ItemLink CItem -> Creature -> Point3 -> Point3
heldItemOffset loc cr p = x + Q.rotate q p
where
(x, q) = handHandleOrient loc cr
(x, q) = handHandleOrient (locLDTToLocDT loc) cr
handHandleOrient :: LocationLDT ItemLink CItem -> Creature -> Point3Q
handHandleOrient :: LocationDT CItem -> Creature -> Point3Q
handHandleOrient loc cr =
handOrient cr (aimStance (loc ^. locLDT))
`Q.comp` handleOrient loc
handOrient cr (aimStance (loc' ^. locDT))
`Q.comp` handleOrient loc'
where
loc' = locToTop' loc
shoulderHeight :: Float
shoulderHeight = 18