Update avatar_base implementation, assets and documentation

This commit is contained in:
cthangover committed 2026-10-31 15:28:48 +03:00
commit 1ac123dd1b
24 files changed
+862

No files matched your search

@@ -0,0 +1,26 @@
{
"Kind": "avatar",
"Items": [
{
"Id": "avatar_contracts/sample",
"Renderer": "test",
"Groups": {
"eyes_state": {
"Default": "opened",
"Presets": {
"opened": {
"Values": {
"eye": 1
}
},
"closed": {
"Values": {
"eye": 0
}
}
}
}
}
}
]
}
+12
View File
@@ -0,0 +1,12 @@
{
"id": "avatar_base__contracts",
"name": "Avatar resource contract tests",
"version": "1.0.0",
"author": "ct",
"depends": [
"avatar_base>=1"
],
"test_sources": [
"tests/*.cs"
]
}
@@ -0,0 +1,22 @@
using System.Collections.Generic;
using Cthangover.Core.Mods.Testing;
using Cthangover.Mods.Avatars;
namespace Cthangover.Mods.Avatars.Contracts
{
/// <summary>Exercises real Kind registration, mod entity resolution and independent catalog instances.</summary>
public sealed class AvatarCatalogTests
{
[ModTest("avatar_catalog/resolved_entity_creates_independent_instances")]
public static void Resource(ModTestContext ctx)
{
var first = AvatarCatalog.Create("avatar_contracts/sample");
var second = AvatarCatalog.Create("avatar_contracts/sample");
first.ApplyPresets(new Dictionary<string, string> { ["eyes_state"] = "closed" });
ModAssert.CloseTo(0, first.Resolve().Values["eye"].GetDouble());
ModAssert.CloseTo(1, second.Resolve().Values["eye"].GetDouble());
var restored = AvatarCatalog.Create("avatar_contracts/sample", first.CaptureState());
ModAssert.Equal("closed", restored.CaptureState().Presets["eyes_state"]);
}
}
}