2024-04-07 16:55:41 +00:00
|
|
|
use crate::defines::LevelInt;
|
|
|
|
use crate::dynamic_data::Pokemon;
|
2024-04-13 08:47:40 +00:00
|
|
|
use crate::script_implementations::rune::wrappers::impl_rune_wrapper;
|
2024-04-07 16:55:41 +00:00
|
|
|
use rune::Any;
|
|
|
|
|
|
|
|
pub fn register(module: &mut rune::Module) -> anyhow::Result<()> {
|
|
|
|
module.ty::<RunePokemon>()?;
|
|
|
|
module.function_meta(RunePokemon::level)?;
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Any)]
|
2024-04-13 08:47:40 +00:00
|
|
|
pub struct RunePokemon(Pokemon);
|
2024-04-07 16:55:41 +00:00
|
|
|
|
|
|
|
impl RunePokemon {
|
|
|
|
#[rune::function]
|
2024-04-13 08:47:40 +00:00
|
|
|
fn level(&self) -> LevelInt { self.0.level() }
|
2024-04-07 16:55:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl_rune_wrapper!(&Pokemon, RunePokemon);
|