From d1d8054c482370fadd2db38eb4dde152150d632e Mon Sep 17 00:00:00 2001 From: entar Date: Tue, 10 Jun 2025 17:31:41 +0700 Subject: [PATCH] Removed the outdated system with setfenv, now only module.shared works. --- charts/thorns/Spin.lua | 2 +- modules/states/playstate.lua | 20 ++------------------ modules/types/note.lua | 1 + stages/spooky.lua | 4 ++-- 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/charts/thorns/Spin.lua b/charts/thorns/Spin.lua index 9eb5101..8ea90fb 100644 --- a/charts/thorns/Spin.lua +++ b/charts/thorns/Spin.lua @@ -22,7 +22,7 @@ if value == 1 then setProperty('dadGroup.x', getProperty 'dadGroup.x' + math.sin((eT * speed.x) + offset.x) * reach.x) setProperty('dadGroup.y', getProperty 'dadGroup.y' + math.cos((eT * speed.y) + offset.y) * reach.y) if not mustHitSection then - runHaxeCode 'game.moveCameraSection();' + runHaxeCode 'module.shared.moveCameraSection();' end end end diff --git a/modules/states/playstate.lua b/modules/states/playstate.lua index ffb8823..85ebd05 100644 --- a/modules/states/playstate.lua +++ b/modules/states/playstate.lua @@ -166,7 +166,8 @@ local function state(songName, songDifficulty) speed = speed, ui = ui, zoom = zoom, - notes = notes -- only spawned notes + notes = notes, -- only spawned notes + characters = characters } local function quit() @@ -820,23 +821,6 @@ local function state(songName, songDifficulty) for i, module in next, modules do if type(module) ~= "boolean" then - for i, func in next, module do - if type(func) ~= "function" then goto evilContinue end - local newEnv = getfenv(func) - newEnv.game = { - characters=characters, - step=step, - beat=beat, - volume=volume, - ratings=ratings, - keyBinds=keyBinds, - zoom=zoom - } - setfenv(func, newEnv) - ::evilContinue:: - end - - module.characters = characters module.shared = sharedVars if module.onCreate then diff --git a/modules/types/note.lua b/modules/types/note.lua index fefde94..6be4b70 100644 --- a/modules/types/note.lua +++ b/modules/types/note.lua @@ -38,6 +38,7 @@ function NoteClass:spawn() if self.hold then sprite.layer = 9 if self.holdEnd then + sprite.layer = 10 spriteName = string.format("%s hold end", sprites[self.direction]) if self.flipY then sprite.extraOffset = module.types.Vector2(0, -70) diff --git a/stages/spooky.lua b/stages/spooky.lua index faeec13..c22c16b 100644 --- a/stages/spooky.lua +++ b/stages/spooky.lua @@ -25,8 +25,8 @@ return { if lightningCountdown == 0 then mansion:PlayAnimation("halloweem bg lightning strike", 24, false) - game.characters.bf:PlayAnimation("scared") - game.characters.gf:PlayAnimation("scared") + module.shared.characters.bf:PlayAnimation("scared") + module.shared.characters.gf:PlayAnimation("scared") lightningCountdown = love.math.random(15, 20)