This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
use crate::script_implementations::rune::wrappers::impl_rune_wrapper;
|
||||
use crate::static_data::{Nature, Statistic};
|
||||
use rune::Any;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub fn register(module: &mut rune::Module) -> anyhow::Result<()> {
|
||||
module.ty::<RuneNature>()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Debug, Any)]
|
||||
pub struct RuneNature(Arc<dyn Nature>);
|
||||
|
||||
impl_rune_wrapper!(&Arc<dyn Nature>, RuneNature);
|
||||
|
||||
impl RuneNature {
|
||||
#[rune::function]
|
||||
pub fn increased_stat(&self) -> Statistic { self.0.increased_stat() }
|
||||
|
||||
#[rune::function]
|
||||
pub fn decreased_stat(&self) -> Statistic { self.0.decreased_stat() }
|
||||
|
||||
#[rune::function]
|
||||
pub fn increased_modifier(&self) -> f32 { self.0.increased_modifier() }
|
||||
|
||||
#[rune::function]
|
||||
pub fn decreased_modifier(&self) -> f32 { self.0.decreased_modifier() }
|
||||
|
||||
#[rune::function]
|
||||
pub fn get_stat_modifier(&self, stat: Statistic) -> f32 { self.0.get_stat_modifier(stat) }
|
||||
}
|
||||
Reference in New Issue
Block a user