refactor GAME.mod (#1006)

Co-authored-by: MrZ_26 <1046101471@qq.com>
This commit is contained in:
Imple Lee
2023-10-08 18:56:44 +08:00
committed by GitHub
parent 323f8a72aa
commit 4e41024ba8
9 changed files with 105 additions and 84 deletions

View File

@@ -504,8 +504,8 @@ function mergeStat(stat,delta)-- Merge delta stat. to global stat.
end
end
function scoreValid()-- Check if any unranked mods are activated
for _,M in next,GAME.mod do
if M.unranked then
for number,sel in next,GAME.mod do
if sel>0 and MODOPT[number].unranked then
return false
end
end
@@ -994,17 +994,23 @@ do-- function dumpBasicConfig()
end
end
do-- function resetGameData(args)
local function task_showMods()
local time=0
while true do
coroutine.yield()
if time%20==0 then
local M=GAME.mod[time/20+1]
if not M then return end
local function task_showMods() -- TODO
coroutine.yield()
local counter=0
for number,sel in next,GAME.mod do
if sel>0 then
if counter==0 then
coroutine.yield()
else
for _=1,20 do
coroutine.yield()
end
end
local M=MODOPT[number]
SFX.play('collect',.2)
TEXT.show(M.id,640+(time/20%5-2)*80,26,45,'spin')
TEXT.show(M.id,640+(counter%5-2)*80,26,45,'spin')
counter=counter+1
end
time=time+1
end
end
local gameSetting={
@@ -1126,6 +1132,14 @@ do-- function checkWarning(P,dt)
end
end
end
function usingMod()
for _,sel in next,GAME.mod do
if sel>0 then
return true
end
end
return false
end
@@ -1176,6 +1190,9 @@ function drawWarning()
gc_pop()
end
end
function setModBackgroundColor()
gc_setColor(.42,.26,.62,.62+.26*math.sin(TIME()*12.6))
end