Fix store.jsonc vehiclePacks nesting and gjn field name, matchingApiFunc callback argument order, and DaGui CSS @import/lowercase rules; add stock archive inspection steps, BR-to-mrank table, cloned vehicle walkthrough, tuning field reference, and official-map-selector full-stack trace while bringing en/01..07.md to full 1:1 parity with zh-CN/.
459 lines
23 KiB
Markdown
459 lines
23 KiB
Markdown
# 02 · Client Packs & BLK Incremental Patching
|
||
|
||
Most War Thunder data mods—tweaking vehicle performance, shell penetration, missile maneuverability, tech-tree layouts, Silver Lion / Research Point prices, Battle Ratings, localized names, and vehicle icons—live inside `.vromfs.bin` data packs. This chapter explains how to modify those packs in a **100% stackable, conflict-free** way, ending with a copy-pasteable walkthrough that clones a playable standalone tank into the US Rank I tech tree.
|
||
|
||
---
|
||
|
||
## 1. Plain-Language Intro: What Is BLK & Why Does It Differ from JSON?
|
||
|
||
War Thunder's Dagor Engine stores nearly all game configurations in **BLK (DataBlock)** files—compiled to compact binary inside `.vromfs.bin` packs, and readable as plain text `.blk` when unpacked. While text BLK looks superficially similar to JSON, it differs in three fundamental ways:
|
||
|
||
1. **Every parameter carries an explicit static type suffix**: such as `:i` (32-bit integer), `:r` (32-bit float), `:t` (string), or `:b` (boolean `yes`/`no`). Writing `:i` where the engine expects `:r` causes the engine to ignore decimal values;
|
||
2. **Duplicate parameter names are allowed inside the same block**: for instance, `slaveUnit:t="launcher_a"` followed immediately by `slaveUnit:t="launcher_b"` (converting naively to a plain JSON object would overwrite the first key!);
|
||
3. **Duplicate sibling block names are allowed under the same parent**: most notably in `shop.blk`, where every army/aviation branch contains multiple sibling `range { ... }` blocks side by side.
|
||
|
||
Compare this 8-line stock text `.blk` excerpt (`us_m2a4` in `wpcost.blk`) side by side with its `.blk.patch.jsonc` patch operation:
|
||
|
||
```blk
|
||
// Stock readable text BLK (excerpt from char.vromfs.bin -> config/wpcost.blk)
|
||
us_m2a4 {
|
||
value:i = 0
|
||
rank:i = 1
|
||
economicRankHistorical:i = 0
|
||
rewardMulHistorical:r = 0.1
|
||
country:t = "country_usa"
|
||
unitClass:t = "exp_tank"
|
||
}
|
||
```
|
||
|
||
```jsonc
|
||
// Matching incremental patch: client/packs/char.vromfs.bin/config/wpcost.blk.patch.jsonc
|
||
// Touches ONLY us_m2a4's Realistic reward multiplier without clobbering other fields or other mods!
|
||
{
|
||
"ops": [
|
||
{
|
||
"op": "setParam",
|
||
"path": ["us_m2a4"],
|
||
"name": "rewardMulHistorical",
|
||
"value": { "type": "real", "value": 1.2 }
|
||
}
|
||
]
|
||
}
|
||
```
|
||
|
||
---
|
||
|
||
## 2. The 8 Overlayable Client Data Packs
|
||
|
||
Place your files under `client/packs/<pack-path>/` matching the target archive's internal path:
|
||
|
||
| Target Directory | Common Contents | Backup Strategy |
|
||
| --- | --- | --- |
|
||
| `client/packs/char.vromfs.bin/` | `config/shop.blk` (tech tree), `config/wpcost.blk` (economy/BR/modifications), `config/unittags.blk`, `config/items.blk`, `config/modifications.blk` | Always rebuilt from stock |
|
||
| `client/packs/aces.vromfs.bin/` | `gamedata/units/.../*.blk` (vehicle models/DM/turrets), `gamedata/flightmodels/...` (FMs), `gamedata/weapons/...` (guns/shells/missiles), `config/settings.blk` | Always rebuilt from stock |
|
||
| `client/packs/gui.vromfs.bin/` | New standalone `.nut` scripts, `.tpl` templates, `.css` stylesheets (to edit stock UI files, see Chapter 04 `gui-patches`) | Always rebuilt from stock |
|
||
| `client/packs/lang.vromfs.bin/` | `lang/units.csv`, `lang/menu.csv`, `lang/units_weaponry.csv`, and other localization CSVs | Backed up on demand, restored on disable |
|
||
| `client/packs/mis.vromfs.bin/` | `gamedata/missions/.../*.blk` multiplayer and custom missions | Backed up on demand, restored on disable |
|
||
| `client/packs/game.vromfs.bin/` | `danetlibs/...`, `game/...` scripts and configs | Backed up on demand, restored on disable |
|
||
| `client/packs/ui/atlases.vromfs.bin/` | `gameuiskin/<lowercase_unit_id>_ico.svg` (tech-tree & local web store silhouette icons) | Backed up on demand, restored on disable |
|
||
| `client/packs/ui/images.vromfs.bin/` | `units/<unit_id>.ddsx` or `.png` (stat-card / crew-slot vehicle images) | Backed up on demand, restored on disable |
|
||
|
||
> **Automatic Server Sync**: The local server reads static datasets directly from the overlaid `.vromfs.bin` packs on startup. Any vehicle added or tweaked in `shop.blk` / `wpcost.blk` is automatically picked up for prices, tech-tree prerequisites, Research Points, modifications, Battle Ratings, AI bot pools, and store pack GUIDs—no duplicate server registration needed.
|
||
|
||
---
|
||
|
||
## 3. Three File Handling Modes Inside Packs (Auto-Detected by Suffix)
|
||
|
||
The patcher determines how to process each file under `client/packs/<pack>/` by its filename suffix:
|
||
|
||
1. **`<target-path>.patch.jsonc` → Structured Incremental BLK Patch**: decodes the target `.blk` into a type-preserving tree, applies `ops` in order, and re-encodes a self-contained binary BLK;
|
||
2. **`<target-path>.patch.csv` → Incremental Localization CSV Merge**: merges rows by column 0 (updating only the non-empty language columns you provide on existing keys, and appending new keys at the end);
|
||
3. **Any other file (e.g. `us_m2a4_mod_demo.blk`, `us_m2a4_mod_demo_ico.svg`) → Add or Replace File**:
|
||
- If the path ends with `.blk` and your source file is **plain text BLK** (for example, extracted and edited from your stock client), the builder automatically compiles it into **binary BLK** for the engine;
|
||
- Binary `.blk` files and other assets (`.svg`, `.ddsx`, `.nut`, `.tpl`, `.css`) are written into the archive as-is.
|
||
|
||
---
|
||
|
||
## 4. Complete BLK Incremental Patch (`*.blk.patch.jsonc`) Reference
|
||
|
||
### 4.1 Document Format & Path Addressing
|
||
|
||
```jsonc
|
||
{
|
||
"ops": [
|
||
// Ordered list of patch operations
|
||
]
|
||
}
|
||
```
|
||
|
||
- `path` is an array of child block names starting from the BLK root, e.g. `["country_usa", "army", "range[0]"]`;
|
||
- Duplicate sibling blocks (such as consecutive `range` blocks in `shop.blk`) can be addressed precisely with **`name[index]`** (zero-based); omitting `[index]` selects occurrence `0`;
|
||
- `[]` refers to the root block of the current document.
|
||
|
||
### 4.2 All 7 Patch Operations (`op`)
|
||
|
||
#### ① `setParam`: Set a parameter (overwrites & deduplicates same-named params if present; appends if absent)
|
||
|
||
Always prefer **`setParam`** when updating a single parameter on an existing block:
|
||
|
||
```jsonc
|
||
{
|
||
"op": "setParam",
|
||
"path": ["us_m2a4"],
|
||
"name": "rewardMulHistorical",
|
||
"value": { "type": "real", "value": 1.2 },
|
||
"createBlocks": false // Optional (default false); set true to auto-create missing blocks along path
|
||
}
|
||
```
|
||
|
||
#### ② `addParam`: Append a duplicate-named parameter (preserves existing entries; ideal for `slaveUnit`, `folder`, `aircraftGift`)
|
||
|
||
```jsonc
|
||
{
|
||
"op": "addParam",
|
||
"path": ["country_usa", "army", "range[0]", "us_m2a4"],
|
||
"name": "slaveUnit",
|
||
"value": "my_extra_launcher"
|
||
}
|
||
```
|
||
|
||
#### ③ `removeParam`: Delete parameters (deletes all matching `name` when `value` is omitted, or only entries matching `value`)
|
||
|
||
```jsonc
|
||
{
|
||
"op": "removeParam",
|
||
"path": ["us_m2a4"],
|
||
"name": "showOnlyWhenBought"
|
||
}
|
||
```
|
||
|
||
#### ④ `upsertBlock`: Find or create a child block and append `params` & `blocks`
|
||
|
||
```jsonc
|
||
{
|
||
"op": "upsertBlock",
|
||
"path": ["country_usa", "army", "range[0]", "my_custom_tank"],
|
||
"block": {
|
||
"params": [
|
||
{ "name": "rank", "value": { "type": "int", "value": 8 } },
|
||
{ "name": "reqAir", "value": "us_m1a2_sep2_abrams" }
|
||
]
|
||
}
|
||
}
|
||
```
|
||
|
||
> **Important Behavior Note (Avoid Duplicate Keys)**: If the target block along `path` **does not exist**, `upsertBlock` creates it and populates `block.params` and `block.blocks`. However, if the target block **already exists**, `upsertBlock` **appends** every entry in `block.params` (via `appendParam`) and `block.blocks` to the end of the block **without overwriting existing same-named parameters**! Use `upsertBlock` to create new blocks or append multi-value params; **to overwrite an existing parameter on an existing block, always use `setParam`**.
|
||
|
||
#### ⑤ `addBlock`: Insert a new child block under a parent (supports `before` / `after` sibling anchors)
|
||
|
||
```jsonc
|
||
{
|
||
"op": "addBlock",
|
||
"path": ["country_usa", "army", "range[0]"],
|
||
"name": "my_custom_tank",
|
||
"after": "us_m3a1_stuart",
|
||
"block": {
|
||
"params": [
|
||
{ "name": "rank", "value": { "type": "int", "value": 1 } },
|
||
{ "name": "reqAir", "value": "us_m2a4" }
|
||
]
|
||
}
|
||
}
|
||
```
|
||
|
||
#### ⑥ `removeBlock`: Delete a child block at `path`
|
||
|
||
```jsonc
|
||
{
|
||
"op": "removeBlock",
|
||
"path": ["country_usa", "army", "range[0]", "some_vehicle"]
|
||
}
|
||
```
|
||
|
||
#### ⑦ `cloneBlock`: Deep-clone an existing block in the same file under `newName` with nested `ops` (essential for derived vehicles!)
|
||
|
||
In `wpcost.blk` and `unittags.blk`, each vehicle block contains dozens of repair, crew, modification, and weapon-preset sub-blocks. `cloneBlock` copies a stock donor vehicle completely in one step and lets you tweak only the differences via nested `ops`:
|
||
|
||
```jsonc
|
||
{
|
||
"op": "cloneBlock",
|
||
"from": ["us_m1a2_sep2_abrams"],
|
||
"toParent": [],
|
||
"newName": "us_m1a2_mod_example",
|
||
"replaceExisting": true,
|
||
"ops": [
|
||
{ "op": "setParam", "path": [], "name": "value", "value": { "type": "int", "value": 10000 } },
|
||
{ "op": "setParam", "path": [], "name": "reqExp", "value": { "type": "int", "value": 50000 } },
|
||
{ "op": "setParam", "path": [], "name": "economicRankHistorical", "value": { "type": "int", "value": 34 } }
|
||
]
|
||
}
|
||
```
|
||
|
||
> Note: Nested `ops` inside `cloneBlock` run with **the newly cloned block itself as the root**, so use `"path": []` when editing top-level fields on the cloned block.
|
||
|
||
### 4.3 All 13 BLK Data Types
|
||
|
||
When you write a plain JSON primitive, the patcher infers the BLK type from any existing parameter of the same name on that block (falling back to `string`, `bool`, `int` for integers, or `real` for non-integers). To guarantee exact binary types—especially when setting a float parameter to a whole number like `2.0`, which JSON parses as integer `2`—write `{ "type": "<type>", "value": <val> }`:
|
||
|
||
| `type` | Text BLK Suffix | `value` Example & Notes |
|
||
| --- | --- | --- |
|
||
| `string` | `:t` | `"us_m2a4"` |
|
||
| `int` | `:i` | `120` (signed 32-bit integer) |
|
||
| `real` | `:r` | `1.5` (encoded strictly as 32-bit float `:r` even if written as `2`) |
|
||
| `bool` | `:b` | `true` / `false` (`yes` / `no` in text BLK) |
|
||
| `int64` | `:i64` | `"133700000000000000"` or integer (signed 64-bit integer) |
|
||
| `point2` | `:p2` | `[1.0, 2.5]` (2 floats) |
|
||
| `point3` | `:p3` | `[0.0, 1.5, -2.0]` (3 floats) |
|
||
| `point4` | `:p4` | `[0.0, 1.0, 0.0, 1.0]` (4 floats) |
|
||
| `ipoint2` | `:ip2` | `[10, 20]` (2 integers) |
|
||
| `ipoint3` | `:ip3` | `[1, 2, 3]` (3 integers) |
|
||
| `ipoint4` | `:ip4` | `[0, 1, 2, 3]` (4 integers) |
|
||
| `color` | `:c` | `[255, 128, 0, 255]` (`[r, g, b, a]`) or unsigned packed integer `0xAARRGGBB` |
|
||
| `matrix` | `:m` | Array of 12 floats (4×3 transform matrix) |
|
||
|
||
---
|
||
|
||
## 5. Battle Rating (BR) ↔ Internal `mrank` (`economicRank*`) Conversion & Lookup Table
|
||
|
||
A classic question when opening `wpcost.blk` for the first time is: **why are there no `11.7` or `12.7` Battle Rating numbers anywhere in the file?**
|
||
|
||
Internally, War Thunder stores displayed **Battle Ratings (BR)** as zero-based non-negative integers called **`mrank`** (stored in `economicRank*` fields), where **every 3 integer steps equal `1.0` BR** and fractional steps cycle `.0` → `.3` → `.7`:
|
||
|
||
- **Forward formula (`mrank` → displayed BR)**: `BR = 1.0 + Math.floor(mrank / 3) + [0, 0.3, 0.7][mrank % 3]`
|
||
- **Reverse formula (displayed BR → `mrank`)**: `(wholePart - 1) × 3` plus the decimal step (`+0` for `.0`, `+1` for `.3`, `+2` for `.7`). For example, `11.7` → `(11 - 1) × 3 + 2 = 32`!
|
||
|
||
### 5.1 Complete `mrank` ↔ Displayed BR Lookup Table
|
||
|
||
| `mrank` | Displayed BR | `mrank` | Displayed BR | `mrank` | Displayed BR | `mrank` | Displayed BR |
|
||
| --- | --- | --- | --- | --- | --- | --- | --- |
|
||
| `0` | **1.0** | `10` | **4.3** | `20` | **7.7** | `30` | **11.0** |
|
||
| `1` | **1.3** | `11` | **4.7** | `21` | **8.0** | `31` | **11.3** |
|
||
| `2` | **1.7** | `12` | **5.0** | `22` | **8.3** | `32` | **11.7** |
|
||
| `3` | **2.0** | `13` | **5.3** | `23` | **8.7** | `33` | **12.0** |
|
||
| `4` | **2.3** | `14` | **5.7** | `24` | **9.0** | `34` | **12.3** |
|
||
| `5` | **2.7** | `15` | **6.0** | `25` | **9.3** | `35` | **12.7** |
|
||
| `6` | **3.0** | `16` | **6.3** | `26` | **9.7** | `36` | **13.0** |
|
||
| `7` | **3.3** | `17` | **6.7** | `27` | **10.0** | `37` | **13.3** |
|
||
| `8` | **3.7** | `18` | **7.0** | `28` | **10.3** | `38` | **13.7** |
|
||
| `9` | **4.0** | `19` | **7.3** | `29` | **10.7** | `39` | **14.0** |
|
||
|
||
### 5.2 Legacy Mode Suffixes in `wpcost.blk` vs Tech-Tree Tier `rank`
|
||
|
||
War Thunder retains internal field names from its alpha era—be careful not to confuse **tech-tree tier `rank`** with **matchmaking BR `economicRank*`**:
|
||
|
||
| Field Name | Value Range | Meaning |
|
||
| --- | --- | --- |
|
||
| `rank` | `1` .. `8` | **Tech-Tree Era Tier (Rank I – VIII)**: controls which horizontal tier row the vehicle occupies, tier unlock gates, and default store rank-tier pricing |
|
||
| `economicRankArcade` | `0` .. `39+` | **Arcade Battles (AB)** matchmaking `mrank` |
|
||
| `economicRankHistorical` | `0` .. `39+` | **Realistic Battles (RB)** default matchmaking `mrank` (RB was originally called *Historical Battles*) |
|
||
| `economicRankSimulation` | `0` .. `39+` | **Simulator Battles (SB)** default matchmaking `mrank` |
|
||
| `economicRankTankHistorical` | `0` .. `39+` | *(Optional)* Split **Ground RB** `mrank` for aircraft/helicopters with separate air vs ground BRs; falls back to `economicRankHistorical` when omitted |
|
||
| `economicRankTankSimulation` | `0` .. `39+` | *(Optional)* Split **Ground SB** `mrank` for aircraft/helicopters |
|
||
|
||
---
|
||
|
||
## 6. `shop.blk` Anatomy & `units.csv` Localization Suffixes
|
||
|
||
### 6.1 The 4-Level Hierarchy of `config/shop.blk`
|
||
|
||
Inside `char.vromfs.bin`, `config/shop.blk` organizes every nation's research tree into a uniform 4-level hierarchy:
|
||
|
||
```text
|
||
country_usa (or country_germany / country_ussr / country_britain / country_japan / country_china / ...)
|
||
└─ army | helicopters | aviation | ships | boats
|
||
├─ range { ... } <-- range[0]: 1st vertical column (e.g. US Light Tank line)
|
||
├─ range { ... } <-- range[1]: 2nd vertical column (e.g. US Medium Tank line, containing folder us_sherman_group)
|
||
├─ range { ... } <-- range[2]..range[4]: remaining regular Silver Lions research columns
|
||
└─ range { ... } <-- range[5]..range[6]: right-hand Golden Eagle / Pack / Event / Squadron columns
|
||
```
|
||
|
||
Keep three rules in mind when writing `shop.blk.patch.jsonc`:
|
||
|
||
1. **Each sibling `range` block is one vertical column in the tech tree**: since every column block is named `range`, address them left-to-right (zero-based) as `"range[0]"`, `"range[1]"`, `"range[5]"`, etc.;
|
||
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;
|
||
- 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
|
||
|
||
When localizing a vehicle `<id>` in `client/packs/lang.vromfs.bin/lang/units.csv.patch.csv`, War Thunder uses **4 standard localization keys** for different UI contexts and HUD distances:
|
||
|
||
| Key Pattern | Where It Appears in Game | Example (for `us_m2a4_mod_demo`) |
|
||
| --- | --- | --- |
|
||
| `<id>_shop` | **Tech-tree card, crew slot bar, and local web store card** short name | `"M2A4 (Mod Demo)"` / `"M2A4(教学改型)"` |
|
||
| `<id>_0` | **Stat-card header, research completion modal, and battle debriefing** full formal title | `"Light Tank M2A4 (Mod Demo)"` / `"M2A4 轻型坦克(教学改型)"` |
|
||
| `<id>_1` | In-battle **medium-distance 3D HUD marker** name | `"M2A4 Demo"` / `"M2A4 教学型"` |
|
||
| `<id>_2` | In-battle **far-distance HUD marker / compact killfeed** short name | `"M2A4"` / `"M2A4"` |
|
||
|
||
Example `client/packs/lang.vromfs.bin/lang/units.csv.patch.csv`:
|
||
|
||
```csv
|
||
"<ID|readonly|noverify>";"<English>";"<Chinese>";"<HChinese>"
|
||
"us_m2a4_mod_demo_shop";"M2A4 (Mod Demo)";"M2A4(教学改型)";"M2A4(教學改型)"
|
||
"us_m2a4_mod_demo_0";"Light Tank M2A4 (Mod Demo)";"M2A4 轻型坦克(教学改型)";"M2A4 輕型坦克(教學改型)"
|
||
"us_m2a4_mod_demo_1";"M2A4 Demo";"M2A4 教学型";"M2A4 教學型"
|
||
"us_m2a4_mod_demo_2";"M2A4";"M2A4";"M2A4"
|
||
```
|
||
|
||
- Fields must be separated by semicolons `;` and wrapped in double quotes, with column headers on line 1 (list only the language columns you want to populate; omitted columns keep their stock values or default to empty);
|
||
- Existing row keys update only your non-empty columns in place; new keys are appended to the end of the file.
|
||
|
||
---
|
||
|
||
## 7. Patching Root `config.blk` (`client/config-blk.patch.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 standard BLK patch at `client/config-blk.patch.jsonc`:
|
||
|
||
```jsonc
|
||
{
|
||
"ops": [
|
||
{
|
||
"op": "setParam",
|
||
"path": ["sound"],
|
||
"name": "enable_mod",
|
||
"value": { "type": "bool", "value": true },
|
||
"createBlocks": true
|
||
}
|
||
]
|
||
}
|
||
```
|
||
|
||
The launcher backs up the stock `config.blk` to `wtoffline/stock/config.blk` before applying patches and restores it automatically when no enabled mod touches `config.blk`.
|
||
|
||
---
|
||
|
||
## 8. End-to-End Walkthrough: Clone a Playable Standalone Tank (`us_m2a4_mod_demo`) in 5 Minutes
|
||
|
||
Let's connect every piece from this chapter into a complete, copy-pasteable mod that derives a standalone **`us_m2a4_mod_demo`** light tank from stock `us_m2a4`—boosted to `90 km/h`, rated at BR `1.3` (`mrank = 1`), and wired into US Ground Rank I with a research arrow from `M2A4`. Because every player profile owns the reserve `us_m2a4` from the start, you can see the new tank in the US tree and **Test Drive** it immediately!
|
||
|
||
### 8.1 Mod Folder Tree
|
||
|
||
Create `demo-standalone-m2a4/` inside your global `mods/` directory:
|
||
|
||
```text
|
||
mods/demo-standalone-m2a4/
|
||
├─ mod.jsonc
|
||
└─ client/
|
||
└─ packs/
|
||
├─ aces.vromfs.bin/
|
||
│ └─ gamedata/units/tankmodels/
|
||
│ └─ us_m2a4_mod_demo.blk # ① Tank physics/armor/weapons (copied from stock us_m2a4.blk)
|
||
├─ char.vromfs.bin/
|
||
│ └─ config/
|
||
│ ├─ wpcost.blk.patch.jsonc # ② Clone economy, BR, modifications & ammo racks
|
||
│ ├─ shop.blk.patch.jsonc # ③ Insert into US Army column 0 (Rank I)
|
||
│ └─ unittags.blk.patch.jsonc # ④ Clone unit class tags & test-drive mission
|
||
└─ lang.vromfs.bin/
|
||
└─ lang/
|
||
└─ units.csv.patch.csv # ⑤ Localized _shop / _0 / _1 / _2 names
|
||
```
|
||
|
||
### 8.2 Complete File Contents
|
||
|
||
#### Manifest `mod.jsonc`
|
||
|
||
```jsonc
|
||
{
|
||
"format": 1,
|
||
"id": "demo.standalone-m2a4",
|
||
"name": {
|
||
"zh-CN": "独立衍生载具示例:M2A4 教学改型",
|
||
"en": "Standalone Vehicle Demo: M2A4 Mod Demo"
|
||
},
|
||
"version": "0.1.0",
|
||
"author": "YourName",
|
||
"description": {
|
||
"zh-CN": "克隆原版 us_m2a4 新增一辆独立可研发、可试驾的 90km/h 高速轻坦。",
|
||
"en": "Clones stock us_m2a4 into a playable 90 km/h standalone tank in the US Rank I tree."
|
||
},
|
||
"api_version": "0.1-experimental",
|
||
"game_versions": ["2.61.0.*"]
|
||
}
|
||
```
|
||
|
||
#### ① Tank Model Definition `client/packs/aces.vromfs.bin/gamedata/units/tankmodels/us_m2a4_mod_demo.blk`
|
||
|
||
Extract stock `gamedata/units/tankmodels/us_m2a4.blk` from `aces.vromfs.bin` using any method from Chapter 01 Section 2, and save it as `us_m2a4_mod_demo.blk`. Keep `model:t="m2a4"` at the top (so the engine reuses the stock M2A4 3D mesh and textures) and raise its speed and acceleration (plain text `.blk` compiles to binary automatically on build):
|
||
|
||
```blk
|
||
model:t="m2a4"
|
||
// ... (keep the rest of stock us_m2a4.blk unchanged; tweak mobility below to feel the difference) ...
|
||
maxFwdSpeed:r=90.0
|
||
maxRevSpeed:r=25.0
|
||
maxAccel:r=12.0
|
||
```
|
||
|
||
#### ② Economy & BR Patch `client/packs/char.vromfs.bin/config/wpcost.blk.patch.jsonc`
|
||
|
||
Use `cloneBlock` to copy `us_m2a4` (inheriting all weapons, shells, modifications, and backup settings), and set `reqAir` to `"us_m2a4"`, RP cost to `1000`, SL price to `500`, and all mode `mrank` values to `1` (displayed BR **1.3**):
|
||
|
||
```jsonc
|
||
{
|
||
"ops": [
|
||
{
|
||
"op": "cloneBlock",
|
||
"from": ["us_m2a4"],
|
||
"toParent": [],
|
||
"newName": "us_m2a4_mod_demo",
|
||
"replaceExisting": true,
|
||
"ops": [
|
||
{ "op": "setParam", "path": [], "name": "reqAir", "value": "us_m2a4" },
|
||
{ "op": "setParam", "path": [], "name": "reqExp", "value": { "type": "int", "value": 1000 } },
|
||
{ "op": "setParam", "path": [], "name": "value", "value": { "type": "int", "value": 500 } },
|
||
{ "op": "setParam", "path": [], "name": "economicRank", "value": { "type": "int", "value": 1 } },
|
||
{ "op": "setParam", "path": [], "name": "economicRankArcade", "value": { "type": "int", "value": 1 } },
|
||
{ "op": "setParam", "path": [], "name": "economicRankHistorical", "value": { "type": "int", "value": 1 } },
|
||
{ "op": "setParam", "path": [], "name": "economicRankSimulation", "value": { "type": "int", "value": 1 } }
|
||
]
|
||
}
|
||
]
|
||
}
|
||
```
|
||
|
||
#### ③ Tech-Tree Slot Patch `client/packs/char.vromfs.bin/config/shop.blk.patch.jsonc`
|
||
|
||
Insert `us_m2a4_mod_demo` into `country_usa -> army -> range[0]` right after `us_m3a1_stuart` (just before the `us_m5a1_stuart` Rank II break) with an explicit `reqAir: "us_m2a4"`, creating a clean Rank I side-branch arrow from `M2A4` without disturbing the stock Stuart chain:
|
||
|
||
```jsonc
|
||
{
|
||
"ops": [
|
||
{
|
||
"op": "addBlock",
|
||
"path": ["country_usa", "army", "range[0]"],
|
||
"name": "us_m2a4_mod_demo",
|
||
"after": "us_m3a1_stuart",
|
||
"block": {
|
||
"params": [
|
||
{ "name": "rank", "value": { "type": "int", "value": 1 } },
|
||
{ "name": "reqAir", "value": "us_m2a4" }
|
||
]
|
||
}
|
||
}
|
||
]
|
||
}
|
||
```
|
||
|
||
#### ④ Unit Tags & Test-Drive Patch `client/packs/char.vromfs.bin/config/unittags.blk.patch.jsonc`
|
||
|
||
Clone `us_m2a4` in `unittags.blk` so the new ID inherits `type:t="tank"`, `hangar_place:t="tank"`, the ground `testFlight` mission, and light-tank tags:
|
||
|
||
```jsonc
|
||
{
|
||
"ops": [
|
||
{
|
||
"op": "cloneBlock",
|
||
"from": ["us_m2a4"],
|
||
"toParent": [],
|
||
"newName": "us_m2a4_mod_demo",
|
||
"replaceExisting": true
|
||
}
|
||
]
|
||
}
|
||
```
|
||
|
||
#### ⑤ Localization Patch `client/packs/lang.vromfs.bin/lang/units.csv.patch.csv`
|
||
|
||
Copy the 4-row CSV snippet from Section 6.2 above. Enable the mod in the launcher, start the game, open the US Ground Rank I tree, and right-click **M2A4 (Mod Demo) › Test Drive** to take your 90 km/h light tank for a spin!
|