aswig and multiplayer fixes
This commit is contained in:
parent
d25800eca4
commit
1bdf77e8d6
6 changed files with 102 additions and 49 deletions
|
|
@ -77,6 +77,10 @@ namespace RacesOfValheim
|
|||
{
|
||||
UpdateAswidVisuals();
|
||||
}
|
||||
else if (race == "Trol")
|
||||
{
|
||||
// Managed externally in TrolPatches.cs
|
||||
}
|
||||
else
|
||||
{
|
||||
RevertAllVisuals();
|
||||
|
|
@ -230,44 +234,6 @@ namespace RacesOfValheim
|
|||
$"[SkadiSync] remote '{m_player.GetPlayerName()}' form='{currentForm}' flying={flying} " +
|
||||
$"y={m_player.transform.position.y:F1} gravity={(body != null ? body.useGravity.ToString() : "no-body")}");
|
||||
}
|
||||
|
||||
if (currentForm != m_lastSkadiForm)
|
||||
{
|
||||
// Form changed
|
||||
if (m_currentFormInstance != null) Destroy(m_currentFormInstance);
|
||||
|
||||
Transform playerVisual = m_player.transform.Find("Visual");
|
||||
if (playerVisual != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(currentForm))
|
||||
{
|
||||
playerVisual.localScale = Vector3.one;
|
||||
}
|
||||
else
|
||||
{
|
||||
playerVisual.localScale = Vector3.one * 0.001f;
|
||||
GameObject prefab = Jotunn.Managers.PrefabManager.Cache.GetPrefab<GameObject>(currentForm);
|
||||
if (prefab != null)
|
||||
{
|
||||
Transform visual = prefab.transform.Find("Visual");
|
||||
if (visual != null)
|
||||
{
|
||||
m_currentFormInstance = Instantiate(visual.gameObject, m_player.transform);
|
||||
m_currentFormInstance.transform.localPosition = Vector3.zero;
|
||||
m_currentFormInstance.transform.localRotation = Quaternion.identity;
|
||||
Component animEvent = m_currentFormInstance.GetComponent("AnimEvent");
|
||||
if (animEvent != null) Destroy(animEvent);
|
||||
|
||||
foreach (var col in m_currentFormInstance.GetComponentsInChildren<Collider>())
|
||||
{
|
||||
Destroy(col);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_lastSkadiForm = currentForm;
|
||||
}
|
||||
}
|
||||
|
||||
private void RevertAllVisuals()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue