patch not firing for soil use count
This commit is contained in:
@@ -280,33 +280,34 @@ namespace AbsorbentSoil
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(GrowContainer), "SetRemainingSoilUses")]
|
||||
internal static class GrowContainer_SetRemainingSoilUses_Patch
|
||||
[HarmonyPatch(typeof(Pot), "OnPlantFullyHarvested")]
|
||||
internal static class Pot_OnPlantFullyHarvested_Patch
|
||||
{
|
||||
private static void Postfix(GrowContainer __instance, int uses)
|
||||
private static void Prefix(Pot __instance)
|
||||
{
|
||||
try
|
||||
{
|
||||
Pot pot = __instance.TryCast<Pot>();
|
||||
if (pot == null)
|
||||
return;
|
||||
|
||||
SoilHelper.SetRemainingSoilUses(pot, uses);
|
||||
|
||||
if (uses <= 0)
|
||||
{
|
||||
AdditiveMemory.Forget(pot);
|
||||
SoilHelper.Forget(pot);
|
||||
MelonLogger.Msg("[Absorbent Soil] Cleared retained additives because soil uses reached zero.");
|
||||
}
|
||||
MelonLogger.Msg($"Pot.OnPlantFullyHarvested fired. Pot={__instance?.name}, key={PotKeyHelper.GetPotKey(__instance)}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MelonLogger.Warning($"SetRemainingSoilUses postfix failed: {ex}");
|
||||
MelonLogger.Warning($"OnPlantFullyHarvested prefix failed: {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
private static void Postfix(Pot __instance)
|
||||
{
|
||||
try
|
||||
{
|
||||
MelonLogger.Msg($"Pot.OnPlantFullyHarvested postfix. Pot={__instance?.name}, key={PotKeyHelper.GetPotKey(__instance)}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MelonLogger.Warning($"OnPlantFullyHarvested postfix failed: {ex}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HarmonyPatch(typeof(Plant), nameof(Plant.AdditiveApplied))]
|
||||
internal static class Plant_AdditiveApplied_Patch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user