diff --git a/AutoMark/scripts/mods/AutoMark/utils/utils.lua b/AutoMark/scripts/mods/AutoMark/utils/utils.lua index 490fd9a..92f3874 100644 --- a/AutoMark/scripts/mods/AutoMark/utils/utils.lua +++ b/AutoMark/scripts/mods/AutoMark/utils/utils.lua @@ -34,3 +34,58 @@ end function mod:get_latest_fixed_time() return FixedFrame.get_latest_fixed_time() end + +-- Dev utility: dump all current game breeds to a file so mod hard-coded breed tables +-- can be diffed against the live game after updates. Runs once on mod load. +function mod:dump_breeds() + local Breed = require("scripts/utilities/breed") + local Breeds = require("scripts/settings/breed/breeds") + + local names = {} + for breed_name, breed_data in pairs(Breeds) do + if type(breed_data) == "table" and (Breed.is_minion(breed_data) or breed_data.is_boss) then + names[#names + 1] = breed_name + end + end + table.sort(names) + + local lines = {} + lines[#lines + 1] = "breed dump v1" + for _, breed_name in ipairs(names) do + local breed_data = Breeds[breed_name] + local tags = {} + for tag_name, value in pairs(breed_data.tags or {}) do + if value then + tags[#tags + 1] = tag_name + end + end + table.sort(tags) + local pounce_setting = breed_data.companion_pounce_setting + local pounce_action = pounce_setting and pounce_setting.companion_pounce_action or "" + local passes_filter = Breed.is_minion(breed_data) and breed_data.unit_template_name == "minion" and + breed_data.smart_tag_target_type == "breed" and breed_data.faction_name ~= "imperium" + lines[#lines + 1] = string.format("%s|tpl=%s|tag_type=%s|faction=%s|boss=%s|filter=%s|her=%s|hef=%s|pounce=%s|tags=%s", + breed_name, + tostring(breed_data.unit_template_name), + tostring(breed_data.smart_tag_target_type), + tostring(breed_data.faction_name), + tostring(breed_data.is_boss == true), + tostring(passes_filter), + tostring(breed_data.half_extent_right), + tostring(breed_data.half_extent_forward), + pounce_action, + table.concat(tags, ",")) + end + + local path = "./../mods/AutoMark/breed_dump.txt" + local file, err = io.open(path, "w") + if file then + file:write(table.concat(lines, "\n")) + file:close() + mod:echo("breed dump written:", path) + else + mod:echo("breed dump FAILED:", tostring(err)) + end +end + +mod:dump_breeds()