Decompiled source of DroneScrap v1.0.1

plugins/ScrapDrones.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.DroneScrapper;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ScrapDrones")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ScrapDrones")]
[assembly: AssemblyTitle("ScrapDrones")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ScrapDrones
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

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

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

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

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

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

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInPlugin("AdoptedFatty.ScrapDrones", "ScrapDrones", "1.0.0")]
	public class ScrapDrones : BaseUnityPlugin
	{
		private class StoredDroneData
		{
			public DroneIndex DroneIndex { get; set; }

			public ItemTier Tier { get; set; }

			public int UpgradeCount { get; set; }
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OpenSummonReturnMaster <0>__SummonMasterBehavior_OpenSummonReturnMaster;

			public static hook_DispatchDrone <1>__DroneVendorTerminalBehavior_DispatchDrone;

			public static hook_AssignDronesFromInteractor <2>__DroneScrapperController_AssignDronesFromInteractor;

			public static hook_BeginScrapping <3>__DroneScrapperController_BeginScrapping;
		}

		public const string PluginGUID = "AdoptedFatty.ScrapDrones";

		public const string PluginAuthor = "AdoptedFatty";

		public const string PluginName = "ScrapDrones";

		public const string PluginVersion = "1.0.0";

		private static Dictionary<Inventory, List<StoredDroneData>> storedDronesMap = new Dictionary<Inventory, List<StoredDroneData>>();

		private static ConfigEntry<bool> configEnableEquipmentDrones;

		public void Awake()
		{
			Log.Init(((BaseUnityPlugin)this).Logger);
			configEnableEquipmentDrones = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "EnableEquipmentDroneScrap", false, "Allow equipment drones to be scrapped in drone scrappers.");
			HookDroneSpawns();
			ConfigureScrapperTimings();
		}

		private static void HookDroneSpawns()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//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_003d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			object obj = <>O.<0>__SummonMasterBehavior_OpenSummonReturnMaster;
			if (obj == null)
			{
				hook_OpenSummonReturnMaster val = SummonMasterBehavior_OpenSummonReturnMaster;
				<>O.<0>__SummonMasterBehavior_OpenSummonReturnMaster = val;
				obj = (object)val;
			}
			SummonMasterBehavior.OpenSummonReturnMaster += (hook_OpenSummonReturnMaster)obj;
			object obj2 = <>O.<1>__DroneVendorTerminalBehavior_DispatchDrone;
			if (obj2 == null)
			{
				hook_DispatchDrone val2 = DroneVendorTerminalBehavior_DispatchDrone;
				<>O.<1>__DroneVendorTerminalBehavior_DispatchDrone = val2;
				obj2 = (object)val2;
			}
			DroneVendorTerminalBehavior.DispatchDrone += (hook_DispatchDrone)obj2;
			object obj3 = <>O.<2>__DroneScrapperController_AssignDronesFromInteractor;
			if (obj3 == null)
			{
				hook_AssignDronesFromInteractor val3 = DroneScrapperController_AssignDronesFromInteractor;
				<>O.<2>__DroneScrapperController_AssignDronesFromInteractor = val3;
				obj3 = (object)val3;
			}
			DroneScrapperController.AssignDronesFromInteractor += (hook_AssignDronesFromInteractor)obj3;
			object obj4 = <>O.<3>__DroneScrapperController_BeginScrapping;
			if (obj4 == null)
			{
				hook_BeginScrapping val4 = DroneScrapperController_BeginScrapping;
				<>O.<3>__DroneScrapperController_BeginScrapping = val4;
				obj4 = (object)val4;
			}
			DroneScrapperController.BeginScrapping += (hook_BeginScrapping)obj4;
		}

		private static CharacterMaster SummonMasterBehavior_OpenSummonReturnMaster(orig_OpenSummonReturnMaster orig, SummonMasterBehavior self, Interactor activator)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return orig.Invoke(self, activator);
			}
			try
			{
				PurchaseInteraction component = ((Component)self).GetComponent<PurchaseInteraction>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					return orig.Invoke(self, activator);
				}
				if (!component.isDrone && !IsDroneOrTurretMaster(self.masterPrefab))
				{
					return orig.Invoke(self, activator);
				}
				ItemTier droneTierFromMasterPrefab = GetDroneTierFromMasterPrefab(self.masterPrefab);
				DroneIndex droneIndexFromMasterPrefab = GetDroneIndexFromMasterPrefab(self.masterPrefab);
				StoreDroneForInteractor(activator, droneIndexFromMasterPrefab, droneTierFromMasterPrefab);
				if (self.destroyAfterSummoning)
				{
					Object.Destroy((Object)(object)((Component)self).gameObject);
				}
				return null;
			}
			catch (Exception data)
			{
				Log.Error(data);
				return orig.Invoke(self, activator);
			}
		}

		private static void DroneVendorTerminalBehavior_DispatchDrone(orig_DispatchDrone orig, DroneVendorTerminalBehavior self, Interactor interactor)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				orig.Invoke(self, interactor);
				return;
			}
			try
			{
				UniquePickup cachedPickup = self.CachedPickup;
				PickupDef pickupDef = PickupCatalog.GetPickupDef(cachedPickup.pickupIndex);
				if (pickupDef == null)
				{
					orig.Invoke(self, interactor);
					return;
				}
				DroneIndex droneIndex = pickupDef.droneIndex;
				DroneDef droneDef = DroneCatalog.GetDroneDef(droneIndex);
				ItemTier tier = (ItemTier)((droneDef != null) ? ((int)droneDef.tier) : 0);
				StoreDroneForInteractor(interactor, droneIndex, tier, cachedPickup.upgradeValue);
			}
			catch (Exception data)
			{
				Log.Error(data);
				orig.Invoke(self, interactor);
			}
		}

		private static void DroneScrapperController_AssignDronesFromInteractor(orig_AssignDronesFromInteractor orig, DroneScrapperController self, Interactor activator)
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				orig.Invoke(self, activator);
				return;
			}
			try
			{
				orig.Invoke(self, activator);
				CharacterBody component = ((Component)activator).GetComponent<CharacterBody>();
				if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.inventory))
				{
					return;
				}
				List<StoredDroneData> storedDronesForInventory = GetStoredDronesForInventory(component.inventory);
				if (storedDronesForInventory.Count == 0)
				{
					return;
				}
				List<Option> list = new List<Option>(self.pickupPickerController.options ?? Array.Empty<Option>());
				for (int i = 0; i < storedDronesForInventory.Count; i++)
				{
					StoredDroneData storedDroneData = storedDronesForInventory[i];
					DroneDef droneDef = DroneCatalog.GetDroneDef(storedDroneData.DroneIndex);
					if (Object.op_Implicit((Object)(object)droneDef) && droneDef.canScrap)
					{
						NetworkInstanceId networkID = GenerateStoredDroneNetworkId(component.inventory, i);
						list.Add(new Option
						{
							networkID = networkID,
							isCarryingItems = (storedDroneData.UpgradeCount > 0),
							droneIndex = storedDroneData.DroneIndex,
							droneUpgradeCount = storedDroneData.UpgradeCount
						});
						Log.Debug($"Added stored drone option: {droneDef.nameToken} (Index: {storedDroneData.DroneIndex})");
					}
				}
				self.pickupPickerController.SetOptionsServer(list.ToArray());
			}
			catch (Exception arg)
			{
				Log.Error($"Error in AssignDronesFromInteractor hook: {arg}");
				orig.Invoke(self, activator);
			}
		}

		private static void DroneScrapperController_BeginScrapping(orig_BeginScrapping orig, DroneScrapperController self, NetworkInstanceId id, DroneIndex droneIndex)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				orig.Invoke(self, id, droneIndex);
				return;
			}
			try
			{
				if (IsStoredDroneNetworkId(id))
				{
					HandleStoredDroneScrapping(self, id, droneIndex);
					return;
				}
			}
			catch (Exception arg)
			{
				Log.Error($"Error in BeginScrapping hook: {arg}");
			}
			orig.Invoke(self, id, droneIndex);
		}

		private static void StoreDroneForInteractor(Interactor interactor, DroneIndex droneIndex, ItemTier tier, int upgradeCount = 0)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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)
			CharacterBody val = ((interactor != null) ? ((Component)interactor).GetComponent<CharacterBody>() : null);
			Inventory val2 = ((val != null) ? val.inventory : null);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				Log.Warning("Could not get inventory from interactor");
				return;
			}
			if (!storedDronesMap.ContainsKey(val2))
			{
				storedDronesMap[val2] = new List<StoredDroneData>();
			}
			storedDronesMap[val2].Add(new StoredDroneData
			{
				DroneIndex = droneIndex,
				Tier = tier,
				UpgradeCount = upgradeCount
			});
			Log.Info($"Stored drone {droneIndex} for player inventory");
			CharacterMaster val3 = ((val != null) ? val.master : null);
			if (Object.op_Implicit((Object)(object)val3))
			{
				DroneDef droneDef = DroneCatalog.GetDroneDef(droneIndex);
				if (Object.op_Implicit((Object)(object)droneDef))
				{
					CharacterMasterNotificationQueue.PushDroneNotification(val3, droneDef.droneIndex, upgradeCount);
				}
			}
		}

		private static List<StoredDroneData> GetStoredDronesForInventory(Inventory inventory)
		{
			if (storedDronesMap.TryGetValue(inventory, out var value))
			{
				return value;
			}
			return new List<StoredDroneData>();
		}

		private static DroneIndex GetDroneIndexFromMasterPrefab(GameObject masterPrefab)
		{
			//IL_000f: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)masterPrefab))
			{
				return (DroneIndex)(-1);
			}
			GameObject val = masterPrefab.GetComponent<CharacterMaster>()?.bodyPrefab;
			if (!Object.op_Implicit((Object)(object)val))
			{
				return (DroneIndex)(-1);
			}
			DroneDef val2 = DroneCatalog.FindDroneDefFromBody(val);
			return (DroneIndex)((!Object.op_Implicit((Object)(object)val2)) ? (-1) : ((int)val2.droneIndex));
		}

		private static bool IsDroneOrTurretMaster(GameObject masterPrefab)
		{
			//IL_0047: 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_0053: Invalid comparison between Unknown and I4
			GameObject val = (Object.op_Implicit((Object)(object)masterPrefab) ? masterPrefab.GetComponent<CharacterMaster>() : null)?.bodyPrefab;
			CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<CharacterBody>() : null);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				return false;
			}
			bool flag = (val2.bodyFlags & 0x400000) > 0;
			bool flag2 = ((Object)val).name.Contains("Turret", StringComparison.OrdinalIgnoreCase);
			return flag || flag2 || (Object)(object)DroneCatalog.FindDroneDefFromBody(val) != (Object)null;
		}

		private static DroneIndex GetDroneIndexFromPickupDef(PickupDef pickupDef)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			if (pickupDef == null)
			{
				return (DroneIndex)(-1);
			}
			if ((int)pickupDef.equipmentIndex != -1)
			{
				EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(pickupDef.equipmentIndex);
				if (equipmentDef != null && ((Object)equipmentDef).name.Contains("Drone"))
				{
					foreach (DroneDef allDroneDef in DroneCatalog.allDroneDefs)
					{
						if (Object.op_Implicit((Object)(object)allDroneDef) && ((Object)allDroneDef).name.Contains("Equipment"))
						{
							return allDroneDef.droneIndex;
						}
					}
				}
			}
			if ((int)pickupDef.itemIndex != -1)
			{
			}
			return (DroneIndex)(-1);
		}

		private static ItemTier GetDroneTierFromMasterPrefab(GameObject masterPrefab)
		{
			//IL_000f: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)masterPrefab))
			{
				return (ItemTier)0;
			}
			GameObject val = masterPrefab.GetComponent<CharacterMaster>()?.bodyPrefab;
			if (!Object.op_Implicit((Object)(object)val))
			{
				return (ItemTier)0;
			}
			DroneDef val2 = DroneCatalog.FindDroneDefFromBody(val);
			return (ItemTier)(Object.op_Implicit((Object)(object)val2) ? ((int)val2.tier) : 0);
		}

		private static NetworkInstanceId GenerateStoredDroneNetworkId(Inventory inventory, int droneIndex)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			NetworkInstanceId netId = ((NetworkBehaviour)inventory).netId;
			int value = (int)((NetworkInstanceId)(ref netId)).Value;
			uint num = (uint)(value << 8) | ((uint)droneIndex & 0xFFu);
			return new NetworkInstanceId(num);
		}

		private static bool IsStoredDroneNetworkId(NetworkInstanceId id)
		{
			uint value = ((NetworkInstanceId)(ref id)).Value;
			return value < 16777216;
		}

		private static void HandleStoredDroneScrapping(DroneScrapperController self, NetworkInstanceId fakeNetworkId, DroneIndex droneIndex)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Expected O, but got Unknown
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				DroneDef droneDef = DroneCatalog.GetDroneDef(droneIndex);
				if (!Object.op_Implicit((Object)(object)droneDef))
				{
					Log.Error($"Could not find drone def for index {droneIndex}");
					return;
				}
				Inventory val = null;
				int num = -1;
				foreach (KeyValuePair<Inventory, List<StoredDroneData>> item in storedDronesMap)
				{
					List<StoredDroneData> value = item.Value;
					for (int i = 0; i < value.Count; i++)
					{
						if (value[i].DroneIndex == droneIndex)
						{
							val = item.Key;
							num = i;
							break;
						}
					}
					if (Object.op_Implicit((Object)(object)val))
					{
						break;
					}
				}
				if (!Object.op_Implicit((Object)(object)val) || num < 0)
				{
					Log.Error($"Could not find owner inventory for stored drone {droneIndex}");
					return;
				}
				List<StoredDroneData> list = storedDronesMap[val];
				StoredDroneData storedDroneData = list[num];
				list.RemoveAt(num);
				if (list.Count == 0)
				{
					storedDronesMap.Remove(val);
				}
				if (Object.op_Implicit((Object)(object)self.esm))
				{
					int droneCountFromUpgradeCount = DroneUpgradeUtils.GetDroneCountFromUpgradeCount(storedDroneData.UpgradeCount);
					typeof(DroneScrapperController).GetProperty("lastScrappedTier", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(self, storedDroneData.Tier);
					typeof(DroneScrapperController).GetProperty("lastScrapDropCount", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(self, droneCountFromUpgradeCount);
					Action<ItemTier, Interactor> action = typeof(DroneScrapperController).GetField("OnDroneScrapped", BindingFlags.Static | BindingFlags.Public)?.GetValue(null) as Action<ItemTier, Interactor>;
					object? obj = typeof(DroneScrapperController).GetField("interactor", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(self);
					Interactor arg = (Interactor)((obj is Interactor) ? obj : null);
					action?.Invoke(storedDroneData.Tier, arg);
					self.esm.SetNextState((EntityState)new WaitToBeginScrappingDrone());
					Log.Info($"Scrapped stored drone: {droneDef.nameToken} (Tier: {storedDroneData.Tier}, Drops: {droneCountFromUpgradeCount})");
				}
			}
			catch (Exception arg2)
			{
				Log.Error($"Error handling stored drone scrapping: {arg2}");
			}
		}

		private static void ConfigureScrapperTimings()
		{
			WaitToBeginScrappingDrone.duration = 0.05f;
			DroneScrapping.duration = 0.25f;
			DroneScrappingToIdle.duration = 0.1f;
		}
	}
}