Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions OneHP/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="BepInEx" value="https://nuget.bepinex.dev/v3/index.json" />
</packageSources>
</configuration>
50 changes: 50 additions & 0 deletions OneHP/OneHP.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}


55 changes: 55 additions & 0 deletions OneHP/OneHP.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<Project Sdk="Microsoft.NET.Sdk">

<!-- BepInEx Properties -->
<PropertyGroup>
<AssemblyName>OneHP</AssemblyName>
<Product>OneHP</Product>
<!-- Change to whatever version you're currently on. -->
<Version>1.0.0</Version>
</PropertyGroup>

<!-- Project Properties -->
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>OneHP</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<!-- Enable Nullable for better IDE null-checking -->
<PropertyGroup>
<Nullable>enable</Nullable>
</PropertyGroup>

<!-- Set NuGet Sources -->
<PropertyGroup>
<RestoreAdditionalProjectSources>
https://api.nuget.org/v3/index.json;
https://nuget.bepinex.dev/v3/index.json
</RestoreAdditionalProjectSources>
</PropertyGroup>

<!-- Embed Debug Symbols for Easier Debugging -->
<PropertyGroup>
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
<!--
Trim the project path to prevent players from potentially
viewing Private Information in stack traces.
-->
<PathMap>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))=./</PathMap>
</PropertyGroup>

<!-- Primary Package References -->
<ItemGroup>
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all"/>
<PackageReference Include="BepInEx.Core" Version="5.*" PrivateAssets="all"/>
<PackageReference Include="BepInEx.PluginInfoProps" Version="2.*" PrivateAssets="all"/>
<PackageReference Include="LethalCompany.GameLibs.Steam" Version="*-*" PrivateAssets="all"/>
<PackageReference Include="UnityEngine.Modules" Version="2022.3.9" IncludeAssets="compile" PrivateAssets="all"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all"/>
</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions OneHP/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# OneHP Mod

Very Simple Mod That Keeps you at OneHP