Skip to content

Commit

Permalink
make runEvent start event scripts automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeMaru committed Apr 15, 2024
1 parent 2070ffa commit d45069d
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions source/funkin/util/modding/FunkScript.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package funkin.util.modding;

import funkin.objects.NotesGroup;
import funkin.objects.NotesGroup;
import hscript.Script;
import flixel.util.FlxDestroyUtil.IFlxDestroyable;

Expand All @@ -8,7 +10,8 @@ enum abstract HscriptFunctionCallback(Int) from Int to Int {
var STOP_FUNCTION = 1;
}

class FunkScript extends hscript.Script implements IFlxDestroyable {
class FunkScript extends hscript.Script implements IFlxDestroyable
{
public static var globalVariables:Map<String, Dynamic> = [];
public var active:Bool = true;
public var scriptID:String = '';
Expand Down Expand Up @@ -321,7 +324,18 @@ class FunkScript extends hscript.Script implements IFlxDestroyable {
if (name == "runCode") // why would you-
return false;

return ModdingUtil.getCall('eventHit', [tempEvent.set(-1, name, values)]);
if (NotesGroup.instance != null)
{
var curEvents = NotesGroup.instance.songEvents;
if (!curEvents.contains(name)) {
var script = ModdingUtil.addScript(Paths.script('events/$name'));
curEvents.push(name);
}
}

tempEvent.name = name;
tempEvent.values = values ?? [];
return ModdingUtil.getCall('eventHit', [tempEvent]);
});

// Script functions
Expand Down

0 comments on commit d45069d

Please sign in to comment.