fix(fenrir): enter the Ulv's sleep by its real state path

scripts/dump_controller.py reads an AnimatorController's states and
transitions offline from Valheim's bundles with UnityPy. On
ulv_animator it shows the entry state "check sleeping" picks Sleep only
at start-up and Movement has no way back into it, so the bool alone
could never work. The cross-fade now targets "Base Layer.Sleep".
This commit is contained in:
kanym 2026-10-17 19:22:24 +02:00
commit e83c3c5d74
2 changed files with 111 additions and 3 deletions

View file

@ -50,7 +50,10 @@ namespace RacesOfValheim
private bool hasSleeping;
private int sleepState;
private bool wasSitting;
private static readonly string[] SleepStateNames = { "Sleep", "sleep", "Sleeping", "sleeping" };
// Read off ulv_animator with scripts/dump_controller.py: the entry state "check sleeping" goes
// to Sleep only at start-up, and Movement has no way back into it. "Base Layer.Sleep" is the
// real path; the short name stays as a fallback for another creature built the same way.
private static readonly string[] SleepStateNames = { "Base Layer.Sleep", "Sleep" };
private static readonly System.Collections.Generic.HashSet<string> sleepLogged = new System.Collections.Generic.HashSet<string>();
/// <summary>Copies the movement parameters, and says whether the form counts as grounded.</summary>
@ -91,8 +94,8 @@ namespace RacesOfValheim
if (p.type == AnimatorControllerParameterType.Bool && p.name == "sleeping") { hasSleeping = true; break; }
}
// The state's name is not readable at runtime, only testable: the clip is 'Sleep', and
// the state is most likely named after it.
// The state's name is not readable at runtime, only testable - but it is readable offline,
// see SleepStateNames.
sleepState = 0;
string found = "none";
if (hasSleeping)