about summary refs log tree commit diff stats
path: root/Archipelago/client.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Archipelago/client.gd')
-rw-r--r--Archipelago/client.gd54
1 files changed, 48 insertions, 6 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 5f8be4e..8cddb83 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd
@@ -19,7 +19,7 @@ var enable_multiplayer = false
19var track_player = false 19var track_player = false
20var connection_history = [] 20var connection_history = []
21 21
22const my_version = "panels-beta6" 22const my_version = "4.2.1"
23const ap_version = {"major": 0, "minor": 5, "build": 0, "class": "Version"} 23const ap_version = {"major": 0, "minor": 5, "build": 0, "class": "Version"}
24const color_items = [ 24const color_items = [
25 "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow" 25 "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow"
@@ -114,6 +114,7 @@ var _pilgrimage_allows_roof_access = false
114var _pilgrimage_allows_paintings = false 114var _pilgrimage_allows_paintings = false
115var _sunwarp_shuffle = false 115var _sunwarp_shuffle = false
116var _sunwarp_mapping = [] 116var _sunwarp_mapping = []
117var _speed_boost_mode = false
117var _slot_seed = 0 118var _slot_seed = 0
118 119
119var _map_loaded = false 120var _map_loaded = false
@@ -127,8 +128,11 @@ var _puzzle_skips = 0
127var _cached_slowness = 0 128var _cached_slowness = 0
128var _cached_iceland = 0 129var _cached_iceland = 0
129var _cached_atbash = 0 130var _cached_atbash = 0
131var _cached_speed_boosts = 0
130var _geronimo_skip = false 132var _geronimo_skip = false
131var _checked_paintings = [] 133var _checked_paintings = []
134var _hints_key = ""
135var _hinted_locations = []
132 136
133signal could_not_connect 137signal could_not_connect
134signal connect_status 138signal connect_status
@@ -346,6 +350,10 @@ func _on_data():
346 _sunwarp_shuffle = false 350 _sunwarp_shuffle = false
347 if _slot_data.has("sunwarp_permutation"): 351 if _slot_data.has("sunwarp_permutation"):
348 _sunwarp_mapping = _slot_data["sunwarp_permutation"] 352 _sunwarp_mapping = _slot_data["sunwarp_permutation"]
353 if _slot_data.has("speed_boost_mode"):
354 _speed_boost_mode = _slot_data["speed_boost_mode"]
355 else:
356 _speed_boost_mode = false
349 357
350 if ( 358 if (
351 _location_classification_bit != kCLASSIFICATION_LOCAL_INSANITY 359 _location_classification_bit != kCLASSIFICATION_LOCAL_INSANITY
@@ -364,6 +372,7 @@ func _on_data():
364 _cached_slowness = 0 372 _cached_slowness = 0
365 _cached_iceland = 0 373 _cached_iceland = 0
366 _cached_atbash = 0 374 _cached_atbash = 0
375 _cached_speed_boosts = 0
367 _geronimo_skip = false 376 _geronimo_skip = false
368 377
369 _localdata_file = "user://archipelago_data/%s_%d" % [_seed, _slot] 378 _localdata_file = "user://archipelago_data/%s_%d" % [_seed, _slot]
@@ -395,6 +404,9 @@ func _on_data():
395 if localdata.size() > 5: 404 if localdata.size() > 5:
396 _geronimo_skip = localdata[5] 405 _geronimo_skip = localdata[5]
397 406
407 if localdata.size() > 6:
408 _cached_speed_boosts = localdata[6]
409
398 requestSync() 410 requestSync()
399 411
400 sendMessage( 412 sendMessage(
@@ -409,6 +421,11 @@ func _on_data():
409 ] 421 ]
410 ) 422 )
411 423
424 _hints_key = "_read_hints_%d_%d" % [_team, _slot]
425 sendMessage(
426 [{"cmd": "SetNotify", "keys": [_hints_key]}, {"cmd": "Get", "keys": [_hints_key]}]
427 )
428
412 emit_signal("client_connected") 429 emit_signal("client_connected")
413 430
414 elif cmd == "ConnectionRefused": 431 elif cmd == "ConnectionRefused":
@@ -506,9 +523,12 @@ func _on_data():
506 ) 523 )
507 else: 524 else:
508 if message["receiving"] != _slot: 525 if message["receiving"] != _slot:
509 messages.showMessage( 526 var sentMsg = (
510 "Sent [color=%s]%s[/color] to %s" % [item_color, item_name, player_name] 527 "Sent [color=%s]%s[/color] to %s" % [item_color, item_name, player_name]
511 ) 528 )
529 if _hinted_locations.has(message["item"]["location"]):
530 sentMsg += " ([color=#fafad2]Hinted![/color])"
531 messages.showMessage(sentMsg)
512 532
513 elif cmd == "Bounced": 533 elif cmd == "Bounced":
514 if ( 534 if (
@@ -529,8 +549,15 @@ func _on_data():
529 get_tree().get_root().get_node("Spatial/player/pause_menu")._reload() 549 get_tree().get_root().get_node("Spatial/player/pause_menu")._reload()
530 550
531 elif cmd == "SetReply": 551 elif cmd == "SetReply":
532 if message.has("key") and message["key"] == ("Lingo_%d_Paintings" % _slot): 552 if message.has("key"):
533 _checked_paintings = message["value"] 553 if message["key"] == ("Lingo_%d_Paintings" % _slot):
554 _checked_paintings = message["value"]
555 elif message["key"] == _hints_key:
556 parseHints(message["value"])
557
558 elif cmd == "Retrieved":
559 if message.has("keys") and message["keys"].has(_hints_key):
560 parseHints(message["keys"][_hints_key])
534 561
535 562
536func _process(_delta): 563func _process(_delta):
@@ -584,7 +611,8 @@ func saveLocaldata():
584 effects_node.slowness_remaining, 611 effects_node.slowness_remaining,
585 effects_node.iceland_remaining, 612 effects_node.iceland_remaining,
586 effects_node.atbash_remaining, 613 effects_node.atbash_remaining,
587 _geronimo_skip 614 _geronimo_skip,
615 effects_node.speed_boosts_remaining,
588 ] 616 ]
589 file.store_var(data, true) 617 file.store_var(data, true)
590 file.close() 618 file.close()
@@ -831,12 +859,14 @@ func processItem(item, index, from, flags):
831 ) 859 )
832 860
833 var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects") 861 var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects")
834 if item_name == "Slowness Trap": 862 if item_name == "Slowness Trap" and !_speed_boost_mode:
835 effects_node.trigger_slowness_trap() 863 effects_node.trigger_slowness_trap()
836 if item_name == "Iceland Trap": 864 if item_name == "Iceland Trap":
837 effects_node.trigger_iceland_trap() 865 effects_node.trigger_iceland_trap()
838 if item_name == "Atbash Trap": 866 if item_name == "Atbash Trap":
839 effects_node.trigger_atbash_trap() 867 effects_node.trigger_atbash_trap()
868 if item_name == "Speed Boost" and _speed_boost_mode:
869 effects_node.trigger_speed_boost()
840 if item_name == "Puzzle Skip": 870 if item_name == "Puzzle Skip":
841 _puzzle_skips += 1 871 _puzzle_skips += 1
842 872
@@ -887,6 +917,14 @@ func checkPainting(painting_id):
887 setValue("Paintings", [painting_id], "add") 917 setValue("Paintings", [painting_id], "add")
888 918
889 919
920func parseHints(hints):
921 _hinted_locations.clear()
922
923 for hint in hints:
924 if hint["finding_player"] == int(_slot):
925 _hinted_locations.append(hint["location"])
926
927
890func colorForItemType(flags): 928func colorForItemType(flags):
891 var int_flags = int(flags) 929 var int_flags = int(flags)
892 if int_flags & 1: # progression 930 if int_flags & 1: # progression
@@ -936,6 +974,10 @@ func parse_printjson(message):
936 textclient_node.parse_printjson("".join(parts)) 974 textclient_node.parse_printjson("".join(parts))
937 975
938 976
977func get_player_name():
978 return _player_name_by_slot[_slot]
979
980
939func compareVersion(lhs, rhs): 981func compareVersion(lhs, rhs):
940 if lhs["major"] == rhs["major"]: 982 if lhs["major"] == rhs["major"]:
941 if lhs["minor"] == rhs["minor"]: 983 if lhs["minor"] == rhs["minor"]: