整理代码,微优化
This commit is contained in:
@@ -5,10 +5,9 @@ local gameEnv0=require"parts.player.gameEnv0"
|
||||
local rnd,max=math.random,math.max
|
||||
local ins=table.insert
|
||||
|
||||
local PLY={
|
||||
update=require"parts.player.update",
|
||||
draw=require"parts.player.draw",
|
||||
}
|
||||
local ply_draw=require"parts.player.draw"
|
||||
local ply_update=require"parts.player.update"
|
||||
local PLY={draw=ply_draw}
|
||||
|
||||
--------------------------<Libs>--------------------------
|
||||
local modeDataMeta do
|
||||
@@ -87,7 +86,7 @@ local function newEmptyPlayer(id,mini)
|
||||
P.pressKey=pressKey
|
||||
P.releaseKey=releaseKey
|
||||
end
|
||||
P.update=PLY.update.alive
|
||||
P.update=ply_update.alive
|
||||
|
||||
P.fieldOff={--Shake FX
|
||||
x=0,y=0,
|
||||
@@ -107,9 +106,9 @@ local function newEmptyPlayer(id,mini)
|
||||
if mini then
|
||||
P.canvas=love.graphics.newCanvas(60,120)
|
||||
P.frameWait=rnd(26,62)
|
||||
P.draw=PLY.draw.small
|
||||
P.draw=ply_draw.small
|
||||
else
|
||||
P.draw=PLY.draw.norm
|
||||
P.draw=ply_draw.norm
|
||||
end
|
||||
|
||||
P.randGen=love.math.newRandomGenerator(GAME.seed)
|
||||
@@ -136,9 +135,9 @@ local function newEmptyPlayer(id,mini)
|
||||
P.atker,P.atking,P.lastRecv={}
|
||||
|
||||
--Network-related
|
||||
P.username='_'
|
||||
P.uid=-1
|
||||
P.sid=-1
|
||||
P.username="_"
|
||||
P.uid=false
|
||||
P.sid=false
|
||||
|
||||
P.dropDelay,P.lockDelay=0,0
|
||||
P.showTime=false
|
||||
@@ -357,7 +356,7 @@ function PLY.newDemoPlayer(id)
|
||||
P.demo=true
|
||||
|
||||
P.frameRun=180
|
||||
P.draw=PLY.draw.demo
|
||||
P.draw=ply_draw.demo
|
||||
P.control=true
|
||||
GAME.modeEnv=DemoEnv
|
||||
loadGameEnv(P)
|
||||
@@ -376,9 +375,9 @@ end
|
||||
function PLY.newRemotePlayer(id,mini,ply)
|
||||
local P=newEmptyPlayer(id,mini)
|
||||
P.type='remote'
|
||||
P.update=PLY.update.remote_alive
|
||||
P.update=ply_update.remote_alive
|
||||
|
||||
P.draw=PLY.draw.norm_remote
|
||||
P.draw=ply_draw.norm_remote
|
||||
|
||||
P.stream={}
|
||||
P.streamProgress=1
|
||||
@@ -409,7 +408,6 @@ function PLY.newPlayer(id,mini)
|
||||
P.sound=true
|
||||
|
||||
P.uid=USER.uid
|
||||
P.sid=-1
|
||||
|
||||
loadGameEnv(P)
|
||||
applyGameEnv(P)
|
||||
|
||||
@@ -7,12 +7,14 @@ local int,ceil,rnd=math.floor,math.ceil,math.random
|
||||
local max,min,modf=math.max,math.min,math.modf
|
||||
local ins,rem=table.insert,table.remove
|
||||
local resume,yield,status=coroutine.resume,coroutine.yield,coroutine.status
|
||||
|
||||
local SFX,BGM,VOC,VIB,SYSFX,SKIN=SFX,BGM,VOC,VIB,SYSFX,SKIN
|
||||
local FREEROW,TABLE,TEXT,NET,TASK=FREEROW,TABLE,TEXT,NET,TASK
|
||||
local PLAYERS,PLY_ALIVE,GAME=PLAYERS,PLY_ALIVE,GAME
|
||||
|
||||
|
||||
local kickList=require"parts.kickList"
|
||||
local ply_draw=require"parts.player.draw"
|
||||
local ply_update=require"parts.player.update"
|
||||
|
||||
--------------------------<FX>--------------------------
|
||||
function Player:showText(text,dx,dy,font,style,spd,stop)
|
||||
@@ -199,9 +201,9 @@ function Player:setNext(next,hidden)--Set next count (use hidden=true if set e
|
||||
if next==0 then
|
||||
self.drawNext=NULL
|
||||
elseif not hidden then
|
||||
self.drawNext=PLY.draw.drawNext_norm
|
||||
self.drawNext=ply_draw.drawNext_norm
|
||||
else
|
||||
self.drawNext=PLY.draw.drawNext_hidden
|
||||
self.drawNext=ply_draw.drawNext_hidden
|
||||
end
|
||||
end
|
||||
function Player:setInvisible(time)--Time in frames
|
||||
@@ -1615,7 +1617,7 @@ function Player:die()--Called both when win/lose!
|
||||
self.alive=false
|
||||
self.timing=false
|
||||
self.control=false
|
||||
self.update=PLY.update.dead
|
||||
self.update=ply_update.dead
|
||||
self.waiting=1e99
|
||||
self.b2b=0
|
||||
self.tasks={}
|
||||
|
||||
Reference in New Issue
Block a user