Allow determination of attach item relative positions

This commit is contained in:
2024-10-02 10:24:10 +01:00
parent 7ce5225491
commit bac57a702d
6 changed files with 87 additions and 61 deletions
+5 -2
View File
@@ -266,7 +266,7 @@ chainLinkOrientation
chainLinkOrientation mo par (ILink lt f) child = do
(p,q) <- mo
(p1,q1) <- f par lt child
return (p + Q.rotate q p1, q * q1)
return (p + Q.rotate q1 p1, q * q1)
updateRootItem' :: LabelDoubleTree ItemLink Item -> Creature -> World -> World
updateRootItem' itmtree cr = ldtPropagateFold chainLinkOrientation chainLinkOrientation
@@ -280,7 +280,10 @@ updateItemWithOrientation cr m itm = case _itType itm of
_ -> id
testtorch :: Creature -> Maybe (Point3, Q.Quaternion Float) -> World -> World
testtorch cr = maybe id $ \(pos,_) -> muzFlareAt yellow (_crPos cr `v2z` 0 + rotate3z (_crDir cr) pos) (_crDir cr)
testtorch cr m = fromMaybe id $ do
(pos,q) <- m
let d = _crDir cr + argV (Q.qToV2 q)
return $ muzFlareAt yellow (_crPos cr `v2z` 0 + rotate3z d pos) d
itemInvSideEffect :: Creature -> Item -> World -> World
itemInvSideEffect cr itm = case _itType itm of