public static void Postfix(ResourceTracker __instance) { TechType techType = (TechType)__instance.GetPrivateField("techType"); if (techType == TechType.UraniniteCrystal) { __instance.gameObject.AddIfNeedComponent <Radiation_UraniniteCrystal>(); Main.PrintLOG($"Radiation_UraniniteCrystal component added to gameobject: {__instance.gameObject.name}"); } }
internal static void PostFix(ref ResourceTracker __instance) { bool isDataBox = __instance.overrideTechType == TechType.Databox || (TechType)__instance.GetPrivateField("techType") == TechType.Databox; if (!isDataBox) { return; // Not a data box, early exit } var blueprint = __instance.GetComponentInParent <BlueprintHandTarget>(); if (blueprint == null) { return; // safety check, but shouldn't happen } if (!blueprint.used) { return; // blueprint still unused } __instance.OnBreakResource(); // call this to invoke the "Unregister" method }