fix(fenrir): source the taunt howl from the real creature's alert bark

sfx_wolf_howl/sfx_wolf_alert/sfx_fenring_idle never resolved to anything
playable - wolves carry no standalone howl prefab. Reads
BaseAI.m_alertedEffects off the live Fenring/Fenring_Cultist prefabs
instead, the same effect the creature itself plays going on alert.

Still reported silent in testing; leaving it in as a step in the right
direction rather than reverting.
This commit is contained in:
kanym 2026-08-09 18:31:33 +02:00
commit 10e55aff3e

View file

@ -9,6 +9,36 @@ using UnityEngine.UI; // Added for UI
namespace RacesOfValheim
{
/// <summary>
/// Howl vocalisation, borrowed from the real creature instead of guessed at. Wolves and their
/// kin do not carry a standalone "sfx_wolf_howl"-style prefab that PlaySFX's
/// PrefabManager.Cache lookup could ever find - dumpdverger's own hierarchy dump for
/// Fenring_Cultist shows no ZSFX anywhere on it.
///
/// BaseAI.m_idleSound was the first guess and was wrong in a quieter way: it is real, but it
/// is the creature's passive ambient noise (DoIdleSound, on a timer while it is doing nothing
/// in particular) - a small grunt, not a howl, and it played back sounding like whatever
/// generic "the form did something" cue the transformation itself already uses. What a
/// creature actually vocalises WHEN IT SPOTS SOMETHING is BaseAI.m_alertedEffects, fired from
/// SetAlerted(true) - reading that off the real "Fenring"/"Fenring_Cultist" prefab and calling
/// Create() plays the same aggressive bark the creature itself makes going on alert.
/// </summary>
internal static class FenrirCreatureSound
{
public static void PlayHowl(string sourcePrefabName, Vector3 position)
{
GameObject source = PrefabManager.Cache.GetPrefab<GameObject>(sourcePrefabName);
BaseAI ai = source != null ? source.GetComponent<BaseAI>() : null;
if (ai == null || ai.m_alertedEffects == null)
{
Jotunn.Logger.LogWarning($"[FenrirForm] No BaseAI.m_alertedEffects found on '{sourcePrefabName}'.");
return;
}
ai.m_alertedEffects.Create(position, Quaternion.identity);
}
}
public class FenrirFormBehavior : MonoBehaviour
{
private Animator playerAnim;
@ -101,7 +131,7 @@ namespace RacesOfValheim
fenrirAnim.SetTrigger("attack_taunt");
PlaySFX("sfx_wolf_howl", "sfx_wolf_alert", "sfx_fenring_idle");
FenrirCreatureSound.PlayHowl("Fenring", Player.m_localPlayer.transform.position);
yield return new WaitForSeconds(2.0f);
@ -386,7 +416,7 @@ namespace RacesOfValheim
// Cultist ha una vera e propria animazione di "taunt"
cultistAnim.SetTrigger("attack_taunt");
PlaySFX("sfx_wolf_howl", "sfx_wolf_alert", "sfx_fenring_idle");
FenrirCreatureSound.PlayHowl("Fenring_Cultist", Player.m_localPlayer.transform.position);
// Durata approssimativa dell'animazione di taunt
yield return new WaitForSeconds(2.0f);