Repository navigation
Expand file tree
/
Copy pathControls.lua
More file actions
48 lines (41 loc) · 1.85 KB
/
Copy pathControls.lua
File metadata and controls
48 lines (41 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
setfenv(1, _G.SlackHacks)
--=====================================================================
-- Controls
--=====================================================================
-- Camera behavior tweaks (max zoom distance, ActionCam-style dynamic pitch/motion).
local module = Self:NewModule("Controls", "AceEvent-3.0")
Self.Controls = module
local function settings()
return db.profile.controls
end
local function applyMaximumCameraZoom()
if settings().maximumCameraZoom then
local maxZoom = 4
if isRetail() then maxZoom = 2.6 end -- Setting the zoom higher than 2.6 in retail sets it back to default
ensureCVar("cameraDistanceMaxZoomFactor", maxZoom)
else
ensureCVar("cameraDistanceMaxZoomFactor", GetCVarDefault("cameraDistanceMaxZoomFactor"))
end
end
local function applyDynamicCamera()
if settings().enableDynamicCamera then
ensureCVar("test_cameraDynamicPitch", 1) -- Equal to `/console ActionCam basic`
-- CameraKeepCharacterCentered=1 silently blocks ActionCam's dynamic pitch from having any effect.
-- Mirrors what turning ON the in-game "Motion Sickness" checkbox does (CameraKeepCharacterCentered=false,
-- CameraReduceUnexpectedMovement=true) -- these two cvars are always set as an inverse pair.
ensureCVar("CameraKeepCharacterCentered", 0)
ensureCVar("CameraReduceUnexpectedMovement", 1)
else
ensureCVar("test_cameraDynamicPitch", GetCVarDefault("test_cameraDynamicPitch"))
ensureCVar("CameraKeepCharacterCentered", GetCVarDefault("CameraKeepCharacterCentered"))
ensureCVar("CameraReduceUnexpectedMovement", GetCVarDefault("CameraReduceUnexpectedMovement"))
end
end
function module:ApplyAll()
applyMaximumCameraZoom()
applyDynamicCamera()
end
function module:OnEnable()
self:RegisterEvent("PLAYER_ENTERING_WORLD", "ApplyAll")
self:ApplyAll()
end