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:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user