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
+2 -2
View File
@@ -27,7 +27,7 @@ useRootItem :: Int -> World -> World
useRootItem crid w = fromMaybe w $ do
cr <- w ^? cWorld . lWorld . creatures . ix crid
itRef <- cr ^? crManipulation . manObject . imRootItem
it <- invTrees (_crInv cr) ^? ix itRef
it <- invTrees' (_crInv cr) ^? ix itRef
return $
itemEffect cr it w
& worldEventFlags . at InventoryChange ?~ ()
@@ -115,7 +115,7 @@ useItemLeftClick' :: Creature -> World -> World
useItemLeftClick' cr' w = fromMaybe w $ do
cr <- w ^? cWorld . lWorld . creatures . ix (_crID cr')
itRef <- cr ^? crManipulation . manObject . imSelectedItem
it <- invTrees (_crInv cr) ^? ix itRef
it <- invTrees' (_crInv cr) ^? ix itRef
return $
itemEffect cr it w
& worldEventFlags . at InventoryChange ?~ ()