Minor tweaking, argument refining

This commit is contained in:
2022-10-29 12:20:19 +01:00
parent af6cdff063
commit afaef480db
17 changed files with 59 additions and 56 deletions
+4 -4
View File
@@ -83,7 +83,7 @@ targetRBCreatureUp it cr w t
. filter (canseepos . _crPos)
$ crsNearCirc mwp 40 w
canseepos p = hasLOS (_crPos cr) p w
mwp = mouseWorldPos w
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . lWorld . camPos)
updatePos t' = t' & tgPos .~ posFromMaybeID (_tgID t')
posFromMaybeID Nothing = Nothing
posFromMaybeID (Just i) = w ^? cWorld . lWorld . creatures . ix i . crPos
@@ -107,7 +107,7 @@ targetCursorUpdate :: World -> Targeting -> Targeting
targetCursorUpdate w t
| SDL.ButtonRight `M.member` _mouseButtons (_input w) =
t
& tgPos . _Just .~ mouseWorldPos w
& tgPos . _Just .~ mouseWorldPos (w ^. input) (w ^. cWorld . lWorld . camPos)
& tgActive .~ True
| otherwise =
t & tgPos %~ const Nothing
@@ -117,7 +117,7 @@ targetRBPressUpdate :: World -> Targeting -> Targeting
targetRBPressUpdate w t
| SDL.ButtonRight `M.member` _mouseButtons (_input w) =
t
& tgPos %~ maybe (Just $ mouseWorldPos w) Just
& tgPos %~ maybe (Just $ mouseWorldPos (w ^. input) (w ^. cWorld . lWorld . camPos)) Just
& tgActive .~ True
| otherwise =
t & tgPos %~ const Nothing
@@ -139,7 +139,7 @@ targetLaserUpdate _ cr w t
where
(mp, _) = reflectLaserAlong 0.2 sp ep w
sp = _crPos cr +.+ 15 *.* unitVectorAtAngle (_crDir cr)
ep = sp +.+ 5000 *.* normalizeV (mouseWorldPos w -.- sp)
ep = sp +.+ 5000 *.* normalizeV (mouseWorldPos (w ^. input) (w ^. cWorld . lWorld . camPos) -.- sp)
addLaserPic =
cWorld . lWorld . lasers
.:~ LaserStart