修复netPlayer模块的一些错误
This commit is contained in:
@@ -20,7 +20,7 @@ return{
|
|||||||
PLY.newPlayer(1)
|
PLY.newPlayer(1)
|
||||||
PLAYERS[1].sid=netPLY.getSID(USER.uid)
|
PLAYERS[1].sid=netPLY.getSID(USER.uid)
|
||||||
for i=2,netPLY.getCount()do
|
for i=2,netPLY.getCount()do
|
||||||
PLY.newRemotePlayer(i,false,netPLY.getPLY(i))
|
PLY.newRemotePlayer(i,false,netPLY.rawgetPLY(i))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
@@ -61,18 +61,16 @@ local posLists={
|
|||||||
}
|
}
|
||||||
local posList
|
local posList
|
||||||
|
|
||||||
local PLY=setmetatable({},{
|
local netPLY={list={}}
|
||||||
__index=function(self,uid)
|
local PLY=netPLY.list
|
||||||
for _,p in next,self do
|
|
||||||
if p.uid==uid then
|
local function getPLY(uid)
|
||||||
return p
|
for i=1,#PLY do
|
||||||
end
|
if PLY[i].uid==uid then
|
||||||
|
return PLY[i]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
end
|
||||||
|
|
||||||
local netPLY={list=PLY}
|
|
||||||
|
|
||||||
local function freshPosList()
|
local function freshPosList()
|
||||||
if #PLY<=5 then
|
if #PLY<=5 then
|
||||||
posList=posLists[1]
|
posList=posLists[1]
|
||||||
@@ -99,13 +97,13 @@ function netPLY.freshPos()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function netPLY.getCount()return #PLY end
|
function netPLY.getCount()return #PLY end
|
||||||
function netPLY.getPLY(i)return PLY[i]end
|
function netPLY.rawgetPLY(i)return PLY[i]end
|
||||||
function netPLY.getUsername(uid)return PLY[uid].username end
|
function netPLY.getUsername(uid)return getPLY(uid).username end
|
||||||
function netPLY.getSID(uid)return PLY[uid].sid end
|
function netPLY.getSID(uid)return getPLY(uid).sid end
|
||||||
function netPLY.getSelfReady()return PLY[1].ready end
|
function netPLY.getSelfReady()return PLY[1].ready end
|
||||||
|
|
||||||
function netPLY.setPlayerObj(ply,p) ply.p=p end
|
function netPLY.setPlayerObj(ply,p)ply.p=p end
|
||||||
function netPLY.setConf(uid,config)PLY[uid].config=config end
|
function netPLY.setConf(uid,config)getPLY(uid).config=config end
|
||||||
function netPLY.setReady(uid,ready)
|
function netPLY.setReady(uid,ready)
|
||||||
for i,p in next,PLY do
|
for i,p in next,PLY do
|
||||||
if p.uid==uid then
|
if p.uid==uid then
|
||||||
|
|||||||
Reference in New Issue
Block a user