Decompiled source of LocationsOfPrecipitation v1.1.2

plugins/LocationsOfPrecipitation.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Logging;
using RoR2;
using RoR2.Navigation;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace LOP;

[ExecuteAlways]
public class AddressableInjector : MonoBehaviour
{
	[Tooltip("The address used for injecting")]
	public string address;

	[NonSerialized]
	private Object _asset;

	[Tooltip("The component that will be injected")]
	[SerializeField]
	private Component targetComponent;

	[Tooltip("The member info that'll be injected")]
	[SerializeField]
	private string targetMemberInfoName;

	private MemberInfo cachedMemberInfo;

	public Object Asset
	{
		get
		{
			return _asset;
		}
		private set
		{
			_asset = value;
		}
	}

	private void OnEnable()
	{
		Refresh();
	}

	public void Refresh()
	{
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		if (string.IsNullOrWhiteSpace(address) || string.IsNullOrEmpty(address) || !Object.op_Implicit((Object)(object)targetComponent) || string.IsNullOrEmpty(targetMemberInfoName) || string.IsNullOrWhiteSpace(targetMemberInfoName))
		{
			return;
		}
		MemberInfo memberInfo = GetMemberInfo();
		if (!(memberInfo == null))
		{
			Object val = Addressables.LoadAssetAsync<Object>((object)address).WaitForCompletion();
			if (Object.op_Implicit(val))
			{
				Asset = val;
				Asset.hideFlags = (HideFlags)28;
				Inject(memberInfo);
			}
		}
	}

	private void Inject(MemberInfo memberInfo)
	{
		if (!(memberInfo is PropertyInfo propertyInfo2))
		{
			if (memberInfo is FieldInfo fieldInfo2)
			{
				InjectFieldInfo(fieldInfo2);
			}
		}
		else
		{
			InjectPropertyInfo(propertyInfo2);
		}
		void InjectFieldInfo(FieldInfo fieldInfo)
		{
			try
			{
				fieldInfo.SetValue(targetComponent, Asset);
			}
			catch (Exception data2)
			{
				LOPLog.Error(data2);
			}
		}
		void InjectPropertyInfo(PropertyInfo propertyInfo)
		{
			try
			{
				propertyInfo.SetValue(targetComponent, Asset);
			}
			catch (Exception data)
			{
				LOPLog.Error(data);
			}
		}
	}

	private MemberInfo GetMemberInfo()
	{
		if ((cachedMemberInfo == null || "(" + cachedMemberInfo.DeclaringType.Name + ") " + cachedMemberInfo.Name != targetMemberInfoName) && Object.op_Implicit((Object)(object)targetComponent))
		{
			cachedMemberInfo = ((object)targetComponent).GetType().GetMembers(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy).Where(delegate(MemberInfo m)
			{
				string name = m.GetType().Name;
				return name.Contains("Property") || name.Contains("Field");
			})
				.FirstOrDefault((MemberInfo m) => "(" + m.DeclaringType.Name + ") " + m.Name == targetMemberInfoName);
		}
		return cachedMemberInfo;
	}
}
[ExecuteAlways]
public class CameraInstantiator : MonoBehaviour
{
	public const string CAMERA_ADDRESS = "RoR2/Base/Core/Main Camera.prefab";

	[NonSerialized]
	private GameObject _cameraInstance;

	public GameObject CameraInstance
	{
		get
		{
			return _cameraInstance;
		}
		private set
		{
			_cameraInstance = value;
		}
	}

	private void OnEnable()
	{
		Refresh();
	}

	private void OnDisable()
	{
		LOPUtil.DestroyImmediateSafe((Object)(object)CameraInstance, allowDestroyingAssets: true);
	}

	public void Refresh()
	{
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		if (Application.isPlaying && !Application.isEditor)
		{
			LOPLog.Fatal($"Lingering camera injector in {((Component)this).gameObject}, Ensure that these scripts are NOT present on finalized builds!!!");
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		if (Object.op_Implicit((Object)(object)CameraInstance))
		{
			LOPUtil.DestroyImmediateSafe((Object)(object)CameraInstance, allowDestroyingAssets: true);
		}
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Core/Main Camera.prefab").WaitForCompletion();
		CameraInstance = Object.Instantiate<GameObject>(val, ((Component)this).transform);
		((Object)CameraInstance).name = "[EDITOR ONLY] " + ((Object)CameraInstance).name;
		GameObject cameraInstance = CameraInstance;
		((Object)cameraInstance).hideFlags = (HideFlags)(((Object)cameraInstance).hideFlags | 0x1C);
		Transform[] componentsInChildren = CameraInstance.GetComponentsInChildren<Transform>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			((Object)((Component)componentsInChildren[i]).gameObject).hideFlags = (HideFlags)(((Object)CameraInstance).hideFlags | 1);
		}
		GameObject cameraInstance2 = CameraInstance;
		((Object)cameraInstance2).hideFlags = (HideFlags)(((Object)cameraInstance2).hideFlags & -2);
	}
}
[ExecuteAlways]
public class InstantiateAddressablePrefab : MonoBehaviour
{
	[Tooltip("The address to use to load the prefab")]
	[SerializeField]
	private string address;

	[Tooltip("When the prefab is instantiated, and this is true, the prefab's position and rotation will be set to 0")]
	[SerializeField]
	private bool setPositionAndRotationToZero = true;

	[Tooltip("setPositionAndRotationToZero would work relative to it's parent")]
	[SerializeField]
	private bool useLocalPositionAndRotation = true;

	[Tooltip("Wether the Refresh method will be called in the editor")]
	[SerializeField]
	private bool refreshInEditor = true;

	[SerializeField]
	[HideInInspector]
	private bool hasNetworkIdentity;

	[NonSerialized]
	private GameObject instance;

	public GameObject Instance => instance;

	private void OnEnable()
	{
		Refresh();
	}

	private void OnDisable()
	{
		if (Object.op_Implicit((Object)(object)instance))
		{
			LOPUtil.DestroyImmediateSafe((Object)(object)instance, allowDestroyingAssets: true);
		}
	}

	public void Refresh()
	{
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		if (Application.isEditor && !refreshInEditor)
		{
			return;
		}
		if (Object.op_Implicit((Object)(object)instance))
		{
			LOPUtil.DestroyImmediateSafe((Object)(object)instance, allowDestroyingAssets: true);
		}
		if (string.IsNullOrWhiteSpace(address) || string.IsNullOrEmpty(address))
		{
			LOPLog.Warning($"Invalid address in {this}, address is null, empty, or white space");
			return;
		}
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)address).WaitForCompletion();
		hasNetworkIdentity = Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>());
		if (hasNetworkIdentity && !Application.isEditor)
		{
			if (NetworkServer.active)
			{
				instance = Object.Instantiate<GameObject>(val, ((Component)this).transform);
				NetworkServer.Spawn(instance);
			}
		}
		else
		{
			instance = Object.Instantiate<GameObject>(val, ((Component)this).transform);
		}
		if (!Object.op_Implicit((Object)(object)instance))
		{
			return;
		}
		GameObject obj = instance;
		((Object)obj).hideFlags = (HideFlags)(((Object)obj).hideFlags | 0x1C);
		Transform[] componentsInChildren = instance.GetComponentsInChildren<Transform>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			((Object)((Component)componentsInChildren[i]).gameObject).hideFlags = ((Object)instance).hideFlags;
		}
		if (setPositionAndRotationToZero)
		{
			Transform transform = instance.transform;
			if (useLocalPositionAndRotation)
			{
				transform.localPosition = Vector3.zero;
				transform.localRotation = Quaternion.identity;
			}
			else
			{
				transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
			}
		}
	}
}
[ExecuteAlways]
[RequireComponent(typeof(JumpVolume))]
public class InstantiateGeyserPrefab : MonoBehaviour
{
	public enum GeyserType
	{
		Default,
		Ambry,
		Moon,
		Aphelian,
		Siphoned,
		Void,
		Fan,
		Shroom,
		Meridian
	}

	[Tooltip("The prefab used for the geyser")]
	[SerializeField]
	public GeyserType geyserType;

