Просмотр исходного кода

【新增】让玩具枪经 MXLR 弹仓发射 7.62x25

20x1mm 玩具枪原装弹匣恢复原样(不再直接支持 7.62x25);改为让 Marlin MXLR 的 5 发 .308 ME 管状弹仓兼容全部 7 种 7.62x25 托卡列夫弹药,并把该弹仓加入玩具枪的 mod_magazine 槽,由玩具枪膛室既有的 7.62x25 兼容发射。

csproj 0.15.0→0.15.1;更新测试与文档。
PJ568 1 месяц назад
Родитель
Сommit
7ae2ba161d
7 измененных файлов с 77 добавлено и 29 удалено
  1. 2 2
      README.md
  2. 3 3
      WeaponCrossModding.csproj
  3. 4 4
      docs/compatibility.md
  4. 6 2
      docs/features.md
  5. 4 4
      docs/verification.md
  6. 21 10
      src/Mod.cs
  7. 37 4
      tests/WeaponCrossModding.Tests/ModTests.cs

+ 2 - 2
README.md

@@ -1,6 +1,6 @@
 # PJ568's Weapon Cross Modding
 
-> 一个 SPT 4.1.x 服务端插件:往目标物品槽的过滤器白名单里追加配件 id,让指定武器、瞄具、枪托与握把实现跨武器兼容;并让 20x1mm 玩具枪与其弹匣在保留玩具弹的同时兼容 7.62x25 托卡列夫弹药。
+> 一个 SPT 4.1.x 服务端插件:往目标物品槽的过滤器白名单里追加配件 id,让指定武器、瞄具、枪托与握把实现跨武器兼容;并让 20x1mm 玩具枪(经 Marlin MXLR 的 5 发管状弹仓)兼容 7.62x25 托卡列夫弹药。
 
 ![PPSh-41 满配跨武器改装展示](assets/PPSh-MDR.webp)
 
@@ -38,7 +38,7 @@ SPT `4.1.x`。
 
 # PJ568's Weapon Cross Modding
 
-> An SPT 4.1.x server plugin that appends accessory ids to slot filter whitelists, enabling cross-weapon compatibility between selected weapons, optics, stocks and grips; it also lets the 20x1mm toy gun and its magazine accept 7.62x25 Tokarev ammunition while keeping the toy rounds.
+> An SPT 4.1.x server plugin that appends accessory ids to slot filter whitelists, enabling cross-weapon compatibility between selected weapons, optics, stocks and grips; it also lets the 20x1mm toy gun accept 7.62x25 Tokarev ammunition via the Marlin MXLR 5-round tubular magazine.
 
 ![PPSh-41 fully-kitted cross-weapon build showcase](assets/PPSh-MDR.webp)
 

+ 3 - 3
WeaponCrossModding.csproj

@@ -13,9 +13,9 @@
       钉到 4.1.2 是当前最稳的策略;服务端校验 mod 编译引用的 SPTarkov.Server.Core
       AssemblyVersion,使用 4.1.2 编译的 mod 可被 4.1.5 宿主加载。
     -->
-    <Version>0.15.0</Version>
-    <AssemblyVersion>0.15.0.0</AssemblyVersion>
-    <FileVersion>0.15.0.0</FileVersion>
+    <Version>0.15.1</Version>
+    <AssemblyVersion>0.15.1.0</AssemblyVersion>
+    <FileVersion>0.15.1.0</FileVersion>
     <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
   </PropertyGroup>
 

+ 4 - 4
docs/compatibility.md

