From 76f450cd2d1a117d41b3b2b2956e8f589eb684a4 Mon Sep 17 00:00:00 2001 From: Russell Matney Date: Mon, 2 Dec 2024 14:12:48 -0500 Subject: [PATCH] fix: move puzzleTheme data to a resource Pandora kept converting these arrays to type 'color'.... I should notify about a bug, but i also shouldn't be using pandora for this anyway. This starts to move off of pandora for themes by moving some of the data to proper godot resources. --- data.pandora | 298 +++------------------ src/themes/DebugThemeData.tres | 9 + src/themes/PuzzleTheme.gd | 24 +- src/themes/PuzzleThemeData.gd | 9 + src/themes/dots/DotsThemeData.tres | 11 + src/themes/fall/FallThemeData.tres | 12 + src/themes/pumpkins/PumpkinsThemeData.tres | 12 + src/themes/space/SpaceThemeData.tres | 12 + src/themes/spring/SpringThemeData.tres | 13 + src/themes/summer/SummerThemeData.tres | 12 + src/themes/winter/WinterThemeData.tres | 13 + 11 files changed, 146 insertions(+), 279 deletions(-) create mode 100644 src/themes/DebugThemeData.tres create mode 100644 src/themes/PuzzleThemeData.gd create mode 100644 src/themes/dots/DotsThemeData.tres create mode 100644 src/themes/fall/FallThemeData.tres create mode 100644 src/themes/pumpkins/PumpkinsThemeData.tres create mode 100644 src/themes/space/SpaceThemeData.tres create mode 100644 src/themes/spring/SpringThemeData.tres create mode 100644 src/themes/summer/SummerThemeData.tres create mode 100644 src/themes/winter/WinterThemeData.tres diff --git a/data.pandora b/data.pandora index 94e2445c..be0661ce 100644 --- a/data.pandora +++ b/data.pandora @@ -109,6 +109,10 @@ "is_unlocked": { "type": "bool", "value": true + }, + "puzzle_theme_data": { + "type": "resource", + "value": "res://src/themes/DebugThemeData.tres" } } }, @@ -131,15 +135,6 @@ "type": "resource", "value": "res://src/themes/dots/assets/blue_ring3.png" }, - "dot_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/dots/Dot.tscn" - } - } - }, "dotted_icon_texture": { "type": "resource", "value": "res://src/themes/dots/assets/blue_ring2.png" @@ -148,15 +143,6 @@ "type": "resource", "value": "res://src/themes/dots/assets/blue_ring1.png" }, - "goal_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/dots/Dot.tscn" - } - } - }, "is_unlocked": { "type": "bool", "value": true @@ -165,18 +151,13 @@ "type": "resource", "value": "res://src/themes/dots/dots_player.png" }, - "player_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/dots/Player.tscn" - } - } - }, "puzzle_scene": { "type": "resource", "value": "res://src/themes/dots/DotsPuzzle.tscn" + }, + "puzzle_theme_data": { + "type": "resource", + "value": "res://src/themes/dots/DotsThemeData.tres" } } }, @@ -195,15 +176,6 @@ "type": "resource", "value": "res://src/themes/space/assets/asteroid_2.png" }, - "dot_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/space/Dot.tscn" - } - } - }, "dotted_icon_texture": { "type": "resource", "value": "res://src/themes/space/assets/asteroid_2-dotted.png" @@ -212,44 +184,21 @@ "type": "resource", "value": "res://src/themes/space/assets/goal.png" }, - "goal_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/space/Dot.tscn" - } - } - }, "is_unlocked": { "type": "bool", "value": true }, - "music_tracks": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://assets/songs/benburnes/Abstraction - Giving Up LOOP.ogg" - } - } - }, "player_icon_texture": { "type": "resource", "value": "res://src/themes/space/assets/ufo.png" }, - "player_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/space/Player.tscn" - } - } - }, "puzzle_scene": { "type": "resource", "value": "res://src/themes/space/SpacePuzzle.tscn" + }, + "puzzle_theme_data": { + "type": "resource", + "value": "res://src/themes/space/SpaceThemeData.tres" } } }, @@ -268,15 +217,6 @@ "type": "resource", "value": "res://src/themes/fall/assets/leaf_greenred.png" }, - "dot_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/fall/Leaf.tscn" - } - } - }, "dotted_icon_texture": { "type": "resource", "value": "res://src/themes/fall/assets/leaf_greenred_dotted.png" @@ -285,44 +225,21 @@ "type": "resource", "value": "res://src/themes/fall/assets/leaf_goal.png" }, - "goal_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/fall/Leaf.tscn" - } - } - }, "is_unlocked": { "type": "bool", "value": true }, - "music_tracks": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://assets/songs/benburnes/Abstraction - Is this Mood LOOP.ogg" - } - } - }, "player_icon_texture": { "type": "resource", "value": "res://src/themes/fall/assets/player.png" }, - "player_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/fall/Player.tscn" - } - } - }, "puzzle_scene": { "type": "resource", "value": "res://src/themes/fall/FallPuzzle.tscn" + }, + "puzzle_theme_data": { + "type": "resource", + "value": "res://src/themes/fall/FallThemeData.tres" } } }, @@ -487,15 +404,6 @@ "type": "resource", "value": "res://src/themes/winter/assets/dot.png" }, - "dot_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/winter/Dot.tscn" - } - } - }, "dotted_icon_texture": { "type": "resource", "value": "res://src/themes/winter/assets/dot-dotted.png" @@ -504,41 +412,14 @@ "type": "resource", "value": "res://src/themes/winter/goal.png" }, - "goal_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/winter/Goal.tscn" - } - } - }, "is_unlocked": { "type": "bool", "value": true }, - "music_tracks": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://assets/songs/benburnes/Abstraction - Lounge Groove LOOP.ogg" - } - } - }, "player_icon_texture": { "type": "resource", "value": "res://src/themes/winter/assets/player.png" }, - "player_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/winter/Player.tscn" - } - } - }, "puzzle_scene": { "type": "resource", "value": "res://src/themes/winter/WinterPuzzle.tscn" @@ -564,15 +445,6 @@ "type": "resource", "value": "res://src/themes/spring/assets/dot.png" }, - "dot_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/spring/Dot.tscn" - } - } - }, "dotted_icon_texture": { "type": "resource", "value": "res://src/themes/spring/assets/goal.png" @@ -581,44 +453,21 @@ "type": "resource", "value": "res://src/themes/spring/goal.png" }, - "goal_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/spring/Goal.tscn" - } - } - }, "is_unlocked": { "type": "bool", "value": true }, - "music_tracks": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://assets/songs/benburnes/The Verdant Grove LOOP.wav" - } - } - }, "player_icon_texture": { "type": "resource", "value": "res://src/themes/spring/assets/player.png" }, - "player_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/spring/Player.tscn" - } - } - }, "puzzle_scene": { "type": "resource", "value": "res://src/themes/spring/SpringPuzzle.tscn" + }, + "puzzle_theme_data": { + "type": "resource", + "value": "res://src/themes/spring/SpringThemeData.tres" } } }, @@ -641,15 +490,6 @@ "type": "resource", "value": "res://src/themes/summer/assets/dot.png" }, - "dot_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/summer/Dot.tscn" - } - } - }, "dotted_icon_texture": { "type": "resource", "value": "res://src/themes/summer/assets/dot-dotted.png" @@ -658,15 +498,6 @@ "type": "resource", "value": "res://src/themes/summer/goal.png" }, - "goal_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/summer/Goal.tscn" - } - } - }, "is_unlocked": { "type": "bool", "value": true @@ -675,18 +506,13 @@ "type": "resource", "value": "res://src/themes/summer/assets/player.png" }, - "player_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/summer/Player.tscn" - } - } - }, "puzzle_scene": { "type": "resource", "value": "res://src/themes/summer/SummerPuzzle.tscn" + }, + "puzzle_theme_data": { + "type": "resource", + "value": "res://src/themes/summer/SummerThemeData.tres" } } }, @@ -909,36 +735,13 @@ "type": "resource", "value": "res://src/themes/pumpkins/pumpkin.png" }, - "dot_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/pumpkins/PumpkinDot.tscn" - } - } - }, - "goal_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/fall/Leaf.tscn" - } - } - }, - "player_scenes": { - "type": "array", - "value": { - "0": { - "type": "string", - "value": "res://src/themes/fall/Player.tscn" - } - } - }, "puzzle_scene": { "type": "resource", "value": "res://src/themes/pumpkins/PumpkinsPuzzle.tscn" + }, + "puzzle_theme_data": { + "type": "resource", + "value": "res://src/themes/pumpkins/PumpkinsThemeData.tres" } } } @@ -1063,33 +866,6 @@ "_name": "worldmap_island_texture", "_type": "resource" }, - { - "_category_id": "3", - "_default_value": { - - }, - "_id": "47", - "_name": "player_scenes", - "_type": "array" - }, - { - "_category_id": "3", - "_default_value": { - - }, - "_id": "48", - "_name": "dot_scenes", - "_type": "array" - }, - { - "_category_id": "3", - "_default_value": { - - }, - "_id": "49", - "_name": "goal_scenes", - "_type": "array" - }, { "_category_id": "3", "_default_value": "res://assets/songs/sulosounds/chill-electric-background.wav", @@ -1163,15 +939,6 @@ "_name": "goal_icon_texture", "_type": "resource" }, - { - "_category_id": "3", - "_default_value": { - - }, - "_id": "62", - "_name": "music_tracks", - "_type": "array" - }, { "_category_id": "1", "_default_value": false, @@ -1209,12 +976,19 @@ "Min Value": 0 }, "_type": "int" + }, + { + "_category_id": "3", + "_default_value": null, + "_id": "71", + "_name": "puzzle_theme_data", + "_type": "resource" } ] }, "_id_generator": { "_ids_by_context": { - "default": 70 + "default": 71 } } } \ No newline at end of file diff --git a/src/themes/DebugThemeData.tres b/src/themes/DebugThemeData.tres new file mode 100644 index 00000000..842167ea --- /dev/null +++ b/src/themes/DebugThemeData.tres @@ -0,0 +1,9 @@ +[gd_resource type="Resource" script_class="PuzzleThemeData" load_steps=2 format=3 uid="uid://vc64ajdhnluf"] + +[ext_resource type="Script" path="res://src/themes/PuzzleThemeData.gd" id="1_567u7"] + +[resource] +script = ExtResource("1_567u7") +player_scenes = Array[PackedScene]([]) +dot_scenes = Array[PackedScene]([]) +goal_scenes = Array[PackedScene]([]) diff --git a/src/themes/PuzzleTheme.gd b/src/themes/PuzzleTheme.gd index 9e15f512..59a7dbfa 100644 --- a/src/themes/PuzzleTheme.gd +++ b/src/themes/PuzzleTheme.gd @@ -14,26 +14,13 @@ func is_unlocked() -> bool: return get_bool("is_unlocked") func get_player_scenes() -> Array[PackedScene]: - var arr = get_array("player_scenes") - var ar: Array[PackedScene] = [] - for a in arr: - var sc = load(a) - ar.append(sc) - return ar + return get_theme_data().player_scenes func get_dot_scenes() -> Array[PackedScene]: - var arr = get_array("dot_scenes") - var ar: Array[PackedScene] = [] - for a in arr: - ar.append(load(a)) - return ar + return get_theme_data().dot_scenes func get_goal_scenes() -> Array[PackedScene]: - var arr = get_array("goal_scenes") - var ar: Array[PackedScene] = [] - for a in arr: - ar.append(load(a)) - return ar + return get_theme_data().goal_scenes func get_background_music() -> AudioStream: return get_resource("background_music") @@ -51,7 +38,7 @@ func get_goal_icon() -> Texture: return get_resource("goal_icon_texture") func get_music_tracks() -> Array[AudioStream]: - var track_strs = get_array("music_tracks") + var track_strs = get_theme_data().music_tracks var tracks: Array[AudioStream] = [] for t in track_strs: if ResourceLoader.exists(t, "AudioStream"): @@ -65,6 +52,9 @@ func get_music_tracks() -> Array[AudioStream]: tracks.append(bg) return tracks +func get_theme_data() -> PuzzleThemeData: + return get_resource("puzzle_theme_data") + ## all properties (consumed by Log.gd) ################# func data(): diff --git a/src/themes/PuzzleThemeData.gd b/src/themes/PuzzleThemeData.gd new file mode 100644 index 00000000..6be8247a --- /dev/null +++ b/src/themes/PuzzleThemeData.gd @@ -0,0 +1,9 @@ +@tool +extends Resource +class_name PuzzleThemeData + +@export var player_scenes: Array[PackedScene] +@export var dot_scenes: Array[PackedScene] +@export var goal_scenes: Array[PackedScene] + +@export var music_tracks: Array[String] diff --git a/src/themes/dots/DotsThemeData.tres b/src/themes/dots/DotsThemeData.tres new file mode 100644 index 00000000..cab818a1 --- /dev/null +++ b/src/themes/dots/DotsThemeData.tres @@ -0,0 +1,11 @@ +[gd_resource type="Resource" script_class="PuzzleThemeData" load_steps=4 format=3 uid="uid://dttbuv6lqqjdq"] + +[ext_resource type="Script" path="res://src/themes/PuzzleThemeData.gd" id="1_d2pp1"] +[ext_resource type="PackedScene" uid="uid://cl82y6gylisqo" path="res://src/themes/dots/Dot.tscn" id="1_ouvcn"] +[ext_resource type="PackedScene" uid="uid://cifvwoalwila" path="res://src/themes/dots/Player.tscn" id="2_8kh3e"] + +[resource] +script = ExtResource("1_d2pp1") +player_scenes = Array[PackedScene]([ExtResource("2_8kh3e")]) +dot_scenes = Array[PackedScene]([ExtResource("1_ouvcn")]) +goal_scenes = Array[PackedScene]([ExtResource("1_ouvcn")]) diff --git a/src/themes/fall/FallThemeData.tres b/src/themes/fall/FallThemeData.tres new file mode 100644 index 00000000..99d60c21 --- /dev/null +++ b/src/themes/fall/FallThemeData.tres @@ -0,0 +1,12 @@ +[gd_resource type="Resource" script_class="PuzzleThemeData" load_steps=4 format=3 uid="uid://x85lhb72ywee"] + +[ext_resource type="Script" path="res://src/themes/PuzzleThemeData.gd" id="1_84qne"] +[ext_resource type="PackedScene" uid="uid://dpn7mqij5du3n" path="res://src/themes/fall/Player.tscn" id="1_mi5di"] +[ext_resource type="PackedScene" uid="uid://di85piestdv0m" path="res://src/themes/fall/Leaf.tscn" id="1_tiex6"] + +[resource] +script = ExtResource("1_84qne") +player_scenes = Array[PackedScene]([ExtResource("1_mi5di")]) +dot_scenes = Array[PackedScene]([ExtResource("1_tiex6")]) +goal_scenes = Array[PackedScene]([ExtResource("1_tiex6")]) +music_tracks = Array[String](["res://assets/songs/benburnes/Abstraction - Is this Mood LOOP.ogg"]) diff --git a/src/themes/pumpkins/PumpkinsThemeData.tres b/src/themes/pumpkins/PumpkinsThemeData.tres new file mode 100644 index 00000000..695feb0f --- /dev/null +++ b/src/themes/pumpkins/PumpkinsThemeData.tres @@ -0,0 +1,12 @@ +[gd_resource type="Resource" script_class="PuzzleThemeData" load_steps=5 format=3 uid="uid://b25h3h6ofryxi"] + +[ext_resource type="PackedScene" uid="uid://tr7u31n263mg" path="res://src/themes/pumpkins/PumpkinDot.tscn" id="1_t6r88"] +[ext_resource type="Script" path="res://src/themes/PuzzleThemeData.gd" id="1_tyb8m"] +[ext_resource type="PackedScene" uid="uid://di85piestdv0m" path="res://src/themes/fall/Leaf.tscn" id="2_d3b15"] +[ext_resource type="PackedScene" uid="uid://dpn7mqij5du3n" path="res://src/themes/fall/Player.tscn" id="3_1y6j3"] + +[resource] +script = ExtResource("1_tyb8m") +player_scenes = Array[PackedScene]([ExtResource("3_1y6j3")]) +dot_scenes = Array[PackedScene]([ExtResource("1_t6r88")]) +goal_scenes = Array[PackedScene]([ExtResource("2_d3b15")]) diff --git a/src/themes/space/SpaceThemeData.tres b/src/themes/space/SpaceThemeData.tres new file mode 100644 index 00000000..621c1d77 --- /dev/null +++ b/src/themes/space/SpaceThemeData.tres @@ -0,0 +1,12 @@ +[gd_resource type="Resource" script_class="PuzzleThemeData" load_steps=4 format=3 uid="uid://cjl7cgvtofdcc"] + +[ext_resource type="Script" path="res://src/themes/PuzzleThemeData.gd" id="1_ughi5"] +[ext_resource type="PackedScene" uid="uid://bmm1270drou5v" path="res://src/themes/space/Dot.tscn" id="1_uy3vh"] +[ext_resource type="PackedScene" uid="uid://csgpsdj4n3rfj" path="res://src/themes/space/Player.tscn" id="2_onk3e"] + +[resource] +script = ExtResource("1_ughi5") +player_scenes = Array[PackedScene]([ExtResource("2_onk3e")]) +dot_scenes = Array[PackedScene]([ExtResource("1_uy3vh")]) +goal_scenes = Array[PackedScene]([ExtResource("1_uy3vh")]) +music_tracks = Array[String](["res://assets/songs/benburnes/Abstraction - Giving Up LOOP.ogg"]) diff --git a/src/themes/spring/SpringThemeData.tres b/src/themes/spring/SpringThemeData.tres new file mode 100644 index 00000000..e12eaf6d --- /dev/null +++ b/src/themes/spring/SpringThemeData.tres @@ -0,0 +1,13 @@ +[gd_resource type="Resource" script_class="PuzzleThemeData" load_steps=5 format=3 uid="uid://cl2l1ysdmee75"] + +[ext_resource type="Script" path="res://src/themes/PuzzleThemeData.gd" id="1_byehf"] +[ext_resource type="PackedScene" uid="uid://coyuchcg4n431" path="res://src/themes/spring/Dot.tscn" id="1_tg3rl"] +[ext_resource type="PackedScene" uid="uid://m8pypw3n8v1d" path="res://src/themes/spring/Goal.tscn" id="2_axqgo"] +[ext_resource type="PackedScene" uid="uid://caphciwfwdctj" path="res://src/themes/spring/Player.tscn" id="3_vuc8k"] + +[resource] +script = ExtResource("1_byehf") +player_scenes = Array[PackedScene]([ExtResource("3_vuc8k")]) +dot_scenes = Array[PackedScene]([ExtResource("1_tg3rl")]) +goal_scenes = Array[PackedScene]([ExtResource("2_axqgo")]) +music_tracks = Array[String](["res://assets/songs/benburnes/The Verdant Grove LOOP.wav"]) diff --git a/src/themes/summer/SummerThemeData.tres b/src/themes/summer/SummerThemeData.tres new file mode 100644 index 00000000..03cc24e5 --- /dev/null +++ b/src/themes/summer/SummerThemeData.tres @@ -0,0 +1,12 @@ +[gd_resource type="Resource" script_class="PuzzleThemeData" load_steps=5 format=3 uid="uid://3ojwqfn7ar0v"] + +[ext_resource type="PackedScene" uid="uid://coyuchcg4n431" path="res://src/themes/summer/Dot.tscn" id="1_2wvlr"] +[ext_resource type="Script" path="res://src/themes/PuzzleThemeData.gd" id="1_ut62m"] +[ext_resource type="PackedScene" uid="uid://m8pypw3n8v1d" path="res://src/themes/summer/Goal.tscn" id="2_8gohi"] +[ext_resource type="PackedScene" uid="uid://caphciwfwdctj" path="res://src/themes/summer/Player.tscn" id="3_dw813"] + +[resource] +script = ExtResource("1_ut62m") +player_scenes = Array[PackedScene]([ExtResource("3_dw813")]) +dot_scenes = Array[PackedScene]([ExtResource("1_2wvlr")]) +goal_scenes = Array[PackedScene]([ExtResource("2_8gohi")]) diff --git a/src/themes/winter/WinterThemeData.tres b/src/themes/winter/WinterThemeData.tres new file mode 100644 index 00000000..c085a671 --- /dev/null +++ b/src/themes/winter/WinterThemeData.tres @@ -0,0 +1,13 @@ +[gd_resource type="Resource" script_class="PuzzleThemeData" load_steps=5 format=3 uid="uid://cghw22rd7rqis"] + +[ext_resource type="PackedScene" uid="uid://coyuchcg4n431" path="res://src/themes/winter/Dot.tscn" id="1_jgtjk"] +[ext_resource type="Script" path="res://src/themes/PuzzleThemeData.gd" id="1_yh0hb"] +[ext_resource type="PackedScene" uid="uid://m8pypw3n8v1d" path="res://src/themes/winter/Goal.tscn" id="2_t5rqh"] +[ext_resource type="PackedScene" uid="uid://caphciwfwdctj" path="res://src/themes/winter/Player.tscn" id="3_baasb"] + +[resource] +script = ExtResource("1_yh0hb") +player_scenes = Array[PackedScene]([ExtResource("3_baasb")]) +dot_scenes = Array[PackedScene]([ExtResource("1_jgtjk")]) +goal_scenes = Array[PackedScene]([ExtResource("2_t5rqh")]) +music_tracks = Array[String](["res://assets/songs/benburnes/Abstraction - Lounge Groove LOOP.ogg"])