From a17cc01bae0a5a68fa3f96b962a540bcbcda5cfa Mon Sep 17 00:00:00 2001 From: bmgjet <50484759+bmgjet@users.noreply.github.com> Date: Tue, 19 Nov 2024 18:28:46 +1300 Subject: [PATCH] Create FishTrapResetter.cs --- FishTrapResetter.cs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 FishTrapResetter.cs diff --git a/FishTrapResetter.cs b/FishTrapResetter.cs new file mode 100644 index 0000000..7f4e0ad --- /dev/null +++ b/FishTrapResetter.cs @@ -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); + } + } + } +}