@@ -14,12 +14,12 @@
 - **原版物品**:RPD 520mm 枪管、M700 全部 4 种枪管、ORSIS T-5000M 660mm 枪管、SKS 与 OP-SKS 的 520mm 枪管、TAPCO Intrafuse SKS 枪身套件、Fab Defence UAS SKS 枪身套件及其枪托槽配件(TAPCO Intrafuse 缓冲管、Fab Defence UAS 折叠枪托)、SKS / OP-SKS 照门固定环、SKS / OP-SKS / SVT-40 / AVT-40 枪本体与 SVT-40 625mm 枪管、SVDS 照门固定环、SVDS 枪本体与 SVDS 枪管、PPSh-41 71 发弹鼓,以及 AKM PBS-1 7.62x39 消音器均为原版物品,不依赖 `WTT-ContentBackport`。
 - **PPSh-41 上机匣槽**:`mod_reciever` 槽同时承载 PPSh-41 防尘盖、TAPCO Intrafuse SKS 与 Fab Defence UAS SKS 枪身套件,共用同一槽位,因此彼此天然二选一。
 - **新增互斥**:两个 SKS 枪身套件与除 KS-23 金属枪托之外的全部 PPSh-41 枪托(含原装木制枪托与 Zveno 缓冲管转接器)互不兼容;两个 SKS 枪身套件与 PPSh-41 的 71 发弹鼓互不兼容;KS-23 金属枪托与两个 SKS 枪身套件枪托槽可装的配件互不兼容;TKPD 导轨防尘盖与 SKS / OP-SKS / SVT-40 / AVT-40 / SVDS 枪本体互不兼容;SVDS 照门固定环护木槽可装的莫辛 200mm、M700 全部 4 种与 ORSIS T-5000M 枪管与 SVDS 枪本体互不兼容;SVDS 枪管与自身互不兼容(防止重复安装);SVDS 照门固定环与 PPSh-41 防尘盖、TAPCO Intrafuse SKS 枪身套件互不兼容;SVDS 照门固定环护木槽可装的 3 种原版 SVDS 护木与 PPSh-41 枪本体互不兼容;SVDS 照门固定环护木槽可装的 SVT-40 / AVT-40 625mm 枪管与 SVDS 枪本体互不兼容;TKPD 导轨防尘盖与自身互不兼容(防止重复安装);MDR BLK LBL ALX 20 脚架与自身互不兼容(防止重复安装);5 种 SKS 导气管防尘盖与 UltiMAK M1-B AK 导气管套件彼此之间(含与自身)互不兼容,使一把武器上最多只能装一个。
-- **新增兼容**:Fab Defence UAS SKS 枪身套件的下导轨(`mod_tactical_002`)新增兼容 AK-100 系列聚合物护木可安装的全部 33 种前握把(含 Zenit RK 系列、BCM MOD.3、KAC、ASh-12、Tactical Dynamics 镂空、TangoDown Stubby BGV-MK46K 三色、Fortis Shift 等);Alpha Dog Alpha 9 9x19 声音抑制器的 `mod_scope` 槽新增兼容 M14 SAGE International DCSB 瞄具基座。
+- **新增兼容**:Fab Defence UAS SKS 枪身套件的下导轨(`mod_tactical_002`)新增兼容 AK-100 系列聚合物护木可安装的全部 33 种前握把(含 Zenit RK 系列、BCM MOD.3、KAC、ASh-12、Tactical Dynamics 镂空、TangoDown Stubby BGV-MK46K 三色、Fortis Shift 等);Alpha Dog Alpha 9 9x19 声音抑制器的 `mod_scope` 槽新增兼容 M14 SAGE International DCSB 瞄具基座;Marlin MXLR .308 ME 杠杆步枪的 5 发管状弹仓新增兼容全部 7 种 7.62x25 托卡列夫弹药;20x1mm 玩具枪的 `mod_magazine` 槽新增兼容 Marlin MXLR 的 5 发管状弹仓。
 - 插件只改写物品数据库,不注册 Harmony patch,也不与客户端插件争抢运行时方法。
 
 ## 已知限制
 
-- **玩具枪跨口径为实验性**:20x1mm 玩具枪与其原装弹匣的 7.62x25 兼容,只通过追加膛室 / 装填位白名单实现,**未改动武器单值 `ammoCaliber`**。若客户端以 `ammoCaliber` 作为开火硬门控,则同一武器模板「既打 20x1mm 又打 7.62x25」可能无法实际开火;届时可改为克隆一个 `ammoCaliber = Caliber762x25TT` 的武器模板,或接受该枪仅打 7.62x25。
+- **玩具枪跨口径机制**:20x1mm 玩具枪与其弹仓的 7.62x25 兼容,只通过追加膛室(`Chambers`)/ 装填位(`Cartridges`)白名单实现,**未改动武器单值 `ammoCaliber`**。实机验证确认 SPT 客户端的开火门控读取膛室白名单而非 `ammoCaliber`,故同一武器模板可同时发射 20x1mm 与 7.62x25,无需客户端插件。
 - **依赖物品 id 与槽位名**:注入目标取自具体物品 id 与槽位名;若上游数据在版本更新中变更,相关条目会跳过或失效。
 - **必须由服务端加载**:这是服务端模组,仅在服务端数据库层面放宽白名单;未部署到服务端时游戏内不会生效。
 - **版本敏感**:`SPTarkov.Server.Core` 等依赖与 SPT 服务端版本对齐,跨越 4.1.x 之外的版本可能需要重新适配。
