From 56bbd269c9592692fcc5c25d1e16b98880ea139c Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 5 Apr 2021 21:41:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8D=A2=E6=96=B0=E5=87=86=E5=A4=87=E5=92=8C?= =?UTF-8?q?=E5=BD=95=E5=83=8F=E6=B5=81=E4=BC=A0=E8=BE=93=E7=9A=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/net_game.lua | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index 4a0690d1..3e53b3ab 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -208,17 +208,22 @@ function scene.socketRead(cmd,data) resetGameData("qn") end elseif cmd=="Ready"then - local L=PLY_ALIVE - for i=1,#L do - if L[i].subID==data.uid then - L[i].ready=true - SFX.play("reach",.6) - break + if data.uid==USER.id then + PLAYERS[1].ready=true + SFX.play("reach",.6) + else + for i=1,#PLAYERS do + if PLAYERS[i].userID==data.uid then + PLAYERS[i].ready=true + SFX.play("reach",.6) + break + end end end elseif cmd=="Set"then NET.rsid=data.rid NET.wsConnectStream() + TASK.new(NET.updateWS_stream) elseif cmd=="Begin"then if not playing then playing=true @@ -235,9 +240,13 @@ function scene.socketRead(cmd,data) elseif cmd=="Die"then LOG.print("One player failed",COLOR.sky) elseif cmd=="Stream"then - if playing and data.uid~=PLAYERS[1].subID then + if data.uid==USER.id then + LOG.print("SELF STREAM") + return + end + if playing then for _,P in next,PLAYERS do - if P.subID==data.uid then + if P.userID==data.uid then local res,stream=pcall(love.data.decode,"string","base64",data.stream) if res then pumpRecording(stream,P.stream)