Merge remote-tracking branch 'origin/main' into localisation

This commit is contained in:
kanym 2026-11-13 17:08:48 +01:00
commit b1f3a6d666
9 changed files with 49 additions and 108 deletions

View file

@ -0,0 +1,32 @@
using UnityEngine;
using BepInEx.Configuration;
namespace RacesOfValheim
{
/// <summary>
/// The mod-wide debug switches, in one "Debug" section rather than one per race. Bound last
/// from RacesOfValheim.Awake(), so Configuration Manager lists the section at the bottom.
///
/// Every entry stays local (never synced from the server): ConfigSync leaves KeyboardShortcut
/// entries and any key containing "debug" alone, so keep "Debug" in the key names.
/// </summary>
public static class DebugConfig
{
public static ConfigEntry<bool> EnableDebugKey;
public static ConfigEntry<KeyboardShortcut> DebugKey;
public static ConfigEntry<bool> LogFormHits;
public static void Bind(ConfigFile config)
{
const string section = "Debug";
EnableDebugKey = config.Bind(section, "Debug: Enable Debug Key", false,
new ConfigDescription("Turns on the debug key below. Leave it off unless you are sending a bug report."));
DebugKey = config.Bind(section, "Debug Key", new KeyboardShortcut(KeyCode.F8),
new ConfigDescription("Toggles the melee reach readout (top left and log) and writes what the Alfar drones and the camera's target are doing to the log."));
// Was "Fenrir - Debug" / "Debug: Log Form Hits" until v1.6.10. It covers the Skadi,
// Sverm and Trol forms too (FormMelee.LogHit), so it moved here.
LogFormHits = config.Bind(section, "Debug: Log Form Hits", false,
new ConfigDescription("Writes one log line per form claw, bite or swing: what was in reach, what it hit, and why anything was skipped. For bug reports about attacks that do no damage."));
}
}
}

View file

@ -100,9 +100,6 @@ namespace RacesOfValheim
public static ConfigEntry<float> UlvAttackRadius; public static ConfigEntry<float> UlvAttackRadius;
public static ConfigEntry<float> UlvPushForce; public static ConfigEntry<float> UlvPushForce;
// ─── Debug ─────────────────────────────────────────────────────────────
public static ConfigEntry<bool> DebugFormHits;
// ─── Appearance (per player, never synced) ────────────────────────────── // ─── Appearance (per player, never synced) ──────────────────────────────
public static ConfigEntry<bool> ReadyMessage; public static ConfigEntry<bool> ReadyMessage;
public static ConfigEntry<bool> EyeGlow; public static ConfigEntry<bool> EyeGlow;
@ -268,10 +265,6 @@ namespace RacesOfValheim
// Tried at 1.2 in game: the orange was too strong. 0.9 checked and kept. // Tried at 1.2 in game: the orange was too strong. 0.9 checked and kept.
EyeReadyStrength = config.Bind(appearance, "Eye Ready Strength", 0.9f, EyeReadyStrength = config.Bind(appearance, "Eye Ready Strength", 0.9f,
new ConfigDescription("Glow at night while a form is ready.", new AcceptableValueRange<float>(0f, 3f))); new ConfigDescription("Glow at night while a form is ready.", new AcceptableValueRange<float>(0f, 3f)));
// "debug" in the key keeps it local - see ConfigSync.
DebugFormHits = config.Bind("Fenrir - Debug", "Debug: Log Form Hits", false,
new ConfigDescription("Writes one log line per claw or bite: what was in reach, what it hit, and why anything was skipped. For bug reports about attacks that do no damage."));
} }
/// <summary> /// <summary>

View file

