Update GaCy-GO
This commit is contained in:
1 parent
da8a32f60d
commit
0cbe460e49
345 files changed
+98202
-77559
No files matched your search
+96
-4
@@ -9,7 +9,28 @@ local GameObject = CS.UnityEngine.GameObject
|
||||
_G.__FREECAM_ENABLED = _G.__FREECAM_ENABLED or false
|
||||
_G.__FREECAM_SPEED = _G.__FREECAM_SPEED or 15.0
|
||||
|
||||
local RAINBOW_TEXT = "<color=#bb00ff>นี่คือเวอร์ชั่นทดสอบของเกย์ </color> <color=#FF0000>Ho</color><color=#FF7F00>nk</color><color=#FFFF00>ai</color> <color=#00FF00>St</color><color=#0000FF>ar</color> <color=#4B0082>Gay</color>"
|
||||
local WATERMARK_PREFIX = "<color=#bb00ff>นี่คือเวอร์ชั่นทดสอบของเกย์ </color> "
|
||||
local WATERMARK_NAME = "Honkai Star Gay"
|
||||
|
||||
-- A closely spaced hue gradient sweeps from right to left.
|
||||
-- Keep the server name, UID, and the Freecam controls independent.
|
||||
local function rainbow_watermark(now)
|
||||
local parts = {WATERMARK_PREFIX}
|
||||
for i = 1, #WATERMARK_NAME do
|
||||
local h = ((now * 0.12 + (i - 1) * 0.035) % 1) * 6
|
||||
local x = 1 - math.abs(h % 2 - 1)
|
||||
local r, g, b
|
||||
if h < 1 then r, g, b = 1, x, 0
|
||||
elseif h < 2 then r, g, b = x, 1, 0
|
||||
elseif h < 3 then r, g, b = 0, 1, x
|
||||
elseif h < 4 then r, g, b = 0, x, 1
|
||||
elseif h < 5 then r, g, b = x, 0, 1
|
||||
else r, g, b = 1, 0, x end
|
||||
parts[#parts + 1] = string.format("<color=#%02X%02X%02X>%s</color>",
|
||||
math.floor(r * 255 + 0.5), math.floor(g * 255 + 0.5), math.floor(b * 255 + 0.5), WATERMARK_NAME:sub(i, i))
|
||||
end
|
||||
return table.concat(parts)
|
||||
end
|
||||
|
||||
local function show_ui(msg)
|
||||
pcall(function()
|
||||
@@ -41,6 +62,42 @@ local function get_active_cam()
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Resolve the character through the active camera's own follow target. A
|
||||
-- humanoid head bone gives a model-relative point as the character moves.
|
||||
-- Do not guess a world position if the Client has no usable target.
|
||||
local function facecam_target(cam)
|
||||
local ok, head, root = pcall(function()
|
||||
local brain = cam:GetComponent(typeof(CS.Cinemachine.CinemachineBrain))
|
||||
local virtual = brain and brain.ActiveVirtualCamera
|
||||
local follow = virtual and virtual.Follow
|
||||
if not follow then return nil, nil end
|
||||
local animator = follow:GetComponentInChildren(typeof(CS.UnityEngine.Animator))
|
||||
if not animator and follow.root then
|
||||
animator = follow.root:GetComponentInChildren(typeof(CS.UnityEngine.Animator))
|
||||
end
|
||||
if not animator or not animator.isHuman then return nil, nil end
|
||||
local bone = animator:GetBoneTransform(CS.UnityEngine.HumanBodyBones.Head)
|
||||
return bone, animator.transform
|
||||
end)
|
||||
if ok then return head, root end
|
||||
return nil, nil
|
||||
end
|
||||
|
||||
local function update_facecam(cam, settings)
|
||||
local head, root = _G.__FC_FACE_HEAD, _G.__FC_FACE_ROOT
|
||||
if not head or not root or not head.gameObject.activeInHierarchy then return false end
|
||||
local distance = tonumber(settings.distance) or 2
|
||||
distance = math.max(0.5, math.min(5, distance))
|
||||
local target = head.position
|
||||
local direction = root.forward
|
||||
local position = target + direction * distance
|
||||
cam.transform.position = position
|
||||
cam.transform.rotation = CS.UnityEngine.Quaternion.LookRotation(target - position, Vector3.up)
|
||||
_G.__FC_POS = cam.transform.position
|
||||
_G.__FC_EULER = cam.transform.eulerAngles
|
||||
return true
|
||||
end
|
||||
|
||||
-- Detach only the active camera brain and restore its recorded state. Virtual
|
||||
-- cameras continue updating animation/effect state; do not scan/disable every
|
||||
-- virtual camera on each render frame.
|
||||
@@ -174,17 +231,42 @@ function _G.__FREECAM_TICK()
|
||||
_G.__FC_LAST_TIME = nil
|
||||
local cam = get_active_cam()
|
||||
if _G.__FREECAM_ENABLED then
|
||||
local settings = _G.__GAC_CAMERA_SETTINGS or {mode="freecam", distance=2}
|
||||
if settings.mode == "facecam" then
|
||||
local head, root
|
||||
if cam then head, root = facecam_target(cam) end
|
||||
if not head or not root then
|
||||
_G.__FREECAM_ENABLED = false
|
||||
show_ui("<color=#FFAA44>FaceCam: character head unavailable</color>")
|
||||
CS.UnityEngine.Debug.Log("[FaceCam] active camera follow target has no humanoid head")
|
||||
return
|
||||
end
|
||||
_G.__FC_FACE_HEAD, _G.__FC_FACE_ROOT = head, root
|
||||
end
|
||||
if cam then
|
||||
_G.__FC_POS = cam.transform.position
|
||||
_G.__FC_EULER = cam.transform.eulerAngles
|
||||
set_cinemachine_enabled(cam, false)
|
||||
end
|
||||
show_ui("<color=#00FF88><b>[FreeCam: ON]</b> Speed: " .. string.format("%.1f", _G.__FREECAM_SPEED) .. " | Arrows: Fly | PgUp/PgDn: Up/Down | RMB: Look</color>")
|
||||
if settings.mode == "facecam" then
|
||||
show_ui("<color=#00FF88><b>[FaceCam: ON]</b> | Tab: Close</color>")
|
||||
else
|
||||
show_ui("<color=#00FF88><b>[FreeCam: ON]</b> Speed: " .. string.format("%.1f", _G.__FREECAM_SPEED) .. " | Arrows: Fly | PgUp/PgDn: Up/Down | RMB: Look</color>")
|
||||
end
|
||||
else
|
||||
if cam then
|
||||
set_cinemachine_enabled(cam, true)
|
||||
end
|
||||
show_ui(RAINBOW_TEXT)
|
||||
_G.__FC_FACE_HEAD, _G.__FC_FACE_ROOT = nil, nil
|
||||
show_ui(rainbow_watermark(Time.unscaledTime or 0))
|
||||
end
|
||||
end
|
||||
|
||||
if not _G.__FREECAM_ENABLED then
|
||||
local now = Time.unscaledTime or 0
|
||||
if now >= (_G.__FC_WATERMARK_NEXT or 0) then
|
||||
_G.__FC_WATERMARK_NEXT = now + 0.05
|
||||
show_ui(rainbow_watermark(now))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -197,6 +279,16 @@ 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}
|
||||
if settings.mode == "facecam" then
|
||||
if not update_facecam(cam, settings) then
|
||||
set_cinemachine_enabled(cam, true)
|
||||
_G.__FREECAM_ENABLED = false
|
||||
_G.__FC_FACE_HEAD, _G.__FC_FACE_ROOT = nil, nil
|
||||
show_ui("<color=#FFAA44>FaceCam: character unavailable</color>")
|
||||
end
|
||||
return
|
||||
end
|
||||
set_cinemachine_enabled(cam, false)
|
||||
|
||||
if not _G.__FC_POS then
|
||||
@@ -287,7 +379,7 @@ if not _G.__FREECAM_REGISTERED then
|
||||
end
|
||||
|
||||
if not _G.__FREECAM_ENABLED then
|
||||
show_ui(RAINBOW_TEXT)
|
||||
show_ui(rainbow_watermark(Time.unscaledTime or 0))
|
||||
end
|
||||
|
||||
-- Restore the in-memory controls before the Client tears down its settings.
|
||||
|
||||
Reference in new issue
Block a user