@@ -53,12 +53,12 @@
 - **Vanilla items**: the RPD 520 mm barrel, all four M700 barrels, the ORSIS T-5000M 660 mm barrel, the SKS and OP-SKS 520 mm barrels, the TAPCO Intrafuse SKS chassis kit, the Fab Defence UAS SKS chassis kit and their stock-slot parts (TAPCO Intrafuse buffer tube, Fab Defence UAS folding stock), the SKS / OP-SKS rear sight blocks, the SKS / OP-SKS / SVT-40 / AVT-40 weapons and the SVT-40 625 mm barrel, the SVDS rear sight block, the SVDS weapon and the SVDS barrel, the PPSh-41 71-round drum magazine, and the AKM PBS-1 7.62x39 suppressor are all vanilla items and do not depend on `WTT-ContentBackport`.
 - **PPSh-41 upper receiver slot**: the `mod_reciever` slot carries the PPSh-41 dust cover, the TAPCO Intrafuse SKS and the Fab Defence UAS SKS chassis kits; since they share the same slot, they are inherently an either/or choice.
 - **New exclusions**: the two SKS chassis kits are incompatible with every PPSh-41 stock except the KS-23 metal stock (including the PPSh wooden stock and the Zveno buffer tube adapter) and with the PPSh-41 71-round drum magazine; the KS-23 metal stock is incompatible with the parts accepted by the two SKS chassis kits' stock slots; the TKPD railed dust cover is incompatible with the SKS, OP-SKS, SVT-40, AVT-40 and SVDS weapons; the Mosin 200 mm, all four M700 and the ORSIS T-5000M barrels accepted by the SVDS rear sight block's handguard slot are incompatible with the SVDS weapon; the SVDS barrel is incompatible with itself (to prevent duplicate mounting); the SVDS rear sight block is incompatible with the PPSh-41 dust cover and with the TAPCO Intrafuse SKS chassis kit; the 3 vanilla SVDS handguards accepted by the SVDS rear sight block's handguard slot are incompatible with the PPSh-41 weapon itself; the SVT-40 / AVT-40 625 mm barrel accepted by that handguard slot is incompatible with the SVDS weapon; the TKPD railed dust cover is incompatible with itself (to prevent duplicate mounting); the MDR BLK LBL ALX 20 bipod is incompatible with itself (to prevent duplicate mounting); the 5 SKS gas-tube covers and the UltiMAK M1-B AK gas tube kit are mutually incompatible with each other (including with themselves), so at most one can be installed on a weapon.
-- **New compatibility**: the Fab Defence UAS SKS chassis kit's lower rail (`mod_tactical_002`) now accepts all 33 foregrips compatible with the AK-100 series polymer handguards (Zenit RK series, BCM MOD.3, KAC, ASh-12, Tactical Dynamics skeletonized, TangoDown Stubby BGV-MK46K in three colors, Fortis Shift, and 25 others); the Alpha Dog Alpha 9 9x19 sound suppressor's `mod_scope` slot now accepts the M14 SAGE International DCSB scope mount.
+- **New compatibility**: the Fab Defence UAS SKS chassis kit's lower rail (`mod_tactical_002`) now accepts all 33 foregrips compatible with the AK-100 series polymer handguards (Zenit RK series, BCM MOD.3, KAC, ASh-12, Tactical Dynamics skeletonized, TangoDown Stubby BGV-MK46K in three colors, Fortis Shift, and 25 others); the Alpha Dog Alpha 9 9x19 sound suppressor's `mod_scope` slot now accepts the M14 SAGE International DCSB scope mount; the Marlin MXLR .308 ME lever-action rifle's 5-round tubular magazine now accepts all 7 types of 7.62x25 Tokarev ammunition; the 20x1mm toy gun's `mod_magazine` slot now accepts the Marlin MXLR 5-round tubular magazine.
 - The plugin only rewrites the item database. It registers no Harmony patch and never contends with client plugins for runtime methods.
 
 ## Known Limitations
 
