Compare commits

...

3 commits

Author SHA1 Message Date
27c2450f41
fix README 2020-02-25 20:15:58 +01:00
2e96d585a3
show on_any 2020-02-25 20:04:17 +01:00
aa541e3bf9
bump version 2020-02-25 20:04:03 +01:00
3 changed files with 8 additions and 4 deletions

View file

@ -4,7 +4,7 @@ description = "Stubs for creating a TES3MP server plugin"
readme = "README.md"
keywords = ["tes3mp", "morrowind"]
homepage = "https://git.cijber.net/teamnwah/tes3mp-rs"
version = "0.1.0"
version = "0.1.1"
license = "AGPL-3.0-or-later"
authors = ["eater <=@eater.me>"]
edition = "2018"

View file

@ -11,7 +11,7 @@ cd crate-dir
git status || git init
mkdir extern
git submodule add https://git.cijber.net/teamnwah/tes3mp-rs.git extern/tes3mp-rs
ln -s extern/tes3mp-rs/tes3mp-plugin/src/plugin src/plugin
ln -s ../extern/tes3mp-rs/tes3mp-plugin/src/plugin src/plugin
```
This will make the `plugin` like it's part of your crate, which allows us to export the C symbols
@ -47,4 +47,4 @@ impl Events for Server {
use_events!(Server);
```
the `Events` trait has all the events that exist for the server, implement as needed
the `Events` trait has all the events that exist for the server, implement as needed

View file

@ -1,4 +1,4 @@
use crate::plugin::Events;
use crate::plugin::{Events, LOG_INFO};
mod plugin;
@ -9,6 +9,10 @@ impl Events for Server {
Server
}
fn on_any(&self, event: &str) {
plugin::log_message(LOG_INFO, format!("Event triggered: {}", event).as_str());
}
fn on_server_init(&self) {
plugin::log_message(plugin::LOG_WARN, "Hello from Rust :3");
}