Show unit portraits in battle HUD

This commit is contained in:
2026-06-18 13:07:08 +09:00
parent 68342c1b0b
commit 7ad34697f9
9 changed files with 111 additions and 14 deletions

View File

@@ -40,6 +40,7 @@ func hydrate_deployment(deployment: Dictionary) -> Dictionary:
unit["id"] = str(deployment.get("unit_id", deployment.get("id", deployment.get("officer_id", ""))))
unit["officer_id"] = str(deployment.get("officer_id", ""))
unit["name"] = str(deployment.get("name", officer.get("name", unit["id"])))
unit["portrait"] = str(deployment.get("portrait", officer.get("portrait", "")))
unit["class_id"] = class_id
unit["class"] = str(class_def.get("name", class_id.capitalize()))
unit["team"] = str(deployment.get("team", "enemy"))
@@ -121,6 +122,13 @@ func get_portrait_for_speaker(speaker_name: String) -> String:
return ""
func get_portrait_for_officer(officer_id: String) -> String:
if officer_id.is_empty():
return ""
var officer := _get_dict(officers, officer_id)
return str(officer.get("portrait", ""))
func _load_json_object(path: String) -> Dictionary:
if not FileAccess.file_exists(path):
push_error("Missing data file: %s" % path)