Initial commit

This commit is contained in:
Ferdinando 2026-07-30 19:00:13 +02:00
commit c4a24c9fdf
142 changed files with 15491 additions and 0 deletions

View file

@ -0,0 +1,54 @@
using UnityEngine;
using Jotunn.Managers;
namespace RacesOfValheim
{
public class BatFormBehavior : MonoBehaviour
{
private Animator anim;
private AswidProgression.FormRules formRules;
public void Initialize(AswidProgression.FormRules rules)
{
this.formRules = rules;
}
private void Start()
{
anim = GetComponentInChildren<Animator>();
if (Player.m_localPlayer != null)
{
HarmonyLib.Traverse.Create(Player.m_localPlayer).Field("m_debugFly").SetValue(true);
}
}
private void Update()
{
if (Player.m_localPlayer == null || Player.m_localPlayer.IsDead()) return;
// Ensure flight remains on continuously
HarmonyLib.Traverse.Create(Player.m_localPlayer).Field("m_debugFly").SetValue(true);
// Sync Animator
if (anim != null)
{
Vector3 vel = Player.m_localPlayer.GetVelocity();
vel.y = 0f;
float speed = vel.magnitude;
// Bats don't necessarily have a complex animator like players,
// but if they do have a speed or flying parameter, we set it here.
anim.SetFloat("forward_speed", speed);
anim.SetBool("flying", true);
}
}
private void OnDestroy()
{
if (Player.m_localPlayer != null)
{
HarmonyLib.Traverse.Create(Player.m_localPlayer).Field("m_debugFly").SetValue(false);
}
}
}
}