Skip to content

Game mods on a server: every table patch kept for the next start; a mod's items join the catalog - #357

Closed
Kharote wants to merge 3 commits into
mainfrom
feat/server-mod-tables
Closed

Kharote wants to merge 3 commits into
mainfrom
feat/server-mod-tables

Conversation

@Kharote

@Kharote Kharote commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

What this changes

A server can now ship a game mod, such as a Nexus mod with new clothes, hair or weapons, as a resource. The mod's files go in replace/, and its table patches keep their names.

  • Players' games: every table patch a resource ships (Libs/Tables/<folder>/<table>__<name>.xml) is kept per server and loaded with the game's own tables at the next start. Until now this worked for perk patches only. The game loads its item table and its clothing and hair table (CharacterComponent) through the same object-database loader as perks, so item__<mod>.xml and CharacterComponent__<mod>.xml now reach every player. The recipe and workpiece tables still load while the game runs. The restart notice now says "game data of its own (perks, items or clothing)".
  • Server:
    • When a resource starts, the rows of its item__*.xml patches join the item catalog (inventory/item_patches.cjs). Inventories, shops, stashes, the ground and Inventory.classes then take the mod's items by name or GUID.
    • A worn piece gets the slot of its clothing's armour type. That comes from the resource's CharacterComponent__*.xml (the nearest ArmorType of the clothing or the clothing it is nested in), or else from the game's clothing it wears or derives from.
    • A row with a game item's GUID changes that item, as the mod does in the game.
    • The server logs items ... added from item__<mod>.xml.
  • Catalog: build_catalog.py now also writes the game's clothing (armour type, covers feet, drop model), the slot of each armour type and the weapon classes by id. The rest of catalog.json is unchanged, rebuilt from the same game.

Guide: KCD-Synced/KCDS-DOCS, "Game mods: items, clothing and hair" in Sounds and game files.

How it was tested

  • item_patches.test.cjs, new, 2 tests:
    • A mod's sleeves derived from the game's brigandine sleeves land in sleeves.
    • A cloak nested under a clothing with ArmorType="Coat" lands in body_coat; drop models resolve.
    • A longsword row gets weaponClass: 'longsword' and its attack mods; stackable misc items stack.
    • A game row (bread) is replaced; NPC tools stay out; Inventory.add takes the new item.
    • A resource with lower-case replace/libs/tables/item/ starts and logs its items.
  • Inventory, recipe, item override, equipment slot, ground item, trade and progression tests: 125/125 pass. The guide tests pass against the docs branch.
  • runtime.table_patch (C++, new): patches of any table and depth are kept; whole tables, misplaced files and .. paths are not; recipe tables stay live. Built and run with clang 19: 3/3 pass.
  • Kit, one game, with a resource whose replace/Libs/Tables/item/item__kitmod.xml adds a hood (a game hood's row with a new GUID and name):
    • The server logged items kitmod_hood added from item__kitmod.xml.
    • First start: the client kept the patch "for the next start". player.equip('kitmod_hood') succeeded on the server, but the game drew nothing.
    • After a restart: 1 table patch(es) mounted ... loaded at this start. The same equip put the hood on, and it shows in third person.
    • The player's real kept tables were set aside for the test and restored after it.
  • Linux run of item_patches.test.cjs (Docker, node 22): 2/2. CI's first run failed on the case-sensitive file system with two folders of the same name in different case; fixed in the second commit.
  • format_source.py --check passes.

Checklist

  • I read CONTRIBUTING.md and agree that my contribution is licensed as it says.
  • The change is my own work: no code, assets or dumps that are not mine or that come from the game.
  • python Dev/tools/format_source.py --check passes.
  • Tests cover the change, and the checks of this pull request pass.
  • Public behaviour that changed is documented (KCD-Synced/KCDS-DOCS) or needs no docs.

…od's items join the catalog

A resource's replace/ table patches of any game table (Libs/Tables/<folder>/<table>__<name>.xml)
are now kept per server and loaded with the game's tables at the next start, not only perk
patches: a mod's items (item__<name>.xml) and its clothing and hair (CharacterComponent__<name>.xml)
reach every player like the game's own. The recipe and workpiece tables still load at once.

On the server the rows of a resource's item patches join the item catalog when it starts, so
inventories, shops, stashes and the ground take the mod's items. A worn piece gets the slot of its
clothing's armour type, from the resource's CharacterComponent patch or the game's clothing; a row
with a game item's GUID changes that item. The catalog now carries the game's clothing, the armour
type slots and the weapon classes for this.
@Kharote Kharote mentioned this pull request Nov 26, 2026
5 tasks done
@Kharote

Kharote commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Shipped in KCDS 1.2.3 through #358.

@Kharote Kharote closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants