Divergent/mods/Anomaly Dependencies/gamedata/scripts/z_parts_inject.script

30 lines
1012 B
Plaintext

cached_r_string_ex = itms_manager.ini_parts.r_string_ex
parts_custom = {}
parts_custom_ini = {
["con_parts_list"] = ini_file_ex("items\\settings\\parts_custom\\con_parts_list\\base_parts.ltx"),
["nor_parts_list"] = ini_file_ex("items\\settings\\parts_custom\\nor_parts_list\\base_parts.ltx")
}
itms_manager.ini_parts.r_string_ex = function(self, s, k)
--printf("Override [%s] [%s]", s, k)
return parts_custom[s] and parts_custom[s][k] or cached_r_string_ex(self, s, k)
end
function collect_parts(ini, t)
local sections = ini:get_sections()
parts_custom[t] = {}
for _, section in pairs(sections) do
--printf("Section: [%s]", section)
local _section = ini:collect_section(section)
for k, v in pairs(_section) do
--printf("Inserted into [%s]: [%s], [%s]", t, k, v)
parts_custom[t][k] = v
end
end
end
function on_game_start()
for section, ini in pairs(parts_custom_ini) do
collect_parts(ini, section)
end
end