Cleanup, delete hotkeys when deleting item from inventory
This commit is contained in:
@@ -34,7 +34,6 @@ swapInvItems f i w = fromMaybe w $ do
|
||||
& swapAnyExtraSelection i k
|
||||
& checkConnection InventorySound disconnectItemS i k
|
||||
& cWorld . lWorld . creatures . ix 0 %~ updatecreature k
|
||||
--x & swaphotkeys k
|
||||
& updateselection
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
& cWorld . lWorld %~ crUpdateItemLocations 0
|
||||
@@ -43,35 +42,15 @@ swapInvItems f i w = fromMaybe w $ do
|
||||
-- a rethink is maybe in order
|
||||
& checkConnection InventoryConnectSound connectItemS i k
|
||||
where
|
||||
-- & checkconnect k InventoryConnectSound connectItemS
|
||||
|
||||
-- cpos = fromMaybe 0 $ w ^? cWorld . lWorld . creatures . ix 0 . crPos
|
||||
-- checkconnect k stype s w'
|
||||
-- | p (i+1) || p (i-1)
|
||||
-- || p (k+1) || p (k-1) = soundStart stype cpos s Nothing w'
|
||||
-- | otherwise = w'
|
||||
-- where
|
||||
-- p j = maybe False not $ w' ^? cWorld . lWorld . creatures . ix 0 . crInv . ix j . itLocation . ilIsRoot
|
||||
updatecreature k =
|
||||
(crInv %~ IM.safeSwapKeys i k)
|
||||
. (crManipulation . manObject . imSelectedItem .~ k)
|
||||
-- . (crInvEquipped %~ IM.safeSwapKeys i k)
|
||||
. swapSite i k
|
||||
. swapSite k i
|
||||
-- . (crInvHotkeys %~ IM.safeSwapKeys i k)
|
||||
--x swaphotkeys k =
|
||||
--x swapSite' i k
|
||||
--x . swapSite' k i
|
||||
--x . (cWorld . lWorld . imHotkeys %~ IM.safeSwapKeys i k)
|
||||
cr = you w
|
||||
--swapSite a b = case cr ^? crInvEquipped . ix a of
|
||||
swapSite a b = case cr ^? crInv . ix a . itLocation . ilEquipSite . _Just of
|
||||
Just epos -> crEquipment . ix epos .~ b
|
||||
Nothing -> id
|
||||
--swapSite' a b = case cr ^? crInvHotkeys . ix a of
|
||||
--x swapSite' a b = case w ^? cWorld . lWorld . imHotkeys . ix a of
|
||||
--x Just epos -> cWorld . lWorld . hotkeys . ix epos .~ b
|
||||
--x Nothing -> id
|
||||
|
||||
swapAnyExtraSelection :: Int -> Int -> World -> World
|
||||
swapAnyExtraSelection i k w = fromMaybe w $ do
|
||||
@@ -98,4 +77,3 @@ isConnected x = case x ^. locLdtContext of
|
||||
not (null $ x ^. locLDT . ldtRight)
|
||||
|| not (null $ x ^. locLDT . ldtLeft)
|
||||
_ -> True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user