This is an Metamod plugin for integrating Node.js directly into Half-Life 1 engine. Plugin is intended as a more functional and convenient replacement for AMX Mod X or LuaMod. Also, it is compatible with Xash3D FWGS too.
|-- /
|-- 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
- You should make sure that Metamod is already installed on your server
- Create a
nodemod
directory inaddons
- Move all files from
/example
toaddons/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 theaddons/nodemod
directory - You can place 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