generated from bitsquid_dt/dt-plugin-template
All checks were successful
build Build for the target platform
lint/clippy Check for common mistakes and opportunities for code improvement
Also implements logging through the common `log` macros.
30 lines
674 B
Rust
30 lines
674 B
Rust
use log::info;
|
|
|
|
use crate::{LUA, MODULE_NAME, PLUGIN_NAME, global, lua};
|
|
|
|
pub(crate) struct Plugin {}
|
|
|
|
impl Plugin {
|
|
pub fn new() -> Self {
|
|
Self {}
|
|
}
|
|
|
|
pub fn setup_game(&self) {
|
|
info!("[setup_game] Hello, world! This is {}!", PLUGIN_NAME);
|
|
|
|
let lua = global!(LUA);
|
|
lua.add_module_function(MODULE_NAME, "do_something", lua::do_something);
|
|
}
|
|
|
|
pub fn shutdown_game(&self) {
|
|
info!("[shutdown_game] Goodbye, world!");
|
|
}
|
|
|
|
pub fn update_game(&self, _dt: f32) {}
|
|
}
|
|
|
|
impl std::fmt::Debug for Plugin {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
f.write_str("PluginApi")
|
|
}
|
|
}
|