Skip to content

Commit

Permalink
Merge pull request #15487 from LarryFrosty/idk
Browse files Browse the repository at this point in the history
Change the type of `Function_Stop` and its variations to `String`
  • Loading branch information
ShadowMario authored Sep 15, 2024
2 parents c769a2a + 008a100 commit 7e6bd91
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
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.signature;

// 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

0 comments on commit 7e6bd91

Please sign in to comment.