diff --git a/src-server/Server/Communication/Handler.hs b/src-server/Server/Communication/Handler.hs index 7e1095f..fb11595 100644 --- a/src-server/Server/Communication/Handler.hs +++ b/src-server/Server/Communication/Handler.hs @@ -23,6 +23,7 @@ import Server.Communication.Send import Server.Log import Server.Types import Server.Util +import System.Random (randomRIO) -- | function for translating 'ClientMessage's into server actions handleMessage @@ -76,9 +77,10 @@ handleMessage stateContainer readerContainer msg = do ClientRequestWizard -> do let arena = rcMap readerContainer initPos <- rollInitPosition arena + initRot <- randomRIO (0, 2 * pi) now <- liftIO getCurrentTime uuid <- nextRandom - let freshWizard = newWizard initPos + let freshWizard = newWizard initPos initRot STM.atomically $ do currentPlayers <- STM.readTMVar (scPlayers stateContainer) void $ STM.swapTMVar (scPlayers stateContainer) $ diff --git a/src-server/Server/Communication/Send.hs b/src-server/Server/Communication/Send.hs index 45a007d..a445aad 100644 --- a/src-server/Server/Communication/Send.hs +++ b/src-server/Server/Communication/Send.hs @@ -184,8 +184,8 @@ sendUpdate curLevel stateContainer tileMap player = do leftLine row = cos leftBound * row rightLine row = sin rightBound * row correctionLeft = if wizardRot < pi / 2 || wizardRot >= 2 * pi - then floor - else ceiling + then ceiling + else floor correctionRight = if wizardRot < pi / 2 || wizardRot >= 2 * pi then ceiling else floor diff --git a/src-server/Server/Util.hs b/src-server/Server/Util.hs index cfbd31a..e874041 100644 --- a/src-server/Server/Util.hs +++ b/src-server/Server/Util.hs @@ -25,11 +25,12 @@ removeIfExists fileName = removeFile fileName `catch` handleExists newWizard :: Position + -> Float -> Wizard -newWizard pos = +newWizard pos rot = Wizard { wizardWands = [] - , wizardRot = 0 + , wizardRot = rot , wizardPos = pos , wizardMana = 100 , wizardHealth = 100