NodeMod – CSRetro
NodeMod embeds a Node.js runtime in the Metamod plugin loaded by CSRetro, so server logic can be written in TypeScript or JavaScript. Project history and attribution: Credits (nodemod-goldsrc).
Setup
NodeMod is vendored at 3rdparty/nodemod/ (full source in this repository). The build:full command handles the build and install automatically.
Manual / incremental NodeMod install
# Full build installs Metamod + NodeMod + (with npm) @nodemod/admin / csr_botmenu:
./tools.sh build:full
# After build:release, refresh addons + optional npm pipeline only (no engine rebuild):
./tools.sh install:addons
See Building (section Metamod, NodeMod, and npm plugins) for presets and ENABLE_NODEMOD_PIPELINE.
Directory structure (runtime)
After build:full, NodeMod files appear in game-test/cstrike/addons/nodemod/:
cstrike/addons/nodemod/
├── dlls/
│ └── libcsr_nodemod.so ← Metamod plugin (may also appear as libnodemod.so legacy name)
├── configs/
│ ├── plugins.ini ← NodeMod plugin list
│ └── users.ini ← Admin user database (optional)
└── plugins/ ← TypeScript/JS plugin workspace
├── package.json
├── node_modules/
├── packages/
│ └── admin/ ← symlink → node_modules/@nodemod/admin
├── src/ ← Plugin source files (*.plugin.ts)
└── dist/ ← Compiled plugin JS
csr_botmenu Plugin
The csr_botmenu plugin provides an in-game bot management menu.
It is part of @nodemod/admin and lives at:
3rdparty/nodemod/packages/admin/src/csr_botmenu.plugin.ts
It is built as part of the NodeMod TypeScript pipeline in build:full.
Enabling csr_botmenu
- Ensure
build:fullhas run (NodeMod and the plugin are installed automatically). - In-game, use the default binds:
h– command menup– bot menu
Adding csr_botmenu to NodeMod config
build:full / build:release (via do_install_to_test) refresh NodeMod configs/plugins.ini; the csr_botmenu line is ensured when the npm pipeline runs (build:full or install:addons with ENABLE_NODEMOD_PIPELINE=1).
To add manually:
; cstrike/addons/nodemod/configs/plugins.ini
csr_botmenu
TypeScript pipeline
The ENABLE_NODEMOD_PIPELINE environment variable controls whether build:full runs the npm/TypeScript pipeline:
ENABLE_NODEMOD_PIPELINE=0 ./tools.sh build:full # Skip npm/TS build
The pipeline:
- Builds
@nodemod/coreand@nodemod/adminfrom3rdparty/nodemod/packages/ - Patches plugin
package.jsonto use the local vendored@nodemod/admin - Runs
npm install && npm run buildin the plugins directory
Admin commands (CSRetro)
@nodemod/admin registers many amx_* commands for compatibility with classic AMX Mod X workflows. Examples present in the vendored tree include:
| Command | Purpose |
|---|---|
amx_plugins |
List loaded NodeMod plugins (requires admin access). |
csr_botmenu |
Open ReGameDLL bot management menu (csr_botmenu.plugin.ts). |
amx_kickmenu, amx_banmenu, amx_slapmenu, … |
Admin menus (plmenu.plugin.ts and related). |
amx_botadd, amx_botdel, … |
Bot helper commands (potti.plugin.ts). |
Authoritative list: search registerCommand( under 3rdparty/nodemod/packages/admin/src/. Access flags (ADMIN_*) are defined in the admin package.
Troubleshooting
| Problem | Solution |
|---|---|
libcsr_nodemod.so / libnodemod.so missing |
Run ./tools.sh build:full or ./tools.sh install:addons; check NODEMOD_SKIP_BUILD, NODEMOD_SKIP_NATIVE, NODEMOD_SKIP_RELEASE_DL |
| npm build fails | Run npm install manually in 3rdparty/nodemod/; check Node.js version (18+) |
| Plugin not loading | Check logs/nodemod-build.log; verify configs/plugins.ini entry |
NodeMod not in plugins.ini |
Run ./tools.sh restore:libs to regenerate managed files |
See also
- NodeMod component — API, events, architecture
- Server administrators —
amx_plugins, listen-server admin