Tweak combine inventory display/click events

This commit is contained in:
2024-11-04 10:00:10 +00:00
parent df08dc8ab5
commit 0b43541080
3 changed files with 29 additions and 15 deletions
+1 -1
View File
@@ -1 +1 @@
All good (594 modules, at 09:31:25)
All good (594 modules, at 10:00:00)
+25 -14
View File
@@ -79,17 +79,20 @@ drawMouseCursor u =
mouseCursorType :: Universe -> Picture
mouseCursorType u
| isselect = drawPlus 5
| Just csel <- u ^? uvWorld . hud . hudElement . subInventory . ciSelection
= if (csel == u ^? uvWorld . hud . hudElement . subInventory . ciMouseOver . _Just
|| null (u ^? uvWorld . hud . hudElement . subInventory . ciMouseOver . _Just))
| Just csel <- u ^? uvWorld . hud . hudElement . subInventory . ciSelection =
if ( csel == u ^? uvWorld . hud . hudElement . subInventory . ciMouseOver . _Just
|| null (u ^? uvWorld . hud . hudElement . subInventory . ciMouseOver . _Just)
)
&& null (u ^? uvWorld . hud . hudElement . diMouseOver . _Just)
&& fmap fst csel /= Just (-1)
then drawDoublePlus 5
else drawPlus 5
&& fromMaybe True (u ^? uvWorld . hud . hudElement . subInventory . ciSections . ix 0 . ssItems . ix 0 . siIsSelectable) --HACK to check there is something creatable
then drawGapPlus 5
else drawPlus 5
| otherwise = rotate a (drawPlus 5)
where
isselect = not (null $ u ^. uvScreenLayers)
|| not (null $ u ^? uvWorld . hud . hudElement . diMouseOver . _Just)
isselect =
not (null $ u ^. uvScreenLayers)
|| not (null $ u ^? uvWorld . hud . hudElement . diMouseOver . _Just)
w = u ^. uvWorld
a = fromMaybe 0 $ do
cpos <- w ^? cWorld . lWorld . creatures . ix 0 . crPos
@@ -100,12 +103,20 @@ mouseCursorType u
drawPlus :: Float -> Picture
drawPlus x = fold [line [V2 (- x) 0, V2 x 0], line [V2 0 (- x), V2 0 x]]
drawDoublePlus :: Float -> Picture
drawDoublePlus x = fold [line [V2 (- (1.5*x)) 0, V2 (1.5*x) 0]
, line [V2 (0.5 * x) (- x), V2 (0.5 * x) x]
, line [V2 (negate 0.5 * x) (- x), V2 (negate 0.5 * x) x]
]
--drawDoublePlus :: Float -> Picture
--drawDoublePlus x = fold [line [V2 (- (1.5*x)) 0, V2 (1.5*x) 0]
-- , line [V2 (0.5 * x) (- x), V2 (0.5 * x) x]
-- , line [V2 (negate 0.5 * x) (- x), V2 (negate 0.5 * x) x]
-- ]
drawGapPlus :: Float -> Picture
drawGapPlus x =
fold
[ line [V2 (-1.5 * x) 0, V2 (-0.5 * x) 0]
, line [V2 (0.5 * x) 0, V2 (1.5 * x) 0]
, line [V2 (0.5 * x) (- x), V2 (0.5 * x) x]
, line [V2 (-0.5 * x) (- x), V2 (-0.5 * x) x]
]
aimDelaySweep :: World -> Picture
aimDelaySweep w = fromMaybe mempty $ do
@@ -122,8 +133,8 @@ drawSweep cr w = fromMaybe mempty $ do
| a - cdir < - pi = cdir - 2 * pi
| otherwise = cdir
return $
uncurryV translate (worldPosToScreen campos p) $
arcFull (a - rot) 10 white (a' - rot) 1 white (5 + dist mwp p * campos ^. camZoom) white
uncurryV translate (worldPosToScreen campos p) $
arcFull (a - rot) 10 white (a' - rot) 1 white (5 + dist mwp p * campos ^. camZoom) white
where
cdir = _crDir cr
rot = campos ^. camRot
+3
View File
@@ -113,6 +113,9 @@ updateCombineInvClick msel sss w = fromMaybe trydocombination $ do
& worldEventFlags . at CombineInventoryChange ?~ ()
| i == -1 -> w & hud . hudElement . subInventory . ciFilter .~ Nothing
& worldEventFlags . at CombineInventoryChange ?~ ()
_ | (w ^? hud . hudElement . subInventory . ciSelection . _Just . _1) == Just (-1)
-> w & hud . hudElement . subInventory . ciFilter .~ Nothing
& worldEventFlags . at CombineInventoryChange ?~ ()
_ -> (worldEventFlags . at InventoryChange ?~ ()) . maybeExitCombine $
tryCombine sss msel w
& worldEventFlags . at CombineInventoryChange ?~ ()