@ -342,7 +342,7 @@ namespace RacesOfValheim
/// </summary> /// </summary>
public static void LogMiss(string form, Collider hit, string reason) public static void LogMiss(string form, Collider hit, string reason)
{ {
if (!FenrirConfig.DebugFormHits.Value) return; if (!DebugConfig.LogFormHits.Value) return;
Jotunn.Logger.LogInfo($"[FenrirForm] {form} swing skipped '{hit.name}' (layer {LayerMask.LayerToName(hit.gameObject.layer)}): {reason}."); Jotunn.Logger.LogInfo($"[FenrirForm] {form} swing skipped '{hit.name}' (layer {LayerMask.LayerToName(hit.gameObject.layer)}): {reason}.");
} }
@ -436,14 +436,14 @@ namespace RacesOfValheim
public static void LogHit(string form, IDestructible target, float damage) public static void LogHit(string form, IDestructible target, float damage)
{ {
if (!FenrirConfig.DebugFormHits.Value) return; if (!DebugConfig.LogFormHits.Value) return;
string name = target is MonoBehaviour behaviour && behaviour != null ? behaviour.name : target.ToString(); string name = target is MonoBehaviour behaviour && behaviour != null ? behaviour.name : target.ToString();
Jotunn.Logger.LogInfo($"[FenrirForm] {form} swing hit '{name}' for {damage:0}."); Jotunn.Logger.LogInfo($"[FenrirForm] {form} swing hit '{name}' for {damage:0}.");
} }
public static void LogSwing(string form, int candidates) public static void LogSwing(string form, int candidates)
{ {
if (!FenrirConfig.DebugFormHits.Value) return; if (!DebugConfig.LogFormHits.Value) return;
Jotunn.Logger.LogInfo($"[FenrirForm] {form} swing: {candidates} collider(s) in reach."); Jotunn.Logger.LogInfo($"[FenrirForm] {form} swing: {candidates} collider(s) in reach.");
} }
} }

View file

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

View file

