mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 05:30:43 -05:00
Add a console command to reload client/profile
This commit is contained in:
parent
00f0d786f9
commit
9d8c285094
@ -20,15 +20,17 @@ namespace Aki.Debugging
|
||||
{
|
||||
new EndRaidDebug().Enable();
|
||||
new LoggerClassLogPatch().Enable();
|
||||
// new CoordinatesPatch().Enable();
|
||||
// new StaticLootDumper().Enable();
|
||||
// new CoordinatesPatch().Enable();
|
||||
// new StaticLootDumper().Enable();
|
||||
|
||||
// BTR debug command patches, can be disabled later
|
||||
//new BTRDebugCommandPatch().Enable();
|
||||
//new BTRDebugDataPatch().Enable();
|
||||
// BTR debug command patches, can be disabled later
|
||||
//new BTRDebugCommandPatch().Enable();
|
||||
//new BTRDebugDataPatch().Enable();
|
||||
|
||||
//new PMCBotSpawnLocationPatch().Enable();
|
||||
}
|
||||
//new PMCBotSpawnLocationPatch().Enable();
|
||||
// Chomp said to leave it enabled by default
|
||||
new ReloadClientPatch().Enable();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"{GetType().Name}: {ex}");
|
||||
|
43
project/Aki.Debugging/Patches/ReloadClientPatch.cs
Normal file
43
project/Aki.Debugging/Patches/ReloadClientPatch.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using Aki.Reflection.Patching;
|
||||
using Comfort.Common;
|
||||
using EFT;
|
||||
using EFT.Console.Core;
|
||||
using EFT.UI;
|
||||
using HarmonyLib;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Aki.Debugging.Patches
|
||||
{
|
||||
public class ReloadClientPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return AccessTools.Method(typeof(PreloaderUI), nameof(PreloaderUI.Awake));
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
private static void PatchPostfix()
|
||||
{
|
||||
ConsoleScreen.Processor.RegisterCommandGroup<ReloadClientPatch>();
|
||||
}
|
||||
|
||||
[ConsoleCommand("reload", "", null, "Reloads currently loaded profile.\nOnly use while in Main Menu" +
|
||||
"\nRunning command while in hideout will cause graphical glitches and NRE to do with Nightvision. Pretty sure wont cause anything bad")]
|
||||
public static void Reload()
|
||||
{
|
||||
|
||||
var tarkovapp = Reflection.Utils.ClientAppUtils.GetMainApp();
|
||||
GameWorld gameWorld = Singleton<GameWorld>.Instance;
|
||||
if (gameWorld != null && gameWorld.MainPlayer.Location != "hideout")
|
||||
{
|
||||
ConsoleScreen.LogError("You are in raid. Please only use in Mainmenu");
|
||||
return; // return early we dont want to cause errors because we are inraid
|
||||
}
|
||||
else if (gameWorld != null)
|
||||
{
|
||||
tarkovapp.HideoutControllerAccess.UnloadHideout();
|
||||
}
|
||||
tarkovapp.method_48();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user