FFI for dynamic libraries
This commit is contained in:
@@ -3,12 +3,12 @@ use std::sync::Arc;
|
||||
|
||||
use crate::dynamic_data::{ItemScript, Script, ScriptOwnerData};
|
||||
use crate::static_data::Item;
|
||||
use crate::{PkmnResult, StringKey};
|
||||
use crate::{PkmnResult, StringKey, ValueIdentifiable, ValueIdentifier};
|
||||
|
||||
/// A script resolver deals with the resolving of scripts. These scripts are non-hardcoded
|
||||
/// implementations of different effects in Pokemon. This allows for things such as generational
|
||||
/// differences, and custom implementations.
|
||||
pub trait ScriptResolver: Debug {
|
||||
pub trait ScriptResolver: Debug + ValueIdentifiable {
|
||||
/// Loads a standard script with a given unique combination of category and key. If no script
|
||||
/// can be created with this combination, returns None.
|
||||
fn load_script(
|
||||
@@ -55,7 +55,16 @@ pub enum ScriptCategory {
|
||||
|
||||
/// A basic empty script resolver, that always returns None.
|
||||
#[derive(Debug)]
|
||||
pub struct EmptyScriptResolver {}
|
||||
pub struct EmptyScriptResolver {
|
||||
/// A unique identifier so we know what value this is.
|
||||
pub identifier: ValueIdentifier,
|
||||
}
|
||||
|
||||
impl ValueIdentifiable for EmptyScriptResolver {
|
||||
fn value_identifier(&self) -> ValueIdentifier {
|
||||
self.identifier
|
||||
}
|
||||
}
|
||||
|
||||
impl ScriptResolver for EmptyScriptResolver {
|
||||
fn load_script(
|
||||
|
||||
Reference in New Issue
Block a user