diff --git a/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll b/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll index ed2407b9..07933d32 100644 Binary files a/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll and b/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll differ diff --git a/Source/Restock/ModuleRestockLinkedMesh.cs b/Source/Restock/ModuleRestockLinkedMesh.cs index 7d241271..39cf0d15 100644 --- a/Source/Restock/ModuleRestockLinkedMesh.cs +++ b/Source/Restock/ModuleRestockLinkedMesh.cs @@ -17,7 +17,7 @@ namespace Restock // reference to the material we will be modifying - private Material pipeMaterial; + private Material[] pipeMaterials; // array of property IDs corresponding to the textures private int[] pipeMaterialIDs; @@ -33,8 +33,13 @@ namespace Restock { base.OnStart(state); - // only the first material we find is used. complicates things otherwise - pipeMaterial = line.GetComponentInChildren().material; + // get all materials on the line object, including disabled ones + var renderers = line.GetComponentsInChildren(true); + pipeMaterials = new Material[renderers.Length]; + for (int i = 0; i < renderers.Length; i++) + { + pipeMaterials[i] = renderers[i].material; + } // split texture list and convert to property IDs for easy access var texNames = stretchTextures.Split(' '); @@ -74,10 +79,13 @@ namespace Restock var stretch = line.localScale.z; var scaleVect = Vector2.one; scaleVect[pipeStretchIndex] = stretch / baseStretch; - - foreach (var t in pipeMaterialIDs) + + foreach (var material in pipeMaterials) { - pipeMaterial.SetTextureScale(t, scaleVect); + foreach (var id in pipeMaterialIDs) + { + material.SetTextureScale(id, scaleVect); + } } } }