My test code doesnt work.. confused

So, this code was a test work (followed a tutorial made a few days ago) for a game called "lethal company" The function of the code IN THEORY, would be every frame, the speed meter (which is how long you can sprint) Would be reset to the max, meaning basically infinite sprint. Im having some issues and for some reason it is not working.. Even though a coding friend of mine does not see any issues with it..
using BepInEx;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BepInEx.Logging;
using Bombastic_Company.Patches;
using HarmonyLib;

namespace Bombastic_Company
{
[BepInPlugin(modGUID, modName, modVersion)]
public class BombasticCompanyBase : BaseUnityPlugin
{
private const string modGUID = "DFISH.BombasticCompany";
private const string modName = "Bombastic Company";
private const string modVersion = "1.0.0.0";

private readonly Harmony harmony = new Harmony(modGUID);

private static BombasticCompanyBase Instance;

internal ManualLogSource mls;



void Awake()
{
if (Instance == null)
{
Instance = this;

}
mls = BepInEx.Logging.Logger.CreateLogSource(modGUID);

mls.LogInfo("Lethal Company has engaged Bombastic Mode");

harmony.PatchAll(typeof(BombasticCompanyBase));
harmony.PatchAll(typeof(PlayerControllerBPatch));
}


}
}
using BepInEx;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BepInEx.Logging;
using Bombastic_Company.Patches;
using HarmonyLib;

namespace Bombastic_Company
{
[BepInPlugin(modGUID, modName, modVersion)]
public class BombasticCompanyBase : BaseUnityPlugin
{
private const string modGUID = "DFISH.BombasticCompany";
private const string modName = "Bombastic Company";
private const string modVersion = "1.0.0.0";

private readonly Harmony harmony = new Harmony(modGUID);

private static BombasticCompanyBase Instance;

internal ManualLogSource mls;



void Awake()
{
if (Instance == null)
{
Instance = this;

}
mls = BepInEx.Logging.Logger.CreateLogSource(modGUID);

mls.LogInfo("Lethal Company has engaged Bombastic Mode");

harmony.PatchAll(typeof(BombasticCompanyBase));
harmony.PatchAll(typeof(PlayerControllerBPatch));
}


}
}
And the second part of the code doesnt fit so ill put it in the comments
1 Reply
DarinForTheWin
DarinForTheWinOP12mo ago
using GameNetcodeStuff;
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bombastic_Company.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
static void InfiniteSpeedPatch(ref float ___sprintMeter)
{
___sprintMeter = 1f;
}

}
}
using GameNetcodeStuff;
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bombastic_Company.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
static void InfiniteSpeedPatch(ref float ___sprintMeter)
{
___sprintMeter = 1f;
}

}
}
So as you can see it would supposedly UPDATE the meter every frame... im seeing none of it though.. anyone knowswhat is wrong with the code?
Want results from more Discord servers?
Add your server