Fix bugs in equipment allocation using hotkeys

The behaviour is still not perfect, should be able to cycle through all
options by pressing one key. There is unnecessary memory of past state
going on here
This commit is contained in:
2025-01-01 14:48:17 +00:00
parent 7dd379d4bc
commit dae0e0591c
10 changed files with 289 additions and 313 deletions
+3 -3
View File
@@ -81,7 +81,7 @@ activateDetonator det = fromMaybe id $ do
return $ cWorld . lWorld . projectiles . ix pjid . pjTimer .~ 0
toggleEquipmentAt :: Int -> Creature -> World -> World
toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
toggleEquipmentAt invid cr w = case getEquipmentAllocation invid w of
DoNotMoveEquipment -> w
PutOnEquipment{_allocNewPos = newp} ->
w
@@ -114,7 +114,7 @@ toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
where
crpoint = cWorld . lWorld . creatures . ix (_crID cr)
itmat i = _crInv cr IM.! i
itm = itmat itRef
itRef = cr ^?! crManipulation . manObject . imSelectedItem -- unsafe!! TODO change?
itm = itmat invid
-- itRef = cr ^?! crManipulation . manObject . imSelectedItem -- unsafe!! TODO change?
onequip itm' = doItmCrWdWd ((_eeOnEquip . _uequipEffect . _itUse) itm') itm'
onremove itm' = doItmCrWdWd ((_eeOnRemove . _uequipEffect . _itUse) itm') itm'