Skip to content

Commit

Permalink
fix: move puzzleTheme data to a resource
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
russmatney committed Dec 2, 2024
1 parent 79e125c commit 76f450c
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 279 deletions.
298 changes: 36 additions & 262 deletions data.pandora

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/themes/DebugThemeData.tres
Original file line number Diff line number Diff line change
@@ -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]([])
24 changes: 7 additions & 17 deletions src/themes/PuzzleTheme.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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"):
Expand All @@ -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():
Expand Down
9 changes: 9 additions & 0 deletions src/themes/PuzzleThemeData.gd
Original file line number Diff line number Diff line change
@@ -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]
11 changes: 11 additions & 0 deletions src/themes/dots/DotsThemeData.tres
Original file line number Diff line number Diff line change
@@ -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")])
12 changes: 12 additions & 0 deletions src/themes/fall/FallThemeData.tres
Original file line number Diff line number Diff line change
@@ -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"])
12 changes: 12 additions & 0 deletions src/themes/pumpkins/PumpkinsThemeData.tres
Original file line number Diff line number Diff line change
@@ -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")])
12 changes: 12 additions & 0 deletions src/themes/space/SpaceThemeData.tres
Original file line number Diff line number Diff line change
@@ -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"])
13 changes: 13 additions & 0 deletions src/themes/spring/SpringThemeData.tres
Original file line number Diff line number Diff line change
@@ -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"])
12 changes: 12 additions & 0 deletions src/themes/summer/SummerThemeData.tres
Original file line number Diff line number Diff line change
@@ -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")])
13 changes: 13 additions & 0 deletions src/themes/winter/WinterThemeData.tres
Original file line number Diff line number Diff line change
@@ -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"])

0 comments on commit 76f450c

Please sign in to comment.