Improve item location code
This commit is contained in:
@@ -248,10 +248,10 @@ invSideEff cr w =
|
||||
|
||||
itemInvSideEffect :: Creature -> Item -> World -> World
|
||||
itemInvSideEffect cr it
|
||||
| hastorchattach = createAttachLight cr it
|
||||
-- | hastorchattach = createAttachLight cr it
|
||||
| otherwise = id
|
||||
where
|
||||
hastorchattach = it ^? itType . iyModules . ix ModHeldAttach == Just ATTACHTORCH && _itIsRoot it
|
||||
-- hastorchattach = it ^? itType . iyModules . ix ModHeldAttach == Just ATTACHTORCH && _itIsRoot it
|
||||
|
||||
createAttachLight :: Creature -> Item -> World -> World
|
||||
createAttachLight cr it = createTorchLightOffset cr it attachoff
|
||||
@@ -262,9 +262,9 @@ itemUpdate :: Creature -> Int -> Item -> Item
|
||||
itemUpdate cr i =
|
||||
updateAutoRecharge
|
||||
. (itUse %~ useUpdate)
|
||||
. (itLocation .~ InInv (_crID cr) i)
|
||||
. (itIsRoot .~ itmisroot)
|
||||
. (itIsSelected .~ itmisselected)
|
||||
. (itLocation .~ InInv (_crID cr) i itmisselected itmisroot)
|
||||
-- . (itIsRoot .~ itmisroot)
|
||||
-- . (itIsSelected .~ itmisselected)
|
||||
where
|
||||
itmisroot = Just i == (cr ^? crManipulation . manObject . inInventory . imRootItem)
|
||||
itmisselected = Just i == (cr ^? crManipulation . manObject . inInventory . imSelectedItem)
|
||||
|
||||
Reference in New Issue
Block a user