第 1 卷第 1 章:1–9 年

This commit is contained in:
Chen Yi
2026-10-05 17:30:11 +08:00
parent c56394afdd
commit 3468433c9a
34 changed files with 2564 additions and 4 deletions
+39
View File
@@ -0,0 +1,39 @@
--@ module = true
-- 观测模式:把界面焦点变化持续追加到 dfannals-observe.log。
-- 用途:发现"新建世界 → 进入 legends → 导出"之间的真实界面序列。
local repeatUtil = require('repeat-util')
local LOG = 'dfannals-observe.log'
local last = nil
local ticks = 0
local function focus_string()
local ok, focus = pcall(dfhack.gui.getCurFocus)
if not ok or not focus then return '?' end
return table.concat(focus, '/')
end
function tick()
ticks = ticks + 1
local fs = focus_string()
if fs ~= last then
last = fs
local f = io.open(LOG, 'a')
if f then
f:write(string.format('%s\t%s\n', os.date('%H:%M:%S'), fs))
f:close()
end
end
end
function start()
repeatUtil.scheduleEvery('dfannals-observe', 10, tick)
local f = io.open(LOG, 'a')
if f then
f:write('--- observe start ' .. os.date('%Y-%m-%d %H:%M:%S') .. '\n')
f:close()
end
end
start()