Fix depth mask interaction with part repairs

pull/932/head
Andrew Cassidy 3 years ago
parent 7fcb091c5f
commit af43cd8f70

@ -44,12 +44,14 @@ namespace Restock
// the part variant system is implemented extremely stupidly // the part variant system is implemented extremely stupidly
// so we have to make this whole module more complicated as a result // so we have to make this whole module more complicated as a result
GameEvents.onVariantApplied.Add(OnVariantApplied); GameEvents.onVariantApplied.Add(OnVariantApplied);
GameEvents.onPartRepaired.Add(OnPartRepaired);
} }
private void OnDestroy() private void OnDestroy()
{ {
GameEvents.onVariantApplied.Remove(OnVariantApplied); GameEvents.onVariantApplied.Remove(OnVariantApplied);
GameEvents.onPartRepaired.Remove(OnPartRepaired);
} }
@ -95,6 +97,12 @@ namespace Restock
if (appliedPart == this.part) UpdateAllMaterials(); 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() private void UpdateAllMaterials()
{ {

Loading…
Cancel
Save