Skip to content

SNMetamorph/xash3d-nodemod

 
 

Repository files navigation

GS-NODEMOD

This is an integration of Node.js directly into GoldSrc, something like amxmodx (and my old luamod). Compatible with Xash3D FWGS too.

Features

  • high performance (with V8 engine)
  • asynchronous
  • lightness (JS is very light)
  • high support (npm modules and more JS code)

Directory structure

|-- /
|-- 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

Compilation

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

Installation and launch

⚠️ we are planning to move examples to another repository

  1. Install metamod in your game server
  2. Create a nodemod directory in addons
  3. Move all files from example to addons/nodemod
  4. Create the addons/nodemod/dlls directory
  5. Move the compiled libnodemod.so to the addons/nodemod/dlls directory
  6. In plugins.ini from metamod, add the line linux addons/nodemod/dlls/libnodemod.so
  7. Install npm or yarn and run the command npm i for npm or yarn for yarn in the addons/nodemod directory
  8. You can write your scripts in the 'addons/nodemod/src` directory.

TypeScript

you can run your typescript code using the ts-node library

  1. Install ts-node: npm i ts-node
  2. Pass there env variable to your start script: export NODE_OPTIONS="--loader ts-node/esm"
  3. Make sure that the main field is in your package.json leads to a TS file

RoadMap

  • Fix all existing crashes.
  • Write a @types/gs-nodemod library, for easy coding on typescript.

Credits

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 88.8%
  • JavaScript 9.0%
  • CMake 2.2%