Record aim position in LWorld
This commit is contained in:
@@ -29,7 +29,7 @@ blinkActionMousePos cr w =
|
||||
& inverseShockwaveAt cpos 40 2 2
|
||||
where
|
||||
cid = _crID cr
|
||||
p1 = mouseWorldPos (w ^. input) (w ^. wCam)
|
||||
p1 = w ^. cWorld . lWorld . lAimPos
|
||||
cpos = _crPos cr
|
||||
--p2 = bouncePoint (const True) 1 cpos p1 w
|
||||
p2 = pushIntoMaybe $ collideCircWalls cpos p1 r (wlsNearSeg cpos p1 w)
|
||||
@@ -73,7 +73,7 @@ unsafeBlinkAction cr w
|
||||
wl <- snd $ collidePointWallsFilter (const True) mwp cpos w
|
||||
return (isLHS mwp `uncurry` _wlLine wl)
|
||||
cid = _crID cr
|
||||
mwp = mouseWorldPos (w ^. input) (w ^. wCam)
|
||||
mwp = w ^. cWorld . lWorld . lAimPos
|
||||
cpos = _crPos cr
|
||||
|
||||
blinkShockwave ::
|
||||
@@ -99,7 +99,7 @@ blinkActionFail cr w =
|
||||
distR = 120
|
||||
distortionBulge = RadialDistortion cpos (cpos +.+ V2 distR 0) (cpos +.+ V2 0 distR) 1.9
|
||||
cid = _crID cr
|
||||
p1 = mouseWorldPos (w ^. input) (w ^. wCam)
|
||||
p1 = w ^. cWorld . lWorld . lAimPos
|
||||
cpos = _crPos cr
|
||||
p2 = bouncePoint (const True) 1 cpos p1 w
|
||||
r = 1.5 * _crRad cr
|
||||
|
||||
@@ -384,7 +384,7 @@ updateItemTargeting tt cr itm w = case tt of
|
||||
TargetRBPress
|
||||
| rbpressed ->
|
||||
w
|
||||
& pointittarg . itTgPos %~ maybe (Just $ mouseWorldPos (w ^. input) (w ^. wCam)) Just
|
||||
& pointittarg . itTgPos %~ maybe (Just $ w ^. cWorld . lWorld . lAimPos) Just
|
||||
& pointittarg . itTgActive .~ True
|
||||
TargetRBPress ->
|
||||
w
|
||||
@@ -395,7 +395,7 @@ updateItemTargeting tt cr itm w = case tt of
|
||||
w
|
||||
& pointittarg
|
||||
.~ ItTargeting
|
||||
(Just (mouseWorldPos (w ^. input) (w ^. wCam)))
|
||||
(Just (w ^. cWorld . lWorld . lAimPos))
|
||||
Nothing
|
||||
True
|
||||
where
|
||||
@@ -417,7 +417,7 @@ setRBCreatureTargeting cr w ituse
|
||||
. filter (canseepos . _crPos)
|
||||
$ crsNearCirc mwp 40 w
|
||||
canseepos p = hasLOS (_crPos cr) p w
|
||||
mwp = mouseWorldPos (w ^. input) (w ^. wCam)
|
||||
mwp = w ^. cWorld . lWorld . lAimPos
|
||||
updatePos t' = t' & itTgPos .~ posFromMaybeID (_itTgID t')
|
||||
posFromMaybeID Nothing = Nothing
|
||||
posFromMaybeID (Just i) = w ^? cWorld . lWorld . creatures . ix i . crPos
|
||||
|
||||
@@ -5,7 +5,6 @@ module Dodge.Creature.YourControl (
|
||||
import Control.Monad
|
||||
import qualified Data.Map.Strict as M
|
||||
import Data.Maybe
|
||||
import Dodge.Base.Coordinate
|
||||
import Dodge.Creature.Impulse.Movement
|
||||
import Dodge.Creature.Impulse.UseItem
|
||||
import Dodge.Data.World
|
||||
@@ -112,14 +111,14 @@ scancodeToHotkey x = case x of
|
||||
within wasdMovement should probably be done first
|
||||
-}
|
||||
wasdWithAiming :: World -> Creature -> Creature
|
||||
wasdWithAiming w cr = wasdAim inp cam $ wasdMovement inp cam speed cr
|
||||
wasdWithAiming w cr = wasdAim inp w $ wasdMovement inp cam speed cr
|
||||
where
|
||||
speed = _mvSpeed $ _crMvType cr
|
||||
inp = w ^. input
|
||||
cam = w ^. wCam
|
||||
|
||||
wasdAim :: Input -> Camera -> Creature -> Creature
|
||||
wasdAim inp cam cr
|
||||
wasdAim :: Input -> World -> Creature -> Creature
|
||||
wasdAim inp w cr
|
||||
| Just 0 <- inp ^? mouseButtons . ix SDL.ButtonRight
|
||||
, Nothing <- inp ^? mouseButtons . ix SDL.ButtonLeft
|
||||
= setAimPosture cr
|
||||
@@ -127,7 +126,7 @@ wasdAim inp cam cr
|
||||
| Aiming <- cr ^. crStance . posture = removeAimPosture cr
|
||||
| otherwise = creatureTurnTowardDir (_crMvAim cr) 0.2 cr
|
||||
where
|
||||
mousedir = argV $ mouseWorldPos inp cam - (cr ^. crPos)
|
||||
mousedir = argV $ w ^. cWorld . lWorld . lAimPos - (cr ^. crPos)
|
||||
|
||||
setAimPosture :: Creature -> Creature
|
||||
setAimPosture = (crStance . posture .~ Aiming) . doAimTwist (- twoHandTwistAmount)
|
||||
|
||||
Reference in New Issue
Block a user