	[Tooltip("When the prefab is instantiated, and this is true, the prefab's position and rotation will be set to 0")]
	[SerializeField]
	private bool setPositionAndRotationToZero = true;

	[Tooltip("setPositionAndRotationToZero would work relative to it's parent")]
	[SerializeField]
	private bool useLocalPositionAndRotation = true;

	[Tooltip("Wether the Refresh method will be called in the editor")]
	[SerializeField]
	private bool refreshInEditor = true;

	[Tooltip("Wether the sound string remains the same as the original instance")]
	[SerializeField]
	private bool conserveSoundString;

	[HideInInspector]
	public bool gateToggleOnPurchase;

	[HideInInspector]
	public string gateToEnableWhenPurchased;

	[HideInInspector]
	public string gateToDisableWhenPurchased;

	[SerializeField]
	[HideInInspector]
	private bool hasNetworkIdentity;

	private string address;

	[NonSerialized]
	private GameObject instance;

	public GameObject Instance => instance;

	private void OnEnable()
	{
		Refresh();
	}

	private void OnDisable()
	{
		if (Object.op_Implicit((Object)(object)instance))
		{
			LOPUtil.DestroyImmediateSafe((Object)(object)instance);
		}
	}

	public void Refresh()
	{
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0288: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_027b: Unknown result type (might be due to invalid IL or missing references)
		if (Application.isEditor && !refreshInEditor)
		{
			return;
		}
		if (Object.op_Implicit((Object)(object)instance))
		{
			LOPUtil.DestroyImmediateSafe((Object)(object)instance);
		}
		switch ((int)geyserType)
		{
		case 0:
			address = "RoR2/Base/Common/Props/Geyser.prefab";
			break;
		case 1:
			address = "RoR2/Base/artifactworld/AWGeyser.prefab";
			break;
		case 2:
			address = "RoR2/Base/moon/MoonGeyser.prefab";
			break;
		case 3:
			address = "RoR2/DLC1/ancientloft/AL_Geyser.prefab";
			break;
		case 4:
			address = "RoR2/DLC1/snowyforest/SFGeyser.prefab";
			break;
		case 5:
			address = "RoR2/DLC1/voidstage/mdlVoidGravityGeyser.prefab";
			break;
		case 6:
			address = "RoR2/Base/frozenwall/FW_HumanFan.prefab";
			break;
		case 7:
			address = "RoR2/Base/rootjungle/RJ_BounceShroom.prefab";
			break;
		case 8:
			address = "RoR2/DLC2/meridian/PMLaunchPad.prefab";
			break;
		case 9:
			address = "RoR2/DLC2/lakes/Assets/TLJumpPad.prefab";
			break;
		case 10:
			address = "RoR2/DLC2/helminthroost/Assets/HRLaunchPad.prefab";
			break;
		default:
			LOPLog.Error($"This isn't supposed to print in {this}. Geyser Type is invalid.");
			return;
		}
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)address).WaitForCompletion();
		instance = Object.Instantiate<GameObject>(val, ((Component)this).transform);
		JumpVolume component = ((Component)this).gameObject.GetComponent<JumpVolume>();
		JumpVolume componentInChildren = instance.GetComponentInChildren<JumpVolume>(true);
		if (Object.op_Implicit((Object)(object)component.targetElevationTransform))
		{
			componentInChildren.targetElevationTransform = component.targetElevationTransform;
		}
		else
		{
			LOPLog.Warning($"Target elevation transform on {this} is invalid.");
		}
		componentInChildren.jumpVelocity = component.jumpVelocity;
		componentInChildren.time = component.time;
		if (!conserveSoundString)
		{
			if (string.IsNullOrEmpty(component.jumpSoundString))
			{
				LOPLog.Warning($"Jump sound string is empty on {this}. This will result in silence for your geyser.");
			}
			componentInChildren.jumpSoundString = component.jumpSoundString;
		}
		componentInChildren.onJump = component.onJump;
		if (geyserType == GeyserType.Fan && gateToggleOnPurchase)
		{
			GateStateSetter obj = ((Component)componentInChildren).gameObject.AddComponent<GateStateSetter>();
			obj.gateToEnableWhenEnabled = gateToEnableWhenPurchased;
			obj.gateToDisableWhenEnabled = gateToDisableWhenPurchased;
		}
		((Behaviour)component).enabled = false;
		GameObject obj2 = instance;
		((Object)obj2).hideFlags = (HideFlags)(((Object)obj2).hideFlags | 0x1C);
		Transform[] componentsInChildren = instance.GetComponentsInChildren<Transform>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			((Object)((Component)componentsInChildren[i]).gameObject).hideFlags = ((Object)instance).hideFlags;
		}
		if (setPositionAndRotationToZero)
		{
			Transform transform = instance.transform;
			if (useLocalPositionAndRotation)
			{
				transform.localPosition = Vector3.zero;
				transform.localRotation = Quaternion.identity;
			}
			else
			{
				transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
			}
		}
	}
}
[RequireComponent(typeof(VelocityRandomOnStart))]
public class InstantiateLogbookPrefab : MonoBehaviour
{
	[Tooltip("The unlock that triggers when the prefab is picked up.")]
	[SerializeField]
	private UnlockableDef unlockableDef;