@ -115,13 +115,14 @@ namespace RacesOfValheim
} }
} }
/// <summary>F8 turns the reach readout on and off.</summary> /// <summary>The debug key (DebugConfig, F8 by default) turns the reach readout on and off.</summary>
[HarmonyPatch(typeof(Player), "Update")] [HarmonyPatch(typeof(Player), "Update")]
internal static class RaceMeleeReachDebugKey internal static class RaceMeleeReachDebugKey
{ {
private static void Postfix(Player __instance) private static void Postfix(Player __instance)
{ {
if (__instance != Player.m_localPlayer || !Input.GetKeyDown(KeyCode.F8)) return; if (__instance != Player.m_localPlayer || !DebugConfig.EnableDebugKey.Value) return;
if (!DebugConfig.DebugKey.Value.IsDownIgnoringHeldKeys()) return;
RaceMeleeReach.DebugOn = !RaceMeleeReach.DebugOn; RaceMeleeReach.DebugOn = !RaceMeleeReach.DebugOn;
__instance.Message(MessageHud.MessageType.TopLeft, $"[RoV reach] debug {(RaceMeleeReach.DebugOn ? "on" : "off")}"); __instance.Message(MessageHud.MessageType.TopLeft, $"[RoV reach] debug {(RaceMeleeReach.DebugOn ? "on" : "off")}");
AlfarMiner.DebugReport(__instance); AlfarMiner.DebugReport(__instance);

View file

@ -16,7 +16,7 @@ namespace RacesOfValheim
{ {
public const string PluginGUID = "com.nandor.racesofvalheim"; public const string PluginGUID = "com.nandor.racesofvalheim";
public const string PluginName = "Races Of Valheim"; public const string PluginName = "Races Of Valheim";
public const string PluginVersion = "1.6.10"; public const string PluginVersion = "1.6.11";
private readonly Harmony harmony = new Harmony(PluginGUID); private readonly Harmony harmony = new Harmony(PluginGUID);
@ -57,6 +57,8 @@ namespace RacesOfValheim
// Not a race either: the faction truce and the faction merchants, which cut across // Not a race either: the faction truce and the faction merchants, which cut across
// every race at once, so they bind last rather than inside the alphabetical run above. // every race at once, so they bind last rather than inside the alphabetical run above.
FactionsConfig.Bind(Config); FactionsConfig.Bind(Config);
// The mod-wide debug switches, at the bottom of the list on purpose.
DebugConfig.Bind(Config);
// After every Bind above: tags the gameplay entries for Jotunn's server-to-client sync. // After every Bind above: tags the gameplay entries for Jotunn's server-to-client sync.
ConfigSync.Apply(Config); ConfigSync.Apply(Config);
harmony.PatchAll(); harmony.PatchAll();

View file

@ -252,97 +252,6 @@ namespace RacesOfValheim
return bestCombo; return bestCombo;
} }
private void DumpTransformHierarchy(Transform t, string indent)
{
if (t == null) return;
Jotunn.Logger.LogInfo(indent + t.name + " (Active: " + t.gameObject.activeSelf + ")");
for(int i = 0; i < t.childCount; i++)
{
DumpTransformHierarchy(t.GetChild(i), indent + " ");
}
}
/// <summary>
/// F8 debug: fires a ray from the camera and logs whatever it hits. Cosmetic pieces
/// (hair, beard, helmet) carry no collider, so this mostly confirms terrain/creature hits
/// - LogHeadCosmeticsState below is what actually answers "what is that floating chunk."
/// Kept anyway because it is the general-purpose "what am I looking at" tool for any other
/// bone or prefab placement question that comes up later.
/// </summary>
private void LogRaycastHit()
{
Camera cam = Camera.main;
if (cam == null)
{
Jotunn.Logger.LogInfo("[F8] No camera found for raycast.");
return;
}
Ray ray = new Ray(cam.transform.position, cam.transform.forward);
if (Physics.Raycast(ray, out RaycastHit hit, 50f))
{
Jotunn.Logger.LogInfo("--- F8 RAYCAST HIT ---");
Jotunn.Logger.LogInfo($"Collider: '{hit.collider.gameObject.name}' at {hit.point:F2}, distance={hit.distance:F2}");
Jotunn.Logger.LogInfo($"Full path: {GetFullPath(hit.collider.transform)}");
Renderer renderer = hit.collider.GetComponentInParent<Renderer>();
if (renderer != null)
{
Jotunn.Logger.LogInfo($"Nearest renderer: '{renderer.gameObject.name}' ({renderer.GetType().Name}), enabled={renderer.enabled}, scale={renderer.transform.lossyScale:F3}");
}
Jotunn.Logger.LogInfo("----------------------");
}
else
{
Jotunn.Logger.LogInfo("[F8] Raycast hit nothing within 50m (cosmetic pieces usually have no collider anyway).");
}
}
private static string GetFullPath(Transform t)
{
string path = t.name;
for (Transform parent = t.parent; parent != null; parent = parent.parent)
{
path = parent.name + "/" + path;
}
return path;
}
/// <summary>
/// F8 debug: dumps the exact state of the three item slots this race hides (hair, beard,
/// helmet) - active flag, renderer enabled flag and scale for every renderer underneath.
/// This is the direct answer to "what is still visible and why": a chunk that survives
/// hiding will show up here as active=true, or as a renderer with enabled=true even while
/// its wrapper is scaled to zero (the skinned-mesh case scale alone cannot hide).
/// </summary>
private void LogHeadCosmeticsState()
{
if (Player.m_localPlayer == null) return;
VisEquipment vis = Player.m_localPlayer.GetComponent<VisEquipment>();
if (vis == null) return;
Jotunn.Logger.LogInfo("--- F8 SKELETON HEAD COSMETICS ---");
DumpItemInstanceField(vis, "m_hairItemInstance");
DumpItemInstanceField(vis, "m_beardItemInstance");
DumpItemInstanceField(vis, "m_helmetItemInstance");
Jotunn.Logger.LogInfo("----------------------------------");
}
private static void DumpItemInstanceField(VisEquipment vis, string fieldName)
{
GameObject go = HarmonyLib.Traverse.Create(vis).Field<GameObject>(fieldName).Value;
if (go == null)
{
Jotunn.Logger.LogInfo($"[F8] {fieldName}: null (nothing equipped/instantiated).");
return;
}
Jotunn.Logger.LogInfo($"[F8] {fieldName}: '{go.name}' active={go.activeSelf} scale={go.transform.localScale:F3}");
foreach (Renderer r in go.GetComponentsInChildren<Renderer>(true))
{
Jotunn.Logger.LogInfo($"[F8] renderer '{r.gameObject.name}' ({r.GetType().Name}) enabled={r.enabled}");
}
}
private void Update() private void Update()
{ {
if (Player.m_localPlayer == null) return; if (Player.m_localPlayer == null) return;

View file

@ -15,9 +15,9 @@ Support the mod: [Patreon — NandorTheModder](https://www.patreon.com/c/NandorT
--- ---
## New in v1.6.10 ## New in v1.6.11
**Drake forms hit the training dummy, the Ravager hits like a Brute, and the Alfar stay off the roof.** Skadi's Moder and Fader melee could never hit the training dummy and landed before the animation did. The Ravager's attacks play the Brute's sounds and grow with Unarmed. Skrid no longer blinks an Alfr onto the roof of a crypt or cave, and swapping items no longer flashes their hair and beard. Full details in the [changelog](#v1610). **F8 no longer fires by accident.** The debug key now lives in a new `Debug` section of the config. It's off until you turn it on, and you can rebind it. Heads-up: `Debug: Log Form Hits` moved there from `Fenrir - Debug`, so if you had turned it on, turn it on again. Full details in the [changelog](#v1611).
--- ---
@ -492,6 +492,10 @@ Both halves have an off switch under `Factions` in Configuration Manager: **Fact
## Changelog ## Changelog
### v1.6.11
- **Heads-up - config key moved:** `Fenrir - Debug` → `Debug: Log Form Hits` is now `Debug` → `Debug: Log Form Hits`. If you had turned it on, turn it on again in Configuration Manager. The old entry stays in your .cfg but does nothing; delete it by hand if you like.
- **Change - the debug key is off by default and can be rebound:** F8 used to toggle the melee reach readout and write Alfar drone reports to the log for everyone, with no way to turn it off. It now sits in a new `Debug` section: `Debug: Enable Debug Key` (off by default) turns it on, and `Debug Key` (F8 by default) rebinds it. `Debug: Log Form Hits` moved into the same section, since it logs the Skadi, Sverm and Trol forms as well as the Fenrir ones. Thanks to Dagaz for the request. Not tested in game yet.
### v1.6.10 ### v1.6.10
- **Fix - Skadi's Moder and Fader forms couldn't hit the training dummy:** their bites, claws and spin checked for cover with a line that counted the target's own body as a wall. Anything standing on the build layer, like the T.W.I.G. training dummy, could never be hit; wildlife worked. They now use the same reach check as the Fenrir forms, and each hit plays the real dragon's impact sound. The blow also lands on the clip's own hit frame instead of a fixed half second, which was early for every melee: the Moder's claws landed a second and a half before the claw came down. Thanks to lexsonn for the report. Not tested in game yet. - **Fix - Skadi's Moder and Fader forms couldn't hit the training dummy:** their bites, claws and spin checked for cover with a line that counted the target's own body as a wall. Anything standing on the build layer, like the T.W.I.G. training dummy, could never be hit; wildlife worked. They now use the same reach check as the Fenrir forms, and each hit plays the real dragon's impact sound. The blow also lands on the clip's own hit frame instead of a fixed half second, which was early for every melee: the Moder's claws landed a second and a half before the claw came down. Thanks to lexsonn for the report. Not tested in game yet.
- **Change - Ravager Strain fights like the troll True Form:** the Brute's swing and impact sounds play on the bite, ram and slam, which were silent. Every attack that lands on a creature trains Unarmed, and the damage now grows with it the way a weapon grows with its skill: about 40% of a real Seeker Brute's at level 0, about 92% at level 100. The new key `Sverm - Ravager Strain` → `Ravager Attack Damage` (default 1) multiplies it. The bite and the ram now stay in front of you and no longer hit through walls, and each attack uses the Brute's own push and tool tier. Thanks to lexsonn for the report. Not tested in game yet. - **Change - Ravager Strain fights like the troll True Form:** the Brute's swing and impact sounds play on the bite, ram and slam, which were silent. Every attack that lands on a creature trains Unarmed, and the damage now grows with it the way a weapon grows with its skill: about 40% of a real Seeker Brute's at level 0, about 92% at level 100. The new key `Sverm - Ravager Strain` → `Ravager Attack Damage` (default 1) multiplies it. The bite and the ram now stay in front of you and no longer hit through walls, and each attack uses the Brute's own push and tool tier. Thanks to lexsonn for the report. Not tested in game yet.

View file

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