patch not firing for soil use count
This commit is contained in:
@@ -280,29 +280,30 @@ namespace AbsorbentSoil
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPatch(typeof(GrowContainer), "SetRemainingSoilUses")]
|
[HarmonyPatch(typeof(Pot), "OnPlantFullyHarvested")]
|
||||||
internal static class GrowContainer_SetRemainingSoilUses_Patch
|
internal static class Pot_OnPlantFullyHarvested_Patch
|
||||||
{
|
{
|
||||||
private static void Postfix(GrowContainer __instance, int uses)
|
private static void Prefix(Pot __instance)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Pot pot = __instance.TryCast<Pot>();
|
MelonLogger.Msg($"Pot.OnPlantFullyHarvested fired. Pot={__instance?.name}, key={PotKeyHelper.GetPotKey(__instance)}");
|
||||||
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.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
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}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("AbsorbentSoil")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("AbsorbentSoil")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+edfdcd0f82cb8dd28ef7c23c0a6db9346d0297d7")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+fdf41b25678969e3fac301d7465f02226d5d3125")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("AbsorbentSoil")]
|
[assembly: System.Reflection.AssemblyProductAttribute("AbsorbentSoil")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("AbsorbentSoil")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("AbsorbentSoil")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
7cd9882f4d02c82d4b4ffd99984e37f9ceb6e198918111ba41d9c687163e9fa9
|
672b76dd04a707c049e964af103b4f06e1081fd0b4decdbfaad45890e1b78a75
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user