Skip to content

Commit

Permalink
Updating to 1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
cybensis committed Jan 16, 2025
1 parent fc28ca7 commit bc75b59
Show file tree
Hide file tree
Showing 13 changed files with 184 additions and 87 deletions.
46 changes: 36 additions & 10 deletions ModSupport/FIKASupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Valve.VR;
using Comfort.Common;
using TarkovVR.Source.Settings;
using Fika.Core.UI;


namespace TarkovVR.ModSupport.FIKA
Expand All @@ -41,8 +42,12 @@ private static bool FixExitRaid(TarkovApplication __instance)
UIPatches.gameUi.transform.parent = null;
UIPatches.HandleCloseInventory();

if (UIPatches.notifierUi != null)
if (UIPatches.notifierUi != null) {
UIPatches.notifierUi.transform.parent = PreloaderUI.Instance._alphaVersionLabel.transform.parent;
UIPatches.notifierUi.transform.localScale = Vector3.one;
UIPatches.notifierUi.transform.localPosition = new Vector3(1920, 0, 0);
UIPatches.notifierUi.transform.localRotation = Quaternion.identity;
}

if (UIPatches.extractionTimerUi != null)
UIPatches.extractionTimerUi.transform.parent = UIPatches.gameUi.transform;
Expand Down Expand Up @@ -70,7 +75,7 @@ private static bool FixExitRaid(Fika.Core.Coop.FreeCamera.FreeCameraController _
{
if (FikaPlugin.ShowExtractMessage.Value)
{
__instance.extractText = Fika.Core.UI.FikaUIUtils.CreateOverlayText("Press 'B' to extract");
__instance.extractText = FikaUIGlobals.CreateOverlayText("Press 'B' to extract");
}
return true;
}
Expand Down Expand Up @@ -107,39 +112,60 @@ private static bool PositionExitRaidUIAndCam(Fika.Core.Coop.FreeCamera.FreeCamer
}


[HarmonyPostfix]
[HarmonyPatch(typeof(Fika.Core.Coop.GameMode.CoopGame), "CreateStartButton")]
private static void AddLaserBackToRaidLoading(Fika.Core.Coop.GameMode.CoopGame __instance) {
VRGlobals.menuVRManager.OnEnable();
}

[HarmonyPostfix]
[HarmonyPatch(typeof(Fika.Core.Coop.GameMode.CoopGame), "WaitForOtherPlayersToLoad")]
private static void RehideLaser(Fika.Core.Coop.GameMode.CoopGame __instance)
{
VRGlobals.menuVRManager.enabled = false;
VRGlobals.vrPlayer.enabled = true;
VRGlobals.ikManager.enabled = true;
VRGlobals.menuOpen = false;
}


[HarmonyPrefix]
[HarmonyPatch(typeof(Fika.Core.Coop.Components.CoopHandler), "ProcessQuitting")]
private static bool OverrideExitRaidButton(Fika.Core.Coop.Components.CoopHandler __instance)
{
EQuitState quitState = __instance.GetQuitState();
if ( (VRSettings.GetLeftHandedMode() ? SteamVR_Actions._default.ButtonY.stateDown : !SteamVR_Actions._default.ButtonB.stateDown) || quitState == EQuitState.NONE || __instance.requestQuitGame)
if ( (VRSettings.GetLeftHandedMode() ? !SteamVR_Actions._default.ButtonY.stateDown : !SteamVR_Actions._default.ButtonB.stateDown) || quitState == EQuitState.None || __instance.requestQuitGame)
{
return false;
}
ConsoleScreen.Log($"{FikaPlugin.ExtractKey.Value} pressed, attempting to extract!");
Plugin.MyLog.LogInfo((object)$"{FikaPlugin.ExtractKey.Value} pressed, attempting to extract!");
__instance.requestQuitGame = true;
CoopGame coopGame = (CoopGame)Singleton<IFikaGame>.Instance;
if (FikaBackendUtils.IsServer)
if (!__instance.isClient)
{
if (Singleton<FikaServer>.Instance.NetServer.ConnectedPeersCount > 0 && quitState != EQuitState.NONE)
if (coopGame.ExitStatus == ExitStatus.Transit && __instance.HumanPlayers.Count <= 1)
{
coopGame.Stop(Singleton<GameWorld>.Instance.MainPlayer.ProfileId, coopGame.ExitStatus, coopGame.ExitLocation);
}
else if (Singleton<FikaServer>.Instance.NetServer.ConnectedPeersCount > 0 && quitState != EQuitState.None)
{
NotificationManagerClass.DisplayWarningNotification(GClass2069.Localized("F_Client_HostCannotExtract", (string)null), (ENotificationDurationType)0);
NotificationManagerClass.DisplayWarningNotification(GClass2069.Localized("F_Client_HostCannotExtract"));
__instance.requestQuitGame = false;
}
else if (Singleton<FikaServer>.Instance.NetServer.ConnectedPeersCount == 0 && Singleton<FikaServer>.Instance.timeSinceLastPeerDisconnected > DateTime.Now.AddSeconds(-5.0) && Singleton<FikaServer>.Instance.HasHadPeer)
else if (Singleton<FikaServer>.Instance.NetServer.ConnectedPeersCount == 0 && Singleton<FikaServer>.Instance.TimeSinceLastPeerDisconnected > DateTime.Now.AddSeconds(-5.0) && Singleton<FikaServer>.Instance.HasHadPeer)
{
NotificationManagerClass.DisplayWarningNotification(GClass2069.Localized("F_Client_Wait5Seconds", (string)null), (ENotificationDurationType)0);
NotificationManagerClass.DisplayWarningNotification(GClass2069.Localized("F_Client_Wait5Seconds"));
__instance.requestQuitGame = false;
}
else
{
((BaseLocalGame<EftGamePlayerOwner>)coopGame).Stop(Singleton<GameWorld>.Instance.MainPlayer.ProfileId, coopGame.MyExitStatus, ((GClass2747<GClass2746>)(object)((EFT.Player)__instance.MyPlayer).ActiveHealthController).IsAlive ? coopGame.MyExitLocation : null, 0f);
coopGame.Stop(Singleton<GameWorld>.Instance.MainPlayer.ProfileId, coopGame.ExitStatus, __instance.MyPlayer.ActiveHealthController.IsAlive ? coopGame.ExitLocation : null);
}
}
else
{
((BaseLocalGame<EftGamePlayerOwner>)coopGame).Stop(Singleton<GameWorld>.Instance.MainPlayer.ProfileId, coopGame.MyExitStatus, ((GClass2747<GClass2746>)(object)((EFT.Player)__instance.MyPlayer).ActiveHealthController).IsAlive ? coopGame.MyExitLocation : null, 0f);
coopGame.Stop(Singleton<GameWorld>.Instance.MainPlayer.ProfileId, coopGame.ExitStatus, __instance.MyPlayer.ActiveHealthController.IsAlive ? coopGame.ExitLocation : null);
}
return false;
}
Expand Down
26 changes: 25 additions & 1 deletion Patches/Core/Player/IKPatches.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using HarmonyLib;
using EFT;
using HarmonyLib;
using System;
using UnityEngine;

Expand Down Expand Up @@ -30,7 +31,30 @@ private static void SetBodyIKScale(EFT.Player __instance)
__instance.RibcageScaleCurrent = 1f;
}

