Add support for external card packs and mods
This commit is contained in:
parent
ac9ac164f9
commit
408093a01c
4 changed files with 31 additions and 2 deletions
|
@ -32,10 +32,10 @@ onready var texture: Texture = cardImage.get_surface_material(0)
|
||||||
func set_cardid(val: String):
|
func set_cardid(val: String):
|
||||||
cardID = val
|
cardID = val
|
||||||
if ready:
|
if ready:
|
||||||
Remote.fetch(Remote.IMGURL + val + ".webp", self, "_card_fetched")
|
Resources.get_card(val, self, "_card_fetched")
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
Remote.fetch(Remote.IMGURL + cardID + ".webp", self, "_card_fetched")
|
Resources.get_card(cardID, self, "_card_fetched")
|
||||||
ready = true
|
ready = true
|
||||||
|
|
||||||
func _mouse_hover():
|
func _mouse_hover():
|
||||||
|
|
16
Scenes/Global/Mods.gd
Normal file
16
Scenes/Global/Mods.gd
Normal file
|
@ -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")
|
6
Scenes/Global/Mods.tscn
Normal file
6
Scenes/Global/Mods.tscn
Normal file
|
@ -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 )
|
|
@ -19,6 +19,11 @@ _global_script_classes=[ {
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://Scenes/Components/Card.gd"
|
"path": "res://Scenes/Components/Card.gd"
|
||||||
}, {
|
}, {
|
||||||
|
"base": "Reference",
|
||||||
|
"class": "Resources",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://Classes/Utils/Resources.gd"
|
||||||
|
}, {
|
||||||
"base": "Area",
|
"base": "Area",
|
||||||
"class": "Stack",
|
"class": "Stack",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
|
@ -27,6 +32,7 @@ _global_script_classes=[ {
|
||||||
_global_script_class_icons={
|
_global_script_class_icons={
|
||||||
"Board": "",
|
"Board": "",
|
||||||
"Card": "",
|
"Card": "",
|
||||||
|
"Resources": "",
|
||||||
"Stack": ""
|
"Stack": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +45,7 @@ config/icon="res://icon.png"
|
||||||
[autoload]
|
[autoload]
|
||||||
|
|
||||||
Remote="*res://Scenes/Global/Remote.tscn"
|
Remote="*res://Scenes/Global/Remote.tscn"
|
||||||
|
Mods="*res://Scenes/Global/Mods.tscn"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue