about summary refs log tree commit diff stats
path: root/Archipelago/effects.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Archipelago/effects.gd')
-rw-r--r--Archipelago/effects.gd75
1 files changed, 55 insertions, 20 deletions
diff --git a/Archipelago/effects.gd b/Archipelago/effects.gd index e830fbc..1e2e311 100644 --- a/Archipelago/effects.gd +++ b/Archipelago/effects.gd
@@ -4,7 +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_activated = false 7var atbash_remaining = 0
8var queued_iceland = 0 8var queued_iceland = 0
9var skip_available = false 9var skip_available = false
10var puzzle_focused = false 10var puzzle_focused = false
@@ -58,13 +58,13 @@ func _ready():
58func activate(): 58func activate():
59 activated = true 59 activated = true
60 60
61 for _i in range(0, queued_iceland): 61 if queued_iceland > 0:
62 trigger_iceland_trap() 62 trigger_iceland_trap(queued_iceland)
63 63
64 queued_iceland = 0 64 queued_iceland = 0
65 65
66 66
67func trigger_slowness_trap(): 67func trigger_slowness_trap(length = 30):
68 if slowness_remaining == 0: 68 if slowness_remaining == 0:
69 var player = get_tree().get_root().get_node("Spatial/player") 69 var player = get_tree().get_root().get_node("Spatial/player")
70 player.walk_speed = orig_walk / 2.0 70 player.walk_speed = orig_walk / 2.0
@@ -72,13 +72,16 @@ func trigger_slowness_trap():
72 72
73 $SlownessTimer.start() 73 $SlownessTimer.start()
74 74
75 slowness_remaining += 30 75 slowness_remaining += length
76 text_dirty = true 76 text_dirty = true
77 77
78 var apclient = global.get_node("Archipelago")
79 apclient.saveLocaldata()
78 80
79func trigger_iceland_trap(): 81
82func trigger_iceland_trap(length = 60):
80 if not activated: 83 if not activated:
81 queued_iceland += 1 84 queued_iceland += length
82 return 85 return
83 86
84 if iceland_remaining == 0: 87 if iceland_remaining == 0:
@@ -88,31 +91,45 @@ func trigger_iceland_trap():
88 91
89 $IcelandTimer.start() 92 $IcelandTimer.start()
90 93
91 iceland_remaining += 60 94 iceland_remaining += length
92 text_dirty = true 95 text_dirty = true
93 96
97 var apclient = global.get_node("Archipelago")
98 apclient.saveLocaldata()
99
94 100
95func trigger_atbash_trap(): 101func trigger_atbash_trap():
96 if not atbash_activated: 102 var newly_atbash = (atbash_remaining == 0)
97 atbash_activated = true 103 atbash_remaining += 1
98 104
105 if newly_atbash:
99 var apclient = global.get_node("Archipelago") 106 var apclient = global.get_node("Archipelago")
100 apclient.evaluateSolvability() 107 apclient.evaluateSolvability()
101 108
102 text_dirty = true 109 text_dirty = true
110
111 var apclient = global.get_node("Archipelago")
112 apclient.saveLocaldata()
103 113
104 114
105func deactivate_atbash_trap(): 115func deactivate_atbash_trap():
106 if atbash_activated: 116 if atbash_remaining > 0:
107 atbash_activated = false 117 atbash_remaining -= 1
108 118
109 var apclient = global.get_node("Archipelago") 119 if atbash_remaining == 0:
110 apclient.evaluateSolvability() 120 var apclient = global.get_node("Archipelago")
121 apclient.evaluateSolvability()
111 122
112 text_dirty = true 123 text_dirty = true
124
125 var apclient = global.get_node("Archipelago")
126 apclient.saveLocaldata()
113 127
114 128
115func show_puzzle_skip_message(node_path): 129func show_puzzle_skip_message(node_path):
130 if puzzle_focused and node_path != puzzle_to_skip:
131 hide_puzzle_skip_message()
132
116 var panel_input = get_tree().get_root().get_node(node_path) 133 var panel_input = get_tree().get_root().get_node(node_path)
117 if not panel_input.visible: 134 if not panel_input.visible:
118 return 135 return
@@ -126,6 +143,7 @@ func show_puzzle_skip_message(node_path):
126 puzzle_focused = true 143 puzzle_focused = true
127 wallcast.enabled = true 144 wallcast.enabled = true
128 not_behind_wall = false 145 not_behind_wall = false
146 text_dirty = true
129 puzzle_to_skip = node_path 147 puzzle_to_skip = node_path
130 _evaluate_puzzle_skip() 148 _evaluate_puzzle_skip()
131 149
@@ -133,6 +151,8 @@ func show_puzzle_skip_message(node_path):
133func hide_puzzle_skip_message(): 151func hide_puzzle_skip_message():
134 puzzle_focused = false 152 puzzle_focused = false
135 wallcast.enabled = false 153 wallcast.enabled = false
154 not_behind_wall = false
155 text_dirty = true
136 _evaluate_puzzle_skip() 156 _evaluate_puzzle_skip()
137 157
138 158
@@ -172,6 +192,10 @@ func _tick_slowness():
172 player.run_speed = orig_run 192 player.run_speed = orig_run
173 193
174 $SlownessTimer.stop() 194 $SlownessTimer.stop()
195
196 if slowness_remaining % 5 == 0:
197 var apclient = global.get_node("Archipelago")
198 apclient.saveLocaldata()
175 199
176 200
177func _tick_iceland(): 201func _tick_iceland():
@@ -184,22 +208,33 @@ func _tick_iceland():
184 ) 208 )
185 209
186 $IcelandTimer.stop() 210 $IcelandTimer.stop()
211
212 if iceland_remaining % 5 == 0:
213 var apclient = global.get_node("Archipelago")
214 apclient.saveLocaldata()
187 215
188 216
189func _process(_delta): 217func _process(_delta):
190 if puzzle_focused: 218 if puzzle_focused:
219 var should_nbw = false
191 if wallcast.is_colliding(): 220 if wallcast.is_colliding():
192 var should_nbw = (get_tree().get_root().get_node("Spatial/player")._get_panel_from_ray(wallcast) != null) 221 var player = get_tree().get_root().get_node("Spatial/player")
193 if should_nbw != not_behind_wall: 222 var puzzlecast = player.get_node("pivot/camera/RayCast_sight")
194 not_behind_wall = true 223 var distance = puzzlecast.get_collision_point().distance_to(wallcast.get_collision_point())
195 text_dirty = true 224 should_nbw = (distance < 0.05)
225
226 if should_nbw != not_behind_wall:
227 not_behind_wall = should_nbw
228 text_dirty = true
196 229
197 if text_dirty: 230 if text_dirty:
198 text_dirty = false 231 text_dirty = false
199 232
200 var text = "" 233 var text = ""
201 if atbash_activated: 234 if atbash_remaining == 1:
202 text += "Atbash Trap lasts until you solve a puzzle" 235 text += "Atbash Trap lasts until you solve a puzzle"
236 if atbash_remaining > 1:
237 text += ("Atbash Trap lasts until you solve %d puzzles" % atbash_remaining)
203 if slowness_remaining > 0: 238 if slowness_remaining > 0:
204 if not text.empty(): 239 if not text.empty():
205 text += "\n" 240 text += "\n"