aswig and multiplayer fixes
This commit is contained in:
parent
d25800eca4
commit
1bdf77e8d6
6 changed files with 102 additions and 49 deletions
|
|
@ -76,6 +76,11 @@ namespace RacesOfValheim
|
|||
formInstance.name = wanted;
|
||||
formInstance.transform.localPosition = formName == "Hatchling" ? new Vector3(0f, -1.0f, 0f) : Vector3.zero;
|
||||
formInstance.transform.localRotation = Quaternion.identity;
|
||||
|
||||
if (formInstance.GetComponent<RemoteSkadiAnimator>() == null)
|
||||
{
|
||||
formInstance.AddComponent<RemoteSkadiAnimator>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -83,6 +88,34 @@ namespace RacesOfValheim
|
|||
}
|
||||
}
|
||||
|
||||
public class RemoteSkadiAnimator : MonoBehaviour
|
||||
{
|
||||
private Animator anim;
|
||||
private Player player;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
anim = GetComponent<Animator>();
|
||||
if (anim == null) anim = GetComponentInChildren<Animator>();
|
||||
player = GetComponentInParent<Player>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (anim == null || player == null) return;
|
||||
|
||||
bool flying = HarmonyLib.Traverse.Create(player).Field<bool>("m_flying").Value;
|
||||
bool grounded = !flying && player.IsOnGround();
|
||||
|
||||
anim.SetBool("onGround", grounded);
|
||||
anim.SetBool("flying", flying);
|
||||
|
||||
Vector3 vel = player.GetVelocity();
|
||||
vel.y = 0f;
|
||||
anim.SetFloat("forward_speed", vel.magnitude);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(SEMan), "AddStatusEffect", new System.Type[] { typeof(int), typeof(bool), typeof(int), typeof(float) })]
|
||||
public static class SkadiSEManPatch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -637,7 +637,7 @@ namespace RacesOfValheim
|
|||
|
||||
if (prefab != null && playerVisual != null)
|
||||
{
|
||||
playerVisual.localScale = Vector3.one * 0.001f;
|
||||
playerVisual.gameObject.SetActive(false);
|
||||
|
||||
Transform visual = prefab.transform.Find("Visual");
|
||||
if (visual != null)
|
||||
|
|
@ -726,6 +726,11 @@ namespace RacesOfValheim
|
|||
{
|
||||
playerVisual.localScale = Vector3.one;
|
||||
playerVisual.gameObject.SetActive(true);
|
||||
|
||||
ZSyncAnimation zanim = Player.m_localPlayer.GetComponent<ZSyncAnimation>();
|
||||
if (zanim != null) zanim.SetBool("sit", false);
|
||||
Animator anim = playerVisual.GetComponent<Animator>();
|
||||
if (anim != null) anim.SetBool("sit", false);
|
||||
}
|
||||
|
||||
isTransformed = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue