about summary refs log tree commit diff stats
path: root/Archipelago
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-06-16 19:05:58 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-06-16 19:05:58 -0400
commite2936fdd05a7178772a47f5e7923a75c1b04a357 (patch)
tree5ea9455dd62634144784787ff5a76f14f3302112 /Archipelago
parent38b8f3dbb70472e99e90c5b1c5095c2c4f206880 (diff)
downloadlingo-archipelago-e2936fdd05a7178772a47f5e7923a75c1b04a357.tar.gz
lingo-archipelago-e2936fdd05a7178772a47f5e7923a75c1b04a357.tar.bz2
lingo-archipelago-e2936fdd05a7178772a47f5e7923a75c1b04a357.zip
Atbash trap
Diffstat (limited to 'Archipelago')
-rw-r--r--Archipelago/client.gd6
-rw-r--r--Archipelago/effects.gd27
-rw-r--r--Archipelago/panel.gd20
3 files changed, 51 insertions, 2 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 1fe354a..6211ad7 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd
@@ -644,6 +644,8 @@ func processItem(item, index, from, flags):
644 effects_node.trigger_slowness_trap() 644 effects_node.trigger_slowness_trap()
645 if item_name == "Iceland Trap": 645 if item_name == "Iceland Trap":
646 effects_node.trigger_iceland_trap() 646 effects_node.trigger_iceland_trap()
647 if item_name == "Atbash Trap":
648 effects_node.trigger_atbash_trap()
647 649
648 650
649func doorIsVanilla(door): 651func doorIsVanilla(door):
@@ -654,6 +656,10 @@ func paintingIsVanilla(painting):
654 return !_mentioned_paintings.has(painting) 656 return !_mentioned_paintings.has(painting)
655 657
656 658
659func evaluateSolvability():
660 emit_signal("evaluate_solvability")
661
662
657func colorForItemType(flags): 663func colorForItemType(flags):
658 var int_flags = int(flags) 664 var int_flags = int(flags)
659 if int_flags & 1: # progression 665 if int_flags & 1: # progression
diff --git a/Archipelago/effects.gd b/Archipelago/effects.gd index a11ab42..04c79b6 100644 --- a/Archipelago/effects.gd +++ b/Archipelago/effects.gd
@@ -4,6 +4,7 @@ var activated = false
4var effect_running = false 4var effect_running = false
5var slowness_remaining = 0 5var slowness_remaining = 0
6var iceland_remaining = 0 6var iceland_remaining = 0
7var atbash_remaining = 0
7var queued_iceland = 0 8var queued_iceland = 0
8 9
9var orig_env 10var orig_env
@@ -70,10 +71,23 @@ func trigger_iceland_trap():
70 _process_effects() 71 _process_effects()
71 72
72 73
74func trigger_atbash_trap():
75 if atbash_remaining == 0:
76 atbash_remaining += 60
77
78 var apclient = global.get_node("Archipelago")
79 apclient.evaluateSolvability()
80 else:
81 atbash_remaining += 60
82
83 if not effect_running:
84 _process_effects()
85
86
73func _process_effects(): 87func _process_effects():
74 effect_running = true 88 effect_running = true
75 89
76 while slowness_remaining > 0 or iceland_remaining > 0: 90 while slowness_remaining > 0 or iceland_remaining > 0 or atbash_remaining > 0:
77 var text = "" 91 var text = ""
78 if slowness_remaining > 0: 92 if slowness_remaining > 0:
79 text += "Slowness: %d seconds" % slowness_remaining 93 text += "Slowness: %d seconds" % slowness_remaining
@@ -81,6 +95,10 @@ func _process_effects():
81 if not text.empty(): 95 if not text.empty():
82 text += "\n" 96 text += "\n"
83 text += "Iceland: %d seconds" % iceland_remaining 97 text += "Iceland: %d seconds" % iceland_remaining
98 if atbash_remaining > 0:
99 if not text.empty():
100 text += "\n"
101 text += "Atbash: %d seconds" % atbash_remaining
84 self.get_node("label").text = text 102 self.get_node("label").text = text
85 103
86 yield(get_tree().create_timer(1.0), "timeout") 104 yield(get_tree().create_timer(1.0), "timeout")
@@ -101,5 +119,12 @@ func _process_effects():
101 orig_env 119 orig_env
102 ) 120 )
103 121
122 if atbash_remaining > 0:
123 atbash_remaining -= 1
124
125 if atbash_remaining == 0:
126 var apclient = global.get_node("Archipelago")
127 apclient.evaluateSolvability()
128
104 self.get_node("label").text = "" 129 self.get_node("label").text = ""
105 effect_running = false 130 effect_running = false
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