diff options
Diffstat (limited to 'Archipelago/client.gd')
-rw-r--r-- | Archipelago/client.gd | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 5b4d81e..8f20d0a 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd | |||
@@ -6,6 +6,9 @@ var ap_pass = "" | |||
6 | 6 | ||
7 | const ap_version = {"major": 0, "minor": 4, "build": 0, "class": "Version"} | 7 | const ap_version = {"major": 0, "minor": 4, "build": 0, "class": "Version"} |
8 | const orange_tower = ["Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh"] | 8 | const orange_tower = ["Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh"] |
9 | const color_items = [ | ||
10 | "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow" | ||
11 | ] | ||
9 | 12 | ||
10 | var _client = WebSocketClient.new() | 13 | var _client = WebSocketClient.new() |
11 | var _last_state = WebSocketPeer.STATE_CLOSED | 14 | var _last_state = WebSocketPeer.STATE_CLOSED |
@@ -36,14 +39,18 @@ var _panel_ids_by_location = {} | |||
36 | var _localdata_file = "" | 39 | var _localdata_file = "" |
37 | var _death_link = false | 40 | var _death_link = false |
38 | var _victory_condition = 0 # THE END, THE MASTER | 41 | var _victory_condition = 0 # THE END, THE MASTER |
42 | var _door_shuffle = false | ||
43 | var _color_shuffle = false | ||
39 | 44 | ||
40 | var _map_loaded = false | 45 | var _map_loaded = false |
41 | var _held_items = [] | 46 | var _held_items = [] |
42 | var _held_locations = [] | 47 | var _held_locations = [] |
43 | var _last_new_item = -1 | 48 | var _last_new_item = -1 |
44 | var _tower_floors = 0 | 49 | var _tower_floors = 0 |
50 | var _has_colors = ["white"] | ||
45 | 51 | ||
46 | signal client_connected | 52 | signal client_connected |
53 | signal evaluate_solvability | ||
47 | 54 | ||
48 | 55 | ||
49 | func _init(): | 56 | func _init(): |
@@ -154,6 +161,10 @@ func _on_data(): | |||
154 | 161 | ||
155 | if _slot_data.has("victory_condition"): | 162 | if _slot_data.has("victory_condition"): |
156 | _victory_condition = _slot_data["victory_condition"] | 163 | _victory_condition = _slot_data["victory_condition"] |
164 | if _slot_data.has("shuffle_colors"): | ||
165 | _color_shuffle = _slot_data["shuffle_colors"] | ||
166 | if _slot_data.has("shuffle_doors"): | ||
167 | _door_shuffle = (_slot_data["shuffle_doors"] > 0) | ||
157 | 168 | ||
158 | _localdata_file = "user://archipelago/%s_%d" % [_seed, _slot] | 169 | _localdata_file = "user://archipelago/%s_%d" % [_seed, _slot] |
159 | var ap_file = File.new() | 170 | var ap_file = File.new() |
@@ -365,6 +376,9 @@ func completedGoal(): | |||
365 | 376 | ||
366 | func mapFinishedLoading(): | 377 | func mapFinishedLoading(): |
367 | if !_map_loaded: | 378 | if !_map_loaded: |
379 | _has_colors = ["white"] | ||
380 | emit_signal("evaluate_solvability") | ||
381 | |||
368 | for item in _held_items: | 382 | for item in _held_items: |
369 | processItem(item["item"], item["index"], item["from"]) | 383 | processItem(item["item"], item["index"], item["from"]) |
370 | 384 | ||
@@ -396,6 +410,12 @@ func processItem(item, index, from): | |||
396 | processItem(_item_name_to_id[subitem_name], null, null) | 410 | processItem(_item_name_to_id[subitem_name], null, null) |
397 | _tower_floors += 1 | 411 | _tower_floors += 1 |
398 | 412 | ||
413 | if _color_shuffle and color_items.has(_item_id_to_name[item]): | ||
414 | var lcol = _item_id_to_name[item].to_lower() | ||
415 | if not _has_colors.has(lcol): | ||
416 | _has_colors.append(lcol) | ||
417 | emit_signal("evaluate_solvability") | ||
418 | |||
399 | # Show a message about the item if it's new. | 419 | # Show a message about the item if it's new. |
400 | if index != null and index > _last_new_item: | 420 | if index != null and index > _last_new_item: |
401 | _last_new_item = index | 421 | _last_new_item = index |