diff --git a/AutoMark/scripts/mods/AutoMark/AutoMark.lua b/AutoMark/scripts/mods/AutoMark/AutoMark.lua index a462236..6c72d2c 100644 --- a/AutoMark/scripts/mods/AutoMark/AutoMark.lua +++ b/AutoMark/scripts/mods/AutoMark/AutoMark.lua @@ -494,6 +494,21 @@ local function auto_mark_by_tag(tag_name, t, fixed_frame) local disabled_character_state_component = context.disabled_character_state_component local is_character_disabled = disabled_character_state_component and disabled_character_state_component.is_disabled and DISABLING_TYPES[disabled_character_state_component.disabling_type] local target_unit, target_tag, target_is_dormant_daemonhost + -- dead-target tag release: vanilla keeps the tag until the corpse despawns (up to the + -- template lifetime), which starves mark_limit; drop the tag as soon as the target dies + if marked_tag and not marked_tag_is_manual then + local marked_target = marked_tag._target_unit + if marked_target and HEALTH_ALIVE and not HEALTH_ALIVE[marked_target] then + local smart_tag_system = context.smart_tag_system + local player_unit = context.player and context.player.player_unit + if smart_tag_system and player_unit then + mod:print_debug("Auto Mark target dead, releasing tag") + smart_tag_system:cancel_tag(marked_tag._id, player_unit, true) + marked_tag = nil + tag_context.cooldown = 0 + end + end + end if is_character_disabled and (tag_name == TAG_NAMES.COMPANION_TAG or tag_name == TAG_NAMES.SERVO_SKULL_TAG) then local disabling_unit = disabled_character_state_component and disabled_character_state_component.disabling_unit if disabling_unit and (not marked_tag or marked_tag._target_unit ~= disabling_unit) then