From 49f1b747b2ca37e0979aa40b09ce687c8e3626d2 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Sat, 10 Aug 2024 18:51:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E4=BA=8B=E4=BB=B6=E7=B3=BB=E7=BB=9F=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E8=87=AA=E7=94=B1=E5=8F=82=E6=95=B0=E6=95=B0=E9=87=8F=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=BD=91=E7=BB=9C=E5=8D=A1=E9=A1=BF=E6=83=85=E5=86=B5?= =?UTF-8?q?=E4=B8=94=E5=BD=95=E5=83=8F=E6=B5=81=E6=9C=80=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E6=98=AF=E6=94=BB=E5=87=BB=E6=97=B6frameRun?= =?UTF-8?q?=E6=9C=89=E6=9C=BA=E4=BC=9A=E8=B6=85=E8=BF=87stream=E5=86=85?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AF=BC=E8=87=B4=E7=8E=A9=E5=AE=B6=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E5=86=BB=E7=BB=93=EF=BC=88wtf=20so=20complicated,=20t?= =?UTF-8?q?hank=20you=20Electra!=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/player/player.lua | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/parts/player/player.lua b/parts/player/player.lua index 9ba90cab..8f820231 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -716,18 +716,18 @@ function Player:extraEvent(eventName,...) return end - local human = nil + local SELF -- Trigger for all non-remote players for _,p in next,PLAYERS do - if p.type ~= 'remote' then - if p.type == 'human' then - human = p + if p.type~='remote' then + if p.type=='human' then + SELF=p end self.gameEnv.extraEventHandler[eventName](p,self,...) end end - - ins(GAME.rep,human.frameRun) + + ins(GAME.rep,SELF.frameRun) ins(GAME.rep,64+eventID) ins(GAME.rep,self.sid) local data={...} @@ -2733,7 +2733,7 @@ local function update_streaming(P) local SRC for _,p in next,PLAYERS do - if P==sourceSid and p.sid==sourceSid then + if p.sid==sourceSid then SRC=p break end @@ -2802,7 +2802,7 @@ function Player:update(dt) end while self.trigFrame>=1 do if self.streamProgress then - local frameDelta-- Time between now and end of stream + local dataDelta=0 -- How much data wating to be process if self.type=='remote' then if self.loseTimer then self.loseTimer=self.loseTimer-1 @@ -2811,25 +2811,24 @@ function Player:update(dt) self:lose(true) end end - frameDelta=(self.stream[#self.stream-1] or 0)-self.frameRun - if frameDelta==0 then frameDelta=nil end - else - frameDelta=0 + dataDelta=#self.stream-self.streamProgress end - if frameDelta then + if dataDelta>0 then for _=1, - self.loseTimer and min(frameDelta, + -- Speed up to finish + self.loseTimer and min(dataDelta, self.loseTimer>16 and 2 or self.loseTimer>6.2 and 12 or self.loseTimer>2.6 and 260 or 2600 ) or - frameDelta<26 and 1 or - frameDelta<50 and 2 or - frameDelta<80 and 3 or - frameDelta<120 and 5 or - frameDelta<160 and 7 or - frameDelta<200 and 10 or + -- Chasing faster when slower + dataDelta<26 and 1 or + dataDelta<42 and 2 or + dataDelta<62 and 3 or + dataDelta<70.23 and 5 or + dataDelta<94.2 and 7 or + dataDelta<126 and 10 or 20 do update_streaming(self)