diff options
Diffstat (limited to 'Archipelago/panel.gd')
-rw-r--r-- | Archipelago/panel.gd | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Archipelago/panel.gd b/Archipelago/panel.gd new file mode 100644 index 0000000..6ec5e14 --- /dev/null +++ b/Archipelago/panel.gd | |||
@@ -0,0 +1,39 @@ | |||
1 | extends Node | ||
2 | |||
3 | var data = {} | ||
4 | var orig_text = "" | ||
5 | var orig_color = Color(0, 0, 0, 0) | ||
6 | |||
7 | |||
8 | func _ready(): | ||
9 | orig_text = self.get_parent().get_node("Viewport/GUI/Panel/Label").text | ||
10 | orig_color = self.get_parent().get_node("Quad").get_surface_material(0).albedo_color | ||
11 | |||
12 | |||
13 | func evaluate_solvability(): | ||
14 | var apclient = global.get_node("Archipelago") | ||
15 | |||
16 | var solvable = true | ||
17 | var missing = [] | ||
18 | |||
19 | if apclient._color_shuffle: | ||
20 | for color in data["color"]: | ||
21 | if not apclient._has_colors.has(color): | ||
22 | missing.append(color) | ||
23 | solvable = false | ||
24 | |||
25 | if solvable: | ||
26 | self.get_parent().get_node("Viewport/GUI/Panel/Label").text = orig_text | ||
27 | self.get_parent().get_node("Viewport/GUI/Panel/TextEdit").editable = true | ||
28 | self.get_parent().get_node("Quad").get_surface_material(0).albedo_color = orig_color | ||
29 | else: | ||
30 | var missing_text = "Missing: " | ||
31 | for thing in missing: | ||
32 | missing_text += thing + ",\n" | ||
33 | missing_text = missing_text.left(missing_text.length() - 2) | ||
34 | |||
35 | self.get_parent().get_node("Viewport/GUI/Panel/Label").text = missing_text | ||
36 | self.get_parent().get_node("Viewport/GUI/Panel/TextEdit").editable = false | ||
37 | self.get_parent().get_node("Quad").get_surface_material(0).albedo_color = Color( | ||
38 | 0.7, 0.2, 0.2 | ||
39 | ) | ||