Removed the fall damage toggle due to lack of reliability
This commit is contained in:
parent
04b65cef3f
commit
e28addc7ea
@ -15,7 +15,6 @@ namespace Terkoiz.Freecam
|
||||
|
||||
private BattleUIScreen _playerUi;
|
||||
private bool _uiHidden;
|
||||
private bool _fallDamageToggle = false;
|
||||
|
||||
private GamePlayerOwner _gamePlayerOwner;
|
||||
|
||||
@ -33,18 +32,25 @@ namespace Terkoiz.Freecam
|
||||
// Find Main Camera
|
||||
_mainCamera = GameObject.Find("FPS Camera");
|
||||
if (_mainCamera == null)
|
||||
{
|
||||
FreecamPlugin.Logger.LogError("Failed to locate main camera");
|
||||
return;
|
||||
}
|
||||
|
||||
// Add Freecam script to main camera in scene
|
||||
_freeCamScript = _mainCamera.AddComponent<Freecam>();
|
||||
if (_freeCamScript == null)
|
||||
{
|
||||
FreecamPlugin.Logger.LogError("Failed to add Freecam script to Camera");
|
||||
}
|
||||
|
||||
// Get GamePlayerOwner component
|
||||
_gamePlayerOwner = GetLocalPlayerFromWorld().GetComponentInChildren<GamePlayerOwner>();
|
||||
if (_gamePlayerOwner == null)
|
||||
{
|
||||
FreecamPlugin.Logger.LogError("Failed to locate GamePlayerOwner");
|
||||
}
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
public void Update()
|
||||
@ -63,29 +69,6 @@ namespace Terkoiz.Freecam
|
||||
{
|
||||
MovePlayerToCamera();
|
||||
}
|
||||
|
||||
if (_fallDamageToggle != FreecamPlugin.DisableFallDamage.Value)
|
||||
{
|
||||
_fallDamageToggle = ToggleFallDamage(FreecamPlugin.DisableFallDamage.Value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool ToggleFallDamage(bool config)
|
||||
{
|
||||
var localPlayer = GetLocalPlayerFromWorld();
|
||||
if (localPlayer == null)
|
||||
return false;
|
||||
|
||||
// Set Safe fall height to 99999
|
||||
if (config)
|
||||
{
|
||||
localPlayer.ActiveHealthController.FallSafeHeight = 99999;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Set Safe fall height to 3
|
||||
localPlayer.ActiveHealthController.FallSafeHeight = 3;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -231,7 +214,7 @@ namespace Terkoiz.Freecam
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
private void OnDestroy()
|
||||
public void OnDestroy()
|
||||
{
|
||||
// Destroy FreeCamScript before FreeCamController if exists
|
||||
Destroy(_freeCamScript);
|
||||
|
@ -7,7 +7,7 @@ using KeyboardShortcut = BepInEx.Configuration.KeyboardShortcut;
|
||||
|
||||
namespace Terkoiz.Freecam
|
||||
{
|
||||
[BepInPlugin("com.terkoiz.freecam", "Terkoiz.Freecam", "1.3.0")]
|
||||
[BepInPlugin("com.terkoiz.freecam", "Terkoiz.Freecam", "1.3.1")]
|
||||
public class FreecamPlugin : BaseUnityPlugin
|
||||
{
|
||||
internal new static ManualLogSource Logger { get; private set; }
|
||||
@ -31,7 +31,6 @@ namespace Terkoiz.Freecam
|
||||
internal static ConfigEntry<bool> CameraHeightMovement;
|
||||
internal static ConfigEntry<bool> CameraMousewheelZoom;
|
||||
internal static ConfigEntry<bool> CameraRememberLastPosition;
|
||||
internal static ConfigEntry<bool> DisableFallDamage;
|
||||
|
||||
[UsedImplicitly]
|
||||
internal void Start()
|
||||
@ -120,12 +119,6 @@ namespace Terkoiz.Freecam
|
||||
"CameraRememberLastPosition",
|
||||
false,
|
||||
"If enabled, returning to Freecam mode will put the camera to it's last position which was saved when exiting Freecam mode.");
|
||||
|
||||
DisableFallDamage = Config.Bind(
|
||||
TogglesSectionName,
|
||||
"DisableFallDamage",
|
||||
true,
|
||||
"If enabled, will prevent fall damage for the player. Highly recommended to leave this enabled if using TeleportToCamera.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<Version>1.3.0</Version>
|
||||
<Version>1.3.1</Version>
|
||||
<Authors>Terkoiz, Kobrakon, CWX</Authors>
|
||||
<RepositoryUrl>https://dev.sp-tarkov.com/Terkoiz/Freecam</RepositoryUrl>
|
||||
<PackageLicenseExpression>NCSA</PackageLicenseExpression>
|
||||
|
Reference in New Issue
Block a user