feat: overlay ACTIONS ring — every mod ping/cancel logged with breed + reason (PING[tag] breed (new|switch), CANCEL breed (mod|dead)) at the three choke points (set_auto_mark, cancel_mark, dead-release), last 5 shown with age; makes priority-switch double-pinging directly observable; NOT installed
This commit is contained in:
@@ -545,6 +545,9 @@ local function auto_mark_by_tag(tag_name, t, fixed_frame)
|
|||||||
local smart_tag_system = context.smart_tag_system
|
local smart_tag_system = context.smart_tag_system
|
||||||
local player_unit = context.player and context.player.player_unit
|
local player_unit = context.player and context.player.player_unit
|
||||||
if smart_tag_system and player_unit then
|
if smart_tag_system and player_unit then
|
||||||
|
if mod.log_action then
|
||||||
|
mod:log_action(string.format("CANCEL %s (dead)", mod:breed_name(marked_target)))
|
||||||
|
end
|
||||||
mod:print_debug("Auto Mark target dead, releasing tag")
|
mod:print_debug("Auto Mark target dead, releasing tag")
|
||||||
smart_tag_system:cancel_tag(marked_tag._id, player_unit, true)
|
smart_tag_system:cancel_tag(marked_tag._id, player_unit, true)
|
||||||
marked_tag = nil
|
marked_tag = nil
|
||||||
|
|||||||
@@ -45,6 +45,13 @@ function mod:cancel_mark(tag_id)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if mod.log_action then
|
||||||
|
local tag = smart_tag_system._all_tags and smart_tag_system._all_tags[tag_id]
|
||||||
|
if tag then
|
||||||
|
mod:log_action(string.format("CANCEL %s (mod)", mod:breed_name(tag._target_unit)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local player = context.player
|
local player = context.player
|
||||||
local player_unit = player and player.player_unit
|
local player_unit = player and player.player_unit
|
||||||
if not player_unit then
|
if not player_unit then
|
||||||
@@ -89,6 +96,9 @@ function mod:set_auto_mark(tag_name, target_unit, target_tag)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if mod.log_action then
|
||||||
|
mod:log_action(string.format("PING[%s] %s (%s)", tostring(tag_name), mod:breed_name(target_unit), tag_context.tag and "switch" or "new"))
|
||||||
|
end
|
||||||
mod:print_debug("Auto Mark", tag_name, target_unit)
|
mod:print_debug("Auto Mark", tag_name, target_unit)
|
||||||
on_set_tag(tag_context)
|
on_set_tag(tag_context)
|
||||||
local template_name_id = NetworkLookup.smart_tag_templates[tag_name]
|
local template_name_id = NetworkLookup.smart_tag_templates[tag_name]
|
||||||
|
|||||||
@@ -141,6 +141,16 @@ function mod:build_debug_hud_lines()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local ring = mod.action_log
|
||||||
|
if ring and #ring > 0 then
|
||||||
|
local now = mod:get_latest_fixed_time()
|
||||||
|
buf[#buf + 1] = "ACTIONS"
|
||||||
|
for i = math.max(1, #ring - 4), #ring do
|
||||||
|
local e = ring[i]
|
||||||
|
buf[#buf + 1] = string.format(" %4.1fs %s", now - e.t, e.s)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local confirm = mod.last_skull_confirm
|
local confirm = mod.last_skull_confirm
|
||||||
if confirm then
|
if confirm then
|
||||||
buf[#buf + 1] = "SERVER last " .. tostring(confirm.n) .. ": " .. (confirm.accepted and "ACCEPTED" or "REJECTED")
|
buf[#buf + 1] = "SERVER last " .. tostring(confirm.n) .. ": " .. (confirm.accepted and "ACCEPTED" or "REJECTED")
|
||||||
|
|||||||
@@ -31,6 +31,30 @@ function mod:get_gameplay_time()
|
|||||||
return Managers.time:time("gameplay")
|
return Managers.time:time("gameplay")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function mod:breed_name(unit)
|
||||||
|
if not unit then
|
||||||
|
return "?"
|
||||||
|
end
|
||||||
|
local ok, name = pcall(function()
|
||||||
|
local ext = ScriptUnit.extension(unit, "unit_data_system")
|
||||||
|
local breed = ext and ext._breed
|
||||||
|
return breed and breed.name or "?"
|
||||||
|
end)
|
||||||
|
return ok and name or "?"
|
||||||
|
end
|
||||||
|
|
||||||
|
mod.action_log = {}
|
||||||
|
function mod:log_action(text)
|
||||||
|
if not (mod_settings.debug_hud or mod_settings.debug_mode) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local ring = mod.action_log
|
||||||
|
ring[#ring + 1] = { t = FixedFrame.get_latest_fixed_time(), s = text }
|
||||||
|
if #ring > 40 then
|
||||||
|
table.remove(ring, 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function mod:get_latest_fixed_time()
|
function mod:get_latest_fixed_time()
|
||||||
return FixedFrame.get_latest_fixed_time()
|
return FixedFrame.get_latest_fixed_time()
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user