jotunn 2.30 compatibility + minor bugs

This commit is contained in:
Ferdinando 2026-09-10 19:14:05 +02:00
commit ce671e7124
14 changed files with 107 additions and 49 deletions

View file

@ -195,14 +195,17 @@ namespace RacesOfValheim
public static readonly float SpineSizeSmall = 0.45f; // metres, state 5-6
public static readonly float SpineSizeFull = 0.80f; // metres, state 7+
/// <summary>
/// Which bone they ride. Spine3 and ONLY Spine3 - no fallback chain.
/// Which bone they ride. Spine2 and ONLY Spine2 - no fallback chain.
///
/// The earlier version tried Spine2, then Spine1, then Spine, on the theory that a missing
/// bone should degrade rather than disappear. On this rig all three exist, so the fallback
/// never fired for the right reason and only ever meant "somewhere on the back, roughly" -
/// which is not good enough for a crest that was positioned by eye. One bone, or nothing.
///
/// It was Spine3 until this was caught: the player rig counts Spine, Spine1 and Spine2 and has
/// no Spine3, so the crest never mounted anywhere and the only trace was a warning in the log.
/// </summary>
public const string SpineBoneName = "Spine3";
public const string SpineBoneName = "Spine2";
// Found in game with the crest on screen. A ribcage is authored lying around a body, so
// standing it up out of a back is a quarter turn on two axes - not something anybody was

View file

@ -239,7 +239,16 @@ namespace RacesOfValheim
SpineBoneName = config.Bind(spines, "Bone", SvermConfig.SpineBoneName,
"Which bone the spines ride. This bone and no other - there is no fallback, so a " +
"name that is not in the rig means no crest at all. Leave it blank to use " +
"Spine3.");
"Spine2.");
// Spine3 was the shipped default and is not a bone this rig has, so a .cfg still holding it
// has never shown a crest. BepInEx keeps the value in the file over a changed default, so
// without this the fix would only ever reach fresh installs. Nobody can have picked Spine3
// on purpose and seen it work, which is what makes overwriting it safe.
if (string.Equals(SpineBoneName.Value?.Trim(), "Spine3", System.StringComparison.OrdinalIgnoreCase))
{
SpineBoneName.Value = SvermConfig.SpineBoneName;
}
// Defaults are the values found in game with the crest on screen, not zeroes: changing
// nothing here now reproduces the placement that was actually approved.

View file

@ -542,19 +542,20 @@ namespace RacesOfValheim
if (!RaceInput.Allowed || !grounded) return;
// Right click rams, left click bites, middle click slams. All three read raw
// UnityEngine.Input rather than going anywhere near Humanoid.StartAttack, which
// Sverm_RavagerBlockNativeAttack_Patch refuses outright for the whole form - see the
// class doc for why that turned out to be the only reliable option.
if (Input.GetMouseButtonDown(1))
// Right click rams, left click bites, middle click slams. All three read the device
// directly (mouse, or its gamepad counterpart - see RaceInput.AttackDown) rather than
// going anywhere near Humanoid.StartAttack, which Sverm_RavagerBlockNativeAttack_Patch
// refuses outright for the whole form - see the class doc for why that turned out to
// be the only reliable option.
if (RaceInput.AttackDown(1))
{
StartCoroutine(AttackRoutine(SvermRavagerAttacks.Ram, 2f, 0.3f, 0.7f));
}
else if (Input.GetMouseButtonDown(0))
else if (RaceInput.AttackDown(0))
{
StartCoroutine(AttackRoutine(SvermRavagerAttacks.Bite, 2f, 0.3f, 0.6f));
}
else if (Input.GetMouseButtonDown(2))
else if (RaceInput.AttackDown(2))
{
StartCoroutine(AttackRoutine(SvermRavagerAttacks.Slam, 1.2f, 0.4f, 1.0f));
}

View file

@ -414,7 +414,7 @@ namespace RacesOfValheim
Transform bone = FindBone(player, SvermConfigManagement.Bone);
if (bone == null)
{
WarnMissingSpineBone();
WarnMissingSpineBone(player);
return;
}
@ -496,7 +496,7 @@ namespace RacesOfValheim
/// Said once, not forty times a minute. The cosmetic pass runs on a timer, so an
/// unqualified LogWarning here would bury the log in the time it takes to read it.
/// </summary>
private static void WarnMissingSpineBone()
private static void WarnMissingSpineBone(Player player)
{
if (warnedMissingSpineBone) return;
warnedMissingSpineBone = true;
@ -505,8 +505,10 @@ namespace RacesOfValheim
// the rig simply has no Spine3 - it counts Spine, Spine1, Spine2 - and there was no
// way to know that from a warning that only said what was missing.
System.Text.StringBuilder spine = new System.Text.StringBuilder();
Player local = Player.m_localPlayer;
VisEquipment visEq = local != null ? local.GetComponent<VisEquipment>() : null;
// Read off the player being dressed, not Player.m_localPlayer. On the main menu the one
// being dressed is the character preview and m_localPlayer is still null, so the old read
// answered "none found" about a rig that has three spine bones.
VisEquipment visEq = player != null ? player.GetComponent<VisEquipment>() : null;
if (visEq != null && visEq.m_bodyModel != null && visEq.m_bodyModel.bones != null)
{
foreach (Transform b in visEq.m_bodyModel.bones)