Update AA synchronization, CW progression and diagnostics
This commit is contained in:
1 parent
67a819a4d3
commit
30bee81fe9
30 files changed
+1143
-55
No files matched your search
@@ -124,6 +124,35 @@ local function current_facecam_target()
|
||||
return nil, nil, nil, true
|
||||
end
|
||||
|
||||
-- Log only changes, so diagnostics stay useful during long battles.
|
||||
local function log_facecam_target(ok, head, root, id, tracked)
|
||||
local success, detail = pcall(function()
|
||||
if not ok then return 'resolve_error=' .. tostring(head) end
|
||||
return 'tracked=' .. tostring(tracked) .. ' entity=' .. tostring(id)
|
||||
.. ' model=' .. tostring(root and root.name)
|
||||
.. ' head=' .. tostring(head and head.name)
|
||||
.. ' head_parent=' .. tostring(head and head.parent and head.parent.name)
|
||||
.. ' head_active=' .. tostring(head and head.gameObject.activeInHierarchy)
|
||||
end)
|
||||
if not success then detail = 'diagnostic_error=' .. tostring(detail) end
|
||||
if _G.__FC_FACE_LAST_DIAGNOSTIC ~= detail then
|
||||
_G.__FC_FACE_LAST_DIAGNOSTIC = detail
|
||||
local message = '[GaC FaceCam] ' .. detail
|
||||
CS.UnityEngine.Debug.Log(message)
|
||||
local written, err = pcall(function()
|
||||
local dir = _G.__GAC_DIAGNOSTICS_DIR
|
||||
if not dir or dir == '' then error('server diagnostics directory unavailable') end
|
||||
CS.System.IO.Directory.CreateDirectory(dir)
|
||||
local path = CS.System.IO.Path.Combine(dir, 'facecam.log')
|
||||
CS.System.IO.File.AppendAllText(path, tostring(CS.System.DateTime.Now) .. ' ' .. message .. '\n')
|
||||
end)
|
||||
if not written and _G.__FC_FACE_FILE_ERROR ~= tostring(err) then
|
||||
_G.__FC_FACE_FILE_ERROR = tostring(err)
|
||||
CS.UnityEngine.Debug.Log('[GaC FaceCam] file log error: ' .. tostring(err))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function facecam_target(cam)
|
||||
local ok, head, root = pcall(function()
|
||||
local battleHead, battleRoot, id, tracked = current_facecam_target()
|
||||
@@ -152,6 +181,7 @@ local function update_facecam(cam, settings)
|
||||
if now >= (_G.__FC_FACE_NEXT or 0) then
|
||||
_G.__FC_FACE_NEXT = now + 0.15
|
||||
local ok, head, root, id, tracked = pcall(current_facecam_target)
|
||||
log_facecam_target(ok, head, root, id, tracked)
|
||||
if ok and tracked and head and root then
|
||||
_G.__FC_FACE_HEAD, _G.__FC_FACE_ROOT, _G.__FC_FACE_ENTITY = head, root, id
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user