about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--Archipelago/client.gd28
-rw-r--r--Archipelago/effects.gd34
-rw-r--r--Archipelago/load.gd9
3 files changed, 63 insertions, 8 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 788f6ca..3a2a783 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd
@@ -112,6 +112,9 @@ var _progressive_progress = {}
112var _has_colors = ["white"] 112var _has_colors = ["white"]
113var _received_indexes = [] 113var _received_indexes = []
114var _puzzle_skips = 0 114var _puzzle_skips = 0
115var _cached_slowness = 0
116var _cached_iceland = 0
117var _cached_atbash = 0
115 118
116signal could_not_connect 119signal could_not_connect
117signal connect_status 120signal connect_status
@@ -297,6 +300,21 @@ func _on_data():
297 300
298 if localdata.size() > 1: 301 if localdata.size() > 1:
299 _puzzle_skips = localdata[1] 302 _puzzle_skips = localdata[1]
303
304 if localdata.size() > 2:
305 _cached_slowness = localdata[2]
306 else:
307 _cached_slowness = 0
308
309 if localdata.size() > 3:
310 _cached_iceland = localdata[3]
311 else:
312 _cached_iceland = 0
313
314 if localdata.size() > 4:
315 _cached_atbash = localdata[4]
316 else:
317 _cached_atbash = 0
300 318
301 requestSync() 319 requestSync()
302 320
@@ -450,7 +468,15 @@ func saveLocaldata():
450 var file = File.new() 468 var file = File.new()
451 file.open(_localdata_file, File.WRITE) 469 file.open(_localdata_file, File.WRITE)
452 470
453 var data = [_last_new_item, _puzzle_skips] 471 var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects")
472
473 var data = [
474 _last_new_item,
475 _puzzle_skips,
476 effects_node.slowness_remaining,
477 effects_node.iceland_remaining,
478 effects_node.atbash_remaining
479 ]
454 file.store_var(data, true) 480 file.store_var(data, true)
455 file.close() 481 file.close()
456 482
diff --git a/Archipelago/effects.gd b/Archipelago/effects.gd index e6d2dcd..1e2e311 100644 --- a/Archipelago/effects.gd +++ b/Archipelago/effects.gd
@@ -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,9 +91,12 @@ 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 var newly_atbash = (atbash_remaining == 0) 102 var newly_atbash = (atbash_remaining == 0)
@@ -102,6 +108,9 @@ func trigger_atbash_trap():
102 108
103 text_dirty = true 109 text_dirty = true
104 110
111 var apclient = global.get_node("Archipelago")
112 apclient.saveLocaldata()
113
105 114
106func deactivate_atbash_trap(): 115func deactivate_atbash_trap():
107 if atbash_remaining > 0: 116 if atbash_remaining > 0:
@@ -112,6 +121,9 @@ func deactivate_atbash_trap():
112 apclient.evaluateSolvability() 121 apclient.evaluateSolvability()
113 122
114 text_dirty = true 123 text_dirty = true
124
125 var apclient = global.get_node("Archipelago")
126 apclient.saveLocaldata()
115 127
116 128
117func show_puzzle_skip_message(node_path): 129func show_puzzle_skip_message(node_path):
@@ -180,6 +192,10 @@ func _tick_slowness():
180 player.run_speed = orig_run 192 player.run_speed = orig_run
181 193
182 $SlownessTimer.stop() 194 $SlownessTimer.stop()
195
196 if slowness_remaining % 5 == 0:
197 var apclient = global.get_node("Archipelago")
198 apclient.saveLocaldata()
183 199
184 200
185func _tick_iceland(): 201func _tick_iceland():
@@ -192,6 +208,10 @@ func _tick_iceland():
192 ) 208 )
193 209
194 $IcelandTimer.stop() 210 $IcelandTimer.stop()
211
212 if iceland_remaining % 5 == 0:
213 var apclient = global.get_node("Archipelago")
214 apclient.saveLocaldata()
195 215
196 216
197func _process(_delta): 217func _process(_delta):
diff --git a/Archipelago/load.gd b/Archipelago/load.gd index 7f86c91..a277817 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd
@@ -565,6 +565,15 @@ func _load():
565 global._print("Hooked Load End") 565 global._print("Hooked Load End")
566 ._load() 566 ._load()
567 567
568 # Activate any cached traps.
569 if apclient._cached_slowness > 0:
570 effects.trigger_slowness_trap(apclient._cached_slowness)
571 if apclient._cached_iceland > 0:
572 effects.trigger_iceland_trap(apclient._cached_iceland)
573 if apclient._cached_atbash > 0:
574 for _i in range(0, apclient._cached_atbash):
575 effects.trigger_atbash_trap()
576
568 # Process any items received while the map was loading, and send the checks 577 # Process any items received while the map was loading, and send the checks
569 # from the save load. 578 # from the save load.
570 apclient.mapFinishedLoading() 579 apclient.mapFinishedLoading()