Add sounds when connecting/disconnecting items
This commit is contained in:
@@ -189,7 +189,8 @@ swapInvItems f i w = fromMaybe w $ do
|
||||
Just (0, j) | j == i -> hud . hudElement . diSelection . _Just . _2 .~ k
|
||||
_ -> id
|
||||
return $
|
||||
w & checkdisconnect k
|
||||
w
|
||||
& checkconnect k InventorySound disconnectItemS
|
||||
& cWorld . lWorld . creatures . ix 0 %~ updatecreature k
|
||||
& updateselection
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
@@ -197,14 +198,15 @@ swapInvItems f i w = fromMaybe w $ do
|
||||
& setInvPosFromSS
|
||||
& cWorld . lWorld %~ crUpdateItemLocations 0 -- the double application is inefficient, but necessary without further changes
|
||||
-- a rethink is maybe in order
|
||||
& checkconnect k InventoryConnectSound connectItemS
|
||||
where
|
||||
cpos = fromMaybe 0 $ w ^? cWorld . lWorld . creatures . ix 0 . crPos
|
||||
checkdisconnect k
|
||||
| a || b = soundStart InventorySound cpos disconnectItemS Nothing
|
||||
| otherwise = id
|
||||
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
|
||||
a = maybe False not $ w ^? cWorld . lWorld . creatures . ix 0 . crInv . ix i . itLocation . ilIsRoot
|
||||
b = maybe False not $ w ^? cWorld . lWorld . creatures . ix 0 . crInv . ix k . itLocation . ilIsRoot
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user