Fix depth mask interaction with part repairs

This commit is contained in:
Andrew Cassidy 2021-01-15 21:36:03 -08:00
parent 7fcb091c5f
commit af43cd8f70
2 changed files with 8 additions and 0 deletions

View File

@ -44,12 +44,14 @@ namespace Restock
// the part variant system is implemented extremely stupidly
// so we have to make this whole module more complicated as a result
GameEvents.onVariantApplied.Add(OnVariantApplied);
GameEvents.onPartRepaired.Add(OnPartRepaired);
}
private void OnDestroy()
{
GameEvents.onVariantApplied.Remove(OnVariantApplied);
GameEvents.onPartRepaired.Remove(OnPartRepaired);
}
@ -95,6 +97,12 @@ namespace Restock
if (appliedPart == this.part) UpdateAllMaterials();
}
public void OnPartRepaired(Part repairedPart)
{
// Part repair resets part of the mesh from the prefab, so it needs to be reapplied
if (repairedPart == this.part) UpdateAllMaterials();
}
private void UpdateAllMaterials()
{