Powered by UE4SS lua scripts! This mod focuses primarily towards dedicated server. Some commands work on client-side, though results may vary depending on the game's replication system.
Download the latest releases here. Extract its contents to path/to/ue4ss/Mods/ directory. The Lua static modules are also available in the relase as shared.zip. Download and extract the contents into the path/to/ue4ss/Mods/shared directory.
-
Clone this repository into your
ue4ss/Modsdirectory.git -C <path/to/ue4ss/Mods> clone https://github.com/drpsyko101/MotorTownMods.git
For a full functionality of the mod, download and extract luasocket to path/to/ue4ss/Mods/shared directory to use the HTTP server. For webhook functionality or any instability while using the REST API, build Luasec either from source or using Luarocks for Win64. Install lua-bcrypt to enable server API authentication with bcrypt hashing algorithm.
The C++ module is included in the release. Any changes to the C++ files need a recompile.
This project supports cross-compiling to Windows from macOS/Linux using Nix. No Windows machine or Visual Studio required!
Prerequisites:
- Nix package manager with flakes enabled
Build Steps:
# Enter the development shell
nix develop
# Run the build (downloads MSVC headers automatically via xwin)
nix runYour compiled DLL will be at build-cross/MotorTownMods/MotorTownMods.dll.
Copy or symlink it to ue4ss/Mods/MotorTownMods/dlls/main.dll.
If you prefer building natively on Windows:
- Clone this repository
- Open the project in Visual Studio or use standard CMake commands
- Ensure Boost 1.87.0 is available (CMake will fetch it if not found)
- Build in Release mode
- Copy the DLL to
ue4ss/Mods/MotorTownMods/dlls/main.dll
This project includes Lua type definitions for IDE IntelliSense support.
See docs/LuaTypeAnnotations.md for setup and usage.
Quick start:
- Enter dev shell:
nix develop(createstypes/ue4sssymlink) - Install Lua extension in VSCode
- Open MTDediMod as your workspace root
Most of the server settings can be configured using environment variables:
| Variable name | Default value | Description |
|---|---|---|
MOD_MANAGEMENT_PORT |
5000 |
Management port. Used for managing mods in the dedicated server |
MOD_SERVER_PORT |
5001 |
Lua HTTP port. This only applies if luasocket module is installed |
MOD_SERVER_PROCESS_AMOUNT |
5 | The amount of cumulative connection to process. Higher number correspond to quicker response, in return slower event hook. |
MOD_SERVER_LOG_LEVEL |
2 | The server log level. 0=ERROR, 1=WARNING, 2=INFO, 3=VERBOSE, 4=DEBUG |
MOD_WEBHOOK_URL |
none | Webhook URL to send the events to. Requires luasec to function |
MOD_WEBHOOK_METHOD |
POST |
Webhook request method |
MOD_WEBHOOK_EXTRA_HEADERS |
none | Webhook extra headers in a JSON object |
MOD_WEBHOOK_ENABLE_EVENTS |
all |
Enable event hook individually. See webhook documentation for a complete list. |
MOD_SERVER_API_URL |
none | Server API to call from client side |
MOD_SERVER_PASSWORD |
none | Authenticate server request with Authorization: Basic header |
MOD_SERVER_SEND_PARTIAL |
none | Limit server response chunks to 40 bytes (Set to true for older luasocket compatibility) |
MOD_AUTO_FPS_ENABLE |
none | Enable automatic server traffic adjustment based on the server's FPS |
Due to the webserver being ran on a separate thread, a stop command must be issued before reloading the mods.
- Send POST
/stopto theMOD_SERVER_PORTserver. A messageWebserver stoppedwill show up in theUE4SS.logindicating the webserver has stopped. - Send POST
/mods/reloadto theMOD_SERVER_PORTserver. This will reload all the Lua mods including this mod.
More detailed instructions can be found in the docs.
This repository uses an automated CI/CD pipeline via GitHub Actions to manage releases and compiled binaries.
We use a branch-based versioning system. All official releases are maintained on branches named release/v<number> (e.g., release/v19).
masterbranch: Used for active development of Lua scripts and C++ source code.release/*branches: Used for stable deployments. These branches contain both the Lua scripts and the pre-compileddlls/main.dll.
When a push occurs on any branch matching release/*:
- GitHub Actions triggers the
Build and Releaseworkflow. - It sets up a Windows environment with the necessary MSVC toolset and
xmake. - The project is compiled into a
ShippingDLL. - The compiled DLL is then automatically committed and pushed back to the same release branch.
- A GitHub Release is created/updated with the packaged zip artifacts.
Binary files, specifically dlls/main.dll, are tracked using Git LFS. Ensure you have Git LFS installed locally if you intend to work with these files:
git lfs installMore contributions are welcomed! Read how to contribute here.