Removed the outdated system with setfenv, now only module.shared works.

This commit is contained in:
entar 2025-06-10 17:31:41 +07:00
parent 54378d14ff
commit d1d8054c48
4 changed files with 6 additions and 21 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)