about summary refs log tree commit diff stats
path: root/Archipelago/panel.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Archipelago/panel.gd')
-rw-r--r--Archipelago/panel.gd20
1 files changed, 19 insertions, 1 deletions
diff --git a/Archipelago/panel.gd b/Archipelago/panel.gd index 6ec5e14..bf43653 100644 --- a/Archipelago/panel.gd +++ b/Archipelago/panel.gd
@@ -2,16 +2,29 @@ extends Node
2 2
3var data = {} 3var data = {}
4var orig_text = "" 4var orig_text = ""
5var atbash_text = ""
5var orig_color = Color(0, 0, 0, 0) 6var orig_color = Color(0, 0, 0, 0)
6 7
8const kAtbashPre = "abcdefghijklmnopqrstuvwxyz1234567890+-"
9const kAtbashPost = "zyxwvutsrqponmlkjihgfedcba0987654321-+"
10
7 11
8func _ready(): 12func _ready():
9 orig_text = self.get_parent().get_node("Viewport/GUI/Panel/Label").text 13 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 14 orig_color = self.get_parent().get_node("Quad").get_surface_material(0).albedo_color
11 15
16 for i in range(0, orig_text.length()):
17 var old_char = orig_text[i]
18 if old_char in kAtbashPre:
19 var j = kAtbashPre.find(old_char)
20 atbash_text += kAtbashPost[j]
21 else:
22 atbash_text += old_char
23
12 24
13func evaluate_solvability(): 25func evaluate_solvability():
14 var apclient = global.get_node("Archipelago") 26 var apclient = global.get_node("Archipelago")
27 var effects = get_tree().get_root().get_node("Spatial/AP_Effects")
15 28
16 var solvable = true 29 var solvable = true
17 var missing = [] 30 var missing = []
@@ -23,7 +36,10 @@ func evaluate_solvability():
23 solvable = false 36 solvable = false
24 37
25 if solvable: 38 if solvable:
26 self.get_parent().get_node("Viewport/GUI/Panel/Label").text = orig_text 39 if effects.atbash_remaining > 0:
40 self.get_parent().get_node("Viewport/GUI/Panel/Label").text = atbash_text
41 else:
42 self.get_parent().get_node("Viewport/GUI/Panel/Label").text = orig_text
27 self.get_parent().get_node("Viewport/GUI/Panel/TextEdit").editable = true 43 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 44 self.get_parent().get_node("Quad").get_surface_material(0).albedo_color = orig_color
29 else: 45 else:
@@ -37,3 +53,5 @@ func evaluate_solvability():
37 self.get_parent().get_node("Quad").get_surface_material(0).albedo_color = Color( 53 self.get_parent().get_node("Quad").get_surface_material(0).albedo_color = Color(
38 0.7, 0.2, 0.2 54 0.7, 0.2, 0.2
39 ) 55 )
56
57 self.get_parent().get_node("Viewport").render_target_update_mode = 1