chore(release): v1.4.0 - Factions, Configuration Manager, Trol log-grab fix
Documents everything that landed on main since 1.3.12 (Factions peace + merchants, BepInEx Configuration Manager across all nine races, Dvergar/Aswid eye glow, Skeleton head-visibility and menu-preview fixes) and bumps the version accordingly. Also fixes a real bug found while writing this changelog: Trol's True Form log-grab was piggybacked on pressing the True Form key a second time, with no on-screen hint it existed. It now has its own keybind (default E, configurable like every other race's keys) and a proper crosshair prompt patched onto vanilla's own HoverText component - the first attempt added a second, competing Hoverable component to the log and it was silently never reached, since Unity's GetComponentInParent<Hoverable>() only returns the first match and vanilla's own HoverText was already on the object.
This commit is contained in:
parent
a0f0b46579
commit
851247ea60
7 changed files with 84 additions and 16 deletions
|
|
@ -94,4 +94,35 @@ namespace RacesOfValheim
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A fallen log already shows a hover prompt in vanilla - its own name, via a HoverText
|
||||
/// component vanilla itself attaches (confirmed live: GetComponentInParent<Hoverable>()
|
||||
/// on a log resolves to HoverText, not TreeLog itself, which only implements IDestructible).
|
||||
/// A first attempt added a second, competing Hoverable component to the same GameObject and
|
||||
/// it was never reached - Unity's GetComponentInParent<T>() returns only the first
|
||||
/// match, and vanilla's own HoverText was already there first. The fix is to append to
|
||||
/// HoverText's own result instead of trying to out-compete it.
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(HoverText), "GetHoverText")]
|
||||
public static class Trol_LogHoverText_Patch
|
||||
{
|
||||
public static void Postfix(HoverText __instance, ref string __result)
|
||||
{
|
||||
if (Player.m_localPlayer == null || !TrolRace.IsTrol()) return;
|
||||
if (BossProgressionManager.GetCurrentProgressionState() < 7) return;
|
||||
if (!Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_TrolTrueForm".GetStableHashCode())) return;
|
||||
|
||||
TreeLog log = ((Component)__instance).GetComponentInParent<TreeLog>();
|
||||
if (log == null) return;
|
||||
|
||||
// Already holding a log - grabbing again is a no-op in TrolLogWeapon.GrabLog, so no
|
||||
// prompt either.
|
||||
ItemDrop.ItemData rightItem = HarmonyLib.Traverse.Create(Player.m_localPlayer).Field<ItemDrop.ItemData>("m_rightItem").Value;
|
||||
if (rightItem != null && rightItem.m_dropPrefab != null && rightItem.m_dropPrefab.name.StartsWith("TrolWeapon_")) return;
|
||||
|
||||
string key = TrolConfig.GrabLogKey.Value.MainKey.ToString();
|
||||
__result += $"\n[<color=yellow><b>{key}</b></color>] Grab Log";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue