Create FishTrapResetter.cs

This commit is contained in:
bmgjet 2024-11-19 18:28:46 +13:00 committed by GitHub
commit a17cc01bae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 33 additions and 0 deletions

33
FishTrapResetter.cs Normal file
View File

@ -0,0 +1,33 @@
/*
*/
using HarmonyLib;
using Oxide.Core.Plugins;
namespace Oxide.Plugins
{
[Info("FishTrapResetter", "bmgjet", "1.0.0")]
[Description("Resets fish traps on each catch.")]
class FishTrapResetter : RustPlugin
{
[AutoPatch]
[HarmonyPatch(typeof(WildlifeTrap), "OnTrappedWildlife", typeof(bool))]
public static class WildlifeTrap_OnTrappedWildlife
{
[HarmonyPostfix]
public static void Postfix(WildlifeTrap __instance)
{
__instance.Invoke(() =>
{
__instance.SetTrapActive(__instance.HasBait());
__instance.ClearTrap();
}, 5);
}
}
}
}