core.mods module

Mod Pack management and merging tools.

core.mods.add_graphics(gfx)[source]

Adds graphics to the mod merge in baselines/temp.

core.mods.can_rebuild(log_file, strict=True)[source]

Test if user can exactly rebuild a raw folder, returning a bool.

core.mods.clear_temp()[source]

Resets the folder in which raws are mixed.

core.mods.get_installed_mods_from_log()[source]

Return best mod load order to recreate installed with available.

core.mods.get_title(mod)[source]

Returns the mod title; either per manifest or from dirname.

core.mods.get_tooltip(mod)[source]

Returns the tooltip for the given mod.

core.mods.install_mods()[source]

Deletes installed raw folder, and copies over merged raws.

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 vanilla

  • Otherwise, 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.read_installation_log(fname)[source]

Read an ‘installed_raws.txt’ and return the mods.

core.mods.read_mods()[source]

Returns a list of mod packs

core.mods.simplify_mods()[source]

Removes unnecessary files from all mods.

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.

core.mods.toggle_premerge_gfx()[source]

Sets the option for pre-merging of graphics.

core.mods.update_raw_dir(path, gfx=('', ''))[source]

Updates a raw dir in place with specified graphics and raws. :returns: True if completed, or False if aborted.

Parameters:
  • path – the full path to the dir to update

  • gfx – Tuple of graphics pack to update to, and pack installed in baselines/temp/

core.mods.will_premerge_gfx()[source]

Returns whether graphics will be merged prior to any mods.