41 lines
999 B
Rust
41 lines
999 B
Rust
use crate::app_interface::list::ImmutableList;
|
|
use crate::app_interface::{DynamicLibrary, EffectParameter};
|
|
use crate::handling::ScriptCapabilities;
|
|
use crate::{ExternRef, TurnChoice};
|
|
use core::ffi::c_void;
|
|
use core::fmt::Debug;
|
|
|
|
pub trait Script {
|
|
fn new() -> Self
|
|
where
|
|
Self: Sized;
|
|
fn destroy(&self);
|
|
fn get_name(&self) -> &str;
|
|
fn get_capabilities(&self) -> &[ScriptCapabilities];
|
|
|
|
fn on_initialize(
|
|
&self,
|
|
_library: &DynamicLibrary,
|
|
_parameters: Option<ImmutableList<EffectParameter>>,
|
|
) {
|
|
}
|
|
fn on_before_turn(&self, _choice: TurnChoice) {}
|
|
}
|
|
|
|
impl Debug for dyn Script {
|
|
fn fmt(&self, _f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
|
core::fmt::Result::Ok(())
|
|
}
|
|
}
|
|
|
|
pub trait OwnerGetter {
|
|
fn get_owner<T>(&self) -> Option<ExternRef<T>> {
|
|
unimplemented!()
|
|
}
|
|
}
|
|
|
|
#[cfg(not(feature = "mock_data"))]
|
|
extern "wasm" {
|
|
pub fn get_script_owner(pointer: *const c_void) -> ExternRef<u8>;
|
|
}
|