feat(mods): compose shared tech tree insertions
Accept manifest declarations for inserting vehicles into an existing research link. Compose shared links in mod load order after ordinary overlays and write matching shop and economy prerequisites. Validate anchors, rank order, and cycles, and document the manifest field. Verified type checks, a 2.61.0.64 build with shared, folded, and cross-column insertions, load-order and disable readback, and the local server health endpoint. In-game acceptance remains pending.
This commit is contained in:
1 parent
0843fde6ff
commit
f86ab99c17
11 files changed
+313
-10
No files matched your search
@@ -141,6 +141,7 @@ Manifest parsing enforces **strict whitelist validation**: typos or unknown keys
|
||||
| `conflicts` | No | `string[]` | Mutually incompatible mod IDs; enabling both raises a **blocking error** |
|
||||
| `load_after` | No | `string[]` | Optional mods this mod should load after (lower in the list = higher priority); does not require them to be enabled, and participates in order hints & **Auto-Sort** |
|
||||
| `load_before` | No | `string[]` | Optional mods this mod should load before; also participates in order hints & **Auto-Sort** |
|
||||
| `tech_tree_insertions` | No | `{ vehicle: string, after: string, before: string }[]` | Inserts vehicles into an existing research link in mod load order. [Example](02-client-packs-and-blk.md#63-inserting-vehicles-into-the-same-research-link) |
|
||||
| `server` | No | `{ entry?: string, tuning?: string }` | Explicit relative paths (no `..`) overriding default auto-detection of `server/index.{ts,mjs,js}` and `server/tuning` |
|
||||
|
||||
---
|
||||
|
||||
@@ -328,7 +328,7 @@ Keep three rules in mind when writing `shop.blk.patch.blk` (or `.patch.jsonc`):
|
||||
2. **Collapsible folder groups (`*_group`)**: when multiple variants share one tech-tree folder, `range` contains a child block ending in `_group` (e.g. `us_sherman_group`) whose children are the grouped vehicles; the folder's display label comes from `shop/group/<group_name>` in `units.csv`;
|
||||
3. **Why is the prerequisite arrow field named `reqAir` even on tanks and ships?**
|
||||
War Thunder began life as an aviation-only game (*World of Planes*), so `air` / `aircraft` remained the universal internal noun for any unit. Consequently, **`reqAir` defines the research prerequisite vehicle across tanks, helicopters, aircraft, and ships alike**!
|
||||
- Setting `reqAir:t="us_m2a4"` in `wpcost.blk` requires owning `us_m2a4` before researching the unit;
|
||||
- With `reqAir:t="us_m2a4"` in `wpcost.blk`, completing research on `us_m2a4` unlocks research on this vehicle. Buying this vehicle requires owning `us_m2a4`.
|
||||
- Inside a `range` column in `shop.blk`: consecutive vehicles with no `reqAir` property automatically connect with vertical arrows; `reqAir:t="us_m2a4"` draws an explicit arrow from `us_m2a4`; and **`reqAir:t=""` (empty string) explicitly breaks the arrow from the vehicle above it** (used at mid-column gaps and throughout the right-hand premium/pack columns).
|
||||
|
||||
### 6.2 All 4 `lang/units.csv` Keys & Incremental CSV Merging
|
||||
@@ -357,6 +357,20 @@ Example `client/packs/lang.vromfs.bin/lang/units.csv.patch.csv`:
|
||||
|
||||
---
|
||||
|
||||
### 6.3 Inserting Vehicles into the Same Research Link
|
||||
|
||||
Supply the vehicle definition and its `wpcost.blk` entry, then declare the research link in `mod.jsonc`. In 2.61.0.64, the F-15C MSIP II follows the F-15A.
|
||||
|
||||
```jsonc
|
||||
"tech_tree_insertions": [
|
||||
{ "vehicle": "my_fighter", "after": "f_15a", "before": "f_15c_msip2" }
|
||||
]
|
||||
```
|
||||
|
||||
- `vehicle` is the mod vehicle ID. `after` and `before` are the existing predecessor and successor IDs. The builder checks that `before` requires `after` in `wpcost.blk` after the ordinary overlays. When migrating a manual insertion, remove the successor's manual `reqAir` edits so the builder can handle the link.
|
||||
- Use regular vehicles from the same nation and branch, with ranks in nondecreasing order. The builder creates a shop entry or reuses one already declared on the same page. An insertion between members of a folder goes inside that folder. An insertion across columns goes in the successor's column.
|
||||
- Multiple mods targeting the same link compose `A → X → Y → B` in the launcher's top-to-bottom order. Reordering or toggling mods rebuilds the chain from stock and the current selection. A missing anchor, a changed link, or a cycle produces a build error naming the mod and vehicles.
|
||||
|
||||
## 7. Patching Root `config.blk` (`client/config-blk.patch.blk` / `.jsonc`)
|
||||
|
||||
If your mod needs to adjust the client root `config.blk` (for example enabling sound mods via `sound{ enable_mod:b=yes }` or setting a custom hangar `hangarBlk:t="..."`), place a BLK patch at `client/config-blk.patch.blk` (recommended; `client/config-blk.patch.jsonc` is also supported):
|
||||
|
||||
@@ -141,6 +141,7 @@ console.log(formatBlkText(decodeBlk(getFile(ar, 'config/wpcost.blk'), { names: a
|
||||
| `conflicts` | 否 | `string[]` | 已知互斥模组 ID 列表;同时启用时作为**阻塞错误**阻止启动 |
|
||||
| `load_after` | 否 | `string[]` | 建议排在这些可选模组 ID 之后(越靠下越晚加载、优先级越高);不强制要求对方启用,若同时启用则参与顺序提示与「按依赖自动排序」 |
|
||||
| `load_before` | 否 | `string[]` | 建议排在这些可选模组 ID 之前;同样参与顺序提示与「按依赖自动排序」 |
|
||||
| `tech_tree_insertions` | 否 | `{ vehicle: string, after: string, before: string }[]` | 按加载顺序把新载具插进指定的研发关系。 [写法](02-client-packs-and-blk.md#63-多个模组插入同一段研发线) |
|
||||
| `server` | 否 | `{ entry?: string, tuning?: string }` | 显式覆盖服务端入口文件(相对路径,不得含 `..`)和 `tuning` 目录路径(默认自动探测 `server/index.{ts,mjs,js}` 与 `server/tuning`) |
|
||||
|
||||
---
|
||||
|
||||
@@ -328,7 +328,7 @@ country_usa (或 country_germany / country_ussr / country_britain / country_japa
|
||||
2. **折叠文件夹(`*_group`)**:当同一格折叠了多辆同系载具时,`range` 下会放一个以 `_group` 结尾的子块(例如 `us_sherman_group`),里面再嵌套各辆具体载具子块,折叠封面标题来自 `units.csv` 的 `shop/group/<组名>`;
|
||||
3. **为什么坦克和军舰的前置研发箭头也叫 `reqAir`?**
|
||||
因为《战争雷霆》最早立项时是纯空战游戏(*World of Planes*),所有载具在底层代码里都沿用了 `air` / `aircraft` 命名,因此**无论是坦克、直升机还是战列舰,指定“上一辆前置研发载具”的字段一律叫 `reqAir`**!
|
||||
- 在 `wpcost.blk` 中设置 `reqAir:t="us_m2a4"`:声明玩家必须先拥有 `us_m2a4` 才能研发本车;
|
||||
- 在 `wpcost.blk` 中设置 `reqAir:t="us_m2a4"`:研发完 `us_m2a4` 才能研发本车,购买本车前须拥有 `us_m2a4`;
|
||||
- 在 `shop.blk` 的同一 `range` 列中:连续排列且未写 `reqAir` 的两辆车默认自动画纵向实线箭头;写 `reqAir:t="us_m2a4"` 会显式从 `us_m2a4` 连出箭头;而写 **`reqAir:t=""`(空字符串)则会显式断开与上方载具的箭头连接**(科技树断线处以及右侧金币/礼包列里的车都用 `reqAir:t=""`)。
|
||||
|
||||
### 6.2 `lang/units.csv` 的 4 个载具译名后缀与 CSV 增量合并
|
||||
@@ -357,6 +357,20 @@ CSV 补丁文件写法示例(`client/packs/lang.vromfs.bin/lang/units.csv.patc
|
||||
|
||||
---
|
||||
|
||||
### 6.3 多个模组插入同一段研发线
|
||||
|
||||
给新载具准备好游戏定义和 `wpcost.blk` 条目,在 `mod.jsonc` 加上要插入的研发关系。例如 2.61.0.64 中,F-15C MSIP II 的前置是 F-15A。
|
||||
|
||||
```jsonc
|
||||
"tech_tree_insertions": [
|
||||
{ "vehicle": "my_fighter", "after": "f_15a", "before": "f_15c_msip2" }
|
||||
]
|
||||
```
|
||||
|
||||
- `vehicle` 是模组载具 ID。`after`、`before` 是已有的前置和后继 ID。构建器在普通补丁叠加后核对 `before` 的 `reqAir` 是否指向 `after`。从手工接线迁移时,把后继载具对 `reqAir` 的手工覆写删掉,让构建器处理这条关系。
|
||||
- 锚点和新载具须为同一国家、同一兵种的常规载具,沿线大等级按顺序递增或相等。构建器可以创建 `shop.blk` 格子,也会复用你已经在同一页声明的格子。插入折叠组内的两个成员之间时,新车进入该组。跨列时,新车在后继载具所在列。
|
||||
- 多个模组声明同一段时,按启动器列表从上到下接成 `A → X → Y → B`。重新排序或调整启用项后,下次构建会从原版和当前模组重新接线。找不到锚点、原连接被改写或组合成循环时,构建错误会指出模组和载具。
|
||||
|
||||
## 7. 修改游戏根目录 `config.blk`(`client/config-blk.patch.blk` / `.jsonc`)
|
||||
|
||||
如果模组需要调整游戏根目录的 `config.blk`(例如开启音效模组开关 `sound{ enable_mod:b=yes }` 或指定自定义机库 `hangarBlk:t="..."`),放一份 BLK 补丁到 `client/config-blk.patch.blk`(推荐,同样兼容 `client/config-blk.patch.jsonc`)即可:
|
||||
|
||||
Reference in new issue
Block a user