From e3d26bdfe070ec8bb946cd4ab3e944690c53a4a7 Mon Sep 17 00:00:00 2001 From: justin Date: Tue, 2 Aug 2022 00:24:01 +0100 Subject: [PATCH] Fix remote projectile direction control --- src/Dodge/Projectile/Update.hs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Dodge/Projectile/Update.hs b/src/Dodge/Projectile/Update.hs index 54cb0b95e..6808513ce 100644 --- a/src/Dodge/Projectile/Update.hs +++ b/src/Dodge/Projectile/Update.hs @@ -99,7 +99,7 @@ upProjectile pu pj = case pu of PJShellCollisionCheck -> updateShell pj PJDecTimMvVel -> decTimMvVel pj PJThrust st et - | act st et -> doThrust' pj + | act st et -> doThrust pj | otherwise -> id PJSpin t cid spinamount | ain t -> trySpinByCID' cid spinamount pj @@ -129,18 +129,19 @@ retireRemoteProj'' itid pjid w = & cWorld . props %~ IM.delete pjid setRemoteDir :: Int -> Int -> Proj -> World -> World -setRemoteDir cid itid pj w = w & cWorld . projectiles . ix (_prjID pj) . prjDir .~ newdir +setRemoteDir cid itid pj w = w & cWorld . projectiles . ix (_prjID pj) . prjAcc .~ turntonewdir where + turntonewdir = magV (_prjAcc pj) *.* unitVectorAtAngle newdir --i = _prjID pj newdir | SDL.ButtonRight `M.member` _mouseButtons w - && w ^? cWorld . creatures . ix cid . crInvSel . iselPos - == w ^? cWorld . itemLocations . ix itid . ipInvID = - _cameraRot (_cWorld w) + argV (_mousePos w) +-- && w ^? cWorld . creatures . ix cid . crInvSel . iselPos +-- == w ^? cWorld . itemLocations . ix itid . ipInvID + = _cameraRot (_cWorld w) + argV (_mousePos w) | otherwise = _prjDir pj -doThrust' :: Proj -> World -> World -doThrust' pj w = +doThrust :: Proj -> World -> World +doThrust pj w = w & randGen .~ g & cWorld . projectiles . ix i . prjVel %~ (\v -> accel +.+ frict *.* v)