Gen7ScriptsRs/gen_7_scripts/src/registered_scripts.rs

42 lines
1.0 KiB
Rust

use crate::test_script::TestScript;
use alloc::boxed::Box;
use pkmn_lib_interface::app_interface::{get_hash, StringKey};
use pkmn_lib_interface::handling::{Script, ScriptCategory};
macro_rules! resolve_match {
(
$mid:expr,
$(
$key:expr => $script:ident,
)*
) => (
match $mid {
$(
const { get_hash($key) } => {
return Some(Box::new($script {}))
}
)*
_ => {}
}
)
}
pub fn get_script(category: ScriptCategory, name: &StringKey) -> Option<Box<dyn Script>> {
match category {
ScriptCategory::Move => {
resolve_match!(
name.hash(),
b"test" => TestScript,
);
}
ScriptCategory::Ability => {}
ScriptCategory::Status => {}
ScriptCategory::Pokemon => {}
ScriptCategory::Battle => {}
ScriptCategory::Side => {}
ScriptCategory::ItemBattleTrigger => {}
}
None
}