From 2f64bcfc38901297749661f830a6131db334ab63 Mon Sep 17 00:00:00 2001 From: kanym Date: Tue, 29 Sep 2026 04:55:23 +0200 Subject: [PATCH] fix(trol): the grabbed log keeps its own size in True Form Its 0.4 scale was set by eye on the size it had before held items started following the model, so in True Form it came out two and a half times too big. HeldItemScaleFix now leaves TrolWeapon_* alone. --- JotunnModStub/HeldItemScaleFix.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/JotunnModStub/HeldItemScaleFix.cs b/JotunnModStub/HeldItemScaleFix.cs index 736c706..b3fdf1d 100644 --- a/JotunnModStub/HeldItemScaleFix.cs +++ b/JotunnModStub/HeldItemScaleFix.cs @@ -31,6 +31,10 @@ namespace RacesOfValheim /// /// Armor (attach_skin) is skinned to the body's bones and follows them whatever its own scale, /// so it is left alone. So are creatures: this is for players only. + /// + /// The Trol's grabbed log (TrolWeapon_*) is left alone too. It is only ever held in True Form, + /// and its 0.4 scale was set by eye on the size it had there before this fix; scaled with the + /// model it came out two and a half times too big. /// [HarmonyPatch(typeof(VisEquipment), "AttachItem")] internal static class HeldItemScaleFix @@ -38,10 +42,13 @@ namespace RacesOfValheim private static readonly AccessTools.FieldRef Visual = AccessTools.FieldRefAccess("m_visual"); - private static void Postfix(VisEquipment __instance, GameObject __result) + private static void Postfix(VisEquipment __instance, GameObject __result, int itemHash) { if (__result == null || !__instance.m_isPlayer) return; + GameObject itemPrefab = ObjectDB.instance != null ? ObjectDB.instance.GetItemPrefab(itemHash) : null; + if (itemPrefab != null && itemPrefab.name.StartsWith("TrolWeapon_")) return; + Transform joint = __result.transform.parent; if (joint == null) return; if (__instance.m_bodyModel != null && joint == __instance.m_bodyModel.transform.parent) return;