diff --git a/parts/modes/netBattle.lua b/parts/modes/netBattle.lua index cddb352e..c781e1e2 100644 --- a/parts/modes/netBattle.lua +++ b/parts/modes/netBattle.lua @@ -20,7 +20,7 @@ return{ PLY.newPlayer(1) PLAYERS[1].sid=netPLY.getSID(USER.uid) for i=2,netPLY.getCount()do - PLY.newRemotePlayer(i,false,netPLY.getPLY(i)) + PLY.newRemotePlayer(i,false,netPLY.rawgetPLY(i)) end end, } \ No newline at end of file diff --git a/parts/netPlayer.lua b/parts/netPlayer.lua index 9dcf8761..316e48a9 100644 --- a/parts/netPlayer.lua +++ b/parts/netPlayer.lua @@ -61,18 +61,16 @@ local posLists={ } local posList -local PLY=setmetatable({},{ - __index=function(self,uid) - for _,p in next,self do - if p.uid==uid then - return p - end +local netPLY={list={}} +local PLY=netPLY.list + +local function getPLY(uid) + for i=1,#PLY do + if PLY[i].uid==uid then + return PLY[i] end end -}) - -local netPLY={list=PLY} - +end local function freshPosList() if #PLY<=5 then posList=posLists[1] @@ -99,13 +97,13 @@ function netPLY.freshPos() end function netPLY.getCount()return #PLY end -function netPLY.getPLY(i)return PLY[i]end -function netPLY.getUsername(uid)return PLY[uid].username end -function netPLY.getSID(uid)return PLY[uid].sid end +function netPLY.rawgetPLY(i)return PLY[i]end +function netPLY.getUsername(uid)return getPLY(uid).username end +function netPLY.getSID(uid)return getPLY(uid).sid end function netPLY.getSelfReady()return PLY[1].ready end -function netPLY.setPlayerObj(ply,p) ply.p=p end -function netPLY.setConf(uid,config)PLY[uid].config=config end +function netPLY.setPlayerObj(ply,p)ply.p=p end +function netPLY.setConf(uid,config)getPLY(uid).config=config end function netPLY.setReady(uid,ready) for i,p in next,PLY do if p.uid==uid then