Make combine and tweak menus servicable
This commit is contained in:
@@ -38,20 +38,13 @@ itemEffect cr it w = case it ^? itUse of
|
||||
|
||||
--this is ugly
|
||||
useLeftItem :: Int -> World -> World
|
||||
useLeftItem cid w = case _crInv cr IM.! crinvsel ^? itUse . lUse of
|
||||
useLeftItem cid w = case cr ^? crInv . ix crinvsel . itUse . lUse of
|
||||
Just f -> f cr crinvsel (w & creatures . ix cid . crLeftInvSel ?~ crinvsel)
|
||||
Nothing -> case _crLeftInvSel cr of
|
||||
Just invid -> case _itUse $ _crInv cr IM.! invid of
|
||||
LeftUse {_lUse = f} -> f cr invid w
|
||||
_ -> w & creatures . ix cid . crLeftInvSel .~ Nothing
|
||||
Nothing -> w
|
||||
-- Nothing -> case luse of
|
||||
-- Nothing -> w
|
||||
-- Just (invid, f) -> f cr invid w & creatures . ix cid . crLeftInvSel ?~ invid
|
||||
where
|
||||
crinvsel = _crInvSel cr
|
||||
cr = _creatures w IM.! cid
|
||||
-- luses = IM.mapMaybe (^? itUse . lUse) (_crInv cr)
|
||||
-- luse = listToMaybe $ IM.toList luses
|
||||
--the old code automatically selected the first unused item in the list: not
|
||||
--sure if I want this behaviour, can probably set it as an option later
|
||||
|
||||
Reference in New Issue
Block a user