Distinguish between selected item and root-selected item
This commit is contained in:
@@ -251,7 +251,7 @@ itemInvSideEffect cr it
|
||||
| hastorchattach = createAttachLight cr it
|
||||
| otherwise = id
|
||||
where
|
||||
hastorchattach = it ^? itType . iyModules . ix ModHeldAttach == Just ATTACHTORCH && _itIsHeld it
|
||||
hastorchattach = it ^? itType . iyModules . ix ModHeldAttach == Just ATTACHTORCH && _itIsRoot it
|
||||
|
||||
createAttachLight :: Creature -> Item -> World -> World
|
||||
createAttachLight cr it = createTorchLightOffset cr it attachoff
|
||||
@@ -263,9 +263,11 @@ itemUpdate cr i =
|
||||
updateAutoRecharge
|
||||
. (itUse %~ useUpdate)
|
||||
. (itLocation .~ InInv (_crID cr) i)
|
||||
. (itIsHeld .~ itmisheld)
|
||||
. (itIsRoot .~ itmisroot)
|
||||
. (itIsSelected .~ itmisselected)
|
||||
where
|
||||
itmisheld = Just i == (cr ^? crManipulation . manObject . inInventory . ispItem)
|
||||
itmisroot = Just i == (cr ^? crManipulation . manObject . inInventory . imRootItem)
|
||||
itmisselected = Just i == (cr ^? crManipulation . manObject . inInventory . imSelectedItem)
|
||||
|
||||
updateAutoRecharge :: Item -> Item
|
||||
updateAutoRecharge it = case it ^? itUse . leftConsumption of
|
||||
@@ -281,7 +283,7 @@ updateAutoRecharge it = case it ^? itUse . leftConsumption of
|
||||
-- in the inventory
|
||||
crGetTargeting :: Creature -> Maybe TargetType
|
||||
crGetTargeting cr = do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
i <- cr ^? crManipulation . manObject . inInventory . imRootItem
|
||||
itm <- cr ^? crInv . ix i
|
||||
itm ^? itType . iyModules . ix ModTarget . imtTargetType
|
||||
<|> do
|
||||
|
||||
Reference in New Issue
Block a user