Compare commits
No commits in common. "master" and "1.4.2" have entirely different histories.
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,7 +3,6 @@ project/References/EFT_Managed/*
|
|||||||
|
|
||||||
# Allow these files, despite the rules above
|
# Allow these files, despite the rules above
|
||||||
!project/References/EFT_Managed/.keep
|
!project/References/EFT_Managed/.keep
|
||||||
!project/References/SPT/.keep
|
|
||||||
|
|
||||||
# ---> VisualStudio
|
# ---> VisualStudio
|
||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using SPT.Reflection.Patching;
|
using Aki.Reflection.Patching;
|
||||||
using EFT.HealthSystem;
|
using EFT.HealthSystem;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ namespace Terkoiz.Freecam
|
|||||||
|
|
||||||
protected override MethodBase GetTargetMethod()
|
protected override MethodBase GetTargetMethod()
|
||||||
{
|
{
|
||||||
return AccessTools.Method(typeof(ActiveHealthController), nameof(ActiveHealthController.HandleFall));
|
return AccessTools.Method(typeof(ActiveHealthController), "HandleFall");
|
||||||
}
|
}
|
||||||
|
|
||||||
[PatchPrefix]
|
[PatchPrefix]
|
||||||
|
@ -6,7 +6,7 @@ namespace Terkoiz.Freecam
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A simple free camera to be added to a Unity game object.
|
/// A simple free camera to be added to a Unity game object.
|
||||||
///
|
///
|
||||||
/// Full credit to Ashley Davis on GitHub for the initial code:
|
/// Full credit to Ashley Davis on GitHub for the inital code:
|
||||||
/// https://gist.github.com/ashleydavis/f025c03a9221bc840a2b
|
/// https://gist.github.com/ashleydavis/f025c03a9221bc840a2b
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -13,7 +13,7 @@ namespace Terkoiz.Freecam
|
|||||||
private GameObject _mainCamera;
|
private GameObject _mainCamera;
|
||||||
private Freecam _freeCamScript;
|
private Freecam _freeCamScript;
|
||||||
|
|
||||||
private EftBattleUIScreen _playerUi;
|
private BattleUIScreen _playerUi;
|
||||||
private bool _uiHidden;
|
private bool _uiHidden;
|
||||||
|
|
||||||
private GamePlayerOwner _gamePlayerOwner;
|
private GamePlayerOwner _gamePlayerOwner;
|
||||||
@ -24,22 +24,14 @@ namespace Terkoiz.Freecam
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
// Get Main Camera
|
// Find Main Camera
|
||||||
_mainCamera = GetLocalPlayerFromWorld().GetComponent<PlayerCameraController>().Camera.gameObject;
|
_mainCamera = GameObject.Find("FPS Camera");
|
||||||
if (_mainCamera == null)
|
if (_mainCamera == null)
|
||||||
{
|
{
|
||||||
FreecamPlugin.Logger.LogError("Failed to locate main camera");
|
FreecamPlugin.Logger.LogError("Failed to locate main camera");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Player UI
|
|
||||||
_playerUi = Singleton<CommonUI>.Instance.EftBattleUIScreen;
|
|
||||||
if (_playerUi == null)
|
|
||||||
{
|
|
||||||
FreecamPlugin.Logger.LogError("Failed to locate player UI");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add Freecam script to main camera in scene
|
// Add Freecam script to main camera in scene
|
||||||
_freeCamScript = _mainCamera.AddComponent<Freecam>();
|
_freeCamScript = _mainCamera.AddComponent<Freecam>();
|
||||||
if (_freeCamScript == null)
|
if (_freeCamScript == null)
|
||||||
@ -132,6 +124,18 @@ namespace Terkoiz.Freecam
|
|||||||
if (GetLocalPlayerFromWorld() == null)
|
if (GetLocalPlayerFromWorld() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// If we don't have the UI Component cached, go look for it in the scene
|
||||||
|
if (_playerUi == null)
|
||||||
|
{
|
||||||
|
_playerUi = GameObject.Find("BattleUIScreen").GetComponent<BattleUIScreen>();
|
||||||
|
|
||||||
|
if (_playerUi == null)
|
||||||
|
{
|
||||||
|
FreecamPlugin.Logger.LogError("Failed to locate player UI");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_playerUi.gameObject.SetActive(_uiHidden);
|
_playerUi.gameObject.SetActive(_uiHidden);
|
||||||
_uiHidden = !_uiHidden;
|
_uiHidden = !_uiHidden;
|
||||||
}
|
}
|
||||||
@ -236,6 +240,7 @@ namespace Terkoiz.Freecam
|
|||||||
{
|
{
|
||||||
// Destroy FreeCamScript before FreeCamController if exists
|
// Destroy FreeCamScript before FreeCamController if exists
|
||||||
Destroy(_freeCamScript);
|
Destroy(_freeCamScript);
|
||||||
|
Destroy(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using SPT.Reflection.Patching;
|
using Aki.Reflection.Patching;
|
||||||
using Comfort.Common;
|
using Comfort.Common;
|
||||||
using EFT;
|
using EFT;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
@ -10,19 +10,19 @@ namespace Terkoiz.Freecam
|
|||||||
{
|
{
|
||||||
protected override MethodBase GetTargetMethod()
|
protected override MethodBase GetTargetMethod()
|
||||||
{
|
{
|
||||||
return AccessTools.Method(typeof(GameWorld), nameof(GameWorld.OnGameStarted));
|
return AccessTools.Method(typeof(GameWorld), "OnGameStarted");
|
||||||
}
|
}
|
||||||
|
|
||||||
[PatchPostfix]
|
[PatchPostfix]
|
||||||
public static void PatchPostFix()
|
public static void PatchPostFix()
|
||||||
{
|
{
|
||||||
var gameWorld = Singleton<GameWorld>.Instance;
|
var gameworld = Singleton<GameWorld>.Instance;
|
||||||
|
|
||||||
if (gameWorld == null)
|
if (gameworld == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Add FreecamController to GameWorld GameObject
|
// Add FreeCamController to GameWorld GameObject
|
||||||
gameWorld.gameObject.AddComponent<FreecamController>();
|
gameworld.gameObject.AddComponent<FreecamController>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,7 +7,7 @@ using KeyboardShortcut = BepInEx.Configuration.KeyboardShortcut;
|
|||||||
|
|
||||||
namespace Terkoiz.Freecam
|
namespace Terkoiz.Freecam
|
||||||
{
|
{
|
||||||
[BepInPlugin("com.terkoiz.freecam", "Terkoiz.Freecam", "1.4.4")]
|
[BepInPlugin("com.terkoiz.freecam", "Terkoiz.Freecam", "1.4.2")]
|
||||||
public class FreecamPlugin : BaseUnityPlugin
|
public class FreecamPlugin : BaseUnityPlugin
|
||||||
{
|
{
|
||||||
internal new static ManualLogSource Logger { get; private set; }
|
internal new static ManualLogSource Logger { get; private set; }
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net471</TargetFramework>
|
<TargetFramework>net472</TargetFramework>
|
||||||
<Version>1.4.4</Version>
|
<Version>1.4.2</Version>
|
||||||
<Authors>Terkoiz, Kobrakon, CWX</Authors>
|
<Authors>Terkoiz, Kobrakon, CWX</Authors>
|
||||||
<RepositoryUrl>https://dev.sp-tarkov.com/Terkoiz/Freecam</RepositoryUrl>
|
<RepositoryUrl>https://dev.sp-tarkov.com/Terkoiz/Freecam</RepositoryUrl>
|
||||||
<PackageLicenseExpression>NCSA</PackageLicenseExpression>
|
<PackageLicenseExpression>NCSA</PackageLicenseExpression>
|
||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Aki.Reflection">
|
<Reference Include="Aki.Reflection">
|
||||||
<HintPath>..\References\SPT\spt-reflection.dll</HintPath>
|
<HintPath>..\References\EFT_Managed\Aki.Reflection.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Assembly-CSharp">
|
<Reference Include="Assembly-CSharp">
|
||||||
|
Reference in New Issue
Block a user