diff --git a/OneHP/NuGet.Config b/OneHP/NuGet.Config new file mode 100644 index 0000000..f322c73 --- /dev/null +++ b/OneHP/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OneHP/OneHP.cs b/OneHP/OneHP.cs new file mode 100644 index 0000000..1d40d26 --- /dev/null +++ b/OneHP/OneHP.cs @@ -0,0 +1,50 @@ +using BepInEx; +using BepInEx.Logging; +using GameNetcodeStuff; +using HarmonyLib; + +namespace OneHP; + + +[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)] +public class OneHP : BaseUnityPlugin +{ + public static OneHP Instance { get; private set; } = null!; + internal new static ManualLogSource Logger { get; private set; } = null!; + internal static Harmony ElmHarmony { get; set; } = new Harmony(MyPluginInfo.PLUGIN_GUID); + + private void Awake() + { + Logger = base.Logger; + Instance = this; + + ElmHarmony.PatchAll(typeof(HealthEditing)); + + Logger.LogInfo($"{MyPluginInfo.PLUGIN_GUID} v{MyPluginInfo.PLUGIN_VERSION} has loaded!"); + } +} + +class HealthEditing +{ + [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] + [HarmonyPrefix] + + static void infiniteCooldown(PlayerControllerB __instance){ + __instance.healthRegenerateTimer = 9999f; + + } + + [HarmonyPatch(typeof(StartOfRound), "ReviveDeadPlayers")] + [HarmonyPostfix] + static void startAt1(PlayerControllerB __instance){ + __instance.health = 1; + } + + [HarmonyPatch(typeof(PlayerControllerB), "Update")] + [HarmonyPostfix] + static void keepSettingTo1(PlayerControllerB __instance){ + __instance.health = 1; + } +} + + diff --git a/OneHP/OneHP.csproj b/OneHP/OneHP.csproj new file mode 100644 index 0000000..55f1987 --- /dev/null +++ b/OneHP/OneHP.csproj @@ -0,0 +1,55 @@ + + + + + OneHP + OneHP + + 1.0.0 + + + + + netstandard2.1 + OneHP + true + latest + + + + + enable + + + + + + https://api.nuget.org/v3/index.json; + https://nuget.bepinex.dev/v3/index.json + + + + + + true + embedded + + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))=./ + + + + + + + + + + + + + + + diff --git a/OneHP/README.md b/OneHP/README.md new file mode 100644 index 0000000..c4f2800 --- /dev/null +++ b/OneHP/README.md @@ -0,0 +1,3 @@ +# OneHP Mod + +Very Simple Mod That Keeps you at OneHP \ No newline at end of file