about summary refs log tree commit diff stats
path: root/Archipelago/client.gd
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-04-16 16:09:37 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-04-16 16:09:37 -0400
commit7aa62e5c0ac0d86e5aed2ead2a7116ea0edbffde (patch)
tree2e35e9166e01ead9e0bdddb1db9c3a18a2fa6266 /Archipelago/client.gd
parent36eee0423e7f29e352c9c44d0ebb592007ec7436 (diff)
downloadlingo-archipelago-7aa62e5c0ac0d86e5aed2ead2a7116ea0edbffde.tar.gz
lingo-archipelago-7aa62e5c0ac0d86e5aed2ead2a7116ea0edbffde.tar.bz2
lingo-archipelago-7aa62e5c0ac0d86e5aed2ead2a7116ea0edbffde.zip
Implemented color shuffle
Diffstat (limited to 'Archipelago/client.gd')
-rw-r--r--Archipelago/client.gd20
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
7const ap_version = {"major": 0, "minor": 4, "build": 0, "class": "Version"} 7const ap_version = {"major": 0, "minor": 4, "build": 0, "class": "Version"}
8const orange_tower = ["Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh"] 8const orange_tower = ["Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh"]
9const color_items = [
10 "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow"
11]
9 12
10var _client = WebSocketClient.new() 13var _client = WebSocketClient.new()
11var _last_state = WebSocketPeer.STATE_CLOSED 14var _last_state = WebSocketPeer.STATE_CLOSED
@@ -36,14 +39,18 @@ var _panel_ids_by_location = {}
36var _localdata_file = "" 39var _localdata_file = ""
37var _death_link = false 40var _death_link = false
38var _victory_condition = 0 # THE END, THE MASTER 41var _victory_condition = 0 # THE END, THE MASTER
42var _door_shuffle = false
43var _color_shuffle = false
39 44
40var _map_loaded = false 45var _map_loaded = false
41var _held_items = [] 46var _held_items = []
42var _held_locations = [] 47var _held_locations = []
43var _last_new_item = -1 48var _last_new_item = -1
44var _tower_floors = 0 49var _tower_floors = 0
50var _has_colors = ["white"]
45 51
46signal client_connected 52signal client_connected
53signal evaluate_solvability
47 54
48 55
49func _init(): 56func _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
366func mapFinishedLoading(): 377func 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