	[Tooltip("The token for the text that appears when the prefab is picked up.")]
	[SerializeField]
	private string displayNameToken;

	[Tooltip("Turns on gravity for the pickup.")]
	[SerializeField]
	private bool enableGravity;

	private static Mesh cubeMesh;

	[NonSerialized]
	private GameObject instance;

	public GameObject Instance => instance;

	private void OnEnable()
	{
		Refresh();
	}

	private void OnDisable()
	{
		if (Object.op_Implicit((Object)(object)instance))
		{
			Object.Destroy((Object)(object)instance);
		}
	}

	public void OnDrawGizmos()
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		cubeMesh = Resources.GetBuiltinResource<Mesh>("Cube.fbx");
		Transform transform = ((Component)this).gameObject.transform;
		Vector3 val = default(Vector3);
		((Vector3)(ref val))..ctor(1.16f, 0.43f, 1.39f);
		Color color = (Gizmos.color = new Color(0.7255f, 0.4314f, 1f));
		Gizmos.DrawWireMesh(cubeMesh, transform.position, transform.rotation, val);
		GUI.color = color;
	}

	public void Refresh()
	{
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)instance))
		{
			Object.Destroy((Object)(object)instance);
		}
		if (!Object.op_Implicit((Object)(object)unlockableDef))
		{
			LOPLog.Warning($"No unlockableDef in {this}. Cancelling instantiation.");
			return;
		}
		if (string.IsNullOrEmpty(displayNameToken) || string.IsNullOrWhiteSpace(displayNameToken))
		{
			LOPLog.Warning($"Invalid displayNameToken in {this}, displayNameToken is null, empty, or white space. Cancelling instantiation.");
			return;
		}
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/LogPickup.prefab").WaitForCompletion();
		if (NetworkServer.active)
		{
			instance = Object.Instantiate<GameObject>(val, ((Component)this).transform);
			NetworkServer.Spawn(instance);
		}
		Transform transform = instance.transform;
		transform.localPosition = Vector3.zero;
		transform.localRotation = Quaternion.identity;
		VelocityRandomOnStart component = ((Component)this).gameObject.GetComponent<VelocityRandomOnStart>();
		VelocityRandomOnStart component2 = instance.GetComponent<VelocityRandomOnStart>();
		component2.minSpeed = component.minSpeed;
		component2.maxSpeed = component.maxSpeed;
		component2.baseDirection = component.baseDirection;
		component2.localDirection = component.localDirection;
		component2.directionMode = component.directionMode;
		component2.coneAngle = component.coneAngle;
		component2.minAngularSpeed = component.minAngularSpeed;
		component2.maxAngularSpeed = component.maxAngularSpeed;
		((Behaviour)component).enabled = false;
		instance.GetComponent<Rigidbody>().useGravity = enableGravity;
		UnlockPickup componentInChildren = instance.GetComponentInChildren<UnlockPickup>();
		componentInChildren.displayNameToken = displayNameToken;
		componentInChildren.unlockableDef = unlockableDef;
	}
}
[BepInPlugin("JaceDaDorito.LocationsOfPrecipitation", "LocationsOfPrecipitation", "1.1.2")]
public class LocationsOfPrecipitation : BaseUnityPlugin
{
	public const string Author = "JaceDaDorito";

