@@ -106,20 +106,8 @@ class GlobalScript {
106106 });
107107 }
108108
109- public static function event <T : CancellableEvent >(name : String , event : T ): T {
110- if (scripts != null )
111- scripts .event (name , event );
112- return event ;
113- }
114-
115- public static function call (name : String , ? args : Array <Dynamic >) {
116- if (scripts != null )
117- scripts .call (name , args );
118- }
119-
120109 public static function onModSwitch (newMod : String ) {
121- call (" destroy" );
122- scripts = FlxDestroyUtil .destroy (scripts );
110+ destroy ();
123111 scripts = new ScriptPack (" GlobalScript" );
124112 for (i in funkin.backend.assets. ModsFolder .getLoadedMods ()) {
125113 var path = Paths .script (' data/global/LIB_ $i ' );
@@ -132,12 +120,24 @@ class GlobalScript {
132120 }
133121 }
134122
135- public static function beatHit (curBeat : Int ) {
136- call (" beatHit" , [curBeat ]);
123+ public static inline function event <T : CancellableEvent >(name : String , event : T ): T {
124+ if (scripts != null )
125+ scripts .event (name , event );
126+ return event ;
137127 }
138128
139- public static function stepHit (curStep : Int ) {
129+ public static inline function call (name : String , ? args : Array <Dynamic >)
130+ if (scripts != null ) scripts .call (name , args );
131+
132+ public static inline function beatHit (curBeat : Int )
133+ call (" beatHit" , [curBeat ]);
134+
135+ public static inline function stepHit (curStep : Int )
140136 call (" stepHit" , [curStep ]);
137+
138+ public static inline function destroy () if (scripts != null ) {
139+ call (" destroy" );
140+ scripts = FlxDestroyUtil .destroy (scripts );
141141 }
142142}
143143#end
0 commit comments