Fixed fenv, access game variables through game.xxxx

This commit is contained in:
entar 2025-06-05 08:54:02 +07:00
parent 0380258c8f
commit 26ce959302
2 changed files with 14 additions and 12 deletions

View File

@ -416,17 +416,6 @@ local function state(songName, songDifficulty)
modules[#modules+1] = stageModule
end
for i, func in next, stageModule do
setfenv(func, {
characters=characters,
step=step,
beat=beat,
volume=volume,
ratings=ratings,,
keyBinds=keyBinds
})
end
if stageModule and stageModule.onCreate then
stageModule.onCreate(chart.song)
end
@ -449,7 +438,6 @@ local function state(songName, songDifficulty)
characters.dad:PlayAnimation("idle")
end
conductor.stepCrochet = conductor:calculateCrochet(chart.bpm)/4
for i = 0, 3 do
@ -509,6 +497,19 @@ local function state(songName, songDifficulty)
keyBinds = settings.Keybinds
state.loaded = true
for i, func in next, stageModule do
local newEnv = getfenv(func)
newEnv.game = {
characters=characters,
step=step,
beat=beat,
volume=volume,
ratings=ratings,
keyBinds=keyBinds
}
setfenv(func, newEnv)
end
end
function state.finish()

View File

@ -55,6 +55,7 @@ return {
dancer.allowedFrame = 1
dancer:PlayAnimation("bg dancer sketch PINK", 24, false)
end
end
end
}