fix: display uploaded and ranking avatars
This commit is contained in:
@@ -376,7 +376,7 @@ func has_custom_skin() -> bool:
|
||||
return _customSkinActive and _customSkinTexture != null
|
||||
|
||||
func get_custom_avatar_texture() -> Texture2D:
|
||||
if has_custom_avatar():
|
||||
if _customAvatarActive and _customAvatarTexture != null:
|
||||
return _customAvatarTexture
|
||||
return _accountAvatarTexture
|
||||
|
||||
|
||||
@@ -1165,7 +1165,13 @@ func _avatarPrimaryTextureFromData(data: Dictionary) -> Texture2D:
|
||||
return null
|
||||
|
||||
func _avatarUrlFromData(data: Dictionary) -> String:
|
||||
return _firstNonEmptyString(data, ["avatarUrl", "avatar_url", "avatar", "avatarURL"])
|
||||
var avatarUrl := _firstNonEmptyString(data, ["avatarUrl", "avatar_url", "avatar", "avatarURL"])
|
||||
if not avatarUrl.begins_with("/"):
|
||||
return avatarUrl
|
||||
var apiBaseUrl := NetworkConfig.get_api_base_url()
|
||||
if avatarUrl.begins_with("/api/") and apiBaseUrl.ends_with("/api"):
|
||||
return apiBaseUrl.trim_suffix("/api") + avatarUrl
|
||||
return apiBaseUrl + avatarUrl
|
||||
|
||||
func _firstNonEmptyString(data: Dictionary, keys: Array[String]) -> String:
|
||||
for key in keys:
|
||||
|
||||
Reference in New Issue
Block a user