Fix remote projectile direction control
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user