添加一点注释,整理代码

This commit is contained in:
MrZ_26
2022-10-28 16:33:19 +08:00
parent d79279d1cd
commit 6b16fcd5f5
2 changed files with 7 additions and 7 deletions

View File

@@ -381,7 +381,7 @@ local DemoEnv={
} }
function PLY.newDemoPlayer(id) function PLY.newDemoPlayer(id)
local P=_newEmptyPlayer(id) local P=_newEmptyPlayer(id)
P.type='computer' P.type='bot'
P.sound=false P.sound=false
P.demo=true P.demo=true
@@ -410,7 +410,7 @@ function PLY.newRemotePlayer(id,mini,p)
P.uid=p.uid P.uid=p.uid
P.sid=NET.uid_sid[p.uid] or p.uid P.sid=NET.uid_sid[p.uid] or p.uid
P.group=p.group P.group=p.group
P.netAtk=0 P.netAtk=0-- Sum of lines sent in stream, will be compared with P.stat.send for checking stream legal or not
if not (P.group%1==0 and P.group>=1 and P.group<=6) then P.group=0 end if not (P.group%1==0 and P.group>=1 and P.group<=6) then P.group=0 end
_loadRemoteEnv(P,p.config) _loadRemoteEnv(P,p.config)
@@ -418,13 +418,13 @@ function PLY.newRemotePlayer(id,mini,p)
end end
function PLY.newAIPlayer(id,AIdata,mini,p) function PLY.newAIPlayer(id,AIdata,mini,p)
local P=_newEmptyPlayer(id,mini) local P=_newEmptyPlayer(id,mini)
P.type='computer' P.type='bot'
local pData={ local pData={
uid=id, uid=id,
group=0, group=0,
} if p then TABLE.coverR(p,pData) end } if p then TABLE.coverR(p,pData) end
P.username='BOT'..pData.uid P.username="BOT"..pData.uid
P.sid=NET.uid_sid[pData.uid] or pData.uid P.sid=NET.uid_sid[pData.uid] or pData.uid
P.group=pData.group P.group=pData.group
if not (P.group%1==0 and P.group>=1 and P.group<=6) then P.group=0 end if not (P.group%1==0 and P.group>=1 and P.group<=6) then P.group=0 end

View File

@@ -2606,8 +2606,8 @@ local function update_streaming(P)
for _,p in next,PLY_ALIVE do for _,p in next,PLY_ALIVE do
if p.sid==sid then if p.sid==sid then
P.netAtk=P.netAtk+amount P.netAtk=P.netAtk+amount
if P.netAtk~=P.stat.send then if P.netAtk~=P.stat.send then-- He cheated or just desynchronized to death
MES.new('warn',"#"..P.uid..' desynchronized') MES.new('warn',"#"..P.uid.." desynchronized")
NET.player_finish({foo=""}) NET.player_finish({foo=""})
P:lose(true) P:lose(true)
return return
@@ -2681,7 +2681,7 @@ function Player:update(dt)
self.trigFrame=self.trigFrame+dt*60 self.trigFrame=self.trigFrame+dt*60
if self.alive then if self.alive then
local S=self.stat local S=self.stat
if self.type=='computer' then self.bot:update(dt) end if self.type=='bot' then self.bot:update(dt) end
if self.trigFrame>=1 and self.alive then if self.trigFrame>=1 and self.alive then
if self.streamProgress then if self.streamProgress then
S.time=self.stat.frame/60 S.time=self.stat.frame/60