dotzuki_engine_script/
lib.rs1#![cfg_attr(target_os = "none", no_std)]
32#![cfg_attr(target_os = "none", feature(prelude_import))]
33#![cfg_attr(target_os = "none", allow(internal_features))]
34
35extern crate alloc;
36
37#[allow(unused_imports)]
38mod alloc_prelude {
39 pub use core::prelude::v1::*;
40 pub use core::convert::{TryFrom, TryInto};
41 pub use alloc::borrow::ToOwned;
42 pub use core::iter::FromIterator;
43 pub use alloc::boxed::Box;
44 pub use alloc::format;
45 pub use alloc::string::{String, ToString};
46 pub use alloc::vec;
47 pub use alloc::vec::Vec;
48 pub use core::{assert_eq, assert_ne, matches, todo, unimplemented, write, writeln};
49 pub use core::debug_assert;
50}
51
52#[cfg_attr(target_os = "none", prelude_import)]
53#[allow(unused_imports)]
54use alloc_prelude::*;
55
56pub mod command;
57pub mod config;
58pub mod cutscene;
59
60#[cfg(feature = "script-boa")]
62pub mod api_registrar;
63#[cfg(feature = "script-boa")]
64pub mod engine;
65#[cfg(feature = "script-boa")]
66pub mod game_api;
67#[cfg(not(target_os = "none"))]
69pub mod loader;
70
71#[cfg(target_os = "none")]
76pub mod loader {
77 use crate::MapScriptConfig;
78
79 #[derive(Debug, Clone, Default)]
80 pub struct ScriptLoader;
81
82 #[derive(Debug)]
83 pub struct ScriptLoaderError;
84
85 impl ScriptLoader {
86 pub fn new() -> Self {
87 Self
88 }
89 pub fn register_script(&mut self, _map_id: &str, _source: &str) {}
90 pub fn register_config(&mut self, _map_id: &str, _config: MapScriptConfig) {}
91 pub fn register_config_json(
92 &mut self,
93 _map_id: &str,
94 _json: &str,
95 ) -> Result<(), String> {
96 Ok(())
97 }
98 pub fn get_script(&self, _map_id: &str) -> Option<&str> {
99 None
100 }
101 pub fn get_config(&self, _map_id: &str) -> Option<&MapScriptConfig> {
102 None
103 }
104 pub fn has_script(&self, _map_id: &str) -> bool {
105 false
106 }
107 pub fn has_config(&self, _map_id: &str) -> bool {
108 false
109 }
110 pub fn loaded_maps(&self) -> Vec<&str> {
111 Vec::new()
112 }
113 pub fn load_auto<T>(&mut self, _dirs: Option<T>) -> Result<usize, ScriptLoaderError> {
114 Ok(0)
115 }
116 }
117}
118
119#[cfg(feature = "embedded-scripts")]
120mod embedded_scripts {
121 include!(concat!(env!("OUT_DIR"), "/embedded_scripts.rs"));
122}
123
124#[cfg(all(test, feature = "script-boa"))]
125mod tests;
126
127pub use command::{CommandResult, ScriptCommand};
128pub use config::MapScriptConfig;
129pub use cutscene::CutsceneManager;
130#[cfg(feature = "script-boa")]
131pub use api_registrar::ScriptApiRegistrar;
132#[cfg(feature = "script-boa")]
133pub use engine::{BridgeView, ScriptEngine, ScriptEngineError};
134#[cfg(not(target_os = "none"))]
135pub use loader::{ScriptLoader, ScriptLoaderError};
136#[cfg(target_os = "none")]
137pub use loader::{ScriptLoader, ScriptLoaderError};