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-28 00:09:55 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-04-28 00:09:55 -0400
commit7446b4accb7b456d5ada064dab607b64e11c2895 (patch)
treed6f59a21de7ca0bc837bbe95b4de7cb4e4e87667 /Archipelago/client.gd
parenta33a7e1e60c48d61a42c540fd5083a3b0dc07b6e (diff)
downloadlingo-archipelago-7446b4accb7b456d5ada064dab607b64e11c2895.tar.gz
lingo-archipelago-7446b4accb7b456d5ada064dab607b64e11c2895.tar.bz2
lingo-archipelago-7446b4accb7b456d5ada064dab607b64e11c2895.zip
Item names are colored by type in messages
The messages node is now a vertical box container with individual RichTextLabels for each line.
Diffstat (limited to 'Archipelago/client.gd')
-rw-r--r--Archipelago/client.gd42
1 files changed, 33 insertions, 9 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 0531fe6..46b9ff0 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd
@@ -293,13 +293,14 @@ func _on_data():
293 var i = 0 293 var i = 0
294 for item in message["items"]: 294 for item in message["items"]:
295 if _map_loaded: 295 if _map_loaded:
296 processItem(item["item"], message["index"] + i, item["player"]) 296 processItem(item["item"], message["index"] + i, item["player"], item["flags"])
297 else: 297 else:
298 _held_items.append( 298 _held_items.append(
299 { 299 {
300 "item": item["item"], 300 "item": item["item"],
301 "index": message["index"] + i, 301 "index": message["index"] + i,
302 "from": item["player"] 302 "from": item["player"],
303 "flags": item["flags"]
303 } 304 }
304 ) 305 )
305 i += 1 306 i += 1
@@ -324,6 +325,8 @@ func _on_data():
324 if _player_name_by_slot.has(message["receiving"]): 325 if _player_name_by_slot.has(message["receiving"]):
325 player_name = _player_name_by_slot[message["receiving"]] 326 player_name = _player_name_by_slot[message["receiving"]]
326 327
328 var item_color = colorForItemType(message["item"]["flags"])
329
327 var messages_node = get_tree().get_root().get_node("Spatial/AP_Messages") 330 var messages_node = get_tree().get_root().get_node("Spatial/AP_Messages")
328 if message["type"] == "Hint": 331 if message["type"] == "Hint":
329 var is_for = "" 332 var is_for = ""
@@ -331,11 +334,16 @@ func _on_data():
331 is_for = " for %s" % player_name 334 is_for = " for %s" % player_name
332 if !message.has("found") || !message["found"]: 335 if !message.has("found") || !message["found"]:
333 messages_node.showMessage( 336 messages_node.showMessage(
334 "Hint: %s%s is on %s" % [item_name, is_for, location_name] 337 (
338 "Hint: [color=%s]%s[/color]%s is on %s"
339 % [item_color, item_name, is_for, location_name]
340 )
335 ) 341 )
336 else: 342 else:
337 if message["receiving"] != _slot: 343 if message["receiving"] != _slot:
338 messages_node.showMessage("Sent %s to %s" % [item_name, player_name]) 344 messages_node.showMessage(
345 "Sent [color=%s]%s[/color] to %s" % [item_color, item_name, player_name]
346 )
339 347
340 elif cmd == "Bounced": 348 elif cmd == "Bounced":
341 if ( 349 if (
@@ -486,7 +494,7 @@ func mapFinishedLoading():
486 emit_signal("evaluate_solvability") 494 emit_signal("evaluate_solvability")
487 495
488 for item in _held_items: 496 for item in _held_items:
489 processItem(item["item"], item["index"], item["from"]) 497 processItem(item["item"], item["index"], item["from"], item["flags"])
490 498
491 sendMessage([{"cmd": "LocationChecks", "locations": _held_locations}]) 499 sendMessage([{"cmd": "LocationChecks", "locations": _held_locations}])
492 500
@@ -495,7 +503,7 @@ func mapFinishedLoading():
495 _held_locations = [] 503 _held_locations = []
496 504
497 505
498func processItem(item, index, from): 506func processItem(item, index, from, flags):
499 global._print(item) 507 global._print(item)
500 508
501 var stringified = String(item) 509 var stringified = String(item)
@@ -522,7 +530,7 @@ func processItem(item, index, from):
522 if _item_name_to_id["Progressive Orange Tower"] == item and _tower_floors < orange_tower.size(): 530 if _item_name_to_id["Progressive Orange Tower"] == item and _tower_floors < orange_tower.size():
523 var subitem_name = "Orange Tower - %s Floor" % orange_tower[_tower_floors] 531 var subitem_name = "Orange Tower - %s Floor" % orange_tower[_tower_floors]
524 global._print(subitem_name) 532 global._print(subitem_name)
525 processItem(_item_name_to_id[subitem_name], null, null) 533 processItem(_item_name_to_id[subitem_name], null, null, null)
526 _tower_floors += 1 534 _tower_floors += 1
527 535
528 if _color_shuffle and color_items.has(_item_id_to_name[item]): 536 if _color_shuffle and color_items.has(_item_id_to_name[item]):
@@ -547,11 +555,15 @@ func processItem(item, index, from):
547 if _player_name_by_slot.has(from): 555 if _player_name_by_slot.has(from):
548 player_name = _player_name_by_slot[from] 556 player_name = _player_name_by_slot[from]
549 557
558 var item_color = colorForItemType(flags)
559
550 var messages_node = get_tree().get_root().get_node("Spatial/AP_Messages") 560 var messages_node = get_tree().get_root().get_node("Spatial/AP_Messages")
551 if from == _slot: 561 if from == _slot:
552 messages_node.showMessage("Found %s" % item_name) 562 messages_node.showMessage("Found [color=%s]%s[/color]" % [item_color, item_name])
553 else: 563 else:
554 messages_node.showMessage("Received %s from %s" % [item_name, player_name]) 564 messages_node.showMessage(
565 "Received [color=%s]%s[/color] from %s" % [item_color, item_name, player_name]
566 )
555 567
556 var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects") 568 var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects")
557 if item_name == "Slowness Trap": 569 if item_name == "Slowness Trap":
@@ -566,3 +578,15 @@ func doorIsVanilla(door):
566 578
567func paintingIsVanilla(painting): 579func paintingIsVanilla(painting):
568 return !_mentioned_paintings.has(painting) 580 return !_mentioned_paintings.has(painting)
581
582
583func colorForItemType(flags):
584 var int_flags = int(flags)
585 if int_flags & 1: # progression
586 return "#bc51e0"
587 elif int_flags & 2: # useful
588 return "#2b67ff"
589 elif int_flags & 4: # trap
590 return "#d63a22"
591 else: # filler
592 return "#14de9e"