From 85946a39961e5dbe2fd7528f1c6c3d551a1cb70f Mon Sep 17 00:00:00 2001 From: CAtlas0784 Date: Thu, 29 Oct 2026 00:24:53 +0700 Subject: [PATCH] Refine FaceCam controls and status indicator --- scripts/freecam.lua | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/freecam.lua b/scripts/freecam.lua index dc4fd37..6c46f1d 100644 --- a/scripts/freecam.lua +++ b/scripts/freecam.lua @@ -143,6 +143,9 @@ local function update_facecam(cam, settings) if scroll ~= 0 then distance = distance - scroll * 0.2 end distance = math.max(0.5, math.min(5, distance)) _G.__FC_FACE_DISTANCE = distance + if scroll ~= 0 then + show_ui('[FaceCam: ON] Distance: ' .. string.format('%.1f', distance) .. '') + end local target = head.position local anchor = _G.__FC_FACE_ANCHOR if not anchor or anchor.transform.parent ~= head then @@ -322,6 +325,7 @@ function _G.__FREECAM_TICK() show_ui("[FreeCam: ON] Speed: " .. string.format("%.1f", _G.__FREECAM_SPEED) .. " | Arrows: Fly | PgUp/PgDn: Up/Down | RMB: Look") end else + local settings = _G.__GAC_CAMERA_SETTINGS or {mode="freecam"} if cam then set_cinemachine_enabled(cam, true) end @@ -329,12 +333,13 @@ function _G.__FREECAM_TICK() _G.__FC_FACE_ENTITY = nil _G.__FC_FACE_DISTANCE, _G.__FC_FACE_LOCAL_FORWARD = nil, nil if _G.__FC_FACE_ANCHOR then CS.UnityEngine.Object.Destroy(_G.__FC_FACE_ANCHOR); _G.__FC_FACE_ANCHOR = nil end - show_ui(rainbow_watermark(Time.unscaledTime or 0)) + local label = settings.mode == 'facecam' and 'FaceCam' or 'FreeCam' + show_ui('[' .. label .. ': OFF]') end end local now = Time.unscaledTime or 0 - if not _G.__FREECAM_ENABLED or now >= (_G.__FC_STATUS_UNTIL or 0) then + if now >= (_G.__FC_STATUS_UNTIL or 0) then if now >= (_G.__FC_WATERMARK_NEXT or 0) then _G.__FC_WATERMARK_NEXT = now + 0.05 show_ui(rainbow_watermark(now)) @@ -387,9 +392,11 @@ function _G.__FREECAM_TICK() -- Raw Unity mouse input remains available to the camera while -- InControl battle clicks are gated separately below. + local cameraAdjusted = false if Input.GetMouseButton(1) then local rotX = Input.GetAxis("Mouse X") or 0 local rotY = Input.GetAxis("Mouse Y") or 0 + cameraAdjusted = rotX ~= 0 or rotY ~= 0 _G.__FC_EULER = Vector3(_G.__FC_EULER.x - rotY * 2.5, _G.__FC_EULER.y + rotX * 2.5, 0) end @@ -426,6 +433,11 @@ function _G.__FREECAM_TICK() if move.sqrMagnitude > 0.0001 then _G.__FC_POS = _G.__FC_POS + move.normalized * (_G.__FREECAM_SPEED * dt) + cameraAdjusted = true + end + if cameraAdjusted and now >= (_G.__FC_INDICATOR_NEXT or 0) then + _G.__FC_INDICATOR_NEXT = now + 0.1 + show_ui('[FreeCam: ON] Speed: ' .. string.format('%.1f', _G.__FREECAM_SPEED) .. '') end -- Enforce locked free camera transform EVERY frame @@ -452,7 +464,7 @@ if not _G.__FREECAM_REGISTERED then pcall(function() CS.UnityEngine.Application.onBeforeRender = CS.UnityEngine.Application.onBeforeRender + function() _G.__FREECAM_TICK() end end) end -if not _G.__FREECAM_ENABLED then +if not _G.__FREECAM_ENABLED and (Time.unscaledTime or 0) >= (_G.__FC_STATUS_UNTIL or 0) then show_ui(rainbow_watermark(Time.unscaledTime or 0)) end