Move hotkeys out of Creature into LWorld
This commit is contained in:
+4
-4
@@ -41,16 +41,16 @@ assignHotkey invid hk lw = fromMaybe lw $ do
|
||||
|
||||
moveOldHotkey :: Int -> Hotkey -> LWorld -> LWorld
|
||||
moveOldHotkey invid hk w = fromMaybe w $ do
|
||||
oldhk <- w ^? creatures . ix 0 . crInvHotkeys . ix invid
|
||||
oldhk <- w ^? imHotkeys . ix invid
|
||||
oldid <- w ^? hotkeys . ix hk
|
||||
return $ w & setHotkey oldid oldhk
|
||||
|
||||
setHotkey :: Int -> Hotkey -> LWorld -> LWorld
|
||||
setHotkey i hk = (creatures . ix 0 . crInvHotkeys . at i ?~ hk) . (hotkeys . at hk ?~ i)
|
||||
setHotkey i hk = (imHotkeys . at i ?~ hk) . (hotkeys . at hk ?~ i)
|
||||
|
||||
removeHotkey :: Int -> LWorld -> LWorld
|
||||
removeHotkey invid w = w & creatures . ix 0 . crInvHotkeys . at invid .~ Nothing
|
||||
removeHotkey invid w = w & imHotkeys . at invid .~ Nothing
|
||||
& fromMaybe id (do
|
||||
hk <- w ^? creatures . ix 0 . crInvHotkeys . ix invid
|
||||
hk <- w ^? imHotkeys . ix invid
|
||||
return (hotkeys . at hk .~ Nothing)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user