From f58923dd0b4c4cc6ac85de4649d29ddae5800fdd Mon Sep 17 00:00:00 2001 From: LarryFrosty <80482125+LarryFrosty@users.noreply.github.com> Date: Sat, 7 Sep 2024 15:43:30 +0800 Subject: [PATCH 1/2] change type of Function_Stop and variations to String --- source/psychlua/LuaUtils.hx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/psychlua/LuaUtils.hx b/source/psychlua/LuaUtils.hx index e17c5e09c20..97090878812 100644 --- a/source/psychlua/LuaUtils.hx +++ b/source/psychlua/LuaUtils.hx @@ -20,11 +20,11 @@ typedef LuaTweenOptions = { class LuaUtils { - public static final Function_Stop:Dynamic = "##PSYCHLUA_FUNCTIONSTOP"; - public static final Function_Continue:Dynamic = "##PSYCHLUA_FUNCTIONCONTINUE"; - public static final Function_StopLua:Dynamic = "##PSYCHLUA_FUNCTIONSTOPLUA"; - public static final Function_StopHScript:Dynamic = "##PSYCHLUA_FUNCTIONSTOPHSCRIPT"; - public static final Function_StopAll:Dynamic = "##PSYCHLUA_FUNCTIONSTOPALL"; + public static final Function_Stop:String = "##PSYCHLUA_FUNCTIONSTOP"; + public static final Function_Continue:String = "##PSYCHLUA_FUNCTIONCONTINUE"; + public static final Function_StopLua:String = "##PSYCHLUA_FUNCTIONSTOPLUA"; + public static final Function_StopHScript:String = "##PSYCHLUA_FUNCTIONSTOPHSCRIPT"; + public static final Function_StopAll:String = "##PSYCHLUA_FUNCTIONSTOPALL"; public static function getLuaTween(options:Dynamic) { From 008a10094a5bc9d2bfa646419ee57c18a809ace8 Mon Sep 17 00:00:00 2001 From: LarryFrosty <80482125+LarryFrosty@users.noreply.github.com> Date: Sat, 7 Sep 2024 15:45:22 +0800 Subject: [PATCH 2/2] part 2 --- source/states/PlayState.hx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/source/states/PlayState.hx b/source/states/PlayState.hx index 4330f43ba09..dbcef8870e3 100644 --- a/source/states/PlayState.hx +++ b/source/states/PlayState.hx @@ -1449,8 +1449,9 @@ class PlayState extends MusicBeatState } function eventEarlyTrigger(event:EventNote):Float { - var returnedValue:Null = callOnScripts('eventEarlyTrigger', [event.event, event.value1, event.value2, event.strumTime], true, [], [0]); - if(returnedValue != null && returnedValue != 0 && returnedValue != LuaUtils.Function_Continue) { + 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) { return returnedValue; } @@ -3275,7 +3276,7 @@ class PlayState extends MusicBeatState #end public function callOnScripts(funcToCall:String, args:Array = null, ignoreStops = false, exclusions:Array = null, excludeValues:Array = null):Dynamic { - var returnVal:Dynamic = LuaUtils.Function_Continue; + var returnVal:String = LuaUtils.Function_Continue; if(args == null) args = []; if(exclusions == null) exclusions = []; if(excludeValues == null) excludeValues = [LuaUtils.Function_Continue]; @@ -3286,7 +3287,7 @@ class PlayState extends MusicBeatState } public function callOnLuas(funcToCall:String, args:Array = null, ignoreStops = false, exclusions:Array = null, excludeValues:Array = null):Dynamic { - var returnVal:Dynamic = LuaUtils.Function_Continue; + var returnVal:String = LuaUtils.Function_Continue; #if LUA_ALLOWED if(args == null) args = []; if(exclusions == null) exclusions = []; @@ -3325,7 +3326,7 @@ class PlayState extends MusicBeatState } public function callOnHScript(funcToCall:String, args:Array = null, ?ignoreStops:Bool = false, exclusions:Array = null, excludeValues:Array = null):Dynamic { - var returnVal:Dynamic = LuaUtils.Function_Continue; + var returnVal:String = LuaUtils.Function_Continue; #if HSCRIPT_ALLOWED if(exclusions == null) exclusions = new Array(); @@ -3347,10 +3348,7 @@ class PlayState extends MusicBeatState var callValue = script.call(funcToCall, args); var myValue:Dynamic = callValue.methodVal; - // compiler fuckup fix - final stopHscript = myValue == LuaUtils.Function_StopHScript; - final stopAll = myValue == LuaUtils.Function_StopAll; - if((stopHscript || stopAll) && !excludeValues.contains(myValue) && !ignoreStops) + if((myValue == LuaUtils.Function_StopHScript || myValue == LuaUtils.Function_StopAll) && !excludeValues.contains(myValue) && !ignoreStops) { returnVal = myValue; break;