diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-04-16 16:09:37 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-04-16 16:09:37 -0400 |
commit | 7aa62e5c0ac0d86e5aed2ead2a7116ea0edbffde (patch) | |
tree | 2e35e9166e01ead9e0bdddb1db9c3a18a2fa6266 /Archipelago/panel.gd | |
parent | 36eee0423e7f29e352c9c44d0ebb592007ec7436 (diff) | |
download | lingo-archipelago-7aa62e5c0ac0d86e5aed2ead2a7116ea0edbffde.tar.gz lingo-archipelago-7aa62e5c0ac0d86e5aed2ead2a7116ea0edbffde.tar.bz2 lingo-archipelago-7aa62e5c0ac0d86e5aed2ead2a7116ea0edbffde.zip |
Implemented color shuffle
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 | ) | ||