Large amounts of work on Rune
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2024-05-08 15:46:09 +02:00
parent 4bc76b0ee4
commit 4ec07ca049
43 changed files with 979 additions and 397 deletions

View File

@@ -5,27 +5,32 @@ use std::sync::Arc;
pub fn register(module: &mut rune::Module) -> anyhow::Result<()> {
module.ty::<RuneNature>()?;
module.function_meta(RuneNature::increased_stat)?;
module.function_meta(RuneNature::decreased_stat)?;
module.function_meta(RuneNature::increased_modifier)?;
module.function_meta(RuneNature::decreased_modifier)?;
module.function_meta(RuneNature::get_stat_modifier)?;
Ok(())
}
#[derive(Debug, Any)]
pub struct RuneNature(Arc<dyn Nature>);
pub struct RuneNature(pub Arc<dyn Nature>);
impl_rune_wrapper!(&Arc<dyn Nature>, RuneNature);
impl RuneNature {
#[rune::function]
pub fn increased_stat(&self) -> Statistic { self.0.increased_stat() }
fn increased_stat(&self) -> Statistic { self.0.increased_stat() }
#[rune::function]
pub fn decreased_stat(&self) -> Statistic { self.0.decreased_stat() }
fn decreased_stat(&self) -> Statistic { self.0.decreased_stat() }
#[rune::function]
pub fn increased_modifier(&self) -> f32 { self.0.increased_modifier() }
fn increased_modifier(&self) -> f32 { self.0.increased_modifier() }
#[rune::function]
pub fn decreased_modifier(&self) -> f32 { self.0.decreased_modifier() }
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) }
fn get_stat_modifier(&self, stat: Statistic) -> f32 { self.0.get_stat_modifier(stat) }
}