Refactor creature draw, pass World to function
This commit is contained in:
@@ -8,7 +8,7 @@ import Dodge.Data
|
||||
import Dodge.Base
|
||||
import Dodge.Item.Weapon.Decoration
|
||||
import Dodge.Item.Weapon.UseEffect
|
||||
import Dodge.Item.Attachment.Data
|
||||
--import Dodge.Item.Attachment.Data
|
||||
import Dodge.WorldEvent.Flash
|
||||
import Dodge.WorldEvent.ThingsHit
|
||||
import Picture
|
||||
@@ -109,7 +109,15 @@ rbSetTarget = ItInvEffect
|
||||
setTarg _ cr invid w
|
||||
| _crInvSel cr /= invid = w
|
||||
| SDL.ButtonRight `S.member` _mouseButtons w = w
|
||||
& creatures . ix (_crID cr) . crInv . ix invid . itAttachment
|
||||
%~ maybe (Just $ ItTargetPos $ mouseWorldPos w) Just
|
||||
| otherwise = w & creatures . ix (_crID cr) . crInv . ix invid . itAttachment .~ Nothing
|
||||
& creatures . ix (_crID cr) . crInv . ix invid . itTargeting
|
||||
%~ maybe (Just $ targetCurrentMousePos w) Just
|
||||
| otherwise = w & creatures . ix (_crID cr) . crInv . ix invid . itTargeting .~ Nothing
|
||||
|
||||
targetCurrentMousePos
|
||||
:: World
|
||||
-> (World -> Maybe Point2, Item -> Int -> Creature -> World -> Picture)
|
||||
targetCurrentMousePos w = (f, \_ _ _ _ -> cursorPic)
|
||||
where
|
||||
f _ = Just mwp
|
||||
mwp = mouseWorldPos w
|
||||
cursorPic = line [mwp +.+ (5,5), mwp -.- (5,5)]
|
||||
|
||||
Reference in New Issue
Block a user