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

Implement hscript-improved #13304

Closed
2 changes: 1 addition & 1 deletion Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@

<!--Psych stuff needed-->
<haxelib name="linc_luajit" if="LUA_ALLOWED"/>
<haxelib name="SScript" if="HSCRIPT_ALLOWED"/>
<haxelib name="hscript" if="HSCRIPT_ALLOWED"/>
<haxelib name="hxCodec" if="VIDEOS_ALLOWED"/>
<haxelib name="discord_rpc" if="desktop"/>
<haxelib name="tjson" />
Expand Down
12 changes: 7 additions & 5 deletions hmm.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@
"type": "haxelib",
"version": null
},
{
"name": "SScript",
"type": "haxelib",
"version": null
},
{
"name": "hxcpp-debug-server",
"type": "haxelib",
Expand All @@ -67,6 +62,13 @@
"ref": "master",
"url": "https://github.com/Aidan63/linc_discord-rpc"
},
{
"name": "hscript",
"type": "git",
"dir": null,
"ref": "master",
"url": "https://github.com/TheLeerName/hscript-improved"
},
{
"name": "linc_luajit",
"type": "git",
Expand Down
12 changes: 11 additions & 1 deletion source/backend/Paths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,18 @@ class Paths
return null;
}

static public function getTextFromFile(key:String, ?ignoreMods:Bool = false):String
static public function getTextFromFile(key:String, ?ignoreMods:Bool = false, ?absolute:Bool = false):String
{
if (absolute) {
#if sys
if (FileSystem.exists(key))
return File.getContent(key);
#end
if(OpenFlAssets.exists(key, TEXT))
return Assets.getText(key);

return null;
}
#if sys
#if MODS_ALLOWED
if (!ignoreMods && FileSystem.exists(modFolders(key)))
Expand Down
4 changes: 2 additions & 2 deletions source/psychlua/ExtraFunctions.hx
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ class ExtraFunctions
}
return false;
});
Lua_helper.add_callback(lua, "getTextFromFile", function(path:String, ?ignoreModFolders:Bool = false) {
return Paths.getTextFromFile(path, ignoreModFolders);
Lua_helper.add_callback(lua, "getTextFromFile", function(path:String, ?ignoreModFolders:Bool = false, ?absolute:Bool = false) {
return Paths.getTextFromFile(path, ignoreModFolders, absolute);
});
Lua_helper.add_callback(lua, "directoryFileList", function(folder:String) {
var list:Array<String> = [];
Expand Down
10 changes: 1 addition & 9 deletions source/psychlua/FunkinLua.hx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ import substates.GameOverSubstate;

import psychlua.LuaUtils;
import psychlua.LuaUtils.LuaTweenOptions;
#if (SScript >= "3.0.0")
import psychlua.HScript;
#end
import psychlua.DebugLuaText;
import psychlua.ModchartSprite;

Expand All @@ -56,9 +54,7 @@ class FunkinLua {
public var scriptName:String = '';
public var closed:Bool = false;

#if (SScript >= "3.0.0")
public var hscript:HScript = null;
#end

public var callbacks:Map<String, Dynamic> = new Map<String, Dynamic>();
public static var customFunctions:Map<String, Dynamic> = new Map<String, Dynamic>();
Expand Down Expand Up @@ -1442,7 +1438,7 @@ class FunkinLua {
});

#if desktop DiscordClient.addLuaCallbacks(lua); #end
#if (SScript >= "3.0.0") HScript.implement(this); #end
HScript.implement(this);
ReflectionFunctions.implement(this);
TextFunctions.implement(this);
ExtraFunctions.implement(this);
Expand Down Expand Up @@ -1542,17 +1538,13 @@ class FunkinLua {
}
Lua.close(lua);
lua = null;
#if (SScript >= "3.0.0")
if(hscript != null)
{
hscript.active = false;
#if (SScript >= "3.0.3")
hscript.destroy();
#end
hscript = null;
}
#end
#end
}

//clone functions
Expand Down
Loading
Loading