Allow for more complex item composition

This commit is contained in:
2024-09-26 00:00:46 +01:00
parent 61f07be08b
commit 772886c8c6
8 changed files with 285 additions and 191 deletions
+3 -2
View File
@@ -20,10 +20,11 @@ import Control.Applicative
-- assumes all item locations inside the items are correct
tryGetRootAttachedFromInvID :: Int -> IM.IntMap Item -> Maybe (Int, IS.IntSet)
tryGetRootAttachedFromInvID invid im = do
let imroots = invRootMap im
let imroots = invRootMap' im
theroot = fromMaybe invid $ imroots ^? ix invid . _1 . _Just
t <- imroots ^? ix theroot . _2
return (theroot, foldMap (IS.singleton . (^?! _1 . itLocation . ilInvID)) t)
--return (theroot, foldMap (IS.singleton . (^?! _1 . itLocation . ilInvID)) t)
return (theroot, foldMap (IS.singleton . (^?! itLocation . ilInvID)) t)
-- this assumes the creature inventory is well formed, specifically the