2.1 KiB
Weapon compatibility files
Some weapon mods ship (or admin tools can dump) a file listing which attachments, magazines
and rounds each weapon class accepts. SNAFU's is called
All classes and their attachments.json; the accepted shape is
{
"<any key>": [
{ "name": "SNAFU_AK12A", "attachments": [...], "magazines": [...], "bullets": [...] },
...
]
}
or a bare list of those objects. Several files can be given; entries merge by class name.
Abstract classes (*_Base) and Test_* / *_TEST entries are ignored.
Using it
python3 traderx_build.py build traderx.yaml --out ~/serverprofile/TraderX --compat snafu-compat.json
python3 traderx_build.py check traderx.yaml --compat snafu-compat.json --compat other-mod.json
1. Validation
Every weapon that has an entry in the compat data gets its configured attachments
checked. Classes that aren't attachable produce
warning: SNAFU_AK12A: not attachable according to compat file: TerjeStethoscope
They still build (the mod will list them on the Customize page, they just won't attach), so fix the source. Weapons without a compat entry are not checked.
2. Generation
Instead of listing attachments, reference the compat data:
- SNAFU_AK12A:
attachments: ["@compat", "@compat_mags"]
| Ref | Result |
|---|---|
@compat |
all compatible attachments that are products somewhere in your source |
@compat_mags |
all compatible magazines that are products in your source |
@compat_all |
everything compatible, creating hidden products at attachment_price for anything missing |
The "defined in your source" filter is what keeps this usable: a SNAFU rifle accepts
~80 attachment classes, but if you only sell 12 optics and 4 suppressors, @compat
resolves to exactly those. Combine with groups for hand-picked kits:
attachments: [ak_optics_tier1, "@compat_mags"]
Lookup
python3 traderx_build.py compat SNAFU_AK12A snafu-compat.json
prints the attachment / magazine / bullet lists for one class – handy when writing groups.