public static void Prefix(ref PowerCellCharger __instance) { HashSet <TechType> compatibleTech = PowerCellCharger.compatibleTech; // Make sure the Acid Power Cell is allowed in the power cell charger if (!compatibleTech.Contains(AcidBatteryCellBase.PowerCellID)) { compatibleTech.Add(AcidBatteryCellBase.PowerCellID); } }
public static void Prefix(ref PowerCellCharger __instance) { FieldInfo compatTechField = typeof(PowerCellCharger).GetField("compatibleTech", BindingFlags.Static | BindingFlags.NonPublic); var compatTech = (HashSet <TechType>)compatTechField.GetValue(null); if (!compatTech.Contains(EnzymeBatteryCore.PowCelID)) { compatTech.Add(EnzymeBatteryCore.PowCelID); } }
[HarmonyPrefix] // This will run just before the code in the chosen method public static void Prefix(ref PowerCellCharger __instance) { // The HashSet of compatible power cells is a private static field FieldInfo compatibleTechFieldInfo = typeof(PowerCellCharger).GetField("compatibleTech", BindingFlags.Static | BindingFlags.NonPublic); var compatibleTech = (HashSet <TechType>)compatibleTechFieldInfo.GetValue(null); // Make sure the Deep Power Cell is allowed in the power cell charger if (!compatibleTech.Contains(DeepBatteryCellBase.PowerCellID)) { compatibleTech.Add(DeepBatteryCellBase.PowerCellID); } }
public static bool Prefix(PowerCellCharger __instance) { var BCColor = __instance.GetComponentsInChildren <SkinnedMeshRenderer>(); foreach (var Bccolor in BCColor) { if (Bccolor.name.Contains("Power_Cell_Charging_Station_")) { Bccolor.material.color = new Color32(Convert.ToByte(Config.fabricatorValue), Convert.ToByte(Config.fabricatorgValue), Convert.ToByte(Config.fabricatorbValue), 1); } } return(true); }