Skip to content
@factorio-rivets

Factorio Rivets

Factorio mod loader powered by Rust

Rivets 🔩

Welcome to Rivets, a Factorio mod loader written in Rust! Rivets injects code into the Factorio binary via DLL injection, providing a powerful toolset for modding and enhancing the game.

Mods written in Rivets have access to functionality not possible within the traditional Lua API.

  • Directly modifiy functionality in the compiled Factorio executable.
  • Add new prototypes such as LinkedRail.
  • Access to a huge library of crates via the Rust package manager.
  • Go blazingly fast with Rust memory safety guarantees and multithreading.
  • A superset of all the functionality possible within the vanilla Lua scripting language.

Features

  • Procedural Macros: Utilize idiomatic proc macros to overwrite or detour compiled Factorio functions.

Here is an example of how to detour the main function:

#[detour(main)]
fn main(argc: c_int, argv: *const c_char, envp: *const c_char) {
    info!("Detoured into main! 🦀🔩");
}

This will intercept the main function call and execute your custom logic, allowing you to modify the behavior of the game.

  • Seamless interop with Factorio Lua: Mods written with Rivets can easily subscribe to lua events, and call remote API's to share data with Factorio mods written in Lua.
#[on_event(defines::events::on_player_died)]
fn on_player_died(player_index: u32, cause: LuaEntity) {
    let player: LuaPlayer = game::get_player(player_index);
    player.print("You just lost the game 💀");
}
  • Leverage existing modding infrastructure: Rivets' design goal is to not reinvent the wheel. Mods written in Rust can be hosted on the offical Factorio modding website. Rivets is also designed to easily allow both Lua and Rust in the same Factorio mod.

Contributing

We are actively seeking contributors to help expand this project, particularly for adding Unix support. If you're interested in contributing, please fork the repository and submit a pull request.

Steps to Contribute:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature-branch)
  3. Make your changes
  4. Commit your changes (git commit -m 'Add some feature')
  5. Push to the branch (git push origin feature-branch)
  6. Open a pull request

We welcome contributions of all kinds, including bug fixes, new features, documentation improvements, and more. See our open issues if you are interested in becoming a contributor.

Credits

A huge thank-you to the following crates, without which this project would not be possible.

  • Retour - Allows directly modifying Factorio's ASM to detour functions.
  • DLL Syringe - Injects .DLL files into the Factorio executable.
  • PDB - Used to parse the .PDB file format and allows debug symbols to be read on Windows.
  • Gimli - Used to parse the .DWARF file format and allows debug symbols to be read on *nix systems.
  • Bindgen - Automatically generates Rust bindings for Factorio datatypes defined in the .pdb

License

This project is licensed under a custom license. See the license file for details. Any mods released using Rivets must have freely available source code.

1. Any modifications, adaptations, or derivative works (collectively "Mods")
   developed using the Software must be released under an open-source license
   as defined by the Open Source Initiative (OSI) (https://opensource.org/osd).

Contact

For any questions or support, please open an issue on GitHub or use GitHub discussions.


This project is not affiliated with or endorsed by the developers of Factorio.


Happy modding!

Pinned Loading

  1. rivets-rs rivets-rs Public

    Rivets is a Factorio mod loader written in Rust. Hook into compiled functions and change their behavior.

    Rust 9 3

Repositories

Showing 8 of 8 repositories
  • rivets-rs Public

    Rivets is a Factorio mod loader written in Rust. Hook into compiled functions and change their behavior.

    factorio-rivets/rivets-rs’s past year of commit activity
    Rust 9 3 1 1 Updated Aug 22, 2024
  • achievement-enabler Public

    This is a small Factorio mod that allows achievements to be unlocked even when /c or /editor is used. Powered by Rivets.

    factorio-rivets/achievement-enabler’s past year of commit activity
    Rust 1 MIT 0 0 1 Updated Aug 20, 2024
  • Factorio-Lua Public Forked from Rseding91/Factorio-Lua

    The (as of) May 19 2024 version of Lua that Factorio uses. Forked to work with MSVC

    factorio-rivets/Factorio-Lua’s past year of commit activity
    C 0 5 0 0 Updated Aug 17, 2024
  • rivets-factorio-mod Public

    Rivets is a Factorio mod loader written in Rust. Hook into compiled functions and change their behavior.

    factorio-rivets/rivets-factorio-mod’s past year of commit activity
    0 MIT 0 4 0 Updated Aug 16, 2024
  • rivets-injector Public

    A small windows application that injects the rivets.dll. Intended to be small, simple, and stable. Should be updated very infrequently.

    factorio-rivets/rivets-injector’s past year of commit activity
    Rust 0 0 0 0 Updated Aug 16, 2024
  • rivets-mod-template Public template Forked from fgardt/factorio-mod-template

    Factorio rivets mod template with automated changelog generation, packaging and releasing.

    factorio-rivets/rivets-mod-template’s past year of commit activity
    Rust 0 MIT 2 2 0 Updated Aug 13, 2024
  • rivets-ffi Public

    A tool designed to create rust FFI bindings for Factorio's compiled C++ classes, structs, and unions. Works by parsing the debug symbols contained in factorio.pdb

    factorio-rivets/rivets-ffi’s past year of commit activity
    Rust 0 0 1 0 Updated Aug 13, 2024
  • .github Public
    factorio-rivets/.github’s past year of commit activity
    0 0 0 0 Updated Aug 10, 2024