WIP checkpoint: Implement avatar loader and customization UI in Godot
This commit is contained in:
@@ -56,10 +56,10 @@ func load_catalog(path: String = _catalog_path) -> Error:
|
|||||||
return OK
|
return OK
|
||||||
|
|
||||||
|
|
||||||
## Get the metadata for an asset by its ID.
|
## Resolve an asset by its ID.
|
||||||
## Returns a Dictionary with keys: type, slot, path, version, etc.
|
## Returns a Dictionary with keys: type, slot, path, version, etc.
|
||||||
## Returns null if the asset ID is not found.
|
## Returns null if the asset ID is not found.
|
||||||
func get_asset(id: String) -> Dictionary:
|
func resolve(id: String) -> Dictionary:
|
||||||
if not _loaded:
|
if not _loaded:
|
||||||
return {}
|
return {}
|
||||||
return _catalog.get(id, {})
|
return _catalog.get(id, {})
|
||||||
@@ -86,7 +86,7 @@ func get_assets_by_slot(slot: String) -> Array[String]:
|
|||||||
|
|
||||||
|
|
||||||
## Get all asset IDs in the catalog.
|
## Get all asset IDs in the catalog.
|
||||||
func get_all_asset_ids() -> Array[String]:
|
func get_all_ids() -> Array[String]:
|
||||||
if not _loaded:
|
if not _loaded:
|
||||||
return []
|
return []
|
||||||
return _catalog.keys()
|
return _catalog.keys()
|
||||||
@@ -103,7 +103,7 @@ func validate_loadout(loadout: AvatarLoadout) -> Dictionary:
|
|||||||
elif not has_asset(loadout.base_body):
|
elif not has_asset(loadout.base_body):
|
||||||
errors.append("Unknown base_body asset: %s" % loadout.base_body)
|
errors.append("Unknown base_body asset: %s" % loadout.base_body)
|
||||||
else:
|
else:
|
||||||
var base: Dictionary = get_asset(loadout.base_body)
|
var base: Dictionary = resolve(loadout.base_body)
|
||||||
if base.get("type") != "base_body":
|
if base.get("type") != "base_body":
|
||||||
errors.append("base_body asset '%s' is not type 'base_body'" % loadout.base_body)
|
errors.append("base_body asset '%s' is not type 'base_body'" % loadout.base_body)
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ func validate_loadout(loadout: AvatarLoadout) -> Dictionary:
|
|||||||
if not has_asset(item_id):
|
if not has_asset(item_id):
|
||||||
errors.append("Unknown accessory asset: %s" % item_id)
|
errors.append("Unknown accessory asset: %s" % item_id)
|
||||||
else:
|
else:
|
||||||
var asset: Dictionary = get_asset(item_id)
|
var asset: Dictionary = resolve(item_id)
|
||||||
if asset.get("slot") != slot_id:
|
if asset.get("slot") != slot_id:
|
||||||
errors.append("Accessory '%s' slot '%s' does not match slot '%s'" % [
|
errors.append("Accessory '%s' slot '%s' does not match slot '%s'" % [
|
||||||
item_id, asset.get("slot"), slot_id
|
item_id, asset.get("slot"), slot_id
|
||||||
@@ -136,7 +136,7 @@ func validate_loadout(loadout: AvatarLoadout) -> Dictionary:
|
|||||||
if not has_asset(slot_value):
|
if not has_asset(slot_value):
|
||||||
errors.append("Unknown asset in slot '%s': %s" % [slot_id, slot_value])
|
errors.append("Unknown asset in slot '%s': %s" % [slot_id, slot_value])
|
||||||
else:
|
else:
|
||||||
var asset: Dictionary = get_asset(slot_value)
|
var asset: Dictionary = resolve(slot_value)
|
||||||
if asset.get("slot") != slot_id:
|
if asset.get("slot") != slot_id:
|
||||||
errors.append("Asset '%s' slot '%s' does not match slot '%s'" % [
|
errors.append("Asset '%s' slot '%s' does not match slot '%s'" % [
|
||||||
slot_value, asset.get("slot"), slot_id
|
slot_value, asset.get("slot"), slot_id
|
||||||
|
|||||||
Reference in New Issue
Block a user