This is an integration of Node.js directly into GoldSrc, something like amxmodx (and my old luamod). Compatible with Xash3D FWGS too.
- high performance (with V8 engine)
- asynchronous
- lightness (JS is very light)
- high support (npm modules and more JS code)
|-- /
|-- deps # 3rdparty dependencies
|-- scripts # auxiliary scripts (generating the autocode)
|-- src # nodemod source files
| |-- auto # auto-generated code
| | |-- dll_events.cpp # events from gamedll
| | |-- engine_events.cpp # events from engine
| | |-- engine_functions.cpp # bindings to engine methods
| |-- lib # nodemod library external api to metamod
| |-- node # v8 and nodejs internal code and api
| |-- structures # structures between engine and jscode
| |-- bindings # util methods and core functional, passed to JS
Disclaimer: for now, Nodemod locked for only x86 architecture. In future we plans to support other architectures too.
Pre-installing dependencies
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install gcc-multilib g++-multilib cmake ninja-build
Building instruction
git clone --recursive https://github.com/TheEVolk/xash3d-nodemod.git
cd xash3d-nodemod
cmake -E make_directory build
cd build
cmake .. --preset linux-x86-debug
cmake --build . --config Debug
⚠️ we are planning to move examples to another repository
- Install metamod in your game server
- Create a nodemod directory in addons
- Move all files from example to
addons/nodemod
- Create the
addons/nodemod/dlls
directory - Move the compiled libnodemod.so to the
addons/nodemod/dlls
directory - In plugins.ini from metamod, add the line
linux addons/nodemod/dlls/libnodemod.so
- Install npm or yarn and run the command
npm i
for npm oryarn
for yarn in the addons/nodemod directory - You can write your scripts in the 'addons/nodemod/src` directory.
you can run your typescript code using the ts-node library
- Install ts-node:
npm i ts-node
- Pass there env variable to your start script:
export NODE_OPTIONS="--loader ts-node/esm"
- Make sure that the main field is in your package.json leads to a TS file
- Fix all existing crashes.
- Write a
@types/gs-nodemod
library, for easy coding on typescript.
- iAmir (Amyr Aahmady) for his samp-node project.
- TheEVolk (Maksim Nikiforov) that's me.
- SNMetamorph for moving code to C++17 and build system refactoring