feat: Scoped Modules
This commit is contained in:
@@ -6,6 +6,7 @@ import funkin.modding.events.ScriptEvent;
|
||||
import funkin.modding.events.ScriptEventDispatcher;
|
||||
import funkin.modding.module.Module;
|
||||
import funkin.modding.module.ScriptedModule;
|
||||
import flixel.FlxG;
|
||||
|
||||
/**
|
||||
* Utility functions for loading and manipulating active modules.
|
||||
@@ -145,6 +146,14 @@ class ModuleHandler
|
||||
// The module needs to be active to receive events.
|
||||
if (module != null && module.active)
|
||||
{
|
||||
if (module.state != null)
|
||||
{
|
||||
// Only call the event if the current state is what the module's state is.
|
||||
if (!(Type.getClass(FlxG.state) == module.state) && !(Type.getClass(FlxG.state?.subState) == module.state))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ScriptEventDispatcher.callEvent(module, event);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user