Project Zomboid

Project Zomboid

Mod Load Order Sorter [b42]
 This topic has been pinned, so it's probably important
REfRigERatoR  [developer] 9 Feb @ 3:11am
Sorting Rules
== RU ==

Правила сортировки модов необходимы для оптимизации загрузки и работы модификаций, чтобы избежать конфликтов и обеспечить корректное взаимодействие между ними. Ясная структура сортировки помогает пользователям легко управлять модами и гарантировать, что они загружаются в правильном порядке.


Для описания правил сортировки используются следующие опции:
  • loadAfter - определяет список текстовых ИД модов, разделенных запятой, которые должны быть загружены ПЕРЕД загрузкой целевого мода (то есть целевой мод должен загрузиться ПОСЛЕ указанного списка модов);
  • loadBefore - определяет список текстовых ИД модов, разделенных запятой, которые должны быть загружены ПОСЛЕ загрузки целевого мода (то есть целевой мод должен загрузиться ДО указанного списка модов);
  • Также есть поддержка описания списка несовместимых модов с помощью опции incompatibleMods. При обнаружени несовместимых модов, будет создано соответствующее предупреждение, но сортировка все равно выполнится.
  • loadFirst - определяет должен ли целевой мод быть загружен первым (при наличии нескольких модов с пометкой loadFirst, эти моды будут сортированы в алфавитном порядке);
  • loadLast - определяет должен ли целевой мод быть загружен последним (при наличии нескольких модов с пометкой loadLast, эти моды будут сортированы в алфавитном порядке);
    Опции loadFirst и loadLast могут принимать следующие значения: on - мод будет передвинут относительно всего списка модов category - мод будет передвинут относительно списка модов в одной категории с целенвым модом off - опция не будет применена

Все правила сортировки хранятся в файле sorting_rules.txt (по пути "C:\Users\<YOUR_USERNAME>\Zomboid\Lua\sorting_rules.txt") либо могут быть напрямую описаны разработчиками модов в файле mod.info своего мода

Для того что бы описать правила сортировки в файле sorting_rules.txt используйте следующий формат:
[Text_mod_ID] loadAfter=text_mod_id_1, ... , text_mod_id_n loadBefore=text_mod_id_1, ... , text_mod_id_n incompatibleMods=text_mod_id_1, ... , text_mod_id_n loadFirst=on

Пример содержимого файла sorting_rules.txt:
[ModManagerLoadOrderSorter] loadAfter = ModManager loadLast = category [ETO_Balanced_mode] loadBefore=FH, vs3 incompatibleMods=ETO_Quality_mode, ETO_FPS, ETO_Performance_mode ...

Для Разработчиков модов:
Вы можете описать правила для сортирорвки модов в mod.info файле своего мода.
Достаточно просто добавить желаемые поля loadAfter, loadBefore, loadFirst, loadLast или incompatibleMods и описать соответвующих списки модов.
Однако, есть несколько нюансов:
  1. Все правила, прописанные в mod.info файл, правильно прочитаются только если он расположен в папке common (а не в папке с номером версии игры)
  2. Если mod.info файл расположен в папке с номером версии игры, то прочитаются только следующие правила: loadModAfter, loadModBefore и incompatible (аналоги правил loadAfter, loadBefore и incompatibleMods)

Данные ограничения связаны с тем, что разработчики игры добавили поддержку версионирования модов по номеру версии игры, но метод getModFileReader, который я использую для чтения файла mod.info, читает только mod.info файл из папки common.

Пример содержимого файла mod.info:
name=some mod name description=Some description id=ModID ... loadAfter=modId1,modID2 loadBefore=modId4 incompatibleMods=modID255 loadFirst=on

ВАЖНО!!! Весь список модов для каждой отдельной опции должен быть описан на одной строке
Last edited by REfRigERatoR; 9 Feb @ 3:34am
< >
Showing 1-1 of 1 comments
REfRigERatoR  [developer] 9 Feb @ 3:36am 
== EN ==

Mod sorting rules are necessary to optimize the loading and operation of mods to avoid conflicts and ensure correct interaction between them. A clear sorting structure helps users easily manage mods and ensure that they are loaded in the correct order.


The following options are used to describe the sorting rules:
  • loadAfter - specifies a comma-separated list of text mod IDs that should be loaded BEFORE loading the target mod (i.e., the target mod should be loaded AFTER the specified list of mods).;
  • loadBefore - specifies a comma-separated list of textual mod IDs that must be loaded AFTER the target mod is loaded (i.e. the target mod must be loaded BEFORE the specified list of mods);
  • There is also support for describing the list of incompatible mods using the incompatibleMods option. If incompatible mods are detected, a corresponding warning will be generated, but sorting will still be performed.
  • loadFirst - determines whether the target mod should be loaded first (if there are multiple mods marked as loadFirst, these mods will be sorted alphabetically);
  • loadLast - determines whether the target mod should be loaded last (if there are multiple mods marked as loadLast, these mods will be sorted alphabetically);
    The loadFirst and loadLast options can have the following values: on - the mod will be moved relative to the entire mod list category - the mod will be moved relative to the list of mods in the same category as the target mod off - the option will not be applied

All sorting rules are stored in the file sorting_rules.txt (at the path “C:\Users\<YOUR_USERNAME>\Zomboid\Lua\sorting_rules.txt”) or can be directly described by mod developers in the file mod.info of their mod.

To describe the sorting rules in the sorting_rules.txt file, use the following format:
[Text_mod_ID] loadAfter=text_mod_id_1, ... , text_mod_id_n loadBefore=text_mod_id_1, ... , text_mod_id_n incompatibleMods=text_mod_id_1, ... , text_mod_id_n loadFirst=on

An example of the contents of the sorting_rules.txt file:
[ModManagerLoadOrderSorter] loadAfter = ModManager loadLast = category [ETO_Balanced_mode] loadBefore=FH, vs3 incompatibleMods=ETO_Quality_mode, ETO_FPS, ETO_Performance_mode ...

For Mod Developers:
You can describe rules for sorting mods in mod.info file of your mod.
Just add the desired fields loadAfter, loadBefore, loadFirst, loadLast or incompatibleMods and describe the corresponding lists of mods.

However, there are a few nuances:
  1. All rules written in the mod.info file will be read correctly only if it is located in the common folder (not in the folder with the game version number).
  2. If mod.info file is located in the folder with game version number, only the following rules will be read: loadModAfter, loadModBefore and incompatible (similar to loadAfter, loadBefore and incompatibleMods).

These limitations are due to the fact that the game developers added support for versioning mods by game version number, but the getModFileReader method I use to read the mod.info file only reads the mod.info file from the common folder.

An example of the contents of the mod.info file:
name=some mod name description=Some description id=ModID ... loadAfter=modId1,modID2 loadBefore=modId4 incompatibleMods=modID255

IMPORTANT!!! The entire list of mods for each individual option must be described on one line
Last edited by REfRigERatoR; 9 Feb @ 3:37am
< >
Showing 1-1 of 1 comments
Per page: 1530 50