From a5569ffbdcf82061ca01bd2b2426a0d8bb011040 Mon Sep 17 00:00:00 2001 From: LarryFrosty <80482125+LarryFrosty@users.noreply.github.com> Date: Sat, 3 Aug 2024 12:07:08 +0800 Subject: [PATCH 1/5] Fix Function_Stop on note callbacks and add noteMissPre --- source/states/PlayState.hx | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/source/states/PlayState.hx b/source/states/PlayState.hx index 8305d37b081..35e09a51036 100644 --- a/source/states/PlayState.hx +++ b/source/states/PlayState.hx @@ -2814,10 +2814,13 @@ class PlayState extends MusicBeatState invalidateNote(note); }); + var result:Dynamic = callOnLuas('noteMissPre', [notes.members.indexOf(daNote), daNote.noteData, daNote.noteType, daNote.isSustainNote]); + var result2:Dynamic = callOnHScript('noteMissPre', [daNote]); + if (result == LuaUtils.Function_Stop || result2 == LuaUtils.Function_Stop) return; noteMissCommon(daNote.noteData, daNote); stagesFunc(function(stage:BaseStage) stage.noteMiss(daNote)); - var result:Dynamic = callOnLuas('noteMiss', [notes.members.indexOf(daNote), daNote.noteData, daNote.noteType, daNote.isSustainNote]); - if(result != LuaUtils.Function_Stop && result != LuaUtils.Function_StopHScript && result != LuaUtils.Function_StopAll) callOnHScript('noteMiss', [daNote]); + callOnLuas('noteMiss', [notes.members.indexOf(daNote), daNote.noteData, daNote.noteType, daNote.isSustainNote]); + callOnHScript('noteMiss', [daNote]); } function noteMissPress(direction:Int = 1):Void //You pressed a key when there was no notes to press for this key @@ -2914,7 +2917,8 @@ class PlayState extends MusicBeatState function opponentNoteHit(note:Note):Void { var result:Dynamic = callOnLuas('opponentNoteHitPre', [notes.members.indexOf(note), Math.abs(note.noteData), note.noteType, note.isSustainNote]); - if(result != LuaUtils.Function_Stop && result != LuaUtils.Function_StopHScript && result != LuaUtils.Function_StopAll) callOnHScript('opponentNoteHitPre', [note]); + var result2:Dynamic = callOnHScript('opponentNoteHitPre', [note]); + if (result == LuaUtils.Function_Stop || result2 == LuaUtils.Function_Stop) return; if (songName != 'tutorial') camZooming = true; @@ -2951,8 +2955,8 @@ class PlayState extends MusicBeatState note.hitByOpponent = true; stagesFunc(function(stage:BaseStage) stage.opponentNoteHit(note)); - var result:Dynamic = callOnLuas('opponentNoteHit', [notes.members.indexOf(note), Math.abs(note.noteData), note.noteType, note.isSustainNote]); - if(result != LuaUtils.Function_Stop && result != LuaUtils.Function_StopHScript && result != LuaUtils.Function_StopAll) callOnHScript('opponentNoteHit', [note]); + callOnLuas('opponentNoteHit', [notes.members.indexOf(note), Math.abs(note.noteData), note.noteType, note.isSustainNote]); + callOnHScript('opponentNoteHit', [note]); if (!note.isSustainNote) invalidateNote(note); } @@ -2967,7 +2971,8 @@ class PlayState extends MusicBeatState var leType:String = note.noteType; var result:Dynamic = callOnLuas('goodNoteHitPre', [notes.members.indexOf(note), leData, leType, isSus]); - if(result != LuaUtils.Function_Stop && result != LuaUtils.Function_StopHScript && result != LuaUtils.Function_StopAll) callOnHScript('goodNoteHitPre', [note]); + var result2:Dynamic = callOnHScript('goodNoteHitPre', [note]); + if (result == LuaUtils.Function_Stop || result2 == LuaUtils.Function_Stop) return; note.wasGoodHit = true; @@ -3052,8 +3057,9 @@ class PlayState extends MusicBeatState } stagesFunc(function(stage:BaseStage) stage.goodNoteHit(note)); - var result:Dynamic = callOnLuas('goodNoteHit', [notes.members.indexOf(note), leData, leType, isSus]); - if(result != LuaUtils.Function_Stop && result != LuaUtils.Function_StopHScript && result != LuaUtils.Function_StopAll) callOnHScript('goodNoteHit', [note]); + callOnLuas('goodNoteHit', [notes.members.indexOf(note), leData, leType, isSus]); + callOnHScript('goodNoteHit', [note]); + if(!note.isSustainNote) invalidateNote(note); } From e230a6a472237fff4999669a9ee238c2ea031ec6 Mon Sep 17 00:00:00 2001 From: LarryFrosty <80482125+LarryFrosty@users.noreply.github.com> Date: Sat, 7 Sep 2024 15:50:00 +0800 Subject: [PATCH 2/5] little eventEarlyTrigger fix --- source/states/PlayState.hx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/states/PlayState.hx b/source/states/PlayState.hx index 35e09a51036..740e0f03dfd 100644 --- a/source/states/PlayState.hx +++ b/source/states/PlayState.hx @@ -565,12 +565,6 @@ class PlayState extends MusicBeatState noteTypes = null; eventsPushed = null; - if(eventNotes.length > 1) - { - for (event in eventNotes) event.strumTime -= eventEarlyTrigger(event); - eventNotes.sort(sortByTime); - } - // SONG SPECIFIC SCRIPTS #if (LUA_ALLOWED || HSCRIPT_ALLOWED) for (folder in Mods.directoriesWithFile(Paths.getSharedPath(), 'data/$songName/')) @@ -588,6 +582,12 @@ class PlayState extends MusicBeatState } #end + if(eventNotes.length > 0) + { + for (event in eventNotes) event.strumTime -= eventEarlyTrigger(event); + eventNotes.sort(sortByTime); + } + startCallback(); RecalculateRating(); From 87b7da286362f03e9ea4ddd079c683777e6b1ad9 Mon Sep 17 00:00:00 2001 From: LarryFrosty <80482125+LarryFrosty@users.noreply.github.com> Date: Sat, 7 Sep 2024 15:55:04 +0800 Subject: [PATCH 3/5] wrong branch also i realized that was already fixed LOL --- source/states/PlayState.hx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/states/PlayState.hx b/source/states/PlayState.hx index 740e0f03dfd..35e09a51036 100644 --- a/source/states/PlayState.hx +++ b/source/states/PlayState.hx @@ -565,6 +565,12 @@ class PlayState extends MusicBeatState noteTypes = null; eventsPushed = null; + if(eventNotes.length > 1) + { + for (event in eventNotes) event.strumTime -= eventEarlyTrigger(event); + eventNotes.sort(sortByTime); + } + // SONG SPECIFIC SCRIPTS #if (LUA_ALLOWED || HSCRIPT_ALLOWED) for (folder in Mods.directoriesWithFile(Paths.getSharedPath(), 'data/$songName/')) @@ -582,12 +588,6 @@ class PlayState extends MusicBeatState } #end - if(eventNotes.length > 0) - { - for (event in eventNotes) event.strumTime -= eventEarlyTrigger(event); - eventNotes.sort(sortByTime); - } - startCallback(); RecalculateRating(); From e5f8a4f7fa8c47318e4d5b34c72e4659e2f0bc51 Mon Sep 17 00:00:00 2001 From: LarryFrosty <80482125+LarryFrosty@users.noreply.github.com> Date: Mon, 16 Sep 2024 05:33:36 +0800 Subject: [PATCH 4/5] add this back --- source/states/PlayState.hx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/states/PlayState.hx b/source/states/PlayState.hx index 35e09a51036..60f27c691a5 100644 --- a/source/states/PlayState.hx +++ b/source/states/PlayState.hx @@ -2819,8 +2819,8 @@ class PlayState extends MusicBeatState if (result == LuaUtils.Function_Stop || result2 == LuaUtils.Function_Stop) return; noteMissCommon(daNote.noteData, daNote); stagesFunc(function(stage:BaseStage) stage.noteMiss(daNote)); - callOnLuas('noteMiss', [notes.members.indexOf(daNote), daNote.noteData, daNote.noteType, daNote.isSustainNote]); - callOnHScript('noteMiss', [daNote]); + var result:Dynamic = callOnLuas('noteMiss', [notes.members.indexOf(daNote), daNote.noteData, daNote.noteType, daNote.isSustainNote]); + if (result != LuaUtils.Function_StopHScript && result != LuaUtils.Function_StopAll) callOnHScript('noteMiss', [daNote]); } function noteMissPress(direction:Int = 1):Void //You pressed a key when there was no notes to press for this key @@ -2955,8 +2955,8 @@ class PlayState extends MusicBeatState note.hitByOpponent = true; stagesFunc(function(stage:BaseStage) stage.opponentNoteHit(note)); - callOnLuas('opponentNoteHit', [notes.members.indexOf(note), Math.abs(note.noteData), note.noteType, note.isSustainNote]); - callOnHScript('opponentNoteHit', [note]); + var result:Dynamic = callOnLuas('opponentNoteHit', [notes.members.indexOf(note), Math.abs(note.noteData), note.noteType, note.isSustainNote]); + if (result != LuaUtils.Function_StopHScript && result != LuaUtils.Function_StopAll) callOnHScript('opponentNoteHit', [note]); if (!note.isSustainNote) invalidateNote(note); } @@ -3057,8 +3057,8 @@ class PlayState extends MusicBeatState } stagesFunc(function(stage:BaseStage) stage.goodNoteHit(note)); - callOnLuas('goodNoteHit', [notes.members.indexOf(note), leData, leType, isSus]); - callOnHScript('goodNoteHit', [note]); + var result:Dynamic = callOnLuas('goodNoteHit', [notes.members.indexOf(note), leData, leType, isSus]); + if (result != LuaUtils.Function_StopHScript && result != LuaUtils.Function_StopAll) callOnHScript('goodNoteHit', [note]); if(!note.isSustainNote) invalidateNote(note); } From 46a1ac54579e49ba60e2ee39c9dc4729e25eb2fd Mon Sep 17 00:00:00 2001 From: LarryFrosty <80482125+LarryFrosty@users.noreply.github.com> Date: Mon, 16 Sep 2024 16:34:11 +0800 Subject: [PATCH 5/5] check Function_StopHScript/All on "pre" functions --- source/states/PlayState.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/states/PlayState.hx b/source/states/PlayState.hx index 60f27c691a5..b34bea7532c 100644 --- a/source/states/PlayState.hx +++ b/source/states/PlayState.hx @@ -2815,7 +2815,7 @@ class PlayState extends MusicBeatState }); var result:Dynamic = callOnLuas('noteMissPre', [notes.members.indexOf(daNote), daNote.noteData, daNote.noteType, daNote.isSustainNote]); - var result2:Dynamic = callOnHScript('noteMissPre', [daNote]); + var result2:Dynamic = (result != LuaUtils.Function_StopHScript && result != LuaUtils.Function_StopAll) ? callOnHScript('noteMissPre', [daNote]) : null; if (result == LuaUtils.Function_Stop || result2 == LuaUtils.Function_Stop) return; noteMissCommon(daNote.noteData, daNote); stagesFunc(function(stage:BaseStage) stage.noteMiss(daNote)); @@ -2917,7 +2917,7 @@ class PlayState extends MusicBeatState function opponentNoteHit(note:Note):Void { var result:Dynamic = callOnLuas('opponentNoteHitPre', [notes.members.indexOf(note), Math.abs(note.noteData), note.noteType, note.isSustainNote]); - var result2:Dynamic = callOnHScript('opponentNoteHitPre', [note]); + var result2:Dynamic = (result != LuaUtils.Function_StopHScript && result != LuaUtils.Function_StopAll) ? callOnHScript('opponentNoteHitPre', [note]) : null; if (result == LuaUtils.Function_Stop || result2 == LuaUtils.Function_Stop) return; if (songName != 'tutorial') @@ -2971,7 +2971,7 @@ class PlayState extends MusicBeatState var leType:String = note.noteType; var result:Dynamic = callOnLuas('goodNoteHitPre', [notes.members.indexOf(note), leData, leType, isSus]); - var result2:Dynamic = callOnHScript('goodNoteHitPre', [note]); + var result2:Dynamic = (result != LuaUtils.Function_StopHScript && result != LuaUtils.Function_StopAll) ? callOnHScript('goodNoteHitPre', [note]) : null; if (result == LuaUtils.Function_Stop || result2 == LuaUtils.Function_Stop) return; note.wasGoodHit = true;