-- **The toy gun's cross-caliber support is experimental**: the 7.62x25 compatibility for the 20x1mm toy gun and its stock magazine is implemented only by appending to the chamber / cartridge whitelists, **without changing the weapon's single-value `ammoCaliber`**. If the client uses `ammoCaliber` as a hard firing gate, a single weapon template that fires both 20x1mm and 7.62x25 may not actually fire; in that case, either clone a weapon template with `ammoCaliber = Caliber762x25TT`, or accept that the gun only fires 7.62x25.
+- **The toy gun's cross-caliber mechanism**: the 7.62x25 compatibility of the 20x1mm toy gun and its magazine is implemented only by appending to the chamber (`Chambers`) / cartridge (`Cartridges`) whitelists, **without changing the weapon's single-value `ammoCaliber`**. In-game verification confirmed that the SPT client's firing gate reads the chamber whitelist rather than `ammoCaliber`, so a single weapon template can fire both 20x1mm and 7.62x25 with no client plugin.
 - **Depends on item ids and slot names**: the injection targets come from concrete item ids and slot names; if upstream data changes in a version update, the affected entries are skipped or stop applying.
 - **Must be loaded by the server**: this is a server mod that widens whitelists only at the server database level; it has no in-game effect unless deployed to the server.
 - **Version sensitive**: dependencies such as `SPTarkov.Server.Core` are version-aligned with the SPT server, and going beyond the 4.1.x line may require re-adaptation.

+ 6 - 2
docs/features.md

@@ -25,7 +25,9 @@
 
 ## 弹药与口径
 
-- 20x1mm 玩具枪(`weapon_ussr_pd_20x1mm`)与其原装弹匣(`mag_pd_ussr_toygun_std_20x1mm_18`):在保留原 20x1mm 玩具弹能力的同时,新增对全部 7 种 7.62x25 托卡列夫弹药(AKBS、FMJ43、LRN、LRNPC、P Gl、Pst gzh、T Gzh)的兼容。做法是向武器膛室(`Chambers`)与弹匣装填位(`Cartridges`)白名单追加弹药 id,不改动武器单值 `ammoCaliber`。
+- 20x1mm 玩具枪(`weapon_ussr_pd_20x1mm`)的膛室(`Chambers`):在保留原 20x1mm 玩具弹能力的同时,新增对全部 7 种 7.62x25 托卡列夫弹药(AKBS、FMJ43、LRN、LRNPC、P Gl、Pst gzh、T Gzh)的兼容。做法是向武器膛室(`Chambers`)白名单追加弹药 id,不改动武器单值 `ammoCaliber`;其原装弹匣不再直接支持 7.62x25。
+- Marlin MXLR .308 ME 杠杆步枪的 5 发管状弹仓(`mag_m1895_marlin_mxlr_784x49_5`):新增对全部 7 种 7.62x25 托卡列夫弹药的兼容。
+- 20x1mm 玩具枪(`weapon_ussr_pd_20x1mm`)的 `mod_magazine` 槽:新增 Marlin MXLR 的 5 发管状弹仓(`mag_m1895_marlin_mxlr_784x49_5`)。
 
 ## 握把与配件
 
@@ -84,7 +86,9 @@
 
 ## Ammunition and caliber
 
-- 20x1mm toy gun (`weapon_ussr_pd_20x1mm`) and its stock magazine (`mag_pd_ussr_toygun_std_20x1mm_18`): while keeping the original 20x1mm toy-round capability, adds compatibility with all 7 types of 7.62x25 Tokarev ammunition (AKBS, FMJ43, LRN, LRNPC, P Gl, Pst gzh, T Gzh). It appends the ammo ids to the weapon's chamber (`Chambers`) and the magazine's cartridge (`Cartridges`) whitelists without touching the weapon's single-value `ammoCaliber`.
+- Chamber (`Chambers`) of the 20x1mm toy gun (`weapon_ussr_pd_20x1mm`): while keeping the original 20x1mm toy-round capability, adds compatibility with all 7 types of 7.62x25 Tokarev ammunition (AKBS, FMJ43, LRN, LRNPC, P Gl, Pst gzh, T Gzh). It appends the ammo ids to the chamber whitelist without touching the weapon's single-value `ammoCaliber`; its stock magazine no longer accepts 7.62x25 directly.
+- 5-round tubular magazine of the Marlin MXLR .308 ME lever-action rifle (`mag_m1895_marlin_mxlr_784x49_5`): adds compatibility with all 7 types of 7.62x25 Tokarev ammunition.
+- `mod_magazine` slot of the 20x1mm toy gun (`weapon_ussr_pd_20x1mm`): adds the Marlin MXLR 5-round tubular magazine.
 
 ## Grips and accessories
 

+ 4 - 4
docs/verification.md

@@ -14,7 +14,7 @@
 [Info][...] WeaponCrossModding: added '<物品 id>' to slot '<槽位名>' (<宿主物品名>)
 ```
 
-槽位名应涵盖 `mod_scope`、`mod_sight_front`、`mod_sight_rear`、`mod_barrel`、`mod_stock`、`mod_tactical`、`mod_tactical_000`、`mod_tactical_001`、`mod_pistol_grip`、`mod_mount`、`mod_muzzle`、`mod_reciever`;弹药注入使用 `patron_in_weapon`(武器膛室)与 `cartridges`(弹匣装填位)两个槽名;互斥关系另会输出 `added conflicting item '…' to '…'`。
+槽位名应涵盖 `mod_scope`、`mod_sight_front`、`mod_sight_rear`、`mod_barrel`、`mod_stock`、`mod_tactical`、`mod_tactical_000`、`mod_tactical_001`、`mod_pistol_grip`、`mod_mount`、`mod_muzzle`、`mod_reciever`、`mod_magazine`;弹药注入使用 `patron_in_weapon`(武器膛室)与 `cartridges`(弹匣装填位)两个槽名;互斥关系另会输出 `added conflicting item '…' to '…'`。
 
 ## 验证步骤
 
@@ -34,7 +34,7 @@
    - 在 AA-12 457mm 枪管的导轨槽安装 M60 脚架;
    - 在 Fab Defence UAS SKS 枪身套件的下导轨(`mod_tactical_002`)或 UltiMAK M1-B AK 导气管套件的战术配件槽(`mod_tactical_000`)安装 MDR BLK LBL ALX 20 脚架;
    - 在 MP-18 或 Marlin MXLR 的枪托槽安装 KS-23 金属枪托;
-   - 清客户端缓存后,给 20x1mm 玩具枪的原装弹匣压入 7.62x25 托卡列夫子弹(全部 7 种任选),插枪并尝试开火,确认能否正常发射;同时确认原 20x1mm 玩具弹仍可使用;
+   - 清客户端缓存后,验证 7.62x25 供弹链路:给 Marlin MXLR 的 5 发管状弹仓压入 7.62x25 托卡列夫子弹,插入玩具枪的 `mod_magazine` 槽,尝试开火;同时确认玩具枪原装 20x1mm 玩具弹仍可使用;
    - 尝试同时安装 PPSh-41 防尘盖与 HUXWRX HX-QD 消音器,确认二者互斥;
    - 尝试在 PPSh-41 上同时安装 SKS 枪身套件与任一非 KS-23 枪托(含 Zveno 缓冲管转接器),确认二者互斥;
    - 尝试在 PPSh-41 上同时安装 SKS 枪身套件与 71 发弹鼓,确认二者互斥;
@@ -77,7 +77,7 @@ followed by the individual injections:
 [Info][...] WeaponCrossModding: added '<item id>' to slot '<slot name>' (<owner item name>)
 ```
 
