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
+8 -4
View File
@@ -53,7 +53,8 @@ toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
-- & crpoint . crInvEquipped . at invid ?~ newp
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
& onequip itm cr
& crpoint %~ assignNewHotkey invid
-- & crpoint %~ assignNewHotkey invid
& cWorld . lWorld %~ assignNewHotkey invid
MoveEquipment{_allocNewPos = newp, _allocOldPos = oldp} ->
w
& crpoint . crEquipment . at newp ?~ invid
@@ -77,15 +78,18 @@ toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
& crpoint . crInv . ix rid . itLocation . ilEquipPosition .~ Nothing
& onremove (itmat rid) cr
& onequip itm cr
& crpoint %~ removeHotkey rid
& crpoint %~ assignNewHotkey invid
-- & crpoint %~ removeHotkey rid
-- & crpoint %~ assignNewHotkey invid
& cWorld . lWorld %~ removeHotkey rid
& cWorld . lWorld %~ assignNewHotkey invid
RemoveEquipment{_allocOldPos = oldp} ->
w
& crpoint . crEquipment . at oldp .~ Nothing
-- & crpoint . crInvEquipped . at invid .~ Nothing
& crpoint . crInv . ix invid . itLocation . ilEquipPosition .~ Nothing
& onremove itm cr
& crpoint %~ removeHotkey invid
-- & crpoint %~ removeHotkey invid
& cWorld . lWorld %~ removeHotkey invid
where
crpoint = cWorld . lWorld . creatures . ix (_crID cr)
itmat i = _crInv cr IM.! i