Refactor shell movement, modularised in a tweakable way

This commit is contained in:
2021-05-26 03:35:30 +02:00
parent 7ca7a2f941
commit f05381be47
9 changed files with 170 additions and 112 deletions
+3 -3
View File
@@ -111,13 +111,13 @@ rbSetTarget = ItInvEffect
| _crInvSel cr /= invid = w
| SDL.ButtonRight `S.member` _mouseButtons w = w
& creatures . ix (_crID cr) . crInv . ix invid . itTargeting
%~ maybe (Just $ targetCurrentMousePos w) Just
%~ maybe (Just $ targetRBMousePos w) Just
| otherwise = w & creatures . ix (_crID cr) . crInv . ix invid . itTargeting .~ Nothing
targetCurrentMousePos
targetRBMousePos
:: World
-> (World -> Maybe Point2, Int -> Item -> Creature -> World -> Picture)
targetCurrentMousePos w = (f, \_ _ _ w' -> cursorPic w')
targetRBMousePos w = (f, \_ _ _ w' -> cursorPic w')
where
f _ = Just mwp
mwp = mouseWorldPos w