-The slot names should cover `mod_scope`, `mod_sight_front`, `mod_sight_rear`, `mod_barrel`, `mod_stock`, `mod_tactical`, `mod_tactical_000`, `mod_tactical_001`, `mod_pistol_grip`, `mod_mount`, `mod_muzzle`, `mod_reciever`; ammo injections use the two slot names `patron_in_weapon` (weapon chamber) and `cartridges` (magazine cartridge slot); conflicts also print `added conflicting item '…' to '…'`.
+The slot names should cover `mod_scope`, `mod_sight_front`, `mod_sight_rear`, `mod_barrel`, `mod_stock`, `mod_tactical`, `mod_tactical_000`, `mod_tactical_001`, `mod_pistol_grip`, `mod_mount`, `mod_muzzle`, `mod_reciever`, `mod_magazine`; ammo injections use the two slot names `patron_in_weapon` (weapon chamber) and `cartridges` (magazine cartridge slot); conflicts also print `added conflicting item '…' to '…'`.
 
 ## Verification Steps
 
@@ -97,7 +97,7 @@ The slot names should cover `mod_scope`, `mod_sight_front`, `mod_sight_rear`, `m
    - mount an M60 bipod on the rail slot of the AA-12 457 mm barrel;
    - mount an MDR BLK LBL ALX 20 bipod on the lower rail (`mod_tactical_002`) of the Fab Defence UAS SKS chassis kit or the tactical slot (`mod_tactical_000`) of the UltiMAK M1-B AK gas tube kit;
    - mount a KS-23 metal stock on the stock slot of the MP-18 or Marlin MXLR;
-   - after clearing the client cache, load 7.62x25 Tokarev rounds (any of the 7 types) into the stock magazine of the 20x1mm toy gun, insert it and try to fire, confirming whether it fires; also confirm the original 20x1mm toy rounds still work;
+   - after clearing the client cache, load 7.62x25 Tokarev rounds into the Marlin MXLR's 5-round tubular magazine, insert it into the toy gun's `mod_magazine` slot and try to fire; also confirm the original 20x1mm toy rounds still work;
    - try mounting the PPSh-41 dust cover and a HUXWRX HX-QD suppressor together and confirm they are mutually exclusive;
    - try mounting an SKS chassis kit on the PPSh-41 together with any non-KS-23 stock (including the Zveno buffer tube adapter) and confirm they are mutually exclusive;
    - try mounting an SKS chassis kit on the PPSh-41 together with the 71-round drum magazine and confirm they are mutually exclusive;

+ 21 - 10
src/Mod.cs

@@ -66,9 +66,11 @@ namespace Pj568.WeaponCrossModding;
 ///  45. 让 SVDS 照门固定环的照门槽支持安装 OP-SKS 标准 / SKS 木制标准 / ATI Monte Carlo 3 种 SKS 导气管防尘盖与 UltiMAK M1-B AK 导气管套件;
 ///  46. 让 5 种 SKS 导气管防尘盖与 UltiMAK M1-B AK 导气管套件彼此之间(含与自身)互不兼容,使一把武器上最多只能装一个;
 ///  47. 让 UltiMAK M1-B AK 导气管套件的战术配件槽(mod_tactical_000)支持安装 MDR BLK LBL ALX 20 脚架。
-///  48. 让 20x1mm 玩具枪与其原装弹匣在保留 20x1mm 能力的同时支持全部 7 种 7.62x25 托卡列夫弹药
-///      (只补膛室与弹匣装填位白名单,不动武器单值 ammoCaliber)。
-///  49. 让 Alpha Dog Alpha 9 9x19 声音抑制器的 mod_scope 槽支持安装 M14 SAGE International DCSB 瞄具基座。
+///  48. 让 20x1mm 玩具枪的膛室在保留 20x1mm 能力的同时支持全部 7 种 7.62x25 托卡列夫弹药
+///      (只补膛室白名单,不动武器单值 ammoCaliber;其原装弹匣不直接支持,改由 MXLR 弹仓链路供弹)。
+///  49. 让 Marlin MXLR .308 ME 杠杆步枪的 5 发管状弹仓支持全部 7 种 7.62x25 托卡列夫弹药。
+///  50. 让 20x1mm 玩具枪的 mod_magazine 槽支持安装 Marlin MXLR 的 5 发管状弹仓。
+///  51. 让 Alpha Dog Alpha 9 9x19 声音抑制器的 mod_scope 槽支持安装 M14 SAGE International DCSB 瞄具基座。
 ///
 /// 做法:往目标槽的 SlotFilter.Filter(HashSet&lt;MongoId&gt;)追加物品 id(幂等)。
 /// </summary>
@@ -299,12 +301,17 @@ public class WeaponCrossModdingPlugin(
     // PPSh-41 7.62x25 71 发弹鼓。
     private const string Ppsh71DrumMagId = "5ea034f65aad6446a939737e";
 
-    // 20x1mm 玩具枪(weapon_ussr_pd_20x1mm)与其原装弹匣(mag_pd_ussr_toygun_std_20x1mm_18)。
-    // 实验性最小改法:只往膛室与弹匣装填位白名单追加 7.62x25,不动单值 ammoCaliber,故保留原 20x1mm 能力。
+    // 20x1mm 玩具枪(weapon_ussr_pd_20x1mm):其膛室兼容 7.62x25,弹匣槽用于搭载 MXLR 弹仓。
     private const string ToyGunId = "66015072e9f84d5680039678";
-    private const string ToyGunMagId = "66015dc4aaad2f54cb04c56a";
     private const string ToyGunLabel = "20x1mm toy gun";
-    private const string ToyGunMagLabel = "20x1mm toy gun magazine";
+
+    // Marlin MXLR .308 ME 杠杆步枪的 5 发管状弹仓(由 WTT-ContentBackport 注入)。
+    // 让 MXLR 弹仓兼容 7.62x25;玩具枪弹匣槽兼容 MXLR 弹仓。
+    private const string MxlrMagId = "67c5424826265106dd0697a4";
+    private const string MxlrMagLabel = "Marlin MXLR 5-round magazine";
+
+    // 弹匣槽名(玩具枪等宿主共用)。
+    private const string MagazineSlotName = "mod_magazine";
 
     // 7.62x25 托卡列夫弹药(Caliber762x25TT)全部 7 种。
     private static readonly (string Id, string Label)[] Caliber762x25Ammo =
@@ -560,10 +567,14 @@ public class WeaponCrossModdingPlugin(
             AddItemIdsToSlot(items, Mp18RifleId, Mp18RifleLabel, StockSlotName, Ks23MetalStockId);
             AddItemIdsToSlot(items, MarlinMxlrId, MarlinMxlrLabel, StockSlotName, Ks23MetalStockId);
 
-            // 20x1mm 玩具枪与其原装弹匣:在原有 20x1mm 能力之上,追加 7.62x25 托卡列夫全部 7 种弹药。
-            // 只补 Chambers / Cartridges 白名单,不改 ammoCaliber;能否实际开火由实机验证判定。
+            // 20x1mm 玩具枪的膛室:保留 7.62x25 托卡列夫全部 7 种弹药兼容(不动 ammoCaliber;其原装弹匣不直接支持,改由 MXLR 弹仓供弹)。
             AddAmmoIdsToContainer(items, ToyGunId, ToyGunLabel, isChamber: true, [.. Caliber762x25Ammo.Select(x => x.Id)]);
-            AddAmmoIdsToContainer(items, ToyGunMagId, ToyGunMagLabel, isChamber: false, [.. Caliber762x25Ammo.Select(x => x.Id)]);
+
+            // Marlin MXLR 5 发管状弹仓的装填位:追加 7.62x25 托卡列夫全部 7 种弹药。
+            AddAmmoIdsToContainer(items, MxlrMagId, MxlrMagLabel, isChamber: false, [.. Caliber762x25Ammo.Select(x => x.Id)]);
+
+            // 20x1mm 玩具枪的 mod_magazine 槽:追加 Marlin MXLR 5 发管状弹仓。
+            AddItemIdsToSlot(items, ToyGunId, ToyGunLabel, MagazineSlotName, MxlrMagId);
         }
         catch (Exception ex)
         {

+ 37 - 4
tests/WeaponCrossModding.Tests/ModTests.cs

@@ -154,6 +154,7 @@ public class WeaponCrossModdingPluginTests
     private const string Mp18StockExistingAId = "61f803b8ced75b2e852e35f8";
     private const string Mp18StockExistingBId = "61f7b234ea4ab34f2f59c3ec";
     private const string MarlinMxlrId = "67c6de3ce39861860909e8e5";
+    private const string MxlrMagId = "67c5424826265106dd0697a4";
     private const string Ks23MetalStockId = "5e848dc4e4dbc5266a4ec63d";
 
     // 20x1mm 玩具枪、其原装弹匣与玩具弹,以及 7.62x25 托卡列夫全部 7 种弹药。
@@ -1045,8 +1046,9 @@ public class WeaponCrossModdingPluginTests
     }
 
     [Fact]
-    public async Task AddsCaliber762x25ToToyGunMagazineCartridgesKeeping20x1mm()
+    public async Task ToyGunMagazineStillOnlyAccepts20x1mm()
     {
+        // 玩具枪原装弹匣恢复原样:不再支持 7.62x25,改由 MXLR 弹仓链路供弹。
         var mag = ItemWithAmmoContainer("mag_pd_ussr_toygun_std_20x1mm_18", isChamber: false, ToyAmmoId);
         var items = new Dictionary<MongoId, TemplateItem> { [new MongoId(ToyGunMagId)] = mag };
 
@@ -1056,9 +1058,9 @@ public class WeaponCrossModdingPluginTests
         Assert.Contains(new MongoId(ToyAmmoId), filter);
         foreach (string id in Caliber762x25AmmoIds)
         {
-            Assert.Contains(new MongoId(id), filter);
+            Assert.DoesNotContain(new MongoId(id), filter);
         }
-        Assert.Equal(1 + Caliber762x25AmmoIds.Length, filter.Count);
+        Assert.Single(filter);
     }
 
     [Fact]
@@ -1077,7 +1079,7 @@ public class WeaponCrossModdingPluginTests
         await plugin.OnLoadAsync(CancellationToken.None);
 
         Assert.Equal(1 + Caliber762x25AmmoIds.Length, AmmoFilterOf(gun, isChamber: true).Count);
-        Assert.Equal(1 + Caliber762x25AmmoIds.Length, AmmoFilterOf(mag, isChamber: false).Count);
+        Assert.Single(AmmoFilterOf(mag, isChamber: false));
     }
 
     [Fact]
@@ -1094,6 +1096,37 @@ public class WeaponCrossModdingPluginTests
         Assert.Equal(2, filter.Count);
     }
 
+    [Fact]
+    public async Task Adds762x25ToMarlinMxlrMagazine()
+    {
+        var mag = ItemWithAmmoContainer("mag_m1895_marlin_mxlr_784x49_5", isChamber: false, "67c540c3d0538d12ec036c08");
+        var items = new Dictionary<MongoId, TemplateItem> { [new MongoId(MxlrMagId)] = mag };
+
+        await BuildPlugin(items).OnLoadAsync(CancellationToken.None);
+
+        var filter = AmmoFilterOf(mag, isChamber: false);
+        Assert.Contains(new MongoId("67c540c3d0538d12ec036c08"), filter);
+        foreach (string id in Caliber762x25AmmoIds)
+        {
+            Assert.Contains(new MongoId(id), filter);
+        }
+        Assert.Equal(1 + Caliber762x25AmmoIds.Length, filter.Count);
+    }
+
+    [Fact]
+    public async Task AddsMarlinMxlrMagazineToToyGunMagazineSlot()
+    {
+        var gun = ItemWithSlot("weapon_ussr_pd_20x1mm", "mod_magazine", ToyGunMagId);
+        var items = new Dictionary<MongoId, TemplateItem> { [new MongoId(ToyGunId)] = gun };
+
+        await BuildPlugin(items).OnLoadAsync(CancellationToken.None);
+
+        var filter = FilterOf(gun, "mod_magazine");
+        Assert.Contains(new MongoId(ToyGunMagId), filter);
+        Assert.Contains(new MongoId(MxlrMagId), filter);
+        Assert.Equal(2, filter.Count);
+    }
+
     [Fact]
     public async Task MissingItemsDoNotThrow()
     {