Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACTUAL eventEarlyTrigger fix #16097

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,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/'))
Expand All @@ -604,6 +598,12 @@ class PlayState extends MusicBeatState
}
#end

if(eventNotes.length > 0)
{
for (event in eventNotes) event.strumTime -= eventEarlyTrigger(event);
eventNotes.sort(sortByTime);
}

startCallback();
RecalculateRating();

Expand Down Expand Up @@ -1479,9 +1479,8 @@ class PlayState extends MusicBeatState
}

function eventEarlyTrigger(event:EventNote):Float {
var returnedValue:Dynamic = callOnScripts('eventEarlyTrigger', [event.event, event.value1, event.value2, event.strumTime], true, [], [0]);
returnedValue = Std.parseFloat(returnedValue);
if(!Math.isNaN(returnedValue) && returnedValue != 0) {
var returnedValue:Null<Float> = callOnScripts('eventEarlyTrigger', [event.event, event.value1, event.value2, event.strumTime], true);
if(returnedValue != null && returnedValue != 0) {
return returnedValue;
}

Expand Down Expand Up @@ -3309,7 +3308,7 @@ class PlayState extends MusicBeatState
#end

public function callOnScripts(funcToCall:String, args:Array<Dynamic> = null, ignoreStops = false, exclusions:Array<String> = null, excludeValues:Array<Dynamic> = null):Dynamic {
var returnVal:String = LuaUtils.Function_Continue;
var returnVal:Dynamic = LuaUtils.Function_Continue;
if(args == null) args = [];
if(exclusions == null) exclusions = [];
if(excludeValues == null) excludeValues = [LuaUtils.Function_Continue];
Expand All @@ -3320,7 +3319,7 @@ class PlayState extends MusicBeatState
}

public function callOnLuas(funcToCall:String, args:Array<Dynamic> = null, ignoreStops = false, exclusions:Array<String> = null, excludeValues:Array<Dynamic> = null):Dynamic {
var returnVal:String = LuaUtils.Function_Continue;
var returnVal:Dynamic = LuaUtils.Function_Continue;
#if LUA_ALLOWED
if(args == null) args = [];
if(exclusions == null) exclusions = [];
Expand Down Expand Up @@ -3359,7 +3358,7 @@ class PlayState extends MusicBeatState
}

public function callOnHScript(funcToCall:String, args:Array<Dynamic> = null, ?ignoreStops:Bool = false, exclusions:Array<String> = null, excludeValues:Array<Dynamic> = null):Dynamic {
var returnVal:String = LuaUtils.Function_Continue;
var returnVal:Dynamic = LuaUtils.Function_Continue;

#if HSCRIPT_ALLOWED
if(exclusions == null) exclusions = new Array();
Expand Down
Loading