diff --git a/persistent b/persistent index c0faa02..21bc3f2 100644 --- a/persistent +++ b/persistent @@ -4,7 +4,7 @@ "auto_technique_food": true, "camera_settings": { "distance": 2, - "mode": "freecam" + "mode": "facecam" }, "currency_wars": { "52022": { diff --git a/scripts/freecam.lua b/scripts/freecam.lua index 1c40231..69ccb5b 100644 --- a/scripts/freecam.lua +++ b/scripts/freecam.lua @@ -555,44 +555,16 @@ function _G.__FREECAM_TICK() _G.__FC_INPUT_FRAME = frame -- Hotkey Handling: - -- F7: Toggle FaceCam directly - -- F8: Toggle FreeCam directly - -- Insert: Toggle active / last camera mode - local toggleFaceCam = Input.GetKeyDown(KeyCode.F7) - local toggleFreeCam = Input.GetKeyDown(KeyCode.F8) - local toggleInsert = Input.GetKeyDown(KeyCode.Insert) - - if toggleFaceCam or toggleFreeCam or toggleInsert then - local settings = _G.__GAC_CAMERA_SETTINGS or {mode="freecam", distance=2} - local defaultMode = settings.mode or "freecam" - - if toggleFaceCam then - if _G.__FREECAM_ENABLED and _G.__FC_ACTIVE_MODE == "facecam" then - _G.__FREECAM_ENABLED = false - else - _G.__FREECAM_ENABLED = true - _G.__FC_ACTIVE_MODE = "facecam" - end - elseif toggleFreeCam then - if _G.__FREECAM_ENABLED and _G.__FC_ACTIVE_MODE == "freecam" then - _G.__FREECAM_ENABLED = false - else - _G.__FREECAM_ENABLED = true - _G.__FC_ACTIVE_MODE = "freecam" - end - elseif toggleInsert then - _G.__FREECAM_ENABLED = not _G.__FREECAM_ENABLED - if _G.__FREECAM_ENABLED and not _G.__FC_ACTIVE_MODE then - _G.__FC_ACTIVE_MODE = defaultMode - end - end - + -- Tab: Main toggle (as set by user) + -- F8 / Insert: Alternate toggles + if Input.GetKeyDown(KeyCode.Tab) or Input.GetKeyDown(KeyCode.F8) or Input.GetKeyDown(KeyCode.Insert) then + _G.__FREECAM_ENABLED = not _G.__FREECAM_ENABLED _G.__FC_LAST_TIME = nil local cam = get_active_cam() - local activeMode = _G.__FC_ACTIVE_MODE or defaultMode + local settings = _G.__GAC_CAMERA_SETTINGS or {mode="facecam", distance=2} if _G.__FREECAM_ENABLED then - if activeMode == "facecam" then + if settings.mode == "facecam" then _G.__FC_FACE_DISTANCE = tonumber(settings.distance) or 2 local head, root if cam then head, root = facecam_target(cam) end @@ -607,10 +579,10 @@ function _G.__FREECAM_TICK() _G.__FC_EULER = cam.transform.eulerAngles set_cinemachine_enabled(cam, false) end - if activeMode == "facecam" then - show_ui("[FaceCam: ON] | F7/Insert: Close | Scroll: Dist | F8: FreeCam") + if settings.mode == "facecam" then + show_ui("[FaceCam: ON] | Tab: Close | Scroll: Distance") else - show_ui("[FreeCam: ON] Speed: " .. string.format("%.1f", _G.__FREECAM_SPEED) .. " | Arrows: Fly | PgUp/PgDn: Height | RMB: Look | F8/Insert: Close | F7: FaceCam") + show_ui("[FreeCam: ON] Speed: " .. string.format("%.1f", _G.__FREECAM_SPEED) .. " | Arrows: Fly | PgUp/PgDn: Height | RMB: Look | Tab: Close") end else if cam then @@ -624,7 +596,7 @@ function _G.__FREECAM_TICK() _G.__FC_FACE_DISTANCE, _G.__FC_FACE_LOCAL_FORWARD = nil, nil _G.__FC_FACE_MISSING_SINCE = nil if _G.__FC_FACE_ANCHOR then CS.UnityEngine.Object.Destroy(_G.__FC_FACE_ANCHOR); _G.__FC_FACE_ANCHOR = nil end - local label = (activeMode == 'facecam') and 'FaceCam' or 'FreeCam' + local label = (settings.mode == 'facecam') and 'FaceCam' or 'FreeCam' show_ui('[' .. label .. ': OFF]') end end @@ -694,10 +666,9 @@ function _G.__FREECAM_TICK() if _G.__FREECAM_ENABLED then local cam = get_active_cam() if cam then - local settings = _G.__GAC_CAMERA_SETTINGS or {mode="freecam", distance=2} - local activeMode = _G.__FC_ACTIVE_MODE or settings.mode or "freecam" + local settings = _G.__GAC_CAMERA_SETTINGS or {mode="facecam", distance=2} - if activeMode == "facecam" then + if settings.mode == "facecam" then if not update_facecam(cam, settings) then set_cinemachine_enabled(cam, true) _G.__FREECAM_ENABLED = false