	public const string Name = "LocationsOfPrecipitation";

	public const string Version = "1.1.2";

	public const string GUID = "JaceDaDorito.LocationsOfPrecipitation";

	public static LocationsOfPrecipitation Instance { get; private set; }

	public static PluginInfo PluginInfo { get; private set; }

	internal static ManualLogSource Logger { get; set; }

	private static string AssemblyDir => Path.GetDirectoryName(PluginInfo.Location);

	private void Awake()
	{
		Instance = this;
		PluginInfo = ((BaseUnityPlugin)this).Info;
		Logger = ((BaseUnityPlugin)this).Logger;
		new LOPLog(Logger);
	}
}
internal class LOPLog
{
	private static ManualLogSource logger;

	internal LOPLog(ManualLogSource logger_)
	{
		logger = logger_;
	}

	internal static void Debug(object data)
	{
		logger.LogDebug(data);
	}

	internal static void Error(object data)
	{
		logger.LogError(data);
	}

	internal static void Fatal(object data)
	{
		logger.LogFatal(data);
	}

	internal static void Info(object data)
	{
		logger.LogInfo(data);
	}

	internal static void Message(object data)
	{
		logger.LogMessage(data);
	}

	internal static void Warning(object data)
	{
		logger.LogWarning(data);
	}
}
public static class LOPUtil
{
	public static void DestroyImmediateSafe(Object obj, bool allowDestroyingAssets = false)
	{
		Object.Destroy(obj);
	}
}
public static class ShaderSwap
{
	public static List<Material> MaterialsWithSwappedShaders { get; } = new List<Material>();


	public static async Task ConvertShader(Material material)
	{
		if (!((Object)material.shader).name.StartsWith("Stubbed"))
		{
			LOPLog.Warning($"The material {material} has a shader which's name doesnt start with \"Stubbed\". Skipping material.");
			return;
		}
		try
		{
			material.shader = await Addressables.LoadAssetAsync<Shader>((object)(((Object)material.shader).name.Substring(7) + ".shader")).Task;
			MaterialsWithSwappedShaders.Add(material);
		}
		catch (Exception arg)
		{
			LOPLog.Error($"Failed to swap shader of material {material}: {arg}");
		}
	}
}
[ExecuteAlways]
public class SurfaceDefInjector : MonoBehaviour
{
	[Tooltip("The surfaceDef address to load")]
	public string surfaceDefAddress;

	[NonSerialized]
	private SurfaceDef loadedSurfaceDef;

	private void OnEnable()
	{
		Refresh();
	}

	private void OnDisable()
	{
		RemoveReferencesEditor();
	}

	public void Refresh()
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		if (string.IsNullOrWhiteSpace(surfaceDefAddress) || string.IsNullOrEmpty(surfaceDefAddress))
		{
			LOPLog.Warning($"Invalid address in {this}, address is null, empty, or white space");
			return;
		}
		loadedSurfaceDef = Addressables.LoadAssetAsync<SurfaceDef>((object)surfaceDefAddress).WaitForCompletion();
		if (Object.op_Implicit((Object)(object)loadedSurfaceDef))
		{
			SurfaceDef obj = loadedSurfaceDef;
			((Object)obj).hideFlags = (HideFlags)(((Object)obj).hideFlags | 0x1C);
			SurfaceDefProvider[] componentsInChildren = ((Component)this).GetComponentsInChildren<SurfaceDefProvider>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				componentsInChildren[i].surfaceDef = loadedSurfaceDef;
			}
		}
	}

	private void RemoveReferencesEditor()
	{
		if (Application.isEditor)
		{
			SurfaceDefProvider[] componentsInChildren = ((Component)this).GetComponentsInChildren<SurfaceDefProvider>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				componentsInChildren[i].surfaceDef = null;
			}
		}
	}
}