Commit before changing ItemUse into single product type

This commit is contained in:
2024-12-20 14:49:18 +00:00
parent e1989eaa1e
commit 3a72bd366f
8 changed files with 32 additions and 27 deletions
+5 -3
View File
@@ -1,5 +1,5 @@
module Dodge.Creature.Impulse.UseItem (
useRootItem,
useSelectedItem,
) where
import Control.Lens
@@ -16,11 +16,13 @@ import Dodge.Item.Grammar
import Dodge.Item.Location
import qualified IntMapHelp as IM
useRootItem :: Int -> World -> World
useRootItem crid w = (worldEventFlags . at InventoryChange ?~ ()) . fromMaybe w $ do
useSelectedItem :: Int -> World -> World
useSelectedItem crid w = (worldEventFlags . at InventoryChange ?~ ()) . fromMaybe w $ do
cr <- w ^? cWorld . lWorld . creatures . ix crid
itRef <- cr ^? crManipulation . manObject . imRootSelectedItem
invid <- cr ^? crManipulation . manObject . imSelectedItem
itmtree <- invRootTrees (_crInv cr) ^? ix itRef
itmloc <- allInvLocs (_crInv cr) ^? ix invid
let itm = itmtree ^. ldtValue . _1
case itmtree ^. ldtValue . _2 of
HeldPlatformSF ->