Skip to content

Commit

Permalink
2 again
Browse files Browse the repository at this point in the history
  • Loading branch information
VMan-2002 committed Jul 29, 2023
1 parent 3823f73 commit ff78629
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1901,7 +1901,7 @@ class PlayState extends MusicBeatState
}

if (generatedMusic) {
Scripting.runModchartUpdateOnScripts();
Scripting.runModchartUpdateOnScripts("modchartUpdate");
var speed = (0.45 * FlxMath.roundDecimal(scrollSpeed, 3));
if (Options.instance.downScroll)
speed = 0 - speed;
Expand Down Expand Up @@ -1989,6 +1989,7 @@ class PlayState extends MusicBeatState
break;
}
}
Scripting.runModchartUpdateOnScripts("modchartPostUpdate");
}

if (camIsFollowing) {
Expand Down
10 changes: 6 additions & 4 deletions source/Scripting.hx
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ class Scripting {
}
}

public static function runModchartUpdateOnScripts() {
public static function runModchartUpdateOnScripts(name:String) {
if (!Options.instance.modchartEnabled)
return;
for (script in scripts) {
script.runValidFunction("modchartUpdate", [FlxG.elapsed]);
script.runValidFunction(name, [FlxG.elapsed]);
}
}

Expand Down Expand Up @@ -279,6 +279,7 @@ class Scripting {
"update",
"updatePost",
"modchartUpdate",
"modchartPostUpdate",
"destroy",
"beatHit",
"stageInit",
Expand All @@ -291,6 +292,7 @@ class Scripting {
"noteMiss",
"goodNoteHit",
"charNoteHit",
"opponentNoteHit",
"preCreateMenuButtons",
"checkUnlocks",
"titleText",
Expand Down Expand Up @@ -328,9 +330,9 @@ class Scripting {
return Reflect.isFunction(interp.variables.get(funcName)) ? Reflect.callMethod(this, interp.variables.get(funcName), args) : null;
}

public inline function runModchartUpdate() {
public inline function runModchartUpdate(name:String) {
if (Options.instance.modchartEnabled)
runValidFunction("modchartUpdate", [FlxG.elapsed]);
runValidFunction(name, [FlxG.elapsed]);
}

/*public inline function runStatePostInit(arr:Array<String>) {
Expand Down

0 comments on commit ff78629

Please sign in to comment.