Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the type of Function_Stop and its variations to String #15487

Merged
merged 2 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions source/psychlua/LuaUtils.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
16 changes: 7 additions & 9 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1449,8 +1449,9 @@ class PlayState extends MusicBeatState
}

function eventEarlyTrigger(event:EventNote):Float {
var returnedValue:Null<Float> = 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;
}

Expand Down Expand Up @@ -3275,7 +3276,7 @@ class PlayState extends MusicBeatState
#end

public function callOnScripts(funcToCall:String, args:Array<Dynamic> = null, ignoreStops = false, exclusions:Array<String> = null, excludeValues:Array<Dynamic> = 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];
Expand All @@ -3286,7 +3287,7 @@ class PlayState extends MusicBeatState
}

public function callOnLuas(funcToCall:String, args:Array<Dynamic> = null, ignoreStops = false, exclusions:Array<String> = null, excludeValues:Array<Dynamic> = 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 = [];
Expand Down Expand Up @@ -3325,7 +3326,7 @@ class PlayState extends MusicBeatState
}

public function callOnHScript(funcToCall:String, args:Array<Dynamic> = null, ?ignoreStops:Bool = false, exclusions:Array<String> = null, excludeValues:Array<Dynamic> = null):Dynamic {
var returnVal:Dynamic = LuaUtils.Function_Continue;
var returnVal:String = LuaUtils.Function_Continue;

#if HSCRIPT_ALLOWED
if(exclusions == null) exclusions = new Array();
Expand All @@ -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;
Expand Down
Loading