add 飞行状态、上马状态、跟随状态监控

This commit is contained in:
王鹏
2026-03-23 09:25:22 +08:00
parent 9bcc3a467c
commit be436b66a7
14 changed files with 122 additions and 32 deletions

View File

@@ -4,9 +4,9 @@
供外部 Python 等脚本截取小区域即可获取完整状态机。
]]
-- 配置:8个状态位1个白色锚点 + 7个数据位)
-- 配置:10个状态位1个白色锚点 + 9个数据位)
local PIXEL_SIZE = 10
local STATUS_COUNT = 8
local STATUS_COUNT = 10
local ADDON_NAME = "LogicBeacon"
-- 默认配置(可被 SavedVariables 覆盖)
@@ -27,8 +27,8 @@ for k, v in pairs(defaults) do
LogicBeaconDB[k] = v
end
end
-- 升级:至少 8 个状态位(含目标位+后勤位+坐标朝向
LogicBeaconDB.statusCount = math.max(LogicBeaconDB.statusCount or 0, 8)
-- 升级:至少 10 个状态位(含跟随信号
LogicBeaconDB.statusCount = math.max(LogicBeaconDB.statusCount or 0, 10)
local db = LogicBeaconDB
@@ -48,7 +48,7 @@ local bg = f:CreateTexture(nil, "BACKGROUND")
bg:SetAllPoints()
bg:SetColorTexture(0, 0, 0, 1)
-- 像素纹理([1]=锚点 [2~8]=数据位)
-- 像素纹理([1]=锚点 [2~10]=数据位)
local pixels = {}
for i = 1, db.statusCount do
local tex = f:CreateTexture(nil, "OVERLAY")
@@ -98,6 +98,47 @@ local function GetPlayerCoords()
return 0, 0
end
-- 专门用于计算飞行信号的函数R 通道0 未上马 / 0.5 可起飞需按空格 / 1.0 已在飞)
local function GetFlightSignal()
local isMounted = IsMounted()
local isFlying = IsFlying()
local canFly = IsFlyableArea()
if not isMounted then
return 0
end
if isMounted and canFly and not isFlying then
if not UnitAffectingCombat("player") and IsOutdoors() then
return 0.5
end
end
if isMounted and isFlying then
return 1.0
end
return 0
end
-- 专门用于计算跟随信号的函数R 通道0 未组队 / 0.5 需补跟随 / 1.0 跟随中)
local function GetFollowSignal()
if not IsInGroup() then
return 0
end
local leader = "party1"
if IsFollowing() then
return 1.0
else
if UnitExists(leader) and UnitIsVisible(leader) then
return 0.5
end
end
return 0
end
f:SetScript("OnUpdate", function()
-- [1] 锚点:永远纯白 (255, 255, 255)
pixels[1]:SetColorTexture(1, 1, 1)
@@ -150,6 +191,16 @@ f:SetScript("OnUpdate", function()
math.floor((mapY * 10000) % 100) / 255,
0
)
-- [9] R=飞行信号 GetFlightSignal()G=上马(1/0)B=可飞区域 IsFlyableArea()
local fSignal = GetFlightSignal()
local mountedSig = IsMounted() and 1 or 0
local canFlySig = IsFlyableArea() and 1 or 0
pixels[9]:SetColorTexture(fSignal, mountedSig, canFlySig, 1)
-- [10] R=跟随信号0 / 0.5 需补跟随 / 1.0 跟随中)
local followSig = GetFollowSignal()
pixels[10]:SetColorTexture(followSig, 0, 0, 1)
end)
-- 可拖动