清单与版本Manifest & versions

Manifest/manifest.xml 告诉游戏这个 Mod 是谁、该用哪个版本目录、包含什么程序。 Manifest/manifest.xml tells the game who the mod is, which version folder to use and what program it contains.

结构Schema

下面的结构树由导出器从 ModXmlManifest / ModMetaVersion 的 XML 序列化规则生成。The tree below is generated from the XML serialisation of ModXmlManifest / ModMetaVersion.

元素Element说明Meaning
packageId必填,全局唯一。作为新增数据的 ID 前缀。不要包含下划线 _:存档记录 Mod 时写成 packageId_name 并按 _ 拆分,含下划线会导致读档时误报缺少 Mod。Required, globally unique; prefixes every row you add. Do not use underscores: saves record mods as packageId_name and split on _, so an underscore causes false “missing mod” warnings when loading.
name / author / desc显示在 Mod 管理界面。Shown in the mod manager.
icon / previewImage相对 Manifest/ 的图片文件名。Image file names relative to Manifest/.
versions必填,至少一个 ModMetaVersion。没有版本的清单会被判为无效并跳过。Required, at least one ModMetaVersion. A manifest without versions is rejected.
version版本目录名,同时是匹配规则的依据(见下)。Mod 的所有内容路径都相对 <Mod>/<version>/。Name of the version folder and the key for matching (below). All content paths are relative to <Mod>/<version>/.
dependencies可重复,每个写一个依赖的 packageId。Repeatable; one depended-on packageId each.
lib / mainDLL Mod:Assemblies/ 下的依赖库与主程序集,见 DLL Mod。DLL mods: libraries and main assembly under Assemblies/; see DLL mods.
luaMainLua Mod:相对 Lua/ 的入口脚本,见 Lua Mod。Lua mods: entry script relative to Lua/; see Lua mods.

版本目录如何选择How a version folder is chosen

游戏按以下顺序在 versions 中查找第一个匹配项(ModXmlManifest.getMatchVersion):The game takes the first match in this order (ModXmlManifest.getMatchVersion):

  1. version 与游戏版本号完全相同,例如 0.9.0008。version equals the full game version, e.g. 0.9.0008.
  2. 原意是“主版本.次版本”(如 0.9),但当前代码查找的是字面量 strs[0].strs[1],这一步实际不会匹配。Intended to match “major.minor” (e.g. 0.9), but the current code looks up the literal string strs[0].strs[1], so this step never matches.
  3. v_common
建议:通用内容放 v_common;只有确实需要针对某个版本的差异时,再增加一个与完整版本号同名的目录。都不匹配时该 Mod 被跳过:日志记录 Mod version mismatch, skipped: packageId=…,不弹窗,其余 Mod 与启动流程不受影响。 Recommendation: put everything in v_common; add a folder named after a full version number only for genuinely version-specific content. If nothing matches, the mod is skipped: the log records Mod version mismatch, skipped: packageId=…, no dialog appears, and other mods and startup carry on.

程序类型的判定How the program type is decided

选中版本里有……Selected version has…结果Result
luaMainLua 程序 Mod。若同时声明了 main/lib 或目录里有 DLL,安装时报错。Lua program mod. Declaring main/lib too, or shipping a DLL, is an error.
main/lib,或 Assemblies/ 下任意 .dllmain/lib, or any .dll under Assemblies/DLL Mod。手机上整个 Mod 被跳过,包括其中的数据和资源。DLL mod. On mobile the whole mod is skipped, data and resources included.
以上都没有None of the above纯数据/资源 Mod,全平台加载。Data/resource-only mod; loads on every platform.
纯数据 Mod 不要在 Assemblies/ 里留 DLL。即使清单没有声明,只要存在 .dll 就会被判成 DLL Mod,手机上无法使用。 Keep Assemblies/ free of DLLs in data-only mods. Even undeclared, any .dll there turns it into a DLL mod that mobile skips.

启用列表、顺序与依赖Enabled list, order and dependencies

  • 启用列表保存在 <persistentDataPath>/mod.dat,只记录 packageId 和顺序。The enabled list is stored in <persistentDataPath>/mod.dat — package IDs and order only.
  • Mod 按启用列表的顺序安装,配置表行也按此顺序追加;同一飞船 ID 的贴图覆盖以后加载者为准。Mods install in list order and their rows are appended in that order; for ship textures the later mod wins for the same ship ID.
  • 依赖不会在加载时检查。它只用于:Mod 管理界面中,依赖没有排在前面时给出提示;以及“自动排序”按钮把依赖移到前面。Dependencies are not checked at load time. They only drive the mod manager's warning when a dependency is not listed earlier, and the “Auto Sort” button that moves dependencies up.
  • 存档会记录保存时已安装的 Mod;读取的存档包含当前未安装的 Mod 时,会弹窗让玩家选择继续或取消。Saves record the mods installed at save time; loading a save that lists a mod not currently installed shows a continue/cancel prompt.