From 0380258c8f2ee7b4c4a11aea81fd612767c1834b Mon Sep 17 00:00:00 2001 From: entar Date: Thu, 5 Jun 2025 08:44:19 +0700 Subject: [PATCH] Perfect holdnotes and characters in env --- modules/states/playstate.lua | 23 ++++++++++++++++++----- modules/types/note.lua | 2 +- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/modules/states/playstate.lua b/modules/states/playstate.lua index 2fafadf..a6c88c0 100644 --- a/modules/states/playstate.lua +++ b/modules/states/playstate.lua @@ -129,7 +129,7 @@ local function state(songName, songDifficulty) } local font = love.graphics.newFont("fonts/Phantomuff.ttf", 15) - local biggerFont = love.graphics.newFont("fonts/Phantomuff.ttf", 23) + local biggerFont = love.graphics.newFont("fonts/Phantomuff.ttf", 30) local receptors = {} local splashes = {} @@ -316,7 +316,7 @@ local function state(songName, songDifficulty) for index, hold in next, holdNotes do if hold.mustPress then hold.sprite.position = myTypes.Vector2(625 + (79 * (hold.direction - 1)), settings.Downscroll and 430 - (hold.position-elapsed) * speed or (hold.position - elapsed) * speed) - if hold.position - elapsed + hold.sprite.extraOffset.y < 10 then + if hold.position - elapsed < 10 then if love.keyboard.isDown(keyBinds[hold.direction]) then if section.altAnim or hold.altAnim then characters.bf:PlayAnimation("sing"..directions[hold.direction].."-alt") @@ -336,7 +336,7 @@ local function state(songName, songDifficulty) end else hold.sprite.position = myTypes.Vector2(75 + (79 * (hold.direction - 1)), settings.Downscroll and 430 - (hold.position-elapsed) * speed or (hold.position - elapsed) * speed) - if hold.position - elapsed + hold.sprite.extraOffset.y < 10 then + if hold.position - elapsed < 10 then if section.altAnim or hold.altAnim then characters.dad:PlayAnimation("sing"..directions[hold.direction].."-alt") else @@ -416,10 +416,22 @@ 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 + -- GF first so she is below other chars if chart.gfVersion ~= "none" then characters.gf = myTypes.character(chart.gfVersion) @@ -476,17 +488,18 @@ local function state(songName, songDifficulty) if note[3] > 0 then local length = note[3] / conductor.stepCrochet - for i = 0, length - 1, .1 do + for i = 0, length - .1, .1 do local newHold = myTypes.note({note[1] + i * conductor.stepCrochet, note[2], note[3], note[4]}, section.mustHitSection, true) unspawnedHoldNotes[#unspawnedHoldNotes+1] = newHold + end local newHold = myTypes.note({note[1] + math.floor(length) * conductor.stepCrochet, note[2], note[3], note[4]}, section.mustHitSection, true, true) unspawnedHoldNotes[#unspawnedHoldNotes+1] = newHold newHold.holdEnd = true if settings.Downscroll then newHold.flipY = true - newHold.speed = speed end + newHold.speed = speed end end end diff --git a/modules/types/note.lua b/modules/types/note.lua index 182f50e..884067e 100644 --- a/modules/types/note.lua +++ b/modules/types/note.lua @@ -37,7 +37,7 @@ function NoteClass:spawn() if self.holdEnd then spriteName = string.format("%s hold end", sprites[self.direction]) if self.flipY then - sprite.extraOffset = module.types.Vector2(0, -150 * self.speed * 2.5) + sprite.extraOffset = module.types.Vector2(0, -70) end else spriteName = string.format("%s hold piece", sprites[self.direction])