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.
This commit is contained in:
parent
5027d2d84f
commit
2f64bcfc38
1 changed files with 8 additions and 1 deletions
|
|
@ -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.
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(VisEquipment), "AttachItem")]
|
||||
internal static class HeldItemScaleFix
|
||||
|
|
@ -38,10 +42,13 @@ namespace RacesOfValheim
|
|||
private static readonly AccessTools.FieldRef<VisEquipment, GameObject> Visual =
|
||||
AccessTools.FieldRefAccess<VisEquipment, GameObject>("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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue