Your first native mod
A native mod is one flat Rust project that implements mod_api::Hooks, built by the launcher into the game it runs in. You need the launcher and a Horizon commit to build against.
From the modding book of arismoko/horizonbfbda6a
Make the project:
cargo horizon-mod new my_mod --template nativeIt writes
horizon-mod.toml(the manifest, with the exact build pins under[native]),Cargo.tomlandsrc/lib.rs, which implements one hook.Look at the hook. Each method of
Hooksis a hook point; implement the ones the mod needs. Everyimpl Hookscarries#[mod_api::horizon_mod], which subscribes the mod to just the methods in that block:#[mod_api::horizon_mod] impl Hooks for Mod { fn server_tick(&self, host: &mut dyn ServerHost, _: &mut ServerTickEvent<'_>) { let _ = count(host); } }- Build and run it in the launcher:
horizon-launcher native-build . --instance <instance> --trust-native-code. Add--profile developerwhile developing for an unoptimized game crate. The choice is remembered for that instance.
Next: Native mods for what the launcher does, Trait mods for Parts and attachments, and Injections for the moment no hook covers.
Edit this page on GitHub · Spotted something wrong? Open an issue .