Add officer portrait defaults
This commit is contained in:
@@ -110,6 +110,17 @@ func get_class_def(class_id: String) -> Dictionary:
|
||||
return _get_dict(classes, class_id).duplicate(true)
|
||||
|
||||
|
||||
func get_portrait_for_speaker(speaker_name: String) -> String:
|
||||
var normalized_speaker := _normalized_speaker_name(speaker_name)
|
||||
if normalized_speaker.is_empty():
|
||||
return ""
|
||||
for officer_id in officers.keys():
|
||||
var officer := _get_dict(officers, officer_id)
|
||||
if _normalized_speaker_name(str(officer.get("name", ""))) == normalized_speaker:
|
||||
return str(officer.get("portrait", ""))
|
||||
return ""
|
||||
|
||||
|
||||
func _load_json_object(path: String) -> Dictionary:
|
||||
if not FileAccess.file_exists(path):
|
||||
push_error("Missing data file: %s" % path)
|
||||
@@ -132,6 +143,10 @@ func _get_dict(source: Dictionary, key) -> Dictionary:
|
||||
return {}
|
||||
|
||||
|
||||
func _normalized_speaker_name(value: String) -> String:
|
||||
return value.strip_edges().to_lower()
|
||||
|
||||
|
||||
func _merged_equipment(base_equipment, override_equipment) -> Dictionary:
|
||||
var result := {}
|
||||
if typeof(base_equipment) == TYPE_DICTIONARY:
|
||||
|
||||
Reference in New Issue
Block a user