Files
Ratdoku/scripts/Avatars.gd
T
Ratdoku Builder e0fd33c25e fix(profile): restore original Crumb portrait in game
The new Krea2 Crumb render is used only for the app icon. Guests keep true headshot avatars.
2026-12-04 05:56:18 -06:00

63 lines
1.4 KiB
GDScript

class_name Avatars
extends RefCounted
## Selectable profile portraits. Crumb is always available; guest portraits
## unlock with the corresponding Guest Book entry.
static func all() -> Array:
var out := [{
"id": "crumb",
"name": "Crumb",
"path": "res://art/crumb_head.png",
"room": 0,
}]
for guest in Guests.all():
var id := str(guest.get("id", ""))
if id.is_empty():
continue
out.append({
"id": id,
"name": str(guest.get("name", id)),
"path": Guests.portrait(id, "thumbs"),
"room": int(guest.get("unlock_room", 0)),
})
return out
static func by_id(id: String) -> Dictionary:
for avatar in all():
if str(avatar.get("id", "")) == id:
return avatar
return {}
static func portrait_path(id: String) -> String:
var avatar := by_id(id)
if avatar.is_empty():
return "res://art/crumb_head.png"
return str(avatar.get("path", "res://art/crumb_head.png"))
static func head_path(id: String) -> String:
if id == "crumb":
return "res://art/crumb_head.png"
return "res://art/guests/heads/%s.png" % id
static func is_unlocked(id: String) -> bool:
if id == "crumb":
return true
var avatar := by_id(id)
if avatar.is_empty():
return false
return SaveGame.is_guest_unlocked(id)
static func requirement_text(id: String) -> String:
var avatar := by_id(id)
if avatar.is_empty():
return ""
if id == "crumb":
return "Always available"
return "Meet in Room %d" % int(avatar.get("room", 0))