1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! dotzuki-engine-script — an async JavaScript scripting engine (Boa-based) for games.
//!
//! Provides an async/await-based scripting system using Boa (a pure-Rust JS engine)
//! that replaces the hardcoded ScriptAction queue. Map scripts are written in
//! JavaScript and can `await` game operations like showText(), moveNpc(), etc.
//!
//! # Architecture
//!
//! ```text
//! JS Script (async fn)
//! │
//! ├─ await game.showText("...") ──► ScriptCommand::ShowText
//! │ ↑ Rust resolves promise when text dismissed
//! │
//! ├─ game.getFlag("GOT_STARTER") ──► synchronous bool return
//! │
//! └─ await game.startBattle("RIVAL") ──► ScriptCommand::StartBattle
//! ↑ Rust resolves promise with battle result
//! ```
//!
//! The game loop calls `ScriptEngine::tick()` each frame:
//! 1. If a pending command was resolved by Rust, `run_jobs()` drains the JS
//! microtask queue so the async function continues to its next `await`.
//! 2. If the script issues a new command, it's returned to the caller for dispatch.
//! 3. If no script is active, returns `None`.
pub use ScriptApiRegistrar;
pub use ;
pub use MapScriptConfig;
pub use CutsceneManager;
pub use ;
pub use ;