core.mods module¶
Mod Pack management and merging tools.
- core.mods.can_rebuild(log_file, strict=True)[source]¶
Test if user can exactly rebuild a raw folder, returning a bool.
- core.mods.get_installed_mods_from_log()[source]¶
Return best mod load order to recreate installed with available.
- core.mods.make_blank_files(pack)[source]¶
Create blank files where vanilla files are missing.
- Params:
- pack
path segment in ‘./LNP/folder/pack/’ as strings
- Returns:
The number of blank files created
- core.mods.make_mod_from_installed_raws(name)[source]¶
Capture whatever unavailable mods a user currently has installed as a mod called $name.
If
installed_raws.txt
is not present, compare to vanillaOtherwise, rebuild as much as possible, then compare to installed
- core.mods.merge_a_mod(mod)[source]¶
Merges the specified mod, and returns an exit code 0-3.
0: Merge was successful, all well 1: Potential compatibility issues, no merge problems 2: Non-fatal error, overlapping lines or non-existent mod etc. 3: Fatal error, respond by rebuilding to previous mod
- core.mods.merge_all_mods(list_of_mods, gfx=None)[source]¶
Merges the specified list of mods, starting with graphics if set to pre-merge (or if a pack is specified explicitly).
- Params:
- list_of_mods
a list of the names of mods to merge
- gfx
a graphics pack to be merged in
- Returns:
A list of status ints for each mod given – -1: Unmerged 0: Merge was successful, all well 1: Potential compatibility issues, no merge problems 2: Non-fatal error, overlapping lines or non-existent mod etc. 3: Fatal error, not returned (rebuilds to previous, rest unmerged)
- core.mods.merge_file(mod_file_name, van_file_name, gen_file_name)[source]¶
Merges three files, and returns an exit code 0-3.
0: Merge was successful, all well 1: Potential compatibility issues, no merge problems 2: Non-fatal error, overlapping lines or non-existent mod etc. 3: Fatal error, respond by rebuilding to previous mod
- core.mods.merge_folder(mod_folder, vanilla_folder, mixed_folder)[source]¶
Merge the specified folders, output going in ‘LNP/Baselines/temp’ Text files are merged; other files (sprites etc.) are copied over.
- core.mods.merge_line_list(mod_text, vanilla_text, gen_text)[source]¶
Merges sequences of lines.
- Params:
- mod_text
The lines of the mod file being added to the merge.
- vanilla_text
The lines of the corresponding vanilla file.
- gen_text
The lines of the previously merged file or files.
- Returns:
tuple(status, lines); status is 0/’ok’ or 2/’overlap merged’
- core.mods.simplify_pack(pack)[source]¶
Removes unnecessary files from one mod.
- Params:
- pack
path segment in ‘./LNP/Mods/pack/’ as a string
- Returns:
The sum of files affected by the operations
- core.mods.three_way_merge(gen_text, van_gen_ops, mod_text, van_mod_ops)[source]¶
Yield blocks of lines from a three-way-merge. Last block is status.