diff --git a/Scenes/Components/Card.gd b/Scenes/Components/Card.gd index e515956..d9653e0 100644 --- a/Scenes/Components/Card.gd +++ b/Scenes/Components/Card.gd @@ -32,10 +32,10 @@ onready var texture: Texture = cardImage.get_surface_material(0) func set_cardid(val: String): cardID = val if ready: - Remote.fetch(Remote.IMGURL + val + ".webp", self, "_card_fetched") + Resources.get_card(val, self, "_card_fetched") func _ready(): - Remote.fetch(Remote.IMGURL + cardID + ".webp", self, "_card_fetched") + Resources.get_card(cardID, self, "_card_fetched") ready = true func _mouse_hover(): diff --git a/Scenes/Global/Mods.gd b/Scenes/Global/Mods.gd new file mode 100644 index 0000000..f032757 --- /dev/null +++ b/Scenes/Global/Mods.gd @@ -0,0 +1,16 @@ +extends Node + +func _ready(): + # Search for all available packs in the same folder and load them all! + var dir := Directory.new() + dir.list_dir_begin(true, true) + while true: + var next := dir.get_next() + if next == "": + break + if next.ends_with(".pck") or next.ends_with(".zip"): + # Found pck, load it! + print("Found pck/zip: ", next, "") + var success := ProjectSettings.load_resource_pack("res://" + next) + if not success: + print("[ERR] Could not load ", next, ", ignoring it") \ No newline at end of file diff --git a/Scenes/Global/Mods.tscn b/Scenes/Global/Mods.tscn new file mode 100644 index 0000000..f39245d --- /dev/null +++ b/Scenes/Global/Mods.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Scenes/Global/Mods.gd" type="Script" id=1] + +[node name="Node" type="Node"] +script = ExtResource( 1 ) diff --git a/project.godot b/project.godot index f9b196d..513c006 100644 --- a/project.godot +++ b/project.godot @@ -19,6 +19,11 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://Scenes/Components/Card.gd" }, { +"base": "Reference", +"class": "Resources", +"language": "GDScript", +"path": "res://Classes/Utils/Resources.gd" +}, { "base": "Area", "class": "Stack", "language": "GDScript", @@ -27,6 +32,7 @@ _global_script_classes=[ { _global_script_class_icons={ "Board": "", "Card": "", +"Resources": "", "Stack": "" } @@ -39,6 +45,7 @@ config/icon="res://icon.png" [autoload] Remote="*res://Scenes/Global/Remote.tscn" +Mods="*res://Scenes/Global/Mods.tscn" [display]