Skip to content

Commit

Permalink
Rework aim fov
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerrrry123 committed Aug 12, 2022
1 parent ea2f89d commit 6f7f69e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
22 changes: 17 additions & 5 deletions JerryScript.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1991,17 +1991,29 @@ do
local extraZoom2 = 0
local modifiedAimFov = {}
JSlang.toggle_loop(_LR['Weapon settings'], 'Enable aim fov', {'JSenableAimFov'}, 'Lets you modify the fov you have while you\'re aiming.', function()
JSkey.disable_control_action(0, 'INPUT_SNIPER_ZOOM_IN_ONLY')
JSkey.disable_control_action(0, 'INPUT_SNIPER_ZOOM_OUT_ONLY')

if not JSkey.is_control_pressed(0, 'INPUT_AIM') then
extraZoom2 = 0
return
end

local step = if extraZoom2 > 60 or extraZoom2 < -5 then 3 else 6

if not (extraZoom2 <= -35) and JSkey.is_disabled_control_just_pressed(0, 'INPUT_SNIPER_ZOOM_IN_ONLY') then
extraZoom2 -= step
elseif not (extraZoom2 >= 100) and JSkey.is_disabled_control_just_pressed(0, 'INPUT_SNIPER_ZOOM_OUT_ONLY') then
extraZoom2 += step
end

local weaponHash = readWeaponAddress(modifiedAimFov, 0x2FC, false)
if weaponHash == 0 then return end
memory.write_float(modifiedAimFov[weaponHash].address, modifiedAimFov[weaponHash].original + extraZoom2)
memory.write_float(modifiedAimFov[weaponHash].address, modifiedAimFov[weaponHash].original + extraZoom2)
end, function()
resetWeapons(modifiedAimFov)
end)

JSlang.slider(_LR['Weapon settings'], 'Aim fov', {'JSaimFov'}, '',-40, 100, 0, 1, function(value)
extraZoom2 = value
end)

JSlang.divider(_LR['Weapon settings'], 'Zoom aim fov')

local extraZoom = 0
Expand Down
1 change: 0 additions & 1 deletion commandList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ Weapons — Command: JSweapons
Remove spin-up time — Removes the spin-up from both the minigun and the widowmaker. — Command: JSnoSpinUp [on/off]
Bullet force multiplier — Works best when shooting vehicles from the front. Displayed value is in percent. — Command: JSbulletForceMultiplier [on/off]
Enable aim fov — Lets you modify the fov you have while you're aiming. — Command: JSenableAimFov [on/off]
Aim fov (-40 to 100) — Command: JSaimFov [-40 to 100]
Enable zoom fov — Lets you modify the fov you have while you're aiming and has zoomed in. — Command: JSenableZoomFov [on/off]
Zoom aim fov (1.00 to 99999999.99) — Command: JSzoomAimFov [1.00 to 99999999.99]
Proxy stickys
Expand Down

0 comments on commit 6f7f69e

Please sign in to comment.