Push item use delay inside datatype, currently broken

This commit is contained in:
2021-11-27 16:37:30 +00:00
parent 224db733f6
commit 8639b2d428
21 changed files with 162 additions and 177 deletions
+3 -3
View File
@@ -32,8 +32,8 @@ itemEffect
-> World
itemEffect cr Consumable{_cnEffect=eff } w = maybe w (rmSelectedInvItem (_crID cr)) (eff (_crID cr) w)
itemEffect cr it w = case it ^? itUse of
Just (RightUse eff) -> foldr ($) eff (_itUseModifiers it) it cr w
Just (LeftUse _ ) -> w & creatures . ix (_crID cr) . crLeftInvSel ?~ _crInvSel cr
Just (RightUse {_rUse = eff,_useMods = usemods}) -> foldr ($) eff usemods it cr w
Just (LeftUse {}) -> w & creatures . ix (_crID cr) . crLeftInvSel ?~ _crInvSel cr
_ -> w
--this is ugly
@@ -42,7 +42,7 @@ useLeftItem cid w = case _crInv cr IM.! 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 f -> f cr invid w
LeftUse {_lUse = f} -> f cr invid w
_ -> w & creatures . ix cid . crLeftInvSel .~ Nothing
Nothing -> case luse of
Nothing -> w