[HarmonyPrefix]
[HarmonyPatch(typeof(EFT.Player), "method_20")]
private static bool ReemoveSprintAnimFromHands(EFT.Player __instance)
{
if (!__instance.IsYourPlayer)
return true;
if (__instance.HandsIsEmpty)
return false;

if (__instance.IsSprintEnabled || !__instance.MovementContext.IsGrounded)
{
__instance._markers[1].transform.parent.parent.localPosition = new Vector3(0, 0, 0);
__instance._markers[1].transform.parent.parent.localEulerAngles = new Vector3(0, 0, 0);
}
return true;
}

private static bool test = true;
[HarmonyPostfix]
[HarmonyPatch(typeof(GClass1355), "SetAnimator")]
private static void ReemoveSprintAnimFromHands(GClass1355 __instance)
{
__instance.animator_0.SetLayerWeight(4, 0);
}
//[HarmonyPrefix]
//[HarmonyPatch(typeof(EFT.Player), "method_22")]
//private static bool SetHandIKPosition(EFT.Player __instance, float distance2Camera)
Expand Down
4 changes: 3 additions & 1 deletion Patches/Core/Player/WeaponPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ internal class WeaponPatches
private static Transform oldGrenadeHolder;
public static Transform previousLeftHandMarker;
public static GunInteractionController currentGunInteractController;
public static Transform currentScope;

