move this out

This commit is contained in:
nek0 2018-07-25 01:10:21 +02:00
parent ca1df3f172
commit 744850d3f0

View file

@ -210,15 +210,15 @@ movePlayer _ = return ()
playerInteract :: MouseMessage -> Affection UserData ()
playerInteract (MsgMouseButton _ _ SDL.Pressed _ SDL.ButtonRight _ m) = do
ud <- getAffection
(V2 rx ry) <- liftIO $ relativizeMouseCoords m
let dr = (ry / sin (atan 0.5) / 2) + rx
dc = rx - (ry / sin (atan 0.5) / 2)
(nws, relEnts) <- liftIO $ yieldSystemT (worldState ud) $ do
emap allEnts $ do
with player
with rot
rot' <- query rot
(V2 rx ry) <- liftIO $ relativizeMouseCoords m
let dr = (ry / sin (atan 0.5) / 2) + rx
dc = rx - (ry / sin (atan 0.5) / 2)
ndir = direction (V2 dr dc)
let ndir = direction (V2 dr dc)
return $ unchanged
{ rot = Set $ fromMaybe rot' ndir
}