Task模块全部改用协程
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
local max=math.max
|
||||
return{
|
||||
color=COLOR.lYellow,
|
||||
env={
|
||||
@@ -7,20 +6,24 @@ return{
|
||||
freshLimit=15,
|
||||
pushSpeed=2,
|
||||
task=function(P)
|
||||
if not(P.control and SCN.cur=="play")then return end
|
||||
P.modeData.counter=P.modeData.counter+1
|
||||
if P.modeData.counter>=max(300,600-10*P.modeData.event)and P.atkBuffer.sum<20 then
|
||||
local t=max(300,480-12*P.modeData.event)
|
||||
local p=#P.atkBuffer+1
|
||||
P.atkBuffer[p] ={pos=P:RND(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=2}
|
||||
P.atkBuffer[p+1]={pos=P:RND(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3}
|
||||
P.atkBuffer[p+2]={pos=P:RND(10),amount=6,countdown=1.2*t,cd0=1.2*t,time=0,sent=false,lv=4}
|
||||
P.atkBuffer[p+3]={pos=P:RND(10),amount=6,countdown=1.5*t,cd0=1.5*t,time=0,sent=false,lv=5}
|
||||
P.atkBuffer.sum=P.atkBuffer.sum+20
|
||||
P.stat.recv=P.stat.recv+20
|
||||
if P.modeData.event==31 then P:showTextF(text.maxspeed,0,-140,100,"appear",.6)end
|
||||
P.modeData.counter=0
|
||||
P.modeData.event=P.modeData.event+1
|
||||
while true do
|
||||
coroutine.yield()
|
||||
if P.control and SCN.cur=="play"then
|
||||
P.modeData.counter=P.modeData.counter+1
|
||||
if P.modeData.counter>=math.max(300,600-10*P.modeData.event)and P.atkBuffer.sum<20 then
|
||||
local t=math.max(300,480-12*P.modeData.event)
|
||||
local p=#P.atkBuffer+1
|
||||
P.atkBuffer[p] ={pos=P:RND(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=2}
|
||||
P.atkBuffer[p+1]={pos=P:RND(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3}
|
||||
P.atkBuffer[p+2]={pos=P:RND(10),amount=6,countdown=1.2*t,cd0=1.2*t,time=0,sent=false,lv=4}
|
||||
P.atkBuffer[p+3]={pos=P:RND(10),amount=6,countdown=1.5*t,cd0=1.5*t,time=0,sent=false,lv=5}
|
||||
P.atkBuffer.sum=P.atkBuffer.sum+20
|
||||
P.stat.recv=P.stat.recv+20
|
||||
if P.modeData.event==31 then P:showTextF(text.maxspeed,0,-140,100,"appear",.6)end
|
||||
P.modeData.counter=0
|
||||
P.modeData.event=P.modeData.event+1
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
bg="welcome",bgm="storm",
|
||||
|
||||
Reference in New Issue
Block a user