Skip to content

Commit

Permalink
Allow moving with weapon scope active
Browse files Browse the repository at this point in the history
  • Loading branch information
fholger committed Aug 26, 2023
1 parent 4b6cb49 commit 4f44292
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion FCData/scripts/Default/Entities/Weapons/BasicWeapon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ function BasicWeapon.Client:OnUpdate(delta, shooter)
if (shooter == _localplayer) then
local stats = shooter.cnt;

if ((stats.moving or stats.running) and ClientStuff.vlayers:IsActive("WeaponScope") and
if ((stats.running) and ClientStuff.vlayers:IsActive("WeaponScope") and
self.AimMode~=1 and (not shooter.theVehicle) and (not shooter.cnt.lock_weapon)) then
if (self.outOfScopeTime) then
if (_time > self.outOfScopeTime) then
Expand Down
8 changes: 4 additions & 4 deletions Sources/CryGame C++/Solution1/CryGame/VRInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ void VRInput::ProcessInputOnFoot()
if (player && player->GetSelectedWeapon())
{
CWeaponClass* weapon = player->GetSelectedWeapon();
if (weapon->IsZoomActive() && (!IsHandTouchingHead(mainHand) || !player->IsTwoHandedModeActive()))
if (weapon->IsZoomActive() && (!IsHandTouchingHead(mainHand, 0.35f) || !player->IsTwoHandedModeActive()))
{
player->GetEntity()->SendScriptEvent(ScriptEvent_ZoomToggle, 2);
}
else if (player->IsTwoHandedModeActive() && !weapon->IsZoomActive() && IsHandTouchingHead(mainHand) && weapon->HasActualScope())
else if (player->IsTwoHandedModeActive() && !player->m_stats.running && !player->IsSwimming() && !weapon->IsZoomActive() && IsHandTouchingHead(mainHand, 0.3f) && weapon->HasActualScope())
{
player->GetEntity()->SendScriptEvent(ScriptEvent_ZoomToggle, 1);
}
Expand Down Expand Up @@ -169,11 +169,11 @@ void VRInput::ProcessInputOnFoot()
HandleBooleanAction(m_moveJump, &CXClient::TriggerJump, false);
HandleDoubleBindAction(m_weaponsNextDrop, &CXClient::TriggerNextWeapon, &CXClient::TriggerDropWeapon, false);
HandleDoubleBindAction(m_weaponsGrenades, &CXClient::CycleGrenade, &CXClient::TriggerFireGrenade, false);
HandleAnalogAction(m_moveMove, 0, &CXClient::TriggerMoveLR);
HandleAnalogAction(m_moveMove, 1, &CXClient::TriggerMoveFB);
HandleBooleanAction(m_moveSprint, &CXClient::TriggerRunSprint);
}

HandleAnalogAction(m_moveMove, 0, &CXClient::TriggerMoveLR);
HandleAnalogAction(m_moveMove, 1, &CXClient::TriggerMoveFB);
HandleBooleanAction(m_weaponsFire, &CXClient::TriggerFire0);
HandleDoubleBindAction(m_weaponsReloadFireMode, &CXClient::TriggerReload, &CXClient::TriggerFireMode, false);
HandleBooleanAction(m_weaponsGrip, &CXClient::TriggerTwoHandedGrip);
Expand Down

0 comments on commit 4f44292

Please sign in to comment.