0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00
Arys 33e6c151af Player can now enter and exit the BTR (!51)
Todo:

* BTR Driver services
  * Send to items to player stash (2x4)
  * Provide covering fire
  * Taxi to a specific location on Streets
* BTR turns hostile if you shoot it
* BTR automatically follows a set path from raid start, stopping at locations for 90 seconds each stop

Co-authored-by: Nympfonic <arys.steam@gmail.com>
Reviewed-on: SPT-AKI/Modules#51
Co-authored-by: Arys <arys@noreply.dev.sp-tarkov.com>
Co-committed-by: Arys <arys@noreply.dev.sp-tarkov.com>
2024-01-04 08:51:06 +00:00

46 lines
1.3 KiB
C#

using System.Reflection;
using Aki.Reflection.Patching;
using Comfort.Common;
using EFT;
using EFT.UI;
namespace Aki.Debugging.BTR.Patches
{
/// <summary>
/// Adds a BTRManager component to the GameWorld game object when raid starts.
/// </summary>
public class BTRPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return typeof(GameWorld).GetMethod(nameof(GameWorld.OnGameStarted));
}
[PatchPostfix]
public static void PatchPostfix()
{
try
{
var gameWorld = Singleton<GameWorld>.Instance;
if (gameWorld.MainPlayer.Location.ToLower() != "tarkovstreets")
{
// only run patch on streets
return;
}
if (gameWorld.LocationId.IsNullOrEmpty())
{
// GameWorld's LocationId needs to be set otherwise BTR doesn't get spawned in automatically
gameWorld.LocationId = gameWorld.MainPlayer.Location;
}
gameWorld.gameObject.AddComponent<BTRManager>();
}
catch (System.Exception)
{
ConsoleScreen.LogError("[AKI-BTR]: Exception thrown, check logs.");
throw;
}
}
}
}