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:
kanym 2026-08-07 09:56:16 +02:00
commit 851247ea60
7 changed files with 84 additions and 16 deletions

View file

@ -1,7 +1,7 @@
{
"name": "RacesOfValheim",
"description": "A Valheim mod that adds nine custom playable races (Aswid, Draugh, Dvergar, Fenrir, Furling, Skadi, Skeleton, Trenta, Trol) each with unique abilities, traits, and a deep boss-driven progression system.",
"version_number": "1.3.12",
"version_number": "1.4.0",
"website_url": "",
"dependencies": [
"denikson-BepInExPack_Valheim-5.4.2333",

View file

@ -15,7 +15,7 @@ namespace RacesOfValheim
{
public const string PluginGUID = "com.nandor.racesofvalheim";
public const string PluginName = "Races Of Valheim";
public const string PluginVersion = "1.3.12";
public const string PluginVersion = "1.4.0";
private readonly Harmony harmony = new Harmony(PluginGUID);

View file

@ -22,6 +22,7 @@ namespace RacesOfValheim
// ─── Keybinds ──────────────────────────────────────────────────────────
public static ConfigEntry<KeyboardShortcut> ThrowRockKey;
public static ConfigEntry<KeyboardShortcut> TrueFormKey;
public static ConfigEntry<KeyboardShortcut> GrabLogKey;
// ─── Passive combat ──────────────────────────────────────────────────
public static ConfigEntry<float> FireWeaknessMultiplier;
@ -65,6 +66,8 @@ namespace RacesOfValheim
new ConfigDescription("Throws a rock (or the log you're holding), tier 3+."));
TrueFormKey = config.Bind(keybinds, "True Form", new KeyboardShortcut(KeyCode.H),
new ConfigDescription("Transform into (or revert from) True Form, tier 5+."));
GrabLogKey = config.Bind(keybinds, "Grab Log", new KeyboardShortcut(KeyCode.E),
new ConfigDescription("Grabs a felled log as a weapon while looking at one, tier 7+ and already in True Form. Matches vanilla's own interact key rather than reusing the True Form key a second time."));
const string combat = "Trol - Passive Combat";
FireWeaknessMultiplier = config.Bind(combat, "Fire Weakness Multiplier", 1.5f,

View file

@ -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&lt;Hoverable&gt;()
/// 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&lt;T&gt;() 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";
}
}
}

View file

@ -130,6 +130,11 @@ namespace RacesOfValheim
{
TryTrueForm();
}
if (TrolConfig.GrabLogKey.Value.IsDown())
{
TryGrabLog();
}
}
// Check log durability
@ -176,18 +181,9 @@ namespace RacesOfValheim
if (Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_TrolTrueForm".GetStableHashCode()))
{
if (BossProgressionManager.GetCurrentProgressionState() >= 7)
{
GameObject hoverObj = Player.m_localPlayer.GetHoverObject();
if (hoverObj != null)
{
TreeLog log = hoverObj.GetComponentInParent<TreeLog>();
if (log != null)
{
TrolLogWeapon.GrabLog(Player.m_localPlayer, log);
}
}
}
// Grabbing a log now has its own key (TrolConfig.GrabLogKey, see TryGrabLog) -
// pressing True Form again while already transformed no longer tries to grab
// whatever you happen to be looking at.
return;
}
@ -205,6 +201,21 @@ namespace RacesOfValheim
}
}
private void TryGrabLog()
{
if (BossProgressionManager.GetCurrentProgressionState() < 7) return;
if (!Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_TrolTrueForm".GetStableHashCode())) return;
GameObject hoverObj = Player.m_localPlayer.GetHoverObject();
if (hoverObj == null) return;
TreeLog log = hoverObj.GetComponentInParent<TreeLog>();
if (log != null)
{
TrolLogWeapon.GrabLog(Player.m_localPlayer, log);
}
}
private System.Collections.IEnumerator TransformToTrueFormRoutine()
{
isTransforming = true;