Start moving hotkeys out from creatures into world

This commit is contained in:
2024-12-19 15:16:47 +00:00
parent 11b5ef74c5
commit 4526119fcd
11 changed files with 131 additions and 108 deletions
+6 -3
View File
@@ -34,6 +34,7 @@ swapInvItems f i w = fromMaybe w $ do
& swapAnyExtraSelection i k
& checkConnection InventorySound disconnectItemS i k
& cWorld . lWorld . creatures . ix 0 %~ updatecreature k
& swaphotkeys k
& updateselection
& worldEventFlags . at InventoryChange ?~ ()
& cWorld . lWorld %~ crUpdateItemLocations 0
@@ -58,15 +59,17 @@ swapInvItems f i w = fromMaybe w $ do
. swapSite i k
. swapSite k i
. (crInvHotkeys %~ IM.safeSwapKeys i k)
. swapSite' i k
swaphotkeys k =
swapSite' i k
. swapSite' k i
cr = you w
--swapSite a b = case cr ^? crInvEquipped . ix a of
swapSite a b = case cr ^? crInv . ix a . itLocation . ilEquipPosition . _Just of
Just epos -> crEquipment . ix epos .~ b
Nothing -> id
swapSite' a b = case cr ^? crInvHotkeys . ix a of
Just epos -> crHotkeys . ix epos .~ b
--swapSite' a b = case cr ^? crInvHotkeys . ix a of
swapSite' a b = case w ^? cWorld . lWorld . creatures . ix 0 . crInvHotkeys . ix a of
Just epos -> cWorld . lWorld . hotkeys . ix epos .~ b
Nothing -> id
swapAnyExtraSelection :: Int -> Int -> World -> World