//------------------------------------------------------------------------------------------------------------------------------------------------------------
[HarmonyPostfix]
Expand Down Expand Up @@ -673,7 +674,6 @@ private static void MoveWeaponToIKHands(EFT.Player.FirearmController __instance)
//VRGlobals.weaponHolder.transform.GetChild(0).localPosition = Vector3.zero;
VRGlobals.vrPlayer.isWeapPistol = (__instance.Weapon.WeapClass == "pistol");
}
private static Transform currentScope;
//------------------------------------------------------------------------------------------------------------------------------------------------------------
//NOTE:::::::::::::: Height over bore is the reason why close distances shots aren't hitting, but further distance shots SHOULD be fine - test this
[HarmonyPostfix]
Expand Down Expand Up @@ -702,6 +702,8 @@ private static void SetOpticCamFoV(EFT.CameraControl.OpticComponentUpdater __ins
else
{
currentScope = __instance.transform_0;
if (VRSettings.GetLeftHandedMode())
currentScope.parent.localScale = new Vector3(-1,1,1);
VRGlobals.vrOpticController.scopeCamera = __instance.camera_0;
float zoomLevel = visualController.sightComponent_0.GetCurrentOpticZoom();
string scopeName = opticSight.name;
Expand Down
21 changes: 18 additions & 3 deletions Patches/Core/VR/InitVRPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,18 @@ private static void AddVR(CharacterControllerSpawner __instance)
collider.isTrigger = true;

VRGlobals.camHolder.layer = 7;
VRGlobals.menuVRManager.enabled = false;
VRGlobals.menuOpen = false;
if (!ModSupport.InstalledMods.FIKAInstalled)
{
VRGlobals.menuVRManager.enabled = false;
VRGlobals.menuOpen = false;
}
else {
VRGlobals.vrPlayer.enabled = false;
VRGlobals.camRoot.transform.position = new Vector3(0, -999.8f, -0.5f);
VRGlobals.vrOffsetter.transform.localPosition = Camera.main.transform.localPosition * -1;
VRGlobals.menuOpen = true;
VRGlobals.menuVRManager.OnEnable();
}
if (UIPatches.quickSlotUi == null)
{
GameObject quickSlotHolder = new GameObject("quickSlotUi");
Expand Down Expand Up @@ -179,8 +189,13 @@ private static void SetupIK(LimbIK __instance)
if (__instance.transform.parent.parent.FindChild("weapon_holster1"))
__instance.transform.parent.parent.FindChild("weapon_holster1").gameObject.active = false;

if (__instance.transform.parent.parent.GetComponent<IKManager>() == null)
if (__instance.transform.parent.parent.GetComponent<IKManager>() == null) {
VRGlobals.ikManager = __instance.transform.parent.parent.gameObject.AddComponent<IKManager>();
if (ModSupport.InstalledMods.FIKAInstalled) {
VRGlobals.ikManager.enabled = false;
VRGlobals.camRoot.transform.position = new Vector3(0, -999.8f, -0.5f);
}
}

if (__instance.name == "Base HumanLCollarbone") {
VRGlobals.ikManager.leftArmIk = __instance.transform.GetComponent<LimbIK>();
Expand Down
11 changes: 9 additions & 2 deletions Patches/UI/UIPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,11 @@ private static void SetAmmoCountUi(AnimatedTextPanel __instance)
[HarmonyPatch(typeof(BattleUIScreen<EftBattleUIScreen.GClass3505, EEftScreenType>), "ShowAmmoDetails")]
private static void SetAmmoCountUi(BattleUIScreen<EftBattleUIScreen.GClass3505, EEftScreenType> __instance)
{
__instance._ammoCountPanel.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f);
if (VRSettings.GetLeftHandedMode())
__instance._ammoCountPanel.transform.localScale = new Vector3(-0.25f, 0.25f, 0.25f);
else
__instance._ammoCountPanel.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f);

if (VRGlobals.vrPlayer)
{
VRGlobals.vrPlayer.SetAmmoFireModeUi(__instance._ammoCountPanel.transform, true);
Expand All @@ -754,7 +758,10 @@ private static void SetAmmoCountUi(BattleUIScreen<EftBattleUIScreen.GClass3505,
[HarmonyPatch(typeof(AmmoCountPanel), "ShowFireMode")]
private static void SetFireModeUi(AmmoCountPanel __instance)
{
__instance.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f);
if (VRSettings.GetLeftHandedMode())
__instance.transform.localScale = new Vector3(-0.25f, 0.25f, 0.25f);
else
__instance.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f);
if (VRGlobals.vrPlayer)
{
VRGlobals.vrPlayer.SetAmmoFireModeUi(__instance.transform, false);
Expand Down
8 changes: 5 additions & 3 deletions Patches/Visuals/VisualPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,14 @@ private static bool DisableUltimateBloom(UltimateBloom __instance)
private static bool FixSSAAImplRenderImage(SSAAImpl __instance, RenderTexture source, RenderTexture destination, bool flipV, CommandBuffer externalCommandBuffer)
{
int shaderPass = 0;

if (__instance.CurrentState == SSAAImpl.SSState.UPSCALE)
{
bool flag = ((__instance.EnableDLSS && !__instance._failedToInitializeDLSS && !__instance.NeedToApplySwitch()) || (__instance.EnableDLSS && (__instance.DLSSDebugDisable || DLSSWrapper.WantToDebugDLSSViaRenderdoc))) && !__instance.InventoryBlurIsEnabled;
bool flag2 = __instance.EnableFSR && !__instance._failedToInitializeFSR && !flag && !__instance.NeedToApplySwitch();
bool flag3 = __instance.EnableFSR2 && !__instance._failedToInitializeFSR2 && !flag && !__instance.NeedToApplySwitch();
if ((flag && __instance.TryRenderDLSS(source, destination, externalCommandBuffer)) || (flag2 && __instance.TryRenderFSR(source, destination, externalCommandBuffer)) || (flag3 && __instance.TryRenderFSR2(source, destination, externalCommandBuffer)))
// Attempting to use FSR is causing massive issues and neither scaling option works anyway so just disable it
//bool flag2 = __instance.EnableFSR && !__instance._failedToInitializeFSR && !flag && !__instance.NeedToApplySwitch();
//bool flag3 = __instance.EnableFSR2 && !__instance._failedToInitializeFSR2 && !flag && !__instance.NeedToApplySwitch();
if ((flag && __instance.TryRenderDLSS(source, destination, externalCommandBuffer)))
{
return false;
}
Expand Down
8 changes: 4 additions & 4 deletions Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private void InitializeConditionalPatches()
}
else
{
MyLog.LogWarning("Dependent mod DLL not found. Some functionality will be disabled.");
MyLog.LogWarning("EFT API dll not found, support patches will not be applied.");
}

modDllPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BepInEx\\plugins\\AmandsGraphics.dll");
Expand All @@ -131,7 +131,7 @@ private void InitializeConditionalPatches()
// Apply conditional patches
InstalledMods.AmandsGraphicsInstalled = true;
ApplyPatches("TarkovVR.ModSupport.AmandsGraphics");
MyLog.LogInfo("Dependent mod found and patches applied.");
MyLog.LogInfo("AmandsGraphics found and patches applied.");
}
else
{
Expand All @@ -140,7 +140,7 @@ private void InitializeConditionalPatches()
}
else
{
MyLog.LogWarning("Dependent mod DLL not found. Some functionality will be disabled.");
MyLog.LogWarning("AmandsGraphics dll not found, support patches will not be applied.");
}

modDllPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BepInEx\\plugins\\Fika.Core.dll");
Expand All @@ -166,7 +166,7 @@ private void InitializeConditionalPatches()
}
else
{
MyLog.LogWarning("Dependent mod DLL not found. Some functionality will be disabled.");
MyLog.LogWarning("FIKA Core dll not found, support patches will not be applied.");
}
// Repeat for other mods (AmandsGraphics, FIKA) as needed
}
Expand Down
6 changes: 3 additions & 3 deletions Source/Controls/InputHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public void UpdateCommand(ref ECommand command)
//if ((!VRSettings.GetLeftHandedMode() && VRGlobals.blockRightJoystick) || !VRGlobals.vrPlayer.interactMenuOpen)
if (!VRGlobals.vrPlayer.interactMenuOpen)
return;
float primaryHandScrollAxis = VRSettings.GetLeftHandedMode() ? SteamVR_Actions._default.LeftJoystick.axis.y : SteamVR_Actions._default.RightJoystick.axis.y;
float primaryHandScrollAxis = (VRSettings.GetLeftHandedMode() && WeaponPatches.currentGunInteractController && WeaponPatches.currentGunInteractController.hightlightingMesh) ? SteamVR_Actions._default.LeftJoystick.axis.y : SteamVR_Actions._default.RightJoystick.axis.y;


if (!isScrolling && primaryHandScrollAxis > 0.5f)
Expand Down Expand Up @@ -367,8 +367,8 @@ public void UpdateCommand(ref ECommand command)
{
command = ECommand.ToggleBreathing;
isHoldingBreath = true;
if (VRGlobals.scopeSensitivity * 40f > 0)
VRPlayerManager.smoothingFactor = VRGlobals.scopeSensitivity * 40f;
if (VRGlobals.scopeSensitivity * (VRSettings.GetScopeSensitivity() * 10) > 0)
VRPlayerManager.smoothingFactor = VRGlobals.scopeSensitivity * (VRSettings.GetScopeSensitivity() * 10);
}
else if (isHoldingBreath && (secondaryHandTriggerAmount < 0.5f || !isAiming))
{
Expand Down
Loading

0 comments on commit bc75b59

Please sign in to comment.