From 3d7efa558252e9c3e0ef5d2708c525ad06ae5e86 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 10 Oct 2024 15:13:50 -0400 Subject: Tell player if location was hinted --- Archipelago/client.gd | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'Archipelago/client.gd') diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 1d8e779..01f812c 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -121,6 +121,8 @@ var _cached_atbash = 0 var _cached_speed_boosts = 0 var _geronimo_skip = false var _checked_paintings = [] +var _hints_key = "" +var _hinted_locations = [] signal could_not_connect signal connect_status @@ -403,6 +405,11 @@ func _on_data(): ] ) + _hints_key = "_read_hints_%d_%d" % [_team, _slot] + sendMessage( + [{"cmd": "SetNotify", "keys": [_hints_key]}, {"cmd": "Get", "keys": [_hints_key]}] + ) + emit_signal("client_connected") elif cmd == "ConnectionRefused": @@ -500,9 +507,12 @@ func _on_data(): ) else: if message["receiving"] != _slot: - messages.showMessage( + var sentMsg = ( "Sent [color=%s]%s[/color] to %s" % [item_color, item_name, player_name] ) + if _hinted_locations.has(message["item"]["location"]): + sentMsg += " ([color=#fafad2]Hinted![/color])" + messages.showMessage(sentMsg) elif cmd == "Bounced": if ( @@ -523,8 +533,15 @@ func _on_data(): get_tree().get_root().get_node("Spatial/player/pause_menu")._reload() elif cmd == "SetReply": - if message.has("key") and message["key"] == ("Lingo_%d_Paintings" % _slot): - _checked_paintings = message["value"] + if message.has("key"): + if message["key"] == ("Lingo_%d_Paintings" % _slot): + _checked_paintings = message["value"] + elif message["key"] == _hints_key: + parseHints(message["value"]) + + elif cmd == "Retrieved": + if message.has("keys") and message["keys"].has(_hints_key): + parseHints(message["keys"][_hints_key]) func _process(_delta): @@ -863,6 +880,14 @@ func checkPainting(painting_id): setValue("Paintings", [painting_id], "add") +func parseHints(hints): + _hinted_locations.clear() + + for hint in hints: + if hint["finding_player"] == int(_slot): + _hinted_locations.append(hint["location"]) + + func colorForItemType(flags): var int_flags = int(flags) if int_flags & 1: # progression -- cgit 1.4.1